shareneus 1.6.69 → 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.69",
3
+ "version": "1.6.70",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",