shareneus 1.7.321 → 1.7.323
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/invoice/invoice-pdf/invoice-pdf.service.js +4 -1
- package/dist/shared/party-details-section/pdf-party-details.section.js +0 -1
- package/dist/shared/table-section/pdf-table.header.js +5 -5
- package/dist/shared/table-section/pdf-table.section.js +1 -1
- package/dist/shared/transactions-pdf.service.js +0 -1
- package/dist/tax/tax-calculator.js +2 -2
- package/dist/tax/tax.types.d.ts +2 -0
- package/package.json +1 -1
- package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +5 -1
- package/src/shared/party-details-section/pdf-party-details.section.ts +0 -1
- package/src/shared/table-section/pdf-table.header.ts +6 -6
- package/src/shared/table-section/pdf-table.section.ts +22 -22
- package/src/shared/transactions-pdf.service.ts +0 -1
- package/src/tax/tax-calculator.ts +2 -2
- package/src/tax/tax.types.ts +3 -0
|
@@ -72,9 +72,12 @@ function CustomerInfo(InvoicePDFData) {
|
|
|
72
72
|
[{ text: 'Name', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.Name, style: ['headerstyle'], fontSize: 9 }],
|
|
73
73
|
[{ text: 'Address', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: (_a = InvoicePDFData.Customer.Adrs) === null || _a === void 0 ? void 0 : _a[0], style: ['headerstyle'], fontSize: 9 }],
|
|
74
74
|
];
|
|
75
|
-
if (InvoicePDFData.Customer.Code) {
|
|
75
|
+
if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Customer.Code)) {
|
|
76
76
|
CustomerTable.unshift([{ text: 'UHID', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.Code, style: ['headerstyle'], fontSize: 9 }]);
|
|
77
77
|
}
|
|
78
|
+
if (!tr_utils_1.TrUtils.IsEmpty(InvoicePDFData.Customer.DLNo)) {
|
|
79
|
+
CustomerTable.push([{ text: 'DLNo', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.DLNo, style: ['headerstyle'], fontSize: 9 }]);
|
|
80
|
+
}
|
|
78
81
|
return CustomerTable;
|
|
79
82
|
}
|
|
80
83
|
function GetBarCode(code, PrCustBar) {
|
|
@@ -13,7 +13,6 @@ function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout, printCo
|
|
|
13
13
|
}
|
|
14
14
|
function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout, printConfig = {}) {
|
|
15
15
|
const transactionData = PDFInvoiceData || {};
|
|
16
|
-
console.log('Transaction Data for Party Details Section:', transactionData);
|
|
17
16
|
const billTo = resolveSalesBillToDetails(transactionData);
|
|
18
17
|
const shipTo = resolveSalesShipToDetails(transactionData);
|
|
19
18
|
const insurance = resolveInsuranceDetails(transactionData);
|
|
@@ -11,11 +11,11 @@ function GetTableHeader(itemsHeader, taxMode = '') {
|
|
|
11
11
|
: orderedHeaders;
|
|
12
12
|
const toHeaderObject = (item) => {
|
|
13
13
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
14
|
-
const itemTitle = (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.title) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.CustTitle) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.
|
|
14
|
+
const itemTitle = (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.title) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.CustTitle) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.Title) !== null && _c !== void 0 ? _c : '';
|
|
15
15
|
const itemWidth = (_d = item === null || item === void 0 ? void 0 : item.width) !== null && _d !== void 0 ? _d : item === null || item === void 0 ? void 0 : item.Width;
|
|
16
16
|
const itemDbFields = (_f = (_e = item === null || item === void 0 ? void 0 : item.dbFields) !== null && _e !== void 0 ? _e : item === null || item === void 0 ? void 0 : item.DBFields) !== null && _f !== void 0 ? _f : [];
|
|
17
17
|
const stackSource = (_g = item === null || item === void 0 ? void 0 : item.stackFields) !== null && _g !== void 0 ? _g : item === null || item === void 0 ? void 0 : item.Stacked;
|
|
18
|
-
const stackTitle = (_j = (_h = stackSource === null || stackSource === void 0 ? void 0 : stackSource.title) !== null && _h !== void 0 ? _h : stackSource === null || stackSource === void 0 ? void 0 : stackSource.
|
|
18
|
+
const stackTitle = (_j = (_h = stackSource === null || stackSource === void 0 ? void 0 : stackSource.title) !== null && _h !== void 0 ? _h : stackSource === null || stackSource === void 0 ? void 0 : stackSource.Title) !== null && _j !== void 0 ? _j : null;
|
|
19
19
|
const stackSeq = (_k = stackSource === null || stackSource === void 0 ? void 0 : stackSource.seq) !== null && _k !== void 0 ? _k : stackSource === null || stackSource === void 0 ? void 0 : stackSource.Seq;
|
|
20
20
|
return {
|
|
21
21
|
text: itemTitle,
|
|
@@ -33,11 +33,11 @@ function GetTableHeader(itemsHeader, taxMode = '') {
|
|
|
33
33
|
.filter((item) => { var _a; return !((_a = item === null || item === void 0 ? void 0 : item.stackFields) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.Stacked); })
|
|
34
34
|
.map((item) => {
|
|
35
35
|
var _a, _b;
|
|
36
|
-
const parentTitle = (_b = (_a = item === null || item === void 0 ? void 0 : item.title) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.CustTitle) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.
|
|
36
|
+
const parentTitle = (_b = (_a = item === null || item === void 0 ? void 0 : item.title) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.CustTitle) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.Title;
|
|
37
37
|
const stackFields = visibleHeaders
|
|
38
38
|
.filter((stackedItem) => {
|
|
39
39
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
40
|
-
const stackedParent = (_f = (_d = (_b = (_a = stackedItem === null || stackedItem === void 0 ? void 0 : stackedItem.stackFields) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : (_c = stackedItem === null || stackedItem === void 0 ? void 0 : stackedItem.stackFields) === null || _c === void 0 ? void 0 : _c.
|
|
40
|
+
const stackedParent = (_f = (_d = (_b = (_a = stackedItem === null || stackedItem === void 0 ? void 0 : stackedItem.stackFields) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : (_c = stackedItem === null || stackedItem === void 0 ? void 0 : stackedItem.stackFields) === null || _c === void 0 ? void 0 : _c.Title) !== null && _d !== void 0 ? _d : (_e = stackedItem === null || stackedItem === void 0 ? void 0 : stackedItem.Stacked) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : (_g = stackedItem === null || stackedItem === void 0 ? void 0 : stackedItem.Stacked) === null || _g === void 0 ? void 0 : _g.Title;
|
|
41
41
|
return stackedParent === parentTitle;
|
|
42
42
|
})
|
|
43
43
|
.sort((a, b) => {
|
|
@@ -273,7 +273,7 @@ function getSingleTaxHeaderText(header) {
|
|
|
273
273
|
}
|
|
274
274
|
function isTaxHeaderConfig(header) {
|
|
275
275
|
var _a, _b, _c, _d;
|
|
276
|
-
const title = (_d = (_c = (_b = (_a = header === null || header === void 0 ? void 0 : header.Title) !== null && _a !== void 0 ? _a : header === null || header === void 0 ? void 0 : header.
|
|
276
|
+
const title = (_d = (_c = (_b = (_a = header === null || header === void 0 ? void 0 : header.Title) !== null && _a !== void 0 ? _a : header === null || header === void 0 ? void 0 : header.Title) !== null && _b !== void 0 ? _b : header === null || header === void 0 ? void 0 : header.CustTitle) !== null && _c !== void 0 ? _c : header === null || header === void 0 ? void 0 : header.Title) !== null && _d !== void 0 ? _d : header === null || header === void 0 ? void 0 : header.text;
|
|
277
277
|
const normalizedTitle = normalizeHeaderText(title);
|
|
278
278
|
return normalizedTitle === 'TAX%' || normalizedTitle === 'TAXAMOUNT';
|
|
279
279
|
}
|
|
@@ -375,7 +375,7 @@ function normalizeTableConfig(tableConfig, pdfInvoiceData) {
|
|
|
375
375
|
}
|
|
376
376
|
function isDiscountColumnConfig(column) {
|
|
377
377
|
var _a, _b, _c;
|
|
378
|
-
const title = String((_c = (_b = (_a = column === null || column === void 0 ? void 0 : column.title) !== null && _a !== void 0 ? _a : column === null || column === void 0 ? void 0 : column.CustTitle) !== null && _b !== void 0 ? _b : column === null || column === void 0 ? void 0 : column.
|
|
378
|
+
const title = String((_c = (_b = (_a = column === null || column === void 0 ? void 0 : column.title) !== null && _a !== void 0 ? _a : column === null || column === void 0 ? void 0 : column.CustTitle) !== null && _b !== void 0 ? _b : column === null || column === void 0 ? void 0 : column.Title) !== null && _c !== void 0 ? _c : '').trim();
|
|
379
379
|
return title === 'Disc %' || title === 'Disc Amount' || title === 'Adisc Amount';
|
|
380
380
|
}
|
|
381
381
|
function buildSectionRows({ rows, columnsOrHeaders, descriptionColumnIndex, label, buildRow, buildTotalRow, showSectionSummaryRows }) {
|
|
@@ -49,7 +49,6 @@ function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCo
|
|
|
49
49
|
invoicePrintData.TaxTotal = tr_utils_1.TrUtils.FixedTo(invoiceData.TaxTotal);
|
|
50
50
|
}
|
|
51
51
|
delete invoicePrintData.SIndTotal;
|
|
52
|
-
console.log('invoicePrintData before creating PDF:', invoicePrintData);
|
|
53
52
|
invPrint = (0, invoice_pdf_service_1.CreateInvoicePDFService)(invoicePrintData, printConfigData, numberofCopies);
|
|
54
53
|
}
|
|
55
54
|
return invPrint;
|
|
@@ -498,7 +498,7 @@ function ComputeTaxSummary(input) {
|
|
|
498
498
|
* // }
|
|
499
499
|
*/
|
|
500
500
|
function ComputeDocumentTotals(input) {
|
|
501
|
-
const { Lines, Rounding, RegimeCode } = input;
|
|
501
|
+
const { Lines, Rounding, RegimeCode, Adjust } = input;
|
|
502
502
|
// 1. SubTotal = sum of gross line values before discounts/tax
|
|
503
503
|
let subTotal = 0;
|
|
504
504
|
let discount = 0;
|
|
@@ -517,7 +517,7 @@ function ComputeDocumentTotals(input) {
|
|
|
517
517
|
// 3. TaxTotal from the (potentially rounded) summary
|
|
518
518
|
const taxTotal = taxSummary.TotalTax;
|
|
519
519
|
// 4. GrandTotal before doc-level rounding
|
|
520
|
-
const grandTotal = (0, math_operations_1.Add)(taxableAmount, taxTotal);
|
|
520
|
+
const grandTotal = (0, math_operations_1.Add)(taxableAmount, taxTotal, Adjust !== null && Adjust !== void 0 ? Adjust : 0);
|
|
521
521
|
// 5. DocTotal rounding
|
|
522
522
|
let roundedTotal = grandTotal;
|
|
523
523
|
let roundAdj = 0;
|
package/dist/tax/tax.types.d.ts
CHANGED
|
@@ -323,6 +323,8 @@ export interface IDocumentTotalsInput {
|
|
|
323
323
|
Rounding: IRoundingConfig;
|
|
324
324
|
/** Tax regime code for the TaxSummary snapshot */
|
|
325
325
|
RegimeCode?: string;
|
|
326
|
+
/** Optional adjustment to grand total before rounding (e.g., for round-off entries) */
|
|
327
|
+
Adjust?: number;
|
|
326
328
|
}
|
|
327
329
|
/** Result of full document totals computation */
|
|
328
330
|
export interface IDocumentTotals {
|
package/package.json
CHANGED
|
@@ -86,9 +86,13 @@ function CustomerInfo(InvoicePDFData: any) {
|
|
|
86
86
|
[{ text: 'Name', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.Name, style: ['headerstyle'], fontSize: 9 }],
|
|
87
87
|
[{ text: 'Address', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.Adrs?.[0], style: ['headerstyle'], fontSize: 9 }],
|
|
88
88
|
];
|
|
89
|
-
if (InvoicePDFData.Customer.Code) {
|
|
89
|
+
if (!TrUtils.IsEmpty(InvoicePDFData.Customer.Code)) {
|
|
90
90
|
CustomerTable.unshift([{ text: 'UHID', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.Code, style: ['headerstyle'], fontSize: 9 }]);
|
|
91
91
|
}
|
|
92
|
+
if (!TrUtils.IsEmpty(InvoicePDFData.Customer.DLNo)) {
|
|
93
|
+
CustomerTable.push([{ text: 'DLNo', style: ['headerstyle'], fontSize: 9 }, { text: ':', style: ['headerstyle'], fontSize: 9 }, { text: InvoicePDFData.Customer.DLNo, style: ['headerstyle'], fontSize: 9 }]);
|
|
94
|
+
}
|
|
95
|
+
|
|
92
96
|
|
|
93
97
|
return CustomerTable;
|
|
94
98
|
}
|
|
@@ -8,7 +8,6 @@ export function buildInvoicePartyDetailsSection(PDFInvoiceData: any, customerLay
|
|
|
8
8
|
|
|
9
9
|
export function buildSalesPartyDetailsSection(PDFInvoiceData: any, customerLayout: any, printConfig: any = {}) {
|
|
10
10
|
const transactionData = PDFInvoiceData || {};
|
|
11
|
-
console.log('Transaction Data for Party Details Section:', transactionData);
|
|
12
11
|
const billTo = resolveSalesBillToDetails(transactionData);
|
|
13
12
|
const shipTo = resolveSalesShipToDetails(transactionData);
|
|
14
13
|
const insurance = resolveInsuranceDetails(transactionData);
|
|
@@ -7,11 +7,11 @@ export function GetTableHeader(itemsHeader: any[], taxMode: string = '') {
|
|
|
7
7
|
: orderedHeaders;
|
|
8
8
|
|
|
9
9
|
const toHeaderObject = (item: any) => {
|
|
10
|
-
const itemTitle = item?.title ?? item?.CustTitle ?? item?.
|
|
10
|
+
const itemTitle = item?.title ?? item?.CustTitle ?? item?.Title ?? '';
|
|
11
11
|
const itemWidth = item?.width ?? item?.Width;
|
|
12
12
|
const itemDbFields = item?.dbFields ?? item?.DBFields ?? [];
|
|
13
13
|
const stackSource = item?.stackFields ?? item?.Stacked;
|
|
14
|
-
const stackTitle = stackSource?.title ?? stackSource?.
|
|
14
|
+
const stackTitle = stackSource?.title ?? stackSource?.Title ?? null;
|
|
15
15
|
const stackSeq = stackSource?.seq ?? stackSource?.Seq;
|
|
16
16
|
return {
|
|
17
17
|
text: itemTitle,
|
|
@@ -30,13 +30,13 @@ export function GetTableHeader(itemsHeader: any[], taxMode: string = '') {
|
|
|
30
30
|
const headerRow = visibleHeaders
|
|
31
31
|
.filter((item: any) => !(item?.stackFields ?? item?.Stacked))
|
|
32
32
|
.map((item: any) => {
|
|
33
|
-
const parentTitle = item?.title ?? item?.CustTitle ?? item?.
|
|
33
|
+
const parentTitle = item?.title ?? item?.CustTitle ?? item?.Title;
|
|
34
34
|
const stackFields = visibleHeaders
|
|
35
35
|
.filter((stackedItem: any) => {
|
|
36
36
|
const stackedParent = stackedItem?.stackFields?.title
|
|
37
|
-
?? stackedItem?.stackFields?.
|
|
37
|
+
?? stackedItem?.stackFields?.Title
|
|
38
38
|
?? stackedItem?.Stacked?.title
|
|
39
|
-
?? stackedItem?.Stacked?.
|
|
39
|
+
?? stackedItem?.Stacked?.Title;
|
|
40
40
|
return stackedParent === parentTitle;
|
|
41
41
|
})
|
|
42
42
|
.sort((a: any, b: any) => {
|
|
@@ -345,7 +345,7 @@ function getSingleTaxHeaderText(header: any) {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
function isTaxHeaderConfig(header: any) {
|
|
348
|
-
const title = header?.Title ?? header?.
|
|
348
|
+
const title = header?.Title ?? header?.Title ?? header?.CustTitle ?? header?.Title ?? header?.text;
|
|
349
349
|
const normalizedTitle = normalizeHeaderText(title);
|
|
350
350
|
return normalizedTitle === 'TAX%' || normalizedTitle === 'TAXAMOUNT';
|
|
351
351
|
}
|
|
@@ -275,14 +275,14 @@ function buildSectionTotalRow(columns: any[], label: string, totals: any, fixedT
|
|
|
275
275
|
if (column.dbField === 'SGST' && column.taxKind === 'amount') {
|
|
276
276
|
return buildTotalValueCell(formatAmount(totals.sgstAmount, fixedTo));
|
|
277
277
|
}
|
|
278
|
-
if (column.dbField === 'IGST' && column.taxKind === 'amount') {
|
|
279
|
-
return buildTotalValueCell(formatAmount(totals.igstAmount, fixedTo));
|
|
280
|
-
}
|
|
281
|
-
if (column.dbField === 'GST' && column.taxKind === 'amount') {
|
|
282
|
-
return buildTotalValueCell(formatAmount(totals.cgstAmount + totals.sgstAmount + totals.igstAmount, fixedTo));
|
|
283
|
-
}
|
|
284
|
-
return buildTotalValueCell('');
|
|
285
|
-
}
|
|
278
|
+
if (column.dbField === 'IGST' && column.taxKind === 'amount') {
|
|
279
|
+
return buildTotalValueCell(formatAmount(totals.igstAmount, fixedTo));
|
|
280
|
+
}
|
|
281
|
+
if (column.dbField === 'GST' && column.taxKind === 'amount') {
|
|
282
|
+
return buildTotalValueCell(formatAmount(totals.cgstAmount + totals.sgstAmount + totals.igstAmount, fixedTo));
|
|
283
|
+
}
|
|
284
|
+
return buildTotalValueCell('');
|
|
285
|
+
}
|
|
286
286
|
|
|
287
287
|
const headerText = column.header?.text ?? '';
|
|
288
288
|
if (headerText === 'Description') {
|
|
@@ -407,7 +407,7 @@ function normalizeTableConfig(tableConfig: any[], pdfInvoiceData: any) {
|
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
function isDiscountColumnConfig(column: any) {
|
|
410
|
-
const title = String(column?.title ?? column?.CustTitle ?? column?.
|
|
410
|
+
const title = String(column?.title ?? column?.CustTitle ?? column?.Title ?? '').trim();
|
|
411
411
|
return title === 'Disc %' || title === 'Disc Amount' || title === 'Adisc Amount';
|
|
412
412
|
}
|
|
413
413
|
|
|
@@ -455,24 +455,24 @@ function shouldNegateFallbackHeaderValue(item: any, headerText: string) {
|
|
|
455
455
|
function shouldSkipFixedTo(header: any) {
|
|
456
456
|
const text = String(header?.text ?? '').trim().toUpperCase();
|
|
457
457
|
const normalizedText = text.replace(/\s+/g, '');
|
|
458
|
-
if (text === 'HSN/SAC' || text === 'BN' || text === 'BNO' || text.includes('%') || normalizedText === 'QTY' || normalizedText === 'OFFERQTY' || normalizedText === 'OFQTY' || normalizedText === 'MPN') {
|
|
459
|
-
return true;
|
|
460
|
-
}
|
|
458
|
+
if (text === 'HSN/SAC' || text === 'BN' || text === 'BNO' || text.includes('%') || normalizedText === 'QTY' || normalizedText === 'OFFERQTY' || normalizedText === 'OFQTY' || normalizedText === 'MPN') {
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
461
|
|
|
462
462
|
const dbFields = Array.isArray(header?.dbFields) ? header.dbFields : [];
|
|
463
463
|
return dbFields.some((field: any) => {
|
|
464
464
|
const normalized = String(field ?? '').trim().toUpperCase();
|
|
465
465
|
return normalized === 'BN'
|
|
466
|
-
|| normalized === 'BNO'
|
|
467
|
-
|| normalized === 'QTY'
|
|
468
|
-
|| normalized === 'OFQTY'
|
|
469
|
-
|| normalized === 'MPN'
|
|
470
|
-
|| normalized.endsWith('.BN')
|
|
471
|
-
|| normalized.endsWith('.QTY')
|
|
472
|
-
|| normalized.endsWith('.OFQTY')
|
|
473
|
-
|| normalized.endsWith('.MPN')
|
|
474
|
-
|| normalized.endsWith('PERC')
|
|
475
|
-
|| normalized.endsWith('.PERC');
|
|
466
|
+
|| normalized === 'BNO'
|
|
467
|
+
|| normalized === 'QTY'
|
|
468
|
+
|| normalized === 'OFQTY'
|
|
469
|
+
|| normalized === 'MPN'
|
|
470
|
+
|| normalized.endsWith('.BN')
|
|
471
|
+
|| normalized.endsWith('.QTY')
|
|
472
|
+
|| normalized.endsWith('.OFQTY')
|
|
473
|
+
|| normalized.endsWith('.MPN')
|
|
474
|
+
|| normalized.endsWith('PERC')
|
|
475
|
+
|| normalized.endsWith('.PERC');
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
478
|
|
|
@@ -46,7 +46,6 @@ export function GetInvoicePDF(invoiceData: any, entityData: any, headerConfig: a
|
|
|
46
46
|
invoicePrintData.TaxTotal = TrUtils.FixedTo(invoiceData.TaxTotal);
|
|
47
47
|
}
|
|
48
48
|
delete invoicePrintData.SIndTotal;
|
|
49
|
-
console.log('invoicePrintData before creating PDF:', invoicePrintData);
|
|
50
49
|
invPrint = CreateInvoicePDFService(invoicePrintData, printConfigData, numberofCopies);
|
|
51
50
|
}
|
|
52
51
|
return invPrint;
|
|
@@ -628,7 +628,7 @@ export function ComputeTaxSummary(input: ITaxSummaryInput): ITaxSummary {
|
|
|
628
628
|
* // }
|
|
629
629
|
*/
|
|
630
630
|
export function ComputeDocumentTotals(input: IDocumentTotalsInput): IDocumentTotals {
|
|
631
|
-
const { Lines, Rounding, RegimeCode } = input;
|
|
631
|
+
const { Lines, Rounding, RegimeCode, Adjust } = input;
|
|
632
632
|
// 1. SubTotal = sum of gross line values before discounts/tax
|
|
633
633
|
let subTotal = 0;
|
|
634
634
|
let discount = 0;
|
|
@@ -651,7 +651,7 @@ export function ComputeDocumentTotals(input: IDocumentTotalsInput): IDocumentTot
|
|
|
651
651
|
const taxTotal = taxSummary.TotalTax;
|
|
652
652
|
|
|
653
653
|
// 4. GrandTotal before doc-level rounding
|
|
654
|
-
const grandTotal = Add(taxableAmount, taxTotal);
|
|
654
|
+
const grandTotal = Add(taxableAmount, taxTotal, Adjust ?? 0);
|
|
655
655
|
|
|
656
656
|
// 5. DocTotal rounding
|
|
657
657
|
let roundedTotal = grandTotal;
|
package/src/tax/tax.types.ts
CHANGED
|
@@ -401,6 +401,9 @@ export interface IDocumentTotalsInput {
|
|
|
401
401
|
|
|
402
402
|
/** Tax regime code for the TaxSummary snapshot */
|
|
403
403
|
RegimeCode?: string;
|
|
404
|
+
|
|
405
|
+
/** Optional adjustment to grand total before rounding (e.g., for round-off entries) */
|
|
406
|
+
Adjust?: number;
|
|
404
407
|
}
|
|
405
408
|
|
|
406
409
|
/** Result of full document totals computation */
|