shareneus 1.6.28 → 1.6.29
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/dist/services/est.print-service.d.ts +1 -0
- package/dist/services/est.print-service.js +40 -30
- package/dist/services/ro-print-service.d.ts +1 -0
- package/dist/services/ro-print-service.js +22 -12
- package/dist/services/ro-totals.service.d.ts +1 -0
- package/dist/services/ro-totals.service.js +28 -18
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class EstPrintService {
|
|
2
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
|
|
2
3
|
static GetEstimatePrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any, OriginalEntityData: any, image: any, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, TaxCodes: any, OverallEst: boolean, SuppEstIndex: any, AsEstimated: boolean, isInitial: boolean, isReverse: boolean, Consolidate: boolean): any;
|
|
3
4
|
static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OverallEst: any, isInitial: boolean): any;
|
|
4
5
|
static GetPrintConditionsBasedOnInput(ROPrintData: any, IncludeGST: boolean, Payee: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, SType: any, Consolidate: boolean): any;
|
|
@@ -9,6 +9,16 @@ const my_date_1 = require("../utils/my-date");
|
|
|
9
9
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
10
10
|
const ro_totals_service_1 = require("./ro-totals.service");
|
|
11
11
|
class EstPrintService {
|
|
12
|
+
static GetTaxAmountFromGroup(item, taxGroupKey, taxCode, fallbackKey) {
|
|
13
|
+
const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
|
|
14
|
+
if (Array.isArray(groupedTaxes)) {
|
|
15
|
+
const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
16
|
+
if (matchedTaxes.length !== 0) {
|
|
17
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
|
|
21
|
+
}
|
|
12
22
|
static GetEstimatePrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, AsCustomerAndInsurance, AsInsuranceOrCustomer, TaxCodes, OverallEst, SuppEstIndex, AsEstimated, isInitial, isReverse, Consolidate) {
|
|
13
23
|
let ROPrintData = {};
|
|
14
24
|
let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
|
|
@@ -414,14 +424,14 @@ class EstPrintService {
|
|
|
414
424
|
ROPrintData.Ops.forEach((Labor) => {
|
|
415
425
|
// console.log('Labor', Labor);
|
|
416
426
|
Labor.NetAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.NetAmt, DecimalsNumber);
|
|
417
|
-
Labor.CCGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
418
|
-
Labor.CSGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
419
|
-
Labor.CIGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
427
|
+
Labor.CCGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
428
|
+
Labor.CSGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
429
|
+
Labor.CIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
420
430
|
Labor.Disc = tr_utils_1.TrUtils.FixPriceValue(Labor.Disc, DecimalsNumber);
|
|
421
431
|
Labor.AssPr = tr_utils_1.TrUtils.FixPriceValue(Labor.AssPr, DecimalsNumber);
|
|
422
|
-
Labor.ACGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
423
|
-
Labor.ASGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
424
|
-
Labor.AIGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
432
|
+
Labor.ACGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
433
|
+
Labor.ASGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
434
|
+
Labor.AIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
425
435
|
if (Consolidate) {
|
|
426
436
|
if (Labor.PBy === enums_1.PayTypeEnum.Customer) {
|
|
427
437
|
Labor.EstPr = tr_utils_1.TrUtils.FixPriceValue(Labor.CustAfterTax, DecimalsNumber);
|
|
@@ -436,9 +446,9 @@ class EstPrintService {
|
|
|
436
446
|
Labor.EstPr = tr_utils_1.TrUtils.FixPriceValue(Labor.EstPr, DecimalsNumber);
|
|
437
447
|
Labor.Pr = tr_utils_1.TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
438
448
|
}
|
|
439
|
-
Labor.ECGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
440
|
-
Labor.ESGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
441
|
-
Labor.EIGST = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
449
|
+
Labor.ECGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
450
|
+
Labor.ESGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
451
|
+
Labor.EIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
442
452
|
if (tr_utils_1.TrUtils.IsNull(Labor.CollId)) {
|
|
443
453
|
let LaborColli = {
|
|
444
454
|
_id: Labor._id,
|
|
@@ -457,15 +467,15 @@ class EstPrintService {
|
|
|
457
467
|
// console.log('Part', Part);
|
|
458
468
|
Part.NetAmt = tr_utils_1.TrUtils.FixPriceValue(Part.NetAmt, DecimalsNumber);
|
|
459
469
|
Part.UnAmt = tr_utils_1.TrUtils.FixPriceValue(Part.UnAmt, DecimalsNumber);
|
|
460
|
-
Part.CCGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
461
|
-
Part.CSGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
462
|
-
Part.CIGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
470
|
+
Part.CCGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
471
|
+
Part.CSGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
472
|
+
Part.CIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
463
473
|
Part.Disc = tr_utils_1.TrUtils.FixPriceValue(Part.Disc, DecimalsNumber);
|
|
464
474
|
Part.AssPr = tr_utils_1.TrUtils.FixPriceValue(Part.AssPr, DecimalsNumber);
|
|
465
475
|
Part.AssAmt = tr_utils_1.TrUtils.FixPriceValue(Part.AssAmt, DecimalsNumber);
|
|
466
|
-
Part.ACGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
467
|
-
Part.ASGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
468
|
-
Part.AIGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
476
|
+
Part.ACGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
477
|
+
Part.ASGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
478
|
+
Part.AIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
469
479
|
Part.EstPr = tr_utils_1.TrUtils.FixPriceValue(Part.EstPr, DecimalsNumber);
|
|
470
480
|
if (Consolidate) {
|
|
471
481
|
if (Part.PBy === enums_1.PayTypeEnum.Customer) {
|
|
@@ -482,9 +492,9 @@ class EstPrintService {
|
|
|
482
492
|
Part.UnPr = tr_utils_1.TrUtils.FixPriceValue(Part.UnPr, DecimalsNumber);
|
|
483
493
|
}
|
|
484
494
|
Part.EstAmt = tr_utils_1.TrUtils.FixPriceValue(Part.EstAmt, DecimalsNumber);
|
|
485
|
-
Part.ECGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
486
|
-
Part.ESGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
487
|
-
Part.EIGST = tr_utils_1.TrUtils.FixPriceValue(Part
|
|
495
|
+
Part.ECGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
496
|
+
Part.ESGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
497
|
+
Part.EIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
488
498
|
if (tr_utils_1.TrUtils.IsNull(Part.CollId)) {
|
|
489
499
|
let LaborIndex = ROPrintData.Ops.findIndex((Labor) => {
|
|
490
500
|
return Labor._id === Part.OpId;
|
|
@@ -828,9 +838,9 @@ class EstPrintService {
|
|
|
828
838
|
LaborList.forEach((Labor) => {
|
|
829
839
|
if (Labor.Sts === enums_1.LaborStatusEnum.New || Labor.Sts === enums_1.LaborStatusEnum.WtngForAppr) {
|
|
830
840
|
if (IncludeGST) {
|
|
831
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
832
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
833
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
841
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
842
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
843
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
834
844
|
}
|
|
835
845
|
else {
|
|
836
846
|
Labor.CGSTAmt = 0;
|
|
@@ -840,9 +850,9 @@ class EstPrintService {
|
|
|
840
850
|
}
|
|
841
851
|
else {
|
|
842
852
|
if (IncludeGST) {
|
|
843
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
844
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
845
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor
|
|
853
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
854
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
855
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
846
856
|
}
|
|
847
857
|
else {
|
|
848
858
|
Labor.CGSTAmt = 0;
|
|
@@ -861,9 +871,9 @@ class EstPrintService {
|
|
|
861
871
|
let LaborStatus = tr_utils_1.TrUtils.IsNull(Item.CollId) ? this.GetPartParentStatus(Item.OpId, LaborList) : Item.Sts;
|
|
862
872
|
if (LaborStatus === enums_1.LaborStatusEnum.New || LaborStatus === enums_1.LaborStatusEnum.WtngForAppr) {
|
|
863
873
|
if (IncludeGST) {
|
|
864
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
865
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
866
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
874
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
|
|
875
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
|
|
876
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
|
|
867
877
|
}
|
|
868
878
|
else {
|
|
869
879
|
Item.CGSTAmt = 0;
|
|
@@ -873,9 +883,9 @@ class EstPrintService {
|
|
|
873
883
|
}
|
|
874
884
|
else {
|
|
875
885
|
if (IncludeGST) {
|
|
876
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
877
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
878
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item
|
|
886
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
887
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
888
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
879
889
|
}
|
|
880
890
|
else {
|
|
881
891
|
Item.CGSTAmt = 0;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class ROPrintService {
|
|
2
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
|
|
2
3
|
static GetRepairOrderPrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any, OriginalEntityData: any, image: any, IncludeGST: boolean, ConsolidateGST: boolean, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, TaxCodes: any, OrderType: any, isReverse: boolean): any;
|
|
3
4
|
static GetEmployeeData(empData: any): any;
|
|
4
5
|
static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OrderType: any): any;
|
|
@@ -9,6 +9,16 @@ const my_date_1 = require("../utils/my-date");
|
|
|
9
9
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
10
10
|
const ro_totals_service_1 = require("./ro-totals.service");
|
|
11
11
|
class ROPrintService {
|
|
12
|
+
static GetTaxAmountFromGroup(item, taxGroupKey, taxCode, fallbackKey) {
|
|
13
|
+
const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
|
|
14
|
+
if (Array.isArray(groupedTaxes)) {
|
|
15
|
+
const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
16
|
+
if (matchedTaxes.length !== 0) {
|
|
17
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
|
|
21
|
+
}
|
|
12
22
|
static GetRepairOrderPrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, IncludeGST, ConsolidateGST, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, TaxCodes, OrderType, isReverse) {
|
|
13
23
|
let ROPrintData = {};
|
|
14
24
|
let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
|
|
@@ -591,9 +601,9 @@ class ROPrintService {
|
|
|
591
601
|
else {
|
|
592
602
|
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr, DecimalsNumber);
|
|
593
603
|
}
|
|
594
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
595
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
596
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
604
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
605
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
606
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
597
607
|
}
|
|
598
608
|
else {
|
|
599
609
|
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr, DecimalsNumber);
|
|
@@ -610,9 +620,9 @@ class ROPrintService {
|
|
|
610
620
|
else {
|
|
611
621
|
Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
|
|
612
622
|
}
|
|
613
|
-
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
614
|
-
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
615
|
-
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor
|
|
623
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
624
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
625
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
616
626
|
Labor.AssPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
|
|
617
627
|
}
|
|
618
628
|
else {
|
|
@@ -639,9 +649,9 @@ class ROPrintService {
|
|
|
639
649
|
else {
|
|
640
650
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr, DecimalsNumber);
|
|
641
651
|
}
|
|
642
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
643
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
644
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
652
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
|
|
653
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
|
|
654
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
|
|
645
655
|
}
|
|
646
656
|
else {
|
|
647
657
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr, DecimalsNumber);
|
|
@@ -658,9 +668,9 @@ class ROPrintService {
|
|
|
658
668
|
else {
|
|
659
669
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
|
|
660
670
|
}
|
|
661
|
-
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
662
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
663
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item
|
|
671
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
|
|
672
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
|
|
673
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
|
|
664
674
|
Item.AssPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
|
|
665
675
|
}
|
|
666
676
|
else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare class ROTotalsService {
|
|
2
|
+
static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
|
|
2
3
|
static GetTotalsValue(OriRecordData: any, TaxCodes: any[], isWorkOrder: boolean, detailedInfo: boolean, withItems: boolean, isRoundable: boolean, EntitySettings: any): any;
|
|
3
4
|
static CalculateLaborValues(opCodesList: any, isWorkOrder: boolean, isTaxable: boolean): any;
|
|
4
5
|
static FilterValidLaborItems(opCodesList: any[]): any[];
|
|
@@ -5,6 +5,16 @@ const enums_1 = require("../enums/enums");
|
|
|
5
5
|
const math_operations_1 = require("../shared/math-operations");
|
|
6
6
|
const tr_utils_1 = require("../utils/tr-utils");
|
|
7
7
|
class ROTotalsService {
|
|
8
|
+
static GetTaxAmountFromGroup(item, taxGroupKey, taxCode, fallbackKey) {
|
|
9
|
+
const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
|
|
10
|
+
if (Array.isArray(groupedTaxes)) {
|
|
11
|
+
const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
12
|
+
if (matchedTaxes.length !== 0) {
|
|
13
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
|
|
17
|
+
}
|
|
8
18
|
static GetTotalsValue(OriRecordData, TaxCodes, isWorkOrder, detailedInfo, withItems, isRoundable, EntitySettings) {
|
|
9
19
|
let dupRecordData = tr_utils_1.TrUtils.Stringify(OriRecordData);
|
|
10
20
|
let argRecordData = {};
|
|
@@ -38,19 +48,19 @@ class ROTotalsService {
|
|
|
38
48
|
Operation.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Disc);
|
|
39
49
|
Operation.Pr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Pr);
|
|
40
50
|
Operation.AssPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.AssPr);
|
|
41
|
-
Operation.ACGST =
|
|
42
|
-
Operation.ASGST =
|
|
43
|
-
Operation.AIGST =
|
|
44
|
-
Operation.CCGST =
|
|
45
|
-
Operation.CSGST =
|
|
46
|
-
Operation.CIGST =
|
|
51
|
+
Operation.ACGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CGST', 'ACGST');
|
|
52
|
+
Operation.ASGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'SGST', 'ASGST');
|
|
53
|
+
Operation.AIGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'IGST', 'AIGST');
|
|
54
|
+
Operation.CCGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CGST', 'CCGST');
|
|
55
|
+
Operation.CSGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'SGST', 'CSGST');
|
|
56
|
+
Operation.CIGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'IGST', 'CIGST');
|
|
47
57
|
Operation.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.NetAmt);
|
|
48
58
|
Operation.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
|
|
49
59
|
if (!isWorkOrder) {
|
|
50
60
|
Operation.EstPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.EstPr);
|
|
51
|
-
Operation.ECGST =
|
|
52
|
-
Operation.ESGST =
|
|
53
|
-
Operation.EIGST =
|
|
61
|
+
Operation.ECGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CGST', 'ECGST');
|
|
62
|
+
Operation.ESGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'SGST', 'ESGST');
|
|
63
|
+
Operation.EIGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'IGST', 'EIGST');
|
|
54
64
|
}
|
|
55
65
|
return Operation;
|
|
56
66
|
}
|
|
@@ -179,21 +189,21 @@ class ROTotalsService {
|
|
|
179
189
|
Part.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
|
|
180
190
|
Part.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
|
|
181
191
|
Part.AssPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.AssPr);
|
|
182
|
-
Part.ACGST =
|
|
183
|
-
Part.ASGST =
|
|
184
|
-
Part.AIGST =
|
|
185
|
-
Part.CCGST =
|
|
186
|
-
Part.CSGST =
|
|
187
|
-
Part.CIGST =
|
|
192
|
+
Part.ACGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST');
|
|
193
|
+
Part.ASGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST');
|
|
194
|
+
Part.AIGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST');
|
|
195
|
+
Part.CCGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST');
|
|
196
|
+
Part.CSGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST');
|
|
197
|
+
Part.CIGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST');
|
|
188
198
|
Part.UnAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnAmt);
|
|
189
199
|
Part.AssAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.AssAmt);
|
|
190
200
|
Part.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.NetAmt);
|
|
191
201
|
Part.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc);
|
|
192
202
|
if (!isWorkOrder) {
|
|
193
203
|
Part.EstPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.EstPr);
|
|
194
|
-
Part.ECGST =
|
|
195
|
-
Part.ESGST =
|
|
196
|
-
Part.EIGST =
|
|
204
|
+
Part.ECGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST');
|
|
205
|
+
Part.ESGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST');
|
|
206
|
+
Part.EIGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST');
|
|
197
207
|
Part.EstAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.EstAmt);
|
|
198
208
|
}
|
|
199
209
|
return Part;
|