shareneus 1.5.59 → 1.5.60
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.d.ts +2 -2
- package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +11 -7
- package/dist/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.js +8 -4
- package/dist/shared/header-footer-section/pdf-header-footer.section.js +9 -1
- package/dist/shared/shared-print.service.js +1 -0
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ export declare function CreateInvoicePDFService(PDFInvoiceData?: any, PrintConfi
|
|
|
30
30
|
subject: string;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function DownloadInvoicePDFService(filename?: string, PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
|
|
34
34
|
footer?: ((_currentPage: number, pageCount: number) => {
|
|
35
35
|
margin: number[];
|
|
36
36
|
columns: {
|
|
@@ -62,7 +62,7 @@ export declare function DownloadPDFService(filename?: string, PDFInvoiceData?: a
|
|
|
62
62
|
subject: string;
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
export declare function
|
|
65
|
+
export declare function GetInvoicePdfDataUrl(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
|
|
66
66
|
footer?: ((_currentPage: number, pageCount: number) => {
|
|
67
67
|
margin: number[];
|
|
68
68
|
columns: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateInvoicePDFService = CreateInvoicePDFService;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
4
|
+
exports.DownloadInvoicePDFService = DownloadInvoicePDFService;
|
|
5
|
+
exports.GetInvoicePdfDataUrl = GetInvoicePdfDataUrl;
|
|
6
6
|
const pdf_party_details_section_1 = require("../../../shared/party-details-section/pdf-party-details.section");
|
|
7
7
|
const pdf_table_section_1 = require("../../../shared/table-section/pdf-table.section");
|
|
8
8
|
const pdf_totals_section_1 = require("../../../shared/totals-section/pdf-totals.section");
|
|
@@ -19,14 +19,13 @@ function CreateInvoicePDFService(PDFInvoiceData = {}, PrintConfigData = {}, prin
|
|
|
19
19
|
// pdfMake.createPdf(dd).open();
|
|
20
20
|
return dd;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function DownloadInvoicePDFService(filename = 'invoice.pdf', PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
23
23
|
const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
|
|
24
24
|
// pdfMake.createPdf(dd).download(filename);
|
|
25
25
|
return dd;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
|
|
28
28
|
const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
|
|
29
|
-
// const pdfDoc: any = pdfMake.createPdf(dd);
|
|
30
29
|
return dd;
|
|
31
30
|
// return new Promise((resolve, reject) => {
|
|
32
31
|
// let settled = false;
|
|
@@ -71,7 +70,7 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
71
70
|
const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(PAGE_SIZE, pageOrientation, pageMargins);
|
|
72
71
|
const copyLabels = normalizeCopyLabels(printCopies);
|
|
73
72
|
const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
|
|
74
|
-
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig);
|
|
73
|
+
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
|
|
75
74
|
const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
|
|
76
75
|
const content = [];
|
|
77
76
|
copyLabels.forEach((copyLabel, index) => {
|
|
@@ -134,7 +133,12 @@ function normalizePrintConfig(PDFInvoiceData, PrintConfigData) {
|
|
|
134
133
|
const watermark = !!(config === null || config === void 0 ? void 0 : config.watermark);
|
|
135
134
|
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.watermarkEnabled);
|
|
136
135
|
const footerText = (0, pdf_shared_utils_1.toStr)(config === null || config === void 0 ? void 0 : config.footerText);
|
|
137
|
-
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_b = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _b !== void 0 ? _b : {
|
|
136
|
+
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_b = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _b !== void 0 ? _b : {
|
|
137
|
+
OrgNameFsize: config === null || config === void 0 ? void 0 : config.OrgNameFsize,
|
|
138
|
+
OrgNameClr: config === null || config === void 0 ? void 0 : config.OrgNameClr,
|
|
139
|
+
AdrsFsize: config === null || config === void 0 ? void 0 : config.AdrsFsize,
|
|
140
|
+
AdrsClr: config === null || config === void 0 ? void 0 : config.AdrsClr
|
|
141
|
+
});
|
|
138
142
|
const fixedTo = normalizeFixedTo(config === null || config === void 0 ? void 0 : config.fixedTo);
|
|
139
143
|
return Object.assign(Object.assign({}, config), { itemsHeader,
|
|
140
144
|
headerData,
|
|
@@ -12,7 +12,6 @@ const PAGE_SIZE = 'A4';
|
|
|
12
12
|
const PAGE_MARGINS = [20, 20, 20, 20];
|
|
13
13
|
function CreateReceiptPDFService(DocumentData = {}, PrintConfigData = {}) {
|
|
14
14
|
const dd = buildPdfDocDefinition(DocumentData, PrintConfigData);
|
|
15
|
-
// pdfMake.createPdf(dd).open();
|
|
16
15
|
return dd;
|
|
17
16
|
}
|
|
18
17
|
function DownloadReceiptPDFService(filename = 'receipt.pdf', DocumentData = {}, PrintConfigData = {}) {
|
|
@@ -62,10 +61,10 @@ function GetReceiptPdfDataUrl(DocumentData = {}, PrintConfigData = {}) {
|
|
|
62
61
|
function buildPdfDocDefinition(DocumentData = {}, PrintConfigData = {}) {
|
|
63
62
|
const PrintConfig = normalizePrintConfig(DocumentData, PrintConfigData);
|
|
64
63
|
const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageOrientation);
|
|
65
|
-
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
64
|
+
const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Margin);
|
|
66
65
|
const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(PAGE_SIZE, pageOrientation, pageMargins);
|
|
67
66
|
const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
|
|
68
|
-
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig);
|
|
67
|
+
const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, DocumentData);
|
|
69
68
|
const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
|
|
70
69
|
const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, DocumentData);
|
|
71
70
|
const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(DocumentData, PrintConfig, availableWidth);
|
|
@@ -408,7 +407,12 @@ function normalizePrintConfig(DocumentData, PrintConfigData) {
|
|
|
408
407
|
const watermark = !!(config === null || config === void 0 ? void 0 : config.watermark);
|
|
409
408
|
const watermarkEnabled = !!(config === null || config === void 0 ? void 0 : config.watermarkEnabled);
|
|
410
409
|
const footerText = (0, pdf_shared_utils_1.toStr)(config === null || config === void 0 ? void 0 : config.footerText);
|
|
411
|
-
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_b = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _b !== void 0 ? _b : {
|
|
410
|
+
const headerStyles = (0, pdf_header_footer_section_1.normalizeHeaderStyle)((_b = config === null || config === void 0 ? void 0 : config.headerStyles) !== null && _b !== void 0 ? _b : {
|
|
411
|
+
OrgNameFsize: config === null || config === void 0 ? void 0 : config.OrgNameFsize,
|
|
412
|
+
OrgNameClr: config === null || config === void 0 ? void 0 : config.OrgNameClr,
|
|
413
|
+
AdrsFsize: config === null || config === void 0 ? void 0 : config.AdrsFsize,
|
|
414
|
+
AdrsClr: config === null || config === void 0 ? void 0 : config.AdrsClr
|
|
415
|
+
});
|
|
412
416
|
return Object.assign(Object.assign({}, config), { headerData,
|
|
413
417
|
pageMargins,
|
|
414
418
|
watermarkText,
|
|
@@ -79,6 +79,7 @@ function normalizeHeaderStyle(headerStyles) {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
function resolvePageMargins(value) {
|
|
82
|
+
var _a, _b, _c, _d;
|
|
82
83
|
if (Array.isArray(value) && value.length === 4) {
|
|
83
84
|
return [
|
|
84
85
|
(0, pdf_shared_utils_1.readPositiveNumber)(value[0], DEFAULT_PAGE_MARGINS[0]),
|
|
@@ -87,6 +88,13 @@ function resolvePageMargins(value) {
|
|
|
87
88
|
(0, pdf_shared_utils_1.readPositiveNumber)(value[3], DEFAULT_PAGE_MARGINS[3])
|
|
88
89
|
];
|
|
89
90
|
}
|
|
91
|
+
if (value && typeof value === 'object') {
|
|
92
|
+
const left = (0, pdf_shared_utils_1.readPositiveNumber)((_a = value === null || value === void 0 ? void 0 : value.Left) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.left, DEFAULT_PAGE_MARGINS[0]);
|
|
93
|
+
const top = (0, pdf_shared_utils_1.readPositiveNumber)((_b = value === null || value === void 0 ? void 0 : value.Top) !== null && _b !== void 0 ? _b : value === null || value === void 0 ? void 0 : value.top, DEFAULT_PAGE_MARGINS[1]);
|
|
94
|
+
const right = (0, pdf_shared_utils_1.readPositiveNumber)((_c = value === null || value === void 0 ? void 0 : value.Right) !== null && _c !== void 0 ? _c : value === null || value === void 0 ? void 0 : value.right, DEFAULT_PAGE_MARGINS[2]);
|
|
95
|
+
const bottom = (0, pdf_shared_utils_1.readPositiveNumber)((_d = value === null || value === void 0 ? void 0 : value.Bottom) !== null && _d !== void 0 ? _d : value === null || value === void 0 ? void 0 : value.bottom, DEFAULT_PAGE_MARGINS[3]);
|
|
96
|
+
return [left, top, right, bottom];
|
|
97
|
+
}
|
|
90
98
|
return DEFAULT_PAGE_MARGINS;
|
|
91
99
|
}
|
|
92
100
|
function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
|
|
@@ -96,7 +104,7 @@ function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
|
|
|
96
104
|
const headerData = normalizeHeaderData((_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _b !== void 0 ? _b : {});
|
|
97
105
|
const mergedHeaderData = normalizeHeaderData(Object.assign(Object.assign({}, headerData), { logoDataUrl: (0, pdf_shared_utils_1.firstValue)(documentLogoDataUrl, headerData === null || headerData === void 0 ? void 0 : headerData.logoDataUrl), organization: Object.assign(Object.assign({}, ((_c = headerData === null || headerData === void 0 ? void 0 : headerData.organization) !== null && _c !== void 0 ? _c : {})), { cName: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.CName, (_d = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _d === void 0 ? void 0 : _d.cName), address1: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs1, (_e = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _e === void 0 ? void 0 : _e.address1), address2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs2, (_f = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _f === void 0 ? void 0 : _f.address2), dlNo: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.DLNo, entity === null || entity === void 0 ? void 0 : entity.DLNO, (_g = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _g === void 0 ? void 0 : _g.dlNo), gstin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.GSTIN, (_h = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _h === void 0 ? void 0 : _h.gstin), pan: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PAN, (_j = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _j === void 0 ? void 0 : _j.pan), city: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.City, (_k = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _k === void 0 ? void 0 : _k.city), state: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.State, (_l = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _l === void 0 ? void 0 : _l.state), pin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PIN, entity === null || entity === void 0 ? void 0 : entity.Pin, (_m = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _m === void 0 ? void 0 : _m.pin), email: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Email, entity === null || entity === void 0 ? void 0 : entity.EMail, (_o = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _o === void 0 ? void 0 : _o.email), phone: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone, entity === null || entity === void 0 ? void 0 : entity.Ph, (_p = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _p === void 0 ? void 0 : _p.phone), phone2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone2, entity === null || entity === void 0 ? void 0 : entity.Ph2, (_q = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _q === void 0 ? void 0 : _q.phone2) }) }));
|
|
98
106
|
const headerStyles = normalizeHeaderStyle((_r = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) !== null && _r !== void 0 ? _r : {});
|
|
99
|
-
const headerSettings = normalizeHeaderSettings((_t = (_s = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.
|
|
107
|
+
const headerSettings = normalizeHeaderSettings((_t = (_s = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Header) !== null && _s !== void 0 ? _s : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Header) !== null && _t !== void 0 ? _t : {});
|
|
100
108
|
if (!headerSettings.show) {
|
|
101
109
|
return [];
|
|
102
110
|
}
|
|
@@ -108,6 +108,7 @@ class PrintSharedService {
|
|
|
108
108
|
Entity.Adrs1 = tempEntity.Address.A1;
|
|
109
109
|
Entity.Adrs2 = tempEntity.Address.A2;
|
|
110
110
|
Entity.City = tempEntity.Address.Ct;
|
|
111
|
+
Entity.State = tempEntity.Address.St;
|
|
111
112
|
Entity.PIN = tempEntity.Address.Pin;
|
|
112
113
|
let Email = this.GetEntityEmailDetails(tempEntity);
|
|
113
114
|
if (!tr_utils_1.TrUtils.IsEmpty(Email)) {
|