Commit fa841b04 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

update130723

See merge request !1896
parents 9d4d0578 6d676279
...@@ -4118,10 +4118,10 @@ export default class SubHolding extends Component { ...@@ -4118,10 +4118,10 @@ export default class SubHolding extends Component {
a.click(); a.click();
} }
} else if (this.state.report.value === 4) { } else if (this.state.report.value === 4) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_ratio/export_report?submission_id=${this.state.FRID === null ? "" : this.state.FRID}&&report_id=29&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_ratio/export_report?submission_id=${this.state.FRID === null ? "" : this.state.FRID}&&report_id=29&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}&&currency_id=${this.state.defaultCurrency.id}`
console.log(url); console.log(url);
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_ratio/export_report?submission_id=${this.state.FRID === null ? "" : this.state.FRID}&&report_id=29&&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_ratio/export_report?submission_id=${this.state.FRID === null ? "" : this.state.FRID}&&report_id=29&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}&&currency_id=${this.state.defaultCurrency.id}`
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -4161,10 +4161,10 @@ export default class SubHolding extends Component { ...@@ -4161,10 +4161,10 @@ export default class SubHolding extends Component {
a.click(); a.click();
} }
} else if (this.state.report.value === 6) { } else if (this.state.report.value === 6) {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_cash_flow/export_report?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=6&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}&&months=${this.state.month.month_id}&&quarter=1` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_cash_flow/export_report?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=6&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}&&months=${this.state.month.month_id}&&quarter=1&&currency_id=${this.state.defaultCurrency.id}`
console.log(url); console.log(url);
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_cash_flow/export_report?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=6&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}&&months=${this.state.month.month_id}&&quarter=1` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_cash_flow/export_report?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=6&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.revisionType}&&months=${this.state.month.month_id}&&quarter=1&&currency_id=${this.state.defaultCurrency.id}`
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false }) this.setState({ loading: false })
......
...@@ -286,7 +286,7 @@ export default class CashFlow extends Component { ...@@ -286,7 +286,7 @@ export default class CashFlow extends Component {
this.setState({ alert: false }) this.setState({ alert: false })
} }
olahDataCashFlow(dataTable2) { olahDataCashFlow(dataTable2, trigger) {
console.log(dataTable2) console.log(dataTable2)
let listCF = [] let listCF = []
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
...@@ -339,10 +339,10 @@ export default class CashFlow extends Component { ...@@ -339,10 +339,10 @@ export default class CashFlow extends Component {
}) })
console.log(listCF) console.log(listCF)
this.createCashFlow(listCF) this.createCashFlow(listCF, trigger)
} }
createCashFlow(dbcf) { createCashFlow(dbcf, trigger) {
let payload = { let payload = {
"rolling_outlook_id": this.props.rollingOutlookID, "rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -355,41 +355,45 @@ export default class CashFlow extends Component { ...@@ -355,41 +355,45 @@ export default class CashFlow extends Component {
} }
console.log(dbcf) console.log(dbcf)
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
api.create().createRollingOutlookCF(payload).then(response => { if (trigger === "simulasi") {
console.log(payload);
console.log(response); } else {
// console.log(JSON.stringify(payload)) api.create().createRollingOutlookCF(payload).then(response => {
if (response.data) { console.log(payload);
if (response.data.status === "success") { console.log(response);
this.props.onClickClose() // console.log(JSON.stringify(payload))
this.props.refresh() if (response.data) {
} else { if (response.data.status === "success") {
if (response.data?.message == "Please Set Up Rate Currency First") { this.props.onClickClose()
this.setState({ visibleAlertSave: true, loading: false }) this.props.refresh()
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => { if (response.data?.message == "Please Set Up Rate Currency First") {
document.body.style.overflow = 'unset'; this.setState({ visibleAlertSave: true, loading: false })
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { } else {
setTimeout(() => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
localStorage.removeItem(Constant.TOKEN) document.body.style.overflow = 'unset';
window.location.reload(); if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
}, 1000); setTimeout(() => {
} localStorage.removeItem(Constant.TOKEN)
this.props.onClickClose() window.location.reload();
this.props.refresh() }, 1000);
}) }
this.props.onClickClose()
this.props.refresh()
})
}
} }
// else {
// this.setState({ loading: false, handleDoubleClick: 0 }, () => {
// this.props.onClickClose()
// this.props.refresh()
// })
// }
} else {
this.setState({ loading: false, handleDoubleClick: 0 })
} }
// else { })
// this.setState({ loading: false, handleDoubleClick: 0 }, () => { }
// this.props.onClickClose()
// this.props.refresh()
// })
// }
} else {
this.setState({ loading: false, handleDoubleClick: 0 })
}
})
this.props.onClickClose() this.props.onClickClose()
this.props.refresh() this.props.refresh()
} }
...@@ -2228,7 +2232,7 @@ export default class CashFlow extends Component { ...@@ -2228,7 +2232,7 @@ export default class CashFlow extends Component {
// : // :
this.state.handleDoubleClick == 1 ? null : this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => { this.setState({ handleDoubleClick: 1 }, () => {
this.olahDataCashFlow(dataTable2) this.olahDataCashFlow(dataTable2, "simulasi")
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
......
...@@ -606,7 +606,7 @@ export default class RollingOutlook extends Component { ...@@ -606,7 +606,7 @@ export default class RollingOutlook extends Component {
}) })
} }
getRollingOutlookID(type) { getRollingOutlookID(type, trigger) {
this.setState({ loading: true }) this.setState({ loading: true })
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
...@@ -653,7 +653,7 @@ export default class RollingOutlook extends Component { ...@@ -653,7 +653,7 @@ export default class RollingOutlook extends Component {
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
// this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type) this.getPL(type, trigger)
} else if (type != undefined && type == 'BS') { } else if (type != undefined && type == 'BS') {
let bodyRatioBs = { let bodyRatioBs = {
"report": 'ratio', "report": 'ratio',
...@@ -1017,7 +1017,7 @@ export default class RollingOutlook extends Component { ...@@ -1017,7 +1017,7 @@ export default class RollingOutlook extends Component {
} }
} }
getPL(type) { getPL(type, trigger) {
let PLID = null let PLID = null
let payloadID = { let payloadID = {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
...@@ -1128,7 +1128,7 @@ export default class RollingOutlook extends Component { ...@@ -1128,7 +1128,7 @@ export default class RollingOutlook extends Component {
}) })
// console.log(dataTable) // console.log(dataTable)
this.setState({ dbPL: dataTable }, () => { this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type) this.olahDataPL(this.state.dbPL, type, trigger)
}) })
} else { } else {
this.setState({ dbPL: [], previewTable: false, previewDownload: false }) this.setState({ dbPL: [], previewTable: false, previewDownload: false })
...@@ -1367,7 +1367,7 @@ export default class RollingOutlook extends Component { ...@@ -1367,7 +1367,7 @@ export default class RollingOutlook extends Component {
return total return total
} }
olahDataPL(dbPL, type) { olahDataPL(dbPL, type, trigger) {
dbPL.map((item, index) => { dbPL.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) { if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
item[7].value = this.handleValueFormulaDBPL(index, item[7], item, 7) item[7].value = this.handleValueFormulaDBPL(index, item[7], item, 7)
...@@ -1387,11 +1387,11 @@ export default class RollingOutlook extends Component { ...@@ -1387,11 +1387,11 @@ export default class RollingOutlook extends Component {
} }
}) })
this.setState({ dbPL }, () => { this.setState({ dbPL }, () => {
this.payloadPL(type) this.payloadPL(type, trigger)
}) })
} }
payloadPL(type) { payloadPL(type, trigger) {
let listPL = [] let listPL = []
// console.log(this.state.dbPL) // console.log(this.state.dbPL)
this.state.dbPL.map((item, index) => { this.state.dbPL.map((item, index) => {
...@@ -1486,13 +1486,13 @@ export default class RollingOutlook extends Component { ...@@ -1486,13 +1486,13 @@ export default class RollingOutlook extends Component {
if (type != undefined) { if (type != undefined) {
if (type == 'PL') { if (type == 'PL') {
console.log('tarik sis') console.log('tarik sis')
this.createDBPL() this.createDBPL(trigger)
} }
} }
}) })
} }
createDBPL() { createDBPL(trigger) {
let payload = { let payload = {
// "submission_id": this.state.submissionID, // "submission_id": this.state.submissionID,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
...@@ -1506,10 +1506,14 @@ export default class RollingOutlook extends Component { ...@@ -1506,10 +1506,14 @@ export default class RollingOutlook extends Component {
} }
console.log(this.state.dbPL) console.log(this.state.dbPL)
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().createDBPLRO(payload).then((res) => { if (trigger === 'simulasiPL') {
console.log(res)
this.setState({ loading: false }) } else {
}) api.create().createDBPLRO(payload).then((res) => {
console.log(res)
this.setState({ loading: false })
})
}
} }
handleApproveAdmin() { handleApproveAdmin() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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