Commit bce6e759 authored by rifkaki's avatar rifkaki

ytd

parent cba56b9c
...@@ -264,6 +264,7 @@ const create = (type = "") => { ...@@ -264,6 +264,7 @@ const create = (type = "") => {
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)
const getReportBSSuma = (body) => api.post('/transaction/summary_balance_sheet/summary/get_report_hierarki', body) const getReportBSSuma = (body) => api.post('/transaction/summary_balance_sheet/summary/get_report_hierarki', body)
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 getHierarkiReportHistorical = (body) => api.post('/transaction/historical/get_historical_hierarki', body) const getHierarkiReportHistorical = (body) => api.post('/transaction/historical/get_historical_hierarki', body)
//CASH FLOW //CASH FLOW
...@@ -637,6 +638,7 @@ const create = (type = "") => { ...@@ -637,6 +638,7 @@ const create = (type = "") => {
createReportPLMB, createReportPLMB,
createReportPLMR, createReportPLMR,
getPLID, getPLID,
getHierarkiReportYtd,
getHierarkiReportHistorical getHierarkiReportHistorical
} }
} }
......
...@@ -263,13 +263,11 @@ export default class SummaryOfTriputra extends Component { ...@@ -263,13 +263,11 @@ export default class SummaryOfTriputra extends Component {
} }
getDataTable() { getDataTable() {
// let payload = { let payload = {
// "report_id": this.state.report.value, "report_type":1,
// "revision": this.state.lastRevision, "periode":"2021",
// "periode": this.state.periode.periode, "months":1
// "company_id": this.state.company.company_id, }
// "submission_id": this.state.submissionID
// }
let newPayload = { let newPayload = {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"report_type":"historical" "report_type":"historical"
...@@ -359,92 +357,133 @@ export default class SummaryOfTriputra extends Component { ...@@ -359,92 +357,133 @@ export default class SummaryOfTriputra extends Component {
// } // }
// }) // })
} else if (this.state.report.value === 2) { } else if (this.state.report.value === 2) {
// api.create().getDetailReportMB(payload).then(response => { api.create().getHierarkiReportYtd(payload).then(response => {
// console.log(payload); console.log(payload);
// console.log(response); console.log(response);
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 = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
// if (indexIDzz === -1) { if (indexIDzz === -1) {
// dataTable.push([ dataTable.push([
// item.type_report_id, item.company_id,
// item.id, item.parent,
// item.parent, item.level,
// item.formula, item.company_name,
// item.level, item.revenue_ytd_act,
// item.description, item.revenue_ytd_mb,
// item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before, item.revenue_ytd_percent_of_mb,
// Number(item.balance_sheet.january).toFixed(1), item.revenue_ytd_last_year,
// Number(item.balance_sheet.february).toFixed(1), item.revenue_ytd_percent_of_last_year,
// Number(item.balance_sheet.march).toFixed(1), item.revenue_fy_ol,
// Number(item.balance_sheet.april).toFixed(1), item.revenue_fy_mb,
// Number(item.balance_sheet.may).toFixed(1), item.revenue_fy_percent_of_mb,
// Number(item.balance_sheet.june).toFixed(1), item.revenue_fy_last_year,
// Number(item.balance_sheet.july).toFixed(1), item.revenue_fy_percent_of_last_year,
// Number(item.balance_sheet.august).toFixed(1), item.ebitda_ytd_act,
// Number(item.balance_sheet.september).toFixed(1), item.ebitda_ytd_mb,
// Number(item.balance_sheet.october).toFixed(1), item.ebitda_ytd_percent_of_mb,
// Number(item.balance_sheet.november).toFixed(1), item.ebitda_ytd_last_year,
// Number(item.balance_sheet.december).toFixed(1), item.ebitda_ytd_percent_of_last_year,
// Number(item.balance_sheet.total_current_year).toFixed(1), item.ebitda_fy_ol,
// Number(item.balance_sheet.total_next_year).toFixed(1), item.ebitda_fy_mb,
// Number(item.balance_sheet.total_more_year).toFixed(1), item.ebitda_fy_percent_of_mb,
// item.order, item.ebitda_fy_last_year,
// item.condition_it_should_be, item.ebitda_fy_percent_of_last_year,
// item.condition_if_wrong item.tpat_ytd_act,
// ]) item.tpat_ytd_mb,
// } item.tpat_ytd_percent_of_mb,
// if (item.children !== null) { item.tpat_ytd_last_year,
// if (item.children.length > 0) { item.tpat_ytd_percent_of_last_year,
// item.children.map((items, indexs) => { item.tpat_fy_ol,
// handlePushChild(items) item.tpat_fy_mb,
// }) item.tpat_fy_percent_of_mb,
// } item.tpat_fy_last_year,
// } item.tpat_fy_percent_of_last_year,
// } item.npat_ytd_act,
// res.map((item, index) => { item.npat_ytd_mb,
// dataTable.push([ item.npat_ytd_percent_of_mb,
// item.type_report_id, item.npat_ytd_last_year,
// item.id, item.npat_ytd_percent_of_last_year,
// item.parent, item.npat_fy_ol,
// item.formula, item.npat_fy_mb,
// item.level, item.npat_fy_percent_of_mb,
// item.description, item.npat_fy_last_year,
// item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before, item.npat_fy_percent_of_last_year,
// Number(item.balance_sheet.january).toFixed(1), item.order,
// Number(item.balance_sheet.february).toFixed(1), ])
// Number(item.balance_sheet.march).toFixed(1), }
// Number(item.balance_sheet.april).toFixed(1), if (item.children !== null) {
// Number(item.balance_sheet.may).toFixed(1), if (item.children.length > 0) {
// Number(item.balance_sheet.june).toFixed(1), item.children.map((items, indexs) => {
// Number(item.balance_sheet.july).toFixed(1), handlePushChild(items)
// 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), res.map((item, index) => {
// Number(item.balance_sheet.total_current_year).toFixed(1), dataTable.push([
// Number(item.balance_sheet.total_next_year).toFixed(1), item.company_id,
// Number(item.balance_sheet.total_more_year).toFixed(1), item.parent,
// item.order, item.level,
// item.condition_it_should_be, item.company_name,
// item.condition_if_wrong item.revenue_ytd_act,
// ]) item.revenue_ytd_mb,
// if (item.children !== null) { item.revenue_ytd_percent_of_mb,
// if (item.children.length > 0) { item.revenue_ytd_last_year,
// item.children.map((items, indexs) => { item.revenue_ytd_percent_of_last_year,
// handlePushChild(items) item.revenue_fy_ol,
// }) item.revenue_fy_mb,
// } item.revenue_fy_percent_of_mb,
// } item.revenue_fy_last_year,
// }) item.revenue_fy_percent_of_last_year,
item.ebitda_ytd_act,
item.ebitda_ytd_mb,
item.ebitda_ytd_percent_of_mb,
item.ebitda_ytd_last_year,
item.ebitda_ytd_percent_of_last_year,
item.ebitda_fy_ol,
item.ebitda_fy_mb,
item.ebitda_fy_percent_of_mb,
item.ebitda_fy_last_year,
item.ebitda_fy_percent_of_last_year,
item.tpat_ytd_act,
item.tpat_ytd_mb,
item.tpat_ytd_percent_of_mb,
item.tpat_ytd_last_year,
item.tpat_ytd_percent_of_last_year,
item.tpat_fy_ol,
item.tpat_fy_mb,
item.tpat_fy_percent_of_mb,
item.tpat_fy_last_year,
item.tpat_fy_percent_of_last_year,
item.npat_ytd_act,
item.npat_ytd_mb,
item.npat_ytd_percent_of_mb,
item.npat_ytd_last_year,
item.npat_ytd_percent_of_last_year,
item.npat_fy_ol,
item.npat_fy_mb,
item.npat_fy_percent_of_mb,
item.npat_fy_last_year,
item.npat_fy_percent_of_last_year,
item.order,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
console.log(dataTable)
this.setState({ dataTable, 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 })
// } }
// }) })
} else if (this.state.report.value === 3) { } else if (this.state.report.value === 3) {
// api.create().getReportHierarkiPL(payload).then(response => { // api.create().getReportHierarkiPL(payload).then(response => {
// // console.log(response); // // console.log(response);
......
...@@ -411,6 +411,24 @@ export default class TableSummaryTriputra extends Component { ...@@ -411,6 +411,24 @@ export default class TableSummaryTriputra extends Component {
] ]
const columnYTD = [ const columnYTD = [
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{ {
name: "Company", name: "Company",
options: { options: {
...@@ -423,7 +441,14 @@ export default class TableSummaryTriputra extends Component { ...@@ -423,7 +441,14 @@ export default class TableSummaryTriputra extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{ val } {
tableMeta.rowData[2] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[2]) }}>
<span style={{ fontSize: 12 }}>{val}</span>
</div>
}
</div> </div>
) )
} }
...@@ -495,11 +520,37 @@ export default class TableSummaryTriputra extends Component { ...@@ -495,11 +520,37 @@ export default class TableSummaryTriputra extends Component {
<div> <div>
<div style={{ display: 'flex', justifyContent: 'space-between'}}> <div style={{ display: 'flex', justifyContent: 'space-between'}}>
<div style={{ display: 'flex', width: 640, justifyContent: 'space-between'}}> <div style={{ display: 'flex', width: 640, justifyContent: 'space-between'}}>
<div style={{ textAlign: 'right', width: '20%' }}> <div style={{ flex: 1 }}>
111 <FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[4]).toFixed(1)}
/>
}
/>
</div> </div>
<div style={{ textAlign: 'right', width: '20%' }}> <div style={{ flex: 1}}>
112 <FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[5]).toFixed(1)}
/>
}
/>
</div> </div>
<div style={{ textAlign: 'right', width: '20%' }}> <div style={{ textAlign: 'right', width: '20%' }}>
113 113
...@@ -2297,7 +2348,7 @@ export default class TableSummaryTriputra extends Component { ...@@ -2297,7 +2348,7 @@ export default class TableSummaryTriputra extends Component {
<div style={{ padding: '0px 20px 20px 20px', width: this.props.width - (this.props.open === true ? 350 : 100) }}> <div style={{ padding: '0px 20px 20px 20px', width: this.props.width - (this.props.open === true ? 350 : 100) }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={this.props.type === 4 ? datasHistorical : this.props.type === 1 ? datasMTD : this.props.type === 2 ? datasYTD : this.props.type === 3 ? datas : datas} data={this.props.type === 4 ? datasHistorical : this.props.type === 1 ? datasMTD : this.props.type === 2 ? dataTable2 : this.props.type === 3 ? datas : datas}
columns={this.props.type === 1 ? columnMTD : this.props.type === 2 ? columnYTD : this.props.type === 3 ? columnCPSM : this.props.type === 4 ? columnHistorical : columns} columns={this.props.type === 1 ? columnMTD : this.props.type === 2 ? columnYTD : this.props.type === 3 ? columnCPSM : this.props.type === 4 ? columnHistorical : columns}
options={options} options={options}
/> />
......
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