Commit debe6a8c authored by d.arizona's avatar d.arizona

update banyak

parent 8c7b235e
...@@ -533,9 +533,10 @@ export default class BudgetTahunan extends Component { ...@@ -533,9 +533,10 @@ export default class BudgetTahunan extends Component {
// // console.log(this.state.btnApprove) // // console.log(this.state.btnApprove)
this.historyApproval() this.historyApproval()
this.getLatestPeriodSubmit() this.getLatestPeriodSubmit()
this.getCashFlow(type) // this.getCashFlow(type)
// this.getPL(type)
if (type != undefined) { if (type != undefined) {
this.getCashFlow(type) // this.getCashFlow(type)
this.getPL(type) this.getPL(type)
} else { } else {
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -1032,68 +1033,11 @@ export default class BudgetTahunan extends Component { ...@@ -1032,68 +1033,11 @@ export default class BudgetTahunan extends Component {
listCF.push(item) listCF.push(item)
}) })
this.setState({dbCF: listCF}, () => {
this.payloadCFOneMore(listCF, type)
})
}
payloadCFOneMore(list, type) {
let listCF = []
this.state.dbCF.map((item, index) => {
if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
item[7].value = this.handleValueFormula(index, item[7], item, 7)
item[8].value = this.handleValueFormula(index, item[8], item, 8)
item[9].value = this.handleValueFormula(index, item[9], item, 9)
item[10].value = this.handleValueFormula(index, item[10], item, 10)
item[11].value = this.handleValueFormula(index, item[11], item, 11)
item[12].value = this.handleValueFormula(index, item[12], item, 12)
item[13].value = this.handleValueFormula(index, item[13], item, 13)
item[14].value = this.handleValueFormula(index, item[14], item, 14)
item[15].value = this.handleValueFormula(index, item[15], item, 15)
item[16].value = this.handleValueFormula(index, item[16], item, 16)
item[17].value = this.handleValueFormula(index, item[17], item, 17)
item[18].value = this.handleValueFormula(index, item[18], item, 18)
item[19] = this.handleForecast(index, item, `${Number(this.state.periode.periode)}`, 19)
item[20] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 1}`, 20)
item[21] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 2}`, 21)
}
listCF.push(item)
})
this.setState({dbCF: listCF}, () => { this.setState({dbCF: listCF}, () => {
this.olahDataCashFlowOneMore(listCF, type) this.olahDataCashFlowOneMore(listCF, type)
}) })
} }
// payloadCFOneMoreAgain(list, type) {
// let listCF = []
// this.state.dbCF.map((item, index) => {
// if (item[0] == 5 || item[0] == 6 || item[0] == 7) {
// item[7].value = this.handleValueFormula(index, item[7], item, 7)
// item[8].value = this.handleValueFormula(index, item[8], item, 8)
// item[9].value = this.handleValueFormula(index, item[9], item, 9)
// item[10].value = this.handleValueFormula(index, item[10], item, 10)
// item[11].value = this.handleValueFormula(index, item[11], item, 11)
// item[12].value = this.handleValueFormula(index, item[12], item, 12)
// item[13].value = this.handleValueFormula(index, item[13], item, 13)
// item[14].value = this.handleValueFormula(index, item[14], item, 14)
// item[15].value = this.handleValueFormula(index, item[15], item, 15)
// item[16].value = this.handleValueFormula(index, item[16], item, 16)
// item[17].value = this.handleValueFormula(index, item[17], item, 17)
// item[18].value = this.handleValueFormula(index, item[18], item, 18)
// item[19] = this.handleForecast(index, item, `${Number(this.state.periode.periode)}`, 19)
// item[20] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 1}`, 20)
// item[21] = this.handleForecast(index, item, `${Number(this.state.periode.periode) + 2}`, 21)
// }
// listCF.push(item)
// })
// this.setState({dbCF: listCF}, () => {
// this.olahDataCashFlowOneMore(listCF, type)
// })
// }
olahDataCashFlowOneMore(list, type) { olahDataCashFlowOneMore(list, type) {
console.log(list) console.log(list)
let listCF = [] let listCF = []
...@@ -1200,26 +1144,16 @@ export default class BudgetTahunan extends Component { ...@@ -1200,26 +1144,16 @@ export default class BudgetTahunan extends Component {
// if (type != undefined) { // if (type != undefined) {
// if (type == 'BS' || type == 'FAM' || type == 'PL') { // if (type == 'BS' || type == 'FAM' || type == 'PL') {
console.log('tarik sis') console.log('tarik sis')
this.createCashFlow() // this.createCashFlow()
// } // }
// } // }
}) })
} }
createCashFlow() { createCashFlow(payload) {
let payload = {
"submission_id": this.state.submissionID,
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
"report_id": 6,
"status": "submitted",
"cash_flow": this.state.dbCF
}
console.log(this.state.dbCF)
console.log(JSON.stringify(payload))
api.create().createReportCF(payload).then((res) => { api.create().createReportCF(payload).then((res) => {
this.setState({ loading: false })
console.log(res) console.log(res)
this.getSubmission()
// if (response.data) { // if (response.data) {
// if (response.data.status === "success") { // if (response.data.status === "success") {
// this.props.saveToMonthlyReport() // this.props.saveToMonthlyReport()
...@@ -1345,7 +1279,7 @@ export default class BudgetTahunan extends Component { ...@@ -1345,7 +1279,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) this.olahDataPL(this.state.dbPL, type)
}) })
...@@ -1558,6 +1492,13 @@ export default class BudgetTahunan extends Component { ...@@ -1558,6 +1492,13 @@ export default class BudgetTahunan extends Component {
} }
}) })
if(String(tableMeta[5]) == "Cost of Goods Sold (COGS)" && column == 20) {
console.log(splitFormula)
console.log(baru)
console.log(anjay)
console.log(anjay2)
console.log(total)
}
total = R.equals(total, NaN) ? "0.0" : total total = R.equals(total, NaN) ? "0.0" : total
return total return total
} }
...@@ -1573,7 +1514,7 @@ export default class BudgetTahunan extends Component { ...@@ -1573,7 +1514,7 @@ export default class BudgetTahunan extends Component {
} }
}) })
} else { } else {
total = this.handleValueFormulaDBPL(dataTable2[index][column], tableMeta, column, periode, dataTable2[index][25]) total = this.handleValueFormulaDBPL(dataTable2[index][column], tableMeta[column], tableMeta, column, periode, dataTable2[index][25])
} }
return total return total
...@@ -3069,6 +3010,7 @@ export default class BudgetTahunan extends Component { ...@@ -3069,6 +3010,7 @@ export default class BudgetTahunan extends Component {
lastStatus={this.state.lastStatus} lastStatus={this.state.lastStatus}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
PLBSFAMSubmitted={this.state.PLBSFAMSubmitted} PLBSFAMSubmitted={this.state.PLBSFAMSubmitted}
createCashFlow={this.createCashFlow.bind(this)}
/> />
) )
} }
......
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