shareneus 1.6.68 → 1.6.70

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 function GetInvoicePDF(invoiceData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], withPass?: boolean, options?: any): any;
2
+ export declare function GetSalesOrderPDF(salesOrderData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], options?: any): any;
2
3
  export declare function GetCreditNotePDF(creditNoteData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], options?: any): any;
3
4
  export declare function GetSalesReceiptPDF(salesReceiptData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], withPass?: boolean, options?: any): any;
4
5
  export declare function GetBillPDF(billData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any): any;
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetInvoicePDF = GetInvoicePDF;
4
+ exports.GetSalesOrderPDF = GetSalesOrderPDF;
4
5
  exports.GetCreditNotePDF = GetCreditNotePDF;
5
6
  exports.GetSalesReceiptPDF = GetSalesReceiptPDF;
6
7
  exports.GetBillPDF = GetBillPDF;
7
8
  const purchase_order_print_service_1 = require("../../purchases/purchase-order/purchase-order-print.service");
9
+ const sales_pdf_service_1 = require("../../sales/sales/sales-pdf.service");
10
+ const sales_print_service_1 = require("../../sales/sales/sales-print.service");
8
11
  const math_operations_1 = require("../../shared/math-operations");
9
12
  const tr_utils_1 = require("../../utils/tr-utils");
10
13
  const pos_receipt_pdf_1 = require("../counter-sales/pos-receipt-pdf");
@@ -45,6 +48,30 @@ function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCo
45
48
  }
46
49
  return invPrint;
47
50
  }
51
+ function GetSalesOrderPDF(salesOrderData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], options = null) {
52
+ var _a;
53
+ if (!options) {
54
+ options = {
55
+ ShowGST: (((_a = salesOrderData === null || salesOrderData === void 0 ? void 0 : salesOrderData.Settings) === null || _a === void 0 ? void 0 : _a.Tax) === 'TI') ? true : false,
56
+ ConsolidateGST: false,
57
+ Size: 'full',
58
+ isOtherIndustry: false,
59
+ Design: false,
60
+ MoreDiscDetails: false,
61
+ Orientation: 'portrait'
62
+ };
63
+ }
64
+ const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
65
+ const soPrintData = sales_print_service_1.SalesPrintService.GetSalesPrintInfo(salesOrderData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false, options.isOtherIndustry);
66
+ let soPrint;
67
+ if (options.ConsolidateGST || !options.ShowGST) {
68
+ soPrint = sales_pdf_service_1.SalesPdfService.GetSalesPrint(salesOrderData, numberofCopies, options.isOtherIndustry, entityData, options.Design, options.SoItems, image, options.MoreDiscDetails);
69
+ }
70
+ else {
71
+ soPrint = (0, invoice_pdf_service_1.CreateInvoicePDFService)(soPrintData, printConfigData, numberofCopies);
72
+ }
73
+ return soPrint;
74
+ }
48
75
  function GetCreditNotePDF(creditNoteData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], options = null) {
49
76
  var _a;
50
77
  if (!options) {
@@ -4,6 +4,9 @@ export declare class DeliveryChallanPrintService {
4
4
  static GetInvoiceTypeHeading(InvoicePrintData: any, OriginalInvoiceData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean): any;
5
5
  static GetInvoiceOtherDetailsForPrint(InvoicePrintData: any, OriginalInvoiceData: any): any;
6
6
  static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
7
+ static GetTaxAmountFromTaxes(item: any, taxCode: string, fallbackAmount?: any): any;
8
+ static GetTaxRateFromTaxes(item: any, taxCode: string, fallbackRate?: any): any;
9
+ static GetTCodeFromTaxes(item: any): any;
7
10
  static ReverseItemsForInvoicePrint(argInvoiceData: any): any;
8
11
  static PrepareFormatForInvoicePrint(InvoicePrintData: any, ROType: any, InvoiceStatus: any): any[];
9
12
  static GetBillNameForInvoicePrint(OriginalInvoiceData: any, InvoicePrintData: any): any;
@@ -78,22 +78,26 @@ class DeliveryChallanPrintService {
78
78
  }
79
79
  static GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, DecimalsNumber) {
80
80
  Items.forEach((Item) => {
81
+ const cgst = this.GetTaxAmountFromTaxes(Item, 'CGST');
82
+ const sgst = this.GetTaxAmountFromTaxes(Item, 'SGST');
83
+ const igst = this.GetTaxAmountFromTaxes(Item, 'IGST');
81
84
  if (Consolidate) {
82
85
  let AfterDiscForEach = (0, math_operations_1.Divide)(Item.AfterPartDisc, Item.Qty);
83
- let CTaxAmtPerItem = (0, math_operations_1.Divide)(Item.CGST, Item.Qty);
84
- let STaxAmtPerItem = (0, math_operations_1.Divide)(Item.SGST, Item.Qty);
85
- let ITaxAmtPerItem = (0, math_operations_1.Divide)(Item.IGST, Item.Qty);
86
+ let CTaxAmtPerItem = (0, math_operations_1.Divide)(cgst, Item.Qty);
87
+ let STaxAmtPerItem = (0, math_operations_1.Divide)(sgst, Item.Qty);
88
+ let ITaxAmtPerItem = (0, math_operations_1.Divide)(igst, Item.Qty);
86
89
  Item.UnPr = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
87
90
  }
88
91
  else {
89
92
  Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
90
93
  }
91
- Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CGST, DecimalsNumber);
92
- Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.SGST, DecimalsNumber);
93
- Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.IGST, DecimalsNumber);
94
- Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
95
- Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
96
- Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
94
+ Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(cgst, DecimalsNumber);
95
+ Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(sgst, DecimalsNumber);
96
+ Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(igst, DecimalsNumber);
97
+ Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST');
98
+ Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST');
99
+ Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST');
100
+ Item.TCode = this.GetTCodeFromTaxes(Item);
97
101
  if (LineTotal === 'AT') {
98
102
  Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterPartTax, DecimalsNumber);
99
103
  }
@@ -106,6 +110,30 @@ class DeliveryChallanPrintService {
106
110
  });
