Commit bfc78019 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

update

See merge request !1007
parents c3e55249 66e68589
......@@ -503,7 +503,7 @@ export default class SubHolding extends Component {
}
})
} else if (this.state.report.value === 4) {
api.create().getReportHierarkiFR(payload).then(response => {
api.create().getReportHierarkiFRMB(payload).then(response => {
// console.log(payload);
console.log(response);
let dataTable = []
......@@ -536,18 +536,18 @@ export default class SubHolding extends Component {
Number(item.ratio.december).toFixed(1),
Number(item.ratio.total_next_year).toFixed(1),
Number(item.ratio.total_more_year).toFixed(1),
Number(item.ratio.monthly_january).toFixed(2),
Number(item.ratio.monthly_february).toFixed(2),
Number(item.ratio.monthly_march).toFixed(2),
Number(item.ratio.monthly_april).toFixed(2),
Number(item.ratio.monthly_may).toFixed(2),
Number(item.ratio.monthly_june).toFixed(2),
Number(item.ratio.monthly_july).toFixed(2),
Number(item.ratio.monthly_august).toFixed(2),
Number(item.ratio.monthly_september).toFixed(2),
Number(item.ratio.monthly_october).toFixed(2),
Number(item.ratio.monthly_november).toFixed(2),
Number(item.ratio.monthly_december).toFixed(2),
// Number(item.ratio.monthly_january).toFixed(2),
// Number(item.ratio.monthly_february).toFixed(2),
// Number(item.ratio.monthly_march).toFixed(2),
// Number(item.ratio.monthly_april).toFixed(2),
// Number(item.ratio.monthly_may).toFixed(2),
// Number(item.ratio.monthly_june).toFixed(2),
// Number(item.ratio.monthly_july).toFixed(2),
// Number(item.ratio.monthly_august).toFixed(2),
// Number(item.ratio.monthly_september).toFixed(2),
// Number(item.ratio.monthly_october).toFixed(2),
// Number(item.ratio.monthly_november).toFixed(2),
// Number(item.ratio.monthly_december).toFixed(2),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong,
......@@ -586,18 +586,18 @@ export default class SubHolding extends Component {
Number(item.ratio.december).toFixed(1),
Number(item.ratio.total_next_year).toFixed(1),
Number(item.ratio.total_more_year).toFixed(1),
Number(item.ratio.monthly_january).toFixed(2),
Number(item.ratio.monthly_february).toFixed(2),
Number(item.ratio.monthly_march).toFixed(2),
Number(item.ratio.monthly_april).toFixed(2),
Number(item.ratio.monthly_may).toFixed(2),
Number(item.ratio.monthly_june).toFixed(2),
Number(item.ratio.monthly_july).toFixed(2),
Number(item.ratio.monthly_august).toFixed(2),
Number(item.ratio.monthly_september).toFixed(2),
Number(item.ratio.monthly_october).toFixed(2),
Number(item.ratio.monthly_november).toFixed(2),
Number(item.ratio.monthly_december).toFixed(2),
// Number(item.ratio.monthly_january).toFixed(2),
// Number(item.ratio.monthly_february).toFixed(2),
// Number(item.ratio.monthly_march).toFixed(2),
// Number(item.ratio.monthly_april).toFixed(2),
// Number(item.ratio.monthly_may).toFixed(2),
// Number(item.ratio.monthly_june).toFixed(2),
// Number(item.ratio.monthly_july).toFixed(2),
// Number(item.ratio.monthly_august).toFixed(2),
// Number(item.ratio.monthly_september).toFixed(2),
// Number(item.ratio.monthly_october).toFixed(2),
// Number(item.ratio.monthly_november).toFixed(2),
// Number(item.ratio.monthly_december).toFixed(2),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
......@@ -610,7 +610,10 @@ export default class SubHolding extends Component {
}
}
})
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => {
console.log(this.state.dataTable)
this.getRatioMR(payload)
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -628,6 +631,90 @@ export default class SubHolding extends Component {
}
}
getRatioMR(payload) {
api.create().getReportHierarkiFRMR(payload).then(response => {
// console.log(payload);
console.log(response);
let dataTable = this.state.dataTable
let dataTable2 = []
if (response.data) {
if (response.data.status === 'success') {
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.ratio.monthly_january).toFixed(1),
Number(items.ratio.monthly_february).toFixed(1),
Number(items.ratio.monthly_march).toFixed(1),
Number(items.ratio.monthly_april).toFixed(1),
Number(items.ratio.monthly_may).toFixed(1),
Number(items.ratio.monthly_june).toFixed(1),
Number(items.ratio.monthly_july).toFixed(1),
Number(items.ratio.monthly_august).toFixed(1),
Number(items.ratio.monthly_september).toFixed(1),
Number(items.ratio.monthly_october).toFixed(1),
Number(items.ratio.monthly_november).toFixed(1),
Number(items.ratio.monthly_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.ratio.monthly_january).toFixed(1),
Number(item.ratio.monthly_february).toFixed(1),
Number(item.ratio.monthly_march).toFixed(1),
Number(item.ratio.monthly_april).toFixed(1),
Number(item.ratio.monthly_may).toFixed(1),
Number(item.ratio.monthly_june).toFixed(1),
Number(item.ratio.monthly_july).toFixed(1),
Number(item.ratio.monthly_august).toFixed(1),
Number(item.ratio.monthly_september).toFixed(1),
Number(item.ratio.monthly_october).toFixed(1),
Number(item.ratio.monthly_november).toFixed(1),
Number(item.ratio.monthly_december).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 })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
async downloadAllData() {
if (this.state.report.value === 1) {
let res = await fetch(
......
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