shareneus 1.7.325 → 1.7.327

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.
@@ -126,6 +126,7 @@ function negateNumericLikeValue(value) {
126
126
  function getFirstFieldValue(item, dbFields = []) {
127
127
  for (const field of dbFields) {
128
128
  const value = readValue(item, field);
129
+ console.log(`getFirstFieldValue - field: ${field}, value: ${value}`);
129
130
  if (value !== undefined && value !== null && value !== '') {
130
131
  return String(value);
131
132
  }
@@ -423,6 +423,8 @@ function shouldSkipFixedTo(header) {
423
423
  });
424
424
  }
425
425
  function getDisplayValueForFallbackRow(item, dbFields = [], shouldNegate = false) {
426
+ console.log(item, dbFields);
427
+ console.log('getFirstFieldValue', (0, pdf_table_row_1.getFirstFieldValue)(item, dbFields));
426
428
  const value = (0, pdf_table_row_1.getFirstFieldValue)(item, dbFields);
427
429
  if (!shouldNegate) {
428
430
  return value;
@@ -153,6 +153,7 @@ function GetDebitNotePDF(debitNoteData, entityData, headerConfig, printConfig, t
153
153
  dnPrint = debit_note_print_service_1.DebitNotePrintService.GetDebitNotePrintInfo(debitNotePrintData, entityData, image, true, true, taxCodes, false, true);
154
154
  }
155
155
  else {
156
+ console.log('DebitNotePrintData before formatting', debitNotePrintData);
156
157
  debitNotePrintData.Round = tr_utils_1.TrUtils.FixedTo(debitNoteData.Round);
157
158
  debitNotePrintData.Total = tr_utils_1.TrUtils.FixedTo(debitNoteData.Total);
158
159
  debitNotePrintData.SubToal = tr_utils_1.TrUtils.FixedTo(debitNoteData.SubToal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.325",
3
+ "version": "1.7.327",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -59,53 +59,53 @@ function formatFieldValue(item: any, fieldConfig: any, fixedTo: number) {
59
59
  return formatNumericLikeValue(signedValue, fixedTo, shouldSkipFixedTo(fieldConfig));
60
60
  }
61
61
 
62
- function getTaxValue(item: any, taxName: 'CGST' | 'SGST' | 'IGST' | 'GST', taxKind: 'rate' | 'amount') {
63
- if (taxName === 'GST') {
64
- if (taxKind === 'rate') {
65
- return getCombinedTaxValue(item, ['CombinedTaxPercentage', 'GSTPerc'], [
66
- ['CGSTPerc', 'CGST'],
67
- ['SGSTPerc', 'SGST'],
68
- ['IGSTPerc', 'IGST']
69
- ]);
70
- }
71
- return getCombinedTaxValue(item, ['TotalTaxAmount', 'TaxAmount', 'GSTAmt'], [
72
- ['CGSTAmt', 'CGST'],
73
- ['SGSTAmt', 'SGST'],
74
- ['IGSTAmt', 'IGST']
75
- ]);
76
- }
77
-
78
- if (taxName === 'IGST') {
79
- const fields = taxKind === 'rate' ? ['IGSTPerc'] : ['IGSTAmt'];
80
- return getFirstFieldValue(item, fields);
81
- }
62
+ function getTaxValue(item: any, taxName: 'CGST' | 'SGST' | 'IGST' | 'GST', taxKind: 'rate' | 'amount') {
63
+ if (taxName === 'GST') {
64
+ if (taxKind === 'rate') {
65
+ return getCombinedTaxValue(item, ['CombinedTaxPercentage', 'GSTPerc'], [
66
+ ['CGSTPerc', 'CGST'],
67
+ ['SGSTPerc', 'SGST'],
68
+ ['IGSTPerc', 'IGST']
69
+ ]);
70
+ }
71
+ return getCombinedTaxValue(item, ['TotalTaxAmount', 'TaxAmount', 'GSTAmt'], [
72
+ ['CGSTAmt', 'CGST'],
73
+ ['SGSTAmt', 'SGST'],
74
+ ['IGSTAmt', 'IGST']
75
+ ]);
76
+ }
77
+
78
+ if (taxName === 'IGST') {
79
+ const fields = taxKind === 'rate' ? ['IGSTPerc'] : ['IGSTAmt'];
80
+ return getFirstFieldValue(item, fields);
81
+ }
82
82
  const fields = taxKind === 'rate'
83
83
  ? [`${taxName}Perc`, taxName]
84
84
  : [`${taxName}Amt`, taxName];
85
- return getFirstFieldValue(item, fields);
86
- }
87
-
88
- function getCombinedTaxValue(item: any, combinedFields: string[], componentFieldGroups: string[][]) {
89
- const combinedValue = getFirstFieldValue(item, combinedFields);
90
- if (combinedValue) {
91
- return combinedValue;
92
- }
93
-
94
- const values = componentFieldGroups
95
- .map((fields: string[]) => getFirstFieldValue(item, fields))
96
- .filter((value: string) => value !== '');
97
-
98
- if (values.length === 0) {
99
- return '';
100
- }
101
-
102
- const numericValues = values.map((value: string) => Number(value.replace(/,/g, '').trim()));
103
- if (numericValues.some((value: number) => !Number.isFinite(value))) {
104
- return values[0];
105
- }
106
-
107
- return String(numericValues.reduce((sum: number, value: number) => sum + value, 0));
108
- }
85
+ return getFirstFieldValue(item, fields);
86
+ }
87
+
88
+ function getCombinedTaxValue(item: any, combinedFields: string[], componentFieldGroups: string[][]) {
89
+ const combinedValue = getFirstFieldValue(item, combinedFields);
90
+ if (combinedValue) {
91
+ return combinedValue;
92
+ }
93
+
94
+ const values = componentFieldGroups
95
+ .map((fields: string[]) => getFirstFieldValue(item, fields))
96
+ .filter((value: string) => value !== '');
97
+
98
+ if (values.length === 0) {
99
+ return '';
100
+ }
101
+
102
+ const numericValues = values.map((value: string) => Number(value.replace(/,/g, '').trim()));
103
+ if (numericValues.some((value: number) => !Number.isFinite(value))) {
104
+ return values[0];
105
+ }
106
+
107
+ return String(numericValues.reduce((sum: number, value: number) => sum + value, 0));
108
+ }
109
109
 
110
110
  function shouldRenderNegativeTaxAmount(item: any, column: any) {
111
111
  return !!item?.Ret && column?.taxKind === 'amount';
@@ -139,6 +139,7 @@ function negateNumericLikeValue(value: string) {
139
139
  export function getFirstFieldValue(item: any, dbFields: string[] = []) {
140
140
  for (const field of dbFields) {
141
141
  const value = readValue(item, field);
142
+ console.log(`getFirstFieldValue - field: ${field}, value: ${value}`);
142
143
  if (value !== undefined && value !== null && value !== '') {
143
144
  return String(value);
144
145
  }
@@ -274,23 +275,23 @@ function formatExpiryDateValue(value: string) {
274
275
  function shouldSkipFixedTo(header: any) {
275
276
  const text = String(header?.text ?? '').trim().toUpperCase();
276
277
  const normalizedText = text.replace(/\s+/g, '');
277
- if (text === 'HSN/SAC' || text === 'BN' || text === 'BNO' || text.includes('%') || normalizedText === 'QTY' || normalizedText === 'OFFERQTY' || normalizedText === 'OFQTY' || normalizedText === 'MPN') {
278
- return true;
279
- }
278
+ if (text === 'HSN/SAC' || text === 'BN' || text === 'BNO' || text.includes('%') || normalizedText === 'QTY' || normalizedText === 'OFFERQTY' || normalizedText === 'OFQTY' || normalizedText === 'MPN') {
279
+ return true;
280
+ }
280
281
 
281
282
  const dbFields = Array.isArray(header?.dbFields) ? header.dbFields : [];
282
283
  return dbFields.some((field: any) => {
283
284
  const normalized = String(field ?? '').trim().toUpperCase();
284
285
  return normalized === 'BN'
285
- || normalized === 'BNO'
286
- || normalized === 'QTY'
287
- || normalized === 'OFQTY'
288
- || normalized === 'MPN'
289
- || normalized.endsWith('.BN')
290
- || normalized.endsWith('.QTY')
291
- || normalized.endsWith('.OFQTY')
292
- || normalized.endsWith('.MPN')
293
- || normalized.endsWith('PERC')
294
- || normalized.endsWith('.PERC');
286
+ || normalized === 'BNO'
287
+ || normalized === 'QTY'
288
+ || normalized === 'OFQTY'
289
+ || normalized === 'MPN'
290
+ || normalized.endsWith('.BN')
291
+ || normalized.endsWith('.QTY')
292
+ || normalized.endsWith('.OFQTY')
293
+ || normalized.endsWith('.MPN')
294
+ || normalized.endsWith('PERC')
295
+ || normalized.endsWith('.PERC');
295
296
  });
296
297
  }
@@ -477,6 +477,8 @@ function shouldSkipFixedTo(header: any) {
477
477
  }
478
478
 
479
479
  function getDisplayValueForFallbackRow(item: any, dbFields: string[] = [], shouldNegate: boolean = false) {
480
+ console.log(item, dbFields);
481
+ console.log('getFirstFieldValue', getFirstFieldValue(item, dbFields));
480
482
  const value = getFirstFieldValue(item, dbFields);
481
483
  if (!shouldNegate) {
482
484
  return value;
@@ -167,6 +167,7 @@ export function GetDebitNotePDF(debitNoteData: any, entityData: any, headerConfi
167
167
  if (options.ConsolidateGST) {
168
168
  dnPrint = DebitNotePrintService.GetDebitNotePrintInfo(debitNotePrintData,entityData, image,true, true, taxCodes, false, true);
169
169
  } else {
170
+ console.log('DebitNotePrintData before formatting', debitNotePrintData);
170
171
  debitNotePrintData.Round = TrUtils.FixedTo(debitNoteData.Round);
171
172
  debitNotePrintData.Total = TrUtils.FixedTo(debitNoteData.Total);
172
173
  debitNotePrintData.SubToal = TrUtils.FixedTo(debitNoteData.SubToal);