b2m-utils 0.0.305 → 0.0.306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.esm.js +15 -2
- package/build/index.esm.js.gz +0 -0
- package/build/index.esm.js.map +1 -1
- package/build/index.js +15 -2
- package/build/index.js.gz +0 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1013,12 +1013,25 @@ var calculateTotalPercentageFees = function (allFees, cte, allFeesForCalc, preCa
|
|
|
1013
1013
|
// Calcular fees percentuais iterativamente até convergir
|
|
1014
1014
|
var maxIterations = 10;
|
|
1015
1015
|
var tolerance = 0.01; // Tolerância de 1 centavo
|
|
1016
|
-
// Inicializar com valores zerados
|
|
1016
|
+
// Inicializar com valores zerados ou pré-calculados
|
|
1017
1017
|
var previousValues = new Map();
|
|
1018
|
-
percentageFees.forEach(function (pf) {
|
|
1018
|
+
percentageFees.forEach(function (pf) {
|
|
1019
|
+
// Se existe valor pré-calculado (editado manualmente), usar ele
|
|
1020
|
+
var preCalcValue = preCalculatedValues === null || preCalculatedValues === void 0 ? void 0 : preCalculatedValues.get(pf.fee.id);
|
|
1021
|
+
previousValues.set(pf.fee.id, preCalcValue !== undefined ? preCalcValue : 0);
|
|
1022
|
+
});
|
|
1019
1023
|
var _loop_1 = function (iteration) {
|
|
1020
1024
|
// Calcular cada fee percentual com base nos valores atuais das outras
|
|
1021
1025
|
percentageFees.forEach(function (pf) {
|
|
1026
|
+
// Se esta fee tem valor pré-calculado (foi editada manualmente), não recalcular
|
|
1027
|
+
var preCalcValue = preCalculatedValues === null || preCalculatedValues === void 0 ? void 0 : preCalculatedValues.get(pf.fee.id);
|
|
1028
|
+
if (preCalcValue !== undefined) {
|
|
1029
|
+
// Manter o valor editado manualmente
|
|
1030
|
+
previousValues.set(pf.fee.id, preCalcValue);
|
|
1031
|
+
// Armazenar resultado com valor editado
|
|
1032
|
+
results.set(pf.fee.id, __assign(__assign({}, pf), { totalFee: preCalcValue, totalToCalc: preCalcValue, resultFee: "".concat(convertNumberToCurrency(preCalcValue, 'pt-br'), " (editado manualmente)") }));
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1022
1035
|
// Calcular base: fees não-percentuais + outras fees percentuais (exceto ela mesma)
|
|
1023
1036
|
var basePercentage = Array.from(previousValues.entries())
|
|
1024
1037
|
.filter(function (_a) {
|
package/build/index.js.gz
CHANGED
|
Binary file
|