Commit fded77b5 authored by Riri Novita's avatar Riri Novita

plid

parent c19c236d
...@@ -245,6 +245,7 @@ const create = (type = "") => { ...@@ -245,6 +245,7 @@ const create = (type = "") => {
const getHierarkiCreateReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body) const getHierarkiCreateReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body)
const createReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/create_submission_report', body) const createReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/create_submission_report', body)
const createReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/create_monthly_report', body) const createReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/create_monthly_report', body)
const getPLID = (body) => api.post('/transaction/db_profit_loss/get_profit_loss_id', body)
// const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body) // const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
// const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body) // const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body) const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body)
...@@ -633,7 +634,8 @@ const create = (type = "") => { ...@@ -633,7 +634,8 @@ const create = (type = "") => {
getHierarkiCreateReportPLMB, getHierarkiCreateReportPLMB,
getHierarkiCreateReportPLMR, getHierarkiCreateReportPLMR,
createReportPLMB, createReportPLMB,
createReportPLMR createReportPLMR,
getPLID
} }
} }
......
...@@ -621,7 +621,22 @@ export default class SubHolding extends Component { ...@@ -621,7 +621,22 @@ export default class SubHolding extends Component {
} }
}) })
} else if (this.state.report.value === 3) { } else if (this.state.report.value === 3) {
let payloads = {...payload, months: this.state.month.month_id, quarter: 0} let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
"company_id": this.state.company.company_id
}
console.log(payloadID);
api.create().getPLID(payloadID).then(response => {
console.log(response);
if (response) {
PLID = response.data.data == null ? null : response.data.data.profit_loss_id
} else {
PLID = null
}
this.setState({ PLID }, () => {
let payloads = {...payload, submission_id: this.state.PLID, months: this.state.month.month_id, quarter: 0}
console.log(payloads);
api.create().getReportPL(payloads).then(response => { api.create().getReportPL(payloads).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -796,6 +811,8 @@ export default class SubHolding extends Component { ...@@ -796,6 +811,8 @@ export default class SubHolding extends Component {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
}) })
})
})
} else if (this.state.report.value === 4) { } else if (this.state.report.value === 4) {
api.create().getReportHierarkiFRMB(payload).then(response => { api.create().getReportHierarkiFRMB(payload).then(response => {
// console.log(payload); // console.log(payload);
...@@ -2715,7 +2732,7 @@ export default class SubHolding extends Component { ...@@ -2715,7 +2732,7 @@ export default class SubHolding extends Component {
} }
} else if (this.state.report.value === 3) { } else if (this.state.report.value === 3) {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_profit_loss/export_report?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.revisionType}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_profit_loss/export_report?submission_id=${this.state.PLID === null ? "" : this.state.PLID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}`
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
......
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