shareneus 1.6.91 → 1.6.92
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.
|
@@ -17,6 +17,7 @@ function buildInvoiceTableData(PDFInvoiceData, PrintConfig, availableWidth) {
|
|
|
17
17
|
const items = Array.isArray(PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Items) ? PDFInvoiceData.Items : [];
|
|
18
18
|
const services = Array.isArray(PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Ops) ? PDFInvoiceData.Ops : [];
|
|
19
19
|
const sType = (_a = PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.SType) !== null && _a !== void 0 ? _a : '';
|
|
20
|
+
const showSectionSummaryRows = !resolveIsPoSPrint(PrintConfig);
|
|
20
21
|
const headerConfig = (0, pdf_table_header_1.GetTableHeader)(PrintConfig.TableConfig)[0];
|
|
21
22
|
const renderColumns = (0, pdf_table_header_1.getRenderableColumns)(headerConfig, sType);
|
|
22
23
|
const headerRows = (0, pdf_table_header_1.buildHeaderRows)(headerConfig, sType);
|
|
@@ -29,18 +30,32 @@ function buildInvoiceTableData(PDFInvoiceData, PrintConfig, availableWidth) {
|
|
|
29
30
|
const itemTotals = calculateSectionTotals(items);
|
|
30
31
|
const serviceTotals = calculateSectionTotals(services);
|
|
31
32
|
const itemSectionRows = items.length > 0
|
|
32
|
-
?
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
? buildSectionRows({
|
|
34
|
+
rows: items,
|
|
35
|
+
columnsOrHeaders: fallbackHeaderRow,
|
|
36
|
+
descriptionColumnIndex,
|
|
37
|
+
label: 'Items',
|
|
38
|
+
totalLabel: 'Items Total',
|
|
39
|
+
totals: itemTotals,
|
|
40
|
+
fixedTo,
|
|
41
|
+
buildRow: (item, index) => buildFallbackDataRow(item, index, fallbackHeaderRow, fixedTo),
|
|
42
|
+
buildTotalRow: () => buildFallbackSectionTotalRow(fallbackHeaderRow, 'Items Total', itemTotals, fixedTo),
|
|
43
|
+
showSectionSummaryRows
|
|
44
|
+
})
|
|
37
45
|
: [];
|
|
38
46
|
const serviceSectionRows = services.length > 0
|
|
39
|
-
?
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
? buildSectionRows({
|
|
48
|
+
rows: services,
|
|
49
|
+
columnsOrHeaders: fallbackHeaderRow,
|
|
50
|
+
descriptionColumnIndex,
|
|
51
|
+
label: 'Services',
|
|
52
|
+
totalLabel: 'Services Total',
|
|
53
|
+
totals: serviceTotals,
|
|
54
|
+
fixedTo,
|
|
55
|
+
buildRow: (service, index) => buildFallbackDataRow(service, index, fallbackHeaderRow, fixedTo),
|
|
56
|
+
buildTotalRow: () => buildFallbackSectionTotalRow(fallbackHeaderRow, 'Services Total', serviceTotals, fixedTo),
|
|
57
|
+
showSectionSummaryRows
|
|
58
|
+
})
|
|
44
59
|
: [];
|
|
45
60
|
body = [
|
|
46
61
|
fallbackHeaderRow,
|
|
@@ -54,18 +69,32 @@ function buildInvoiceTableData(PDFInvoiceData, PrintConfig, availableWidth) {
|
|
|
54
69
|
const itemTotals = calculateSectionTotals(items);
|
|
55
70
|
const serviceTotals = calculateSectionTotals(services);
|
|
56
71
|
const itemSectionRows = items.length > 0
|
|
57
|
-
?
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
? buildSectionRows({
|
|
73
|
+
rows: items,
|
|
74
|
+
columnsOrHeaders: renderColumns,
|
|
75
|
+
descriptionColumnIndex,
|
|
76
|
+
label: 'Items',
|
|
77
|
+
totalLabel: 'Items Total',
|
|
78
|
+
totals: itemTotals,
|
|
79
|
+
fixedTo,
|
|
80
|
+
buildRow: (item, index) => (0, pdf_table_row_1.buildDataRow)(item, index, renderColumns, fixedTo),
|
|
81
|
+
buildTotalRow: () => buildSectionTotalRow(renderColumns, 'Items Total', itemTotals, fixedTo),
|
|
82
|
+
showSectionSummaryRows
|
|
83
|
+
})
|
|
62
84
|
: [];
|
|
63
85
|
const serviceSectionRows = services.length > 0
|
|
64
|
-
?
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
86
|
+
? buildSectionRows({
|
|
87
|
+
rows: services,
|
|
88
|
+
columnsOrHeaders: renderColumns,
|
|
89
|
+
descriptionColumnIndex,
|
|
90
|
+
label: 'Services',
|
|
91
|
+
totalLabel: 'Services Total',
|
|
92
|
+
totals: serviceTotals,
|
|
93
|
+
fixedTo,
|
|
94
|
+
buildRow: (service, index) => (0, pdf_table_row_1.buildDataRow)(service, index, renderColumns, fixedTo),
|
|
95
|
+
buildTotalRow: () => buildSectionTotalRow(renderColumns, 'Services Total', serviceTotals, fixedTo),
|
|
96
|
+
showSectionSummaryRows
|
|
97
|
+
})
|
|
69
98
|
: [];
|
|
70
99
|
body = [
|
|
71
100
|
...headerRows,
|
|
@@ -329,6 +358,21 @@ function resolveFixedTo(value) {
|
|
|
329
358
|
}
|
|
330
359
|
return Math.floor(parsed);
|
|
331
360
|
}
|
|
361
|
+
function resolveIsPoSPrint(printConfig) {
|
|
362
|
+
var _a;
|
|
363
|
+
return Boolean((_a = printConfig === null || printConfig === void 0 ? void 0 : printConfig.IsPoSPrint) !== null && _a !== void 0 ? _a : printConfig === null || printConfig === void 0 ? void 0 : printConfig.isPoSPrint);
|
|
364
|
+
}
|
|
365
|
+
function buildSectionRows({ rows, columnsOrHeaders, descriptionColumnIndex, label, buildRow, buildTotalRow, showSectionSummaryRows }) {
|
|
366
|
+
const sectionRows = rows.map((row, index) => buildRow(row, index));
|
|
367
|
+
if (!showSectionSummaryRows) {
|
|
368
|
+
return sectionRows;
|
|
369
|
+
}
|
|
370
|
+
return [
|
|
371
|
+
buildSectionLabelRow(columnsOrHeaders.length, descriptionColumnIndex, label),
|
|
372
|
+
...sectionRows,
|
|
373
|
+
buildTotalRow()
|
|
374
|
+
];
|
|
375
|
+
}
|
|
332
376
|
function shouldNegateFallbackHeaderValue(item, headerText) {
|
|
333
377
|
if (!(item === null || item === void 0 ? void 0 : item.Ret)) {
|
|
334
378
|
return false;
|