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 { ...@@ -38,6 +38,7 @@ export default class BalanceSheet extends Component {
// ["Trade Receivables - Third Party", "142,668", "77,480"], // ["Trade Receivables - Third Party", "142,668", "77,480"],
] ]
} }
this.handleValue = this.handleValue.bind(this)
} }
componentDidMount() { componentDidMount() {
...@@ -61,6 +62,7 @@ export default class BalanceSheet extends Component { ...@@ -61,6 +62,7 @@ export default class BalanceSheet extends Component {
item.type_report_id, item.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula,
item.level, item.level,
item.description item.description
]) ])
...@@ -71,23 +73,48 @@ export default class BalanceSheet extends Component { ...@@ -71,23 +73,48 @@ export default class BalanceSheet extends Component {
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
i.children.map(val => { i.children.map(val => {
dataTable.push([ if (val.children && val.children.length > 0) {
val.type_report_id, dataTable.push([
val.id, val.type_report_id,
val.parent, val.id,
val.level, val.parent,
val.description 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 { } else {
dataTable.push([ dataTable.push([
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
...@@ -97,6 +124,7 @@ export default class BalanceSheet extends Component { ...@@ -97,6 +124,7 @@ export default class BalanceSheet extends Component {
i.type_report_id, i.type_report_id,
i.id, i.id,
i.parent, i.parent,
i.formula,
i.level, i.level,
i.description i.description
]) ])
...@@ -107,6 +135,7 @@ export default class BalanceSheet extends Component { ...@@ -107,6 +135,7 @@ export default class BalanceSheet extends Component {
item.type_report_id, item.type_report_id,
item.id, item.id,
item.parent, item.parent,
item.formula,
item.level, item.level,
item.description item.description
]) ])
...@@ -137,12 +166,14 @@ export default class BalanceSheet extends Component { ...@@ -137,12 +166,14 @@ export default class BalanceSheet extends Component {
let data = this.state.dataTable let data = this.state.dataTable
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
console.log(indexParent)
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = data[indexParent][tableMeta.columnIndex] let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else { } else {
data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
this.forceUpdate()
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.setState({ // this.setState({
// data: a, // data: a,
...@@ -170,6 +201,11 @@ export default class BalanceSheet extends Component { ...@@ -170,6 +201,11 @@ export default class BalanceSheet extends Component {
options: { options: {
display: false display: false
} }
}, {
name: "",
options: {
display: false
}
}, { }, {
name: "Account", name: "Account",
options: { options: {
...@@ -182,12 +218,12 @@ export default class BalanceSheet extends Component { ...@@ -182,12 +218,12 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 388 }}> <div style={{ width: 388 }}>
{tableMeta.rowData[3] == 0 ? {tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span> <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
: :
tableMeta.rowData[3] === 1 ? tableMeta.rowData[4] === 1 ?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> : <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span> <span style={{ fontSize: 12, marginLeft: 20 * Number(tableMeta.rowData[4]) }}>{val}</span>
} }
</div> </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