Commit d32c3bee authored by Riri Novita's avatar Riri Novita

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents 25dddc91 400fb66e
......@@ -104,12 +104,13 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
// // console.log(JSON.stringify(payload))
console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
// // console.log(response)
// // console.log(response)\
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
......@@ -221,6 +222,11 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs)
})
} else {
this.setState({ dataTable, loading: false, dataReal: [], editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs)
})
}
})
}
......@@ -352,7 +358,7 @@ export default class CorporateAnnualTarget extends Component {
})
// console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => {
// // // console.log(JSON.stringify(this.state.payload));
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if (response.data) {
if (response.data.status === 'success') {
......
......@@ -278,7 +278,8 @@ export default class SubHolding extends Component {
})
} else if (this.state.report.value === 2) {
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
console.log(payload);
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -449,6 +450,93 @@ export default class SubHolding extends Component {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
} else if (this.state.report.value === 4) {
api.create().getDetailReportMB(payload).then(response => {
console.log(payload);
console.log(response);
// let dataTable = []
// if (response.data) {
// let res = response.data.data
// const handlePushChild = (item) => {
// let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
// if (indexIDzz === -1) {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
// Number(item.balance_sheet.january).toFixed(1),
// Number(item.balance_sheet.february).toFixed(1),
// Number(item.balance_sheet.march).toFixed(1),
// Number(item.balance_sheet.april).toFixed(1),
// Number(item.balance_sheet.may).toFixed(1),
// Number(item.balance_sheet.june).toFixed(1),
// Number(item.balance_sheet.july).toFixed(1),
// Number(item.balance_sheet.august).toFixed(1),
// Number(item.balance_sheet.september).toFixed(1),
// Number(item.balance_sheet.october).toFixed(1),
// Number(item.balance_sheet.november).toFixed(1),
// Number(item.balance_sheet.december).toFixed(1),
// Number(item.balance_sheet.total_current_year).toFixed(1),
// Number(item.balance_sheet.total_next_year).toFixed(1),
// Number(item.balance_sheet.total_more_year).toFixed(1),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
// ])
// }
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// }
// res.map((item, index) => {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// item.description,
// item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
// Number(item.balance_sheet.january).toFixed(1),
// Number(item.balance_sheet.february).toFixed(1),
// Number(item.balance_sheet.march).toFixed(1),
// Number(item.balance_sheet.april).toFixed(1),
// Number(item.balance_sheet.may).toFixed(1),
// Number(item.balance_sheet.june).toFixed(1),
// Number(item.balance_sheet.july).toFixed(1),
// Number(item.balance_sheet.august).toFixed(1),
// Number(item.balance_sheet.september).toFixed(1),
// Number(item.balance_sheet.october).toFixed(1),
// Number(item.balance_sheet.november).toFixed(1),
// Number(item.balance_sheet.december).toFixed(1),
// Number(item.balance_sheet.total_current_year).toFixed(1),
// Number(item.balance_sheet.total_next_year).toFixed(1),
// Number(item.balance_sheet.total_more_year).toFixed(1),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
// ])
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// })
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
// } else {
// this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
// }
})
}
}
......@@ -463,7 +551,7 @@ export default class SubHolding extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report DB Balance Sheet.xlsx';
a.download = 'Report DB Profit & Loss Detail.xlsx';
a.click();
}
} else if (this.state.report.value === 2) {
......@@ -479,7 +567,7 @@ export default class SubHolding extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Report DB Profit & Loss Detail.xlsx';
a.download = 'Report DB Balance Sheet.xlsx';
a.click();
}
} else if (this.state.report.value === 3) {
......@@ -495,6 +583,19 @@ export default class SubHolding extends Component {
a.download = 'Report DB Profit & Loss.xlsx';
a.click();
}
} else if (this.state.report.value === 4) {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/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();
}
} else {
setTimeout(() => {
this.setState({ loading: false })
......
This diff is collapsed.
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