shareneus 1.6.96 → 1.6.98
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.
- package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +4 -4
- package/dist/shared/table-section/pdf-table.header.js +11 -2
- package/dist/shared/table-section/pdf-table.row.d.ts +1 -1
- package/dist/shared/table-section/pdf-table.row.js +28 -42
- package/dist/shared/table-section/pdf-table.section.js +3 -0
- package/dist/shared/totals-section/pdf-totals.section.js +29 -11
- package/package.json +1 -1
|
@@ -194,12 +194,12 @@ function GetHeaderInfo(Entity, marginleft, InvoicePDFData = {}) {
|
|
|
194
194
|
if (!tr_utils_1.TrUtils.IsEmpty(Entity.DLNo)) {
|
|
195
195
|
TaxInfo.push({ text: 'D.L.NO : ' + Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' });
|
|
196
196
|
}
|
|
197
|
-
TaxInfo.push(GetBillofSupplyName(InvoicePDFData.Settings));
|
|
197
|
+
// TaxInfo.push(GetBillofSupplyName(InvoicePDFData.Settings));
|
|
198
198
|
return TaxInfo;
|
|
199
199
|
}
|
|
200
|
-
function GetBillofSupplyName(Settings) {
|
|
201
|
-
|
|
202
|
-
}
|
|
200
|
+
// function GetBillofSupplyName(Settings: any) {
|
|
201
|
+
// return { text: Settings.Tax === 'BS' ? ' Bill of Supply' : null, alignment: 'center', marginLeft: 15, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
|
|
202
|
+
// }
|
|
203
203
|
// function SalesReceiptHeaderData(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
|
|
204
204
|
// return [
|
|
205
205
|
// SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
|
|
@@ -18,6 +18,8 @@ function GetTableHeader(itemsHeader) {
|
|
|
18
18
|
text: itemTitle,
|
|
19
19
|
width: itemWidth,
|
|
20
20
|
bold: (_l = item.bold) !== null && _l !== void 0 ? _l : true,
|
|
21
|
+
fontSize: 9,
|
|
22
|
+
alignment: resolveHeaderAlignment(itemTitle),
|
|
21
23
|
dbFields: itemDbFields,
|
|
22
24
|
stackParent: stackTitle,
|
|
23
25
|
stackSeq: typeof stackSeq === 'number' ? stackSeq : Number.MAX_SAFE_INTEGER
|
|
@@ -191,7 +193,7 @@ function buildHeaderRows(headerConfig, sType = '') {
|
|
|
191
193
|
const hasDiscGroup = hasDiscPercent && hasDiscAmount;
|
|
192
194
|
const hasGroupedHeaders = hasTaxPercent || hasTaxAmount || hasDiscGroup;
|
|
193
195
|
if (!hasGroupedHeaders) {
|
|
194
|
-
const singleRow = headerConfig.map((header) => (Object.assign({ text: header.text, dbFields: header.dbFields, stackFields: header.stackFields }, getHeaderCellStyle())));
|
|
196
|
+
const singleRow = headerConfig.map((header) => (Object.assign({ text: header.text, alignment: header.alignment, dbFields: header.dbFields, stackFields: header.stackFields }, getHeaderCellStyle())));
|
|
195
197
|
return [singleRow];
|
|
196
198
|
}
|
|
197
199
|
const topRow = [];
|
|
@@ -246,7 +248,7 @@ function buildHeaderRows(headerConfig, sType = '') {
|
|
|
246
248
|
if (hasDiscGroup && isDiscountAmountHeader(header.text)) {
|
|
247
249
|
continue;
|
|
248
250
|
}
|
|
249
|
-
topRow.push(Object.assign({ text: header.text, rowSpan: 2 }, getHeaderCellStyle()));
|
|
251
|
+
topRow.push(Object.assign({ text: header.text, rowSpan: 2, alignment: header.alignment }, getHeaderCellStyle()));
|
|
250
252
|
subRow.push({});
|
|
251
253
|
}
|
|
252
254
|
return [topRow, subRow];
|
|
@@ -272,6 +274,13 @@ function normalizeHeaderText(value) {
|
|
|
272
274
|
.trim()
|
|
273
275
|
.toUpperCase();
|
|
274
276
|
}
|
|
277
|
+
function resolveHeaderAlignment(title) {
|
|
278
|
+
const normalizedTitle = normalizeHeaderText(title);
|
|
279
|
+
if (normalizedTitle === 'LINETOTAL' || normalizedTitle === 'PRICE' || normalizedTitle === 'QTY') {
|
|
280
|
+
return 'right';
|
|
281
|
+
}
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
275
284
|
function getHeaderCellStyle() {
|
|
276
285
|
return {
|
|
277
286
|
bold: true,
|
|
@@ -11,6 +11,6 @@ export declare function buildDataRow(item: any, index: number, headerConfig: any
|
|
|
11
11
|
color?: undefined;
|
|
12
12
|
alignment?: undefined;
|
|
13
13
|
})[];
|
|
14
|
-
export declare function getFirstFieldValue(item: any, dbFields?: string[]
|
|
14
|
+
export declare function getFirstFieldValue(item: any, dbFields?: string[]): string;
|
|
15
15
|
export declare function getNumericAlignment(value: string): "left" | "right";
|
|
16
16
|
export declare function getCellAlignment(headerText: string, value: string): "left" | "right";
|
|
@@ -7,6 +7,7 @@ exports.getCellAlignment = getCellAlignment;
|
|
|
7
7
|
const pdf_table_config_1 = require("./pdf-table.config");
|
|
8
8
|
const my_date_1 = require("../../utils/my-date");
|
|
9
9
|
function buildDataRow(item, index, headerConfig, fixedTo = 2) {
|
|
10
|
+
console.log('Building data row for headerConfig:', headerConfig);
|
|
10
11
|
return headerConfig.map((column) => {
|
|
11
12
|
var _a;
|
|
12
13
|
if (column.type === 'tax') {
|
|
@@ -49,7 +50,7 @@ function buildDataRow(item, index, headerConfig, fixedTo = 2) {
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
function formatFieldValue(item, fieldConfig, fixedTo) {
|
|
52
|
-
const rawValue =
|
|
53
|
+
const rawValue = getFirstFieldValue(item, fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.dbFields);
|
|
53
54
|
if (isExpiryField(fieldConfig)) {
|
|
54
55
|
return formatExpiryDateValue(rawValue);
|
|
55
56
|
}
|
|
@@ -58,17 +59,6 @@ function formatFieldValue(item, fieldConfig, fixedTo) {
|
|
|
58
59
|
: rawValue;
|
|
59
60
|
return formatNumericLikeValue(signedValue, fixedTo, shouldSkipFixedTo(fieldConfig));
|
|
60
61
|
}
|
|
61
|
-
function getDisplayFieldValue(item, fieldConfig) {
|
|
62
|
-
const directValue = getFirstFieldValue(item, fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.dbFields);
|
|
63
|
-
if (directValue) {
|
|
64
|
-
return directValue;
|
|
65
|
-
}
|
|
66
|
-
const fallbackFields = getFallbackDbFields(fieldConfig);
|
|
67
|
-
if (fallbackFields.length === 0) {
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
return getFirstFieldValue(item, fallbackFields);
|
|
71
|
-
}
|
|
72
62
|
function getTaxValue(item, taxName, taxKind) {
|
|
73
63
|
if (taxName === 'IGST') {
|
|
74
64
|
const fields = taxKind === 'rate' ? ['IGSTPerc'] : ['IGSTAmt'];
|
|
@@ -104,8 +94,8 @@ function negateNumericLikeValue(value) {
|
|
|
104
94
|
return String(normalized === 0 ? 0 : -Math.abs(normalized));
|
|
105
95
|
}
|
|
106
96
|
function getFirstFieldValue(item, dbFields = []) {
|
|
107
|
-
const
|
|
108
|
-
for (const field of
|
|
97
|
+
const fields = Array.isArray(dbFields) ? dbFields : [dbFields];
|
|
98
|
+
for (const field of fields) {
|
|
109
99
|
const value = readValue(item, field);
|
|
110
100
|
if (value !== undefined && value !== null && value !== '') {
|
|
111
101
|
return String(value);
|
|
@@ -114,13 +104,14 @@ function getFirstFieldValue(item, dbFields = []) {
|
|
|
114
104
|
return '';
|
|
115
105
|
}
|
|
116
106
|
function readValue(item, field) {
|
|
117
|
-
|
|
107
|
+
const normalizedField = normalizeDbFieldPath(field);
|
|
108
|
+
if (!item || !normalizedField) {
|
|
118
109
|
return undefined;
|
|
119
110
|
}
|
|
120
|
-
if (item[
|
|
121
|
-
return item[
|
|
111
|
+
if (item[normalizedField] !== undefined) {
|
|
112
|
+
return item[normalizedField];
|
|
122
113
|
}
|
|
123
|
-
const dottedPathValue =
|
|
114
|
+
const dottedPathValue = normalizedField.split('.').reduce((current, key) => {
|
|
124
115
|
if (current && current[key] !== undefined) {
|
|
125
116
|
return current[key];
|
|
126
117
|
}
|
|
@@ -129,16 +120,7 @@ function readValue(item, field) {
|
|
|
129
120
|
if (dottedPathValue !== undefined) {
|
|
130
121
|
return dottedPathValue;
|
|
131
122
|
}
|
|
132
|
-
return deepFindByKey(item,
|
|
133
|
-
}
|
|
134
|
-
function normalizeDbFields(dbFields) {
|
|
135
|
-
if (Array.isArray(dbFields)) {
|
|
136
|
-
return dbFields;
|
|
137
|
-
}
|
|
138
|
-
if (typeof dbFields === 'string') {
|
|
139
|
-
return dbFields ? [dbFields] : [];
|
|
140
|
-
}
|
|
141
|
-
return [];
|
|
123
|
+
return deepFindByKey(item, normalizedField);
|
|
142
124
|
}
|
|
143
125
|
function deepFindByKey(source, field) {
|
|
144
126
|
if (!source || typeof source !== 'object') {
|
|
@@ -162,6 +144,9 @@ function getNumericAlignment(value) {
|
|
|
162
144
|
return isNumericLike(value) ? 'right' : 'left';
|
|
163
145
|
}
|
|
164
146
|
function getCellAlignment(headerText, value) {
|
|
147
|
+
if (isRightAlignedHeader(headerText)) {
|
|
148
|
+
return 'right';
|
|
149
|
+
}
|
|
165
150
|
if (isLeftAlignedHeader(headerText)) {
|
|
166
151
|
return 'left';
|
|
167
152
|
}
|
|
@@ -175,7 +160,11 @@ function isNumericLike(value) {
|
|
|
175
160
|
return /^-?\d+(\.\d+)?$/.test(normalized);
|
|
176
161
|
}
|
|
177
162
|
function isLeftAlignedHeader(headerText) {
|
|
178
|
-
return
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
function isRightAlignedHeader(headerText) {
|
|
166
|
+
const normalizedHeader = String(headerText !== null && headerText !== void 0 ? headerText : '').replace(/\s+/g, '').trim().toUpperCase();
|
|
167
|
+
return normalizedHeader === 'QTY' || normalizedHeader === 'OFFERQTY';
|
|
179
168
|
}
|
|
180
169
|
function formatNumericLikeValue(value, fixedTo, skipFixedTo = false) {
|
|
181
170
|
if (skipFixedTo) {
|
|
@@ -198,7 +187,7 @@ function isExpiryField(fieldConfig) {
|
|
|
198
187
|
}
|
|
199
188
|
const dbFields = Array.isArray(fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.dbFields) ? fieldConfig.dbFields : [];
|
|
200
189
|
return dbFields.some((field) => {
|
|
201
|
-
const normalized =
|
|
190
|
+
const normalized = normalizeDbFieldPath(field).toUpperCase();
|
|
202
191
|
return normalized === 'EXDT' || normalized.endsWith('.EXDT') || normalized.endsWith('.EXPIRY');
|
|
203
192
|
});
|
|
204
193
|
}
|
|
@@ -219,17 +208,6 @@ function formatExpiryDateValue(value) {
|
|
|
219
208
|
}
|
|
220
209
|
return my_date_1.MyDate.ConvertUTCDateToReadableExDate(input) || input;
|
|
221
210
|
}
|
|
222
|
-
function getFallbackDbFields(fieldConfig) {
|
|
223
|
-
var _a;
|
|
224
|
-
const text = String((_a = fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.text) !== null && _a !== void 0 ? _a : '').trim().toUpperCase();
|
|
225
|
-
if (text === 'BN' || text === 'BATCH' || text === 'BATCH NO' || text === 'BATCH NO.') {
|
|
226
|
-
return ['Batch.BN', 'Batch.MBN', 'BN'];
|
|
227
|
-
}
|
|
228
|
-
if (text === 'EXDT' || text === 'EXPIRY' || text === 'EXPIRY DATE') {
|
|
229
|
-
return ['Batch.ExDt', 'ExDt'];
|
|
230
|
-
}
|
|
231
|
-
return [];
|
|
232
|
-
}
|
|
233
211
|
function shouldSkipFixedTo(header) {
|
|
234
212
|
var _a;
|
|
235
213
|
const text = String((_a = header === null || header === void 0 ? void 0 : header.text) !== null && _a !== void 0 ? _a : '').trim().toUpperCase();
|
|
@@ -238,7 +216,15 @@ function shouldSkipFixedTo(header) {
|
|
|
238
216
|
}
|
|
239
217
|
const dbFields = Array.isArray(header === null || header === void 0 ? void 0 : header.dbFields) ? header.dbFields : [];
|
|
240
218
|
return dbFields.some((field) => {
|
|
241
|
-
const normalized =
|
|
219
|
+
const normalized = normalizeDbFieldPath(field).toUpperCase();
|
|
242
220
|
return normalized === 'BN' || normalized === 'BNO' || normalized.endsWith('.BN');
|
|
243
221
|
});
|
|
244
222
|
}
|
|
223
|
+
function normalizeDbFieldPath(field) {
|
|
224
|
+
const value = String(field !== null && field !== void 0 ? field : '').trim();
|
|
225
|
+
if (!value) {
|
|
226
|
+
return '';
|
|
227
|
+
}
|
|
228
|
+
const bracketMatch = value.match(/^\[(.*)\]$/);
|
|
229
|
+
return bracketMatch ? bracketMatch[1].trim() : value;
|
|
230
|
+
}
|
|
@@ -384,7 +384,10 @@ function shouldNegateFallbackHeaderValue(item, headerText) {
|
|
|
384
384
|
|| normalized === 'LINE TOTAL';
|
|
385
385
|
}
|
|
386
386
|
function getDisplayValueForFallbackRow(item, dbFields = [], shouldNegate = false) {
|
|
387
|
+
console.log(item, dbFields, shouldNegate);
|
|
388
|
+
console.log((0, pdf_table_row_1.getFirstFieldValue)(item, dbFields));
|
|
387
389
|
const value = (0, pdf_table_row_1.getFirstFieldValue)(item, dbFields);
|
|
390
|
+
console.log('value', value);
|
|
388
391
|
if (!shouldNegate) {
|
|
389
392
|
return value;
|
|
390
393
|
}
|
|
@@ -36,7 +36,7 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
36
36
|
margin: [0, 5, 0, 5]
|
|
37
37
|
};
|
|
38
38
|
const topColumns = {
|
|
39
|
-
columns: buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals),
|
|
39
|
+
columns: buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals, totalInWords),
|
|
40
40
|
columnGap: 20,
|
|
41
41
|
margin: [0, 0, 0, 8]
|
|
42
42
|
};
|
|
@@ -48,6 +48,7 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
48
48
|
dueAmount: dueInfo.due,
|
|
49
49
|
qrPayload,
|
|
50
50
|
upiPhone: resolveUpiPhone(normalizedInvoice),
|
|
51
|
+
showInWords: taxSummary.hasData || showBankDetails,
|
|
51
52
|
showDueSection,
|
|
52
53
|
isPoSPrint
|
|
53
54
|
});
|
|
@@ -59,7 +60,8 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
|
|
|
59
60
|
}
|
|
60
61
|
return [dividerLine, bottomColumns];
|
|
61
62
|
}
|
|
62
|
-
function buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals) {
|
|
63
|
+
function buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals, totalInWords) {
|
|
64
|
+
const inWords = totalInWords || '-';
|
|
63
65
|
if (taxSummary.hasData) {
|
|
64
66
|
return [
|
|
65
67
|
{ width: '42%', stack: buildTaxSummaryTableStack(null, taxSummary.rows, sType) },
|
|
@@ -74,24 +76,34 @@ function buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails,
|
|
|
74
76
|
];
|
|
75
77
|
}
|
|
76
78
|
return [
|
|
77
|
-
{
|
|
79
|
+
{
|
|
80
|
+
width: '70%',
|
|
81
|
+
columns: [
|
|
82
|
+
{ width: 'auto', text: 'In Words :', bold: true, fontSize: 9, color: '#111827' },
|
|
83
|
+
{ width: '*', text: inWords, bold: true, fontSize: 9, color: '#111827' }
|
|
84
|
+
],
|
|
85
|
+
columnGap: 6,
|
|
86
|
+
margin: [0, 0, 0, 4]
|
|
87
|
+
},
|
|
88
|
+
{ width: '30%', stack: buildInfoCardStack(null, totals.lines, { rightAlign: true }) }
|
|
78
89
|
];
|
|
79
90
|
}
|
|
80
91
|
function buildPostTotalsInfoSection(data) {
|
|
81
92
|
const hasQr = !!(0, pdf_shared_utils_1.firstValue)(data.qrPayload);
|
|
82
93
|
const inWords = data.totalInWords || '-';
|
|
83
94
|
const termsText = (0, pdf_shared_utils_1.firstValue)(data.terms);
|
|
84
|
-
const leftStack = [
|
|
85
|
-
|
|
95
|
+
const leftStack = [];
|
|
96
|
+
if (data.showInWords) {
|
|
97
|
+
leftStack.push({
|
|
86
98
|
columns: [
|
|
87
99
|
{ width: 'auto', text: 'In Words :', bold: true, fontSize: 9, color: '#111827' },
|
|
88
100
|
{ width: '*', text: inWords, bold: true, fontSize: 9, color: '#111827' }
|
|
89
101
|
],
|
|
90
102
|
columnGap: 6,
|
|
91
103
|
margin: [0, 0, 0, 4]
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (data.showDueSection) {
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (data.showDueSection && !data.isPoSPrint) {
|
|
95
107
|
const paidText = `Paid : Rs.${formatAmountFixed2(data.paidAmount)}`;
|
|
96
108
|
const dueText = `Due : Rs.${formatAmountFixed2(data.dueAmount)}`;
|
|
97
109
|
leftStack.push({
|
|
@@ -520,7 +532,9 @@ function hasDisplayValue(value) {
|
|
|
520
532
|
return true;
|
|
521
533
|
}
|
|
522
534
|
function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
535
|
+
var _a;
|
|
523
536
|
const subtotal = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['SIndTotal', 'STotal', 'SubTotal', 'SubTot', 'TaxableAmount', 'TaxableValue']);
|
|
537
|
+
const isPoSPrint = isTruthy((_a = printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.IsPoSPrint) !== null && _a !== void 0 ? _a : printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.isPoSPrint);
|
|
524
538
|
const showDetailedDisc = isTruthy((0, pdf_shared_utils_1.firstValue)(printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.ShowDetailedDisc));
|
|
525
539
|
const itemsDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.PDisc));
|
|
526
540
|
const servicesDiscount = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.LDisc));
|
|
@@ -539,6 +553,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
539
553
|
const returnTotal = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.RetTotal);
|
|
540
554
|
const finalTotalRaw = (0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.FinalTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Total, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.GrandTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.NetTotal);
|
|
541
555
|
const finalTotal = parseNumber(finalTotalRaw);
|
|
556
|
+
const paidAmount = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Paid', 'PaidAmount', 'PaidAmt', 'ReceivedAmount', 'RecAmt']);
|
|
542
557
|
let totalBeforeRound = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['TotalBeforeRound', 'BeforeRoundTotal', 'PreRoundTotal']);
|
|
543
558
|
if (totalBeforeRound === 0) {
|
|
544
559
|
if (finalTotalRaw) {
|
|
@@ -552,6 +567,8 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
552
567
|
}
|
|
553
568
|
}
|
|
554
569
|
const resolvedFinalTotal = finalTotalRaw ? finalTotal : totalBeforeRound + roundOff;
|
|
570
|
+
const dueFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Due', 'DueAmount', 'DueAmt', 'Balance', 'BalAmt']);
|
|
571
|
+
const dueAmount = dueFromInvoice !== 0 ? dueFromInvoice : Math.max(0, resolvedFinalTotal - paidAmount);
|
|
555
572
|
const discountLines = (showDetailedDisc
|
|
556
573
|
? [
|
|
557
574
|
{ label: 'Items Discount', amount: itemsDiscount },
|
|
@@ -561,7 +578,7 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
561
578
|
: [
|
|
562
579
|
{ label: 'Discount', amount: (0, math_operations_1.Add)(overalItemsDiscount, overalServicesDiscount) }
|
|
563
580
|
])
|
|
564
|
-
.filter((line) =>
|
|
581
|
+
.filter((line) => parseNumber(line === null || line === void 0 ? void 0 : line.amount) !== 0);
|
|
565
582
|
const totalLines = [
|
|
566
583
|
{ label: 'SubTotal', amount: subtotal },
|
|
567
584
|
...discountLines,
|
|
@@ -569,10 +586,11 @@ function resolveTotals(invoiceData, totalTax, printConfigData = {}) {
|
|
|
569
586
|
{ label: 'Return Total', amount: returnTotal },
|
|
570
587
|
{ label: 'Total', amount: totalBeforeRound },
|
|
571
588
|
{ label: 'Rounding', amount: roundOff },
|
|
572
|
-
{ label: 'Final Total', amount: resolvedFinalTotal }
|
|
589
|
+
...(roundOff !== 0 ? [{ label: 'Final Total', amount: resolvedFinalTotal }] : []),
|
|
590
|
+
...(isPoSPrint ? [{ label: 'Due', amount: dueAmount }] : [])
|
|
573
591
|
];
|
|
574
592
|
const lines = totalLines
|
|
575
|
-
.filter((line) =>
|
|
593
|
+
.filter((line) => parseNumber(line === null || line === void 0 ? void 0 : line.amount) !== 0)
|
|
576
594
|
.map((line) => ({ label: line.label, value: formatAmountFixed2(parseNumber(line === null || line === void 0 ? void 0 : line.amount)) }));
|
|
577
595
|
const hasData = lines.some((line) => hasDisplayValue(line === null || line === void 0 ? void 0 : line.value));
|
|
578
596
|
return {
|