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.
@@ -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.CCGST, DecimalsNumber);
418
- Labor.CSGST = tr_utils_1.TrUtils.FixPriceValue(Labor.CSGST, DecimalsNumber);
419
- Labor.CIGST = tr_utils_1.TrUtils.FixPriceValue(Labor.CIGST, DecimalsNumber);
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.ACGST, DecimalsNumber);
423
- Labor.ASGST = tr_utils_1.TrUtils.FixPriceValue(Labor.ASGST, DecimalsNumber);
424
- Labor.AIGST = tr_utils_1.TrUtils.FixPriceValue(Labor.AIGST, DecimalsNumber);
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.ECGST, DecimalsNumber);
440
- Labor.ESGST = tr_utils_1.TrUtils.FixPriceValue(Labor.ESGST, DecimalsNumber);
441
- Labor.EIGST = tr_utils_1.TrUtils.FixPriceValue(Labor.EIGST, DecimalsNumber);
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.CCGST, DecimalsNumber);
461
- Part.CSGST = tr_utils_1.TrUtils.FixPriceValue(Part.CSGST, DecimalsNumber);
462
- Part.CIGST = tr_utils_1.TrUtils.FixPriceValue(Part.CIGST, DecimalsNumber);
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.ACGST, DecimalsNumber);
467
- Part.ASGST = tr_utils_1.TrUtils.FixPriceValue(Part.ASGST, DecimalsNumber);
468
- Part.AIGST = tr_utils_1.TrUtils.FixPriceValue(Part.AIGST, DecimalsNumber);
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.ECGST, DecimalsNumber);
486
- Part.ESGST = tr_utils_1.TrUtils.FixPriceValue(Part.ESGST, DecimalsNumber);
487
- Part.EIGST = tr_utils_1.TrUtils.FixPriceValue(Part.EIGST, DecimalsNumber);
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.ECGST, DecimalsNumber);
832
- Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.ESGST, DecimalsNumber);
833
- Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.EIGST, DecimalsNumber);
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.CCGST, DecimalsNumber);
844
- Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.CSGST, DecimalsNumber);
845
- Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Labor.CIGST, DecimalsNumber);
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.ECGST, DecimalsNumber);
865
- Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.ESGST, DecimalsNumber);
866
- Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.EIGST, DecimalsNumber);
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.CCGST, DecimalsNumber);
877
- Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CSGST, DecimalsNumber);
878
- Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CIGST, DecimalsNumber);
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.CCGST, DecimalsNumber);
595
- Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.CSGST, DecimalsNumber);
596
- Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.CIGST, DecimalsNumber);
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.ACGST, DecimalsNumber);
614
- Labor.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.ASGST, DecimalsNumber);
615
- Labor.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Labor.AIGST, DecimalsNumber);
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.CCGST, DecimalsNumber);
643
- Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.CSGST, DecimalsNumber);
644
- Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.CIGST, DecimalsNumber);
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.ACGST, DecimalsNumber);
662
- Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.ASGST, DecimalsNumber);
663
- Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(Item.AIGST, DecimalsNumber);
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 = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.ACGST);
42
- Operation.ASGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.ASGST);
43
- Operation.AIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.AIGST);
44
- Operation.CCGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.CCGST);
45
- Operation.CSGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.CSGST);
46
- Operation.CIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(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 = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.ECGST);
52
- Operation.ESGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.ESGST);
53
- Operation.EIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(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 = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.ACGST);
183
- Part.ASGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.ASGST);
184
- Part.AIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.AIGST);
185
- Part.CCGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.CCGST);
186
- Part.CSGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.CSGST);
187
- Part.CIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(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 = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.ECGST);
195
- Part.ESGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.ESGST);
196
- Part.EIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.28",
3
+ "version": "1.6.29",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",