Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Fix: Sumary Report (#2649)
Browse files Browse the repository at this point in the history
* Fix: Sumary Report

* Fix: Sumary Report

* Fix: Sumary Report

* Fix: Sumary Report
  • Loading branch information
Ricargame authored Sep 18, 2024
1 parent 0d97532 commit 26068be
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/components/ADempiere/Report/Data/DataReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ import DataCells from '@/components/ADempiere/Report/Data/DataCells.vue'
// Utility functions
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { isNumberField, isDateField, isBooleanField, isDecimalField } from '@/utils/ADempiere/references'
import {
formatQuantity
} from '@/utils/ADempiere/formatValue/numberFormat'
export default defineComponent({
name: 'DataReport',
components: {
Expand Down Expand Up @@ -339,22 +342,25 @@ export default defineComponent({
sums[index] = 'Total'
return
}
let sum = 0
data.forEach((data) => {
Object.values(data.cells).forEach((dataCell) => {
if (dataCell && 'sum_value' in dataCell && isNumberField(column.display_type)) {
sums[index] = dataCell.value.value
nextTick(() => {
const footerCells = document.querySelectorAll('.el-table__footer-wrapper td.el-table__cell')
footerCells.forEach((cell) => {
const num = parseFloat(cell.textContent)
if (!isEmptyValue(num) && num < 0) {
cell.style.color = 'red'
}
})
return
})
const dataCell = data.cells[column.code]
if (!isEmptyValue(dataCell) && dataCell.sum_value) {
const { value } = dataCell
if (!isEmptyValue(value) && value.value) {
sum += parseFloat(value.value)
}
})
}
})
sums[index] = sum === 0 ? '' : formatQuantity({ value: sum })
})
nextTick(() => {
const footerCells = document.querySelectorAll('.el-table__footer-wrapper td.el-table__cell')
footerCells.forEach((cell) => {
const num = parseFloat(cell.textContent)
if (!isEmptyValue(num) && num < 0) {
cell.style.color = 'red'
}
})
})
}
Expand Down

0 comments on commit 26068be

Please sign in to comment.