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

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into didam

parents c2c26692 b3763a9c
......@@ -814,9 +814,10 @@ export default class SubHolding extends Component {
}
}
})
this.setState({ dataTable, loading: false, previewTable: true, previewDownload: true }, () => {
console.log(this.state.dataTable)
// this.getTaxPlanMR(payload)
console.log(dataTable)
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => {
this.getTaxPlanMR(payload)
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -1726,86 +1727,83 @@ export default class SubHolding extends Component {
}
getTaxPlanMR(payload) {
let payloadLast = {
"report_id": this.state.report.value,
"revision": this.state.revisionType,
"periode": Number(this.state.periode.periode) - 1,
"company_id": this.state.company.company_id,
"submission_id": this.state.submissionID
}
api.create().getReportTPMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = this.state.dataTable
// let dataTable2 = []
// if (response.data) {
// let res = response.data.data
// res.map((item,index) => {
// let indexID = dataTable.findIndex((val) => val[1] == item.id)
// if (indexID != -1) {
// const handlePushChild = (items) => {
// let indexIDzz = dataTable.findIndex((val) => val[1] === items.id)
// // console.log(indexIDzz)
// if (indexIDzz != -1) {
// dataTable2.push([...dataTable[indexIDzz],
// Number(items.balance_sheet.january).toFixed(1),
// Number(items.balance_sheet.february).toFixed(1),
// Number(items.balance_sheet.march).toFixed(1),
// Number(items.balance_sheet.april).toFixed(1),
// Number(items.balance_sheet.may).toFixed(1),
// Number(items.balance_sheet.june).toFixed(1),
// Number(items.balance_sheet.july).toFixed(1),
// Number(items.balance_sheet.august).toFixed(1),
// Number(items.balance_sheet.september).toFixed(1),
// Number(items.balance_sheet.october).toFixed(1),
// Number(items.balance_sheet.november).toFixed(1),
// Number(items.balance_sheet.december).toFixed(1),
// ])
// }
// if (items.children !== null) {
// if (items.children.length > 0) {
// items.children.map((itemss, indexss) => {
// handlePushChild(itemss)
// })
// }
// }
// }
// dataTable2.push([...dataTable[indexID],
// Number(item.balance_sheet.january).toFixed(1),
// Number(item.balance_sheet.february).toFixed(1),
// Number(item.balance_sheet.march).toFixed(1),
// Number(item.balance_sheet.april).toFixed(1),
// Number(item.balance_sheet.may).toFixed(1),
// Number(item.balance_sheet.june).toFixed(1),
// Number(item.balance_sheet.july).toFixed(1),
// Number(item.balance_sheet.august).toFixed(1),
// Number(item.balance_sheet.september).toFixed(1),
// Number(item.balance_sheet.october).toFixed(1),
// Number(item.balance_sheet.november).toFixed(1),
// Number(item.balance_sheet.december).toFixed(1),
// ])
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
console.log(dataTable)
let dataTable2 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable.findIndex((val) => val[4] == item.id)
console.log(indexID)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable.findIndex((val) => val[4] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz],
Number(items.tax_planning_report.january).toFixed(1),
Number(items.tax_planning_report.february).toFixed(1),
Number(items.tax_planning_report.march).toFixed(1),
Number(items.tax_planning_report.april).toFixed(1),
Number(items.tax_planning_report.may).toFixed(1),
Number(items.tax_planning_report.june).toFixed(1),
Number(items.tax_planning_report.july).toFixed(1),
Number(items.tax_planning_report.august).toFixed(1),
Number(items.tax_planning_report.september).toFixed(1),
Number(items.tax_planning_report.october).toFixed(1),
Number(items.tax_planning_report.november).toFixed(1),
Number(items.tax_planning_report.december).toFixed(1),
Number(items.tax_planning_report.total_actual_before).toFixed(1),
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
Number(item.tax_planning_report.january).toFixed(1),
Number(item.tax_planning_report.february).toFixed(1),
Number(item.tax_planning_report.march).toFixed(1),
Number(item.tax_planning_report.april).toFixed(1),
Number(item.tax_planning_report.may).toFixed(1),
Number(item.tax_planning_report.june).toFixed(1),
Number(item.tax_planning_report.july).toFixed(1),
Number(item.tax_planning_report.august).toFixed(1),
Number(item.tax_planning_report.september).toFixed(1),
Number(item.tax_planning_report.october).toFixed(1),
Number(item.tax_planning_report.november).toFixed(1),
Number(item.tax_planning_report.december).toFixed(1),
Number(item.tax_planning_report.total_actual_before).toFixed(1),
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
// }
}
// })
// console.log(dataTable2)
// // this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
// this.setState({ dataTable2 }, () => {
// // console.log(this.state.dataTable2)
// this.getTaxPlanLastMR(payloadLast)
// })
// } else {
// this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
// }
})
console.log(dataTable2)
this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
// this.setState({ dataTable2 }, () => {
// // console.log(this.state.dataTable2)
// this.getTaxPlanLastMR(payloadLast)
// })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
......
This diff is collapsed.
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