shareneus 1.6.37 → 1.6.39
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.
|
@@ -20,6 +20,7 @@ function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCo
|
|
|
20
20
|
const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
|
|
21
21
|
printConfigData.withPass = withPass;
|
|
22
22
|
const invoicePrintData = (0, inv_print_service_1.GetInvoicePrintInfo)(invoiceData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false, options.PartInvoice, options.LaborInvoice);
|
|
23
|
+
console.log('invoicePrintData', invoicePrintData);
|
|
23
24
|
let invPrint;
|
|
24
25
|
if (options.ConsolidateGST || !options.ShowGST) {
|
|
25
26
|
invPrint = (0, unified_invoice_pdf_service_1.GetInvoicePrint)(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare class InvoiceTotalsService {
|
|
2
|
+
static GetTaxAmountFromTaxes(item: any, taxCode: string): any;
|
|
3
|
+
static GetTaxRateFromTaxes(item: any, taxCode: string): any;
|
|
4
|
+
static GetTCodeFromTaxes(item: any): any;
|
|
2
5
|
static GetTotalsValue(opCodesList: any, PartsList: any, IsIndependentTax: boolean, DetailedInfo: boolean, LDisc: any, LPerc: string, PDisc: any, PPerc: string, Disc: any, Perc: string, TaxCodes: any, WithItems: boolean, Settings: any, Adjust: number, isRoundable: boolean, EntitySettings: any): any;
|
|
3
6
|
static CalculateLaborValues(opCodesList: any, IsIndependentTax: boolean): any;
|
|
4
7
|
static ResetLaborValues(opCodesList: any, IsIndependentTax: boolean): any;
|
|
@@ -37,7 +40,6 @@ export declare class InvoiceTotalsService {
|
|
|
37
40
|
static GetLaborGSTTaxTotal(opCodesList: any, IsIndependentTax: boolean): number[];
|
|
38
41
|
static GetPartGSTTaxTotal(PartsList: any, IsIndependentTax: boolean): number[];
|
|
39
42
|
static GetTaxGroupingForPartsByHSN(Parts: any, TaxCodes: any, DecimalsNumber: any): any[];
|
|
40
|
-
static GetTaxRateFromTaxes(item: any, taxCode: string): any;
|
|
41
43
|
static GetCombinedTaxPercentage(Parts: any, TaxCodes: any): any;
|
|
42
44
|
static ComparePartsByHSN(Parts: any, TaxCodes: any): any[];
|
|
43
45
|
static GetTaxGroupingInfoByHSN(FinalMatchedParts: any, TaxCodes: any, DecimalsNumber: any): any[];
|
|
@@ -4,6 +4,30 @@ exports.InvoiceTotalsService = void 0;
|
|
|
4
4
|
const math_operations_1 = require("../../shared/math-operations");
|
|
5
5
|
const tr_utils_1 = require("../../utils/tr-utils");
|
|
6
6
|
class InvoiceTotalsService {
|
|
7
|
+
static GetTaxAmountFromTaxes(item, taxCode) {
|
|
8
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
9
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
10
|
+
if (matchedTaxes.length !== 0) {
|
|
11
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
12
|
+
}
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
static GetTaxRateFromTaxes(item, taxCode) {
|
|
16
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
17
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
18
|
+
if (matchedTaxes.length !== 0) {
|
|
19
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
static GetTCodeFromTaxes(item) {
|
|
24
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
25
|
+
const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
|
|
26
|
+
if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
|
|
27
|
+
return matchedTax.TaxCodeId;
|
|
28
|
+
}
|
|
29
|
+
return item === null || item === void 0 ? void 0 : item.TCode;
|
|
30
|
+
}
|
|
7
31
|
static GetTotalsValue(opCodesList, PartsList, IsIndependentTax, DetailedInfo, LDisc, LPerc, PDisc, PPerc, Disc, Perc, TaxCodes, WithItems, Settings, Adjust, isRoundable, EntitySettings) {
|
|
8
32
|
LPerc = tr_utils_1.TrUtils.SetPercToStringIfNull(LPerc);
|
|
9
33
|
PPerc = tr_utils_1.TrUtils.SetPercToStringIfNull(PPerc);
|
|
@@ -59,9 +83,10 @@ class InvoiceTotalsService {
|
|
|
59
83
|
Operation.Pr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Pr);
|
|
60
84
|
Operation.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
|
|
61
85
|
Operation.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Disc);
|
|
62
|
-
Operation.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.CGST);
|
|
63
|
-
Operation.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.SGST);
|
|
64
|
-
Operation.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.IGST);
|
|
86
|
+
Operation.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Operation, 'CGST') || Operation.CGST);
|
|
87
|
+
Operation.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Operation, 'SGST') || Operation.SGST);
|
|
88
|
+
Operation.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Operation, 'IGST') || Operation.IGST);
|
|
89
|
+
Operation.TCode = this.GetTCodeFromTaxes(Operation);
|
|
65
90
|
return Operation;
|
|
66
91
|
}
|
|
67
92
|
static CalculateLaborPartValues(PartsList, IsIndependentTax) {
|
|
@@ -91,9 +116,10 @@ class InvoiceTotalsService {
|
|
|
91
116
|
Part.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnPr);
|
|
92
117
|
Part.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.Disc);
|
|
93
118
|
Part.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.RecDisc);
|
|
94
|
-
Part.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.CGST);
|
|
95
|
-
Part.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.SGST);
|
|
96
|
-
Part.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.IGST);
|
|
119
|
+
Part.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'CGST') || Part.CGST);
|
|
120
|
+
Part.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'SGST') || Part.SGST);
|
|
121
|
+
Part.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'IGST') || Part.IGST);
|
|
122
|
+
Part.TCode = this.GetTCodeFromTaxes(Part);
|
|
97
123
|
return Part;
|
|
98
124
|
}
|
|
99
125
|
static GetFinalRODataForSave(LaborList, PartsList, IsIndependentTax, LDisc, LPerc, PDisc, PPerc, Disc, Perc, DetailedInfo, Settings, Adjust, isRoundable, DecimalsNumber) {
|
|
@@ -328,10 +354,9 @@ class InvoiceTotalsService {
|
|
|
328
354
|
TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
|
|
329
355
|
TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
|
|
330
356
|
TaxInfo.ItemsCount = MatchedLabor.length;
|
|
331
|
-
|
|
332
|
-
TaxInfo.
|
|
333
|
-
TaxInfo.
|
|
334
|
-
TaxInfo.IGST = GSTValues[2];
|
|
357
|
+
TaxInfo.CGST = this.GetTaxRateFromTaxes(MatchedLabor[0], 'CGST');
|
|
358
|
+
TaxInfo.SGST = this.GetTaxRateFromTaxes(MatchedLabor[0], 'SGST');
|
|
359
|
+
TaxInfo.IGST = this.GetTaxRateFromTaxes(MatchedLabor[0], 'IGST');
|
|
335
360
|
if (TaxOnAmount !== 0) {
|
|
336
361
|
SACTaxInfo.push(TaxInfo);
|
|
337
362
|
}
|
|
@@ -574,14 +599,6 @@ class InvoiceTotalsService {
|
|
|
574
599
|
let FinalMatchedParts = this.ComparePartsByHSN(Parts, TaxCodes);
|
|
575
600
|
return this.GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes, DecimalsNumber);
|
|
576
601
|
}
|
|
577
|
-
static GetTaxRateFromTaxes(item, taxCode) {
|
|
578
|
-
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
579
|
-
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
580
|
-
if (matchedTaxes.length !== 0) {
|
|
581
|
-
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
|
|
582
|
-
}
|
|
583
|
-
return 0;
|
|
584
|
-
}
|
|
585
602
|
static GetCombinedTaxPercentage(Parts, TaxCodes) {
|
|
586
603
|
Parts.forEach((Part) => {
|
|
587
604
|
if (tr_utils_1.TrUtils.IsNull(Part.HSN)) {
|
package/package.json
CHANGED
package/.vscode/settings.json
DELETED