Commit be21ea1f authored by Riri Novita's avatar Riri Novita

cashflow

parent 94c78007
......@@ -117,6 +117,23 @@ export default class CashFlowMR extends Component {
})
}
async downloadAllData() {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_cf/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/monthly_report_cf/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
)
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 = 'Monthly Report Cash Flow.xlsx';
a.click();
}
}
render() {
let dataTable2 = this.state.dataTable
......@@ -426,7 +443,7 @@ export default class CashFlowMR extends Component {
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
// this.downloadAllData()
this.downloadAllData()
}, 100);
})}
>
......@@ -452,7 +469,7 @@ export default class CashFlowMR extends Component {
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
......
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