Commit 21972c67 authored by Deni Rinaldi's avatar Deni Rinaldi

fixing parent balancesheet

parent 625f6a06
......@@ -38,6 +38,7 @@ export default class BalanceSheet extends Component {
// ["Trade Receivables - Third Party", "142,668", "77,480"],
]
}
this.handleValue = this.handleValue.bind(this)
}
componentDidMount() {
......@@ -61,6 +62,7 @@ export default class BalanceSheet extends Component {
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description
])
......@@ -71,23 +73,48 @@ export default class BalanceSheet extends Component {
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description
])
i.children.map(val => {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.level,
val.description
])
if (val.children && val.children.length > 0) {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description
])
val.children.map(items => {
console.log(items)
dataTable.push([
items.type_report_id,
items.id,
items.parent,
items.formula,
items.level,
items.description
])
})
} else {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.formula,
val.level,
val.description
])
}
})
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description
])
......@@ -97,6 +124,7 @@ export default class BalanceSheet extends Component {
i.type_report_id,
i.id,
i.parent,
i.formula,
i.level,
i.description
])
......@@ -107,6 +135,7 @@ export default class BalanceSheet extends Component {
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description
])
......@@ -137,12 +166,14 @@ export default class BalanceSheet extends Component {
let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) {
console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
this.forceUpdate()
// console.log(this.state.dataTable)
// this.setState({
// data: a,
......@@ -170,6 +201,11 @@ export default class BalanceSheet extends Component {
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "Account",
options: {
......@@ -182,12 +218,12 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 388 }}>
{tableMeta.rowData[3] == 0 ?
{tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
:
tableMeta.rowData[3] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span>
tableMeta.rowData[4] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span>
}
</div>
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment