shareneus 1.6.72 → 1.6.73
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 +24 -12
- package/dist/shared/header-footer-section/pdf-header-footer.section.d.ts +1 -0
- package/dist/shared/header-footer-section/pdf-header-footer.section.js +6 -0
- package/dist/shared/totals-section/pdf-totals.section.js +6 -4
- package/package.json +1 -1
|
@@ -63,26 +63,38 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
|
|
|
63
63
|
}
|
|
64
64
|
function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
65
65
|
const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
|
|
66
|
+
const compactLayout = (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize);
|
|
66
67
|
const requestedPageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Orientation) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation));
|
|
67
68
|
const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, requestedPageOrientation);
|
|
68
69
|
const basePageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
|
|
70
|
+
const resolvedPrintConfig = compactLayout ? Object.assign(Object.assign({}, PrintConfig), { compactLayout: true }) : PrintConfig;
|
|
69
71
|
const copyLabels = normalizeCopyLabels(printCopies);
|
|
70
|
-
const watermark = (0, pdf_header_footer_section_1.buildWatermark)(
|
|
71
|
-
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(
|
|
72
|
-
const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(
|
|
73
|
-
const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(
|
|
72
|
+
const watermark = (0, pdf_header_footer_section_1.buildWatermark)(resolvedPrintConfig, PDFInvoiceData);
|
|
73
|
+
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(resolvedPrintConfig, PDFInvoiceData);
|
|
74
|
+
const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(resolvedPrintConfig);
|
|
75
|
+
const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(resolvedPrintConfig);
|
|
74
76
|
const pageMargins = pageHeader !== null
|
|
75
|
-
? [
|
|
76
|
-
|
|
77
|
+
? [
|
|
78
|
+
compactLayout ? Math.min(basePageMargins[0], 12) : basePageMargins[0],
|
|
79
|
+
compactLayout ? Math.max(Math.min(basePageMargins[1], 12), 12) : Math.max(basePageMargins[1], 18),
|
|
80
|
+
compactLayout ? Math.min(basePageMargins[2], 12) : basePageMargins[2],
|
|
81
|
+
compactLayout ? Math.min(basePageMargins[3], 12) : basePageMargins[3]
|
|
82
|
+
]
|
|
83
|
+
: [
|
|
84
|
+
compactLayout ? Math.min(basePageMargins[0], 12) : basePageMargins[0],
|
|
85
|
+
compactLayout ? Math.min(basePageMargins[1], 12) : basePageMargins[1],
|
|
86
|
+
compactLayout ? Math.min(basePageMargins[2], 12) : basePageMargins[2],
|
|
87
|
+
compactLayout ? Math.min(basePageMargins[3], 12) : basePageMargins[3]
|
|
88
|
+
];
|
|
77
89
|
const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, requestedPageOrientation, pageMargins);
|
|
78
90
|
const content = [];
|
|
79
91
|
copyLabels.forEach((copyLabel, index) => {
|
|
80
|
-
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(
|
|
81
|
-
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData,
|
|
82
|
-
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData,
|
|
83
|
-
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth,
|
|
84
|
-
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(
|
|
85
|
-
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData,
|
|
92
|
+
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(resolvedPrintConfig, PDFInvoiceData);
|
|
93
|
+
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, resolvedPrintConfig, availableWidth);
|
|
94
|
+
const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, resolvedPrintConfig === null || resolvedPrintConfig === void 0 ? void 0 : resolvedPrintConfig.Customer, resolvedPrintConfig);
|
|
95
|
+
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, resolvedPrintConfig);
|
|
96
|
+
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(resolvedPrintConfig, PDFInvoiceData, availableWidth);
|
|
97
|
+
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, resolvedPrintConfig, availableWidth);
|
|
86
98
|
if (index > 0) {
|
|
87
99
|
content.push({ text: '', pageBreak: 'before' });
|
|
88
100
|
}
|
|
@@ -3,6 +3,7 @@ export declare function resolvePageSize(value: any, orientation?: 'portrait' | '
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
};
|
|
6
|
+
export declare function isHalfA4PageSize(value: any): boolean;
|
|
6
7
|
export declare function deriveHeaderDataFromInvoice(PDFInvoiceData: any): {
|
|
7
8
|
invoiceHeading: string;
|
|
8
9
|
organization: {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolvePageOrientation = resolvePageOrientation;
|
|
4
4
|
exports.resolvePageSize = resolvePageSize;
|
|
5
|
+
exports.isHalfA4PageSize = isHalfA4PageSize;
|
|
5
6
|
exports.deriveHeaderDataFromInvoice = deriveHeaderDataFromInvoice;
|
|
6
7
|
exports.normalizeHeaderData = normalizeHeaderData;
|
|
7
8
|
exports.normalizeHeaderStyle = normalizeHeaderStyle;
|
|
@@ -41,6 +42,11 @@ function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
|
|
|
41
42
|
}
|
|
42
43
|
return 'A4';
|
|
43
44
|
}
|
|
45
|
+
function isHalfA4PageSize(value) {
|
|
46
|
+
const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
|
|
47
|
+
const normalized = raw.replace(/[\s_-]/g, '');
|
|
48
|
+
return normalized === 'halfa4';
|
|
49
|
+
}
|
|
44
50
|
function deriveHeaderDataFromInvoice(PDFInvoiceData) {
|
|
45
51
|
const entity = (PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity) || {};
|
|
46
52
|
return {
|
|
@@ -23,6 +23,7 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
23
23
|
const terms = (0, pdf_shared_utils_1.firstValue)(normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TermsAndConditions, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TermsCondition, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Terms, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TC);
|
|
24
24
|
const dueInfo = resolveDueInfo(normalizedInvoice, totals);
|
|
25
25
|
const qrPayload = resolveQrPayload(normalizedInvoice, PrintConfigData);
|
|
26
|
+
const compactLayout = !!(PrintConfigData === null || PrintConfigData === void 0 ? void 0 : PrintConfigData.compactLayout) || (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfigData === null || PrintConfigData === void 0 ? void 0 : PrintConfigData.PSize);
|
|
26
27
|
const hasTopSection = !hideTopSection && (taxSummary.hasData || bankDetails.hasData || totals.hasData);
|
|
27
28
|
const hasBottomSection = !!(notes || terms || totalInWords || (showDueSection && dueInfo.hasData) || qrPayload);
|
|
28
29
|
if (!hasTopSection && !hasBottomSection) {
|
|
@@ -32,12 +33,12 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
32
33
|
canvas: [
|
|
33
34
|
{ type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
|
|
34
35
|
],
|
|
35
|
-
margin: [0, 10, 0, 10]
|
|
36
|
+
margin: compactLayout ? [0, 6, 0, 6] : [0, 10, 0, 10]
|
|
36
37
|
};
|
|
37
38
|
const topColumns = {
|
|
38
39
|
columns: buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals),
|
|
39
40
|
columnGap: 20,
|
|
40
|
-
margin: [0, 0, 0, 8]
|
|
41
|
+
margin: compactLayout ? [0, 0, 0, 4] : [0, 0, 0, 8]
|
|
41
42
|
};
|
|
42
43
|
const bottomColumns = buildPostTotalsInfoSection({
|
|
43
44
|
totalInWords,
|
|
@@ -159,17 +160,18 @@ function buildSignatureSection(PrintConfig, invoiceData, availableWidth) {
|
|
|
159
160
|
const headerData = (0, pdf_header_footer_section_1.normalizeHeaderData)((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _a !== void 0 ? _a : {});
|
|
160
161
|
const companyName = (0, pdf_shared_utils_1.firstValue)((_b = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _b === void 0 ? void 0 : _b.cName, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _c === void 0 ? void 0 : _c.CName, (_d = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _d === void 0 ? void 0 : _d.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CName);
|
|
161
162
|
const withPass = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.withPass) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.withPass) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.WithPass));
|
|
163
|
+
const compactLayout = !!(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.compactLayout) || (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize);
|
|
162
164
|
const signatureRows = [
|
|
163
165
|
{
|
|
164
166
|
columns: [
|
|
165
167
|
{ width: '*', text: '' },
|
|
166
168
|
{ width: '*', text: `For ${companyName || ''}`.trim(), fontSize: 9, bold: true, color: '#111827', alignment: 'right' }
|
|
167
169
|
],
|
|
168
|
-
margin: [0, 12, 0, 0]
|
|
170
|
+
margin: compactLayout ? [0, 6, 0, 0] : [0, 12, 0, 0]
|
|
169
171
|
},
|
|
170
172
|
{
|
|
171
173
|
text: '',
|
|
172
|
-
margin: [0, 18, 0, 0]
|
|
174
|
+
margin: compactLayout ? [0, 10, 0, 0] : [0, 18, 0, 0]
|
|
173
175
|
},
|
|
174
176
|
{
|
|
175
177
|
columns: [
|