Commit a9dddc68 authored by d.arizona's avatar d.arizona

engga cop engga

parent 0ee4456d
......@@ -35,7 +35,7 @@ export default class BudgetTahunan extends Component {
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode,
"revisi": this.state.periode
"report_type": "Master Budget",
}
api.create().getReportTypeBody(payload).then(response => {
if (response.data) {
......
......@@ -58,6 +58,9 @@ export default class BalanceSheet extends Component {
response.data.data.map((item, index) => {
if (item.children.length > 0) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.level,
item.description
])
......@@ -65,23 +68,35 @@ export default class BalanceSheet extends Component {
if (i.children) {
if (i.children.length > 0) {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.level,
i.description
])
i.children.map(val => {
dataTable.push([
val.type_report_id,
val.id,
val.parent,
val.level,
val.description
])
})
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.level,
i.description
])
}
} else {
dataTable.push([
i.type_report_id,
i.id,
i.parent,
i.level,
i.description
])
......@@ -89,6 +104,9 @@ export default class BalanceSheet extends Component {
})
} else {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.level,
item.description
])
......@@ -101,9 +119,24 @@ export default class BalanceSheet extends Component {
})
}
handleValue(data) {
let total = 0
this.state.dataTable.map((item,index) => {
if (data[1] == item[2]) {
total = item[6] == undefined? (total + 0) : (total + item[6])
}
// console.log(data[2])
})
return total
}
handleChange(value, tableMeta) {
let data = this.state.dataTable
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = value
let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(value)
let jagain = data[indexParent][tableMeta.columnIndex]
a = data[indexParent][tableMeta.columnIndex] = jagain == undefined? (0 + Number(value)) : (jagain + Number(value))
this.setState({
data: a
}, () => console.log(this.state.dataTable))
......@@ -117,7 +150,22 @@ export default class BalanceSheet extends Component {
options: {
display: false
}
}, {
},{
name: "",
options: {
display: false
}
},{
name: "",
options: {
display: false
}
},{
name: "",
options: {
display: false
}
},{
name: "Account",
options: {
customHeadRender: (columnMeta) => (
......@@ -129,10 +177,10 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 388 }}>
{tableMeta.rowData[0] == 0 ?
{tableMeta.rowData[3] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
:
tableMeta.rowData[0] === 1?
tableMeta.rowData[3] === 1?
<span style={{ fontSize: 12, marginLeft: 20 }}>{val}</span> :
<span style={{ fontSize: 12, marginLeft: 40 }}>{val}</span>
}
......@@ -168,7 +216,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowIndex === 3 || tableMeta.rowIndex === 4 || tableMeta.rowIndex === 9 ?
{tableMeta.rowData[0] !== 2 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
......@@ -194,6 +242,7 @@ export default class BalanceSheet extends Component {
placeholder=""
value={value}
onChange={event => {
// console.log(event.target)
updateValue(event.target.value)
this.handleChange(event.target.value, tableMeta)
}}
......@@ -201,7 +250,7 @@ export default class BalanceSheet extends Component {
}
/>
</div> :
<span style={{ fontSize: 12, textAlign: 'right' }}>{value === "" ? "-" : value}</span>
<span style={{ fontSize: 12, textAlign: 'right' }}>{this.handleValue(tableMeta.rowData)}</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