shareneus 1.5.61 → 1.5.63

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,214 +1 @@
1
- export declare function GetInvoicePDF(invoiceData: any, entityData: any, taxCodes: any, image?: any, numberofCopies?: string[], withPass?: boolean, options?: any): {
2
- watermark: string | {
3
- text: string;
4
- opacity: number;
5
- };
6
- info: {
7
- title: string;
8
- };
9
- background: (currentPage: any, pageSize: any) => any;
10
- header: (currentPage: any, pageCount: any) => {
11
- text: string;
12
- alignment: string;
13
- marginRight: number;
14
- fontSize: number;
15
- marginTop: number;
16
- };
17
- pageBreakBefore: (currentNode: any, followingNodesOnPage: any, nodesOnNextPage: any, previousNodesOnPage: any) => boolean;
18
- pageMargins: number[];
19
- pageOrientation: "portrait" | "landscape";
20
- pageSize: string;
21
- content: any[];
22
- styles: {
23
- temp2header: {
24
- fontSize: number;
25
- bold: boolean;
26
- alignment: string;
27
- };
28
- tableheader1: {
29
- bold: boolean;
30
- fontFamily: string;
31
- margin: number[];
32
- alignment: string;
33
- };
34
- header: {
35
- fontSize: number;
36
- bold: boolean;
37
- alignment: string;
38
- };
39
- meetingHeader: {
40
- fontSize: number;
41
- bold: boolean;
42
- };
43
- Receiptheader: {
44
- fontSize: number;
45
- bold: boolean;
46
- alignment: string;
47
- margin: number[];
48
- };
49
- InlineHeader: {
50
- fontSize: number;
51
- bold: boolean;
52
- alignment: string;
53
- margin: number[];
54
- };
55
- TaskHeading: {
56
- fontSize: number;
57
- bold: boolean;
58
- margin: number[];
59
- };
60
- lettersSize: {
61
- fontSize: number;
62
- margin: number[];
63
- };
64
- tablexample: {
65
- margin: number[];
66
- };
67
- hedstyl: {
68
- margin: number[];
69
- };
70
- header2: {
71
- fontSize: number;
72
- bold: boolean;
73
- alignment: string;
74
- margin: number[];
75
- };
76
- header1: {
77
- fontSize: number;
78
- bold: boolean;
79
- alignment: string;
80
- decoration: string;
81
- margin: number[];
82
- };
83
- ws_adrs_center: {
84
- fontSize: number;
85
- alignment: string;
86
- };
87
- ws_adrs_center1: {
88
- fontSize: number;
89
- alignment: string;
90
- };
91
- ws_adrs_left: {
92
- fontSize: number;
93
- alignment: string;
94
- };
95
- ws_adrs_left1: {
96
- fontSize: number;
97
- alignment: string;
98
- };
99
- columnheader: {
100
- margin: number[];
101
- };
102
- tableExample: {
103
- margin: number[];
104
- fontSize: number;
105
- };
106
- tableExamplemargin: {
107
- margin: number[];
108
- fontSize: number;
109
- };
110
- textcust: {
111
- fontSize: number;
112
- margin: number[];
113
- };
114
- column: {
115
- margin: number[];
116
- };
117
- tableheader: {
118
- bold: boolean;
119
- fontSize: number;
120
- margin: number[];
121
- alignment: string;
122
- };
123
- tableheader2: {
124
- fontSize: number;
125
- margin: number[];
126
- alignment: string;
127
- opacity: number;
128
- };
129
- hed: {
130
- fontSize: number;
131
- bold: boolean;
132
- };
133
- hed2: {
134
- fontSize: number;
135
- };
136
- TotalsStyles: {
137
- marginTop: number;
138
- lineHeight: number;
139
- fontSize: number;
140
- margin: number[];
141
- };
142
- colum1: {
143
- fontSize: number;
144
- lineHeight: number;
145
- };
146
- colum2: {
147
- fontSize: number;
148
- lineHeight: number;
149
- margin: number[];
150
- };
151
- colum3: {
152
- lineHeight: number;
153
- };
154
- Receiptheader1: {
155
- fontSize: number;
156
- bold: boolean;
157
- alignment: string;
158
- margin: number[];
159
- };
160
- Row1: {
161
- fontSize: number;
162
- margin: number[];
163
- };
164
- rowdata: {
165
- margin: number[];
166
- fontSize: number;
167
- };
168
- forCompany: {
169
- margin: number[];
170
- fontSize: number;
171
- };
172
- forCompany1: {
173
- margin: number[];
174
- fontSize: number;
175
- };
176
- Rupees: {
177
- margin: number[];
178
- fontSize: number;
179
- };
180
- Signature: {
181
- margin: number[];
182
- alignment: string;
183
- fontSize: number;
184
- };
185
- withApp: {
186
- alignment: string;
187
- lineHeight: number;
188
- };
189
- withOutApp: {
190
- alignment: string;
191
- lineHeight: number;
192
- };
193
- Sign: {
194
- fontSize: number;
195
- margin: number[];
196
- };
197
- Sign1: {
198
- fontSize: number;
199
- margin: number[];
200
- };
201
- 'margin-all': {
202
- margin: number[];
203
- };
204
- 'margin-top': {
205
- margin: number[];
206
- };
207
- 'margin-bottom': {
208
- margin: number[];
209
- };
210
- fontSize: {
211
- fontSize: number;
212
- };
213
- };
214
- };
1
+ export declare function GetInvoicePDF(invoiceData: any, entityData: any, headerConfig: any, printConfig: any, taxCodes: any, image?: any, numberofCopies?: string[], withPass?: boolean, options?: any): any;
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetInvoicePDF = GetInvoicePDF;
4
+ const tr_utils_1 = require("../../utils/tr-utils");
4
5
  const inv_print_service_1 = require("./inv-print.service");
