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 {
}
}
})
// console.log(dataTable)
console.log(dataTable)
this.setState({ dbCF: dataTable }, () => {
this.olahDataCashFlow(this.state.dbCF, type)
})
......@@ -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
}
......@@ -1089,6 +1089,7 @@ export default class BudgetTahunan extends Component {
console.log(this.state.dbCF)
console.log(JSON.stringify(payload))
api.create().createReportCF(payload).then((res) => {
this.setState({loading: false})
console.log(res)
// if (response.data) {
// if (response.data.status === "success") {
......@@ -1220,7 +1221,7 @@ export default class BudgetTahunan extends Component {
this.olahDataPL(this.state.dbPL, type)
})
} 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 {
intervalEBITDA: 0,
data: [],
defaultMonth: [],
defaultYear: []
defaultYear: [],
revOptions: {},
tpatOptions: {},
ebitdaOptions: {},
totalAssetsOptions: {}
};
}
......@@ -390,7 +394,7 @@ export default class DashboardFinancial extends React.Component {
// newName = `asd \n baba`
// } else {
let splitName = String(name).split(' ')
console.log(splitName)
// console.log(splitName)
newName = name
// }
}
......@@ -424,61 +428,487 @@ export default class DashboardFinancial extends React.Component {
let minEBITDA = response.ebitda.vertical_pointing[1]
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') {
companyRev.push(item.periode)
mbRev.push(item.value)
mrRev.push(item.gp_margin)
mbRev.push(Number(item.value))
mrRev.push(Number(item.gp_margin))
} else {
companyRev.push(handleName(item.company))
mbRev.push(item.value_mb)
mrRev.push(item.value_mr)
mbRev.push(Number(item.value_mb))
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') {
companyTPAT.push(item.periode)
mbTPAT.push(item.value)
mrTPAT.push(item.gp_margin)
mbTPAT.push(Number(item.value))
mrTPAT.push(Number(item.gp_margin))
} else {
companyTPAT.push(handleName(item.company))
mbTPAT.push(item.value_mb)
mrTPAT.push(item.value_mr)
mbTPAT.push(Number(item.value_mb))
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') {
companyEBITDA.push(item.periode)
mbEBITDA.push(item.value)
mrEBITDA.push(item.gp_margin)
mbEBITDA.push(Number(item.value))
mrEBITDA.push(Number(item.gp_margin))
} else {
companyEBITDA.push(handleName(item.company))
mbEBITDA.push(item.value_mb)
mrEBITDA.push(item.value_mr)
mbEBITDA.push(Number(item.value_mb))
mrEBITDA.push(Number(item.value_mr))
}
})
let 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: companyEBITDA,
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: minEBITDA,
max: maxEBITDA,
interval: intervalEBITDA,
axisLabel: {
interval: 0,
textStyle: {
baseline: "top",
color: "#333",
fontSize: 12,
}
}
}
] :
[
{
type: 'value',
name: '(Rp bn)',
min: minEBITDA,
max: maxEBITDA,
interval: intervalEBITDA,
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: 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.revenue.nodes.map((item, index) => {
totalAssets.push({
"company": item.company,
"MB": item.value_mb,
"MBColor": "hsl(212, 64%, 46%)",
"MR": item.value_mr,
"MRColor": "hsl(212, 78%, 62%)",
})
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({ 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 })
this.setState({ revOptions, tpatOptions, ebitdaOptions }, () => {
setTimeout(() => {
this.setState({ loading: false })
}, 300);
})
}
})
......@@ -523,7 +953,7 @@ export default class DashboardFinancial extends React.Component {
}
return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} ref={this.myRef}>
{this.state.loading && loadingComponent}
{/* {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>
......@@ -672,7 +1102,7 @@ export default class DashboardFinancial extends React.Component {
}
})
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()
})
} else {
......@@ -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 }}>
{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 }}
option={{
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
}
]
}}
option={this.state.revOptions}
/>}
</div>
<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.loading && <ReactECharts
{<ReactECharts
showLoading={this.state.loading}
style={{ height: 500, width: '100%', marginTop: 20 }}
option={{
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
}
]
}}
option={this.state.tpatOptions}
/>}
{/* <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 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.loading && <ReactECharts
{<ReactECharts
lazyUpdate={true}
showLoading={this.state.loading}
style={{ height: 500, width: '100%', marginTop: 20 }}
option={{
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
}
]
}}
option={this.state.ebitdaOptions}
/>}
</div>
{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>
{!this.state.loading && <ReactECharts
{<ReactECharts
style={{ height: 500, width: '100%', marginTop: 20 }}
option={{
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
}
]
}}
showLoading={this.state.loading}
option={this.state.totalAssetsOptions}
/>}
</div>}
</div>
......
......@@ -119,9 +119,9 @@ export default class MonthlyReport extends Component {
if (this.props.location.state !== undefined) {
console.log(this.props);
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()
})
} else {
......@@ -135,19 +135,19 @@ export default class MonthlyReport extends Component {
getChecApprover() {
let listStatus1 = [
{name: 'Open', value: 'not-yet'},
{name: 'Submitted', value: 'approval_review'},
{name: 'Waiting for Review / Approval', value: 'approval_proccess'},
{ name: 'Open', value: 'not-yet' },
{ name: 'Submitted', value: 'approval_review' },
{ name: 'Waiting for Review / Approval', value: 'approval_proccess' },
// {name: 'Waiting for Approval', value: 'approval_proccess'},
// {name: 'Revision', value: 'revision'},
{name: 'Approved', value: 'approved'},
{ name: 'Approved', value: 'approved' },
]
let listStatus2 = [
{name: 'Open', value: 'not-yet'},
{name: 'Submitted', value: 'approval_review'},
{ name: 'Open', value: 'not-yet' },
{ name: 'Submitted', value: 'approval_review' },
// {name: 'Revision', value: 'revision'},
{name: 'Approved', value: 'approved'},
{ name: 'Approved', value: 'approved' },
]
api.create().checkApproverMonthly().then(response => {
......@@ -155,18 +155,17 @@ export default class MonthlyReport extends Component {
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true, still_approver: true, approverTrue: true, listStatus: listStatus1, selectedStatus: listStatus1}, () =>
{
// if (this.state.submittedOnly) {
this.getMonth()
// } else {
// this.getCompanyActive()
// }
})
this.setState({ isApprover: true, checkApprover: true, still_approver: true, approverTrue: true, listStatus: listStatus1, selectedStatus: listStatus1 }, () => {
// if (this.state.submittedOnly) {
this.getMonth()
// } else {
// this.getCompanyActive()
// }
})
} 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.getCompanyActive())
// this.getCompanyActive())
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -226,13 +225,13 @@ export default class MonthlyReport extends Component {
let indexC = String(item.current_status).toLocaleUpperCase().indexOf('C')
let status_approv = ''
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 {
status_approv = String(item.current_status)
}
return [
item.number,
item.report_name == "CAT"? "Corporate Annual Target" : item.report_name,
item.report_name == "CAT" ? "Corporate Annual Target" : item.report_name,
item.revision,
this.state.isApprovedMB ? (this.state.lastStatus === 'APPROVED' ? 'CLOSED' : this.state.isSubmit === false ? "CLOSED" : status_approv) : "CLOSED",
item.report_id,
......@@ -253,7 +252,7 @@ export default class MonthlyReport extends Component {
}
})
// 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 {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -285,7 +284,7 @@ export default class MonthlyReport extends Component {
options: companyData,
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()
// console.log(this.state.company_active)
})
......@@ -332,7 +331,7 @@ export default class MonthlyReport extends Component {
indexMonthHome = monthData.findIndex((val) => val.month_id == this.state.monthHome.month_id)
}
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.submittedOnly) {
// console.log('masuk cuk')
......@@ -341,8 +340,8 @@ export default class MonthlyReport extends Component {
// this.getLastPeriod()
// }
// } else {
// this.getLastPeriod()
this.getPeriode()
// this.getLastPeriod()
this.getPeriode()
// }
})
} else {
......@@ -415,11 +414,11 @@ export default class MonthlyReport extends Component {
// console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
// if (this.state.isApprover === true && this.state.submittedOnly) {
this.getDetailUser()
// this.getCompanySubmitted()
this.getDetailUser()
// this.getCompanySubmitted()
// console.log('masuk')
// } else {
// this.getRevision()
// this.getRevision()
// }
})
} else {
......@@ -492,7 +491,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"status": selectedStatus
}
this.setState({isApprovedMB: true})
this.setState({ isApprovedMB: true })
api.create().getCompanySubmittedMonthly(body).then(response => {
console.log(response);
if (response.data) {
......@@ -515,7 +514,7 @@ export default class MonthlyReport extends Component {
})
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 = {
options: arrayBaru,
......@@ -607,7 +606,7 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"is_approver": this.state.isApprover
}
this.setState({visibleTableHistory: false})
this.setState({ visibleTableHistory: false })
api.create().getMonthlyReportID(payload).then(response => {
console.log(response);
if (response.data) {
......@@ -625,8 +624,13 @@ export default class MonthlyReport extends Component {
// // console.log(this.state.lastStatus);
this.historyApproval()
this.getLatestPeriodSubmit()
this.getCashFlow(type)
this.getPL(type)
if (type != undefined) {
this.getCashFlow(type)
this.getPL(type)
} else {
this.setState({ loading: false })
}
// this.getFR(type)
// this.getReport()
// this.getReportAttachment()
......@@ -634,7 +638,7 @@ export default class MonthlyReport extends Component {
console.log(response)
if (this.state.btnCreate === true && this.state.btnEdit === true) {
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 {
console.log('just view');
this.setState({ isApprover: true, checkApprover: true })
......@@ -661,7 +665,7 @@ export default class MonthlyReport extends Component {
let body = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"months" : this.state.month.month_id
"months": this.state.month.month_id
}
api.create().getSubmitMonthlyReport(body).then(response => {
console.log(response);
......@@ -690,7 +694,7 @@ export default class MonthlyReport extends Component {
let indexC = String(item.status_approval).toLocaleUpperCase().indexOf('C')
let status_approv = ''
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 {
status_approv = String(item.status_approval)
}
......@@ -744,7 +748,7 @@ export default class MonthlyReport extends Component {
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") {
PLBSFAMSubmitted += 1
}
......@@ -851,7 +855,7 @@ export default class MonthlyReport extends Component {
visibleLOCF: false,
visibleOI: false,
visibleCF: true,
PLBSFAMSubmitted: PLBSFAMSubmitted == 3? true : false
PLBSFAMSubmitted: PLBSFAMSubmitted == 3 ? true : false
})
}
})
......@@ -1121,7 +1125,7 @@ export default class MonthlyReport extends Component {
// console.log(item);
// console.log(items);
// console.log(subForm);
let re = /^[a-zA-Z0-9_]+$/;
if (item !== "") {
if (items == ']') {
......@@ -1153,14 +1157,14 @@ export default class MonthlyReport extends Component {
// console.log(tst);
let indexID = dbCF[indexS][6].formula.findIndex((val) => val.item_formula == tst)
// console.log(indexID);
if (indexID !== -1) {
let valuezz = dbCF[indexS][6].formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
// console.log(valuezz);
}
} 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)
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) {
......@@ -1184,7 +1188,7 @@ export default class MonthlyReport extends Component {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
anjay.push(opet == ''? Number(item) : Number(String(opet + String(item))))
anjay.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
......@@ -1330,41 +1334,41 @@ export default class MonthlyReport extends Component {
}
olahDataCashFlow(dbCF, type) {
dbCF.map((item,index) => {
if(item[0] == 5 || item[0] == 6) {
item[6].value = this.handleValueFormula(item,index)
dbCF.map((item, index) => {
if (item[0] == 5 || item[0] == 6) {
item[6].value = this.handleValueFormula(item, index)
}
})
console.log(dbCF)
this.setState({dbCF}, () => {
this.setState({ dbCF }, () => {
this.payloadCF(type)
})
}
payloadCF(type) {
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") {
item[6].value = this.handleValueFormula(item,index)
item[6].value = this.handleValueFormula(item, index)
listCF.push({
"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 {
listCF.push({
"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)
this.setState({dbCF: listCF} , () => {
this.setState({ dbCF: listCF }, () => {
// if (type != undefined) {
// if (type == 'BS' || type == 'FAM' || type == 'PL') {
console.log('tarik sis')
this.createCashFlow()
console.log('tarik sis')
this.createCashFlow()
// }
// }
})
......@@ -1410,7 +1414,7 @@ export default class MonthlyReport extends Component {
api.create().getPLID(payloadID).then(response => {
console.log(response);
if (response) {
PLID = response.data.data == null ? null : response.data.data.profit_loss_id
PLID = response.data.data == null ? null : response.data.data.profit_loss_id
} else {
PLID = null
}
......@@ -1424,12 +1428,12 @@ export default class MonthlyReport extends Component {
"report_id": 28,
"submission_id": this.state.PLID
}
api.create().getHierarkiCreateReportPLMR(payload).then((response) => {
console.log(response)
let dataTable = []
let err = false
if (response.data) {
if (response.data.status === 'success') {
let res = response.data.data
......@@ -1443,29 +1447,29 @@ export default class MonthlyReport extends Component {
item.formula,
item.level,
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 } :
this.state.month.month_id == 2?
{ value: item.profit_detail.february, formula: item.profit_detail.february_formula } :
this.state.month.month_id == 3?
{ value: item.profit_detail.march, formula: item.profit_detail.march_formula } :
this.state.month.month_id == 4?
{ value: item.profit_detail.april, formula: item.profit_detail.april_formula } :
this.state.month.month_id == 5?
{ value: item.profit_detail.may, formula: item.profit_detail.may_formula } :
this.state.month.month_id == 6?
{ value: item.profit_detail.june, formula: item.profit_detail.june_formula } :
this.state.month.month_id == 7?
{ value: item.profit_detail.july, formula: item.profit_detail.july_formula } :
this.state.month.month_id == 8?
{ value: item.profit_detail.august, formula: item.profit_detail.august_formula } :
this.state.month.month_id == 9?
{ value: item.profit_detail.september, formula: item.profit_detail.september_formula } :
this.state.month.month_id == 10?
{ value: item.profit_detail.october, formula: item.profit_detail.october_formula } :
this.state.month.month_id == 11?
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula },
this.state.month.month_id == 2 ?
{ value: item.profit_detail.february, formula: item.profit_detail.february_formula } :
this.state.month.month_id == 3 ?
{ value: item.profit_detail.march, formula: item.profit_detail.march_formula } :
this.state.month.month_id == 4 ?
{ value: item.profit_detail.april, formula: item.profit_detail.april_formula } :
this.state.month.month_id == 5 ?
{ value: item.profit_detail.may, formula: item.profit_detail.may_formula } :
this.state.month.month_id == 6 ?
{ value: item.profit_detail.june, formula: item.profit_detail.june_formula } :
this.state.month.month_id == 7 ?
{ value: item.profit_detail.july, formula: item.profit_detail.july_formula } :
this.state.month.month_id == 8 ?
{ value: item.profit_detail.august, formula: item.profit_detail.august_formula } :
this.state.month.month_id == 9 ?
{ value: item.profit_detail.september, formula: item.profit_detail.september_formula } :
this.state.month.month_id == 10 ?
{ value: item.profit_detail.october, formula: item.profit_detail.october_formula } :
this.state.month.month_id == 11 ?
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula },
item.order,
item.profit_detail.notes
])
......@@ -1486,29 +1490,29 @@ export default class MonthlyReport extends Component {
item.formula,
item.level,
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 } :
this.state.month.month_id == 2?
{ value: item.profit_detail.february, formula: item.profit_detail.february_formula } :
this.state.month.month_id == 3?
{ value: item.profit_detail.march, formula: item.profit_detail.march_formula } :
this.state.month.month_id == 4?
{ value: item.profit_detail.april, formula: item.profit_detail.april_formula } :
this.state.month.month_id == 5?
{ value: item.profit_detail.may, formula: item.profit_detail.may_formula } :
this.state.month.month_id == 6?
{ value: item.profit_detail.june, formula: item.profit_detail.june_formula } :
this.state.month.month_id == 7?
{ value: item.profit_detail.july, formula: item.profit_detail.july_formula } :
this.state.month.month_id == 8?
{ value: item.profit_detail.august, formula: item.profit_detail.august_formula } :
this.state.month.month_id == 9?
{ value: item.profit_detail.september, formula: item.profit_detail.september_formula } :
this.state.month.month_id == 10?
{ value: item.profit_detail.october, formula: item.profit_detail.october_formula } :
this.state.month.month_id == 11?
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula },
this.state.month.month_id == 2 ?
{ value: item.profit_detail.february, formula: item.profit_detail.february_formula } :
this.state.month.month_id == 3 ?
{ value: item.profit_detail.march, formula: item.profit_detail.march_formula } :
this.state.month.month_id == 4 ?
{ value: item.profit_detail.april, formula: item.profit_detail.april_formula } :
this.state.month.month_id == 5 ?
{ value: item.profit_detail.may, formula: item.profit_detail.may_formula } :
this.state.month.month_id == 6 ?
{ value: item.profit_detail.june, formula: item.profit_detail.june_formula } :
this.state.month.month_id == 7 ?
{ value: item.profit_detail.july, formula: item.profit_detail.july_formula } :
this.state.month.month_id == 8 ?
{ value: item.profit_detail.august, formula: item.profit_detail.august_formula } :
this.state.month.month_id == 9 ?
{ value: item.profit_detail.september, formula: item.profit_detail.september_formula } :
this.state.month.month_id == 10 ?
{ value: item.profit_detail.october, formula: item.profit_detail.october_formula } :
this.state.month.month_id == 11 ?
{ value: item.profit_detail.november, formula: item.profit_detail.november_formula } :
{ value: item.profit_detail.december, formula: item.profit_detail.december_formula },
item.order,
item.profit_detail.notes
])
......@@ -1541,7 +1545,7 @@ export default class MonthlyReport extends Component {
})
})
})
}
handleValueFormulaDBPLMR = (value, tableMeta, column, periode, forecast) => {
......@@ -1752,43 +1756,43 @@ export default class MonthlyReport extends Component {
}
olahDataPL(dbPL, type) {
dbPL.map((item,index) => {
if(item[0] == 5 || item[0] == 6 ) {
item[6].value = this.handleValueFormulaDBPLMR(item[6],item,6)
dbPL.map((item, index) => {
if (item[0] == 5 || item[0] == 6) {
item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
}
})
// console.log(dbPL)
this.setState({dbPL}, () => {
this.setState({ dbPL }, () => {
this.payloadPL(type)
})
}
payloadPL(type) {
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") {
item[6].value = this.handleValueFormulaDBPLMR(item[6],item,6)
item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
listPL.push({
"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]
})
} else {
listPL.push({
"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]
})
}
})
console.log(listPL)
this.setState({dbPL: listPL} , () => {
this.setState({ dbPL: listPL }, () => {
// if (type != undefined) {
// if ( type == 'PL') {
console.log('tarik sis')
this.createPL()
console.log('tarik sis')
this.createPL()
// }
// }
})
......@@ -1808,7 +1812,7 @@ export default class MonthlyReport extends Component {
}
api.create().createReportPLMR(payload).then((res) => {
console.log(res)
this.setState({loading: false})
this.setState({ loading: false })
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
......@@ -1836,7 +1840,7 @@ export default class MonthlyReport extends Component {
api.create().getFRID(payloadID).then(response => {
console.log(response);
if (response) {
FRID = response.data.data == null ? null : response.data.data.ratio_id
FRID = response.data.data == null ? null : response.data.data.ratio_id
} else {
FRID = null
}
......@@ -1880,7 +1884,7 @@ export default class MonthlyReport extends Component {
Number(item.ratio.monthly_november).toFixed(2),
Number(item.ratio.monthly_december).toFixed(2),
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
......@@ -1925,18 +1929,18 @@ export default class MonthlyReport extends Component {
})
console.log(dataTable)
this.setState({ dbFR: dataTable, loading: false }, () => {
this.olahDataFR(this.state.dbFR, type)
this.olahDataFR(this.state.dbFR, type)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
})
})
}
handleFormulaRatio = (value, tableMeta, month) => {
......@@ -1950,7 +1954,7 @@ export default class MonthlyReport extends Component {
total += Number(dataTable2[35][7 + index])
// console.log(index);
}
total = total/month
total = total / month
}
let hasil = Number(value) / total
// console.log(hasil, value, total);
......@@ -1958,25 +1962,25 @@ export default class MonthlyReport extends Component {
}
olahDataFR(dbFR, type) {
dbFR.map((item,index) => {
if(item[0] != 4 || item[0] != 1) {
if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) {
item[7] = this.handleFormulaRatio(item[7],item,1)
item[8] = this.handleFormulaRatio(item[8],item,2)
item[9] = this.handleFormulaRatio(item[9],item,3)
item[10] = this.handleFormulaRatio(item[10],item,4)
item[11] = this.handleFormulaRatio(item[11],item,5)
item[12] = this.handleFormulaRatio(item[12],item,6)
item[13] = this.handleFormulaRatio(item[13],item,7)
item[14] = this.handleFormulaRatio(item[14],item,8)
item[15] = this.handleFormulaRatio(item[15],item,9)
item[16] = this.handleFormulaRatio(item[16],item,10)
item[17] = this.handleFormulaRatio(item[17],item,11)
item[18] = this.handleFormulaRatio(item[18],item,12)
}
dbFR.map((item, index) => {
if (item[0] != 4 || item[0] != 1) {
if (item[5] === "Return on Invested Capital - YTD (ROIC)") {
item[7] = this.handleFormulaRatio(item[7], item, 1)
item[8] = this.handleFormulaRatio(item[8], item, 2)
item[9] = this.handleFormulaRatio(item[9], item, 3)
item[10] = this.handleFormulaRatio(item[10], item, 4)
item[11] = this.handleFormulaRatio(item[11], item, 5)
item[12] = this.handleFormulaRatio(item[12], item, 6)
item[13] = this.handleFormulaRatio(item[13], item, 7)
item[14] = this.handleFormulaRatio(item[14], item, 8)
item[15] = this.handleFormulaRatio(item[15], item, 9)
item[16] = this.handleFormulaRatio(item[16], item, 10)
item[17] = this.handleFormulaRatio(item[17], item, 11)
item[18] = this.handleFormulaRatio(item[18], item, 12)
}
}
})
this.setState({dbFR}, () => {
this.setState({ dbFR }, () => {
this.payloadFR(type)
})
}
......@@ -1984,7 +1988,7 @@ export default class MonthlyReport extends Component {
payloadFR(type) {
let listFR = []
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[5] === "Return on Invested Capital - YTD (ROIC)" ) {
// item[7] = this.handleFormulaRatio(item[7],item,1)
......@@ -2001,34 +2005,34 @@ export default class MonthlyReport extends Component {
// item[18] = this.handleFormulaRatio(item[18],item,12)
// }
}
listFR.push(
{
"item_report_id": item[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)) :
this.state.month.month_id == 2?
String(item[8] == undefined || item[8] == 'Infinity' || item[8] == '-Infinity'? "0.0" : Number(item[8]).toFixed(2)) :
this.state.month.month_id == 3?
String(item[9] == undefined || item[9] == 'Infinity' || item[9] == '-Infinity'? "0.0" : Number(item[9]).toFixed(2)) :
this.state.month.month_id == 4?
String(item[10] == undefined || item[10] == 'Infinity' || item[10] == '-Infinity'? "0.0" : Number(item[10]).toFixed(2)) :
this.state.month.month_id == 5?
String(item[11] == undefined || item[11] == 'Infinity' || item[11] == '-Infinity'? "0.0" : Number(item[11]).toFixed(2)) :
this.state.month.month_id == 6?
String(item[12] == undefined || item[12] == 'Infinity' || item[12] == '-Infinity'? "0.0" : Number(item[12]).toFixed(2)) :
this.state.month.month_id == 7?
String(item[13] == undefined || item[13] == 'Infinity' || item[13] == '-Infinity'? "0.0" : Number(item[13]).toFixed(2)) :
this.state.month.month_id == 8?
String(item[14] == undefined || item[14] == 'Infinity' || item[14] == '-Infinity'? "0.0" : Number(item[14]).toFixed(2)) :
this.state.month.month_id == 9?
String(item[15] == undefined || item[15] == 'Infinity' || item[15] == '-Infinity'? "0.0" : Number(item[15]).toFixed(2)) :
this.state.month.month_id == 10?
String(item[16] == undefined || item[16] == 'Infinity' || item[16] == '-Infinity'? "0.0" : Number(item[16]).toFixed(2)) :
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[18] == undefined || item[18] == 'Infinity' || item[18] == '-Infinity'? "0.0" : Number(item[18]).toFixed(2))
"actual": this.state.month.month_id == 1 ?
String(item[7] == undefined || item[7] == 'Infinity' || item[7] == '-Infinity' ? "0.0" : Number(item[7]).toFixed(2)) :
this.state.month.month_id == 2 ?
String(item[8] == undefined || item[8] == 'Infinity' || item[8] == '-Infinity' ? "0.0" : Number(item[8]).toFixed(2)) :
this.state.month.month_id == 3 ?
String(item[9] == undefined || item[9] == 'Infinity' || item[9] == '-Infinity' ? "0.0" : Number(item[9]).toFixed(2)) :
this.state.month.month_id == 4 ?
String(item[10] == undefined || item[10] == 'Infinity' || item[10] == '-Infinity' ? "0.0" : Number(item[10]).toFixed(2)) :
this.state.month.month_id == 5 ?
String(item[11] == undefined || item[11] == 'Infinity' || item[11] == '-Infinity' ? "0.0" : Number(item[11]).toFixed(2)) :
this.state.month.month_id == 6 ?
String(item[12] == undefined || item[12] == 'Infinity' || item[12] == '-Infinity' ? "0.0" : Number(item[12]).toFixed(2)) :
this.state.month.month_id == 7 ?
String(item[13] == undefined || item[13] == 'Infinity' || item[13] == '-Infinity' ? "0.0" : Number(item[13]).toFixed(2)) :
this.state.month.month_id == 8 ?
String(item[14] == undefined || item[14] == 'Infinity' || item[14] == '-Infinity' ? "0.0" : Number(item[14]).toFixed(2)) :
this.state.month.month_id == 9 ?
String(item[15] == undefined || item[15] == 'Infinity' || item[15] == '-Infinity' ? "0.0" : Number(item[15]).toFixed(2)) :
this.state.month.month_id == 10 ?
String(item[16] == undefined || item[16] == 'Infinity' || item[16] == '-Infinity' ? "0.0" : Number(item[16]).toFixed(2)) :
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[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)),
// "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)),
// "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)),
......@@ -2043,14 +2047,14 @@ export default class MonthlyReport extends Component {
// "december": String(item[18] == undefined? item[18] : Number(item[18]).toFixed(1)),
// "total_next_year": String(item[19] != ''? Number(item[19]).toFixed(1) : item[19]),
// "total_more_year": String(item[20] != ''? Number(item[20]).toFixed(1) : item[20]),
}
}
)
})
console.log(listFR)
console.log('subOD',this.state.submissionID)
this.setState({dbFR: listFR} , () => {
console.log('subOD', this.state.submissionID)
this.setState({ dbFR: listFR }, () => {
if (this.state.monthlyReportId != null) {
this.createDBFR()
}
......@@ -2088,7 +2092,7 @@ export default class MonthlyReport extends Component {
// }
})
}
render() {
const columns = ["#", "Report Type",
{
......@@ -2172,7 +2176,7 @@ export default class MonthlyReport extends Component {
: null
// console.log(tableMeta.rowData)
// }
}
>
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
......@@ -2234,7 +2238,7 @@ export default class MonthlyReport extends Component {
let handleDate = Number(moment(this.state.maxDateRevision).format('YYYYMMDD')) - Number(moment(this.state.minDateRevision).format('YYYYMMDD'))
return handleDate < 0 ? moment(this.state.minDateRevision).format('YYYY/MM/DD') : moment(this.state.maxDateRevision).format('YYYY/MM/DD')
}
const handleChangeText = (value, tableMeta) => {
let dataTableRevision = this.state.dataTableRevision
dataTableRevision[tableMeta.rowIndex][tableMeta.columnIndex] = value
......@@ -2459,12 +2463,12 @@ export default class MonthlyReport extends Component {
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// } else {
this.setState({ visibleTableHistory: false })
if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
this.setState({ visibleTableHistory: false })
if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
// }
})}
disableClearable
......@@ -2479,12 +2483,12 @@ export default class MonthlyReport extends Component {
// if (this.state.isApprover === true) {
// this.getCompanySubmitted()
// } else {
this.setState({ visibleTableHistory: false })
if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
this.setState({ visibleTableHistory: false })
if (this.state.listCompany == null) {
this.getCompanySubmitted()
} else {
this.getRevision()
}
// }
})}
disableClearable
......@@ -2493,11 +2497,11 @@ export default class MonthlyReport extends Component {
value={this.state.periode}
/>
</div>
{/* } */}
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
......@@ -2507,7 +2511,7 @@ export default class MonthlyReport extends Component {
getOptionLabel={(option) => option.name}
style={{ width: 250 }}
onChange={(event, newInputValue) => {
this.setState({selectedStatus: newInputValue, loading: true}, () => {
this.setState({ selectedStatus: newInputValue, loading: true }, () => {
console.log(newInputValue);
this.getCompanySubmitted()
})
......@@ -2729,7 +2733,7 @@ export default class MonthlyReport extends Component {
</div>
</div>
:
this.state.checkApprover?
this.state.checkApprover ?
this.state.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<button
......@@ -2781,7 +2785,7 @@ export default class MonthlyReport extends Component {
</div>
</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' }} >
<button
style={{
......@@ -2872,7 +2876,7 @@ export default class MonthlyReport extends Component {
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
createCF={this.createCashFlow.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
{this.state.visiblePL && (
......@@ -2893,7 +2897,7 @@ export default class MonthlyReport extends Component {
lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
createCF={this.createCashFlow.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
/>
)}
......@@ -2915,7 +2919,7 @@ export default class MonthlyReport extends Component {
isApprover={this.state.isApprover}
status={this.state.status}
lastStatus={this.state.lastStatus}
// getReport={this.getCompanyActive.bind(this)}
// getReport={this.getCompanyActive.bind(this)}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
/>
)}
......@@ -3014,7 +3018,7 @@ export default class MonthlyReport extends Component {
/>
)}
{
{
this.state.visibleRevision && (
<div className="test app-popup-show">
<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