Commit 1f8a16da authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

mtd

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