b2m-utils 0.0.268 → 0.0.270
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/enums/FeeCalculationTypeEnum.d.ts +2 -1
- package/build/enums/FeeEnum.d.ts +4 -1
- package/build/index.esm.js +32 -10
- package/build/index.esm.js.gz +0 -0
- package/build/index.esm.js.map +1 -1
- package/build/index.js +32 -10
- package/build/index.js.gz +0 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/enums/FeeEnum.d.ts
CHANGED
|
@@ -18,5 +18,8 @@ export declare enum FeeEnum {
|
|
|
18
18
|
FREIGHT_RODO_FIXED_VALUE = 143,
|
|
19
19
|
COLLECT = 151,
|
|
20
20
|
COLLECT_PERCENTAGE_TOTAL = 152,
|
|
21
|
-
COLLECT_REVERSE_PERCENTAGE_TOTAL = 153
|
|
21
|
+
COLLECT_REVERSE_PERCENTAGE_TOTAL = 153,
|
|
22
|
+
TRT_PERCENTAGE_TOTAL = 169,
|
|
23
|
+
TDA_PERCENTAGE_TOTAL = 170,
|
|
24
|
+
TDE_PERCENTAGE_TOTAL = 171
|
|
22
25
|
}
|
package/build/index.esm.js
CHANGED
|
@@ -144,6 +144,7 @@ var FeeCalculationTypeEnum;
|
|
|
144
144
|
FeeCalculationTypeEnum[FeeCalculationTypeEnum["TOTAL_PERCENTAGE"] = 9] = "TOTAL_PERCENTAGE";
|
|
145
145
|
FeeCalculationTypeEnum[FeeCalculationTypeEnum["MIN_VALUE"] = 10] = "MIN_VALUE";
|
|
146
146
|
FeeCalculationTypeEnum[FeeCalculationTypeEnum["SUM_CONTAINERS"] = 11] = "SUM_CONTAINERS";
|
|
147
|
+
FeeCalculationTypeEnum[FeeCalculationTypeEnum["VOLUMES_QUANTITY"] = 12] = "VOLUMES_QUANTITY";
|
|
147
148
|
})(FeeCalculationTypeEnum || (FeeCalculationTypeEnum = {}));
|
|
148
149
|
|
|
149
150
|
var FeeCategoryEnum;
|
|
@@ -181,6 +182,9 @@ var FeeEnum;
|
|
|
181
182
|
FeeEnum[FeeEnum["COLLECT"] = 151] = "COLLECT";
|
|
182
183
|
FeeEnum[FeeEnum["COLLECT_PERCENTAGE_TOTAL"] = 152] = "COLLECT_PERCENTAGE_TOTAL";
|
|
183
184
|
FeeEnum[FeeEnum["COLLECT_REVERSE_PERCENTAGE_TOTAL"] = 153] = "COLLECT_REVERSE_PERCENTAGE_TOTAL";
|
|
185
|
+
FeeEnum[FeeEnum["TRT_PERCENTAGE_TOTAL"] = 169] = "TRT_PERCENTAGE_TOTAL";
|
|
186
|
+
FeeEnum[FeeEnum["TDA_PERCENTAGE_TOTAL"] = 170] = "TDA_PERCENTAGE_TOTAL";
|
|
187
|
+
FeeEnum[FeeEnum["TDE_PERCENTAGE_TOTAL"] = 171] = "TDE_PERCENTAGE_TOTAL";
|
|
184
188
|
})(FeeEnum || (FeeEnum = {}));
|
|
185
189
|
|
|
186
190
|
var FreightRegionEnum;
|
|
@@ -520,7 +524,7 @@ var filterSiblingFees = function (fees) {
|
|
|
520
524
|
};
|
|
521
525
|
|
|
522
526
|
var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCalc) {
|
|
523
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
527
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
524
528
|
if (debug === void 0) { debug = false; }
|
|
525
529
|
if (ratecardLaneFee.fee) {
|
|
526
530
|
// Buscar o ratecard correto do CTE usando getRatecardFromCte
|
|
@@ -596,7 +600,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
596
600
|
if (totalValueFromAllFees && !isNaN(+totalValueFromAllFees)) {
|
|
597
601
|
var valueToMultiply = (+value / 100);
|
|
598
602
|
var total_1 = +totalValueFromAllFees * valueToMultiply;
|
|
599
|
-
var
|
|
603
|
+
var _j = applyRedeliveryMultiplier(total_1, cte), adjustedTotal_1 = _j.adjustedTotal, redeliveryInfo_1 = _j.redeliveryInfo;
|
|
600
604
|
total_1 = adjustedTotal_1;
|
|
601
605
|
var totalValueFromAllFeesCurrency = convertNumberToCurrency(+totalValueFromAllFees, 'pt-br');
|
|
602
606
|
var resultCurrency_1 = (+total_1).toLocaleString('pt-BR', {
|
|
@@ -619,7 +623,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
619
623
|
var shouldApplyFraction = +cte.taxedWeight > minWeightForFraction;
|
|
620
624
|
var fractions = shouldApplyFraction ? Math.ceil(+cte.taxedWeight / 100) : 1;
|
|
621
625
|
var total_2 = fractions * value;
|
|
622
|
-
var
|
|
626
|
+
var _k = applyRedeliveryMultiplier(total_2, cte), adjustedTotal_2 = _k.adjustedTotal, redeliveryInfo_2 = _k.redeliveryInfo;
|
|
623
627
|
total_2 = adjustedTotal_2;
|
|
624
628
|
var valueCurrency_1 = (+value).toLocaleString('pt-br', {
|
|
625
629
|
style: 'currency',
|
|
@@ -640,7 +644,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
640
644
|
if (value && (cte === null || cte === void 0 ? void 0 : cte.freightValue)) {
|
|
641
645
|
if (!isNaN(+value) && !isNaN(+cte.freightValue)) {
|
|
642
646
|
var total_3 = +cte.freightValue * (+value / 100);
|
|
643
|
-
var
|
|
647
|
+
var _l = applyRedeliveryMultiplier(total_3, cte), adjustedTotal_3 = _l.adjustedTotal, redeliveryInfo_3 = _l.redeliveryInfo;
|
|
644
648
|
total_3 = adjustedTotal_3;
|
|
645
649
|
var freightValueCurrency = (+cte.freightValue).toLocaleString('pt-br', {
|
|
646
650
|
style: 'currency',
|
|
@@ -675,7 +679,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
675
679
|
case FeeCalculationTypeEnum.MIN_VALUE:
|
|
676
680
|
case FeeCalculationTypeEnum.FIXED:
|
|
677
681
|
var total = +value;
|
|
678
|
-
var
|
|
682
|
+
var _m = applyRedeliveryMultiplier(total, cte), adjustedTotal = _m.adjustedTotal, redeliveryInfo = _m.redeliveryInfo;
|
|
679
683
|
total = adjustedTotal;
|
|
680
684
|
var valueCurrency = (+value).toLocaleString('pt-br', {
|
|
681
685
|
style: 'currency',
|
|
@@ -727,7 +731,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
727
731
|
// Somar ao total
|
|
728
732
|
total_4 += additionalValue;
|
|
729
733
|
// Aplicar multiplicador de redelivery ao valor final
|
|
730
|
-
var
|
|
734
|
+
var _o = applyRedeliveryMultiplier(total_4, cte), adjustedTotal_4 = _o.adjustedTotal, redeliveryInfo_4 = _o.redeliveryInfo;
|
|
731
735
|
total_4 = adjustedTotal_4;
|
|
732
736
|
var valueCurrency_2 = (+highestIntervalFee.value).toLocaleString('pt-br', {
|
|
733
737
|
style: 'currency',
|
|
@@ -769,7 +773,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
769
773
|
// Somar ao total
|
|
770
774
|
total_5 += additionalValue;
|
|
771
775
|
// Aplicar multiplicador de redelivery ao valor final
|
|
772
|
-
var
|
|
776
|
+
var _p = applyRedeliveryMultiplier(total_5, cte), adjustedTotal_5 = _p.adjustedTotal, redeliveryInfo_5 = _p.redeliveryInfo;
|
|
773
777
|
total_5 = adjustedTotal_5;
|
|
774
778
|
var valueCurrency_3 = (+highestIntervalFee.value).toLocaleString('pt-br', {
|
|
775
779
|
style: 'currency',
|
|
@@ -789,7 +793,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
789
793
|
if (value) {
|
|
790
794
|
var commodityValue = (_d = cte === null || cte === void 0 ? void 0 : cte.commodityValue) !== null && _d !== void 0 ? _d : 0;
|
|
791
795
|
var total_6 = +commodityValue * (+value / 100);
|
|
792
|
-
var
|
|
796
|
+
var _q = applyRedeliveryMultiplier(total_6, cte), adjustedTotal_6 = _q.adjustedTotal, redeliveryInfo_6 = _q.redeliveryInfo;
|
|
793
797
|
total_6 = adjustedTotal_6;
|
|
794
798
|
var resultCurrency_6 = (+total_6).toLocaleString('pt-br', {
|
|
795
799
|
style: 'currency',
|
|
@@ -804,7 +808,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
804
808
|
if (value) {
|
|
805
809
|
var taxedWeight = (_e = cte === null || cte === void 0 ? void 0 : cte.taxedWeight) !== null && _e !== void 0 ? _e : 0;
|
|
806
810
|
var total_7 = +taxedWeight * +value;
|
|
807
|
-
var
|
|
811
|
+
var _r = applyRedeliveryMultiplier(total_7, cte), adjustedTotal_7 = _r.adjustedTotal, redeliveryInfo_7 = _r.redeliveryInfo;
|
|
808
812
|
total_7 = adjustedTotal_7;
|
|
809
813
|
var resultCurrency_7 = (+total_7).toLocaleString('pt-br', {
|
|
810
814
|
style: 'currency',
|
|
@@ -817,6 +821,21 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
817
821
|
resultFee = result_7;
|
|
818
822
|
}
|
|
819
823
|
break;
|
|
824
|
+
case FeeCalculationTypeEnum.VOLUMES_QUANTITY:
|
|
825
|
+
if (value && (cte === null || cte === void 0 ? void 0 : cte.commodityVolumes)) {
|
|
826
|
+
var commodityVolumes = (_f = cte.commodityVolumes) !== null && _f !== void 0 ? _f : 0;
|
|
827
|
+
var total_8 = +commodityVolumes * +value;
|
|
828
|
+
var _s = applyRedeliveryMultiplier(total_8, cte), adjustedTotal_8 = _s.adjustedTotal, redeliveryInfo_8 = _s.redeliveryInfo;
|
|
829
|
+
total_8 = adjustedTotal_8;
|
|
830
|
+
var resultCurrency_8 = (+total_8).toLocaleString('pt-br', {
|
|
831
|
+
style: 'currency',
|
|
832
|
+
currency: 'BRL',
|
|
833
|
+
});
|
|
834
|
+
var result_8 = "".concat(commodityVolumes, " ").concat(commodityVolumes === 1 ? 'volume' : 'volumes', " x ").concat(convertNumberToCurrency(+value, 'pt-br')).concat(redeliveryInfo_8, " = ").concat(resultCurrency_8);
|
|
835
|
+
totalFee = total_8;
|
|
836
|
+
resultFee = result_8;
|
|
837
|
+
}
|
|
838
|
+
break;
|
|
820
839
|
/*if (ratecardLaneFee.minWeight && cte?.taxedWeight) {
|
|
821
840
|
|
|
822
841
|
if (+ratecardLaneFee.minWeight <= +cte.taxedWeight) {
|
|
@@ -919,7 +938,7 @@ var calculateFee = function (ratecardLaneFee, cte, allFees, debug, allFeesForCal
|
|
|
919
938
|
return 0;
|
|
920
939
|
});
|
|
921
940
|
if ((siblingFeesResults === null || siblingFeesResults === void 0 ? void 0 : siblingFeesResults.length) > 0) {
|
|
922
|
-
if (((
|
|
941
|
+
if (((_g = siblingFeesResults[0]) === null || _g === void 0 ? void 0 : _g.totalFee) && ((_h = siblingFeesResults[0]) === null || _h === void 0 ? void 0 : _h.totalFee) > totalFee) {
|
|
923
942
|
totalToCalc = 0;
|
|
924
943
|
}
|
|
925
944
|
}
|
|
@@ -1025,10 +1044,13 @@ var getFilteredFeesToAudit = function (_a) {
|
|
|
1025
1044
|
FeeEnum.SUFRAMA,
|
|
1026
1045
|
FeeEnum.TDA_FREIGHT,
|
|
1027
1046
|
FeeEnum.TDA_MIN,
|
|
1047
|
+
FeeEnum.TDA_PERCENTAGE_TOTAL,
|
|
1028
1048
|
FeeEnum.TDE_FREIGHT,
|
|
1029
1049
|
FeeEnum.TDE_MIN,
|
|
1050
|
+
FeeEnum.TDE_PERCENTAGE_TOTAL,
|
|
1030
1051
|
FeeEnum.TRT_FREIGHT,
|
|
1031
1052
|
FeeEnum.TRT_MIN,
|
|
1053
|
+
FeeEnum.TRT_PERCENTAGE_TOTAL,
|
|
1032
1054
|
FeeEnum.RIVER_INSURANCE_COMMODITY_VALUE,
|
|
1033
1055
|
FeeEnum.RIVER_INSURANCE_MIN_VALUE,
|
|
1034
1056
|
FeeEnum.RIVER_REDISPATCH_COMMODITY_VALUE,
|
package/build/index.esm.js.gz
CHANGED
|
Binary file
|