Commit 73e8675b authored by Riri Novita's avatar Riri Novita

balikin code simulasi MB

parent 4fb1c8bf
This diff is collapsed.
...@@ -614,8 +614,7 @@ export default class BudgetTahunan extends Component { ...@@ -614,8 +614,7 @@ export default class BudgetTahunan extends Component {
}) })
} }
getSubmission(type, trigger) { getSubmission(type) {
console.log(trigger);
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
}) })
...@@ -668,22 +667,8 @@ export default class BudgetTahunan extends Component { ...@@ -668,22 +667,8 @@ export default class BudgetTahunan extends Component {
} }
if (type != undefined && type == 'PL') { if (type != undefined && type == 'PL') {
// this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type, trigger) this.getPL(type)
} else if (type != undefined && type == 'BS') { } else if (type != undefined && type == 'BS') {
if (trigger === 'simulasiBS') {
let bodyRatioBs = {
"report": 'ratio',
"submissionId": this.state.submissionID,
"periode": this.state.periode.periode,
"companyId": this.state.company.company_id,
"currency_id": this.state.defaultCurrency.id,
}
// console.log(bodyRatioBs);
api.create().triggerRatioMBSimulasi(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
let bodyRatioBs = { let bodyRatioBs = {
"report": 'ratio', "report": 'ratio',
"submissionId": this.state.submissionID, "submissionId": this.state.submissionID,
...@@ -696,7 +681,6 @@ export default class BudgetTahunan extends Component { ...@@ -696,7 +681,6 @@ export default class BudgetTahunan extends Component {
console.log(res) console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
}) })
}
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
} }
...@@ -1320,26 +1304,7 @@ export default class BudgetTahunan extends Component { ...@@ -1320,26 +1304,7 @@ export default class BudgetTahunan extends Component {
}) })
} }
createCashFlow(payload, trigger) { createCashFlow(payload) {
console.log(trigger);
if (trigger === "simulasi") {
api.create().createReportCFSimulasi(payload).then((res) => {
console.log(res)
// this.getSubmission()
if (res.data) {
if (res.data.status === "success") {
this.setState({ visibleCF: false, visibleBudgetTahunan: true })
this.getSubmission()
} else {
if (res.data.message == "Please Set Up Rate Currency First") {
this.setState({ visibleAlertSave: true })
} else {
this.setState({ alert: true, messageAlert: res.data.message, tipeAlert: 'warning', loading: false })
}
}
}
})
} else {
api.create().createReportCF(payload).then((res) => { api.create().createReportCF(payload).then((res) => {
console.log(res) console.log(res)
// this.getSubmission() // this.getSubmission()
...@@ -1371,9 +1336,8 @@ export default class BudgetTahunan extends Component { ...@@ -1371,9 +1336,8 @@ export default class BudgetTahunan extends Component {
// } // }
}) })
} }
}
getPL(type, trigger) { getPL(type) {
let PLID = null let PLID = null
let payloadID = { let payloadID = {
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
...@@ -1484,7 +1448,7 @@ export default class BudgetTahunan extends Component { ...@@ -1484,7 +1448,7 @@ export default class BudgetTahunan extends Component {
}) })
// console.log(dataTable) // console.log(dataTable)
this.setState({ dbPL: dataTable }, () => { this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type, trigger) this.olahDataPL(this.state.dbPL, type)
}) })
} else { } else {
this.setState({ dbPL: [], previewTable: false, previewDownload: false }) this.setState({ dbPL: [], previewTable: false, previewDownload: false })
...@@ -1723,7 +1687,7 @@ export default class BudgetTahunan extends Component { ...@@ -1723,7 +1687,7 @@ export default class BudgetTahunan extends Component {
return total return total
} }
olahDataPL(dbPL, type, trigger) { olahDataPL(dbPL, type) {
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)
...@@ -1743,11 +1707,11 @@ export default class BudgetTahunan extends Component { ...@@ -1743,11 +1707,11 @@ export default class BudgetTahunan extends Component {
} }
}) })
this.setState({ dbPL }, () => { this.setState({ dbPL }, () => {
this.payloadPL(type, trigger) this.payloadPL(type)
}) })
} }
payloadPL(type, trigger) { payloadPL(type) {
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) => {
...@@ -1842,14 +1806,13 @@ export default class BudgetTahunan extends Component { ...@@ -1842,14 +1806,13 @@ export default class BudgetTahunan extends Component {
if (type != undefined) { if (type != undefined) {
if (type == 'PL') { if (type == 'PL') {
// console.log('tarik sis') // console.log('tarik sis')
this.createDBPL(trigger) this.createDBPL()
} }
} }
}) })
} }
createDBPL(trigger) { createDBPL() {
console.log(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,
...@@ -1863,12 +1826,6 @@ export default class BudgetTahunan extends Component { ...@@ -1863,12 +1826,6 @@ export default class BudgetTahunan extends Component {
} }
// console.log(this.state.dbCF) // console.log(this.state.dbCF)
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
if (trigger === "simulasiPL") {
api.create().createReportPLMBSimulasi(payload).then((res) => {
// console.log(res)
this.setState({ loading: false })
})
} else {
api.create().createReportPLMB(payload).then((res) => { api.create().createReportPLMB(payload).then((res) => {
// console.log(res) // console.log(res)
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -1888,7 +1845,6 @@ export default class BudgetTahunan extends Component { ...@@ -1888,7 +1845,6 @@ export default class BudgetTahunan extends Component {
// } // }
}) })
} }
}
getFR(type) { getFR(type) {
// console.log("get FR"); // console.log("get FR");
......
...@@ -336,7 +336,7 @@ export default class CashFlow extends Component { ...@@ -336,7 +336,7 @@ export default class CashFlow extends Component {
this.setState({ alert: false }) this.setState({ alert: false })
} }
olahDataCashFlow(dataTable2, trigger) { olahDataCashFlow(dataTable2) {
console.log(dataTable2) console.log(dataTable2)
let listCF = [] let listCF = []
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
...@@ -373,10 +373,10 @@ export default class CashFlow extends Component { ...@@ -373,10 +373,10 @@ export default class CashFlow extends Component {
}) })
console.log(listCF) console.log(listCF)
this.createCashFlow(listCF, trigger) this.createCashFlow(listCF)
} }
createCashFlow(dbcf, trigger) { createCashFlow(dbcf) {
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -388,7 +388,7 @@ export default class CashFlow extends Component { ...@@ -388,7 +388,7 @@ export default class CashFlow extends Component {
} }
console.log(dbcf) console.log(dbcf)
console.log(JSON.stringify(payload)) console.log(JSON.stringify(payload))
this.props.createCashFlow(payload, trigger) this.props.createCashFlow(payload)
// this.props.onClickClose() // this.props.onClickClose()
} }
...@@ -3340,29 +3340,6 @@ export default class CashFlow extends Component { ...@@ -3340,29 +3340,6 @@ export default class CashFlow extends Component {
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.olahDataCashFlow(dataTable2, "simulasi")
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 15
}}
>
<div style={{ backgroundColor: '#cd5c5c', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data Simulasi</Typography>
</div>
</button>
{this.props.isApprover === true || dataTable2.length == 0 ? null : {this.props.isApprover === true || dataTable2.length == 0 ? null :
(!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? (!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
<button <button
......
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