shareneus 1.7.0 → 1.7.2

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.
@@ -449,7 +449,7 @@ class PosReceiptPrintService {
449
449
  if (ShowTaxColumn) {
450
450
  dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
451
451
  }
452
- dataRow.push({ text: item.Batch, alignment: 'center', style: ['headerstyle'], });
452
+ dataRow.push({ text: item.BN, alignment: 'center', style: ['headerstyle'], });
453
453
  dataRow.push({ text: item.ExDt, alignment: 'center', style: ['headerstyle'], });
454
454
  dataRow.push({ text: item.Make, alignment: 'center', style: ['headerstyle'], });
455
455
  dataRow.push({ text: item.Sch, alignment: 'center', style: ['headerstyle'], });
@@ -214,7 +214,7 @@ class SaleReceiptPrintService {
214
214
  Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
215
215
  }
216
216
  Item.ExDt = this.GetExpiryDate(Item);
217
- Item.Batch = this.GetBatchesData(Item, OBN);
217
+ Item.BN = this.GetBatchesData(Item, OBN);
218
218
  Item.TCode = this.GetTCodeFromTaxes(Item);
219
219
  Item.CGSTAmt = tr_utils_1.TrUtils.FixedTo(itemCGST, DecimalsNumber);
220
220
  if (tr_utils_1.TrUtils.IsNull(Item.ConUt)) {
@@ -95,6 +95,7 @@ function negateNumericLikeValue(value) {
95
95
  return String(normalized === 0 ? 0 : -Math.abs(normalized));
96
96
  }
97
97
  function getFirstFieldValue(item, dbFields = []) {
98
+ console.log('Getting first field value from item', item, 'using dbFields', dbFields);
98
99
  for (const field of dbFields) {
99
100
  const value = readValue(item, field);
100
101
  if (value !== undefined && value !== null && value !== '') {
@@ -104,14 +105,15 @@ function getFirstFieldValue(item, dbFields = []) {
104
105
  return '';
105
106
  }
106
107
  function readValue(item, field) {
108
+ console.log('Reading value for field', field, 'from item', item);
109
+ console.log('Direct value', item[field]);
107
110
  if (!item || !field) {
108
111
  return undefined;
109
112
  }
110
113
  if (item[field] !== undefined) {
111
114
  return item[field];
112
115
  }
113
- const pathSegments = field.split('.');
114
- const dottedPathValue = pathSegments.reduce((current, key) => {
116
+ const dottedPathValue = field.split('.').reduce((current, key) => {
115
117
  console.log('Current value for key', key, 'is', current);
116
118
  if (current && current[key] !== undefined) {
117
119
  return current[key];
@@ -122,17 +124,6 @@ function readValue(item, field) {
122
124
  if (dottedPathValue !== undefined) {
123
125
  return dottedPathValue;
124
126
  }
125
- if (pathSegments.length > 1) {
126
- const rootValue = item[pathSegments[0]];
127
- if (rootValue !== undefined && rootValue !== null && typeof rootValue !== 'object') {
128
- return rootValue;
129
- }
130
- const leafField = pathSegments[pathSegments.length - 1];
131
- const leafValue = deepFindByKey(item, leafField);
132
- if (leafValue !== undefined) {
133
- return leafValue;
134
- }
135
- }
136
127
  return deepFindByKey(item, field);
137
128
  }
138
129
  function deepFindByKey(source, field) {
@@ -1,17 +1,6 @@
1
- export declare function buildInvoiceTotalsAndNotesSection(invoiceData: any, availableWidth: number, PrintConfigData?: any): ({
2
- canvas: {
3
- type: string;
4
- x1: number;
5
- y1: number;
6
- x2: number;
7
- y2: number;
8
- lineWidth: number;
9
- lineColor: string;
10
- }[];
11
- margin: number[];
12
- } | {
1
+ export declare function buildInvoiceTotalsAndNotesSection(invoiceData: any, availableWidth: number, PrintConfigData?: any): {
13
2
  columns: any[];
14
3
  columnGap: number;
15
4
  margin: number[];
16
- })[];
5
+ }[];
17
6
  export declare function buildSignatureSection(PrintConfig: any, invoiceData: any, availableWidth: number): any[];
@@ -30,16 +30,16 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
30
30
  if (!hasTopSection && !hasBottomSection) {
31
31
  return [];
32
32
  }
33
- const dividerLine = {
34
- canvas: [
35
- { type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
36
- ],
37
- margin: [0, 5, 0, 5]
38
- };
33
+ // const dividerLine = {
34
+ // canvas: [
35
+ // { type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
36
+ // ],
37
+ // margin: [0, 5, 0, 5]
38
+ // };
39
39
  const topColumns = {
40
40
  columns: buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals, totalInWords),
41
41
  columnGap: 20,
42
- margin: [0, 0, 0, 8]
42
+ margin: [0, 2, 0, 8]
43
43
  };
44
44
  const bottomColumns = buildPostTotalsInfoSection({
45
45
  totalInWords,
@@ -55,18 +55,18 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
55
55
  isPoSPrint
56
56
  });
57
57
  if (hasTopSection && hasBottomSection) {
58
- return [dividerLine, topColumns, bottomColumns];
58
+ return [topColumns, bottomColumns];
59
59
  }
60
60
  if (hasTopSection) {
61
- return [dividerLine, topColumns];
61
+ return [topColumns];
62
62
  }
63
- return [dividerLine, bottomColumns];
63
+ return [bottomColumns];
64
64
  }
65
65
  function buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals, totalInWords) {
66
66
  const inWords = totalInWords || '-';
67
67
  if (taxSummary.hasData) {
68
68
  return [
69
- { width: '42%', stack: buildTaxSummaryTableStack(null, taxSummary.rows, sType) },
69
+ { width: '42%', stack: buildTaxSummaryTableStack(null, taxSummary.rows, sType), marginTop: 2 },
70
70
  { width: '28%', stack: showBankDetails ? buildInfoCardStack('Bank Details', bankDetails.lines) : [{ text: '' }] },
71
71
  { width: '30%', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
72
72
  ];
@@ -85,7 +85,7 @@ function buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails,
85
85
  { width: '*', text: inWords, bold: true, fontSize: 9, color: '#111827' }
86
86
  ],
87
87
  columnGap: 6,
88
- margin: [0, 0, 0, 4]
88
+ margin: [0, 2, 0, 4]
89
89
  },
90
90
  { width: '30%', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
91
91
  ];
@@ -102,7 +102,7 @@ function buildPostTotalsInfoSection(data) {
102
102
  { width: '*', text: inWords, bold: true, fontSize: 9, color: '#111827' }
103
103
  ],
104
104
  columnGap: 6,
105
- margin: [0, 0, 0, 4]
105
+ margin: [0, 2, 0, 4]
106
106
  });
107
107
  }
108
108
  if (data.showDueSection && !data.isPoSPrint) {
@@ -132,7 +132,7 @@ function buildPostTotalsInfoSection(data) {
132
132
  width: '60%',
133
133
  stack: [
134
134
  { text: '* Goods once sold will not be taken back or exchanged', fontSize: 6, color: '#111827' },
135
- { text: '* PLEASE GET YOUR MEDICINES CHECKED BY YOUR DOCTOR BEFORE USE *', fontSize: 6, color: '#111827' }
135
+ { text: '* PLEASE GET YOUR MEDICINES CHECKED BY YOUR DOCTOR BEFORE USE', fontSize: 6, color: '#111827' }
136
136
  ],
137
137
  margin: [5, 0, 0, 6],
138
138
  lineHeight: 1.1
@@ -147,7 +147,7 @@ function buildPostTotalsInfoSection(data) {
147
147
  }
148
148
  ],
149
149
  columnGap: 6,
150
- margin: [0, 4, 0, 0]
150
+ margin: [0, 2, 0, 0]
151
151
  });
152
152
  }
153
153
  if (termsText) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.00",
3
+ "version": "1.7.02",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",