Commit af86bc39 authored by d.arizona's avatar d.arizona

update export OI

parent d3f19180
...@@ -1086,7 +1086,7 @@ export default class SubHolding extends Component { ...@@ -1086,7 +1086,7 @@ export default class SubHolding extends Component {
} }
} }
}) })
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: false }) this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
// this.setState({ dataTable }, () => { // this.setState({ dataTable }, () => {
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
...@@ -2297,6 +2297,21 @@ export default class SubHolding extends Component { ...@@ -2297,6 +2297,21 @@ export default class SubHolding extends Component {
a.download = 'Report DB Financial Ratio.xlsx'; a.download = 'Report DB Financial Ratio.xlsx';
a.click(); a.click();
} }
} else if (this.state.report.value === 21) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_operating_indicator/export_report?operating_indicator_id=${this.state.OPID === null ? "" : this.state.OPID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_operating_indicator/export_report?operating_indicator_id=${this.state.OPID === null ? "" : this.state.OPID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report DB Operating Indicator.xlsx';
a.click();
}
} else { } else {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -2363,7 +2378,7 @@ export default class SubHolding extends Component { ...@@ -2363,7 +2378,7 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company} value={this.state.company}
/> />
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete {/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listUom} {...this.state.listUom}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
id="uom" id="uom"
...@@ -2374,7 +2389,7 @@ export default class SubHolding extends Component { ...@@ -2374,7 +2389,7 @@ export default class SubHolding extends Component {
style={{ width: 250, marginLeft: 10 }} style={{ width: 250, marginLeft: 10 }}
renderInput={(params) => <TextField {...params} label="Uom" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Uom" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.uom} value={this.state.uom}
/> : null : null} /> : null : null} */}
</div> </div>
<div style={{ marginTop: 15, display: 'flex' }}> <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
...@@ -2391,18 +2406,7 @@ export default class SubHolding extends Component { ...@@ -2391,18 +2406,7 @@ export default class SubHolding extends Component {
/>} />}
value={this.state.periode} value={this.state.periode}
/> />
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)}
id="months"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250, marginLeft: 10 }}
renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/> : null : null}
{/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete {/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listQuarter} {...this.state.listQuarter}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
...@@ -2416,6 +2420,20 @@ export default class SubHolding extends Component { ...@@ -2416,6 +2420,20 @@ export default class SubHolding extends Component {
value={this.state.quarter} value={this.state.quarter}
/> : null : null} */} /> : null : null} */}
</div> </div>
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete
{...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)}
id="months"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250, marginLeft: 10 }}
renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/>
</div> : null : null}
</div> </div>
<div> <div>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}> <div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}>
......
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