Commit 5ab0ef4d authored by Riri Novita's avatar Riri Novita

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

Rollback Code MR Simulasi

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