107
111
  return Items;
108
112
  }
113
+ static GetTaxAmountFromTaxes(item, taxCode, fallbackAmount = 0) {
114
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
115
+ const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
116
+ if (matchedTaxes.length !== 0) {
117
+ return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
118
+ }
119
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackAmount);
120
+ }
121
+ static GetTaxRateFromTaxes(item, taxCode, fallbackRate = 0) {
122
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
123
+ const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
124
+ if (matchedTaxes.length !== 0) {
125
+ return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
126
+ }
127
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackRate);
128
+ }
129
+ static GetTCodeFromTaxes(item) {
130
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
131
+ const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
132
+ if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
133
+ return matchedTax.TaxCodeId;
134
+ }
135
+ return item === null || item === void 0 ? void 0 : item.TCode;
136
+ }
109
137
  static ReverseItemsForInvoicePrint(argInvoiceData) {
110
138
  argInvoiceData.Items = argInvoiceData.Items.reverse();
111
139
  return argInvoiceData;
@@ -25,5 +25,8 @@ export declare class DeliveryChallanTotalsService {
25
25
  static GetCombinedTaxPercentage(Parts: any, TaxCodes: any): any;
26
26
  static ComparePartsByHSN(Parts: any, TaxCodes: any): any[];
27
27
  static GetTaxGroupingInfoByHSN(FinalMatchedParts: any, TaxCodes: any, DecimalsNumber: any): any[];
28
+ static GetTaxAmountFromTaxes(item: any, taxCode: string, fallbackAmount?: any): any;
29
+ static GetTaxRateFromTaxes(item: any, taxCode: string, fallbackRate?: any): any;
30
+ static GetTCodeFromTaxes(item: any): any;
28
31
  static GetGSTValueBasedOnTaxCode(TCode: any, TaxCodes: any): any[];
29
32
  }
@@ -45,9 +45,10 @@ class DeliveryChallanTotalsService {
45
45
  Part.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
46
46
  Part.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
47
47
  Part.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc);
48
- Part.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.CGST);
49
- Part.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.SGST);
50
- Part.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.IGST);
48
+ Part.CGST = this.GetTaxAmountFromTaxes(Part, 'CGST');
49
+ Part.SGST = this.GetTaxAmountFromTaxes(Part, 'SGST');
50
+ Part.IGST = this.GetTaxAmountFromTaxes(Part, 'IGST');
51
+ Part.TCode = this.GetTCodeFromTaxes(Part);
51
52
  return Part;
52
53
  }
53
54
  static GetFinalChallanDataForSave(PartsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings, isRoundable, DecimalsNumber) {
@@ -283,10 +284,9 @@ class DeliveryChallanTotalsService {
283
284
  if (tr_utils_1.TrUtils.IsNull(Part.HSN)) {
284
285
  Part.HSN = '';
285
286
  }
286
- let GSTValues = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
287
- Part.CGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[0]);
288
- Part.SGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[1]);
289
- Part.IGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(GSTValues[2]);
287
+ Part.CGSTAmt = this.GetTaxRateFromTaxes(Part, 'CGST');
288
+ Part.SGSTAmt = this.GetTaxRateFromTaxes(Part, 'SGST');
289
+ Part.IGSTAmt = this.GetTaxRateFromTaxes(Part, 'IGST');
290
290
  Part.CombinedTaxPercentage = (0, math_operations_1.Add)(Part.CGSTAmt, Part.SGSTAmt, Part.IGSTAmt);
