Commit f7b3f0ab authored by Riri Novita's avatar Riri Novita

mtd

parent 3a1fad0d
...@@ -273,7 +273,7 @@ const create = (type = "") => { ...@@ -273,7 +273,7 @@ const create = (type = "") => {
const getDashboardCAT = (body) => api.post('/dashboard/cat', body) const getDashboardCAT = (body) => api.post('/dashboard/cat', body)
const getHierarkiReportYtd = (body) => api.post('/transaction/summary/ytd/get_report_hierarki', body) const getHierarkiReportYtd = (body) => api.post('/transaction/summary/ytd/get_report_hierarki', body)
const getHierarkiReportHistorical = (body) => api.post('/transaction/summary_historical/summary/get_report_hierarki', body) const getHierarkiReportHistorical = (body) => api.post('/transaction/summary_historical/summary/get_report_hierarki', body)
const getHierarkiReportMTD = (body) => api.post('/transaction/summary/mtd/get_report_hierarki', body) const getHierarkiReportMTD = (body) => api.post('/transaction/summary_mtd/summary/get_report_hierarki', body)
const getFullApproveMB = (body) => api.post('/transaction/master_budget/get_approved_submit', body) const getFullApproveMB = (body) => api.post('/transaction/master_budget/get_approved_submit', body)
const getFullApproveMonthly = (body) => api.post('/transaction/monthly_report/get_approved_submit', body) const getFullApproveMonthly = (body) => api.post('/transaction/monthly_report/get_approved_submit', body)
......
...@@ -23,10 +23,10 @@ export default class SummaryOfTriputra extends Component { ...@@ -23,10 +23,10 @@ export default class SummaryOfTriputra extends Component {
listPeriode: null, listPeriode: null,
periode: null, periode: null,
reportType: [ reportType: [
{ value: 1, label: 'MTD Report' }, { value: 1, label: 'MTD Report', key: "MTD" },
{ value: 2, label: 'YTD Report' }, { value: 2, label: 'YTD Report', key: "YTD" },
{ value: 3, label: 'CPSM Report' }, { value: 3, label: 'CPSM Report', key: "CPSM" },
{ value: 4, label: 'Historical' }, { value: 4, label: 'Historical', key: "historical" },
], ],
report: null, report: null,
loading: false, loading: false,
...@@ -196,7 +196,7 @@ export default class SummaryOfTriputra extends Component { ...@@ -196,7 +196,7 @@ export default class SummaryOfTriputra extends Component {
getDataTable() { getDataTable() {
let payload = { let payload = {
"report_type": this.state.report.value, "report_type": this.state.report.key,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"months" : this.state.month.month_id "months" : this.state.month.month_id
} }
...@@ -205,126 +205,54 @@ export default class SummaryOfTriputra extends Component { ...@@ -205,126 +205,54 @@ export default class SummaryOfTriputra extends Component {
"report_type":"historical" "report_type":"historical"
} }
if (this.state.report.value === 1) { if (this.state.report.value === 1) {
let dbMTD =[]
api.create().getHierarkiReportMTD(payload).then(response => { api.create().getHierarkiReportMTD(payload).then(response => {
console.log(payload);
console.log(response); console.log(response);
// console.log(payload) let dataTable = []
// let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = [response.data.data]
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dbMTD.findIndex((val) => val[0] === item.company_id) let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let mtd_revenue_act = item.mtd_revenue_act = '' ? 0 : Number(item.mtd_revenue_act) dataTable.push([
let mtd_revenue_mb = item.mtd_revenue_mb = '' ? 0 : Number(item.mtd_revenue_mb) // item.company_id,
let persenRevMB = 0 0,
if (mtd_revenue_mb < 0) {
if (mtd_revenue_act >= mtd_revenue_mb) {
persenRevMB = ( mtd_revenue_mb - mtd_revenue_act ) / mtd_revenue_mb + 1
} else {
persenRevMB = ( mtd_revenue_mb - mtd_revenue_act ) / mtd_revenue_mb
}
} else {
persenRevMB = mtd_revenue_act / mtd_revenue_mb
}
let mtd_ebitda_act = item.mtd_ebitda_act = '' ? 0 : Number(item.mtd_ebitda_act)
let mtd_ebitda_mb = item.mtd_ebitda_mb = '' ? 0 : Number(item.mtd_ebitda_mb)
let persenEbitMB = 0
if (mtd_ebitda_mb < 0) {
if (mtd_ebitda_act >= mtd_ebitda_mb) {
persenEbitMB = ( mtd_ebitda_mb - mtd_ebitda_act ) / mtd_ebitda_mb + 1
} else {
persenEbitMB = ( mtd_ebitda_mb - mtd_ebitda_act ) / mtd_ebitda_mb
}
} else {
persenEbitMB = mtd_ebitda_act / mtd_ebitda_mb
}
let mtd_tpat_act = item.mtd_tpat_act = '' ? 0 : Number(item.mtd_tpat_act)
let mtd_tpat_mb = item.mtd_tpat_mb = '' ? 0 : Number(item.mtd_tpat_mb)
let persenTPATMB = 0
if (mtd_tpat_mb < 0) {
if (mtd_tpat_act >= mtd_tpat_mb) {
persenTPATMB = ( mtd_tpat_mb - mtd_tpat_act ) / mtd_tpat_mb + 1
} else {
persenTPATMB = ( mtd_tpat_mb - mtd_tpat_act ) / mtd_tpat_mb
}
} else {
persenTPATMB = mtd_tpat_act / mtd_tpat_mb
}
let mtd_npat_act = item.mtd_npat_act = '' ? 0 : Number(item.mtd_npat_act)
let mtd_npat_mb = item.mtd_npat_mb = '' ? 0 : Number(item.mtd_npat_mb)
let persenNPATMB = 0
if (mtd_npat_mb < 0) {
if (mtd_npat_act >= mtd_npat_mb) {
persenNPATMB = ( mtd_npat_mb - mtd_npat_act ) / mtd_npat_mb + 1
} else {
persenNPATMB = ( mtd_npat_mb - mtd_npat_act ) / mtd_npat_mb
}
} else {
persenNPATMB = mtd_npat_act / mtd_npat_mb
}
let mtd_cf_cfo = item.mtd_cf_cfo = '' ? 0 : Number(item.mtd_cf_cfo)
let mtd_cf_cfi = item.mtd_cf_cfi = '' ? 0 : Number(item.mtd_cf_cfi)
let mtd_cf_cff = item.mtd_cf_cff = '' ? 0 : Number(item.mtd_cf_cff)
let mtd_net_cf = mtd_cf_cfo + mtd_cf_cfi + mtd_cf_cff
let mtd_os_bank_loan_ki = item.mtd_os_bank_loan_ki = '' ? 0 : Number(item.mtd_os_bank_loan_ki)
let mtd_os_bank_loan_wc = item.mtd_os_bank_loan_wc = '' ? 0 : Number(item.mtd_os_bank_loan_wc)
let mtd_os_bank_loan_others = item.mtd_os_bank_loan_others = '' ? 0 : Number(item.mtd_os_bank_loan_others)
let mtd_os_bank_loan_total = mtd_os_bank_loan_ki + mtd_os_bank_loan_wc + mtd_os_bank_loan_others
let mtd_fr_ar_days = item.mtd_fr_ar_days = '' ? 0 : Number(item.mtd_fr_ar_days)
let mtd_fr_inv_days = item.mtd_fr_inv_days = '' ? 0 : Number(item.mtd_fr_inv_days)
let mtd_fr_ap_days = item.mtd_fr_ap_days = '' ? 0 : Number(item.mtd_fr_ap_days)
let mtd_fr_ccc = mtd_fr_ar_days + mtd_fr_inv_days - mtd_fr_ap_days
dbMTD.push([
item.company_id,
item.parent, item.parent,
item.level, item.level,
item.company_name, item.item_name,
item.mtd_revenue_act, item.revenue_act,
item.mtd_revenue_mb, item.revenue_mb,
isNaN(persenRevMB) || persenRevMB == 'Infinity' || persenRevMB == '-Infinity'? (item.mtd_revenue_mb == '' || item.mtd_revenue_mb == 0? -0 : 0) : (item.mtd_revenue_mb == '' || item.mtd_revenue_mb == 0? persenRevMB * -100 : persenRevMB * 100), item.revenue_percent_of_mb,
item.mtd_ebitda_act, item.ebitda_act,
item.mtd_ebitda_mb, item.ebitda_mb,
isNaN(persenEbitMB) || persenEbitMB == 'Infinity' || persenEbitMB == '-Infinity'? (item.mtd_ebitda_mb == '' || item.mtd_ebitda_mb == 0? -0 : 0) : (item.mtd_ebitda_mb == '' || item.mtd_ebitda_mb == 0? persenEbitMB * -100 : persenEbitMB * 100), item.ebitda_percent_of_mb,
item.mtd_tpat_act, item.tpat_act,
item.mtd_tpat_mb, item.tpat_mb,
isNaN(persenTPATMB) || persenTPATMB == 'Infinity' || persenTPATMB == '-Infinity'? (item.mtd_tpat_mb == '' || item.mtd_tpat_mb == 0? -0 : 0) : (item.mtd_tpat_mb == '' || item.mtd_tpat_mb == 0? persenTPATMB * -100 : persenTPATMB * 100), item.tpat_percent_of_mb,
item.mtd_npat_act, item.npat_act,
item.mtd_npat_mb, item.npat_mb,
isNaN(persenNPATMB) || persenNPATMB == 'Infinity' || persenNPATMB == '-Infinity'? (item.mtd_npat_mb == '' || item.mtd_npat_mb == 0? -0 : 0) : (item.mtd_npat_mb == '' || item.mtd_npat_mb == 0? persenNPATMB * -100 : persenNPATMB * 100), item.npat_percent_of_mb,
item.mtd_cf_cfo, item.cash_flow_cfo,
item.mtd_cf_cfi, item.cash_flow_cfi,
item.mtd_cf_cff, item.cash_flow_cff,
mtd_net_cf, item.cash_flow_cf,
item.mtd_os_bank_loan_ki, item.os_bank_loan_ki,
item.mtd_os_bank_loan_wc, item.os_bank_loan_wc,
item.mtd_os_bank_loan_others, item.os_bank_loan_other,
mtd_os_bank_loan_total, item.os_bank_loan_total,
item.mtd_os_shl, item.os_shl,
item.mtd_bs_cash_bank, item.balance_sheet_cash_bank,
item.mtd_bs_ca, item.balance_sheet_ca,
item.mtd_bs_cl, item.balance_sheet_cl,
item.mtd_bs_equility, item.balance_sheet_equity,
item.mtd_fr_cr, item.ratio_cr,
item.mtd_fr_der, item.ratio_der,
item.mtd_fr_debt_ebitda, item.ratio_debt_to_ebitda,
item.mtd_fr_interest, item.ratio_to_interest,
item.mtd_fr_ar_days, item.ratio_ar_days,
item.mtd_fr_inv_days, item.ratio_inv_days,
item.mtd_fr_ap_days, item.ratio_ap_days,
mtd_fr_ccc, item.ratio_ccc,
item.order, item.order,
]) ])
} }
...@@ -337,115 +265,45 @@ export default class SummaryOfTriputra extends Component { ...@@ -337,115 +265,45 @@ export default class SummaryOfTriputra extends Component {
} }
} }
res.map((item, index) => { res.map((item, index) => {
let mtd_revenue_act = item.mtd_revenue_act = '' ? 0 : Number(item.mtd_revenue_act) dataTable.push([
let mtd_revenue_mb = item.mtd_revenue_mb = '' ? 0 : Number(item.mtd_revenue_mb) // item.company_id,
let persenRevMB = 0 0,
if (mtd_revenue_mb < 0) {
if (mtd_revenue_act >= mtd_revenue_mb) {
persenRevMB = ( mtd_revenue_mb - mtd_revenue_act ) / mtd_revenue_mb + 1
} else {
persenRevMB = ( mtd_revenue_mb - mtd_revenue_act ) / mtd_revenue_mb
}
} else {
persenRevMB = mtd_revenue_act / mtd_revenue_mb
}
let mtd_ebitda_act = item.mtd_ebitda_act = '' ? 0 : Number(item.mtd_ebitda_act)
let mtd_ebitda_mb = item.mtd_ebitda_mb = '' ? 0 : Number(item.mtd_ebitda_mb)
let persenEbitMB = 0
if (mtd_ebitda_mb < 0) {
if (mtd_ebitda_act >= mtd_ebitda_mb) {
persenEbitMB = ( mtd_ebitda_mb - mtd_ebitda_act ) / mtd_ebitda_mb + 1
} else {
persenEbitMB = ( mtd_ebitda_mb - mtd_ebitda_act ) / mtd_ebitda_mb
}
} else {
persenEbitMB = mtd_ebitda_act / mtd_ebitda_mb
}
let mtd_tpat_act = item.mtd_tpat_act = '' ? 0 : Number(item.mtd_tpat_act)
let mtd_tpat_mb = item.mtd_tpat_mb = '' ? 0 : Number(item.mtd_tpat_mb)
let persenTPATMB = 0
if (mtd_tpat_mb < 0) {
if (mtd_tpat_act >= mtd_tpat_mb) {
persenTPATMB = ( mtd_tpat_mb - mtd_tpat_act ) / mtd_tpat_mb + 1
} else {
persenTPATMB = ( mtd_tpat_mb - mtd_tpat_act ) / mtd_tpat_mb
}
} else {
persenTPATMB = mtd_tpat_act / mtd_tpat_mb
}
let mtd_npat_act = item.mtd_npat_act = '' ? 0 : Number(item.mtd_npat_act)
let mtd_npat_mb = item.mtd_npat_mb = '' ? 0 : Number(item.mtd_npat_mb)
let persenNPATMB = 0
if (mtd_npat_mb < 0) {
if (mtd_npat_act >= mtd_npat_mb) {
persenNPATMB = ( mtd_npat_mb - mtd_npat_act ) / mtd_npat_mb + 1
} else {
persenNPATMB = ( mtd_npat_mb - mtd_npat_act ) / mtd_npat_mb
}
} else {
persenNPATMB = mtd_npat_act / mtd_npat_mb
}
let mtd_cf_cfo = item.mtd_cf_cfo = '' ? 0 : Number(item.mtd_cf_cfo)
let mtd_cf_cfi = item.mtd_cf_cfi = '' ? 0 : Number(item.mtd_cf_cfi)
let mtd_cf_cff = item.mtd_cf_cff = '' ? 0 : Number(item.mtd_cf_cff)
let mtd_net_cf = mtd_cf_cfo + mtd_cf_cfi + mtd_cf_cff
let mtd_os_bank_loan_ki = item.mtd_os_bank_loan_ki = '' ? 0 : Number(item.mtd_os_bank_loan_ki)
let mtd_os_bank_loan_wc = item.mtd_os_bank_loan_wc = '' ? 0 : Number(item.mtd_os_bank_loan_wc)
let mtd_os_bank_loan_others = item.mtd_os_bank_loan_others = '' ? 0 : Number(item.mtd_os_bank_loan_others)
let mtd_os_bank_loan_total = mtd_os_bank_loan_ki + mtd_os_bank_loan_wc + mtd_os_bank_loan_others
let mtd_fr_ar_days = item.mtd_fr_ar_days = '' ? 0 : Number(item.mtd_fr_ar_days)
let mtd_fr_inv_days = item.mtd_fr_inv_days = '' ? 0 : Number(item.mtd_fr_inv_days)
let mtd_fr_ap_days = item.mtd_fr_ap_days = '' ? 0 : Number(item.mtd_fr_ap_days)
let mtd_fr_ccc = mtd_fr_ar_days + mtd_fr_inv_days - mtd_fr_ap_days
dbMTD.push([
item.company_id,
item.parent, item.parent,
item.level, item.level,
item.company_name, item.item_name,
item.mtd_revenue_act, item.revenue_act,
item.mtd_revenue_mb, item.revenue_mb,
isNaN(persenRevMB) || persenRevMB == 'Infinity' || persenRevMB == '-Infinity'? (item.mtd_revenue_mb == '' || item.mtd_revenue_mb == 0? -0 : 0) : (item.mtd_revenue_mb == '' || item.mtd_revenue_mb == 0? persenRevMB * -100 : persenRevMB * 100), item.revenue_percent_of_mb,
item.mtd_ebitda_act, item.ebitda_act,
item.mtd_ebitda_mb, item.ebitda_mb,
isNaN(persenEbitMB) || persenEbitMB == 'Infinity' || persenEbitMB == '-Infinity'? (item.mtd_ebitda_mb == '' || item.mtd_ebitda_mb == 0? -0 : 0) : (item.mtd_ebitda_mb == '' || item.mtd_ebitda_mb == 0? persenEbitMB * -100 : persenEbitMB * 100), item.ebitda_percent_of_mb,
item.mtd_tpat_act, item.tpat_act,
item.mtd_tpat_mb, item.tpat_mb,
isNaN(persenTPATMB) || persenTPATMB == 'Infinity' || persenTPATMB == '-Infinity'? (item.mtd_tpat_mb == '' || item.mtd_tpat_mb == 0? -0 : 0) : (item.mtd_tpat_mb == '' || item.mtd_tpat_mb == 0? persenTPATMB * -100 : persenTPATMB * 100), item.tpat_percent_of_mb,
item.mtd_npat_act, item.npat_act,
item.mtd_npat_mb, item.npat_mb,
isNaN(persenNPATMB) || persenNPATMB == 'Infinity' || persenNPATMB == '-Infinity'? (item.mtd_npat_mb == '' || item.mtd_npat_mb == 0? -0 : 0) : (item.mtd_npat_mb == '' || item.mtd_npat_mb == 0? persenNPATMB * -100 : persenNPATMB * 100), item.npat_percent_of_mb,
item.mtd_cf_cfo, item.cash_flow_cfo,
item.mtd_cf_cfi, item.cash_flow_cfi,
item.mtd_cf_cff, item.cash_flow_cff,
mtd_net_cf, item.cash_flow_cf,
item.mtd_os_bank_loan_ki, item.os_bank_loan_ki,
item.mtd_os_bank_loan_wc, item.os_bank_loan_wc,
item.mtd_os_bank_loan_others, item.os_bank_loan_other,
mtd_os_bank_loan_total, item.os_bank_loan_total,
item.mtd_os_shl, item.os_shl,
item.mtd_bs_cash_bank, item.balance_sheet_cash_bank,
item.mtd_bs_ca, item.balance_sheet_ca,
item.mtd_bs_cl, item.balance_sheet_cl,
item.mtd_bs_equility, item.balance_sheet_equity,
item.mtd_fr_cr, item.ratio_cr,
item.mtd_fr_der, item.ratio_der,
item.mtd_fr_debt_ebitda, item.ratio_debt_to_ebitda,
item.mtd_fr_interest, item.ratio_to_interest,
item.mtd_fr_ar_days, item.ratio_ar_days,
item.mtd_fr_inv_days, item.ratio_inv_days,
item.mtd_fr_ap_days, item.ratio_ap_days,
mtd_fr_ccc, item.ratio_ccc,
item.order, item.order,
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -456,8 +314,8 @@ export default class SummaryOfTriputra extends Component { ...@@ -456,8 +314,8 @@ export default class SummaryOfTriputra extends Component {
} }
} }
}) })
console.log(dbMTD) console.log(dataTable)
this.setState({ dataTable: dbMTD, previewTable: true, loading: false, previewDownload: true }) this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
} else { } else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
......
...@@ -168,7 +168,6 @@ export default class TableSummaryTriputra extends Component { ...@@ -168,7 +168,6 @@ export default class TableSummaryTriputra extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1}
disabled={true} disabled={true}
value={Number(tableMeta.rowData[4]).toFixed(1)} value={Number(tableMeta.rowData[4]).toFixed(1)}
/> />
...@@ -187,7 +186,6 @@ export default class TableSummaryTriputra extends Component { ...@@ -187,7 +186,6 @@ export default class TableSummaryTriputra extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
decimalScale={1}
disabled={true} disabled={true}
value={Number(tableMeta.rowData[5]).toFixed(1)} value={Number(tableMeta.rowData[5]).toFixed(1)}
/> />
...@@ -206,9 +204,8 @@ export default class TableSummaryTriputra extends Component { ...@@ -206,9 +204,8 @@ export default class TableSummaryTriputra extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
suffix={'%'}
disabled={true} disabled={true}
value={Number(tableMeta.rowData[6]).toFixed(2)} value={Number(tableMeta.rowData[6]).toFixed(1)}
/> />
} }
/> />
...@@ -269,7 +266,7 @@ export default class TableSummaryTriputra extends Component { ...@@ -269,7 +266,7 @@ export default class TableSummaryTriputra extends Component {
placeholder="" placeholder=""
suffix={'%'} suffix={'%'}
disabled={true} disabled={true}
value={Number(tableMeta.rowData[9]).toFixed(2)} value={Number(tableMeta.rowData[9]).toFixed(1)}
/> />
} }
/> />
...@@ -1041,26 +1038,6 @@ export default class TableSummaryTriputra extends Component { ...@@ -1041,26 +1038,6 @@ export default class TableSummaryTriputra extends Component {
options: { options: {
display: false display: false
} }
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
} }
] ]
......
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