shareneus 1.7.353 → 1.7.355

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.
@@ -1,5 +1,8 @@
1
1
  export declare class EstPrintService {
2
2
  static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
3
+ static GetTCode(item: any): any;
4
+ static GetTaxRateFromGroup(item: any, taxGroupKey: string, taxCode: string): number;
5
+ static GetTaxRate(item: any, taxCode: string, preferredTaxGroupKey?: string): number;
3
6
  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;
4
7
  static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OverallEst: any, isInitial: boolean): any;
5
8
  static GetPrintConditionsBasedOnInput(ROPrintData: any, IncludeGST: boolean, Payee: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, SType: any, Consolidate: boolean): any;
@@ -19,6 +19,48 @@ class EstPrintService {
19
19
  }
20
20
  return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
21
21
  }
22
+ static GetTCode(item) {
23
+ const taxGroupKeys = ['CTaxes', 'ATaxes', 'ETaxes'];
24
+ for (const taxGroupKey of taxGroupKeys) {
25
+ const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
26
+ if (!Array.isArray(groupedTaxes)) {
27
+ continue;
28
+ }
29
+ const matchedTax = groupedTaxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
30
+ if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
31
+ return matchedTax.TaxCodeId;
32
+ }
33
+ }
34
+ return item === null || item === void 0 ? void 0 : item.TCode;
35
+ }
36
+ static GetTaxRateFromGroup(item, taxGroupKey, taxCode) {
37
+ const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
38
+ if (Array.isArray(groupedTaxes)) {
39
+ const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
40
+ if (matchedTaxes.length !== 0) {
41
+ return tr_utils_1.TrUtils.FixedTo(matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0));
42
+ }
43
+ }
44
+ return 0;
45
+ }
46
+ static GetTaxRate(item, taxCode, preferredTaxGroupKey) {
47
+ const taxGroupKeys = [];
48
+ if (typeof preferredTaxGroupKey === 'string' && preferredTaxGroupKey.length !== 0) {
49
+ taxGroupKeys.push(preferredTaxGroupKey);
50
+ }
51
+ ['CTaxes', 'ATaxes', 'ETaxes'].forEach((groupKey) => {
52
+ if (taxGroupKeys.indexOf(groupKey) === -1) {
53
+ taxGroupKeys.push(groupKey);
54
+ }
55
+ });
56
+ for (const taxGroupKey of taxGroupKeys) {
57
+ const rate = this.GetTaxRateFromGroup(item, taxGroupKey, taxCode);
58
+ if (!tr_utils_1.TrUtils.IsZero(rate)) {
59
+ return rate;
60
+ }
61
+ }
62
+ return 0;
63
+ }
22
64
  static GetEstimatePrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, AsCustomerAndInsurance, AsInsuranceOrCustomer, TaxCodes, OverallEst, SuppEstIndex, AsEstimated, isInitial, isReverse, Consolidate) {
23
65
  let ROPrintData = {};
24
66
  let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
@@ -427,11 +469,13 @@ class EstPrintService {
427
469
  Labor.CCGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
428
470
  Labor.CSGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
429
471
  Labor.CIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
472
+ Labor.CCESS = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
430
473
  Labor.Disc = tr_utils_1.TrUtils.FixPriceValue(Labor.Disc, DecimalsNumber);
431
474
  Labor.AssPr = tr_utils_1.TrUtils.FixPriceValue(Labor.AssPr, DecimalsNumber);
432
475
  Labor.ACGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
433
476
  Labor.ASGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
434
477
  Labor.AIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
478
+ Labor.ACESS = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
435
479
  if (Consolidate) {
436
480
  if (Labor.PBy === enums_1.PayTypeEnum.Customer) {
437
481
  Labor.EstPr = tr_utils_1.TrUtils.FixPriceValue(Labor.CustAfterTax, DecimalsNumber);
@@ -449,6 +493,7 @@ class EstPrintService {
449
493
  Labor.ECGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
450
494
  Labor.ESGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
451
495
  Labor.EIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
496
+ Labor.ECESS = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
452
497
  if (tr_utils_1.TrUtils.IsNull(Labor.CollId)) {
453
498
  let LaborColli = {
454
499
  _id: Labor._id,
@@ -470,12 +515,14 @@ class EstPrintService {
470
515
  Part.CCGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
471
516
  Part.CSGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
472
517
  Part.CIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
518
+ Part.CCESS = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
473
519
  Part.Disc = tr_utils_1.TrUtils.FixPriceValue(Part.Disc, DecimalsNumber);
474
520
  Part.AssPr = tr_utils_1.TrUtils.FixPriceValue(Part.AssPr, DecimalsNumber);
475
521
  Part.AssAmt = tr_utils_1.TrUtils.FixPriceValue(Part.AssAmt, DecimalsNumber);
476
522
  Part.ACGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
477
523
  Part.ASGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
478
524
  Part.AIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
525
+ Part.ACESS = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
479
526
  Part.EstPr = tr_utils_1.TrUtils.FixPriceValue(Part.EstPr, DecimalsNumber);
480
527
  if (Consolidate) {
481
528
  if (Part.PBy === enums_1.PayTypeEnum.Customer) {
@@ -495,6 +542,7 @@ class EstPrintService {
495
542
  Part.ECGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
496
543
  Part.ESGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
497
544
  Part.EIGST = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
545
+ Part.ECESS = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
498
546
  if (tr_utils_1.TrUtils.IsNull(Part.CollId)) {
499
547
  let LaborIndex = ROPrintData.Ops.findIndex((Labor) => {
500
548
  return Labor._id === Part.OpId;
@@ -841,11 +889,13 @@ class EstPrintService {
841
889
  Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
842
890
  Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
843
891
  Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
892
+ Labor.CESSAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
844
893
  }
845
894
  else {
846
895
  Labor.CGSTAmt = 0;
847
896
  Labor.SGSTAmt = 0;
848
897
  Labor.IGSTAmt = 0;
898
+ Labor.CESSAmt = 0;
849
899
  }
850
900
  }
851
901
  else {
@@ -853,16 +903,21 @@ class EstPrintService {
853
903
  Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
854
904
  Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
855
905
  Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
906
+ Labor.CESSAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
856
907
  }
857
908
  else {
858
909
  Labor.CGSTAmt = 0;
859
910
  Labor.SGSTAmt = 0;
860
911
  Labor.IGSTAmt = 0;
912
+ Labor.CESSAmt = 0;
861
913
  }
862
914
  }
863
- Labor.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
864
- Labor.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
865
- Labor.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
915
+ const taxGroupKey = (Labor.Sts === enums_1.LaborStatusEnum.New || Labor.Sts === enums_1.LaborStatusEnum.WtngForAppr) ? 'ETaxes' : 'CTaxes';
916
+ Labor.TCode = this.GetTCode(Labor);
917
+ Labor.CGSTPerc = this.GetTaxRate(Labor, 'CGST', taxGroupKey);
918
+ Labor.SGSTPerc = this.GetTaxRate(Labor, 'SGST', taxGroupKey);
919
+ Labor.IGSTPerc = this.GetTaxRate(Labor, 'IGST', taxGroupKey);
920
+ Labor.CESSPerc = this.GetTaxRate(Labor, 'CESS', taxGroupKey);
866
921
  });
867
922
  return LaborList;
868
923
  }
@@ -874,11 +929,13 @@ class EstPrintService {
874
929
  Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
875
930
  Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
876
931
  Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
932
+ Item.CESSAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
877
933
  }
878
934
  else {
879
935
  Item.CGSTAmt = 0;
880
936
  Item.SGSTAmt = 0;
881
937
  Item.IGSTAmt = 0;
938
+ Item.CESSAmt = 0;
882
939
  }
883
940
  }
884
941
  else {
@@ -886,16 +943,21 @@ class EstPrintService {
886
943
  Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
887
944
  Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
888
945
  Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
946
+ Item.CESSAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
889
947
  }
890
948
  else {
891
949
  Item.CGSTAmt = 0;
892
950
  Item.SGSTAmt = 0;
893
951
  Item.IGSTAmt = 0;
952
+ Item.CESSAmt = 0;
894
953
  }
895
954
  }
896
- Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
897
- Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
898
- Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
955
+ const taxGroupKey = (LaborStatus === enums_1.LaborStatusEnum.New || LaborStatus === enums_1.LaborStatusEnum.WtngForAppr) ? 'ETaxes' : 'CTaxes';
956
+ Item.TCode = this.GetTCode(Item);
957
+ Item.CGSTPerc = this.GetTaxRate(Item, 'CGST', taxGroupKey);
958
+ Item.SGSTPerc = this.GetTaxRate(Item, 'SGST', taxGroupKey);
959
+ Item.IGSTPerc = this.GetTaxRate(Item, 'IGST', taxGroupKey);
960
+ Item.CESSPerc = this.GetTaxRate(Item, 'CESS', taxGroupKey);
899
961
  });
900
962
  return Items;
901
963
  }
@@ -959,7 +1021,7 @@ class EstPrintService {
959
1021
  }
960
1022
  static CheckLaborTaxItemIndex(LaborList) {
961
1023
  let TaxIndex = LaborList.findIndex((Labor) => {
962
- if (!tr_utils_1.TrUtils.CheckInvalidSelect(Labor.TCode)) {
1024
+ if (!tr_utils_1.TrUtils.IsNull(this.GetTCode(Labor))) {
963
1025
  return Labor;
964
1026
  }
965
1027
  });
@@ -967,7 +1029,7 @@ class EstPrintService {
967
1029
  }
968
1030
  static CheckPartTaxItemIndex(PartsList) {
969
1031
  let TaxIndex = PartsList.findIndex((Part) => {
970
- if (!tr_utils_1.TrUtils.CheckInvalidSelect(Part.TCode)) {
1032
+ if (!tr_utils_1.TrUtils.IsNull(this.GetTCode(Part))) {
971
1033
  return Part;
972
1034
  }
973
1035
  });
@@ -647,12 +647,14 @@ class ROPrintService {
647
647
  Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
648
648
  Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
649
649
  Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
650
+ Labor.CESSAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
650
651
  }
651
652
  else {
652
653
  Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.Pr, DecimalsNumber);
653
654
  Labor.CGSTAmt = 0;
654
655
  Labor.SGSTAmt = 0;
655
656
  Labor.IGSTAmt = 0;
657
+ Labor.CESSAmt = 0;
656
658
  }
657
659
  }
658
660
  else if (AsInsuranceOnly) {
@@ -667,6 +669,7 @@ class ROPrintService {
667
669
  Labor.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
668
670
  Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
669
671
  Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
672
+ Labor.CESSAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
670
673
  Labor.AssPr = tr_utils_1.TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
671
674
  }
672
675
  else {
@@ -675,12 +678,14 @@ class ROPrintService {
675
678
  Labor.CGSTAmt = 0;
676
679
  Labor.SGSTAmt = 0;
677
680
  Labor.IGSTAmt = 0;
681
+ Labor.CESSAmt = 0;
678
682
  }
679
683
  }
680
684
  Labor.TCode = this.GetTCode(Labor);
681
685
  Labor.CGSTPerc = this.GetTaxRate(Labor, 'CGST', taxGroupKey);
682
686
  Labor.SGSTPerc = this.GetTaxRate(Labor, 'SGST', taxGroupKey);
683
687
  Labor.IGSTPerc = this.GetTaxRate(Labor, 'IGST', taxGroupKey);
688
+ Labor.CESSPerc = this.GetTaxRate(Labor, 'CESS', taxGroupKey);
684
689
  });
685
690
  return LaborList;
686
691
  }
@@ -698,12 +703,14 @@ class ROPrintService {
698
703
  Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
699
704
  Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
700
705
  Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
706
+ Item.CESSAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
701
707
  }
702
708
  else {
703
709
  Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.UnPr, DecimalsNumber);
704
710
  Item.CGSTAmt = 0;
705
711
  Item.SGSTAmt = 0;
706
712
  Item.IGSTAmt = 0;
713
+ Item.CESSAmt = 0;
707
714
  }
708
715
  }
709
716
  else if (AsInsuranceOnly) {
@@ -718,6 +725,7 @@ class ROPrintService {
718
725
  Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
719
726
  Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
720
727
  Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
728
+ Item.CESSAmt = tr_utils_1.TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
721
729
  Item.AssPr = tr_utils_1.TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
722
730
  }
723
731
  else {
@@ -726,6 +734,7 @@ class ROPrintService {
726
734
  Item.CGSTAmt = 0;
727
735
  Item.SGSTAmt = 0;
728
736
  Item.IGSTAmt = 0;
737
+ Item.CESSAmt = 0;
729
738
  }
730
739
  }
731
740
  if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
@@ -735,6 +744,7 @@ class ROPrintService {
735
744
  Item.CGSTPerc = this.GetTaxRate(Item, 'CGST', taxGroupKey);
736
745
  Item.SGSTPerc = this.GetTaxRate(Item, 'SGST', taxGroupKey);
737
746
  Item.IGSTPerc = this.GetTaxRate(Item, 'IGST', taxGroupKey);
747
+ Item.CESSPerc = this.GetTaxRate(Item, 'CESS', taxGroupKey);
738
748
  });
739
749
  return Items;
740
750
  }
@@ -529,14 +529,14 @@ export declare class SharedPDFService {
529
529
  Field: string;
530
530
  })[];
531
531
  static ALLPartsCGSTTaxListTable(PartsTaxInfo: any, ShowAccParts: any, ShowTaxColumn: any): any;
532
- static CreateHeadingAllHSNTaxList(ShowIGST: any): {
532
+ static CreateHeadingAllHSNTaxList(ShowIGST: any, hasCESS: boolean): {
533
533
  text: string;
534
534
  style: string;
535
535
  fontSize: number;
536
536
  lineHeight: number;
537
537
  Field: string;
538
538
  }[];
539
- static CreateHeadingAllTaxList(ShowIGST: any): {
539
+ static CreateHeadingAllTaxList(ShowIGST: any, hasCESS: boolean): {
540
540
  text: string;
541
541
  style: string;
542
542
  fontSize: number;
@@ -544,6 +544,7 @@ export declare class SharedPDFService {
544
544
  Field: string;
545
545
  alignment: string;
546
546
  }[];
547
+ static hasCESS(items: any[]): boolean;
547
548
  static CreateHSNTaxTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any): any;
548
549
  static CreateHSNTaxTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any): any;
549
550
  static GetFinalTotalDetails1(RecordData: any, BasicLaborTotal: any, OverAllMainLaborDiscount: any, LCGST: any, LSGST: any, LIGST: any, PIGST: any, ShowIGST: any, ShowTaxColumn: any, BasicPartsTotal: any, OverAllMainPartsDiscount: any, PCGST: any, PSGST: any, PartsTaxInfo: any, ShowAccParts: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, For: any, OverAllRecordTotal: any, Rounded: any, GrandTotal: any, ShowDetailedLaborTaxInfo: any, ShowDetailedPartTaxInfo: any, istaxable: boolean, LaborTotalTax: any, PartTotalTax: any, Consolidate: boolean, From: string, Adj: any, CustLaborTaxGroupDataByPerc: any, STotal: any, isAuto: boolean, moreDiscDetails: boolean): {
@@ -1555,11 +1555,12 @@ class SharedPDFService {
1555
1555
  }
1556
1556
  }
1557
1557
  static AllHSNPartCGSTTaxListTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1558
+ const hasCESS = this.hasCESS(PartsTaxInfo);
1558
1559
  if (ShowIGST) {
1559
1560
  return {
1560
1561
  style: 'tableExample',
1561
1562
  table: {
1562
- widths: [25, 60, 50],
1563
+ widths: hasCESS ? [25, 60, 50, 40] : [25, 60, 50],
1563
1564
  headerRows: 1,
1564
1565
  body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1565
1566
  },
@@ -1570,7 +1571,7 @@ class SharedPDFService {
1570
1571
  return {
1571
1572
  style: 'tableExample',
1572
1573
  table: {
1573
- widths: [25, 60, 40, 40],
1574
+ widths: hasCESS ? [25, 60, 40, 40, 40] : [25, 60, 40, 40],
1574
1575
  headerRows: 1,
1575
1576
  body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1576
1577
  },
@@ -1579,11 +1580,12 @@ class SharedPDFService {
1579
1580
  }
1580
1581
  }
1581
1582
  static AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1583
+ const hasCESS = this.hasCESS(PartsTaxInfo);
1582
1584
  if (ShowIGST) {
1583
1585
  return {
1584
1586
  style: 'tableExample',
1585
1587
  table: {
1586
- widths: [40, 'auto', 50],
1588
+ widths: hasCESS ? [40, 'auto', 50, 40] : [40, 'auto', 50],
1587
1589
  headerRows: 1,
1588
1590
  body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1589
1591
  },
@@ -1594,7 +1596,7 @@ class SharedPDFService {
1594
1596
  return {
1595
1597
  style: 'tableExample',
1596
1598
  table: {
1597
- widths: [50, 65, 50, 50],
1599
+ widths: hasCESS ? [50, 65, 50, 50, 40] : [50, 65, 50, 50],
1598
1600
  headerRows: 1,
1599
1601
  body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1600
1602
  },
@@ -1675,7 +1677,7 @@ class SharedPDFService {
1675
1677
  return [{}];
1676
1678
  }
1677
1679
  }
1678
- static CreateHeadingAllHSNTaxList(ShowIGST) {
1680
+ static CreateHeadingAllHSNTaxList(ShowIGST, hasCESS) {
1679
1681
  let HeaderNames = [{ text: 'HSN', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'HSN' },
1680
1682
  // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1681
1683
  // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
@@ -1690,9 +1692,12 @@ class SharedPDFService {
1690
1692
  HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1691
1693
  HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' });
1692
1694
  }
1695
+ if (hasCESS) {
1696
+ HeaderNames.push({ text: 'CESS', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CESS' });
1697
+ }
1693
1698
  return HeaderNames;
1694
1699
  }
1695
- static CreateHeadingAllTaxList(ShowIGST) {
1700
+ static CreateHeadingAllTaxList(ShowIGST, hasCESS) {
1696
1701
  let HeaderNames = [
1697
1702
  // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1698
1703
  // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
@@ -1704,27 +1709,41 @@ class SharedPDFService {
1704
1709
  if (ShowIGST) {
1705
1710
  // HeaderNames.splice(1, 0, { text: 'IGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
1706
1711
  HeaderNames.splice(2, 0, { text: 'IGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGSTAmt', alignment: 'right' });
1712
+ if (hasCESS) {
1713
+ HeaderNames.splice(3, 0, { text: 'CESS(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CESSAmt', alignment: 'right' });
1714
+ }
1707
1715
  }
1708
1716
  else {
1709
1717
  // HeaderNames.splice(1, 0, { text: 'CGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1710
1718
  HeaderNames.splice(2, 0, { text: 'CGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGSTAmt', alignment: 'right' });
1711
1719
  // HeaderNames.splice(3, 0, { text: 'SGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1712
1720
  HeaderNames.splice(3, 0, { text: 'SGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'SGSTAmt', alignment: 'right' });
1721
+ if (hasCESS) {
1722
+ HeaderNames.splice(4, 0, { text: 'CESS(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CESSAmt', alignment: 'right' });
1723
+ }
1713
1724
  }
1714
1725
  return HeaderNames;
1715
1726
  }
1727
+ static hasCESS(items) {
1728
+ if (tr_utils_1.TrUtils.IsNull(items) || (items === null || items === void 0 ? void 0 : items.length) === 0) {
1729
+ return false;
1730
+ }
1731
+ return items.some(item => { var _a; return (_a = item.Taxes) === null || _a === void 0 ? void 0 : _a.some((tax) => { var _a; return ((_a = tax.Code) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CESS'; }); });
1732
+ }
1716
1733
  static CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1717
1734
  if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1718
1735
  var body = [];
1719
- let columns = this.CreateHeadingAllTaxList(ShowIGST);
1736
+ console.log('PartsTaxInfo', PartsTaxInfo);
1737
+ const hasCESS = this.hasCESS(PartsTaxInfo);
1738
+ console.log('hasCESS', hasCESS);
1739
+ let columns = this.CreateHeadingAllTaxList(ShowIGST, hasCESS);
1720
1740
  body.push(columns);
1721
1741
  PartsTaxInfo.forEach((part) => {
1722
1742
  var dataRow = [];
1723
1743
  columns.forEach((column) => {
1724
1744
  if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) &&
1725
- !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt'
1726
- || column.Field === 'TotalTaxableAmount') {
1727
- if (column.Field === 'TotalTaxableAmount' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'IGSTAmt') {
1745
+ !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'CESSAmt' || column.Field === 'TotalTaxableAmount') {
1746
+ if (column.Field === 'TotalTaxableAmount' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'IGSTAmt' || column.Field === 'CESSAmt') {
1728
1747
  dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(part[column.Field]), alignment: 'right', opacity: 0.7, nowrap: true, fontSize: 6 });
1729
1748
  }
1730
1749
  else if (column.Field === 'CombinedTaxPercentage') {
@@ -1750,13 +1769,14 @@ class SharedPDFService {
1750
1769
  static CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn) {
1751
1770
  if (!tr_utils_1.TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1752
1771
  var body = [];
1753
- let columns = this.CreateHeadingAllHSNTaxList(ShowIGST);
1772
+ const hasCESS = this.hasCESS(PartsTaxInfo);
1773
+ let columns = this.CreateHeadingAllHSNTaxList(ShowIGST, hasCESS);
1754
1774
  body.push(columns);
1755
1775
  PartsTaxInfo.forEach((part) => {
1756
1776
  var dataRow = [];
1757
1777
  columns.forEach((column) => {
1758
1778
  if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) &&
1759
- !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
1779
+ !tr_utils_1.TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'CESS'
1760
1780
  || column.Field === 'TotalTaxAmount') {
1761
1781
  if (column.Field === 'SGSTLaborAmt') {
1762
1782
  dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.353",
3
+ "version": "1.7.355",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,6 +22,56 @@ export class EstPrintService {
22
22
  return TrUtils.SetValueToZeroIfNull(item?.[fallbackKey]);
23
23
  }
24
24
 
25
+ static GetTCode(item: any) {
26
+ const taxGroupKeys: string[] = ['CTaxes', 'ATaxes', 'ETaxes'];
27
+
28
+ for (const taxGroupKey of taxGroupKeys) {
29
+ const groupedTaxes = item?.[taxGroupKey];
30
+ if (!Array.isArray(groupedTaxes)) {
31
+ continue;
32
+ }
33
+
34
+ const matchedTax = groupedTaxes.find((tax: any) => !TrUtils.IsNull(tax?.TaxCodeId));
35
+ if (!TrUtils.IsNull(matchedTax?.TaxCodeId)) {
36
+ return matchedTax.TaxCodeId;
37
+ }
38
+ }
39
+
40
+ return item?.TCode;
41
+ }
42
+
43
+ static GetTaxRateFromGroup(item: any, taxGroupKey: string, taxCode: string) {
44
+ const groupedTaxes = item?.[taxGroupKey];
45
+ if (Array.isArray(groupedTaxes)) {
46
+ const matchedTaxes = groupedTaxes.filter((tax: any) => tax?.Code === taxCode);
47
+ if (matchedTaxes.length !== 0) {
48
+ return TrUtils.FixedTo(matchedTaxes.reduce((total: number, tax: any) => Add(total, tax?.Rate), 0));
49
+ }
50
+ }
51
+ return 0;
52
+ }
53
+
54
+ static GetTaxRate(item: any, taxCode: string, preferredTaxGroupKey?: string) {
55
+ const taxGroupKeys: string[] = [];
56
+
57
+ if (typeof preferredTaxGroupKey === 'string' && preferredTaxGroupKey.length !== 0) {
58
+ taxGroupKeys.push(preferredTaxGroupKey);
59
+ }
60
+ ['CTaxes', 'ATaxes', 'ETaxes'].forEach((groupKey: string) => {
61
+ if (taxGroupKeys.indexOf(groupKey) === -1) {
62
+ taxGroupKeys.push(groupKey);
63
+ }
64
+ });
65
+
66
+ for (const taxGroupKey of taxGroupKeys) {
67
+ const rate = this.GetTaxRateFromGroup(item, taxGroupKey, taxCode);
68
+ if (!TrUtils.IsZero(rate)) {
69
+ return rate;
70
+ }
71
+ }
72
+ return 0;
73
+ }
74
+
25
75
  static GetEstimatePrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any, OriginalEntityData: any,
26
76
  image: any, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean, AsInsuranceOnly: boolean,
27
77
  AsCustomerAndInsurance: boolean, AsInsuranceOrCustomer: boolean, TaxCodes: any, OverallEst: boolean,
@@ -490,11 +540,13 @@ export class EstPrintService {
490
540
  Labor.CCGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
491
541
  Labor.CSGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
492
542
  Labor.CIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
543
+ Labor.CCESS = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
493
544
  Labor.Disc = TrUtils.FixPriceValue(Labor.Disc, DecimalsNumber);
494
545
  Labor.AssPr = TrUtils.FixPriceValue(Labor.AssPr, DecimalsNumber);
495
546
  Labor.ACGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
496
547
  Labor.ASGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
497
548
  Labor.AIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
549
+ Labor.ACESS = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
498
550
  if (Consolidate) {
499
551
  if (Labor.PBy === PayTypeEnum.Customer) {
500
552
  Labor.EstPr = TrUtils.FixPriceValue(Labor.CustAfterTax, DecimalsNumber);
@@ -510,6 +562,7 @@ export class EstPrintService {
510
562
  Labor.ECGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
511
563
  Labor.ESGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
512
564
  Labor.EIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
565
+ Labor.ECESS = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
513
566
  if (TrUtils.IsNull(Labor.CollId)) {
514
567
  let LaborColli: any = {
515
568
  _id: Labor._id,
@@ -533,12 +586,14 @@ export class EstPrintService {
533
586
  Part.CCGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
534
587
  Part.CSGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
535
588
  Part.CIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
589
+ Part.CCESS = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
536
590
  Part.Disc = TrUtils.FixPriceValue(Part.Disc, DecimalsNumber);
537
591
  Part.AssPr = TrUtils.FixPriceValue(Part.AssPr, DecimalsNumber);
538
592
  Part.AssAmt = TrUtils.FixPriceValue(Part.AssAmt, DecimalsNumber);
539
593
  Part.ACGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
540
594
  Part.ASGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
541
595
  Part.AIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
596
+ Part.ACESS = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
542
597
  Part.EstPr = TrUtils.FixPriceValue(Part.EstPr, DecimalsNumber);
543
598
  if (Consolidate) {
544
599
  if (Part.PBy === PayTypeEnum.Customer) {
@@ -556,6 +611,7 @@ export class EstPrintService {
556
611
  Part.ECGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
557
612
  Part.ESGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
558
613
  Part.EIGST = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
614
+ Part.ECESS = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
559
615
  if (TrUtils.IsNull(Part.CollId)) {
560
616
  let LaborIndex: any = ROPrintData.Ops.findIndex((Labor: any) => {
561
617
  return Labor._id === Part.OpId;
@@ -924,25 +980,32 @@ export class EstPrintService {
924
980
  Labor.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
925
981
  Labor.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
926
982
  Labor.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
983
+ Labor.CESSAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
927
984
  } else {
928
985
  Labor.CGSTAmt = 0;
929
986
  Labor.SGSTAmt = 0;
930
987
  Labor.IGSTAmt = 0;
988
+ Labor.CESSAmt = 0;
931
989
  }
932
990
  } else {
933
991
  if (IncludeGST) {
934
992
  Labor.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
935
993
  Labor.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
936
994
  Labor.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
995
+ Labor.CESSAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
937
996
  } else {
938
997
  Labor.CGSTAmt = 0;
939
998
  Labor.SGSTAmt = 0;
940
999
  Labor.IGSTAmt = 0;
1000
+ Labor.CESSAmt = 0;
941
1001
  }
942
1002
  }
943
- Labor.CGSTPerc = PrintSharedService.GetCGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
944
- Labor.SGSTPerc = PrintSharedService.GetSGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
945
- Labor.IGSTPerc = PrintSharedService.GetIGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
1003
+ const taxGroupKey = (Labor.Sts === LaborStatusEnum.New || Labor.Sts === LaborStatusEnum.WtngForAppr) ? 'ETaxes' : 'CTaxes';
1004
+ Labor.TCode = this.GetTCode(Labor);
1005
+ Labor.CGSTPerc = this.GetTaxRate(Labor, 'CGST', taxGroupKey);
1006
+ Labor.SGSTPerc = this.GetTaxRate(Labor, 'SGST', taxGroupKey);
1007
+ Labor.IGSTPerc = this.GetTaxRate(Labor, 'IGST', taxGroupKey);
1008
+ Labor.CESSPerc = this.GetTaxRate(Labor, 'CESS', taxGroupKey);
946
1009
  });
947
1010
  return LaborList;
948
1011
  }
@@ -955,25 +1018,32 @@ export class EstPrintService {
955
1018
  Item.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CGST', 'ECGST'), DecimalsNumber);
956
1019
  Item.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'SGST', 'ESGST'), DecimalsNumber);
957
1020
  Item.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'IGST', 'EIGST'), DecimalsNumber);
1021
+ Item.CESSAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'ETaxes', 'CESS', 'ECESS'), DecimalsNumber);
958
1022
  } else {
959
1023
  Item.CGSTAmt = 0;
960
1024
  Item.SGSTAmt = 0;
961
1025
  Item.IGSTAmt = 0;
1026
+ Item.CESSAmt = 0;
962
1027
  }
963
1028
  } else {
964
1029
  if (IncludeGST) {
965
1030
  Item.CGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
966
1031
  Item.SGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
967
1032
  Item.IGSTAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
1033
+ Item.CESSAmt = TrUtils.FixPriceValue(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
968
1034
  } else {
969
1035
  Item.CGSTAmt = 0;
970
1036
  Item.SGSTAmt = 0;
971
1037
  Item.IGSTAmt = 0;
1038
+ Item.CESSAmt = 0;
972
1039
  }
973
1040
  }
974
- Item.CGSTPerc = PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
975
- Item.SGSTPerc = PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
976
- Item.IGSTPerc = PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
1041
+ const taxGroupKey = (LaborStatus === LaborStatusEnum.New || LaborStatus === LaborStatusEnum.WtngForAppr) ? 'ETaxes' : 'CTaxes';
1042
+ Item.TCode = this.GetTCode(Item);
1043
+ Item.CGSTPerc = this.GetTaxRate(Item, 'CGST', taxGroupKey);
1044
+ Item.SGSTPerc = this.GetTaxRate(Item, 'SGST', taxGroupKey);
1045
+ Item.IGSTPerc = this.GetTaxRate(Item, 'IGST', taxGroupKey);
1046
+ Item.CESSPerc = this.GetTaxRate(Item, 'CESS', taxGroupKey);
977
1047
  });
978
1048
  return Items;
979
1049
  }
@@ -1044,7 +1114,7 @@ export class EstPrintService {
1044
1114
 
1045
1115
  static CheckLaborTaxItemIndex(LaborList: any[]) {
1046
1116
  let TaxIndex: any = LaborList.findIndex((Labor: any) => {
1047
- if (!TrUtils.CheckInvalidSelect(Labor.TCode)) {
1117
+ if (!TrUtils.IsNull(this.GetTCode(Labor))) {
1048
1118
  return Labor;
1049
1119
  }
1050
1120
  });
@@ -1053,7 +1123,7 @@ export class EstPrintService {
1053
1123
 
1054
1124
  static CheckPartTaxItemIndex(PartsList: any[]) {
1055
1125
  let TaxIndex: any = PartsList.findIndex((Part: any) => {
1056
- if (!TrUtils.CheckInvalidSelect(Part.TCode)) {
1126
+ if (!TrUtils.IsNull(this.GetTCode(Part))) {
1057
1127
  return Part;
1058
1128
  }
1059
1129
  });
@@ -1125,7 +1195,7 @@ export class EstPrintService {
1125
1195
  });
1126
1196
  return SParts;
1127
1197
  }
1128
-
1198
+
1129
1199
  static SeparateCollisionBySuppIndex(Collisions: any, SuppEstCodeValue: any) {
1130
1200
  let FilteredCollisions: any[] = [];
1131
1201
  FilteredCollisions = Collisions.filter((Collision: any) => {
@@ -73,7 +73,7 @@ export class ROPrintService {
73
73
  static GetRepairOrderPrintInfo(OriginalROData: any, OriginalCustomerData: any, OriginalVehicleData: any,
74
74
  OriginalEntityData: any, image: any,
75
75
  IncludeGST: boolean, ConsolidateGST: boolean, Payee: any, InsCompanyName: any, AsCustomerOnly: boolean,
76
- AsInsuranceOnly: boolean, TaxCodes: any, OrderType: any, isReverse:boolean) {
76
+ AsInsuranceOnly: boolean, TaxCodes: any, OrderType: any, isReverse: boolean) {
77
77
 
78
78
  let ROPrintData: any = {};
79
79
 
@@ -536,16 +536,16 @@ export class ROPrintService {
536
536
  ROPrintData.Colli.forEach((Collision: any) => {
537
537
  let LineTotal: number = 0;
538
538
  if (!TrUtils.IsNull(Collision.PartData)) {
539
- LineTotal = Add(LineTotal,this.GetCollisionPartLineTotal(Collision.PartData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
539
+ LineTotal = Add(LineTotal, this.GetCollisionPartLineTotal(Collision.PartData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
540
540
  }
541
541
  if (!TrUtils.IsNull(Collision.RRFData)) {
542
- LineTotal = Add(LineTotal,this.GetCollisionLaborLineTotal(Collision.RRFData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
542
+ LineTotal = Add(LineTotal, this.GetCollisionLaborLineTotal(Collision.RRFData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
543
543
  }
544
544
  if (!TrUtils.IsNull(Collision.PtngData)) {
545
- LineTotal = Add(LineTotal,this.GetCollisionLaborLineTotal(Collision.PtngData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
545
+ LineTotal = Add(LineTotal, this.GetCollisionLaborLineTotal(Collision.PtngData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
546
546
  }
547
547
  if (!TrUtils.IsNull(Collision.DtngData)) {
548
- LineTotal = Add(LineTotal,this.GetCollisionLaborLineTotal(Collision.DtngData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
548
+ LineTotal = Add(LineTotal, this.GetCollisionLaborLineTotal(Collision.DtngData, ConsolidateGST, AsCustomerOnly, AsInsuranceOnly));
549
549
  }
550
550
  Collision.LineTotal = TrUtils.FixPriceValue(LineTotal, DecimalsNumber);
551
551
  });
@@ -569,9 +569,9 @@ export class ROPrintService {
569
569
  }
570
570
  } else {
571
571
  if (ConsolidateGST) {
572
- LineTotal = Add(PartData.InsAfterTaxPerItem , PartData.CustAfterTaxPerItem);
572
+ LineTotal = Add(PartData.InsAfterTaxPerItem, PartData.CustAfterTaxPerItem);
573
573
  } else {
574
- LineTotal = Add(PartData.InsAfterPartDisc , PartData.CustAfterPartDisc);
574
+ LineTotal = Add(PartData.InsAfterPartDisc, PartData.CustAfterPartDisc);
575
575
  }
576
576
  }
577
577
  return Number(LineTotal);
@@ -593,9 +593,9 @@ export class ROPrintService {
593
593
  }
594
594
  } else {
595
595
  if (ConsolidateGST) {
596
- LineTotal = Add(LaborData.CustAfterTax , LaborData.InsAfterTax);
596
+ LineTotal = Add(LaborData.CustAfterTax, LaborData.InsAfterTax);
597
597
  } else {
598
- LineTotal = Add(LaborData.InsAfterLaborDisc , LaborData.CustAfterLaborDisc);
598
+ LineTotal = Add(LaborData.InsAfterLaborDisc, LaborData.CustAfterLaborDisc);
599
599
  }
600
600
  }
601
601
  return Number(LineTotal);
@@ -617,9 +617,9 @@ export class ROPrintService {
617
617
  }
618
618
  } else {
619
619
  if (IncludeGST) {
620
- LineTotal = Add(LaborData.CustAfterTax , LaborData.InsAfterTax);
620
+ LineTotal = Add(LaborData.CustAfterTax, LaborData.InsAfterTax);
621
621
  } else {
622
- LineTotal = Add(LaborData.InsAfterLaborDisc , LaborData.CustAfterLaborDisc);
622
+ LineTotal = Add(LaborData.InsAfterLaborDisc, LaborData.CustAfterLaborDisc);
623
623
  }
624
624
  }
625
625
  return TrUtils.FixPriceValue(LineTotal, DecimalsNumber);
@@ -641,21 +641,21 @@ export class ROPrintService {
641
641
  }
642
642
  } else {
643
643
  if (IncludeGST) {
644
- LineTotal = Add(PartData.InsAfterTax , PartData.CustAfterTax);
644
+ LineTotal = Add(PartData.InsAfterTax, PartData.CustAfterTax);
645
645
  } else {
646
- LineTotal = Add(PartData.InsAfterPartDisc , PartData.CustAfterPartDisc);
646
+ LineTotal = Add(PartData.InsAfterPartDisc, PartData.CustAfterPartDisc);
647
647
  }
648
648
  }
649
649
  return TrUtils.FixPriceValue(LineTotal, DecimalsNumber);
650
650
  }
651
651
 
652
- static ReverseItemsForROPrint(argROData: any, isReverse:boolean) {
653
- if(isReverse){
652
+ static ReverseItemsForROPrint(argROData: any, isReverse: boolean) {
653
+ if (isReverse) {
654
654
  argROData.Comps = TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps.reverse();
655
655
  argROData.Ops = TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops.reverse();
656
656
  argROData.Parts = TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts.reverse();
657
657
  argROData.Colli = TrUtils.IsNull(argROData.Colli) ? [] : argROData.Colli.reverse();
658
- }else{
658
+ } else {
659
659
  argROData.Comps = TrUtils.IsNull(argROData.Comps) ? [] : argROData.Comps;
660
660
  argROData.Ops = TrUtils.IsNull(argROData.Ops) ? [] : argROData.Ops;
661
661
  argROData.Parts = TrUtils.IsNull(argROData.Parts) ? [] : argROData.Parts;
@@ -716,7 +716,7 @@ export class ROPrintService {
716
716
  }
717
717
 
718
718
  static GetLaborPrintInfo(LaborList: any, ConsolidateGST: boolean,
719
- IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, _TaxCodes: any[], DecimalsNumber:number) {
719
+ IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, _TaxCodes: any[], DecimalsNumber: number) {
720
720
  LaborList.forEach((Labor: any) => {
721
721
  Labor.HSN = Labor.SAC;
722
722
  let taxGroupKey = 'CTaxes';
@@ -730,11 +730,13 @@ export class ROPrintService {
730
730
  Labor.CGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
731
731
  Labor.SGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
732
732
  Labor.IGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
733
+ Labor.CESSAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
733
734
  } else {
734
735
  Labor.UnPr = TrUtils.FixedTo(Labor.Pr, DecimalsNumber);
735
736
  Labor.CGSTAmt = 0;
736
737
  Labor.SGSTAmt = 0;
737
738
  Labor.IGSTAmt = 0;
739
+ Labor.CESSAmt = 0;
738
740
  }
739
741
  } else if (AsInsuranceOnly) {
740
742
  taxGroupKey = 'ATaxes';
@@ -747,6 +749,7 @@ export class ROPrintService {
747
749
  Labor.CGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
748
750
  Labor.SGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
749
751
  Labor.IGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
752
+ Labor.CESSAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Labor, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
750
753
  Labor.AssPr = TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
751
754
  } else {
752
755
  Labor.UnPr = TrUtils.FixedTo(Labor.AssPr, DecimalsNumber);
@@ -754,12 +757,14 @@ export class ROPrintService {
754
757
  Labor.CGSTAmt = 0;
755
758
  Labor.SGSTAmt = 0;
756
759
  Labor.IGSTAmt = 0;
760
+ Labor.CESSAmt = 0;
757
761
  }
758
762
  }
759
763
  Labor.TCode = this.GetTCode(Labor);
760
764
  Labor.CGSTPerc = this.GetTaxRate(Labor, 'CGST', taxGroupKey);
761
765
  Labor.SGSTPerc = this.GetTaxRate(Labor, 'SGST', taxGroupKey);
762
766
  Labor.IGSTPerc = this.GetTaxRate(Labor, 'IGST', taxGroupKey);
767
+ Labor.CESSPerc = this.GetTaxRate(Labor, 'CESS', taxGroupKey);
763
768
  });
764
769
  return LaborList;
765
770
  }
@@ -778,11 +783,13 @@ export class ROPrintService {
778
783
  Item.CGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CGST', 'CCGST'), DecimalsNumber);
779
784
  Item.SGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'SGST', 'CSGST'), DecimalsNumber);
780
785
  Item.IGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'IGST', 'CIGST'), DecimalsNumber);
786
+ Item.CESSAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'CTaxes', 'CESS', 'CCESS'), DecimalsNumber);
781
787
  } else {
782
788
  Item.UnPr = TrUtils.FixedTo(Item.UnPr, DecimalsNumber);
783
789
  Item.CGSTAmt = 0;
784
790
  Item.SGSTAmt = 0;
785
791
  Item.IGSTAmt = 0;
792
+ Item.CESSAmt = 0;
786
793
  }
787
794
  } else if (AsInsuranceOnly) {
788
795
  taxGroupKey = 'ATaxes';
@@ -795,6 +802,7 @@ export class ROPrintService {
795
802
  Item.CGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'CGST', 'ACGST'), DecimalsNumber);
796
803
  Item.SGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'SGST', 'ASGST'), DecimalsNumber);
797
804
  Item.IGSTAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'IGST', 'AIGST'), DecimalsNumber);
805
+ Item.CESSAmt = TrUtils.FixedTo(this.GetTaxAmountFromGroup(Item, 'ATaxes', 'CESS', 'ACESS'), DecimalsNumber);
798
806
  Item.AssPr = TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
799
807
  } else {
800
808
  Item.UnPr = TrUtils.FixedTo(Item.AssPr, DecimalsNumber);
@@ -802,6 +810,7 @@ export class ROPrintService {
802
810
  Item.CGSTAmt = 0;
803
811
  Item.SGSTAmt = 0;
804
812
  Item.IGSTAmt = 0;
813
+ Item.CESSAmt = 0;
805
814
  }
806
815
  }
807
816
  if (!TrUtils.IsZero(Item.Qty) && !TrUtils.CheckInvalidSelect(Item.UoM)) {
@@ -811,6 +820,7 @@ export class ROPrintService {
811
820
  Item.CGSTPerc = this.GetTaxRate(Item, 'CGST', taxGroupKey);
812
821
  Item.SGSTPerc = this.GetTaxRate(Item, 'SGST', taxGroupKey);
813
822
  Item.IGSTPerc = this.GetTaxRate(Item, 'IGST', taxGroupKey);
823
+ Item.CESSPerc = this.GetTaxRate(Item, 'CESS', taxGroupKey);
814
824
  });
815
825
  return Items;
816
826
  }
@@ -840,7 +850,7 @@ export class ROPrintService {
840
850
  return PrintInfo;
841
851
 
842
852
  }
843
-
853
+
844
854
  static GetFormatForROPrint(For: any, ROPrintData: any, argROType: any) {
845
855
  let ROLaborParts: any = {};
846
856
  ROLaborParts.Ops = ROPrintData.Ops;
@@ -1649,12 +1649,12 @@ export class SharedPDFService {
1649
1649
  }
1650
1650
 
1651
1651
  static AllHSNPartCGSTTaxListTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1652
-
1652
+ const hasCESS: boolean = this.hasCESS(PartsTaxInfo);
1653
1653
  if (ShowIGST) {
1654
1654
  return {
1655
1655
  style: 'tableExample',
1656
1656
  table: {
1657
- widths: [25, 60, 50],
1657
+ widths: hasCESS ? [25, 60, 50, 40] : [25, 60, 50],
1658
1658
  headerRows: 1,
1659
1659
  body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1660
1660
  },
@@ -1664,7 +1664,7 @@ export class SharedPDFService {
1664
1664
  return {
1665
1665
  style: 'tableExample',
1666
1666
  table: {
1667
- widths: [25, 60, 40, 40],
1667
+ widths: hasCESS ? [25, 60, 40, 40, 40] : [25, 60, 40, 40],
1668
1668
  headerRows: 1,
1669
1669
  body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1670
1670
  },
@@ -1674,12 +1674,12 @@ export class SharedPDFService {
1674
1674
  }
1675
1675
 
1676
1676
  static AllHSNPartCGSTTaxListTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1677
-
1677
+ const hasCESS: boolean = this.hasCESS(PartsTaxInfo);
1678
1678
  if (ShowIGST) {
1679
1679
  return {
1680
1680
  style: 'tableExample',
1681
1681
  table: {
1682
- widths: [40, 'auto', 50],
1682
+ widths: hasCESS ? [40, 'auto', 50, 40] : [40, 'auto', 50],
1683
1683
  headerRows: 1,
1684
1684
  body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1685
1685
  },
@@ -1689,7 +1689,7 @@ export class SharedPDFService {
1689
1689
  return {
1690
1690
  style: 'tableExample',
1691
1691
  table: {
1692
- widths: [50, 65, 50, 50],
1692
+ widths: hasCESS ? [50, 65, 50, 50, 40] : [50, 65, 50, 50],
1693
1693
  headerRows: 1,
1694
1694
  body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1695
1695
  },
@@ -1773,7 +1773,7 @@ export class SharedPDFService {
1773
1773
  }
1774
1774
  }
1775
1775
 
1776
- static CreateHeadingAllHSNTaxList(ShowIGST: any) {
1776
+ static CreateHeadingAllHSNTaxList(ShowIGST: any, hasCESS: boolean) {
1777
1777
  let HeaderNames = [{ text: 'HSN', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'HSN' },
1778
1778
  // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1779
1779
  // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
@@ -1782,15 +1782,18 @@ export class SharedPDFService {
1782
1782
  { text: 'Amount', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1783
1783
  ];
1784
1784
  if (ShowIGST) {
1785
- HeaderNames.splice(1, 0, { text: 'IGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'IGST' })
1785
+ HeaderNames.splice(1, 0, { text: 'IGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
1786
1786
  } else {
1787
- HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' })
1788
- HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' })
1787
+ HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1788
+ HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' });
1789
+ }
1790
+ if (hasCESS) {
1791
+ HeaderNames.push({ text: 'CESS', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CESS' });
1789
1792
  }
1790
1793
  return HeaderNames;
1791
1794
  }
1792
1795
 
1793
- static CreateHeadingAllTaxList(ShowIGST: any) {
1796
+ static CreateHeadingAllTaxList(ShowIGST: any, hasCESS: boolean) {
1794
1797
  let HeaderNames = [
1795
1798
  // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1796
1799
  // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
@@ -1802,27 +1805,44 @@ export class SharedPDFService {
1802
1805
  if (ShowIGST) {
1803
1806
  // HeaderNames.splice(1, 0, { text: 'IGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
1804
1807
  HeaderNames.splice(2, 0, { text: 'IGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGSTAmt', alignment: 'right' });
1808
+ if (hasCESS) {
1809
+ HeaderNames.splice(3, 0, { text: 'CESS(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CESSAmt', alignment: 'right' });
1810
+ }
1805
1811
  } else {
1806
1812
  // HeaderNames.splice(1, 0, { text: 'CGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1807
1813
  HeaderNames.splice(2, 0, { text: 'CGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGSTAmt', alignment: 'right' });
1808
1814
  // HeaderNames.splice(3, 0, { text: 'SGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1809
1815
  HeaderNames.splice(3, 0, { text: 'SGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'SGSTAmt', alignment: 'right' });
1816
+ if (hasCESS) {
1817
+ HeaderNames.splice(4, 0, { text: 'CESS(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CESSAmt', alignment: 'right' });
1818
+ }
1810
1819
  }
1820
+
1811
1821
  return HeaderNames;
1812
1822
  }
1823
+ static hasCESS(items: any[]): boolean {
1824
+ if (TrUtils.IsNull(items) || items?.length === 0) {
1825
+ return false;
1826
+ }
1827
+ return items.some(item =>
1828
+ item.Taxes?.some((tax: any) => tax.Code?.toUpperCase() === 'CESS')
1829
+ );
1830
+ }
1813
1831
 
1814
1832
  static CreateHSNTaxTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1815
1833
  if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1816
1834
  var body: any = [];
1817
- let columns: any = this.CreateHeadingAllTaxList(ShowIGST);
1835
+ console.log('PartsTaxInfo', PartsTaxInfo);
1836
+ const hasCESS: boolean = this.hasCESS(PartsTaxInfo);
1837
+ console.log('hasCESS', hasCESS);
1838
+ let columns: any = this.CreateHeadingAllTaxList(ShowIGST, hasCESS);
1818
1839
  body.push(columns);
1819
1840
  PartsTaxInfo.forEach((part: any) => {
1820
1841
  var dataRow: any = [];
1821
1842
  columns.forEach((column: any) => {
1822
1843
  if (!TrUtils.IsFixedZero(part[column.Field]) &&
1823
- !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt'
1824
- || column.Field === 'TotalTaxableAmount') {
1825
- if (column.Field === 'TotalTaxableAmount' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'IGSTAmt') {
1844
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'CESSAmt' || column.Field === 'TotalTaxableAmount') {
1845
+ if (column.Field === 'TotalTaxableAmount' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'IGSTAmt' || column.Field === 'CESSAmt') {
1826
1846
  dataRow.push({ text: TrUtils.FixPriceValue(part[column.Field]), alignment: 'right', opacity: 0.7, nowrap: true, fontSize: 6 });
1827
1847
  } else if (column.Field === 'CombinedTaxPercentage') {
1828
1848
  dataRow.push({ text: part[column.Field].toString() + '%', alignment: 'left', opacity: 0.7, nowrap: true, fontSize: 6 });
@@ -1846,13 +1866,14 @@ export class SharedPDFService {
1846
1866
  static CreateHSNTaxTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1847
1867
  if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1848
1868
  var body: any = [];
1849
- let columns: any = this.CreateHeadingAllHSNTaxList(ShowIGST);
1869
+ const hasCESS: boolean = this.hasCESS(PartsTaxInfo);
1870
+ let columns: any = this.CreateHeadingAllHSNTaxList(ShowIGST, hasCESS);
1850
1871
  body.push(columns);
1851
1872
  PartsTaxInfo.forEach((part: any) => {
1852
1873
  var dataRow: any = [];
1853
1874
  columns.forEach((column: any) => {
1854
1875
  if (!TrUtils.IsFixedZero(part[column.Field]) &&
1855
- !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
1876
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'CESS'
1856
1877
  || column.Field === 'TotalTaxAmount') {
1857
1878
  if (column.Field === 'SGSTLaborAmt') {
1858
1879
  dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });