shareneus 1.6.11 → 1.6.12

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.
@@ -121,7 +121,6 @@ function resolvePageMargins(value) {
121
121
  function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
122
122
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
123
123
  const entity = (_a = DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Entity) !== null && _a !== void 0 ? _a : {};
124
- console.log('Building header with DocumentData entity:', entity);
125
124
  const documentLogoDataUrl = resolveDocumentLogoDataUrl(DocumentData);
126
125
  const headerData = normalizeHeaderData((_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _b !== void 0 ? _b : {});
127
126
  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), taxIds: Array.isArray(entity === null || entity === void 0 ? void 0 : entity.TaxIds) ? entity.TaxIds : (_k = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _k === void 0 ? void 0 : _k.taxIds, city: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.City, (_l = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _l === void 0 ? void 0 : _l.city), state: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.State, (_m = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _m === void 0 ? void 0 : _m.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, (_o = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _o === void 0 ? void 0 : _o.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, (_p = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _p === void 0 ? void 0 : _p.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, (_q = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _q === void 0 ? void 0 : _q.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, (_r = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _r === void 0 ? void 0 : _r.phone2) }) }));
@@ -282,9 +281,7 @@ function buildOrganizationStack(organization, headerStyles, alignment) {
282
281
  }
283
282
  const hasTaxIdsConfig = Array.isArray(organization === null || organization === void 0 ? void 0 : organization.taxIds) && organization.taxIds.length > 0;
284
283
  const printedTaxIdsText = buildPrintedTaxIdsText(organization === null || organization === void 0 ? void 0 : organization.taxIds);
285
- console.log('Printed tax IDs text:', printedTaxIdsText, 'for tax IDs config:', organization === null || organization === void 0 ? void 0 : organization.taxIds);
286
284
  if (hasTaxIdsConfig) {
287
- console.log('inside printedTaxIdsText', printedTaxIdsText);
288
285
  if (printedTaxIdsText) {
289
286
  stack.push({ text: printedTaxIdsText, fontSize: orgAddressFontSize, color: orgAddressFontColor, lineHeight: 1.05, alignment });
290
287
  }
@@ -338,7 +335,6 @@ function normalizeTaxIds(value) {
338
335
  });
339
336
  }
340
337
  function buildPrintedTaxIdsText(value) {
341
- console.log('Building printed tax IDs text with value:', value);
342
338
  const taxIds = normalizeTaxIds(value);
343
339
  const primary = [];
344
340
  const secondary = [];
@@ -230,6 +230,8 @@ function resolveOtherDetails(transactionData, printConfig = {}) {
230
230
  const RegnNo = (_g = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _g === void 0 ? void 0 : _g.RegNo;
231
231
  const EngNo = (_h = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _h === void 0 ? void 0 : _h.EngNo;
232
232
  const ChassisNo = (_j = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Product) === null || _j === void 0 ? void 0 : _j.VIN;
233
+ const DoctorName = (0, pdf_shared_utils_1.firstValue)(transactionData === null || transactionData === void 0 ? void 0 : transactionData.Name, transactionData === null || transactionData === void 0 ? void 0 : transactionData.DoctorName);
234
+ const shouldShowDoctorName = documentNumberLabel === 'Sales Receipt#';
233
235
  const lines = [
234
236
  { label: documentNumberLabel, value: invoiceNumber },
235
237
  { label: 'Date', value: invoiceDate ? formatDisplayDate(invoiceDate) : '' },
@@ -237,7 +239,8 @@ function resolveOtherDetails(transactionData, printConfig = {}) {
237
239
  { label: 'Regn. No', value: (0, pdf_shared_utils_1.firstValue)(RegnNo) },
238
240
  { label: 'Engine No', value: (0, pdf_shared_utils_1.firstValue)(EngNo) },
239
241
  { label: 'Chassis No', value: (0, pdf_shared_utils_1.firstValue)(ChassisNo) },
240
- { label: 'Milage', value: Milage }
242
+ { label: 'Milage', value: Milage },
243
+ ...(shouldShowDoctorName ? [{ label: 'Doctor Name', value: DoctorName }] : [])
241
244
  ].filter((line) => !!line.value);
242
245
  return {
243
246
  lines,
@@ -464,12 +467,12 @@ function textToSvgBarcode(text) {
464
467
  const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
465
468
  (0, jsbarcode_1.default)(svgElement, text, {
466
469
  format: "CODE128",
467
- width: 0.6,
468
- height: 12,
470
+ width: 0.48,
471
+ height: 9.6,
469
472
  margin: 0,
470
473
  marginTop: 0,
471
474
  displayValue: true,
472
- fontSize: 5,
475
+ fontSize: 4,
473
476
  textMargin: 0,
474
477
  fontOptions: 'bold'
475
478
  });
@@ -9,7 +9,8 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
9
9
  var _a;
10
10
  const normalizedInvoice = invoiceData || {};
11
11
  const hideTopSection = isTruthy((_a = normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Settings) === null || _a === void 0 ? void 0 : _a.NoPr);
12
- const taxSummary = resolveTaxSummary(normalizedInvoice);
12
+ const shouldShowTaxSummary = resolveShowTaxSummary(normalizedInvoice, PrintConfigData);
13
+ const taxSummary = resolveTaxSummary(normalizedInvoice, shouldShowTaxSummary);
13
14
  const showBankDetails = resolveShowBankDetails(normalizedInvoice, PrintConfigData);
14
15
  const showDueSection = shouldShowDueSection(PrintConfigData);
15
16
  const bankDetails = showBankDetails ? resolveBankDetails(normalizedInvoice) : { lines: [], hasData: false };
@@ -372,7 +373,14 @@ function buildTaxSummaryTableStack(title, rows) {
372
373
  }
373
374
  ];
374
375
  }
375
- function resolveTaxSummary(invoiceData) {
376
+ function resolveTaxSummary(invoiceData, shouldShowTaxSummary) {
377
+ if (!shouldShowTaxSummary) {
378
+ return {
379
+ rows: [],
380
+ totalTax: 0,
381
+ hasData: false
382
+ };
383
+ }
376
384
  const sourceRows = Array.isArray(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.TaxSummary) ? invoiceData.TaxSummary : [];
377
385
  const rows = sourceRows.map((entry) => {
378
386
  const taxRate = (0, pdf_shared_utils_1.firstValue)(entry === null || entry === void 0 ? void 0 : entry.Tax, entry === null || entry === void 0 ? void 0 : entry.TaxRate, entry === null || entry === void 0 ? void 0 : entry.CombinedTaxPercentage, entry === null || entry === void 0 ? void 0 : entry.Perc, entry === null || entry === void 0 ? void 0 : entry.Percentage);
@@ -396,6 +404,10 @@ function resolveTaxSummary(invoiceData) {
396
404
  hasData: rows.length > 0
397
405
  };
398
406
  }
407
+ function resolveShowTaxSummary(invoiceData, printConfigData = {}) {
408
+ const value = (0, pdf_shared_utils_1.firstValue)(printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.ShowTaxSummary, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.ShowTaxSummary);
409
+ return isTruthy(value);
410
+ }
399
411
  function resolveBankDetails(invoiceData) {
400
412
  var _a, _b;
401
413
  const bank = ((_a = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _a === void 0 ? void 0 : _a.Bank)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.11",
3
+ "version": "1.6.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",