shareneus 1.6.65 → 1.6.67

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.
@@ -175,7 +175,7 @@ function resolvePurchaseOtherDetails(transactionData, printConfig = {}) {
175
175
  // const ChassisNo = transactionData?.Product?.VIN;
176
176
  const lines = [
177
177
  { label: documentNumberLabel, value: billNumber },
178
- { label: 'Date', value: billDate ? formatDisplayDate(billDate) : '' },
178
+ { label: 'Date', value: billDate ? billDate : '' },
179
179
  // { label: 'Vehicle', value: vehicleDetails },
180
180
  // { label: 'Regn. No', value: firstValue(RegnNo) },
181
181
  // { label: 'Engine No', value: firstValue(EngNo) },
@@ -216,7 +216,7 @@ function resolveInsuranceDetails(transactionData) {
216
216
  }
217
217
  function resolveOtherDetails(transactionData, printConfig = {}) {
218
218
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
219
- const invoiceDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.DDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvDt, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Date, transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate);
219
+ const invoiceDate = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.CrDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.DDate, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvDt, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Date);
220
220
  const invoiceNumber = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData._id, transactionData === null || transactionData === void 0 ? void 0 : transactionData.Code, transactionData === null || transactionData === void 0 ? void 0 : transactionData.InvNo, transactionData === null || transactionData === void 0 ? void 0 : transactionData.No);
221
221
  const documentNumberLabel = resolveDocumentNumberLabel(printConfig, 'Invoice');
222
222
  const productName = [
@@ -236,7 +236,7 @@ function resolveOtherDetails(transactionData, printConfig = {}) {
236
236
  const shouldShowDoctorName = documentNumberLabel === 'Sales Receipt#';
237
237
  const lines = [
238
238
  { label: documentNumberLabel, value: invoiceNumber },
239
- { label: 'Date', value: invoiceDate ? formatDisplayDate(invoiceDate) : '' },
239
+ { label: 'Date', value: invoiceDate ? invoiceDate : '' },
240
240
  { label: 'Vehicle', value: vehicleDetails },
241
241
  { label: 'Regn. No', value: (0, pdf_shared_utils_1.firstValue)(RegnNo) },
242
242
  { label: 'Engine No', value: (0, pdf_shared_utils_1.firstValue)(EngNo) },
@@ -410,23 +410,23 @@ function getAddressFieldValue(address, keys) {
410
410
  }
411
411
  return '';
412
412
  }
413
- function formatDisplayDate(value) {
414
- if (!value) {
415
- return '-';
416
- }
417
- const dt = new Date(value);
418
- if (!Number.isNaN(dt.getTime())) {
419
- const day = leftPadWithZero(dt.getDate());
420
- const month = leftPadWithZero(dt.getMonth() + 1);
421
- const year = dt.getFullYear();
422
- return `${day}/${month}/${year}`;
423
- }
424
- return value;
425
- }
426
- function leftPadWithZero(value) {
427
- const text = String(value);
428
- return text.length >= 2 ? text : `0${text}`;
429
- }
413
+ // function formatDisplayDate(value: string) {
414
+ // if (!value) {
415
+ // return '-';
416
+ // }
417
+ // const dt = new Date(value);
418
+ // if (!Number.isNaN(dt.getTime())) {
419
+ // const day = leftPadWithZero(dt.getDate());
420
+ // const month = leftPadWithZero(dt.getMonth() + 1);
421
+ // const year = dt.getFullYear();
422
+ // return `${day}/${month}/${year}`;
423
+ // }
424
+ // return value;
425
+ // }
426
+ // function leftPadWithZero(value: number) {
427
+ // const text = String(value);
428
+ // return text.length >= 2 ? text : `0${text}`;
429
+ // }
430
430
  function resolveShowBarCode(transactionData, printConfig = {}) {
431
431
  var _a, _b;
432
432
  if (Object.prototype.hasOwnProperty.call(printConfig || {}, 'Customer')) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildInvoiceTotalsAndNotesSection = buildInvoiceTotalsAndNotesSection;
4
4
  exports.buildSignatureSection = buildSignatureSection;
5
+ const my_date_1 = require("../../utils/my-date");
5
6
  const pdf_header_footer_section_1 = require("../header-footer-section/pdf-header-footer.section");
6
7
  const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
7
8
  const math_operations_1 = require("../math-operations");
@@ -45,6 +46,7 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
45
46
  paidAmount: dueInfo.paid,
46
47
  dueAmount: dueInfo.due,
47
48
  qrPayload,
49
+ upiPhone: resolveUpiPhone(normalizedInvoice),
48
50
  showDueSection
49
51
  });
50
52
  if (hasTopSection && hasBottomSection) {
@@ -135,7 +137,14 @@ function buildPostTotalsInfoSection(data) {
135
137
  bold: true,
136
138
  alignment: 'right',
137
139
  margin: [0, 2, 0, 0]
138
- }
140
+ },
141
+ ...((0, pdf_shared_utils_1.firstValue)(data.upiPhone) ? [{
142
+ text: `UPIPhone: ${data.upiPhone}`,
143
+ fontSize: 8,
144
+ bold: true,
145
+ alignment: 'right',
146
+ margin: [0, 2, 0, 0]
147
+ }] : [])
139
148
  ]
