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.esm.js
CHANGED
|
@@ -1009,12 +1009,25 @@ var calculateTotalPercentageFees = function (allFees, cte, allFeesForCalc, preCa
|
|
|
1009
1009
|
// Calcular fees percentuais iterativamente até convergir
|
|
1010
1010
|
var maxIterations = 10;
|
|
1011
1011
|
var tolerance = 0.01; // Tolerância de 1 centavo
|
|
1012
|
-
// Inicializar com valores zerados
|
|
1012
|
+
// Inicializar com valores zerados ou pré-calculados
|
|
1013
1013
|
var previousValues = new Map();
|
|
1014
|
-
percentageFees.forEach(function (pf) {
|
|
1014
|
+
percentageFees.forEach(function (pf) {
|
|
1015
|
+
// Se existe valor pré-calculado (editado manualmente), usar ele
|
|
1016
|
+
var preCalcValue = preCalculatedValues === null || preCalculatedValues === void 0 ? void 0 : preCalculatedValues.get(pf.fee.id);
|
|
1017
|
+
previousValues.set(pf.fee.id, preCalcValue !== undefined ? preCalcValue : 0);
|
|
1018
|
+
});
|
|
1015
1019
|
var _loop_1 = function (iteration) {
|
|
1016
1020
|
// Calcular cada fee percentual com base nos valores atuais das outras
|
|
1017
1021
|
percentageFees.forEach(function (pf) {
|
|
1022
|
+
// Se esta fee tem valor pré-calculado (foi editada manualmente), não recalcular
|
|
1023
|
+
var preCalcValue = preCalculatedValues === null || preCalculatedValues === void 0 ? void 0 : preCalculatedValues.get(pf.fee.id);
|
|
1024
|
+
if (preCalcValue !== undefined) {
|
|
1025
|
+
// Manter o valor editado manualmente
|
|
1026
|
+
previousValues.set(pf.fee.id, preCalcValue);
|
|
1027
|
+
// Armazenar resultado com valor editado
|
|
1028
|
+
results.set(pf.fee.id, __assign(__assign({}, pf), { totalFee: preCalcValue, totalToCalc: preCalcValue, resultFee: "".concat(convertNumberToCurrency(preCalcValue, 'pt-br'), " (editado manualmente)") }));
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1018
1031
|
// Calcular base: fees não-percentuais + outras fees percentuais (exceto ela mesma)
|
|
1019
1032
|
var basePercentage = Array.from(previousValues.entries())
|
|
1020
1033
|
.filter(function (_a) {
|
package/build/index.esm.js.gz
CHANGED
|
Binary file
|