6
+ const invoice_pdf_service_1 = require("./invoice-pdf/invoice-pdf.service");
5
7
  const unified_invoice_pdf_service_1 = require("./unified-invoice-pdf.service");
6
- function GetInvoicePDF(invoiceData, entityData, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
8
+ function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
7
9
  if (!options) {
8
10
  options = {
9
11
  ShowGST: true,
@@ -15,7 +17,15 @@ function GetInvoicePDF(invoiceData, entityData, taxCodes, image = null, numberof
15
17
  Orientation: 'portrait'
16
18
  };
17
19
  }
20
+ const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
21
+ printConfigData.withPass = withPass;
18
22
  const invoicePrintData = (0, inv_print_service_1.GetInvoicePrintInfo)(invoiceData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false, options.PartInvoice, options.LaborInvoice);
19
- const invPrint = (0, unified_invoice_pdf_service_1.GetInvoicePrint)(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
23
+ let invPrint;
24
+ if (options.ConsolidateGST || !options.ShowGST) {
25
+ invPrint = (0, unified_invoice_pdf_service_1.GetInvoicePrint)(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
26
+ }
27
+ else {
28
+ invPrint = (0, invoice_pdf_service_1.CreateInvoicePDFService)(invoiceData, printConfigData, numberofCopies);
29
+ }
20
30
  return invPrint;
21
31
  }
@@ -315,7 +315,6 @@ function addLaborHeaderAndTotalRows(Labor, laborLabel, laborTotalLabel, ShowTaxC
315
315
  Labor.unshift(dummypartadding1);
316
316
  }
317
317
  function buildItemRow(item, columns, column, itemLabel) {
318
- var _a, _b, _c, _d, _e;
319
318
  const hasValue = !tr_utils_1.TrUtils.IsFixedZero(item[column.Field]) && !tr_utils_1.TrUtils.IsNull(item[column.Field]) || (column.text === 'Line Total');
320
319
  if (hasValue) {
321
320
  if (item[column.Field] === itemLabel) {
@@ -384,22 +383,22 @@ function buildItemRow(item, columns, column, itemLabel) {
384
383
  DescData.push({ text: item['EDesc'].toString(), color: 'grey' });
385
384
  }
386
385
  // DescData.push({ text: item['MPN'] ? 'MPN: ' + item['MPN'] : '', color: 'grey', italics: true, marginTop: 2 });
387
- const isItemRow = itemLabel === 'Items';
388
- const hasBatchOrMrp = !tr_utils_1.TrUtils.IsNull((_a = item['Batch']) === null || _a === void 0 ? void 0 : _a.BN) || !tr_utils_1.TrUtils.IsNull((_b = item['Batch']) === null || _b === void 0 ? void 0 : _b.ExDt) || !tr_utils_1.TrUtils.IsNull(item['MRP']);
389
- if (isItemRow && hasBatchOrMrp) {
390
- const exDate = !tr_utils_1.TrUtils.IsNull((_c = item['Batch']) === null || _c === void 0 ? void 0 : _c.ExDt) ? my_date_1.MyDate.ConvertUTCDateToReadableExDate((_d = item['Batch']) === null || _d === void 0 ? void 0 : _d.ExDt) : '';
391
- DescData.push({
392
- marginTop: 5,
393
- text: [
394
- { text: 'B.No: ', bold: true },
395
- { text: (((_e = item['Batch']) === null || _e === void 0 ? void 0 : _e.BN) || '') + '' },
396
- { text: ' | Ex.Dt: ', bold: true },
397
- { text: exDate + '' },
398
- { text: ' | MRP: ', bold: true },
399
- { text: (tr_utils_1.TrUtils.IsNull(item['MRP']) ? '' : item['MRP']) + '' }
400
- ]
401
- });
402
- }
386
+ // const isItemRow = itemLabel === 'Items';
387
+ // const hasBatchOrMrp = !TrUtils.IsNull(item['Batch']?.BN) || !TrUtils.IsNull(item['Batch']?.ExDt) || !TrUtils.IsNull(item['MRP']);
388
+ // if (isItemRow && hasBatchOrMrp) {
389
+ // const exDate = !TrUtils.IsNull(item['Batch']?.ExDt) ? MyDate.ConvertUTCDateToReadableExDate(item['Batch']?.ExDt) : '';
390
+ // DescData.push({
391
+ // marginTop: 5,
392
+ // text: [
393
+ // { text: 'B.No: ', bold: true },
394
+ // { text: (item['Batch']?.BN || '') + '' },
395
+ // { text: ' | Ex.Dt: ', bold: true },
396
+ // { text: exDate + '' },
397
+ // { text: ' | MRP: ', bold: true },
398
+ // { text: (TrUtils.IsNull(item['MRP']) ? '' : item['MRP']) + '' }
399
+ // ]
400
+ // });
401
+ // }
403
402
  return { stack: DescData };
404
403
  }
405
404
  else {
@@ -14,36 +14,4 @@ export declare function buildInvoiceTotalsAndNotesSection(invoiceData: any, avai
14
14
  columnGap: number;
15
15
  margin: number[];
16
16
  })[];
17
- export declare function buildSignatureSection(PrintConfig: any, invoiceData: any): ({
18
- columns: ({
19
- width: string;
20
- text: string;
21
- fontSize?: undefined;
22
- bold?: undefined;
23
- color?: undefined;
24
- alignment?: undefined;
25
- } | {
26
- width: string;
27
- text: string;
28
- fontSize: number;
29
- bold: boolean;
30
- color: string;
31
- alignment: string;
32
- })[];
33
- margin: number[];
34
- text?: undefined;
35
- } | {
36
- text: string;
37
- margin: number[];
38
- columns?: undefined;
39
- } | {
40
- columns: {
41
- width: string;
42
- text: string;
43
- fontSize: number;
44
- color: string;
45
- alignment: string;
46
- }[];
47
- margin: number[];
48
- text?: undefined;
49
- })[];
17
+ export declare function buildSignatureSection(PrintConfig: any, invoiceData: any): any[];
@@ -125,7 +125,8 @@ function buildSignatureSection(PrintConfig, invoiceData) {
125
125
  var _a, _b, _c, _d;
126
126
  const headerData = (0, pdf_header_footer_section_1.normalizeHeaderData)((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _a !== void 0 ? _a : {});
127
127
  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);
128
- return [
128
+ 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));
129
+ const signatureRows = [
129
130
  {
130
131
  columns: [
131
132
  { width: '*', text: '' },
@@ -145,6 +146,121 @@ function buildSignatureSection(PrintConfig, invoiceData) {
145
146
  margin: [0, 0, 0, 0]
146
147
  }
147
148
  ];
149
+ if (!withPass) {
150
+ return signatureRows;
151
+ }
152
+ return [...signatureRows, ...buildGatePassSection(companyName, invoiceData)];
153
+ }
154
+ function buildGatePassSection(companyName, invoiceData) {
155
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
156
+ const customerName = (0, pdf_shared_utils_1.firstValue)((_a = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Customer) === null || _a === void 0 ? void 0 : _a.Name, (_b = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Cust) === null || _b === void 0 ? void 0 : _b.Name, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.BillTo) === null || _c === void 0 ? void 0 : _c.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CustomerName);
157
+ const serviceAdvisor = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.ServiceAdvisor, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.AdvisorName, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.SAName);
158
+ const chassisNo = (0, pdf_shared_utils_1.firstValue)((_d = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _d === void 0 ? void 0 : _d.CIN, (_e = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _e === void 0 ? void 0 : _e.ChassisNo, (_f = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Product) === null || _f === void 0 ? void 0 : _f.VIN, (_g = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Vehicle) === null || _g === void 0 ? void 0 : _g.VIN);
159
+ const regnNo = (0, pdf_shared_utils_1.firstValue)((_h = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _h === void 0 ? void 0 : _h.RegnNo, (_j = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Product) === null || _j === void 0 ? void 0 : _j.RegNo, (_k = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Veh) === null || _k === void 0 ? void 0 : _k.RegNo, (_l = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Vehicle) === null || _l === void 0 ? void 0 : _l.RegNo, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.VehicleNo, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.VehNo);
160
+ const vehicleModel = (0, pdf_shared_utils_1.firstValue)((_m = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Prod) === null || _m === void 0 ? void 0 : _m.Model, (_o = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Product) === null || _o === void 0 ? void 0 : _o.Model, (_p = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Vehicle) === null || _p === void 0 ? void 0 : _p.Model);
161
+ const gatePassDate = formatGatePassDate((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.DDate, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.InvDt, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Date, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CrDate));
162
+ return [
163
+ {
164
+ canvas: [
165
+ { type: 'line', x1: 0, y1: 0, x2: 555, y2: 0, lineWidth: 0.8, lineColor: '#374151' }
166
+ ],
167
+ margin: [0, 10, 0, 5]
168
+ },
169
+ {
170
+ columns: [
171
+ { width: '*', text: '' },
172
+ { width: 'auto', text: 'Gate Pass', bold: true, fontSize: 10, alignment: 'center' },
173
+ { width: '*', text: `Date: ${gatePassDate}`, fontSize: 9, alignment: 'right' }
174
+ ],
175
+ margin: [0, 0, 0, 4]
176
+ },
177
+ {
178
+ text: companyName || '-',
179
+ alignment: 'center',
180
+ bold: true,
181
+ fontSize: 11,
182
+ margin: [0, 0, 0, 6]
183
+ },
184
+ {
185
+ columns: [
186
+ {
187
+ width: '50%',
188
+ table: {
189
+ widths: ['auto', 8, '*'],
190
+ body: [
191
+ [
192
+ { text: 'Customer Name', fontSize: 8, bold: true },
193
+ { text: ':', fontSize: 8, bold: true, alignment: 'center' },
194
+ { text: customerName || '-', fontSize: 8 }
195
+ ],
196
+ [
197
+ { text: 'Service Advisor', fontSize: 8, bold: true },
198
+ { text: ':', fontSize: 8, bold: true, alignment: 'center' },
199
+ { text: serviceAdvisor || '-', fontSize: 8 }
200
+ ]
201
+ ]
202
+ },
203
+ layout: 'noBorders'
204
+ },
205
+ {
206
+ width: '50%',
207
+ table: {
208
+ widths: ['auto', 8, '*'],
209
+ body: [
210
+ [
211
+ { text: 'Chassis No', fontSize: 8, bold: true },
212
+ { text: ':', fontSize: 8, bold: true, alignment: 'center' },
213
+ { text: chassisNo || '-', fontSize: 8 }
214
+ ],
215
+ [
216
+ { text: 'Regn. No', fontSize: 8, bold: true },
217
+ { text: ':', fontSize: 8, bold: true, alignment: 'center' },
218
+ { text: regnNo || '-', fontSize: 8 }
219
+ ],
220
+ [
221
+ { text: 'Vehicle Model', fontSize: 8, bold: true },
222
+ { text: ':', fontSize: 8, bold: true, alignment: 'center' },
223
+ { text: vehicleModel || '-', fontSize: 8 }
224
+ ]
225
+ ]
226
+ },
227
+ layout: 'noBorders'
228
+ }
229
+ ],
230
+ columnGap: 12,
231
+ margin: [0, 0, 0, 0]
232
+ },
233
+ {
234
+ text: 'Vehicle has been received from workshop and work done as per my satisfaction.',
235
+ fontSize: 7,
236
+ color: '#111827',
237
+ margin: [0, 8, 0, 10]
238
+ },
239
+ {
240
+ columns: [
241
+ { width: '*', text: 'Customer Signature', fontSize: 8, color: '#111827', alignment: 'left' },
242
+ { width: '*', text: 'Authorised Signatory', fontSize: 8, color: '#111827', alignment: 'right' }
243
+ ],
244
+ margin: [0, 0, 0, 0]
245
+ }
246
+ ];
247
+ }
248
+ function formatGatePassDate(value) {
249
+ const raw = (0, pdf_shared_utils_1.firstValue)(value);
250
+ if (!raw) {
251
+ return formatAsDDMMYYYY(new Date());
252
+ }
253
+ const parsed = new Date(raw);
254
+ if (Number.isNaN(parsed.getTime())) {
255
+ return raw;
256
+ }
257
+ return formatAsDDMMYYYY(parsed);
258
+ }
259
+ function formatAsDDMMYYYY(dateValue) {
260
+ const day = String(dateValue.getDate()).padStart(2, '0');
261
+ const month = String(dateValue.getMonth() + 1).padStart(2, '0');
262
+ const year = dateValue.getFullYear();
263
+ return `${day}/${month}/${year}`;
148
264
  }
149
265
  function buildSimpleTextCardStack(title, value) {
150
266
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.61",
3
+ "version": "1.5.63",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",