shareneus 1.6.39 → 1.6.40
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.
- package/dist/accounting/counter-sales/sales-receipt-print.service.d.ts +3 -0
- package/dist/accounting/counter-sales/sales-receipt-print.service.js +44 -15
- package/dist/accounting/invoice/invoice-pdf.service.js +0 -1
- package/dist/shared/totals-section/pdf-totals.section.js +3 -1
- package/package.json +1 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare class SaleReceiptPrintService {
|
|
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 GetSaleReceiptPrintInfo(OriginalInvoiceData: any, OriginalEntityData: any, image: any, IncludeGST: boolean, ConsolidateGST: boolean, TaxCodes: any, IsProforma: boolean, OBN: boolean): any;
|
|
3
6
|
static GetPrintConditionsBasedOnInput(InvoicePrintData: any, IncludeGST: boolean, ConsolidateGST: boolean, ForInsurance: boolean, SType: any, OriginalInvoiceData: any, IsProforma: boolean): any;
|
|
4
7
|
static GetInvoiceTypeHeading(InvoicePrintData: any, OriginalInvoiceData: any, IncludeGST: boolean, ConsolidateGST: boolean, IsProforma: boolean): any;
|
|
@@ -9,6 +9,30 @@ const my_date_1 = require("../../utils/my-date");
|
|
|
9
9
|
const tr_utils_1 = require("../../utils/tr-utils");
|
|
10
10
|
const invoice_total_service_1 = require("../invoice/invoice-total.service");
|
|
11
11
|
class SaleReceiptPrintService {
|
|
12
|
+
static GetTaxAmountFromTaxes(item, taxCode) {
|
|
13
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
14
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
15
|
+
if (matchedTaxes.length !== 0) {
|
|
16
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Amt), 0);
|
|
17
|
+
}
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
static GetTaxRateFromTaxes(item, taxCode) {
|
|
21
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
22
|
+
const matchedTaxes = taxes.filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === taxCode);
|
|
23
|
+
if (matchedTaxes.length !== 0) {
|
|
24
|
+
return matchedTaxes.reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
|
|
25
|
+
}
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
static GetTCodeFromTaxes(item) {
|
|
29
|
+
const taxes = Array.isArray(item === null || item === void 0 ? void 0 : item.Taxes) ? item.Taxes : [];
|
|
30
|
+
const matchedTax = taxes.find((tax) => !tr_utils_1.TrUtils.IsNull(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId));
|
|
31
|
+
if (!tr_utils_1.TrUtils.IsNull(matchedTax === null || matchedTax === void 0 ? void 0 : matchedTax.TaxCodeId)) {
|
|
32
|
+
return matchedTax.TaxCodeId;
|
|
33
|
+
}
|
|
34
|
+
return item === null || item === void 0 ? void 0 : item.TCode;
|
|
35
|
+
}
|
|
12
36
|
static GetSaleReceiptPrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma, OBN) {
|
|
13
37
|
var _a, _b, _c, _d;
|
|
14
38
|
let ForInsurance = !tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo) && !tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId);
|
|
@@ -156,12 +180,13 @@ class SaleReceiptPrintService {
|
|
|
156
180
|
else {
|
|
157
181
|
Labor.UnPr = tr_utils_1.TrUtils.FixPriceValue(Labor.Pr, DecimalsNumber);
|
|
158
182
|
}
|
|
159
|
-
Labor.
|
|
160
|
-
Labor.
|
|
161
|
-
Labor.
|
|
162
|
-
Labor.
|
|
163
|
-
Labor.
|
|
164
|
-
Labor.
|
|
183
|
+
Labor.TCode = this.GetTCodeFromTaxes(Labor);
|
|
184
|
+
Labor.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'CGST'), DecimalsNumber);
|
|
185
|
+
Labor.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'SGST'), DecimalsNumber);
|
|
186
|
+
Labor.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(this.GetTaxAmountFromTaxes(Labor, 'IGST'), DecimalsNumber);
|
|
187
|
+
Labor.CGSTPerc = this.GetTaxRateFromTaxes(Labor, 'CGST');
|
|
188
|
+
Labor.SGSTPerc = this.GetTaxRateFromTaxes(Labor, 'SGST');
|
|
189
|
+
Labor.IGSTPerc = this.GetTaxRateFromTaxes(Labor, 'IGST');
|
|
165
190
|
if (LineTotal === 'AT') {
|
|
166
191
|
Labor.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Labor.AfterLaborTax, DecimalsNumber);
|
|
167
192
|
}
|
|
@@ -174,11 +199,14 @@ class SaleReceiptPrintService {
|
|
|
174
199
|
static GetItemsPrintInfo(Items, Consolidate, TaxCodes, OBN, LineTotal, DecimalsNumber) {
|
|
175
200
|
Items.forEach((Item) => {
|
|
176
201
|
var _a;
|
|
202
|
+
const itemCGST = this.GetTaxAmountFromTaxes(Item, 'CGST');
|
|
203
|
+
const itemSGST = this.GetTaxAmountFromTaxes(Item, 'SGST');
|
|
204
|
+
const itemIGST = this.GetTaxAmountFromTaxes(Item, 'IGST');
|
|
177
205
|
if (Consolidate) {
|
|
178
206
|
let AfterDiscForEach = (0, math_operations_1.Divide)(Item.AfterPartDisc, Item.Qty);
|
|
179
|
-
let CTaxAmtPerItem = (0, math_operations_1.Divide)(
|
|
180
|
-
let STaxAmtPerItem = (0, math_operations_1.Divide)(
|
|
181
|
-
let ITaxAmtPerItem = (0, math_operations_1.Divide)(
|
|
207
|
+
let CTaxAmtPerItem = (0, math_operations_1.Divide)(itemCGST, Item.Qty);
|
|
208
|
+
let STaxAmtPerItem = (0, math_operations_1.Divide)(itemSGST, Item.Qty);
|
|
209
|
+
let ITaxAmtPerItem = (0, math_operations_1.Divide)(itemIGST, Item.Qty);
|
|
182
210
|
let DiscPerItem = (0, math_operations_1.Divide)((0, math_operations_1.Add)(Item.Disc, Item.RecDisc), Item.Qty);
|
|
183
211
|
Item.UnPr = tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Add)(AfterDiscForEach, DiscPerItem, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
|
|
184
212
|
}
|
|
@@ -187,7 +215,8 @@ class SaleReceiptPrintService {
|
|
|
187
215
|
}
|
|
188
216
|
Item.ExDt = this.GetExpiryDate(Item);
|
|
189
217
|
Item.Batch = this.GetBatchesData(Item, OBN);
|
|
190
|
-
Item.
|
|
218
|
+
Item.TCode = this.GetTCodeFromTaxes(Item);
|
|
219
|
+
Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(itemCGST, DecimalsNumber);
|
|
191
220
|
if (tr_utils_1.TrUtils.IsNull(Item.ConUt)) {
|
|
192
221
|
Item.ConUt = 1;
|
|
193
222
|
}
|
|
@@ -195,12 +224,12 @@ class SaleReceiptPrintService {
|
|
|
195
224
|
Item.Make = (_a = Item.Make) === null || _a === void 0 ? void 0 : _a.slice(0, 4).toUpperCase();
|
|
196
225
|
}
|
|
197
226
|
Item.Qty = tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Multiply)(Item.Qty, Item.ConUt), DecimalsNumber);
|
|
198
|
-
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(
|
|
199
|
-
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(
|
|
200
|
-
Item.CGSTPerc =
|
|
201
|
-
Item.SGSTPerc =
|
|
227
|
+
Item.SGSTAmt = tr_utils_1.TrUtils.FixedTo(itemSGST, DecimalsNumber);
|
|
228
|
+
Item.IGSTAmt = tr_utils_1.TrUtils.FixedTo(itemIGST, DecimalsNumber);
|
|
229
|
+
Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST');
|
|
230
|
+
Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST');
|
|
202
231
|
Item.TaxName = this.getTaxName(Item.TCode, TaxCodes);
|
|
203
|
-
Item.IGSTPerc =
|
|
232
|
+
Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST');
|
|
204
233
|
if (Consolidate) {
|
|
205
234
|
Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Multiply)(Item.UnPr, Item.Qty), DecimalsNumber);
|
|
206
235
|
}
|
|
@@ -20,7 +20,6 @@ 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);
|
|
24
23
|
let invPrint;
|
|
25
24
|
if (options.ConsolidateGST || !options.ShowGST) {
|
|
26
25
|
invPrint = (0, unified_invoice_pdf_service_1.GetInvoicePrint)(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
|
|
@@ -467,7 +467,7 @@ function hasDisplayValue(value) {
|
|
|
467
467
|
return true;
|
|
468
468
|
}
|
|
469
469
|
function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
470
|
-
const subtotal = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['STotal', 'SubTotal', 'SubTot', 'TaxableAmount', 'TaxableValue']);
|
|
470
|
+
const subtotal = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['SIndTotal', 'STotal', 'SubTotal', 'SubTot', 'TaxableAmount', 'TaxableValue']);
|
|
471
471
|
const showDetailedDisc = isTruthy((0, pdf_shared_utils_1.firstValue)(printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.ShowDetailedDisc));
|
|
472
472
|
const itemsDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PDisc));
|
|
473
473
|
const servicesDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.LDisc));
|
|
@@ -481,6 +481,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
481
481
|
const roundOff = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Round', 'RoundOff']);
|
|
482
482
|
const taxFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalTax', 'TaxTotal', 'TaxAmt', 'GSTTotal', 'CustItemITax']);
|
|
483
483
|
const totalTaxValue = taxFromInvoice !== 0 ? taxFromInvoice : totalTax;
|
|
484
|
+
const returnTotal = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.RetTotal);
|
|
484
485
|
const finalTotalRaw = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.FinalTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Total, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.GrandTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.NetTotal);
|
|
485
486
|
const finalTotal = parseNumber(finalTotalRaw);
|
|
486
487
|
let totalBeforeRound = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalBeforeRound', 'BeforeRoundTotal', 'PreRoundTotal']);
|
|
@@ -510,6 +511,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
510
511
|
{ label: 'SubTotal', amount: subtotal },
|
|
511
512
|
...discountLines,
|
|
512
513
|
{ label: 'Total Tax', amount: totalTaxValue },
|
|
514
|
+
{ label: 'Return Total', amount: returnTotal },
|
|
513
515
|
{ label: 'Total', amount: totalBeforeRound },
|
|
514
516
|
{ label: 'Rounding', amount: roundOff },
|
|
515
517
|
{ label: 'Final Total', amount: resolvedFinalTotal }
|