shareneus 1.6.76 → 1.6.77

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,90 @@ 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
+ // stack: [{ text: 'UHID : ' + InvoicePDFData.Customer.Code, style: ['headerstyle'] },
105
+ // { text: 'Name : ' + InvoicePDFData.Customer.Name, style: ['headerstyle'] },
106
+ // { text: 'Doctor : ' + InvoicePDFData.Name, style: ['headerstyle'] }],
107
+ table: {
108
+ lineHeight: 0.5,
109
+ body: CustomerInfo(InvoicePDFData)
110
+ }, layout: 'noBorders'
111
+ }, GetBarCode((_a = InvoicePDFData.Customer) === null || _a === void 0 ? void 0 : _a.Code, InvoicePDFData.Entity.PrCustBar),
112
+ {
113
+ // marginTop: 4,
114
+ marginRight: 5,
115
+ marginLeft: 70,
116
+ // alignment: 'right',
117
+ // stack: [{ text: 'Bill No : ' + InvoicePDFData._id, style: ['headerstyle'] },
118
+ // { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
119
+ table: {
120
+ lineHeight: 0.5,
121
+ body: [
122
+ [{ text: 'Bill No', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData._id, style: ['headerstyle'] }],
123
+ [{ text: 'Date', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.CrDate, style: ['headerstyle'] }],
124
+ // [{text:'Doctor', style: ['headerstyle']}, {text:':', style: ['headerstyle']}, {text: InvoicePDFData.Name, style: ['headerstyle']}]
125
+ ]
126
+ }, layout: 'noBorders'
127
+ }]
128
+ ]
129
+ },
130
+ layout: HeaderLayOut()
131
+ };
132
+ }
133
+ function HeaderLayOut() {
134
+ return {
135
+ hLineWidth: function (i, node) {
136
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
137
+ },
138
+ vLineWidth: function (i, node) {
139
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0;
140
+ },
141
+ // hLineStyle: function (i, node) {
142
+ // return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
143
+ // },
144
+ hLineColor: function (i, node) {
145
+ return 'gray';
146
+ },
147
+ vLineColor: function (i, node) {
148
+ return 'gray';
149
+ },
150
+ };
151
+ }
65
152
  function GetMainHeaderInfo(Entity, Image, AColor, HColor, InvoicePDFData) {
66
153
  if (!tr_utils_1.TrUtils.IsNull(Image)) {
67
154
  return {
@@ -142,7 +229,8 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
142
229
  // const invoiceHeaderContent = buildDocumentHeaderSection(PrintConfig, PDFInvoiceData);
143
230
  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
231
  const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
145
- const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer, PrintConfig);
232
+ // const invoicePartyDetailsContent = buildInvoicePartyDetailsSection(PDFInvoiceData, PrintConfig?.Customer, PrintConfig);
233
+ const invoicePartyDetailsContent = [GetPartyDetails(PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity, PDFInvoiceData)];
146
234
  const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, PrintConfigData);
147
235
  const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
148
236
  const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.76",
3
+ "version": "1.6.77",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",