shareneus 1.6.35 → 1.6.36
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.
|
@@ -2,6 +2,9 @@ export declare function GetInvoicePrintInfo(OriginalInvoiceData: any, OriginalEn
|
|
|
2
2
|
export declare function GetPrintConditionsBasedOnInput(InvoicePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean, ForInsurance: boolean, SType: any, OriginalInvoiceData: any, IsProforma: boolean, PartsPrint: boolean, LaborPrint: boolean): any;
|
|
3
3
|
export declare function GetInvoiceTypeHeading(InvoicePrintData: any, OriginalInvoiceData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean, PartsPrint: boolean, LaborPrint: boolean): any;
|
|
4
4
|
export declare function GetInvoiceOtherDetailsForPrint(InvoicePrintData: any, argInvoiceData: any): any;
|
|
5
|
+
export declare function GetTaxAmountFromTaxes(item: any, taxCode: string): any;
|
|
6
|
+
export declare function GetTaxRateFromTaxes(item: any, taxCode: string): any;
|
|
7
|
+
export declare function GetTCodeFromTaxes(item: any): any;
|
|
5
8
|
export declare function GetLaborPrintInfo(LaborList: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
|
|
6
9
|
export declare function GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, DecimalsNumber: number): any;
|
|
7
10
|
export declare function getTaxName(TCode: any, TaxCodes: any): any;
|
|
@@ -4,6 +4,9 @@ exports.GetInvoicePrintInfo = GetInvoicePrintInfo;
|
|
|
4
4
|
exports.GetPrintConditionsBasedOnInput = GetPrintConditionsBasedOnInput;
|
|
5
5
|
exports.GetInvoiceTypeHeading = GetInvoiceTypeHeading;
|
|
6
6
|
exports.GetInvoiceOtherDetailsForPrint = GetInvoiceOtherDetailsForPrint;
|
|
7
|
+
exports.GetTaxAmountFromTaxes = GetTaxAmountFromTaxes;
|
|
8
|
+
exports.GetTaxRateFromTaxes = GetTaxRateFromTaxes;
|
|
9
|
+
exports.GetTCodeFromTaxes = GetTCodeFromTaxes;
|
|
7
10
|
exports.GetLaborPrintInfo = GetLaborPrintInfo;
|
|
8
11
|
exports.GetItemsPrintInfo = GetItemsPrintInfo;
|
|
9
12
|
exports.getTaxName = getTaxName;
|
|
@@ -207,6 +210,30 @@ function GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData) {
|
|
|
207
210
|
InvoicePrintData.CrDate = my_date_1.MyDate.ConvertUTCDateToReadable(argInvoiceData.CrDate);
|
|
208
211
|
return InvoicePrintData;
|
|
209
212
|
}
|
|
213
|
+
function GetTaxAmountFromTaxes(item, taxCode) {
|
|
214
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
215
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
216
|
+
if (matchedTaxes.length !== 0) {
|
|
217
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
218
|
+
}
|
|
219
|
+
return 0;
|
|
220
|
+
}
|
|
221
|
+
function GetTaxRateFromTaxes(item, taxCode) {
|
|
222
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
223
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
224
|
+
if (matchedTaxes.length !== 0) {
|
|
225
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
|
|
226
|
+
}
|
|
227
|
+
return 0;
|
|
228
|
+
}
|
|
229
|
+
function GetTCodeFromTaxes(item) {
|
|
230
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
231
|
+
const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
|
|
232
|
+
if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
|
|
233
|
+
return matchedTax.TaxCodeId;
|
|
234
|
+
}
|
|
235
|
+
return item === null || item === void 0 ? void 0 : item.TCode;
|
|
236
|
+
}
|
|
210
237
|
function GetLaborPrintInfo(LaborList, Consolidate, TaxCodes, LineTotal, DecimalsNumber) {
|
|
211
238
|
LaborList.forEach((Labor) => {
|
|
212
239
|
Labor.HSN = Labor.SAC;
|
|
@@ -219,7 +246,6 @@ function GetLaborPrintInfo(LaborList, Consolidate, TaxCodes, LineTotal, Decimals
|
|
|
219
246
|
else {
|
|
220
247
|
Labor.UnPr = tr_utils_1.TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
221
248
|
}
|
|
222
|
-
Labor.TaxName = getTaxName(Labor.TCode, TaxCodes);
|
|
223
249
|
if (!tr_utils_1.TrUtils.IsEmpty(Labor.Perc)) {
|
|
224
250
|
Labor.DiscPerc = Labor.Perc;
|
|
225
251
|
}
|
|
@@ -232,13 +258,15 @@ function GetLaborPrintInfo(LaborList, Consolidate, TaxCodes, LineTotal, Decimals
|
|
|
232
258
|
Labor.DiscPerc = 0;
|
|
233
259
|
}
|
|
234
260
|
}
|
|
235
|
-
Labor.
|
|
236
|
-
Labor.
|
|
237
|
-
Labor.
|
|
261
|
+
Labor.TCode = GetTCodeFromTaxes(Labor);
|
|
262
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(GetTaxAmountFromTaxes(Labor, 'CGST'), DecimalsNumber);
|
|
263
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(GetTaxAmountFromTaxes(Labor, 'SGST'), DecimalsNumber);
|
|
264
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(GetTaxAmountFromTaxes(Labor, 'IGST'), DecimalsNumber);
|
|
238
265
|
Labor.QtyAndUoM = Labor.Qty.toString();
|
|
239
|
-
Labor.CGSTPerc =
|
|
240
|
-
Labor.SGSTPerc =
|
|
241
|
-
Labor.IGSTPerc =
|
|
266
|
+
Labor.CGSTPerc = GetTaxRateFromTaxes(Labor, 'CGST');
|
|
267
|
+
Labor.SGSTPerc = GetTaxRateFromTaxes(Labor, 'SGST');
|
|
268
|
+
Labor.IGSTPerc = GetTaxRateFromTaxes(Labor, 'IGST');
|
|
269
|
+
Labor.TaxName = getTaxName(Labor.TCode, TaxCodes);
|
|
242
270
|
if (LineTotal === 'AT') {
|
|
243
271
|
Labor.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Labor.AfterLaborTax, DecimalsNumber);
|
|
244
272
|
}
|
|
@@ -252,9 +280,9 @@ function GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, DecimalsNumb
|
|
|
252
280
|
Items.forEach((Item) => {
|
|
253
281
|
if (Consolidate) {
|
|
254
282
|
let AfterDiscForEach = (0, math_operations_1.Divide)(Item.AfterPartDisc, Item.Qty);
|
|
255
|
-
let CTaxAmtPerItem = (0, math_operations_1.Divide)(Item
|
|
256
|
-
let STaxAmtPerItem = (0, math_operations_1.Divide)(Item
|
|
257
|
-
let ITaxAmtPerItem = (0, math_operations_1.Divide)(Item
|
|
283
|
+
let CTaxAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'CGST'), Item.Qty);
|
|
284
|
+
let STaxAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'SGST'), Item.Qty);
|
|
285
|
+
let ITaxAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'IGST'), Item.Qty);
|
|
258
286
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Add)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
|
|
259
287
|
}
|
|
260
288
|
else {
|
|
@@ -267,9 +295,10 @@ function GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, DecimalsNumb
|
|
|
267
295
|
// }
|
|
268
296
|
// Item.Desc = Item['Desc'].split(' #{')[0];
|
|
269
297
|
Item.MRP = tr_utils_1.TrUtils.FixPriceValue(Item.MRP, DecimalsNumber);
|
|
270
|
-
Item.
|
|
271
|
-
Item.
|
|
272
|
-
Item.
|
|
298
|
+
Item.TCode = GetTCodeFromTaxes(Item);
|
|
299
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(GetTaxAmountFromTaxes(Item, 'CGST'), DecimalsNumber);
|
|
300
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(GetTaxAmountFromTaxes(Item, 'SGST'), DecimalsNumber);
|
|
301
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(GetTaxAmountFromTaxes(Item, 'IGST'), DecimalsNumber);
|
|
273
302
|
Item.TaxName = getTaxName(Item.TCode, TaxCodes);
|
|
274
303
|
if (!tr_utils_1.TrUtils.IsEmpty(Item.Perc)) {
|
|
275
304
|
Item.DiscPerc = Item.Perc;
|
|
@@ -283,9 +312,9 @@ function GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, DecimalsNumb
|
|
|
283
312
|
Item.DiscPerc = 0;
|
|
284
313
|
}
|
|
285
314
|
}
|
|
286
|
-
Item.CGSTPerc =
|
|
287
|
-
Item.SGSTPerc =
|
|
288
|
-
Item.IGSTPerc =
|
|
315
|
+
Item.CGSTPerc = GetTaxRateFromTaxes(Item, 'CGST');
|
|
316
|
+
Item.SGSTPerc = GetTaxRateFromTaxes(Item, 'SGST');
|
|
317
|
+
Item.IGSTPerc = GetTaxRateFromTaxes(Item, 'IGST');
|
|
289
318
|
if (LineTotal === 'AT') {
|
|
290
319
|
Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterPartTax, DecimalsNumber);
|
|
291
320
|
}
|
|
@@ -740,7 +740,7 @@ class ROPrintService {
|
|
|
740
740
|
}
|
|
741
741
|
static CheckLaborTaxItemIndex(LaborList) {
|
|
742
742
|
let TaxIndex = LaborList.findIndex((Labor) => {
|
|
743
|
-
if (!this.GetTCode(Labor)) {
|
|
743
|
+
if (!tr_utils_1.TrUtils.IsNull(this.GetTCode(Labor))) {
|
|
744
744
|
return Labor;
|
|
745
745
|
}
|
|
746
746
|
});
|
|
@@ -748,7 +748,7 @@ class ROPrintService {
|
|
|
748
748
|
}
|
|
749
749
|
static CheckPartTaxItemIndex(PartsList) {
|
|
750
750
|
let TaxIndex = PartsList.findIndex((Part) => {
|
|
751
|
-
if (!this.GetTCode(Part)) {
|
|
751
|
+
if (!tr_utils_1.TrUtils.IsNull(this.GetTCode(Part))) {
|
|
752
752
|
return Part;
|
|
753
753
|
}
|
|
754
754
|
});
|