Commit 42d054ba authored by rifkaki's avatar rifkaki

historical

parent bf34a703
......@@ -1191,87 +1191,179 @@ export default class SummaryOfTriputra extends Component {
console.log(newPayload);
console.log(response);
let dataTable = []
// if (response.data) {
// let res = response.data.data
// const handlePushChild = (item) => {
// let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
// if (indexIDzz === -1) {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
// Number(item.ratio.january).toFixed(1),
// Number(item.ratio.february).toFixed(1),
// Number(item.ratio.march).toFixed(1),
// Number(item.ratio.april).toFixed(1),
// Number(item.ratio.may).toFixed(1),
// Number(item.ratio.june).toFixed(1),
// Number(item.ratio.july).toFixed(1),
// Number(item.ratio.august).toFixed(1),
// Number(item.ratio.september).toFixed(1),
// Number(item.ratio.october).toFixed(1),
// Number(item.ratio.november).toFixed(1),
// Number(item.ratio.december).toFixed(1),
// Number(item.ratio.total_current_year).toFixed(1),
// Number(item.ratio.total_next_year).toFixed(1),
// Number(item.ratio.total_more_year).toFixed(1),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
// ])
// }
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// }
// res.map((item, index) => {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
// Number(item.ratio.january).toFixed(1),
// Number(item.ratio.february).toFixed(1),
// Number(item.ratio.march).toFixed(1),
// Number(item.ratio.april).toFixed(1),
// Number(item.ratio.may).toFixed(1),
// Number(item.ratio.june).toFixed(1),
// Number(item.ratio.july).toFixed(1),
// Number(item.ratio.august).toFixed(1),
// Number(item.ratio.september).toFixed(1),
// Number(item.ratio.october).toFixed(1),
// Number(item.ratio.november).toFixed(1),
// Number(item.ratio.december).toFixed(1),
// Number(item.ratio.total_current_year).toFixed(1),
// Number(item.ratio.total_next_year).toFixed(1),
// Number(item.ratio.total_more_year).toFixed(1),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
// ])
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// })
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
if (indexIDzz === -1) {
dataTable.push([
item.company_id,
item.parent,
item.level,
item.company_name,
item.revenue_one,
item.revenue_two,
item.revenue_three,
item.revenue_four,
item.revenue_five,
item.revenue_six,
item.revenue_seven,
item.revenue_eight,
item.revenue_nine,
item.revenue_ten,
item.revenue_twelve,
item.ebitda_one,
item.ebitda_two,
item.ebitda_three,
item.ebitda_four,
item.ebitda_five,
item.ebitda_six,
item.ebitda_seven,
item.ebitda_eight,
item.ebitda_nine,
item.ebitda_ten,
item.ebitda_twelve,
item.tpat_one,
item.tpat_two,
item.tpat_three,
item.tpat_four,
item.tpat_five,
item.tpat_six,
item.tpat_seven,
item.tpat_eight,
item.tpat_nine,
item.tpat_ten,
item.tpat_twelve,
item.npat_one,
item.npat_two,
item.npat_three,
item.npat_four,
item.npat_five,
item.npat_six,
item.npat_seven,
item.npat_eight,
item.npat_nine,
item.npat_ten,
item.npat_twelve,
item.total_asset_one,
item.total_asset_two,
item.total_asset_three,
item.total_asset_four,
item.total_asset_five,
item.total_asset_six,
item.total_asset_seven,
item.total_asset_eight,
item.total_asset_nine,
item.total_asset_ten,
item.total_asset_twelve,
item.total_equity_one,
item.total_equity_two,
item.total_equity_three,
item.total_equity_four,
item.total_equity_five,
item.total_equity_six,
item.total_equity_seven,
item.total_equity_eight,
item.total_equity_nine,
item.total_equity_ten,
item.total_equity_twelve,
item.order,
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([
item.company_id,
item.parent,
item.level,
item.company_name,
item.revenue_one,
item.revenue_two,
item.revenue_three,
item.revenue_four,
item.revenue_five,
item.revenue_six,
item.revenue_seven,
item.revenue_eight,
item.revenue_nine,
item.revenue_ten,
item.revenue_twelve,
item.ebitda_one,
item.ebitda_two,
item.ebitda_three,
item.ebitda_four,
item.ebitda_five,
item.ebitda_six,
item.ebitda_seven,
item.ebitda_eight,
item.ebitda_nine,
item.ebitda_ten,
item.ebitda_twelve,
item.tpat_one,
item.tpat_two,
item.tpat_three,
item.tpat_four,
item.tpat_five,
item.tpat_six,
item.tpat_seven,
item.tpat_eight,
item.tpat_nine,
item.tpat_ten,
item.tpat_twelve,
item.npat_one,
item.npat_two,
item.npat_three,
item.npat_four,
item.npat_five,
item.npat_six,
item.npat_seven,
item.npat_eight,
item.npat_nine,
item.npat_ten,
item.npat_twelve,
item.total_asset_one,
item.total_asset_two,
item.total_asset_three,
item.total_asset_four,
item.total_asset_five,
item.total_asset_six,
item.total_asset_seven,
item.total_asset_eight,
item.total_asset_nine,
item.total_asset_ten,
item.total_asset_twelve,
item.total_equity_one,
item.total_equity_two,
item.total_equity_three,
item.total_equity_four,
item.total_equity_five,
item.total_equity_six,
item.total_equity_seven,
item.total_equity_eight,
item.total_equity_nine,
item.total_equity_ten,
item.total_equity_twelve,
item.order,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
// } else {
// this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
// }
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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