Commit c056b564 authored by rifkaki's avatar rifkaki

download ytd, histori

parent 92723262
......@@ -1239,22 +1239,22 @@ export default class SummaryOfTriputra extends Component {
// a.click();
// }
} else if (this.state.report.value === 2) {
alert("Download YTD Report Coming Soon")
// let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_report/export_master_budget?submission_id=${this.state.submissionID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.lastRevision}`
// let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_report/export_master_budget?submission_id=&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.lastRevision}`
// // console.log(url);
// let res = await fetch(
// this.state.submissionID == null ? sub_null : url
// )
// 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 Balance Sheet.xlsx';
// a.click();
// }
// alert("Download YTD Report Coming Soon")
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_ytd/export_report?year=${this.state.periode.periode}&&months=${this.state.month.month_id}`
let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_ytd/export_report?year=${this.state.periode.periode}&&months=${this.state.month.month_id}`
console.log(url);
let res = await fetch(
this.state.submissionID == null ? sub_null : url
)
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 YTD.xlsx';
a.click();
}
} else if (this.state.report.value === 3) {
alert("Download CPSM Report Coming Soon")
// let res = await fetch(
......@@ -1270,19 +1270,22 @@ export default class SummaryOfTriputra extends Component {
// a.click();
// }
} else if (this.state.report.value === 4) {
alert("Download Historical Report Coming Soon")
// let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_report_detail/export_master_budget?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.lastRevision}`
// )
// 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 Financial Ratio.xlsx';
// a.click();
// }
// alert("Download Historical Report Coming Soon")
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_historical/export_report?year=${this.state.periode.periode}`
let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_historical/export_report?year=${this.state.periode.periode}`
console.log(url);
let res = await fetch(
this.state.submissionID == null ? sub_null : url
)
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 Historical.xlsx';
a.click();
}
} else {
// setTimeout(() => {
......@@ -1392,7 +1395,7 @@ export default class SummaryOfTriputra extends Component {
margin: 5,
outline: 'none'
}}
onClick={() => this.setState({ loading: false }, () => {
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
......
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