Commit 9a669c70 authored by d.arizona's avatar d.arizona

update bs,pldet,oi, api baru

parent 808d65f1
......@@ -234,14 +234,17 @@ const create = (type = "") => {
const getLastestUpdateMROI = (body) => api.post('transaction/operating_indicator/monthly_report/get_latest_update', body)
//REPORT NEW
const getAllReportBS = (body) => api.post('/transaction/db_balance_sheet/get_report_hierarki', body)
const getReportBSMB = (body) => api.post('/transaction/db_balance_sheet/master_budget/get_report_hierarki', body)
const getReportBSMR = (body) => api.post('/transaction/db_balance_sheet/monthly_report/get_report_hierarki', body)
const getAllReportPLDetail = (body) => api.post('/transaction/db_profit_loss_detail/get_report_hierarki', body)
const getReportPLDetailMB = (body) => api.post('/transaction/db_profit_loss_detail/master_budget/get_report_hierarki', body)
const getReportPLDetailMR = (body) => api.post('/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki', body)
const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/get_report_hierarki', body)
const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body)
const getReportTPMB = (body) => api.post('/transaction/db_tax_planning/master_budget/get_report_hierarki', body)
const getReportTPMR = (body) => api.post('/transaction/db_tax_planning/monthly_report/get_report_hierarki', body)
const getAllReportOI = (body) => api.post('/transaction/db_operating_indicator/get_report_hierarki', body)
const getReportOIMB = (body) => api.post('/transaction/db_operating_indicator/master_budget/get_report_hierarki', body)
const getReportOIMR = (body) => api.post('/transaction/db_operating_indicator/monthly_report/get_report_hierarki', body)
const getReportCFSumaMB = (body) => api.post('/transaction/summary_cash_flow/master_budget/get_report_hierarki', body)
......@@ -602,7 +605,10 @@ const create = (type = "") => {
getReportCFSumaMB,
getReportCFSumaMR,
createReportCF,
getReportCFSuma
getReportCFSuma,
getAllReportBS,
getAllReportPLDetail,
getAllReportOI
}
}
......
......@@ -343,7 +343,7 @@ export default class SubHolding extends Component {
"submission_id": this.state.submissionID
}
if (this.state.report.value === 1) {
api.create().getReportPLDetailMB(payload).then(response => {
api.create().getAllReportPLDetail(payload).then(response => {
console.log(response);
let dataTable = []
if (response.data) {
......@@ -374,7 +374,31 @@ export default class SubHolding extends Component {
item.profit_loss.total_current_year,
item.profit_loss.total_next_year,
item.profit_loss.total_more_year,
item.order
item.order,
item.profit_loss.monthly_january,
item.profit_loss.monthly_february,
item.profit_loss.monthly_march,
item.profit_loss.monthly_april,
item.profit_loss.monthly_may,
item.profit_loss.monthly_june,
item.profit_loss.monthly_july,
item.profit_loss.monthly_august,
item.profit_loss.monthly_september,
item.profit_loss.monthly_october,
item.profit_loss.monthly_november,
item.profit_loss.monthly_december,
item.profit_loss.monthly_last_year_january,
item.profit_loss.monthly_last_year_february,
item.profit_loss.monthly_last_year_march,
item.profit_loss.monthly_last_year_april,
item.profit_loss.monthly_last_year_may,
item.profit_loss.monthly_last_year_june,
item.profit_loss.monthly_last_year_july,
item.profit_loss.monthly_last_year_august,
item.profit_loss.monthly_last_year_september,
item.profit_loss.monthly_last_year_october,
item.profit_loss.monthly_last_year_november,
item.profit_loss.monthly_last_year_december
])
}
if (item.children !== null) {
......@@ -409,7 +433,31 @@ export default class SubHolding extends Component {
item.profit_loss.total_current_year,
item.profit_loss.total_next_year,
item.profit_loss.total_more_year,
item.order
item.order,
item.profit_loss.monthly_january,
item.profit_loss.monthly_february,
item.profit_loss.monthly_march,
item.profit_loss.monthly_april,
item.profit_loss.monthly_may,
item.profit_loss.monthly_june,
item.profit_loss.monthly_july,
item.profit_loss.monthly_august,
item.profit_loss.monthly_september,
item.profit_loss.monthly_october,
item.profit_loss.monthly_november,
item.profit_loss.monthly_december,
item.profit_loss.monthly_last_year_january,
item.profit_loss.monthly_last_year_february,
item.profit_loss.monthly_last_year_march,
item.profit_loss.monthly_last_year_april,
item.profit_loss.monthly_last_year_may,
item.profit_loss.monthly_last_year_june,
item.profit_loss.monthly_last_year_july,
item.profit_loss.monthly_last_year_august,
item.profit_loss.monthly_last_year_september,
item.profit_loss.monthly_last_year_october,
item.profit_loss.monthly_last_year_november,
item.profit_loss.monthly_last_year_december
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -421,16 +469,18 @@ export default class SubHolding extends Component {
})
// console.log(dataTable)
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => {
console.log(this.state.dataTable)
this.getPLDetailMR(payload)
})
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
// this.setState({ dataTable }, () => {
// console.log(this.state.dataTable)
// this.getPLDetailMR(payload)
// })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
} else if (this.state.report.value === 2) {
api.create().getReportBSMB(payload).then(response => {
api.create().getAllReportBS(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = []
......@@ -464,7 +514,31 @@ export default class SubHolding extends Component {
Number(item.balance_sheet.total_more_year).toFixed(1),
item.order,
item.condition_it_should_be,
item.condition_if_wrong
item.condition_if_wrong,
item.balance_sheet.monthly_january,
item.balance_sheet.monthly_february,
item.balance_sheet.monthly_march,
item.balance_sheet.monthly_april,
item.balance_sheet.monthly_may,
item.balance_sheet.monthly_june,
item.balance_sheet.monthly_july,
item.balance_sheet.monthly_august,
item.balance_sheet.monthly_september,
item.balance_sheet.monthly_october,
item.balance_sheet.monthly_november,
item.balance_sheet.monthly_december,
item.balance_sheet.monthly_last_year_january,
item.balance_sheet.monthly_last_year_february,
item.balance_sheet.monthly_last_year_march,
item.balance_sheet.monthly_last_year_april,
item.balance_sheet.monthly_last_year_may,
item.balance_sheet.monthly_last_year_june,
item.balance_sheet.monthly_last_year_july,
item.balance_sheet.monthly_last_year_august,
item.balance_sheet.monthly_last_year_september,
item.balance_sheet.monthly_last_year_october,
item.balance_sheet.monthly_last_year_november,
item.balance_sheet.monthly_last_year_december
])
}
if (item.children !== null) {
......@@ -501,7 +575,31 @@ export default class SubHolding extends Component {
Number(item.balance_sheet.total_more_year).toFixed(1),
item.order,
item.condition_it_should_be,
item.condition_if_wrong
item.condition_if_wrong,
item.balance_sheet.monthly_january,
item.balance_sheet.monthly_february,
item.balance_sheet.monthly_march,
item.balance_sheet.monthly_april,
item.balance_sheet.monthly_may,
item.balance_sheet.monthly_june,
item.balance_sheet.monthly_july,
item.balance_sheet.monthly_august,
item.balance_sheet.monthly_september,
item.balance_sheet.monthly_october,
item.balance_sheet.monthly_november,
item.balance_sheet.monthly_december,
item.balance_sheet.monthly_last_year_january,
item.balance_sheet.monthly_last_year_february,
item.balance_sheet.monthly_last_year_march,
item.balance_sheet.monthly_last_year_april,
item.balance_sheet.monthly_last_year_may,
item.balance_sheet.monthly_last_year_june,
item.balance_sheet.monthly_last_year_july,
item.balance_sheet.monthly_last_year_august,
item.balance_sheet.monthly_last_year_september,
item.balance_sheet.monthly_last_year_october,
item.balance_sheet.monthly_last_year_november,
item.balance_sheet.monthly_last_year_december
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -511,11 +609,11 @@ export default class SubHolding extends Component {
}
}
})
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => {
console.log(this.state.dataTable)
this.getBalanceSheetMR(payload)
})
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
// this.setState({ dataTable }, () => {
// console.log(this.state.dataTable)
// this.getBalanceSheetMR(payload)
// })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......@@ -856,7 +954,7 @@ export default class SubHolding extends Component {
"report_id": 21
}
api.create().getReportOIMB(payloadOI).then(response => {
api.create().getAllReportOI(payloadOI).then(response => {
// console.log(payload);
console.log(response);
let dataTable = []
......@@ -889,7 +987,19 @@ export default class SubHolding extends Component {
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order
item.order,
item.master_budget.monthly_january == "" ? item.master_budget.monthly_january : String(item.master_budget.monthly_january).indexOf(".") == -1 ? Number(item.master_budget.monthly_january) : Number(item.master_budget.monthly_january).toFixed(1),
item.master_budget.monthly_february == "" ? item.master_budget.monthly_february : String(item.master_budget.monthly_february).indexOf(".") == -1 ? Number(item.master_budget.monthly_february) : Number(item.master_budget.monthly_february).toFixed(1),
item.master_budget.monthly_march == "" ? item.master_budget.monthly_march : String(item.master_budget.monthly_march).indexOf(".") == -1 ? Number(item.master_budget.monthly_march) : Number(item.master_budget.monthly_march).toFixed(1),
item.master_budget.monthly_april == "" ? item.master_budget.monthly_april : String(item.master_budget.monthly_april).indexOf(".") == -1 ? Number(item.master_budget.monthly_april) : Number(item.master_budget.monthly_april).toFixed(1),
item.master_budget.monthly_may == "" ? item.master_budget.monthly_may : String(item.master_budget.monthly_may).indexOf(".") == -1 ? Number(item.master_budget.monthly_may) : Number(item.master_budget.monthly_may).toFixed(1),
item.master_budget.monthly_june == "" ? item.master_budget.monthly_june : String(item.master_budget.monthly_june).indexOf(".") == -1 ? Number(item.master_budget.monthly_june) : Number(item.master_budget.monthly_june).toFixed(1),
item.master_budget.monthly_july == "" ? item.master_budget.monthly_july : String(item.master_budget.monthly_july).indexOf(".") == -1 ? Number(item.master_budget.monthly_july) : Number(item.master_budget.monthly_july).toFixed(1),
item.master_budget.monthly_august == "" ? item.master_budget.monthly_august : String(item.master_budget.monthly_august).indexOf(".") == -1 ? Number(item.master_budget.monthly_august) : Number(item.master_budget.monthly_august).toFixed(1),
item.master_budget.monthly_september == "" ? item.master_budget.monthly_september : String(item.master_budget.monthly_september).indexOf(".") == -1 ? Number(item.master_budget.monthly_september) : Number(item.master_budget.monthly_september).toFixed(1),
item.master_budget.monthly_october == "" ? item.master_budget.monthly_october : String(item.master_budget.monthly_october).indexOf(".") == -1 ? Number(item.master_budget.monthly_october) : Number(item.master_budget.monthly_october).toFixed(1),
item.master_budget.monthly_november == "" ? item.master_budget.monthly_november : String(item.master_budget.monthly_november).indexOf(".") == -1 ? Number(item.master_budget.monthly_november) : Number(item.master_budget.monthly_november).toFixed(1),
item.master_budget.monthly_december == "" ? item.master_budget.monthly_december : String(item.master_budget.monthly_december).indexOf(".") == -1 ? Number(item.master_budget.monthly_december) : Number(item.master_budget.monthly_december).toFixed(1),
])
}
if (item.children !== null) {
......@@ -923,7 +1033,19 @@ export default class SubHolding extends Component {
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order
item.order,
item.master_budget.monthly_january == "" ? item.master_budget.monthly_january : String(item.master_budget.monthly_january).indexOf(".") == -1 ? Number(item.master_budget.monthly_january) : Number(item.master_budget.monthly_january).toFixed(1),
item.master_budget.monthly_february == "" ? item.master_budget.monthly_february : String(item.master_budget.monthly_february).indexOf(".") == -1 ? Number(item.master_budget.monthly_february) : Number(item.master_budget.monthly_february).toFixed(1),
item.master_budget.monthly_march == "" ? item.master_budget.monthly_march : String(item.master_budget.monthly_march).indexOf(".") == -1 ? Number(item.master_budget.monthly_march) : Number(item.master_budget.monthly_march).toFixed(1),
item.master_budget.monthly_april == "" ? item.master_budget.monthly_april : String(item.master_budget.monthly_april).indexOf(".") == -1 ? Number(item.master_budget.monthly_april) : Number(item.master_budget.monthly_april).toFixed(1),
item.master_budget.monthly_may == "" ? item.master_budget.monthly_may : String(item.master_budget.monthly_may).indexOf(".") == -1 ? Number(item.master_budget.monthly_may) : Number(item.master_budget.monthly_may).toFixed(1),
item.master_budget.monthly_june == "" ? item.master_budget.monthly_june : String(item.master_budget.monthly_june).indexOf(".") == -1 ? Number(item.master_budget.monthly_june) : Number(item.master_budget.monthly_june).toFixed(1),
item.master_budget.monthly_july == "" ? item.master_budget.monthly_july : String(item.master_budget.monthly_july).indexOf(".") == -1 ? Number(item.master_budget.monthly_july) : Number(item.master_budget.monthly_july).toFixed(1),
item.master_budget.monthly_august == "" ? item.master_budget.monthly_august : String(item.master_budget.monthly_august).indexOf(".") == -1 ? Number(item.master_budget.monthly_august) : Number(item.master_budget.monthly_august).toFixed(1),
item.master_budget.monthly_september == "" ? item.master_budget.monthly_september : String(item.master_budget.monthly_september).indexOf(".") == -1 ? Number(item.master_budget.monthly_september) : Number(item.master_budget.monthly_september).toFixed(1),
item.master_budget.monthly_october == "" ? item.master_budget.monthly_october : String(item.master_budget.monthly_october).indexOf(".") == -1 ? Number(item.master_budget.monthly_october) : Number(item.master_budget.monthly_october).toFixed(1),
item.master_budget.monthly_november == "" ? item.master_budget.monthly_november : String(item.master_budget.monthly_november).indexOf(".") == -1 ? Number(item.master_budget.monthly_november) : Number(item.master_budget.monthly_november).toFixed(1),
item.master_budget.monthly_december == "" ? item.master_budget.monthly_december : String(item.master_budget.monthly_december).indexOf(".") == -1 ? Number(item.master_budget.monthly_december) : Number(item.master_budget.monthly_december).toFixed(1),
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -933,10 +1055,12 @@ export default class SubHolding extends Component {
}
}
})
this.setState({ dataTable }, () => {
console.log(this.state.dataTable)
this.getOIMR(payloadOI)
})
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: false })
// this.setState({ dataTable }, () => {
// console.log(this.state.dataTable)
// this.getOIMR(payloadOI)
// })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -1657,81 +1781,6 @@ export default class SubHolding extends Component {
})
}
getOIMR(payload) {
// let payloadOI = {...payload, "periode": Number(this.state.periode.periode) - 1}
api.create().getReportOIMR(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],
items.master_budget.january == "" ? items.master_budget.january : String(items.master_budget.january).indexOf(".") == -1 ? Number(items.master_budget.january) : Number(items.master_budget.january).toFixed(1),
items.master_budget.february == "" ? items.master_budget.february : String(items.master_budget.february).indexOf(".") == -1 ? Number(items.master_budget.february) : Number(items.master_budget.february).toFixed(1),
items.master_budget.march == "" ? items.master_budget.march : String(items.master_budget.march).indexOf(".") == -1 ? Number(items.master_budget.march) : Number(items.master_budget.march).toFixed(1),
items.master_budget.april == "" ? items.master_budget.april : String(items.master_budget.april).indexOf(".") == -1 ? Number(items.master_budget.april) : Number(items.master_budget.april).toFixed(1),
items.master_budget.may == "" ? items.master_budget.may : String(items.master_budget.may).indexOf(".") == -1 ? Number(items.master_budget.may) : Number(items.master_budget.may).toFixed(1),
items.master_budget.june == "" ? items.master_budget.june : String(items.master_budget.june).indexOf(".") == -1 ? Number(items.master_budget.june) : Number(items.master_budget.june).toFixed(1),
items.master_budget.july == "" ? items.master_budget.july : String(items.master_budget.july).indexOf(".") == -1 ? Number(items.master_budget.july) : Number(items.master_budget.july).toFixed(1),
items.master_budget.august == "" ? items.master_budget.august : String(items.master_budget.august).indexOf(".") == -1 ? Number(items.master_budget.august) : Number(items.master_budget.august).toFixed(1),
items.master_budget.september == "" ? items.master_budget.september : String(items.master_budget.september).indexOf(".") == -1 ? Number(items.master_budget.september) : Number(items.master_budget.september).toFixed(1),
items.master_budget.october == "" ? items.master_budget.october : String(items.master_budget.october).indexOf(".") == -1 ? Number(items.master_budget.october) : Number(items.master_budget.october).toFixed(1),
items.master_budget.november == "" ? items.master_budget.november : String(items.master_budget.november).indexOf(".") == -1 ? Number(items.master_budget.november) : Number(items.master_budget.november).toFixed(1),
items.master_budget.december == "" ? items.master_budget.december : String(items.master_budget.december).indexOf(".") == -1 ? Number(items.master_budget.december) : Number(items.master_budget.december).toFixed(1),
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.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: false })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getTaxPlanMR(payload) {
api.create().getReportTPMR(payload).then(response => {
console.log(payload);
......@@ -1813,163 +1862,6 @@ export default class SubHolding extends Component {
})
}
getBalanceSheetMR(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().getReportBSMR(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(dataTable2)
// this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable2 }, () => {
// console.log(this.state.dataTable2)
this.getBalanceSheetLastMR(payloadLast)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getBalanceSheetLastMR(payload) {
api.create().getReportBSMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable2 = this.state.dataTable2
let dataTable3 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable2.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable3.push([...dataTable2[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)
})
}
}
}
dataTable3.push([...dataTable2[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(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getReportPLMR(payload) {
let payloadLast = {
"report_id": this.state.report.value,
......@@ -2129,163 +2021,6 @@ export default class SubHolding extends Component {
})
}
getPLDetailMR(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().getReportPLDetailMR(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],
items.profit_loss.january,
items.profit_loss.february,
items.profit_loss.march,
items.profit_loss.april,
items.profit_loss.may,
items.profit_loss.june,
items.profit_loss.july,
items.profit_loss.august,
items.profit_loss.september,
items.profit_loss.october,
items.profit_loss.november,
items.profit_loss.december,
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
item.profit_loss.january,
item.profit_loss.february,
item.profit_loss.march,
item.profit_loss.april,
item.profit_loss.may,
item.profit_loss.june,
item.profit_loss.july,
item.profit_loss.august,
item.profit_loss.september,
item.profit_loss.october,
item.profit_loss.november,
item.profit_loss.december,
])
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.getPLDetailLastMR(payloadLast)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getPLDetailLastMR(payload) {
api.create().getReportPLDetailMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable2 = this.state.dataTable2
let dataTable3 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable2.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable3.push([...dataTable2[indexIDzz],
items.profit_loss.january,
items.profit_loss.february,
items.profit_loss.march,
items.profit_loss.april,
items.profit_loss.may,
items.profit_loss.june,
items.profit_loss.july,
items.profit_loss.august,
items.profit_loss.september,
items.profit_loss.october,
items.profit_loss.november,
items.profit_loss.december,
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable3.push([...dataTable2[indexID],
item.profit_loss.january,
item.profit_loss.february,
item.profit_loss.march,
item.profit_loss.april,
item.profit_loss.may,
item.profit_loss.june,
item.profit_loss.july,
item.profit_loss.august,
item.profit_loss.september,
item.profit_loss.october,
item.profit_loss.november,
item.profit_loss.december,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
console.log(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getRatioMR(payload) {
let payloadLast = {
"report_id": this.state.report.value,
......
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