Commit 55e15ff7 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

update dasbor fin + rapihin save pl cf

See merge request !1220
parents 50e82422 d96d53d7
...@@ -671,7 +671,7 @@ export default class BudgetTahunan extends Component { ...@@ -671,7 +671,7 @@ export default class BudgetTahunan extends Component {
} }
} }
}) })
// console.log(dataTable) console.log(dataTable)
this.setState({ dbCF: dataTable }, () => { this.setState({ dbCF: dataTable }, () => {
this.olahDataCashFlow(this.state.dbCF, type) this.olahDataCashFlow(this.state.dbCF, type)
}) })
...@@ -929,7 +929,7 @@ export default class BudgetTahunan extends Component { ...@@ -929,7 +929,7 @@ export default class BudgetTahunan extends Component {
} }
}) })
total = R.equals(total, NaN) ? "0.0" : total total = R.equals(total, NaN) ? "0.0" : Number(total).toFixed(1)
return total return total
} }
...@@ -1089,6 +1089,7 @@ export default class BudgetTahunan extends Component { ...@@ -1089,6 +1089,7 @@ export default class BudgetTahunan extends Component {
console.log(this.state.dbCF) console.log(this.state.dbCF)
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
api.create().createReportCF(payload).then((res) => { api.create().createReportCF(payload).then((res) => {
this.setState({loading: false})
console.log(res) console.log(res)
// if (response.data) { // if (response.data) {
// if (response.data.status === "success") { // if (response.data.status === "success") {
...@@ -1220,7 +1221,7 @@ export default class BudgetTahunan extends Component { ...@@ -1220,7 +1221,7 @@ export default class BudgetTahunan extends Component {
this.olahDataPL(this.state.dbPL, type) this.olahDataPL(this.state.dbPL, type)
}) })
} else { } else {
this.setState({ dbPL: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dbPL: [], previewTable: false, previewDownload: false })
} }
......
...@@ -80,7 +80,11 @@ export default class DashboardFinancial extends React.Component { ...@@ -80,7 +80,11 @@ export default class DashboardFinancial extends React.Component {
intervalEBITDA: 0, intervalEBITDA: 0,
data: [], data: [],
defaultMonth: [], defaultMonth: [],
defaultYear: [] defaultYear: [],
revOptions: {},
tpatOptions: {},
ebitdaOptions: {},
totalAssetsOptions: {}
}; };
} }
...@@ -390,7 +394,7 @@ export default class DashboardFinancial extends React.Component { ...@@ -390,7 +394,7 @@ export default class DashboardFinancial extends React.Component {
// newName = `asd \n baba` // newName = `asd \n baba`
// } else { // } else {
let splitName = String(name).split(' ') let splitName = String(name).split(' ')
console.log(splitName) // console.log(splitName)
newName = name newName = name
// } // }
} }
...@@ -424,135 +428,561 @@ export default class DashboardFinancial extends React.Component { ...@@ -424,135 +428,561 @@ export default class DashboardFinancial extends React.Component {
let minEBITDA = response.ebitda.vertical_pointing[1] let minEBITDA = response.ebitda.vertical_pointing[1]
let intervalEBITDA = Number(response.ebitda.interval) let intervalEBITDA = Number(response.ebitda.interval)
if (response.total_assets != undefined) { let companyTA = []
let mbTA = []
let maxTA = 0
let minTA = 0
let intervalTA = 0
if (response.total_asset != undefined) {
intervalTA = Number(response.total_asset.interval)
maxTA = response.total_asset.vertical_pointing[0]
minTA = response.total_asset.vertical_pointing[1]
} }
response.revenue.nodes.map((item, index) => { let respRev = this.state.report.value == 'summary' ? response.revenue.nodes.sort((a, b) => a.index - b.index) : response.revenue.nodes.sort((a, b) => a.company.localeCompare(b.company))
respRev.map((item, index) => {
if (this.state.report.value == 'summary') { if (this.state.report.value == 'summary') {
companyRev.push(item.periode) companyRev.push(item.periode)
mbRev.push(item.value) mbRev.push(Number(item.value))
mrRev.push(item.gp_margin) mrRev.push(Number(item.gp_margin))
} else { } else {
companyRev.push(handleName(item.company)) companyRev.push(handleName(item.company))
mbRev.push(item.value_mb) mbRev.push(Number(item.value_mb))
mrRev.push(item.value_mr) mrRev.push(Number(item.value_mr))
} }
}) })
response.tpat.nodes.map((item, index) => { let revOptions = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
// restore: { show: true },
// saveAsImage: { show: true }
}
},
legend: {
data: ['MB', 'MR', 'Revenue', 'GP Margin']
},
grid: {
bottom: 125,
},
xAxis: [
{
type: 'category',
data: companyRev,
axisPointer: {
type: 'shadow'
},
axisLabel: {
interval: 0,
rotate: 30,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 13,
}
}
}
],
yAxis: this.state.report.value != 'summary' ?
[
{
type: 'value',
name: '(Rp bn)',
min: minRev,
max: maxRev,
interval: intervalRev,
axisLabel: {
formatter: '{value}%',
interval: 0,
// rotate: 10,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
// fontWeight: "bold"
}
}
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: minRev,
max: maxRev,
interval: intervalRev,
axisLabel: {
interval: 0,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
}
}
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%',
interval: 0,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
}
}
}
]
,
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: mbRev
},
{
name: 'MR',
type: 'bar',
data: mrRev
}
] :
[
{
name: 'Revenue',
type: 'bar',
data: mbRev
},
{
name: 'GP Margin',
type: 'line',
yAxisIndex: 1,
data: mrRev
}
]
}
let respTpat = this.state.report.value == 'summary' ? response.tpat.nodes.sort((a, b) => a.index - b.index) : response.tpat.nodes.sort((a, b) => a.company.localeCompare(b.company))
respTpat.map((item, index) => {
if (this.state.report.value == 'summary') { if (this.state.report.value == 'summary') {
companyTPAT.push(item.periode) companyTPAT.push(item.periode)
mbTPAT.push(item.value) mbTPAT.push(Number(item.value))
mrTPAT.push(item.gp_margin) mrTPAT.push(Number(item.gp_margin))
} else { } else {
companyTPAT.push(handleName(item.company)) companyTPAT.push(handleName(item.company))
mbTPAT.push(item.value_mb) mbTPAT.push(Number(item.value_mb))
mrTPAT.push(item.value_mr) mrTPAT.push(Number(item.value_mr))
} }
}) })
response.ebitda.nodes.map((item, index) => { let tpatOptions = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
// restore: { show: true },
// saveAsImage: { show: true }
}
},
legend: {
data: ['MB', 'MR', 'TPAT', 'TPAT Margin']
},
xAxis: [
{
type: 'category',
data: companyTPAT,
axisPointer: {
type: 'shadow'
},
axisLabel: {
interval: 0,
rotate: 30,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 13,
}
}
}
],
yAxis: this.state.report.value != 'summary' ?
[
{
type: 'value',
name: '(Rp bn)',
min: minTPAT,
max: maxTPAT,
interval: intervalTPAT
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: minTPAT,
max: maxTPAT,
interval: intervalTPAT,
axisLabel: {
interval: 0,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
}
}
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%',
interval: 0,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
}
}
}
]
,
grid: {
bottom: 125,
},
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: mbTPAT
},
{
name: 'MR',
type: 'bar',
data: mrTPAT
}
] :
[
{
name: 'TPAT',
type: 'bar',
data: mbTPAT
},
{
name: 'TPAT Margin',
type: 'line',
yAxisIndex: 1,
data: mrTPAT
}
]
}
let respEbit = this.state.report.value == 'summary' ? response.ebitda.nodes.sort((a, b) => a.index - b.index) : response.ebitda.nodes.sort((a, b) => a.company.localeCompare(b.company))
respEbit.map((item, index) => {
if (this.state.report.value == 'summary') { if (this.state.report.value == 'summary') {
companyEBITDA.push(item.periode) companyEBITDA.push(item.periode)
mbEBITDA.push(item.value) mbEBITDA.push(Number(item.value))
mrEBITDA.push(item.gp_margin) mrEBITDA.push(Number(item.gp_margin))
} else { } else {
companyEBITDA.push(handleName(item.company)) companyEBITDA.push(handleName(item.company))
mbEBITDA.push(item.value_mb) mbEBITDA.push(Number(item.value_mb))
mrEBITDA.push(item.value_mr) mrEBITDA.push(Number(item.value_mr))
} }
}) })
if (this.state.report.value == 'summary') { let ebitdaOptions = {
response.revenue.nodes.map((item, index) => { tooltip: {
totalAssets.push({ trigger: 'axis',
"company": item.company, axisPointer: {
"MB": item.value_mb, type: 'cross',
"MBColor": "hsl(212, 64%, 46%)", crossStyle: {
"MR": item.value_mr, color: '#999'
"MRColor": "hsl(212, 78%, 62%)",
})
})
} }
this.setState({ companyRev, mbRev, mrRev, minRev, maxRev, intervalRev, companyTPAT, mbTPAT, mrTPAT, minTPAT, maxTPAT, intervalTPAT, companyEBITDA, mbEBITDA, mrEBITDA, minEBITDA, maxEBITDA, intervalEBITDA }, () => {
console.log(companyTPAT)
this.setState({ loading: false })
})
} }
}) },
toolbox: {
feature: {
// restore: { show: true },
// saveAsImage: { show: true }
} }
},
render() { legend: {
const { data: chartData } = this.state; data: ['MB', 'MR', 'EBITDA', 'EBITDA Margin']
const loadingComponent = ( },
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}> xAxis: [
<PropagateLoader {
// css={override} type: 'category',
size={20} data: companyEBITDA,
color={"#274B80"} axisPointer: {
loading={this.state.loading} type: 'shadow'
/> },
</div> axisLabel: {
); interval: 0,
const CustomTick = tick => { rotate: 30,
const theme = useTheme() textStyle: {
baseline: "top",
return ( color: "#333",
<g transform={`translate(${tick.x},${tick.y + 22})`}> fontSize: 13,
{/* <rect x={-14} y={-6} rx={3} ry={3} width={28} height={24} fill="rgba(0, 0, 0, .05)" />
<rect x={-12} y={-12} rx={2} ry={2} width={24} height={24} fill="rgb(232, 193, 160)" />
<line stroke="rgb(232, 193, 160)" strokeWidth={1.5} y1={-22} y2={-12} /> */}
<text
lengthAdjust
fontSizeAdjust
textAnchor="middle"
dominantBaseline="middle"
style={{
...theme.axis.ticks.text,
fill: '#333',
fontSize: 11,
// textAlign: 'justify',
}}
>
{tick.value}
</text>
</g>
)
} }
return ( }
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} ref={this.myRef}> }
{this.state.loading && loadingComponent} ],
<div> yAxis: this.state.report.value != 'summary' ?
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> [
<Typography style={{ fontSize: '16px', color: 'white' }}>Dashboard Financial</Typography> {
</div> type: 'value',
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> name: '(Rp bn)',
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}> min: minEBITDA,
{this.state.messageAlert} max: maxEBITDA,
</Alert> interval: intervalEBITDA,
</Snackbar> axisLabel: {
<div style={{ padding: 20, width: '100%' }}> interval: 0,
<Paper style={{ paddingTop: 10, minHeight: this.props.height, paddingBottom: 20 }}> textStyle: {
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > baseline: "top",
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>FINANCIAL SUMMARY OF TRIPUTRA GROUP</Typography> color: "#333",
</div> fontSize: 12,
<div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}> }
<div style={{ marginTop: 15 }}> }
<Autocomplete }
options={this.state.listReportType} ] :
getOptionLabel={(option) => titleCase(option.name)} [
id="typereport" {
onChange={(event, newInputValue) => this.setState({ report: newInputValue, loading: true, previewTable: false }, () => { type: 'value',
this.getDashboardFinancial() name: '(Rp bn)',
})} min: minEBITDA,
disableClearable max: maxEBITDA,
style={{ width: 250 }} interval: intervalEBITDA,
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />} axisLabel: {
value={this.state.report} interval: 0,
/> textStyle: {
</div> baseline: "top",
color: "#333",
fontSize: 12,
}
}
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%',
interval: 0,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
}
}
}
]
,
grid: {
bottom: 125,
},
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: mbEBITDA
},
{
name: 'MR',
type: 'bar',
data: mrEBITDA
}
] :
[
{
name: 'EBITDA',
type: 'bar',
data: mbEBITDA
},
{
name: 'EBITDA Margin',
type: 'line',
yAxisIndex: 1,
data: mrEBITDA
}
]
}
if (this.state.report.value == 'summary') {
response.total_asset.nodes.sort((a, b) => a.index - b.index).map((item, index) => {
companyTA.push(item.periode)
mbTA.push(item.value)
})
let totalAssetsOptions = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
// restore: { show: true },
// saveAsImage: { show: true }
}
},
legend: {
data: ['MB']
},
grid: {
bottom: 125,
},
xAxis: [
{
type: 'category',
data: companyTA,
axisPointer: {
type: 'shadow'
},
axisLabel: {
interval: 0,
rotate: 30,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 13,
}
}
}
],
yAxis:
[
{
type: 'value',
name: '(Rp bn)',
min: minTA,
max: maxTA,
interval: intervalTA
}
]
,
series:
[
{
name: 'MB',
type: 'bar',
data: mbTA
}
]
}
this.setState({ totalAssetsOptions })
}
this.setState({ revOptions, tpatOptions, ebitdaOptions }, () => {
setTimeout(() => {
this.setState({ loading: false })
}, 300);
})
}
})
}
render() {
const { data: chartData } = this.state;
const loadingComponent = (
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
const CustomTick = tick => {
const theme = useTheme()
return (
<g transform={`translate(${tick.x},${tick.y + 22})`}>
{/* <rect x={-14} y={-6} rx={3} ry={3} width={28} height={24} fill="rgba(0, 0, 0, .05)" />
<rect x={-12} y={-12} rx={2} ry={2} width={24} height={24} fill="rgb(232, 193, 160)" />
<line stroke="rgb(232, 193, 160)" strokeWidth={1.5} y1={-22} y2={-12} /> */}
<text
lengthAdjust
fontSizeAdjust
textAnchor="middle"
dominantBaseline="middle"
style={{
...theme.axis.ticks.text,
fill: '#333',
fontSize: 11,
// textAlign: 'justify',
}}
>
{tick.value}
</text>
</g>
)
}
return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} ref={this.myRef}>
{/* {this.state.loading && loadingComponent} */}
<div>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Dashboard Financial</Typography>
</div>
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
<Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
{this.state.messageAlert}
</Alert>
</Snackbar>
<div style={{ padding: 20, width: '100%' }}>
<Paper style={{ paddingTop: 10, minHeight: this.props.height, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>FINANCIAL SUMMARY OF TRIPUTRA GROUP</Typography>
</div>
<div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}>
<div style={{ marginTop: 15 }}>
<Autocomplete
options={this.state.listReportType}
getOptionLabel={(option) => titleCase(option.name)}
id="typereport"
onChange={(event, newInputValue) => this.setState({ report: newInputValue, loading: true, previewTable: false }, () => {
this.getDashboardFinancial()
})}
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.report}
/>
</div>
<div style={{ display: 'flex', marginTop: 10 }}> <div style={{ display: 'flex', marginTop: 10 }}>
<Autocomplete <Autocomplete
{...this.state.listMonth} {...this.state.listMonth}
...@@ -672,7 +1102,7 @@ export default class DashboardFinancial extends React.Component { ...@@ -672,7 +1102,7 @@ export default class DashboardFinancial extends React.Component {
} }
}) })
let listMonth2 = monthData2 let listMonth2 = monthData2
this.setState({ month2: listMonth2[0], listMonth2: {...this.state.listMonth2, options: listMonth2} }, () => { this.setState({ month2: listMonth2[0], listMonth2: { ...this.state.listMonth2, options: listMonth2 } }, () => {
this.getDashboardFinancial() this.getDashboardFinancial()
}) })
} else { } else {
...@@ -762,443 +1192,38 @@ export default class DashboardFinancial extends React.Component { ...@@ -762,443 +1192,38 @@ export default class DashboardFinancial extends React.Component {
<div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 25, paddingBottom: 50 }}> <div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 25, paddingBottom: 50 }}>
{this.state.businessUnit != null && <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`Revenue ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? String(this.state.report.value).toLocaleUpperCase() : ''} - ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? titleCase(this.state.businessUnit.business_unit_name) : this.state.company.company_name}`}</Typography>} {this.state.businessUnit != null && <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`Revenue ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? String(this.state.report.value).toLocaleUpperCase() : ''} - ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? titleCase(this.state.businessUnit.business_unit_name) : this.state.company.company_name}`}</Typography>}
{!this.state.loading && <ReactECharts {<ReactECharts
showLoading={this.state.loading}
style={{ height: 500, width: '100%', marginTop: 20 }} style={{ height: 500, width: '100%', marginTop: 20 }}
option={{ option={this.state.revOptions}
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
restore: { show: true },
saveAsImage: { show: true }
}
},
legend: {
data: ['MB', 'MR', 'Revenue', 'GP Margin']
},
xAxis: [
{
type: 'category',
data: this.state.companyRev,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: this.state.report.value != 'summary' ?
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minRev,
max: this.state.maxRev,
interval: this.state.intervalRev
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minRev,
max: this.state.maxRev,
interval: this.state.intervalRev
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%'
}
}
]
,
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: this.state.mbRev
},
{
name: 'MR',
type: 'bar',
data: this.state.mrRev
}
] :
[
{
name: 'Revenue',
type: 'bar',
data: this.state.mbRev
},
{
name: 'GP Margin',
type: 'line',
yAxisIndex: 1,
data: this.state.mrRev
}
]
}}
/>} />}
</div> </div>
<div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 50, paddingBottom: 50 }}> <div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 50, paddingBottom: 50 }}>
{this.state.businessUnit != null && <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`TPAT ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? String(this.state.report.value).toLocaleUpperCase() : ''} - ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? titleCase(this.state.businessUnit.business_unit_name) : this.state.company.company_name}`}</Typography>} {this.state.businessUnit != null && <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`TPAT ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? String(this.state.report.value).toLocaleUpperCase() : ''} - ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? titleCase(this.state.businessUnit.business_unit_name) : this.state.company.company_name}`}</Typography>}
{!this.state.loading && <ReactECharts {<ReactECharts
showLoading={this.state.loading}
style={{ height: 500, width: '100%', marginTop: 20 }} style={{ height: 500, width: '100%', marginTop: 20 }}
option={{ option={this.state.tpatOptions}
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
restore: { show: true },
saveAsImage: { show: true }
}
},
legend: {
data: ['MB', 'MR', 'TPAT', 'TPAT Margin']
},
xAxis: [
{
type: 'category',
data: this.state.companyTPAT,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: this.state.report.value != 'summary' ?
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minTPAT,
max: this.state.maxTPAT,
interval: this.state.intervalTPAT
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minTPAT,
max: this.state.maxTPAT,
interval: this.state.intervalTPAT
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%'
}
}
]
,
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: this.state.mbTPAT
},
{
name: 'MR',
type: 'bar',
data: this.state.mrTPAT
}
] :
[
{
name: 'TPAT',
type: 'bar',
data: this.state.mbTPAT
},
{
name: 'TPAT Margin',
type: 'line',
yAxisIndex: 1,
data: this.state.mrTPAT
}
]
}}
/>} />}
{/* <ReactECharts
style={{height: 500, width: '100%'}}
option={{
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
// dataView: {show: true, readOnly: false},
// magicType: {show: true, type: ['bar']},
restore: {show: true},
saveAsImage: {show: true}
}
},
legend: {
data: ['蒸发量', '降水量', '平均温度']
},
xAxis: [
{
type: 'category',
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '水量',
min: 0,
max: 250,
interval: 50,
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '温度',
min: 0,
max: 25,
interval: 5,
axisLabel: {
formatter: '{value} °C'
}
}
],
series: [
{
name: '蒸发量',
type: 'bar',
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
name: '降水量',
type: 'bar',
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
},
{
name: '平均温度',
type: 'line',
yAxisIndex: 1,
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
]
}}
/> */}
</div> </div>
<div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 50, paddingBottom: 50 }}> <div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 50, paddingBottom: 50 }}>
{this.state.businessUnit != null && <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`EBITDA ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? String(this.state.report.value).toLocaleUpperCase() : ''} - ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? titleCase(this.state.businessUnit.business_unit_name) : this.state.company.company_name}`}</Typography>} {this.state.businessUnit != null && <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`EBITDA ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? String(this.state.report.value).toLocaleUpperCase() : ''} - ${this.state.report.value == 'mtd' || this.state.report.value == 'ytd' ? titleCase(this.state.businessUnit.business_unit_name) : this.state.company.company_name}`}</Typography>}
{!this.state.loading && <ReactECharts {<ReactECharts
lazyUpdate={true}
showLoading={this.state.loading}
style={{ height: 500, width: '100%', marginTop: 20 }} style={{ height: 500, width: '100%', marginTop: 20 }}
option={{ option={this.state.ebitdaOptions}
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
restore: { show: true },
saveAsImage: { show: true }
}
},
legend: {
data: ['MB', 'MR', 'EBITDA', 'EBITDA Margin']
},
xAxis: [
{
type: 'category',
data: this.state.companyEBITDA,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: this.state.report.value != 'summary' ?
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minEBITDA,
max: this.state.maxEBITDA,
interval: this.state.intervalEBITDA
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minEBITDA,
max: this.state.maxEBITDA,
interval: this.state.intervalEBITDA
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%'
}
}
]
,
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: this.state.mbEBITDA
},
{
name: 'MR',
type: 'bar',
data: this.state.mrEBITDA
}
] :
[
{
name: 'EBITDA',
type: 'bar',
data: this.state.mbEBITDA
},
{
name: 'EBITDA Margin',
type: 'line',
yAxisIndex: 1,
data: this.state.mrEBITDA
}
]
}}
/>} />}
</div> </div>
{this.state.report.value == 'summary' && <div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 50, paddingBottom: 50 }}> {this.state.report.value == 'summary' && <div style={{ height: Number(0.6 * this.props.height), border: '1px solid black', marginTop: 50, paddingBottom: 50 }}>
<Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`Total Assets - ${this.state.company.company_name}`}</Typography> <Typography style={{ fontSize: '16px', color: 'black', textAlign: 'center', marginTop: 10, marginBottom: 10 }}>{`Total Assets - ${this.state.company.company_name}`}</Typography>
{!this.state.loading && <ReactECharts {<ReactECharts
style={{ height: 500, width: '100%', marginTop: 20 }} style={{ height: 500, width: '100%', marginTop: 20 }}
option={{ showLoading={this.state.loading}
tooltip: { option={this.state.totalAssetsOptions}
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
restore: { show: true },
saveAsImage: { show: true }
}
},
legend: {
data: ['MB', 'MR', 'EBITDA', 'EBITDA Margin']
},
xAxis: [
{
type: 'category',
data: this.state.companyEBITDA,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: this.state.report.value != 'summary' ?
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minEBITDA,
max: this.state.maxEBITDA,
interval: this.state.intervalEBITDA
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: this.state.minEBITDA,
max: this.state.maxEBITDA,
interval: this.state.intervalEBITDA
},
{
type: 'value',
name: '(%)',
min: 0,
max: 100,
interval: 20,
axisLabel: {
formatter: '{value}%'
}
}
]
,
series: this.state.report.value != 'summary' ?
[
{
name: 'MB',
type: 'bar',
data: this.state.mbEBITDA
},
{
name: 'MR',
type: 'bar',
data: this.state.mrEBITDA
}
] :
[
{
name: 'EBITDA',
type: 'bar',
data: this.state.mbEBITDA
},
{
name: 'EBITDA Margin',
type: 'line',
yAxisIndex: 1,
data: this.state.mrEBITDA
}
]
}}
/>} />}
</div>} </div>}
</div> </div>
......
...@@ -119,9 +119,9 @@ export default class MonthlyReport extends Component { ...@@ -119,9 +119,9 @@ export default class MonthlyReport extends Component {
if (this.props.location.state !== undefined) { if (this.props.location.state !== undefined) {
console.log(this.props); console.log(this.props);
if (this.props.location.state.month != null || this.props.location.state.month != undefined) { if (this.props.location.state.month != null || this.props.location.state.month != undefined) {
this.setState({monthHome: this.props.location.state.month}) this.setState({ monthHome: this.props.location.state.month })
} }
this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData}, () => { this.setState({ userType: this.props.location.state.userType, intent: 'Home', lastPeriod: this.props.location.state.rawData.periode, rawData: this.props.location.state.rawData }, () => {
this.getPermission() this.getPermission()
}) })
} else { } else {
...@@ -135,19 +135,19 @@ export default class MonthlyReport extends Component { ...@@ -135,19 +135,19 @@ export default class MonthlyReport extends Component {
getChecApprover() { getChecApprover() {
let listStatus1 = [ let listStatus1 = [
{name: 'Open', value: 'not-yet'}, { name: 'Open', value: 'not-yet' },
{name: 'Submitted', value: 'approval_review'}, { name: 'Submitted', value: 'approval_review' },
{name: 'Waiting for Review / Approval', value: 'approval_proccess'}, { name: 'Waiting for Review / Approval', value: 'approval_proccess' },
// {name: 'Waiting for Approval', value: 'approval_proccess'}, // {name: 'Waiting for Approval', value: 'approval_proccess'},
// {name: 'Revision', value: 'revision'}, // {name: 'Revision', value: 'revision'},
{name: 'Approved', value: 'approved'}, { name: 'Approved', value: 'approved' },
] ]
let listStatus2 = [ let listStatus2 = [
{name: 'Open', value: 'not-yet'}, { name: 'Open', value: 'not-yet' },
{name: 'Submitted', value: 'approval_review'}, { name: 'Submitted', value: 'approval_review' },
// {name: 'Revision', value: 'revision'}, // {name: 'Revision', value: 'revision'},
{name: 'Approved', value: 'approved'}, { name: 'Approved', value: 'approved' },
] ]
api.create().checkApproverMonthly().then(response => { api.create().checkApproverMonthly().then(response => {
...@@ -155,8 +155,7 @@ export default class MonthlyReport extends Component { ...@@ -155,8 +155,7 @@ export default class MonthlyReport extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true, still_approver: true, approverTrue: true, listStatus: listStatus1, selectedStatus: listStatus1}, () => this.setState({ isApprover: true, checkApprover: true, still_approver: true, approverTrue: true, listStatus: listStatus1, selectedStatus: listStatus1 }, () => {
{
// if (this.state.submittedOnly) { // if (this.state.submittedOnly) {
this.getMonth() this.getMonth()
// } else { // } else {
...@@ -164,7 +163,7 @@ export default class MonthlyReport extends Component { ...@@ -164,7 +163,7 @@ export default class MonthlyReport extends Component {
// } // }
}) })
} else { } else {
this.setState({ isApprover: false, checkApprover: false, still_approver: false, approverTrue: false, listStatus: listStatus2, selectedStatus: listStatus2}, () => this.setState({ isApprover: false, checkApprover: false, still_approver: false, approverTrue: false, listStatus: listStatus2, selectedStatus: listStatus2 }, () =>
this.getMonth()) this.getMonth())
// this.getCompanyActive()) // this.getCompanyActive())
} }
...@@ -226,13 +225,13 @@ export default class MonthlyReport extends Component { ...@@ -226,13 +225,13 @@ export default class MonthlyReport extends Component {
let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C') let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C')
let status_approv = '' let status_approv = ''
if (String(item.current_status).toLocaleUpperCase().includes('CC')) { if (String(item.current_status).toLocaleUpperCase().includes('CC')) {
status_approv = `${String(item.current_status).substr(0,indexC)}${String(item.current_status).substr(indexC+1,String(item.current_status).length)}` status_approv = `${String(item.current_status).substr(0, indexC)}${String(item.current_status).substr(indexC + 1, String(item.current_status).length)}`
} else { } else {
status_approv = String(item.current_status) status_approv = String(item.current_status)
} }
return [ return [
item.number, item.number,
item.report_name == "CAT"? "Corporate Annual Target" : item.report_name, item.report_name == "CAT" ? "Corporate Annual Target" : item.report_name,
item.revision, item.revision,
this.state.isApprovedMB ? (this.state.lastStatus === 'APPROVED' ? 'CLOSED' : this.state.isSubmit === false ? "CLOSED" : status_approv) : "CLOSED", this.state.isApprovedMB ? (this.state.lastStatus === 'APPROVED' ? 'CLOSED' : this.state.isSubmit === false ? "CLOSED" : status_approv) : "CLOSED",
item.report_id, item.report_id,
...@@ -253,7 +252,7 @@ export default class MonthlyReport extends Component { ...@@ -253,7 +252,7 @@ export default class MonthlyReport extends Component {
} }
}) })
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable, loading: false, dataTableRevision: dataTableRevision.sort((a, b) => a.number - b.number), dataForRevision: response.data.data }) this.setState({ dataTable, dataTableRevision: dataTableRevision.sort((a, b) => a.number - b.number), dataForRevision: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -285,7 +284,7 @@ export default class MonthlyReport extends Component { ...@@ -285,7 +284,7 @@ export default class MonthlyReport extends Component {
options: companyData, options: companyData,
getOptionLabel: (option) => titleCase(option.company_name), getOptionLabel: (option) => titleCase(option.company_name),
}; };
this.setState({ listCompany: defaultProps, company: companyData[0], company_active: defaultProps}, () => { this.setState({ listCompany: defaultProps, company: companyData[0], company_active: defaultProps }, () => {
this.getMonth() this.getMonth()
// console.log(this.state.company_active) // console.log(this.state.company_active)
}) })
...@@ -332,7 +331,7 @@ export default class MonthlyReport extends Component { ...@@ -332,7 +331,7 @@ export default class MonthlyReport extends Component {
indexMonthHome = monthData.findIndex((val) => val.month_id == this.state.monthHome.month_id) indexMonthHome = monthData.findIndex((val) => val.month_id == this.state.monthHome.month_id)
} }
console.log(indexMonthHome) console.log(indexMonthHome)
this.setState({ listMonth: defaultProps, month: indexMonthHome == -1? (index == -1 ? monthData[0] : monthData[index]) : monthData[indexMonthHome] }, () => { this.setState({ listMonth: defaultProps, month: indexMonthHome == -1 ? (index == -1 ? monthData[0] : monthData[index]) : monthData[indexMonthHome] }, () => {
// if (this.state.isApprover === true) { // if (this.state.isApprover === true) {
// if (this.state.submittedOnly) { // if (this.state.submittedOnly) {
// console.log('masuk cuk') // console.log('masuk cuk')
...@@ -492,7 +491,7 @@ export default class MonthlyReport extends Component { ...@@ -492,7 +491,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id, "months": this.state.month.month_id,
"status": selectedStatus "status": selectedStatus
} }
this.setState({isApprovedMB: true}) this.setState({ isApprovedMB: true })
api.create().getCompanySubmittedMonthly(body).then(response => { api.create().getCompanySubmittedMonthly(body).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -515,7 +514,7 @@ export default class MonthlyReport extends Component { ...@@ -515,7 +514,7 @@ export default class MonthlyReport extends Component {
}) })
if (arrayBaru.length > 0) { if (arrayBaru.length > 0) {
arrayBaru = arrayBaru.sort((a,b) => a.company_name.localeCompare(b.company_name)) arrayBaru = arrayBaru.sort((a, b) => a.company_name.localeCompare(b.company_name))
} }
let defaultProps = { let defaultProps = {
options: arrayBaru, options: arrayBaru,
...@@ -607,7 +606,7 @@ export default class MonthlyReport extends Component { ...@@ -607,7 +606,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id, "months": this.state.month.month_id,
"is_approver": this.state.isApprover "is_approver": this.state.isApprover
} }
this.setState({visibleTableHistory: false}) this.setState({ visibleTableHistory: false })
api.create().getMonthlyReportID(payload).then(response => { api.create().getMonthlyReportID(payload).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -625,8 +624,13 @@ export default class MonthlyReport extends Component { ...@@ -625,8 +624,13 @@ export default class MonthlyReport extends Component {
// // console.log(this.state.lastStatus); // // console.log(this.state.lastStatus);
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (type != undefined) {
this.getCashFlow(type) this.getCashFlow(type)
this.getPL(type) this.getPL(type)
} else {
this.setState({ loading: false })
}
// this.getFR(type) // this.getFR(type)
// this.getReport() // this.getReport()
// this.getReportAttachment() // this.getReportAttachment()
...@@ -634,7 +638,7 @@ export default class MonthlyReport extends Component { ...@@ -634,7 +638,7 @@ export default class MonthlyReport extends Component {
console.log(response) console.log(response)
if (this.state.btnCreate === true && this.state.btnEdit === true) { if (this.state.btnCreate === true && this.state.btnEdit === true) {
console.log('editable'); console.log('editable');
this.setState({ isApprover: this.state.approverTrue? true : false, checkApprover: this.state.approverTrue? true : false }) this.setState({ isApprover: this.state.approverTrue ? true : false, checkApprover: this.state.approverTrue ? true : false })
} else { } else {
console.log('just view'); console.log('just view');
this.setState({ isApprover: true, checkApprover: true }) this.setState({ isApprover: true, checkApprover: true })
...@@ -661,7 +665,7 @@ export default class MonthlyReport extends Component { ...@@ -661,7 +665,7 @@ export default class MonthlyReport extends Component {
let body = { let body = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"months" : this.state.month.month_id "months": this.state.month.month_id
} }
api.create().getSubmitMonthlyReport(body).then(response => { api.create().getSubmitMonthlyReport(body).then(response => {
console.log(response); console.log(response);
...@@ -690,7 +694,7 @@ export default class MonthlyReport extends Component { ...@@ -690,7 +694,7 @@ export default class MonthlyReport extends Component {
let indexC = String(item.status_approval).toLocaleUpperCase().indexOf('C') let indexC = String(item.status_approval).toLocaleUpperCase().indexOf('C')
let status_approv = '' let status_approv = ''
if (String(item.status_approval).toLocaleUpperCase().includes('CC')) { if (String(item.status_approval).toLocaleUpperCase().includes('CC')) {
status_approv = `${String(item.status_approval).substr(0,indexC)}${String(item.status_approval).substr(indexC+1,String(item.status_approval).length)}` status_approv = `${String(item.status_approval).substr(0, indexC)}${String(item.status_approval).substr(indexC + 1, String(item.status_approval).length)}`
} else { } else {
status_approv = String(item.status_approval) status_approv = String(item.status_approval)
} }
...@@ -744,7 +748,7 @@ export default class MonthlyReport extends Component { ...@@ -744,7 +748,7 @@ export default class MonthlyReport extends Component {
this.setState({ prevRevision: false }) this.setState({ prevRevision: false })
} }
} }
if (String(i.report_name).toLocaleLowerCase() == "profit loss" || String(i.report_name).toLocaleLowerCase() == "balance sheet" || String(i.report_name).toLocaleLowerCase() == "fixed assets movement" ) { if (String(i.report_name).toLocaleLowerCase() == "profit loss" || String(i.report_name).toLocaleLowerCase() == "balance sheet" || String(i.report_name).toLocaleLowerCase() == "fixed assets movement") {
if (String(i.current_status).toLocaleLowerCase() == "submitted") { if (String(i.current_status).toLocaleLowerCase() == "submitted") {
PLBSFAMSubmitted += 1 PLBSFAMSubmitted += 1
} }
...@@ -851,7 +855,7 @@ export default class MonthlyReport extends Component { ...@@ -851,7 +855,7 @@ export default class MonthlyReport extends Component {
visibleLOCF: false, visibleLOCF: false,
visibleOI: false, visibleOI: false,
visibleCF: true, visibleCF: true,
PLBSFAMSubmitted: PLBSFAMSubmitted == 3? true : false PLBSFAMSubmitted: PLBSFAMSubmitted == 3 ? true : false
}) })
} }
}) })
...@@ -1160,7 +1164,7 @@ export default class MonthlyReport extends Component { ...@@ -1160,7 +1164,7 @@ export default class MonthlyReport extends Component {
// console.log(valuezz); // console.log(valuezz);
} }
} else { } else {
let data = dbCF[indexS][6].formula == null? [] : dbCF[indexS][6].formula let data = dbCF[indexS][6].formula == null ? [] : dbCF[indexS][6].formula
// console.log(data) // console.log(data)
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`)) let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) { if (indexID !== -1) {
...@@ -1184,7 +1188,7 @@ export default class MonthlyReport extends Component { ...@@ -1184,7 +1188,7 @@ export default class MonthlyReport extends Component {
if (item == '-' || item == '+' || item == '/' || item == '*') { if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item opet = item
} else { } else {
anjay.push(opet == ''? Number(item) : Number(String(opet + String(item)))) anjay.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false tambahan = false
opet = "" opet = ""
} }
...@@ -1330,37 +1334,37 @@ export default class MonthlyReport extends Component { ...@@ -1330,37 +1334,37 @@ export default class MonthlyReport extends Component {
} }
olahDataCashFlow(dbCF, type) { olahDataCashFlow(dbCF, type) {
dbCF.map((item,index) => { dbCF.map((item, index) => {
if(item[0] == 5 || item[0] == 6) { if (item[0] == 5 || item[0] == 6) {
item[6].value = this.handleValueFormula(item,index) item[6].value = this.handleValueFormula(item, index)
} }
}) })
console.log(dbCF) console.log(dbCF)
this.setState({dbCF}, () => { this.setState({ dbCF }, () => {
this.payloadCF(type) this.payloadCF(type)
}) })
} }
payloadCF(type) { payloadCF(type) {
let listCF = [] let listCF = []
this.state.dbCF.map((item,index) => { this.state.dbCF.map((item, index) => {
if (item[6].value == "" || item[6].value == 0 || item[6].value == "0.0") { if (item[6].value == "" || item[6].value == 0 || item[6].value == "0.0") {
item[6].value = this.handleValueFormula(item,index) item[6].value = this.handleValueFormula(item, index)
listCF.push({ listCF.push({
"item_report_id": item[1], "item_report_id": item[1],
"actual": item[0] == 1? "" : Number(item[6].value).toFixed(1) "actual": item[0] == 1 ? "" : Number(item[6].value).toFixed(1)
}) })
} else { } else {
listCF.push({ listCF.push({
"item_report_id": item[1], "item_report_id": item[1],
"actual": item[0] == 1? "" : Number(item[6].value).toFixed(1) "actual": item[0] == 1 ? "" : Number(item[6].value).toFixed(1)
}) })
} }
}) })
// console.log(listCF) // console.log(listCF)
this.setState({dbCF: listCF} , () => { this.setState({ dbCF: listCF }, () => {
// if (type != undefined) { // if (type != undefined) {
// if (type == 'BS' || type == 'FAM' || type == 'PL') { // if (type == 'BS' || type == 'FAM' || type == 'PL') {
console.log('tarik sis') console.log('tarik sis')
...@@ -1443,27 +1447,27 @@ export default class MonthlyReport extends Component { ...@@ -1443,27 +1447,27 @@ export default class MonthlyReport extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
this.state.month.month_id == 1? this.state.month.month_id == 1 ?
{ value: item.profit_detail.january, formula: item.profit_detail.january_formula } : { value: item.profit_detail.january, formula: item.profit_detail.january_formula } :
this.state.month.month_id == 2? this.state.month.month_id == 2 ?
{ value: item.profit_detail.february, formula: item.profit_detail.february_formula } : { value: item.profit_detail.february, formula: item.profit_detail.february_formula } :
this.state.month.month_id == 3? this.state.month.month_id == 3 ?
{ value: item.profit_detail.march, formula: item.profit_detail.march_formula } : { value: item.profit_detail.march, formula: item.profit_detail.march_formula } :
this.state.month.month_id == 4? this.state.month.month_id == 4 ?
{ value: item.profit_detail.april, formula: item.profit_detail.april_formula } : { value: item.profit_detail.april, formula: item.profit_detail.april_formula } :
this.state.month.month_id == 5? this.state.month.month_id == 5 ?
{ value: item.profit_detail.may, formula: item.profit_detail.may_formula } : { value: item.profit_detail.may, formula: item.profit_detail.may_formula } :
this.state.month.month_id == 6? this.state.month.month_id == 6 ?
{ value: item.profit_detail.june, formula: item.profit_detail.june_formula } : { value: item.profit_detail.june, formula: item.profit_detail.june_formula } :
this.state.month.month_id == 7? this.state.month.month_id == 7 ?
{ value: item.profit_detail.july, formula: item.profit_detail.july_formula } : { value: item.profit_detail.july, formula: item.profit_detail.july_formula } :
this.state.month.month_id == 8? this.state.month.month_id == 8 ?
{ value: item.profit_detail.august, formula: item.profit_detail.august_formula } : { value: item.profit_detail.august, formula: item.profit_detail.august_formula } :
this.state.month.month_id == 9? this.state.month.month_id == 9 ?
{ value: item.profit_detail.september, formula: item.profit_detail.september_formula } : { value: item.profit_detail.september, formula: item.profit_detail.september_formula } :
this.state.month.month_id == 10? this.state.month.month_id == 10 ?
{ value: item.profit_detail.october, formula: item.profit_detail.october_formula } : { value: item.profit_detail.october, formula: item.profit_detail.october_formula } :
this.state.month.month_id == 11? this.state.month.month_id == 11 ?
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } : { value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula }, { value: item.profit_detail.december, formula: item.profit_detail.december_formula },
item.order, item.order,
...@@ -1486,27 +1490,27 @@ export default class MonthlyReport extends Component { ...@@ -1486,27 +1490,27 @@ export default class MonthlyReport extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
this.state.month.month_id == 1? this.state.month.month_id == 1 ?
{ value: item.profit_detail.january, formula: item.profit_detail.january_formula } : { value: item.profit_detail.january, formula: item.profit_detail.january_formula } :
this.state.month.month_id == 2? this.state.month.month_id == 2 ?
{ value: item.profit_detail.february, formula: item.profit_detail.february_formula } : { value: item.profit_detail.february, formula: item.profit_detail.february_formula } :
this.state.month.month_id == 3? this.state.month.month_id == 3 ?
{ value: item.profit_detail.march, formula: item.profit_detail.march_formula } : { value: item.profit_detail.march, formula: item.profit_detail.march_formula } :
this.state.month.month_id == 4? this.state.month.month_id == 4 ?
{ value: item.profit_detail.april, formula: item.profit_detail.april_formula } : { value: item.profit_detail.april, formula: item.profit_detail.april_formula } :
this.state.month.month_id == 5? this.state.month.month_id == 5 ?
{ value: item.profit_detail.may, formula: item.profit_detail.may_formula } : { value: item.profit_detail.may, formula: item.profit_detail.may_formula } :
this.state.month.month_id == 6? this.state.month.month_id == 6 ?
{ value: item.profit_detail.june, formula: item.profit_detail.june_formula } : { value: item.profit_detail.june, formula: item.profit_detail.june_formula } :
this.state.month.month_id == 7? this.state.month.month_id == 7 ?
{ value: item.profit_detail.july, formula: item.profit_detail.july_formula } : { value: item.profit_detail.july, formula: item.profit_detail.july_formula } :
this.state.month.month_id == 8? this.state.month.month_id == 8 ?
{ value: item.profit_detail.august, formula: item.profit_detail.august_formula } : { value: item.profit_detail.august, formula: item.profit_detail.august_formula } :
this.state.month.month_id == 9? this.state.month.month_id == 9 ?
{ value: item.profit_detail.september, formula: item.profit_detail.september_formula } : { value: item.profit_detail.september, formula: item.profit_detail.september_formula } :
this.state.month.month_id == 10? this.state.month.month_id == 10 ?
{ value: item.profit_detail.october, formula: item.profit_detail.october_formula } : { value: item.profit_detail.october, formula: item.profit_detail.october_formula } :
this.state.month.month_id == 11? this.state.month.month_id == 11 ?
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } : { value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula }, { value: item.profit_detail.december, formula: item.profit_detail.december_formula },
item.order, item.order,
...@@ -1752,31 +1756,31 @@ export default class MonthlyReport extends Component { ...@@ -1752,31 +1756,31 @@ export default class MonthlyReport extends Component {
} }
olahDataPL(dbPL, type) { olahDataPL(dbPL, type) {
dbPL.map((item,index) => { dbPL.map((item, index) => {
if(item[0] == 5 || item[0] == 6 ) { if (item[0] == 5 || item[0] == 6) {
item[6].value = this.handleValueFormulaDBPLMR(item[6],item,6) item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
} }
}) })
// console.log(dbPL) // console.log(dbPL)
this.setState({dbPL}, () => { this.setState({ dbPL }, () => {
this.payloadPL(type) this.payloadPL(type)
}) })
} }
payloadPL(type) { payloadPL(type) {
let listPL = [] let listPL = []
this.state.dbPL.map((item,index) => { this.state.dbPL.map((item, index) => {
if (item[6].value == "" || item[6].value == 0 || item[6].value == "0.0") { if (item[6].value == "" || item[6].value == 0 || item[6].value == "0.0") {
item[6].value = this.handleValueFormulaDBPLMR(item[6],item,6) item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
listPL.push({ listPL.push({
"item_report_id": item[1], "item_report_id": item[1],
"actual": item[0] == 1? "" : Number(item[6].value).toFixed(1), "actual": item[0] == 1 ? "" : Number(item[6].value).toFixed(1),
"notes": item[8] "notes": item[8]
}) })
} else { } else {
listPL.push({ listPL.push({
"item_report_id": item[1], "item_report_id": item[1],
"actual": item[0] == 1? "" : Number(item[6].value).toFixed(1), "actual": item[0] == 1 ? "" : Number(item[6].value).toFixed(1),
"notes": item[8] "notes": item[8]
}) })
} }
...@@ -1784,7 +1788,7 @@ export default class MonthlyReport extends Component { ...@@ -1784,7 +1788,7 @@ export default class MonthlyReport extends Component {
}) })
console.log(listPL) console.log(listPL)
this.setState({dbPL: listPL} , () => { this.setState({ dbPL: listPL }, () => {
// if (type != undefined) { // if (type != undefined) {
// if ( type == 'PL') { // if ( type == 'PL') {
console.log('tarik sis') console.log('tarik sis')
...@@ -1808,7 +1812,7 @@ export default class MonthlyReport extends Component { ...@@ -1808,7 +1812,7 @@ export default class MonthlyReport extends Component {
} }
api.create().createReportPLMR(payload).then((res) => { api.create().createReportPLMR(payload).then((res) => {
console.log(res) console.log(res)
this.setState({loading: false}) this.setState({ loading: false })
// if (response.data) { // if (response.data) {
// if (response.data.status === "success") { // if (response.data.status === "success") {
// this.props.saveToMonthlyReport() // this.props.saveToMonthlyReport()
...@@ -1950,7 +1954,7 @@ export default class MonthlyReport extends Component { ...@@ -1950,7 +1954,7 @@ export default class MonthlyReport extends Component {
total += Number(dataTable2[35][7 + index]) total += Number(dataTable2[35][7 + index])
// console.log(index); // console.log(index);
} }
total = total/month total = total / month
} }
let hasil = Number(value) / total let hasil = Number(value) / total
// console.log(hasil, value, total); // console.log(hasil, value, total);
...@@ -1958,25 +1962,25 @@ export default class MonthlyReport extends Component { ...@@ -1958,25 +1962,25 @@ export default class MonthlyReport extends Component {
} }
olahDataFR(dbFR, type) { olahDataFR(dbFR, type) {
dbFR.map((item,index) => { dbFR.map((item, index) => {
if(item[0] != 4 || item[0] != 1) { if (item[0] != 4 || item[0] != 1) {
if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) { if (item[5] === "Return on Invested Capital - YTD (ROIC)") {
item[7] = this.handleFormulaRatio(item[7],item,1) item[7] = this.handleFormulaRatio(item[7], item, 1)
item[8] = this.handleFormulaRatio(item[8],item,2) item[8] = this.handleFormulaRatio(item[8], item, 2)
item[9] = this.handleFormulaRatio(item[9],item,3) item[9] = this.handleFormulaRatio(item[9], item, 3)
item[10] = this.handleFormulaRatio(item[10],item,4) item[10] = this.handleFormulaRatio(item[10], item, 4)
item[11] = this.handleFormulaRatio(item[11],item,5) item[11] = this.handleFormulaRatio(item[11], item, 5)
item[12] = this.handleFormulaRatio(item[12],item,6) item[12] = this.handleFormulaRatio(item[12], item, 6)
item[13] = this.handleFormulaRatio(item[13],item,7) item[13] = this.handleFormulaRatio(item[13], item, 7)
item[14] = this.handleFormulaRatio(item[14],item,8) item[14] = this.handleFormulaRatio(item[14], item, 8)
item[15] = this.handleFormulaRatio(item[15],item,9) item[15] = this.handleFormulaRatio(item[15], item, 9)
item[16] = this.handleFormulaRatio(item[16],item,10) item[16] = this.handleFormulaRatio(item[16], item, 10)
item[17] = this.handleFormulaRatio(item[17],item,11) item[17] = this.handleFormulaRatio(item[17], item, 11)
item[18] = this.handleFormulaRatio(item[18],item,12) item[18] = this.handleFormulaRatio(item[18], item, 12)
} }
} }
}) })
this.setState({dbFR}, () => { this.setState({ dbFR }, () => {
this.payloadFR(type) this.payloadFR(type)
}) })
} }
...@@ -1984,7 +1988,7 @@ export default class MonthlyReport extends Component { ...@@ -1984,7 +1988,7 @@ export default class MonthlyReport extends Component {
payloadFR(type) { payloadFR(type) {
let listFR = [] let listFR = []
console.log(this.state.dbFR) console.log(this.state.dbFR)
this.state.dbFR.map((item,index) => { this.state.dbFR.map((item, index) => {
if (item[0] != 4 || item[0] != 1) { if (item[0] != 4 || item[0] != 1) {
// if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) { // if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) {
// item[7] = this.handleFormulaRatio(item[7],item,1) // item[7] = this.handleFormulaRatio(item[7],item,1)
...@@ -2006,29 +2010,29 @@ export default class MonthlyReport extends Component { ...@@ -2006,29 +2010,29 @@ export default class MonthlyReport extends Component {
listFR.push( listFR.push(
{ {
"item_report_id": item[1], "item_report_id": item[1],
"actual": this.state.month.month_id == 1? "actual": this.state.month.month_id == 1 ?
String(item[7] == undefined || item[7] == 'Infinity' || item[7] == '-Infinity'? "0.0" : Number(item[7]).toFixed(2)) : String(item[7] == undefined || item[7] == 'Infinity' || item[7] == '-Infinity' ? "0.0" : Number(item[7]).toFixed(2)) :
this.state.month.month_id == 2? this.state.month.month_id == 2 ?
String(item[8] == undefined || item[8] == 'Infinity' || item[8] == '-Infinity'? "0.0" : Number(item[8]).toFixed(2)) : String(item[8] == undefined || item[8] == 'Infinity' || item[8] == '-Infinity' ? "0.0" : Number(item[8]).toFixed(2)) :
this.state.month.month_id == 3? this.state.month.month_id == 3 ?
String(item[9] == undefined || item[9] == 'Infinity' || item[9] == '-Infinity'? "0.0" : Number(item[9]).toFixed(2)) : String(item[9] == undefined || item[9] == 'Infinity' || item[9] == '-Infinity' ? "0.0" : Number(item[9]).toFixed(2)) :
this.state.month.month_id == 4? this.state.month.month_id == 4 ?
String(item[10] == undefined || item[10] == 'Infinity' || item[10] == '-Infinity'? "0.0" : Number(item[10]).toFixed(2)) : String(item[10] == undefined || item[10] == 'Infinity' || item[10] == '-Infinity' ? "0.0" : Number(item[10]).toFixed(2)) :
this.state.month.month_id == 5? this.state.month.month_id == 5 ?
String(item[11] == undefined || item[11] == 'Infinity' || item[11] == '-Infinity'? "0.0" : Number(item[11]).toFixed(2)) : String(item[11] == undefined || item[11] == 'Infinity' || item[11] == '-Infinity' ? "0.0" : Number(item[11]).toFixed(2)) :
this.state.month.month_id == 6? this.state.month.month_id == 6 ?
String(item[12] == undefined || item[12] == 'Infinity' || item[12] == '-Infinity'? "0.0" : Number(item[12]).toFixed(2)) : String(item[12] == undefined || item[12] == 'Infinity' || item[12] == '-Infinity' ? "0.0" : Number(item[12]).toFixed(2)) :
this.state.month.month_id == 7? this.state.month.month_id == 7 ?
String(item[13] == undefined || item[13] == 'Infinity' || item[13] == '-Infinity'? "0.0" : Number(item[13]).toFixed(2)) : String(item[13] == undefined || item[13] == 'Infinity' || item[13] == '-Infinity' ? "0.0" : Number(item[13]).toFixed(2)) :
this.state.month.month_id == 8? this.state.month.month_id == 8 ?
String(item[14] == undefined || item[14] == 'Infinity' || item[14] == '-Infinity'? "0.0" : Number(item[14]).toFixed(2)) : String(item[14] == undefined || item[14] == 'Infinity' || item[14] == '-Infinity' ? "0.0" : Number(item[14]).toFixed(2)) :
this.state.month.month_id == 9? this.state.month.month_id == 9 ?
String(item[15] == undefined || item[15] == 'Infinity' || item[15] == '-Infinity'? "0.0" : Number(item[15]).toFixed(2)) : String(item[15] == undefined || item[15] == 'Infinity' || item[15] == '-Infinity' ? "0.0" : Number(item[15]).toFixed(2)) :
this.state.month.month_id == 10? this.state.month.month_id == 10 ?
String(item[16] == undefined || item[16] == 'Infinity' || item[16] == '-Infinity'? "0.0" : Number(item[16]).toFixed(2)) : String(item[16] == undefined || item[16] == 'Infinity' || item[16] == '-Infinity' ? "0.0" : Number(item[16]).toFixed(2)) :
this.state.month.month_id == 11? this.state.month.month_id == 11 ?
String(item[17] == undefined || item[17] == 'Infinity' || item[17] == '-Infinity'? "0.0" : Number(item[17]).toFixed(2)) : String(item[17] == undefined || item[17] == 'Infinity' || item[17] == '-Infinity' ? "0.0" : Number(item[17]).toFixed(2)) :
String(item[18] == undefined || item[18] == 'Infinity' || item[18] == '-Infinity'? "0.0" : Number(item[18]).toFixed(2)) String(item[18] == undefined || item[18] == 'Infinity' || item[18] == '-Infinity' ? "0.0" : Number(item[18]).toFixed(2))
// "january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)), // "january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)),
// "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)), // "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)),
// "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)), // "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)),
...@@ -2049,8 +2053,8 @@ export default class MonthlyReport extends Component { ...@@ -2049,8 +2053,8 @@ export default class MonthlyReport extends Component {
}) })
console.log(listFR) console.log(listFR)
console.log('subOD',this.state.submissionID) console.log('subOD', this.state.submissionID)
this.setState({dbFR: listFR} , () => { this.setState({ dbFR: listFR }, () => {
if (this.state.monthlyReportId != null) { if (this.state.monthlyReportId != null) {
this.createDBFR() this.createDBFR()
} }
...@@ -2507,7 +2511,7 @@ export default class MonthlyReport extends Component { ...@@ -2507,7 +2511,7 @@ export default class MonthlyReport extends Component {
getOptionLabel={(option) => option.name} getOptionLabel={(option) => option.name}
style={{ width: 250 }} style={{ width: 250 }}
onChange={(event, newInputValue) => { onChange={(event, newInputValue) => {
this.setState({selectedStatus: newInputValue, loading: true}, () => { this.setState({ selectedStatus: newInputValue, loading: true }, () => {
console.log(newInputValue); console.log(newInputValue);
this.getCompanySubmitted() this.getCompanySubmitted()
}) })
...@@ -2729,7 +2733,7 @@ export default class MonthlyReport extends Component { ...@@ -2729,7 +2733,7 @@ export default class MonthlyReport extends Component {
</div> </div>
</div> </div>
: :
this.state.checkApprover? this.state.checkApprover ?
this.state.lastStatus === 'WAITING FOR REVIEW' ? this.state.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button <button
...@@ -2781,7 +2785,7 @@ export default class MonthlyReport extends Component { ...@@ -2781,7 +2785,7 @@ export default class MonthlyReport extends Component {
</div> </div>
</div> : null </div> : null
: :
(this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit? (this.state.lastStatus === 'SUBMIT' || this.state.lastStatus === 'REVISION') && this.state.isSubmit ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button <button
style={{ style={{
...@@ -3014,7 +3018,7 @@ export default class MonthlyReport extends Component { ...@@ -3014,7 +3018,7 @@ export default class MonthlyReport extends Component {
/> />
)} )}
{ {
this.state.visibleRevision && ( this.state.visibleRevision && (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
......
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