140
149
  });
141
150
  }
@@ -176,13 +185,13 @@ function buildSignatureSection(PrintConfig, invoiceData, availableWidth) {
176
185
  return [...signatureRows, ...buildGatePassSection(companyName, invoiceData, availableWidth)];
177
186
  }
178
187
  function buildGatePassSection(companyName, invoiceData, availableWidth) {
179
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
188
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
180
189
  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);
181
190
  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);
182
191
  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);
183
192
  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);
184
193
  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);
185
- 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));
194
+ const gatePassDate = my_date_1.MyDate.ConvertUTCDateToReadable(my_date_1.MyDate.GetDateTimeNowInUTC((_r = (_q = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _q === void 0 ? void 0 : _q.User) === null || _r === void 0 ? void 0 : _r.TZ));
186
195
  const dividerLine = {
187
196
  canvas: [
188
197
  { type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
@@ -275,27 +284,27 @@ function buildGatePassSection(companyName, invoiceData, availableWidth) {
275
284
  }
276
285
  ];
277
286
  }
278
- function formatGatePassDate(value) {
279
- const raw = (0, pdf_shared_utils_1.firstValue)(value);
280
- if (!raw) {
281
- return formatAsDDMMYYYY(new Date());
282
- }
283
- const parsed = new Date(raw);
284
- if (Number.isNaN(parsed.getTime())) {
285
- return raw;
286
- }
287
- return formatAsDDMMYYYY(parsed);
288
- }
289
- function formatAsDDMMYYYY(dateValue) {
290
- const day = leftPadWithZero(dateValue.getDate());
291
- const month = leftPadWithZero(dateValue.getMonth() + 1);
292
- const year = dateValue.getFullYear();
293
- return `${day}/${month}/${year}`;
294
- }
295
- function leftPadWithZero(value) {
296
- const text = String(value);
297
- return text.length >= 2 ? text : `0${text}`;
298
- }
287
+ // function formatGatePassDate(value: string) {
288
+ // const raw = firstValue(value);
289
+ // if (!raw) {
290
+ // return formatAsDDMMYYYY(new Date());
291
+ // }
292
+ // const parsed = new Date(raw);
293
+ // if (Number.isNaN(parsed.getTime())) {
294
+ // return raw;
295
+ // }
296
+ // return formatAsDDMMYYYY(parsed);
297
+ // }
298
+ // function formatAsDDMMYYYY(dateValue: Date) {
299
+ // const day = leftPadWithZero(dateValue.getDate());
300
+ // const month = leftPadWithZero(dateValue.getMonth() + 1);
301
+ // const year = dateValue.getFullYear();
302
+ // return `${day}/${month}/${year}`;
303
+ // }
304
+ // function leftPadWithZero(value: number) {
305
+ // const text = String(value);
306
+ // return text.length >= 2 ? text : `0${text}`;
307
+ // }
299
308
  function buildSimpleTextCardStack(title, value) {
300
309
  return [
301
310
  { text: title, bold: true, fontSize: 9, color: '#374151', margin: [0, 0, 0, 4] },
@@ -573,6 +582,10 @@ function resolveQrPayload(invoiceData, printConfigData = {}) {
573
582
  }
574
583
  return (0, pdf_shared_utils_1.firstValue)((_a = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _a === void 0 ? void 0 : _a.UPI, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.QRText, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.QrText, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.QRCode, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.QRData, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.UPIId, (_b = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Bank) === null || _b === void 0 ? void 0 : _b.UPI, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.BankDetails) === null || _c === void 0 ? void 0 : _c.UPI);
575
584
  }
585
+ function resolveUpiPhone(invoiceData) {
586
+ var _a, _b, _c, _d, _e, _f, _g;
587
+ return (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.UPIPhone, (_a = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _a === void 0 ? void 0 : _a.UPIPhone, (_b = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Bank) === null || _b === void 0 ? void 0 : _b.UPIPhone, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.BankDetails) === null || _c === void 0 ? void 0 : _c.UPIPhone, (_e = (_d = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _d === void 0 ? void 0 : _d.Bank) === null || _e === void 0 ? void 0 : _e.UPIPhone, (_g = (_f = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _f === void 0 ? void 0 : _f.BankDetails) === null || _g === void 0 ? void 0 : _g.UPIPhone);
588
+ }
576
589
  function formatAmountFixed2(value) {
577
590
  if (!Number.isFinite(value)) {
578
591
  return '0.00';
@@ -521,7 +521,7 @@ function ComputeDocumentTotals(input) {
521
521
  // 5. DocTotal rounding
522
522
  let roundedTotal = grandTotal;
523
523
  let roundAdj = 0;
524
- if ((Rounding === null || Rounding === void 0 ? void 0 : Rounding.DocTotal) !== false) { // default true
524
+ if (Rounding.DocTotal !== false) { // default true
525
525
  roundedTotal = RoundAmount(grandTotal, { Method: Rounding.Method, Precision: Rounding.Precision });
526
526
  roundAdj = (0, math_operations_1.Subtract)(roundedTotal, grandTotal);
527
527
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.65",
3
+ "version": "1.6.67",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",