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