@@ -90,6 +90,9 @@ import DataCells from '@/components/ADempiere/Report/Data/DataCells.vue'
90
90
// Utility functions
91
91
import { isEmptyValue } from ' @/utils/ADempiere/valueUtils.js'
92
92
import { isNumberField , isDateField , isBooleanField , isDecimalField } from ' @/utils/ADempiere/references'
93
+ import {
94
+ formatQuantity
95
+ } from ' @/utils/ADempiere/formatValue/numberFormat'
93
96
export default defineComponent ({
94
97
name: ' DataReport' ,
95
98
components: {
@@ -339,22 +342,25 @@ export default defineComponent({
339
342
sums[index] = ' Total'
340
343
return
341
344
}
345
+ let sum = 0
342
346
data .forEach ((data ) => {
343
- Object .values (data .cells ).forEach ((dataCell ) => {
344
- if (dataCell && ' sum_value' in dataCell && isNumberField (column .display_type )) {
345
- sums[index] = dataCell .value .value
346
- nextTick (() => {
347
- const footerCells = document .querySelectorAll (' .el-table__footer-wrapper td.el-table__cell' )
348
- footerCells .forEach ((cell ) => {
349
- const num = parseFloat (cell .textContent )
350
- if (! isEmptyValue (num) && num < 0 ) {
351
- cell .style .color = ' red'
352
- }
353
- })
354
- return
355
- })
347
+ const dataCell = data .cells [column .code ]
348
+ if (! isEmptyValue (dataCell) && dataCell .sum_value ) {
349
+ const { value } = dataCell
350
+ if (! isEmptyValue (value) && value .value ) {
351
+ sum += parseFloat (value .value )
356
352
}
357
- })
353
+ }
354
+ })
355
+ sums[index] = sum === 0 ? ' ' : formatQuantity ({ value: sum })
356
+ })
357
+ nextTick (() => {
358
+ const footerCells = document .querySelectorAll (' .el-table__footer-wrapper td.el-table__cell' )
359
+ footerCells .forEach ((cell ) => {
360
+ const num = parseFloat (cell .textContent )
361
+ if (! isEmptyValue (num) && num < 0 ) {
362
+ cell .style .color = ' red'
363
+ }
358
364
})
359
365
})
360
366
}
0 commit comments