shareneus 1.6.32 → 1.6.33

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,7 @@
1
1
  export declare class ROPrintService {
2
2
  static GetTaxAmountFromGroup(item: any, taxGroupKey: string, taxCode: string, fallbackKey: string): any;
3
+ static GetTaxRateFromGroup(item: any, taxGroupKey: string, taxCode: string): number;
4
+ static GetTaxRate(item: any, taxCode: string, preferredTaxGroupKey?: string): number;
3
5
  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;
4
6
  static GetEmployeeData(empData: any): any;
5
7
  static GetROBasicDetailsForPrint(ROPrintData: any, argROData: any, Product: any, OrderType: any): any;
@@ -36,8 +38,8 @@ export declare class ROPrintService {
36
38
  static GetPartLineTotal(PartData: any, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, DecimalsNumber: number): string;
37
39
  static ReverseItemsForROPrint(argROData: any, isReverse: boolean): any;
38
40
  static GetDetailedInfoForItems(ROTotalsData: any, IncludeGST: boolean, ConsolidateGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, TaxCodes: any[], DecimalsNumber: number): any;
39
- static GetLaborPrintInfo(LaborList: any, ConsolidateGST: boolean, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, TaxCodes: any[], DecimalsNumber: number): any;
40
- static GetItemsPrintInfo(Items: any, ConsolidateGST: boolean, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, TaxCodes: any[], DecimalsNumber: number): any;
41
+ static GetLaborPrintInfo(LaborList: any, ConsolidateGST: boolean, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, _TaxCodes: any[], DecimalsNumber: number): any;
42
+ static GetItemsPrintInfo(Items: any, ConsolidateGST: boolean, IncludeGST: boolean, AsCustomerOnly: boolean, AsInsuranceOnly: boolean, _TaxCodes: any[], DecimalsNumber: number): any;
41
43
  static CheckLaborTaxItemIndex(LaborList: any[]): any;
42
44
  static CheckPartTaxItemIndex(PartsList: any[]): any;
43
45
  static PrepareFormatForROPrint(ROPrintData: any, For: string, argROType: any): any[];
@@ -19,6 +19,34 @@ class ROPrintService {
19
19
  }
20
20
  return tr_utils_1.TrUtils.SetValueToZeroIfNull(item === null || item === void 0 ? void 0 : item[fallbackKey]);
21
21
  }
22
+ static GetTaxRateFromGroup(item, taxGroupKey, taxCode) {
23
+ const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
24
+ if (Array.isArray(groupedTaxes)) {
25
+ const matchedTaxes = groupedTaxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
26
+ if (matchedTaxes.length !== 0) {
27
+ 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));
28
+ }
29
+ }
30
+ return 0;
31
+ }
32
+ static GetTaxRate(item, taxCode, preferredTaxGroupKey) {
33
+ const taxGroupKeys = [];
34
+ if (typeof preferredTaxGroupKey === 'string' && preferredTaxGroupKey.length !== 0) {
35
+ taxGroupKeys.push(preferredTaxGroupKey);
36
+ }
37
+ ['CTaxes', 'ATaxes', 'ETaxes'].forEach((groupKey) => {
38
+ if (taxGroupKeys.indexOf(groupKey) === -1) {
39
+ taxGroupKeys.push(groupKey);
40
+ }
41
+ });
42
+ for (const taxGroupKey of taxGroupKeys) {
43
+ const rate = this.GetTaxRateFromGroup(item, taxGroupKey, taxCode);
44
+ if (!tr_utils_1.TrUtils.IsZero(rate)) {
45
+ return rate;
46
+ }
47
+ }
48
+ return 0;
49
+ }
22
50
  static GetRepairOrderPrintInfo(OriginalROData, OriginalCustomerData, OriginalVehicleData, OriginalEntityData, image, IncludeGST, ConsolidateGST, Payee, InsCompanyName, AsCustomerOnly, AsInsuranceOnly, TaxCodes, OrderType, isReverse) {
23
51
  let ROPrintData = {};
24
52
  let argROData = tr_utils_1.TrUtils.Stringify(OriginalROData);
@@ -590,9 +618,10 @@ class ROPrintService {
590
618
  }
591
619
  return ROTotalsData;
592
620
  }
593
- static GetLaborPrintInfo(LaborList, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes, DecimalsNumber) {
621
+ static GetLaborPrintInfo(LaborList, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, _TaxCodes, DecimalsNumber) {
594
622
  LaborList.forEach((Labor) => {
595
623
  Labor.HSN = Labor.SAC;
624
+ let taxGroupKey = 'CTaxes';
596
625
  if (AsCustomerOnly) {
597
626
  if (IncludeGST) {
598
627
  if (ConsolidateGST) {
@@ -613,6 +642,7 @@ class ROPrintService {
613
642
  }
614
643
  }
615
644
  else if (AsInsuranceOnly) {
645
+ taxGroupKey = 'ATaxes';
616
646
  if (IncludeGST) {
617
647
  if (ConsolidateGST) {
618
648
  Labor.UnPr = tr_utils_1.TrUtils.FixedTo(Labor.InsAfterTax, DecimalsNumber);
@@ -633,14 +663,15 @@ class ROPrintService {
633
663
  Labor.IGSTAmt = 0;
634
664
  }
635
665
  }
636
- Labor.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
637
- Labor.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
638
- Labor.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
666
+ Labor.CGSTPerc = this.GetTaxRate(Labor, 'CGST', taxGroupKey);
667
+ Labor.SGSTPerc = this.GetTaxRate(Labor, 'SGST', taxGroupKey);
668
+ Labor.IGSTPerc = this.GetTaxRate(Labor, 'IGST', taxGroupKey);
639
669
  });
640
670
  return LaborList;
641
671
  }
642
- static GetItemsPrintInfo(Items, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, TaxCodes, DecimalsNumber) {
672
+ static GetItemsPrintInfo(Items, ConsolidateGST, IncludeGST, AsCustomerOnly, AsInsuranceOnly, _TaxCodes, DecimalsNumber) {
643
673
  Items.forEach((Item) => {
674
+ let taxGroupKey = 'CTaxes';
644
675
  if (AsCustomerOnly) {
645
676
  if (IncludeGST) {
646
677
  if (ConsolidateGST) {
@@ -661,6 +692,7 @@ class ROPrintService {
661
692
  }
662
693
  }
663
694
  else if (AsInsuranceOnly) {
695
+ taxGroupKey = 'ATaxes';
664
696
  if (IncludeGST) {
665
697
  if (ConsolidateGST) {
666
698
  Item.UnPr = tr_utils_1.TrUtils.FixedTo(Item.InsAfterTaxPerItem, DecimalsNumber);
@@ -684,9 +716,9 @@ class ROPrintService {
684
716
  if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
685
717
  Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
686
718
  }
687
- Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
688
- Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
689
- Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
719
+ Item.CGSTPerc = this.GetTaxRate(Item, 'CGST', taxGroupKey);
720
+ Item.SGSTPerc = this.GetTaxRate(Item, 'SGST', taxGroupKey);
721
+ Item.IGSTPerc = this.GetTaxRate(Item, 'IGST', taxGroupKey);
690
722
  });
691
723
  return Items;
692
724
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.32",
3
+ "version": "1.6.33",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",