shareneus 1.6.76 → 1.6.78
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.
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.CreateInvoicePDFService = CreateInvoicePDFService;
|
|
4
7
|
exports.DownloadInvoicePDFService = DownloadInvoicePDFService;
|
|
5
8
|
exports.GetInvoicePdfDataUrl = GetInvoicePdfDataUrl;
|
|
6
|
-
const pdf_party_details_section_1 = require("../../../shared/party-details-section/pdf-party-details.section");
|
|
7
9
|
const pdf_table_section_1 = require("../../../shared/table-section/pdf-table.section");
|
|
8
10
|
const pdf_totals_section_1 = require("../../../shared/totals-section/pdf-totals.section");
|
|
9
11
|
const pdf_shared_utils_1 = require("../../../shared/header-footer-section/pdf-shared.utils");
|
|
10
12
|
const pdf_header_footer_section_1 = require("../../../shared/header-footer-section/pdf-header-footer.section");
|
|
11
13
|
const tr_utils_1 = require("../../../utils/tr-utils");
|
|
14
|
+
const jsbarcode_1 = __importDefault(require("jsbarcode"));
|
|
12
15
|
const PAGE_MARGINS = [20, 20, 20, 20];
|
|
13
16
|
const CELL_PADDING_LEFT = 4;
|
|
14
17
|
const CELL_PADDING_RIGHT = 4;
|
|
@@ -62,6 +65,91 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
|
|
|
62
65
|
// }
|
|
63
66
|
// });
|
|
64
67
|
}
|
|
68
|
+
function CustomerInfo(InvoicePDFData) {
|
|
69
|
+
let CustomerTable = [
|
|
70
|
+
[{ text: 'Name', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.Customer.Name, style: ['headerstyle'] }],
|
|
71
|
+
[{ text: 'Doctor', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.Name, style: ['headerstyle'] }]
|
|
72
|
+
];
|
|
73
|
+
if (InvoicePDFData.Customer.Code) {
|
|
74
|
+
CustomerTable.unshift([{ text: 'UHID', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.Customer.Code, style: ['headerstyle'] }]);
|
|
75
|
+
}
|
|
76
|
+
return CustomerTable;
|
|
77
|
+
}
|
|
78
|
+
function GetBarCode(code, PrCustBar) {
|
|
79
|
+
if (!tr_utils_1.TrUtils.IsNull(code) && PrCustBar) {
|
|
80
|
+
return { svg: textToSvgBarcode(code).svg };
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
return {};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function textToSvgBarcode(text) {
|
|
87
|
+
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
88
|
+
(0, jsbarcode_1.default)(svgElement, text, {
|
|
89
|
+
format: "CODE128", width: 1.25, height: 25, margin: 0, marginTop: 8,
|
|
90
|
+
displayValue: true, fontSize: 7, textMargin: 0, fontOptions: 'bold'
|
|
91
|
+
});
|
|
92
|
+
return { svg: svgElement.outerHTML };
|
|
93
|
+
}
|
|
94
|
+
function GetPartyDetails(Entity, InvoicePDFData) {
|
|
95
|
+
var _a;
|
|
96
|
+
return {
|
|
97
|
+
style: 'tableExample',
|
|
98
|
+
table: {
|
|
99
|
+
widths: ['*', 'auto', '*'],
|
|
100
|
+
body: [
|
|
101
|
+
[{
|
|
102
|
+
// marginTop: 4,
|
|
103
|
+
marginLeft: 5,
|
|
104
|
+
marginBottom: 5,
|
|
105
|
+
// stack: [{ text: 'UHID : ' + InvoicePDFData.Customer.Code, style: ['headerstyle'] },
|
|
106
|
+
// { text: 'Name : ' + InvoicePDFData.Customer.Name, style: ['headerstyle'] },
|
|
107
|
+
// { text: 'Doctor : ' + InvoicePDFData.Name, style: ['headerstyle'] }],
|
|
108
|
+
table: {
|
|
109
|
+
lineHeight: 0.5,
|
|
110
|
+
body: CustomerInfo(InvoicePDFData)
|
|
111
|
+
}, layout: 'noBorders'
|
|
112
|
+
}, GetBarCode((_a = InvoicePDFData.Customer) === null || _a === void 0 ? void 0 : _a.Code, InvoicePDFData.Entity.PrCustBar),
|
|
113
|
+
{
|
|
114
|
+
// marginTop: 4,
|
|
115
|
+
marginRight: 5,
|
|
116
|
+
marginLeft: 70,
|
|
117
|
+
// alignment: 'right',
|
|
118
|
+
// stack: [{ text: 'Bill No : ' + InvoicePDFData._id, style: ['headerstyle'] },
|
|
119
|
+
// { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
|
|
120
|
+
table: {
|
|
121
|
+
lineHeight: 0.5,
|
|
122
|
+
body: [
|
|
123
|
+
[{ text: 'Receipt No', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData._id, style: ['headerstyle'] }],
|
|
124
|
+
[{ text: 'Date', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.CrDate, style: ['headerstyle'] }],
|
|
125
|
+
// [{text:'Doctor', style: ['headerstyle']}, {text:':', style: ['headerstyle']}, {text: InvoicePDFData.Name, style: ['headerstyle']}]
|
|
126
|
+
]
|
|
127
|
+
}, layout: 'noBorders'
|
|
128
|
+
}]
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
layout: HeaderLayOut()
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function HeaderLayOut() {
|
|
135
|
+
return {
|
|
136
|
+
hLineWidth: function (i, node) {
|
|
137
|
+
return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
|
|
138
|
+
},
|
|
139
|
+
vLineWidth: function (i, node) {
|
|
140
|
+
return (i === 0 || i === node.table.widths.length) ? 1 : 0;
|
|
141
|
+
},
|
|
142
|
+
// hLineStyle: function (i, node) {
|
|
143
|
+
// return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
|
|
144
|
+
// },
|
|
145
|
+
hLineColor: function (i, node) {
|
|
146
|
+
return 'gray';
|
|
147
|
+
},
|
|
148
|
+
vLineColor: function (i, node) {
|
|
149
|
+
return 'gray';
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
65
153
|
function GetMainHeaderInfo(Entity, Image, AColor, HColor, InvoicePDFData) {
|
|
66
154
|
if (!tr_utils_1.TrUtils.IsNull(Image)) {
|
|
67
155
|
return {
|
|
@@ -141,8 +229,10 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
|
|
|
141
229
|
var _a, _b;
|
|
142
230
|
// const invoiceHeaderContent = buildDocumentHeaderSection(PrintConfig, PDFInvoiceData);
|
|
143
231
|
const invoiceHeaderContent = [GetMainHeaderInfo(PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Image, (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) === null || _a === void 0 ? void 0 : _a.OrgNameClr, (_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) === null || _b === void 0 ? void 0 : _b.AdrsClr, PDFInvoiceData)];
|
|
144
|
-
const invoiceHeadingContent =
|
|
145
|
-
const
|
|
232
|
+
// const invoiceHeadingContent = buildDocumentHeadingSection(PDFInvoiceData, PrintConfig, availableWidth);
|
|
233
|
+
const invoiceHeadingContent = [{}];
|
|
234
|
+
// const invoicePartyDetailsContent = buildInvoicePartyDetailsSection(PDFInvoiceData, PrintConfig?.Customer, PrintConfig);
|
|
235
|
+
const invoicePartyDetailsContent = [GetPartyDetails(PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity, PDFInvoiceData)];
|
|
146
236
|
const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, PrintConfigData);
|
|
147
237
|
const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
|
|
148
238
|
const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
|
|
@@ -81,6 +81,10 @@ function buildPostTotalsInfoSection(data) {
|
|
|
81
81
|
const termsText = (0, pdf_shared_utils_1.firstValue)(data.terms);
|
|
82
82
|
const leftStack = [
|
|
83
83
|
{
|
|
84
|
+
stack: ['* Goods once sold will not be taken back or exchanged',
|
|
85
|
+
'* PLEASE GET YOUR MEDICINES CHECKED BY YOUR DOCTOR BEFORE USE *'],
|
|
86
|
+
fontSize: 7,
|
|
87
|
+
marginLeft: 5,
|
|
84
88
|
columns: [
|
|
85
89
|
{ width: 'auto', text: 'In Words :', bold: true, fontSize: 9, color: '#111827' },
|
|
86
90
|
{ width: '*', text: inWords, bold: true, fontSize: 9, color: '#111827' }
|