Commit cb98c5b4 authored by Riri Novita's avatar Riri Novita

Rollback Code MR Simulasi

parent fe5af8aa
......@@ -214,7 +214,7 @@ export default class CashFlowMR extends Component {
}
}
payloadCF(dataTable2, trigger) {
payloadCF(dataTable2) {
let listCF = []
console.log(dataTable2)
dataTable2.map((item, index) => {
......@@ -232,10 +232,10 @@ export default class CashFlowMR extends Component {
// }
})
this.createCashFlow(listCF, trigger)
this.createCashFlow(listCF)
}
createCashFlow(listCF, trigger) {
createCashFlow(listCF) {
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
......@@ -246,7 +246,7 @@ export default class CashFlowMR extends Component {
"currency_id": this.props.defaultCurrency.id,
"cash_flow": listCF
}
this.props.createCashFlow(payload, trigger)
this.props.createCashFlow(payload)
}
render() {
......@@ -766,29 +766,6 @@ export default class CashFlowMR extends Component {
</button>
</div>
<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.payloadCF(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.state.viewOnly &&
<button
type="button"
......
......@@ -685,7 +685,7 @@ export default class MonthlyReport extends Component {
})
}
getMonthlyReportID(type, trigger) {
getMonthlyReportID(type) {
this.setState({ selectReport: [], isCheckAll: false }, () => {
let payload = {
"company_id": this.state.company.company_id,
......@@ -730,7 +730,7 @@ export default class MonthlyReport extends Component {
}
// this.getPL(type)
if (type != undefined && type == 'PL') {
this.getPL(type, trigger)
this.getPL(type)
} else if (type != undefined && type == 'LOCF') {
let bodyRatioLocf = {
"report": 'ratio',
......@@ -740,17 +740,10 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"currency_id": this.state.defaultCurrency.id
}
if (trigger == "simulasiLOCF") {
api.create().triggerHistoricalRatioSimulasi(bodyRatioLocf).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
api.create().triggerHistoricalRatio(bodyRatioLocf).then((res) => {
console.log(res)
this.setState({ loading: false })
})
}
api.create().triggerHistoricalRatio(bodyRatioLocf).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else if (type != undefined && type == 'BS') {
let bodyRatioBs = {
"report": 'ratio',
......@@ -760,17 +753,10 @@ export default class MonthlyReport extends Component {
"months": this.state.month.month_id,
"currency_id": this.state.defaultCurrency.id
}
if (trigger === 'simulasiBS') {
api.create().triggerRatioFromLOCFSimulasi(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
api.create().triggerRatioFromLOCF(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
}
api.create().triggerRatioFromLOCF(bodyRatioBs).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
this.setState({ loading: false })
}
......@@ -856,8 +842,7 @@ export default class MonthlyReport extends Component {
})
}
saveToMonthlyReport(type, trigger) {
console.log(trigger);
saveToMonthlyReport(type) {
this.setState({
visibleMonthlyReport: true,
loading: true,
......@@ -870,7 +855,7 @@ export default class MonthlyReport extends Component {
visibleLOCF: false,
visibleOI: false,
}, () => {
this.getMonthlyReportID(type, trigger)
this.getMonthlyReportID(type)
})
}
......@@ -1543,22 +1528,15 @@ export default class MonthlyReport extends Component {
})
}
createCashFlow(payload, trigger) {
createCashFlow(payload) {
console.log(JSON.stringify(payload))
if (trigger === "simulasi") {
api.create().uploadSimulasiMRCF(payload).then((res) => {
this.saveToMonthlyReport()
console.log(res)
})
} else {
api.create().createMonthlyReportCF(payload).then((res) => {
this.saveToMonthlyReport()
console.log(res)
})
}
api.create().createMonthlyReportCF(payload).then((res) => {
this.saveToMonthlyReport()
console.log(res)
})
}
getPL(type, trigger) {
getPL(type) {
let PLID = null
let payloadID = {
"periode": this.state.periode.periode,
......@@ -1683,7 +1661,7 @@ export default class MonthlyReport extends Component {
console.log(JSON.stringify(dataTable))
console.log(dataTable)
this.setState({ dbPL: dataTable }, () => {
this.olahDataPL(this.state.dbPL, type, trigger)
this.olahDataPL(this.state.dbPL, type)
})
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -1919,7 +1897,7 @@ export default class MonthlyReport extends Component {
}
olahDataPL(dbPL, type, trigger) {
olahDataPL(dbPL, type) {
dbPL.map((item, index) => {
if (item[0] == 5 || item[0] == 6) {
item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
......@@ -1928,11 +1906,11 @@ export default class MonthlyReport extends Component {
})
// console.log(dbPL)
this.setState({ dbPL }, () => {
this.payloadPL(type, trigger)
this.payloadPL(type)
})
}
payloadPL(type, trigger) {
payloadPL(type) {
let listPL = []
this.state.dbPL.map((item, index) => {
// if (item[6].value == "" || item[6].value == 0 || item[6].value == "0.0") {
......@@ -1961,14 +1939,14 @@ export default class MonthlyReport extends Component {
// console.log(this.state.dbPL)
// this.setState({ loading: false })
console.log('tarik sis')
this.createPL(trigger)
this.createPL()
}
}
})
}
createPL(trigger) {
console.log(trigger);
createPL() {
console.log();
let payload = {
// "monthly_report_id": this.state.monthlyReportId,
"company_id": this.state.company.company_id,
......@@ -1981,32 +1959,25 @@ export default class MonthlyReport extends Component {
"profit_loss_mr": this.state.dbPL,
"currency_id": this.state.defaultCurrency.id
}
if (trigger === "simulasiPL") {
api.create().createSimulasiReportPLMR(payload).then((res) => {
console.log(res)
this.setState({ loading: false })
})
} else {
api.create().createReportPLMR(payload).then((res) => {
console.log(res)
// console.log(this.state.dbPL)
this.setState({ loading: false })
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
// } else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ loading: false }, () => {
// // this.getSubmission()
// document.body.style.overflow = 'unset';
// })
// }
})
}
api.create().createReportPLMR(payload).then((res) => {
console.log(res)
// console.log(this.state.dbPL)
this.setState({ loading: false })
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
// } else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ loading: false }, () => {
// // this.getSubmission()
// document.body.style.overflow = 'unset';
// })
// }
})
}
getFR(type) {
......
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