shareneus 1.6.67 → 1.6.69
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.
|
@@ -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 +
|
|
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)(
|
|
118
|
-
let STaxAmtPerItem = (0, math_operations_1.Divide)(
|
|
119
|
-
let ITaxAmtPerItem = (0, math_operations_1.Divide)(
|
|
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(
|
|
129
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(
|
|
130
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(
|
|
131
|
-
Item.CGSTPerc =
|
|
132
|
-
Item.SGSTPerc =
|
|
133
|
-
Item.IGSTPerc =
|
|
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;
|
|
@@ -25,5 +26,7 @@ export declare class SalesTotalsService {
|
|
|
25
26
|
static GetCombinedTaxPercentage(Items: any, TaxCodes: any): any;
|
|
26
27
|
static CompareItemsByHSN(Items: any, TaxCodes: any): any[];
|
|
27
28
|
static GetTaxGroupingInfoByHSN(FinalMatchedParts: any, TaxCodes: any, DecimalsNumber: any): any[];
|
|
29
|
+
static GetTaxAmountFromTaxes(item: any, taxCode: string, fallbackAmount?: any): any;
|
|
30
|
+
static GetTaxRateFromTaxes(item: any, taxCode: string, fallbackRate?: any): any;
|
|
28
31
|
static GetGSTValueBasedOnTaxCode(TCode: any, TaxCodes: any): any[];
|
|
29
32
|
}
|
|
@@ -48,11 +48,20 @@ class SalesTotalsService {
|
|
|
48
48
|
Item.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.UnPr);
|
|
49
49
|
Item.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc);
|
|
50
50
|
Item.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
|
|
51
|
-
Item.CGST =
|
|
52
|
-
Item.SGST =
|
|
53
|
-
Item.IGST =
|
|
51
|
+
Item.CGST = this.GetTaxAmountFromTaxes(Item, 'CGST');
|
|
52
|
+
Item.SGST = this.GetTaxAmountFromTaxes(Item, 'SGST');
|
|
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);
|
|
@@ -283,9 +292,9 @@ class SalesTotalsService {
|
|
|
283
292
|
Item.HSN = '';
|
|
284
293
|
}
|
|
285
294
|
let TaxInfo = this.GetGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
|
|
286
|
-
Item.CGSTAmt =
|
|
287
|
-
Item.SGSTAmt =
|
|
288
|
-
Item.IGSTAmt =
|
|
295
|
+
Item.CGSTAmt = this.GetTaxRateFromTaxes(Item, 'CGST');
|
|
296
|
+
Item.SGSTAmt = this.GetTaxRateFromTaxes(Item, 'SGST');
|
|
297
|
+
Item.IGSTAmt = this.GetTaxRateFromTaxes(Item, 'IGST');
|
|
289
298
|
Item.CombinedTaxPercentage = (0, math_operations_1.Add)(Item.CGSTAmt, Item.SGSTAmt, Item.IGSTAmt);
|
|
290
299
|
});
|
|
291
300
|
return Items;
|
|
@@ -361,6 +370,22 @@ class SalesTotalsService {
|
|
|
361
370
|
});
|
|
362
371
|
return HSNTaxInfo;
|
|
363
372
|
}
|
|
373
|
+
static GetTaxAmountFromTaxes(item, taxCode, fallbackAmount = 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.Amt), 0);
|
|
378
|
+
}
|
|
379
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackAmount);
|
|
380
|
+
}
|
|
381
|
+
static GetTaxRateFromTaxes(item, taxCode, fallbackRate = 0) {
|
|
382
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
383
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
384
|
+
if (matchedTaxes.length !== 0) {
|
|
385
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
|
|
386
|
+
}
|
|
387
|
+
return tr_utils_1.TrUtils.SetValueToZeroIfNull(fallbackRate);
|
|
388
|
+
}
|
|
364
389
|
static GetGSTValueBasedOnTaxCode(TCode, TaxCodes) {
|
|
365
390
|
let CGST = 0;
|
|
366
391
|
let SGST = 0;
|