Commit f660923a authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

summary pl

See merge request !1035
parents c1d323dd 02e5bcba
...@@ -250,6 +250,7 @@ const create = (type = "") => { ...@@ -250,6 +250,7 @@ const create = (type = "") => {
const getReportCFSumaMB = (body) => api.post('/transaction/summary_cash_flow/master_budget/get_report_hierarki', body) const getReportCFSumaMB = (body) => api.post('/transaction/summary_cash_flow/master_budget/get_report_hierarki', body)
const getReportCFSumaMR = (body) => api.post('/transaction/summary_cash_flow/monthly_report/get_report_hierarki', body) const getReportCFSumaMR = (body) => api.post('/transaction/summary_cash_flow/monthly_report/get_report_hierarki', body)
const getReportCFSuma = (body) => api.post('/transaction/summary_cash_flow/summary/get_report_hierarki', body) const getReportCFSuma = (body) => api.post('/transaction/summary_cash_flow/summary/get_report_hierarki', body)
const getReportPLSuma = (body) => api.post('/transaction/summary_profit_loss/summary/get_report_hierarki', body)
const getReportFRMB = (body) => api.post('/transaction/summary_ratio/master_budget/get_report_hierarki', body) const getReportFRMB = (body) => api.post('/transaction/summary_ratio/master_budget/get_report_hierarki', body)
const getReportFRMR = (body) => api.post('/transaction/summary_ratio/monthly_report/get_report_hierarki', body) const getReportFRMR = (body) => api.post('/transaction/summary_ratio/monthly_report/get_report_hierarki', body)
const getReportFRLastMR = (body) => api.post('/transaction/summary_ratio/monthly_report_last_year/get_report_hierarki', body) const getReportFRLastMR = (body) => api.post('/transaction/summary_ratio/monthly_report_last_year/get_report_hierarki', body)
...@@ -610,6 +611,7 @@ const create = (type = "") => { ...@@ -610,6 +611,7 @@ const create = (type = "") => {
getReportCFSumaMR, getReportCFSumaMR,
createReportCF, createReportCF,
getReportCFSuma, getReportCFSuma,
getReportPLSuma,
getAllReportBS, getAllReportBS,
getAllReportPLDetail, getAllReportPLDetail,
getAllReportOI, getAllReportOI,
......
...@@ -1385,96 +1385,119 @@ export default class SubHolding extends Component { ...@@ -1385,96 +1385,119 @@ export default class SubHolding extends Component {
}) })
} else if (this.state.report.value === 8) { } else if (this.state.report.value === 8) {
api.create().getReportPLMB(payload).then(response => { let dbSumaPL = []
// console.log(response); let payloadPL = {...payload, months: this.state.month.month_id}
// if (response.data) { api.create().getReportPLSuma(payloadPL).then(response => {
// let dataTable = [] console.log(response);
// console.log(response) if (response.data) {
// let res = response.data.data if (response.data.status === 'success') {
// const handlePushChild = (item) => { let res = response.data.data
// dataTable.push([ console.log(res)
// item.type_report_id, const handlePushChild = (item) => {
// item.id, let indexIDzz = dbSumaPL.findIndex((val) => val[1] === item.id)
// item.parent, if (indexIDzz === -1) {
// item.formula, let mtd_actual = item.profit_loss.mtd_actual == ''? 0 : item.profit_loss.mtd_actual
// item.level, let mtd_mb = item.profit_loss.mtd_mb == ''? 0 : item.profit_loss.mtd_mb
// item.description, let persenMtd = Number(mtd_actual/mtd_mb)
// item.profit_detail.total_actual_before === null ? "0" : item.profit_detail.total_actual_before === "" ? "0" : item.profit_detail.total_actual_before,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january, let ytd_actual = item.profit_loss.ytd_actual == ''? 0 : item.profit_loss.ytd_actual
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february, let ytd_mb = item.profit_loss.ytd_mb == ''? 0 : item.profit_loss.ytd_mb
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march, let persenYtd = Number(ytd_actual/ytd_mb)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may, let q1_actual = item.profit_loss.q1_actual == ''? 0 : item.profit_loss.q1_actual
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june, let q1_mb = item.profit_loss.q1_mb == ''? 0 : item.profit_loss.q1_mb
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july, let persenQuarter = Number(q1_actual/q1_mb)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september, let fy_actual = item.profit_loss.fy_actual == ''? 0 : item.profit_loss.fy_actual
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october, let fy_mb = item.profit_loss.fy_mb == ''? 0 : item.profit_loss.fy_mb
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november, let persenFy = Number(fy_actual/fy_mb)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.december,
// item.profit_detail.total_current_year, dbSumaPL.push([
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_next_year, item.id,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_more_year, item.profit_loss.mtd_actual,
// item.order, item.profit_loss.mtd,
// item.condition_it_should_be, isNaN(persenMtd)? 0 : persenMtd * 100,
// item.condition_if_wrong, item.profit_loss.mtd_last_year,
// item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula item.profit_loss.ytd_actual,
// ]) item.profit_loss.ytd,
isNaN(persenYtd)? 0 : persenYtd * 100,
// if (item.children !== null) { item.profit_loss.ytd_last_year,
// if (item.children.length > 0) { item.profit_loss.quarter_actual,
// item.children.map((items, indexs) => { item.profit_loss.quarter,
// handlePushChild(items) isNaN(persenQuarter)? 0 : persenQuarter * 100,
// }) item.profit_loss.quarter_last_year,
// } item.profit_loss.fy_actual,
// } item.profit_loss.fy,
// } isNaN(persenFy)? 0 : persenFy * 100,
// res.map((item, index) => { item.profit_loss.fy_last_year,
// dataTable.push([ ])
// item.type_report_id, }
// item.id, if (item.children !== null) {
// item.parent, if (item.children.length > 0) {
// item.formula, item.children.map((items, indexs) => {
// item.level, handlePushChild(items)
// item.description, })
// item.profit_detail.total_actual_before === null ? "0" : item.profit_detail.total_actual_before === "" ? "0" : item.profit_detail.total_actual_before, }
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january, }
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february, }
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march, res.map((item,index) => {
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april, let mtd_actual = item.profit_loss.mtd_actual == ''? 0 : item.profit_loss.mtd_actual
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may, let mtd = item.profit_loss.mtd == ''? 0 : item.profit_loss.mtd
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june, let persenMtd = Number(mtd_actual/mtd)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july, console.log(persenMtd)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august, let ytd_actual = item.profit_loss.ytd_actual == ''? 0 : item.profit_loss.ytd_actual
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september, let ytd = item.profit_loss.ytd == ''? 0 : item.profit_loss.ytd
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october, let persenYtd = Number(ytd_actual/ytd)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.december, let quarter_actual = item.profit_loss.quarter_actual == ''? 0 : item.profit_loss.quarter_actual
// item.profit_detail.total_current_year, let quarter = item.profit_loss.quarter == ''? 0 : item.profit_loss.quarter
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_next_year, let persenQuarter = Number(quarter_actual/quarter)
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_more_year,
// item.order, let fy_actual = item.profit_loss.fy_actual == ''? 0 : item.profit_loss.fy_actual
// item.condition_it_should_be, let fy = item.profit_loss.fy == ''? 0 : item.profit_loss.fy
// item.condition_if_wrong, let persenFy = Number(fy_actual/fy)
// item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula
// ]) dbSumaPL.push([
// if (item.children !== null) { item.id,
// if (item.children.length > 0) { item.profit_loss.mtd_actual,
// item.children.map((items, indexs) => { item.profit_loss.mtd_mb,
// handlePushChild(items) isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity'? (item.profit_loss.mtd == '' || item.profit_loss.mtd == 0? -0 : 0) : (item.profit_loss.mtd == '' || item.profit_loss.mtd == 0? persenMtd * -100 : persenMtd * 100),
// }) item.profit_loss.mtd_last_year,
// } item.profit_loss.ytd_actual,
// } item.profit_loss.ytd,
// }) isNaN(persenYtd) || persenYtd == 'Infinity' || persenYtd == '-Infinity'? (item.profit_loss.ytd == '' || item.profit_loss.ytd == 0? -0 : 0) : (item.profit_loss.ytd == '' || item.profit_loss.ytd == 0? persenYtd * -100 : persenYtd * 100),
// // this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true }) item.profit_loss.ytd_last_year,
// this.setState({ dataTable }, () => { item.profit_loss.quarter_actual,
// console.log(this.state.dataTable) item.profit_loss.quarter,
// this.getReportPLMR(payload) isNaN(persenQuarter) || persenQuarter == 'Infinity' || persenQuarter == '-Infinity'? (item.profit_loss.quarter == '' || item.profit_loss.quarter == 0? -0 : 0) : (item.profit_loss.quarter == '' || item.profit_loss.quarter == 0? persenQuarter * -100 : persenQuarter * 100),
// }) item.profit_loss.quarter_last_year,
// } else { item.profit_loss.fy_actual,
// this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) item.profit_loss.fy,
// } isNaN(persenFy) || persenFy == 'Infinity' || persenFy == '-Infinity'? (item.profit_loss.fy == '' || item.profit_loss.fy == 0? -0 : 0) : (item.profit_loss.fy == '' || item.profit_loss.fy == 0? persenFy * -100 : persenFy * 100),
this.setState({ previewTable: true, loading: false, previewDownload: false }) item.profit_loss.fy_last_year,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable: dbSumaPL, loading: false, previewTable: true, 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 })
}
}) })
} else if (this.state.report.value === 9) { } else if (this.state.report.value === 9) {
let paylodFR = { ...payload, months: this.state.month.month_id } let paylodFR = { ...payload, months: this.state.month.month_id }
......
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