shareneus 1.5.80 → 1.5.82
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 +1 -1
- package/dist/purchases/bills/bill-pdf/bill-pdf.service.js +1 -1
- package/dist/shared/party-details-section/pdf-party-details.section.d.ts +3 -3
- package/dist/shared/party-details-section/pdf-party-details.section.js +22 -11
- package/dist/shared/totals-section/pdf-totals.section.js +33 -16
- package/package.json +1 -1
|
@@ -75,7 +75,7 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
75
75
|
copyLabels.forEach((copyLabel, index) => {
|
|
76
76
|
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
|
|
77
77
|
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
78
|
-
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer);
|
|
78
|
+
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer, PrintConfig);
|
|
79
79
|
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, PrintConfigData);
|
|
80
80
|
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
|
|
81
81
|
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
@@ -75,7 +75,7 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
75
75
|
copyLabels.forEach((copyLabel, index) => {
|
|
76
76
|
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
|
|
77
77
|
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
78
|
-
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildPurchasePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer);
|
|
78
|
+
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildPurchasePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer, PrintConfig);
|
|
79
79
|
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, PrintConfigData);
|
|
80
80
|
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
|
|
81
81
|
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function buildInvoicePartyDetailsSection(PDFInvoiceData: any, customerLayout: any): {
|
|
1
|
+
export declare function buildInvoicePartyDetailsSection(PDFInvoiceData: any, customerLayout: any, printConfig?: any): {
|
|
2
2
|
text: string;
|
|
3
3
|
margin: number[];
|
|
4
4
|
}[] | {
|
|
@@ -9,7 +9,7 @@ export declare function buildInvoicePartyDetailsSection(PDFInvoiceData: any, cus
|
|
|
9
9
|
columnGap: number;
|
|
10
10
|
margin: number[];
|
|
11
11
|
}[];
|
|
12
|
-
export declare function buildSalesPartyDetailsSection(PDFInvoiceData: any, customerLayout: any): {
|
|
12
|
+
export declare function buildSalesPartyDetailsSection(PDFInvoiceData: any, customerLayout: any, printConfig?: any): {
|
|
13
13
|
text: string;
|
|
14
14
|
margin: number[];
|
|
15
15
|
}[] | {
|
|
@@ -20,7 +20,7 @@ export declare function buildSalesPartyDetailsSection(PDFInvoiceData: any, custo
|
|
|
20
20
|
columnGap: number;
|
|
21
21
|
margin: number[];
|
|
22
22
|
}[];
|
|
23
|
-
export declare function buildPurchasePartyDetailsSection(PDFInvoiceData: any, customerLayout: any): {
|
|
23
|
+
export declare function buildPurchasePartyDetailsSection(PDFInvoiceData: any, customerLayout: any, printConfig?: any): {
|
|
24
24
|
text: string;
|
|
25
25
|
margin: number[];
|
|
26
26
|
}[] | {
|
|
@@ -8,10 +8,10 @@ exports.buildSalesPartyDetailsSection = buildSalesPartyDetailsSection;
|
|
|
8
8
|
exports.buildPurchasePartyDetailsSection = buildPurchasePartyDetailsSection;
|
|
9
9
|
const jsbarcode_1 = __importDefault(require("jsbarcode"));
|
|
10
10
|
const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
|
|
11
|
-
function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
12
|
-
return buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout);
|
|
11
|
+
function buildInvoicePartyDetailsSection(PDFInvoiceData, customerLayout, printConfig = {}) {
|
|
12
|
+
return buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout, printConfig);
|
|
13
13
|
}
|
|
14
|
-
function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
14
|
+
function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout, printConfig = {}) {
|
|
15
15
|
const transactionData = PDFInvoiceData || {};
|
|
16
16
|
const billTo = resolveSalesBillToDetails(transactionData);
|
|
17
17
|
const shipTo = resolveSalesShipToDetails(transactionData);
|
|
@@ -20,7 +20,7 @@ function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
|
20
20
|
const secondaryParty = useInsurance ? insurance : shipTo;
|
|
21
21
|
const showBarCode = resolveShowBarCode(transactionData);
|
|
22
22
|
const billToCode = resolveBillToCode(transactionData);
|
|
23
|
-
const otherDetails = resolveOtherDetails(transactionData);
|
|
23
|
+
const otherDetails = resolveOtherDetails(transactionData, printConfig);
|
|
24
24
|
const shouldShowSecondaryBarcode = !secondaryParty.hasData && showBarCode && !!billToCode;
|
|
25
25
|
const secondaryTitle = useInsurance ? 'Insurance' : 'Ship To';
|
|
26
26
|
return buildPartyDetailsSectionLayout({
|
|
@@ -34,13 +34,13 @@ function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
|
34
34
|
secondaryBarcodeCode: billToCode
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function buildPurchasePartyDetailsSection(PDFInvoiceData, customerLayout) {
|
|
37
|
+
function buildPurchasePartyDetailsSection(PDFInvoiceData, customerLayout, printConfig = {}) {
|
|
38
38
|
const transactionData = PDFInvoiceData || {};
|
|
39
39
|
const billTo = resolvePurchaseBFromDetails(transactionData);
|
|
40
40
|
const shipFrom = resolvePurchaseShipFromDetails(transactionData);
|
|
41
41
|
const showBarCode = resolveShowBarCode(transactionData);
|
|
42
42
|
const billToCode = resolvePurchaseBillToCode(transactionData);
|
|
43
|
-
const otherDetails = resolvePurchaseOtherDetails(transactionData);
|
|
43
|
+
const otherDetails = resolvePurchaseOtherDetails(transactionData, printConfig);
|
|
44
44
|
const shouldShowSecondaryBarcode = !shipFrom.hasData && showBarCode && !!billToCode;
|
|
45
45
|
return buildPartyDetailsSectionLayout({
|
|
46
46
|
primaryTitle: 'Vendor Details',
|
|
@@ -109,7 +109,7 @@ function resolveSalesBillToDetails(transactionData) {
|
|
|
109
109
|
}
|
|
110
110
|
function resolveSalesShipToDetails(transactionData) {
|
|
111
111
|
console.log('Resolving Ship To Details from Transaction Data:', transactionData);
|
|
112
|
-
const shipTo = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipTo) || {};
|
|
112
|
+
const shipTo = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipTo) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShippmentTo) || {};
|
|
113
113
|
const address = normalizeAddress((shipTo === null || shipTo === void 0 ? void 0 : shipTo.Adrs)
|
|
114
114
|
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipAddress)
|
|
115
115
|
|| (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipToAddress));
|
|
@@ -149,9 +149,10 @@ function resolvePurchaseBFromDetails(transactionData) {
|
|
|
149
149
|
hasData: !!(name || gstin || contactInfo.number || directPhone || hasAddress(address))
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function resolvePurchaseOtherDetails(transactionData) {
|
|
152
|
+
function resolvePurchaseOtherDetails(transactionData, printConfig = {}) {
|
|
153
153
|
const billDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvDt, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Date, transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate);
|
|
154
154
|
const billNumber = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.Id, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Code, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvNo, transactionData === null || transactionData === void 0 ? void 0 : transactionData.No);
|
|
155
|
+
const documentNumberLabel = resolveDocumentNumberLabel(printConfig, 'Bill');
|
|
155
156
|
// const productName = [
|
|
156
157
|
// transactionData?.Product?.Make,
|
|
157
158
|
// transactionData?.Product?.Model,
|
|
@@ -174,7 +175,7 @@ function resolvePurchaseOtherDetails(transactionData) {
|
|
|
174
175
|
// const EngNo = transactionData?.Product?.EngNo;
|
|
175
176
|
// const ChassisNo = transactionData?.Product?.VIN;
|
|
176
177
|
const lines = [
|
|
177
|
-
{ label:
|
|
178
|
+
{ label: documentNumberLabel, value: billNumber },
|
|
178
179
|
{ label: 'Date', value: billDate ? formatDisplayDate(billDate) : '' },
|
|
179
180
|
// { label: 'Vehicle', value: vehicleDetails },
|
|
180
181
|
// { label: 'Regn. No', value: firstValue(RegnNo) },
|
|
@@ -214,10 +215,11 @@ function resolveInsuranceDetails(transactionData) {
|
|
|
214
215
|
hasData: !!(name || gstin || hasAddress(address))
|
|
215
216
|
};
|
|
216
217
|
}
|
|
217
|
-
function resolveOtherDetails(transactionData) {
|
|
218
|
+
function resolveOtherDetails(transactionData, printConfig = {}) {
|
|
218
219
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
219
220
|
const invoiceDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.DDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvDt, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Date, transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate);
|
|
220
221
|
const invoiceNumber = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData._id, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Code, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvNo, transactionData === null || transactionData === void 0 ? void 0 : transactionData.No);
|
|
222
|
+
const documentNumberLabel = resolveDocumentNumberLabel(printConfig, 'Invoice');
|
|
221
223
|
const productName = [
|
|
222
224
|
(_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _a === void 0 ? void 0 : _a.Make,
|
|
223
225
|
(_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _b === void 0 ? void 0 : _b.Model,
|
|
@@ -232,7 +234,7 @@ function resolveOtherDetails(transactionData) {
|
|
|
232
234
|
const EngNo = (_h = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _h === void 0 ? void 0 : _h.EngNo;
|
|
233
235
|
const ChassisNo = (_j = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _j === void 0 ? void 0 : _j.VIN;
|
|
234
236
|
const lines = [
|
|
235
|
-
{ label:
|
|
237
|
+
{ label: documentNumberLabel, value: invoiceNumber },
|
|
236
238
|
{ label: 'Date', value: invoiceDate ? formatDisplayDate(invoiceDate) : '' },
|
|
237
239
|
{ label: 'Vehicle', value: vehicleDetails },
|
|
238
240
|
{ label: 'Regn. No', value: (0, pdf_shared_utils_1.firstValue)(RegnNo) },
|
|
@@ -413,6 +415,15 @@ function resolvePurchaseBillToCode(transactionData) {
|
|
|
413
415
|
var _a, _b, _c, _d, _e;
|
|
414
416
|
return (0, pdf_shared_utils_1.firstValue)((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BFrom) === null || _a === void 0 ? void 0 : _a.Code, (_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _b === void 0 ? void 0 : _b.Code, (_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vendor) === null || _c === void 0 ? void 0 : _c.Code, (_d = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Vnd) === null || _d === void 0 ? void 0 : _d.Code, (_e = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Supplier) === null || _e === void 0 ? void 0 : _e.Code);
|
|
415
417
|
}
|
|
418
|
+
function resolveDocumentNumberLabel(printConfig, fallbackType) {
|
|
419
|
+
const typeValue = (0, pdf_shared_utils_1.firstValue)(printConfig === null || printConfig === void 0 ? void 0 : printConfig.Type, fallbackType);
|
|
420
|
+
const normalizedType = String(typeValue !== null && typeValue !== void 0 ? typeValue : '').trim();
|
|
421
|
+
if (!normalizedType) {
|
|
422
|
+
return `${fallbackType}#`;
|
|
423
|
+
}
|
|
424
|
+
const withoutHash = normalizedType.replace(/#+$/g, '').trim();
|
|
425
|
+
return `${withoutHash || fallbackType}#`;
|
|
426
|
+
}
|
|
416
427
|
function isTruthy(value) {
|
|
417
428
|
if (typeof value === 'boolean') {
|
|
418
429
|
return value;
|
|
@@ -29,11 +29,7 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
29
29
|
margin: [0, 10, 0, 10]
|
|
30
30
|
};
|
|
31
31
|
const topColumns = {
|
|
32
|
-
columns:
|
|
33
|
-
{ width: '42%', stack: buildTaxSummaryTableStack(null, taxSummary.rows) },
|
|
34
|
-
{ width: '28%', stack: showBankDetails ? buildInfoCardStack('Bank Details', bankDetails.lines) : [{ text: '' }] },
|
|
35
|
-
{ width: '30%', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
|
|
36
|
-
],
|
|
32
|
+
columns: buildTopSectionColumns(taxSummary, showBankDetails, bankDetails, totals),
|
|
37
33
|
columnGap: 20,
|
|
38
34
|
margin: [0, 0, 0, 8]
|
|
39
35
|
};
|
|
@@ -54,6 +50,24 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
54
50
|
}
|
|
55
51
|
return [dividerLine, bottomColumns];
|
|
56
52
|
}
|
|
53
|
+
function buildTopSectionColumns(taxSummary, showBankDetails, bankDetails, totals) {
|
|
54
|
+
if (taxSummary.hasData) {
|
|
55
|
+
return [
|
|
56
|
+
{ width: '42%', stack: buildTaxSummaryTableStack(null, taxSummary.rows) },
|
|
57
|
+
{ width: '28%', stack: showBankDetails ? buildInfoCardStack('Bank Details', bankDetails.lines) : [{ text: '' }] },
|
|
58
|
+
{ width: '30%', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
if (showBankDetails) {
|
|
62
|
+
return [
|
|
63
|
+
{ width: '40%', stack: buildInfoCardStack('Bank Details', bankDetails.lines) },
|
|
64
|
+
{ width: '60%', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
return [
|
|
68
|
+
{ width: '*', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
|
|
69
|
+
];
|
|
70
|
+
}
|
|
57
71
|
function buildPostTotalsInfoSection(data) {
|
|
58
72
|
const hasQr = !!(0, pdf_shared_utils_1.firstValue)(data.qrPayload);
|
|
59
73
|
const inWords = data.totalInWords || '-';
|
|
@@ -411,7 +425,7 @@ function shouldShowDueSection(printConfigData = {}) {
|
|
|
411
425
|
return false;
|
|
412
426
|
}
|
|
413
427
|
const normalizedType = String(type).trim().toLowerCase();
|
|
414
|
-
return normalizedType === '
|
|
428
|
+
return normalizedType === 'Invoice' || normalizedType === 'Bill';
|
|
415
429
|
}
|
|
416
430
|
function isTruthy(value) {
|
|
417
431
|
if (typeof value === 'boolean') {
|
|
@@ -451,7 +465,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
451
465
|
? itemsDiscount + servicesDiscount + overallDiscount
|
|
452
466
|
: (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Disc', 'Discount', 'TotDisc']);
|
|
453
467
|
const roundOff = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Round', 'RoundOff']);
|
|
454
|
-
const taxFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalTax', 'TaxTotal', 'TaxAmt', 'GSTTotal']);
|
|
468
|
+
const taxFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalTax', 'TaxTotal', 'TaxAmt', 'GSTTotal', 'CustItemITax']);
|
|
455
469
|
const totalTaxValue = taxFromInvoice !== 0 ? taxFromInvoice : totalTax;
|
|
456
470
|
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);
|
|
457
471
|
const finalTotal = parseNumber(finalTotalRaw);
|
|
@@ -477,19 +491,22 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
477
491
|
: [
|
|
478
492
|
{ label: 'Discount', amount: discount }
|
|
479
493
|
])
|
|
480
|
-
.filter((line) => Math.abs(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) > 0)
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
{ label: 'SubTotal', value: formatAmountFixed2(subtotal) },
|
|
494
|
+
.filter((line) => Math.abs(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) > 0);
|
|
495
|
+
const totalLines = [
|
|
496
|
+
{ label: 'SubTotal', amount: subtotal },
|
|
484
497
|
...discountLines,
|
|
485
|
-
{ label: 'Total Tax',
|
|
486
|
-
{ label: 'Total',
|
|
487
|
-
{ label: 'Rounding',
|
|
488
|
-
{ label: 'Final Total',
|
|
498
|
+
{ label: 'Total Tax', amount: totalTaxValue },
|
|
499
|
+
{ label: 'Total', amount: totalBeforeRound },
|
|
500
|
+
{ label: 'Rounding', amount: roundOff },
|
|
501
|
+
{ label: 'Final Total', amount: resolvedFinalTotal }
|
|
489
502
|
];
|
|
503
|
+
const lines = totalLines
|
|
504
|
+
.filter((line) => Math.abs(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) > 0)
|
|
505
|
+
.map((line) => ({ label: line.label, value: formatAmountFixed2(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) }));
|
|
506
|
+
const hasData = lines.some((line) => hasDisplayValue(line === null || line === void 0 ? void 0 : line.value));
|
|
490
507
|
return {
|
|
491
508
|
lines,
|
|
492
|
-
hasData
|
|
509
|
+
hasData
|
|
493
510
|
};
|
|
494
511
|
}
|
|
495
512
|
function resolveDueInfo(invoiceData, totals) {
|