Commit ea1d8dea authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

cashflow

See merge request !828
parents 94c78007 be21ea1f
...@@ -117,6 +117,23 @@ export default class CashFlowMR extends Component { ...@@ -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() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
...@@ -426,7 +443,7 @@ export default class CashFlowMR extends Component { ...@@ -426,7 +443,7 @@ export default class CashFlowMR extends Component {
onClick={() => onClick={() =>
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
// this.downloadAllData() this.downloadAllData()
}, 100); }, 100);
})} })}
> >
...@@ -452,7 +469,7 @@ export default class CashFlowMR extends Component { ...@@ -452,7 +469,7 @@ export default class CashFlowMR extends Component {
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null : {/* {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') ? */} (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="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1"> <div className="col-1" style={{ paddingLeft: 0 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true }, () => { 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