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 {
a.click();
}
} 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);
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()
this.setState({ loading: false })
......@@ -4161,10 +4161,10 @@ export default class SubHolding extends Component {
a.click();
}
} 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);
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()
this.setState({ loading: false })
......
......@@ -286,7 +286,7 @@ export default class CashFlow extends Component {
this.setState({ alert: false })
}
olahDataCashFlow(dataTable2) {
olahDataCashFlow(dataTable2, trigger) {
console.log(dataTable2)
let listCF = []
dataTable2.map((item, index) => {
......@@ -339,10 +339,10 @@ export default class CashFlow extends Component {
})
console.log(listCF)
this.createCashFlow(listCF)
this.createCashFlow(listCF, trigger)
}
createCashFlow(dbcf) {
createCashFlow(dbcf, trigger) {
let payload = {
"rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id,
......@@ -355,41 +355,45 @@ export default class CashFlow extends Component {
}
console.log(dbcf)
console.log(JSON.stringify(payload))
api.create().createRollingOutlookCF(payload).then(response => {
console.log(payload);
console.log(response);
// console.log(JSON.stringify(payload))
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.refresh()
} else {
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
if (trigger === "simulasi") {
} else {
api.create().createRollingOutlookCF(payload).then(response => {
console.log(payload);
console.log(response);
// console.log(JSON.stringify(payload))
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.refresh()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
this.props.onClickClose()
this.props.refresh()
})
if (response.data?.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true, loading: false })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 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.refresh()
}
......@@ -2228,7 +2232,7 @@ export default class CashFlow extends Component {
// :
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.olahDataCashFlow(dataTable2)
this.olahDataCashFlow(dataTable2, "simulasi")
})}
style={{
backgroundColor: 'transparent',
......
......@@ -606,7 +606,7 @@ export default class RollingOutlook extends Component {
})
}
getRollingOutlookID(type) {
getRollingOutlookID(type, trigger) {
this.setState({ loading: true })
let payload = {
"company_id": this.state.company.company_id,
......@@ -653,7 +653,7 @@ export default class RollingOutlook extends Component {
this.getLatestPeriodSubmit()
if (type != undefined && type == 'PL') {
// this.getCashFlow(type)
this.getPL(type)
this.getPL(type, trigger)
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
......@@ -1017,7 +1017,7 @@ export default class RollingOutlook extends Component {
}
}
getPL(type) {
getPL(type, trigger) {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
......@@ -1128,7 +1128,7 @@ export default class RollingOutlook extends Component {
})
// console.log(dataTable)
this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type)
this.olahDataPL(this.state.dbPL, type, trigger)
})
} else {
this.setState({ dbPL: [], previewTable: false, previewDownload: false })
......@@ -1367,7 +1367,7 @@ export default class RollingOutlook extends Component {
return total
}
olahDataPL(dbPL, type) {
olahDataPL(dbPL, type, trigger) {
dbPL.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
item[7].value = this.handleValueFormulaDBPL(index, item[7], item, 7)
......@@ -1387,11 +1387,11 @@ export default class RollingOutlook extends Component {
}
})
this.setState({ dbPL }, () => {
this.payloadPL(type)
this.payloadPL(type, trigger)
})
}
payloadPL(type) {
payloadPL(type, trigger) {
let listPL = []
// console.log(this.state.dbPL)
this.state.dbPL.map((item, index) => {
......@@ -1486,13 +1486,13 @@ export default class RollingOutlook extends Component {
if (type != undefined) {
if (type == 'PL') {
console.log('tarik sis')
this.createDBPL()
this.createDBPL(trigger)
}
}
})
}
createDBPL() {
createDBPL(trigger) {
let payload = {
// "submission_id": this.state.submissionID,
"company_id": this.state.company.company_id,
......@@ -1506,10 +1506,14 @@ export default class RollingOutlook extends Component {
}
console.log(this.state.dbPL)
// console.log(JSON.stringify(payload))
api.create().createDBPLRO(payload).then((res) => {
console.log(res)
this.setState({ loading: false })
})
if (trigger === 'simulasiPL') {
} else {
api.create().createDBPLRO(payload).then((res) => {
console.log(res)
this.setState({ loading: false })
})
}
}
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