291
291
  });
292
292
  return Parts;
@@ -362,6 +362,30 @@ class DeliveryChallanTotalsService {
362
362
  });
363
363
  return HSNTaxInfo;
364
364
  }
365
+ static GetTaxAmountFromTaxes(item, taxCode, fallbackAmount = 0) {
366
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
367
+ const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
368
+ if (matchedTaxes.length !== 0) {
369
+ return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
370
+ }
371
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackAmount);
372
+ }
373
+ static GetTaxRateFromTaxes(item, taxCode, fallbackRate = 0) {
374
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
375
+ const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
376
+ if (matchedTaxes.length !== 0) {
377
+ return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
378
+ }
379
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackRate);
380
+ }
381
+ static GetTCodeFromTaxes(item) {
382
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
383
+ const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
384
+ if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
385
+ return matchedTax.TaxCodeId;
386
+ }
387
+ return item === null || item === void 0 ? void 0 : item.TCode;
388
+ }
365
389
  static GetGSTValueBasedOnTaxCode(TCode, TaxCodes) {
366
390
  let CGST = 0;
367
391
  let SGST = 0;
@@ -4,12 +4,15 @@ export declare class SalesPrintService {
4
4
  static GetInvoiceTypeHeading(InvoicePrintData: any, OriginalInvoiceData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean): any;
5
5
  static GetInvoiceOtherDetailsForPrint(InvoicePrintData: any, OriginalInvoiceData: any): any;
6
6
  static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, isOtherIndustry: boolean, LineTotal: string, DecimalsNumber: number): any;
7
+ static GetTCodeFromTaxes(item: any): any;
7
8
  static ReverseItemsForInvoicePrint(argInvoiceData: any): any;
8
9
  static PrepareFormatForInvoicePrint(InvoicePrintData: any, ROType: any, InvoiceStatus: any): any[];
9
10
  static GetFormattedProductDataForPrint(OriginalInvoiceData: any, InvoicePrintData: any): any;
10
11
  static GetShipToForSOPrint(OriginalInvoiceData: any, InvoicePrintData: any): any;
11
12
  static GetBillNameForInvoicePrint(OriginalInvoiceData: any, InvoicePrintData: any): any;
12
13
  static GetCustomerDetails(OriginalInvoiceData: any): any;
14
+ static GetTaxAmountFromTaxes(item: any, taxCode: string, fallbackAmount?: any): any;
15
+ static GetTaxRateFromTaxes(item: any, taxCode: string, fallbackRate?: any): any;
13
16
  static GetBillToName(Title: any, Name: string): string;
14
17
  static GetPaymentsTotal(InvoicePayments: any, Total: number, InvoiceStatus: string, DecimalsNumber: number): any;
15
18
  }
@@ -104,19 +104,19 @@ class SalesPrintService {
104
104
  let DiscAmt = 0;
105
105
  Items.forEach((Item) => {
106
106
  if (tr_utils_1.TrUtils.IsNull(Item.Type) || Item.Type === 'Lab') {
107
+ const cgst = this.GetTaxAmountFromTaxes(Item, 'CGST');
108
+ const sgst = this.GetTaxAmountFromTaxes(Item, 'SGST');
109
+ const igst = this.GetTaxAmountFromTaxes(Item, 'IGST');
107
110
  Amt = Amt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.UnAmt);
108
111
  DiscAmt = DiscAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
109
- TaxAmt = TaxAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
110
- + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
112
+ TaxAmt = TaxAmt + cgst + sgst + igst;
111
113
  let NetAmt = (0, math_operations_1.Subtract)(Item.UnAmt, Item.Disc, Item.RecDisc);
112
- TotalAmt = TotalAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(NetAmt) +
113
- tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
114
- + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
114
+ TotalAmt = TotalAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(NetAmt) + cgst + sgst + igst;
115
115
  if (Consolidate) {
116
116
  let AfterDiscForEach = (0, math_operations_1.Divide)(Item.AfterItemDisc, Item.Qty);
117
- let CTaxAmtPerItem = (0, math_operations_1.Divide)(Item.CGST, Item.Qty);
118
- let STaxAmtPerItem = (0, math_operations_1.Divide)(Item.SGST, Item.Qty);
119
- let ITaxAmtPerItem = (0, math_operations_1.Divide)(Item.IGST, Item.Qty);
117
+ let CTaxAmtPerItem = (0, math_operations_1.Divide)(cgst, Item.Qty);
118
+ let STaxAmtPerItem = (0, math_operations_1.Divide)(sgst, Item.Qty);
119
+ let ITaxAmtPerItem = (0, math_operations_1.Divide)(igst, Item.Qty);
120
120
  Item.UnPr = tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Add)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
121
121
  }
122
122
  else {
@@ -125,12 +125,13 @@ class SalesPrintService {
125
125
  if (isOtherIndustry && tr_utils_1.TrUtils.IsNull(Item.Type) && !tr_utils_1.TrUtils.IsNull(Item.Model) && !tr_utils_1.TrUtils.IsNull(Item.TR)) {
126
126
  Item.Desc = Item.Desc + '( ' + Item.Model + ', ' + Item.TR + ' TR )';
127
127
  }
128
- Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CGST, DecimalsNumber);
129
- Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.SGST, DecimalsNumber);
130
- Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.IGST, DecimalsNumber);
131
- Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
132
- Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
133
- Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
128
+ Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(cgst, DecimalsNumber);
129
+ Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(sgst, DecimalsNumber);
130
+ Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(igst, DecimalsNumber);
131
+ Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST');
132
+ Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST');
133
+ Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST');
134
+ Item.TCode = this.GetTCodeFromTaxes(Item);
134
135
  if (LineTotal === 'AT') {
135
136
  Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterItemTax, DecimalsNumber);
136
137
  }
@@ -162,6 +163,14 @@ class SalesPrintService {
162
163
  });
163
164
  return Items;
164
165
  }
166
+ static GetTCodeFromTaxes(item) {
167
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
168
+ const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
169
+ if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
170
+ return matchedTax.TaxCodeId;
171
+ }
172
+ return item === null || item === void 0 ? void 0 : item.TCode;
173
+ }
165
174
  static ReverseItemsForInvoicePrint(argInvoiceData) {
166
175
  // argInvoiceData.Ops = argInvoiceData.Ops.reverse();
167
176
  argInvoiceData.Items = argInvoiceData.Items.reverse();
@@ -279,6 +288,22 @@ class SalesPrintService {
279
288
  Customer.ConPh = OriginalInvoiceData.Cust.ConPhone;
280
289
  return Customer;
281
290
  }
291
+ static GetTaxAmountFromTaxes(item, taxCode, fallbackAmount = 0) {
292
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
293
+ const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
294
+ if (matchedTaxes.length !== 0) {
295
+ return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
296
+ }
297
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackAmount);
298
+ }
299
+ static GetTaxRateFromTaxes(item, taxCode, fallbackRate = 0) {
300
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
301
+ const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
302
+ if (matchedTaxes.length !== 0) {
303
+ return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
304
+ }
305
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackRate);
306
+ }
282
307
  static GetBillToName(Title, Name) {
283
308
  return tr_utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
284
309
  }
@@ -3,6 +3,7 @@ export declare class SalesTotalsService {
3
3
  static CalculateLaborItemValues(ItemsList: any, IsIndependentTax: boolean): any;
4
4
  static ResetLaborItemValues(ItemsList: any, IsIndependentTax: boolean): any;
5
5
  static ResetLaborItemValueIfInvalid(Item: any): any;
6
+ static GetTCodeFromTaxes(item: any): any;
6
7
  static GetFinalRODataForSave(ItemsList: any, IsIndependentTax: boolean, PDisc: string, PPerc: string, Disc: any, Perc: string, DetailedInfo: boolean, Settings: any, isRoundable: boolean, DecimalsNumber: number): any;
7
8
  static SetMainDiscountValues(PPerc: string, PDisc: any, Disc: any, Perc: string, finalTotalsData: any, DetailedInfo: boolean): any;
8
9
  static GetFinalCustomerTotalsData(finalTotalsData: any, ItemsList: any, IsIndependentTax: boolean, DetailedInfo: boolean, isRoundable: boolean, DecimalsNumber: number): any;
@@ -51,8 +51,17 @@ class SalesTotalsService {
51
51
  Item.CGST = this.GetTaxAmountFromTaxes(Item, 'CGST');
52
52
  Item.SGST = this.GetTaxAmountFromTaxes(Item, 'SGST');
53
53
  Item.IGST = this.GetTaxAmountFromTaxes(Item, 'IGST');
54
+ Item.TCode = this.GetTCodeFromTaxes(Item);
54
55
  return Item;
55
56
  }
57
+ static GetTCodeFromTaxes(item) {
58
+ const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
59
+ const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
60
+ if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
61
+ return matchedTax.TaxCodeId;
62
+ }
63
+ return item === null || item === void 0 ? void 0 : item.TCode;
64
+ }
56
65
  static GetFinalRODataForSave(ItemsList, IsIndependentTax, PDisc, PPerc, Disc, Perc, DetailedInfo, Settings, isRoundable, DecimalsNumber) {
57
66
  let finalTotalsData = {};
58
67
  finalTotalsData = this.SetMainDiscountValues(PPerc, PDisc, Disc, Perc, finalTotalsData, DetailedInfo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.68",
3
+ "version": "1.6.70",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",