Commit b76eabbb authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !1098
parents ec7103c4 dd8f6eca
...@@ -1617,7 +1617,7 @@ export default class BudgetTahunan extends Component { ...@@ -1617,7 +1617,7 @@ export default class BudgetTahunan extends Component {
"revision": Number(this.state.lastRevision), "revision": Number(this.state.lastRevision),
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"submission_id": this.state.FRID, "submission_id": this.state.submissionID,
} }
api.create().getHierarkiCreateReportFRMB(payload).then(response => { api.create().getHierarkiCreateReportFRMB(payload).then(response => {
// console.log(response); // console.log(response);
...@@ -1627,6 +1627,9 @@ export default class BudgetTahunan extends Component { ...@@ -1627,6 +1627,9 @@ export default class BudgetTahunan extends Component {
console.log(response) console.log(response)
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
if (item.description == 'Return on Invested Capital - YTD (ROIC)') {
console.log(item.ratio.january)
}
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -1635,22 +1638,22 @@ export default class BudgetTahunan extends Component { ...@@ -1635,22 +1638,22 @@ export default class BudgetTahunan extends Component {
item.level, item.level,
item.description, item.description,
item.uom, item.uom,
"", // "",
// item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before, // item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
Number(item.ratio.january).toFixed(1), Number(item.ratio.january).toFixed(2),
Number(item.ratio.february).toFixed(1), Number(item.ratio.february).toFixed(2),
Number(item.ratio.march).toFixed(1), Number(item.ratio.march).toFixed(2),
Number(item.ratio.april).toFixed(1), Number(item.ratio.april).toFixed(2),
Number(item.ratio.may).toFixed(1), Number(item.ratio.may).toFixed(2),
Number(item.ratio.june).toFixed(1), Number(item.ratio.june).toFixed(2),
Number(item.ratio.july).toFixed(1), Number(item.ratio.july).toFixed(2),
Number(item.ratio.august).toFixed(1), Number(item.ratio.august).toFixed(2),
Number(item.ratio.september).toFixed(1), Number(item.ratio.september).toFixed(2),
Number(item.ratio.october).toFixed(1), Number(item.ratio.october).toFixed(2),
Number(item.ratio.november).toFixed(1), Number(item.ratio.november).toFixed(2),
Number(item.ratio.december).toFixed(1), Number(item.ratio.december).toFixed(2),
Number(item.ratio.total_next_year).toFixed(1), Number(item.ratio.total_next_year).toFixed(2),
Number(item.ratio.total_more_year).toFixed(1), Number(item.ratio.total_more_year).toFixed(2),
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1670,22 +1673,22 @@ export default class BudgetTahunan extends Component { ...@@ -1670,22 +1673,22 @@ export default class BudgetTahunan extends Component {
item.level, item.level,
item.description, item.description,
item.uom, item.uom,
"", // "",
// item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before, // item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
Number(item.ratio.january).toFixed(1), Number(item.ratio.january).toFixed(2),
Number(item.ratio.february).toFixed(1), Number(item.ratio.february).toFixed(2),
Number(item.ratio.march).toFixed(1), Number(item.ratio.march).toFixed(2),
Number(item.ratio.april).toFixed(1), Number(item.ratio.april).toFixed(2),
Number(item.ratio.may).toFixed(1), Number(item.ratio.may).toFixed(2),
Number(item.ratio.june).toFixed(1), Number(item.ratio.june).toFixed(2),
Number(item.ratio.july).toFixed(1), Number(item.ratio.july).toFixed(2),
Number(item.ratio.august).toFixed(1), Number(item.ratio.august).toFixed(2),
Number(item.ratio.september).toFixed(1), Number(item.ratio.september).toFixed(2),
Number(item.ratio.october).toFixed(1), Number(item.ratio.october).toFixed(2),
Number(item.ratio.november).toFixed(1), Number(item.ratio.november).toFixed(2),
Number(item.ratio.december).toFixed(1), Number(item.ratio.december).toFixed(2),
Number(item.ratio.total_next_year).toFixed(1), Number(item.ratio.total_next_year).toFixed(2),
Number(item.ratio.total_more_year).toFixed(1), Number(item.ratio.total_more_year).toFixed(2),
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -1695,8 +1698,8 @@ export default class BudgetTahunan extends Component { ...@@ -1695,8 +1698,8 @@ export default class BudgetTahunan extends Component {
} }
} }
}) })
console.log(dataTable)
this.setState({ dbFR: dataTable, loading: false }, () => { this.setState({ dbFR: dataTable, loading: false }, () => {
console.log(this.state.dbFR)
this.olahDataFR(this.state.dbFR, type) this.olahDataFR(this.state.dbFR, type)
}) })
} else { } else {
...@@ -1716,17 +1719,19 @@ export default class BudgetTahunan extends Component { ...@@ -1716,17 +1719,19 @@ export default class BudgetTahunan extends Component {
let dataTable2 = this.state.dbFR let dataTable2 = this.state.dbFR
let total = 0 let total = 0
if (month > 12) { if (month > 12) {
total = Number(dataTable2[35][7 + month]) total = Number(dataTable2[35][6 + month])
} else { } else {
for (let index = 0; index < month; index++) { for (let index = 0; index < month; index++) {
total += Number(dataTable2[35][8 + index]) total += Number(dataTable2[35][7 + index])
// console.log(index); // console.log(index);
} }
total = total/month total = total/month
} }
let hasil = Number(value) / total let hasil = Number(value) / total
// console.log(hasil, value, total); console.log(value)
return Number(hasil).toFixed(1) console.log(total)
console.log(hasil, value, total);
return Number(hasil).toFixed(2)
} }
olahDataFR(dbFR, type) { olahDataFR(dbFR, type) {
...@@ -1746,6 +1751,8 @@ export default class BudgetTahunan extends Component { ...@@ -1746,6 +1751,8 @@ export default class BudgetTahunan extends Component {
item[16] = this.handleFormulaRatio(item[16],item,10) item[16] = this.handleFormulaRatio(item[16],item,10)
item[17] = this.handleFormulaRatio(item[17],item,11) item[17] = this.handleFormulaRatio(item[17],item,11)
item[18] = this.handleFormulaRatio(item[18],item,12) item[18] = this.handleFormulaRatio(item[18],item,12)
item[19] = this.handleFormulaRatio(item[19],item,13)
item[20] = this.handleFormulaRatio(item[20],item,14)
// totalCY = Number(item[7]) + Number(item[8]) + Number(item[9]) + Number(item[10]) + Number(item[11]) + Number(item[12]) + Number(item[13]) + Number(item[14]) + Number(item[15]) + Number(item[16]) + Number(item[17]) + Number(item[18]) // totalCY = Number(item[7]) + Number(item[8]) + Number(item[9]) + Number(item[10]) + Number(item[11]) + Number(item[12]) + Number(item[13]) + Number(item[14]) + Number(item[15]) + Number(item[16]) + Number(item[17]) + Number(item[18])
} }
} }
...@@ -1762,40 +1769,42 @@ export default class BudgetTahunan extends Component { ...@@ -1762,40 +1769,42 @@ export default class BudgetTahunan extends Component {
this.state.dbFR.map((item,index) => { this.state.dbFR.map((item,index) => {
if (item[0] != 4 || item[0] != 1) { if (item[0] != 4 || item[0] != 1) {
if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) { if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) {
item[7] = this.handleFormulaRatio(item[7],item,1) // item[7] = this.handleFormulaRatio(item[7],item,1)
item[8] = this.handleFormulaRatio(item[8],item,2) // item[8] = this.handleFormulaRatio(item[8],item,2)
item[9] = this.handleFormulaRatio(item[9],item,3) // item[9] = this.handleFormulaRatio(item[9],item,3)
item[10] = this.handleFormulaRatio(item[10],item,4) // item[10] = this.handleFormulaRatio(item[10],item,4)
item[11] = this.handleFormulaRatio(item[11],item,5) // item[11] = this.handleFormulaRatio(item[11],item,5)
item[12] = this.handleFormulaRatio(item[12],item,6) // item[12] = this.handleFormulaRatio(item[12],item,6)
item[13] = this.handleFormulaRatio(item[13],item,7) // item[13] = this.handleFormulaRatio(item[13],item,7)
item[14] = this.handleFormulaRatio(item[14],item,8) // item[14] = this.handleFormulaRatio(item[14],item,8)
item[15] = this.handleFormulaRatio(item[15],item,9) // item[15] = this.handleFormulaRatio(item[15],item,9)
item[16] = this.handleFormulaRatio(item[16],item,10) // item[16] = this.handleFormulaRatio(item[16],item,10)
item[17] = this.handleFormulaRatio(item[17],item,11) // item[17] = this.handleFormulaRatio(item[17],item,11)
item[18] = this.handleFormulaRatio(item[18],item,12) // item[18] = this.handleFormulaRatio(item[18],item,12)
totalCY = Number(item[7]) + Number(item[8]) + Number(item[9]) + Number(item[10]) + Number(item[11]) + Number(item[12]) + Number(item[13]) + Number(item[14]) + Number(item[15]) + Number(item[16]) + Number(item[17]) + Number(item[18]) // item[19] = this.handleFormulaRatio(item[19],item,13)
// item[20] = this.handleFormulaRatio(item[20],item,14)
} }
totalCY = Number(item[7]) + Number(item[8]) + Number(item[9]) + Number(item[10]) + Number(item[11]) + Number(item[12]) + Number(item[13]) + Number(item[14]) + Number(item[15]) + Number(item[16]) + Number(item[17]) + Number(item[18])
} }
listFR.push( listFR.push(
{ {
"item_report_id": item[1], "item_report_id": item[1],
"january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)), "january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(2)),
"february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)), "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(2)),
"march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)), "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(2)),
"april": String(item[10] == undefined? item[10] : Number(item[10]).toFixed(1)), "april": String(item[10] == undefined? item[10] : Number(item[10]).toFixed(2)),
"may": String(item[11] == undefined? item[11] : Number(item[11]).toFixed(1)), "may": String(item[11] == undefined? item[11] : Number(item[11]).toFixed(2)),
"june": String(item[12] == undefined? item[12] : Number(item[12]).toFixed(1)), "june": String(item[12] == undefined? item[12] : Number(item[12]).toFixed(2)),
"july": String(item[13] == undefined? item[13] : Number(item[13]).toFixed(1)), "july": String(item[13] == undefined? item[13] : Number(item[13]).toFixed(2)),
"august": String(item[14] == undefined? item[14] : Number(item[14]).toFixed(1)), "august": String(item[14] == undefined? item[14] : Number(item[14]).toFixed(2)),
"september": String(item[15] == undefined? item[15] : Number(item[15]).toFixed(1)), "september": String(item[15] == undefined? item[15] : Number(item[15]).toFixed(2)),
"october": String(item[16] == undefined? item[16] : Number(item[16]).toFixed(1)), "october": String(item[16] == undefined? item[16] : Number(item[16]).toFixed(2)),
"november": String(item[17] == undefined? item[17] : Number(item[17]).toFixed(1)), "november": String(item[17] == undefined? item[17] : Number(item[17]).toFixed(2)),
"december": String(item[18] == undefined? item[18] : Number(item[18]).toFixed(1)), "december": String(item[18] == undefined? item[18] : Number(item[18]).toFixed(2)),
"total_current_year": String(totalCY == undefined? totalCY : Number(totalCY).toFixed(1)), "total_current_year": String(totalCY == undefined? totalCY : Number(totalCY).toFixed(2)),
"total_next_year": String(item[19] != ''? Number(item[19]).toFixed(1) : item[19]), "total_next_year": String(item[19] != ''? Number(item[19]).toFixed(2) : item[19]),
"total_more_year": String(item[20] != ''? Number(item[20]).toFixed(1) : item[20]), "total_more_year": String(item[20] != ''? Number(item[20]).toFixed(2) : item[20]),
} }
) )
......
...@@ -1854,20 +1854,20 @@ export default class MonthlyReport extends Component { ...@@ -1854,20 +1854,20 @@ export default class MonthlyReport extends Component {
item.level, item.level,
item.description, item.description,
item.uom, item.uom,
"", // "",
// item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before, // item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
Number(item.ratio.monthly_january).toFixed(1), Number(item.ratio.monthly_january).toFixed(2),
Number(item.ratio.monthly_february).toFixed(1), Number(item.ratio.monthly_february).toFixed(2),
Number(item.ratio.monthly_march).toFixed(1), Number(item.ratio.monthly_march).toFixed(2),
Number(item.ratio.monthly_april).toFixed(1), Number(item.ratio.monthly_april).toFixed(2),
Number(item.ratio.monthly_may).toFixed(1), Number(item.ratio.monthly_may).toFixed(2),
Number(item.ratio.monthly_june).toFixed(1), Number(item.ratio.monthly_june).toFixed(2),
Number(item.ratio.monthly_july).toFixed(1), Number(item.ratio.monthly_july).toFixed(2),
Number(item.ratio.monthly_august).toFixed(1), Number(item.ratio.monthly_august).toFixed(2),
Number(item.ratio.monthly_september).toFixed(1), Number(item.ratio.monthly_september).toFixed(2),
Number(item.ratio.monthly_october).toFixed(1), Number(item.ratio.monthly_october).toFixed(2),
Number(item.ratio.monthly_november).toFixed(1), Number(item.ratio.monthly_november).toFixed(2),
Number(item.ratio.monthly_december).toFixed(1), Number(item.ratio.monthly_december).toFixed(2),
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1887,22 +1887,22 @@ export default class MonthlyReport extends Component { ...@@ -1887,22 +1887,22 @@ export default class MonthlyReport extends Component {
item.level, item.level,
item.description, item.description,
item.uom, item.uom,
"", // "",
// item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before, // item.ratio.total_actual_before === null ? "0.0" : item.ratio.total_actual_before === "" ? "0.0" : item.ratio.total_actual_before,
Number(item.ratio.january).toFixed(1), Number(item.ratio.january).toFixed(2),
Number(item.ratio.february).toFixed(1), Number(item.ratio.february).toFixed(2),
Number(item.ratio.march).toFixed(1), Number(item.ratio.march).toFixed(2),
Number(item.ratio.april).toFixed(1), Number(item.ratio.april).toFixed(2),
Number(item.ratio.may).toFixed(1), Number(item.ratio.may).toFixed(2),
Number(item.ratio.june).toFixed(1), Number(item.ratio.june).toFixed(2),
Number(item.ratio.july).toFixed(1), Number(item.ratio.july).toFixed(2),
Number(item.ratio.august).toFixed(1), Number(item.ratio.august).toFixed(2),
Number(item.ratio.september).toFixed(1), Number(item.ratio.september).toFixed(2),
Number(item.ratio.october).toFixed(1), Number(item.ratio.october).toFixed(2),
Number(item.ratio.november).toFixed(1), Number(item.ratio.november).toFixed(2),
Number(item.ratio.december).toFixed(1), Number(item.ratio.december).toFixed(2),
Number(item.ratio.total_next_year).toFixed(1), Number(item.ratio.total_next_year).toFixed(2),
Number(item.ratio.total_more_year).toFixed(1), Number(item.ratio.total_more_year).toFixed(2),
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -1933,17 +1933,17 @@ export default class MonthlyReport extends Component { ...@@ -1933,17 +1933,17 @@ export default class MonthlyReport extends Component {
let dataTable2 = this.state.dbFR let dataTable2 = this.state.dbFR
let total = 0 let total = 0
if (month > 12) { if (month > 12) {
total = Number(dataTable2[35][7 + month]) total = Number(dataTable2[35][6 + month])
} else { } else {
for (let index = 0; index < month; index++) { for (let index = 0; index < month; index++) {
total += Number(dataTable2[35][8 + index]) total += Number(dataTable2[35][7 + index])
// console.log(index); // console.log(index);
} }
total = total/month total = total/month
} }
let hasil = Number(value) / total let hasil = Number(value) / total
// console.log(hasil, value, total); // console.log(hasil, value, total);
return Number(hasil).toFixed(1) return Number(hasil).toFixed(2)
} }
olahDataFR(dbFR, type) { olahDataFR(dbFR, type) {
...@@ -1975,20 +1975,20 @@ export default class MonthlyReport extends Component { ...@@ -1975,20 +1975,20 @@ export default class MonthlyReport extends Component {
console.log(this.state.dbFR) console.log(this.state.dbFR)
this.state.dbFR.map((item,index) => { this.state.dbFR.map((item,index) => {
if (item[0] != 4 || item[0] != 1) { if (item[0] != 4 || item[0] != 1) {
if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) { // if (item[5] === "Return on Invested Capital - YTD (ROIC)" ) {
item[7] = this.handleFormulaRatio(item[7],item,1) // item[7] = this.handleFormulaRatio(item[7],item,1)
item[8] = this.handleFormulaRatio(item[8],item,2) // item[8] = this.handleFormulaRatio(item[8],item,2)
item[9] = this.handleFormulaRatio(item[9],item,3) // item[9] = this.handleFormulaRatio(item[9],item,3)
item[10] = this.handleFormulaRatio(item[10],item,4) // item[10] = this.handleFormulaRatio(item[10],item,4)
item[11] = this.handleFormulaRatio(item[11],item,5) // item[11] = this.handleFormulaRatio(item[11],item,5)
item[12] = this.handleFormulaRatio(item[12],item,6) // item[12] = this.handleFormulaRatio(item[12],item,6)
item[13] = this.handleFormulaRatio(item[13],item,7) // item[13] = this.handleFormulaRatio(item[13],item,7)
item[14] = this.handleFormulaRatio(item[14],item,8) // item[14] = this.handleFormulaRatio(item[14],item,8)
item[15] = this.handleFormulaRatio(item[15],item,9) // item[15] = this.handleFormulaRatio(item[15],item,9)
item[16] = this.handleFormulaRatio(item[16],item,10) // item[16] = this.handleFormulaRatio(item[16],item,10)
item[17] = this.handleFormulaRatio(item[17],item,11) // item[17] = this.handleFormulaRatio(item[17],item,11)
item[18] = this.handleFormulaRatio(item[18],item,12) // item[18] = this.handleFormulaRatio(item[18],item,12)
} // }
} }
...@@ -1996,28 +1996,28 @@ export default class MonthlyReport extends Component { ...@@ -1996,28 +1996,28 @@ export default class MonthlyReport extends Component {
{ {
"item_report_id": item[1], "item_report_id": item[1],
"actual": this.state.month.month_id == 1? "actual": this.state.month.month_id == 1?
String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)) : String(item[7] == undefined? item[7] : Number(item[7]).toFixed(2)) :
this.state.month.month_id == 2? this.state.month.month_id == 2?
String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)) : String(item[8] == undefined? item[8] : Number(item[8]).toFixed(2)) :
this.state.month.month_id == 3? this.state.month.month_id == 3?
String(item[9] == undefined? item[8] : Number(item[9]).toFixed(1)) : String(item[9] == undefined? item[8] : Number(item[9]).toFixed(2)) :
this.state.month.month_id == 4? this.state.month.month_id == 4?
String(item[10] == undefined? item[10] : Number(item[10]).toFixed(1)) : String(item[10] == undefined? item[10] : Number(item[10]).toFixed(2)) :
this.state.month.month_id == 5? this.state.month.month_id == 5?
String(item[11] == undefined? item[11] : Number(item[11]).toFixed(1)) : String(item[11] == undefined? item[11] : Number(item[11]).toFixed(2)) :
this.state.month.month_id == 6? this.state.month.month_id == 6?
String(item[12] == undefined? item[12] : Number(item[12]).toFixed(1)) : String(item[12] == undefined? item[12] : Number(item[12]).toFixed(2)) :
this.state.month.month_id == 7? this.state.month.month_id == 7?
String(item[13] == undefined? item[13] : Number(item[13]).toFixed(1)) : String(item[13] == undefined? item[13] : Number(item[13]).toFixed(2)) :
this.state.month.month_id == 8? this.state.month.month_id == 8?
String(item[14] == undefined? item[14] : Number(item[14]).toFixed(1)) : String(item[14] == undefined? item[14] : Number(item[14]).toFixed(2)) :
this.state.month.month_id == 9? this.state.month.month_id == 9?
String(item[15] == undefined? item[15] : Number(item[15]).toFixed(1)) : String(item[15] == undefined? item[15] : Number(item[15]).toFixed(2)) :
this.state.month.month_id == 10? this.state.month.month_id == 10?
String(item[16] == undefined? item[16] : Number(item[16]).toFixed(1)) : String(item[16] == undefined? item[16] : Number(item[16]).toFixed(2)) :
this.state.month.month_id == 11? this.state.month.month_id == 11?
String(item[17] == undefined? item[17] : Number(item[17]).toFixed(1)) : String(item[17] == undefined? item[17] : Number(item[17]).toFixed(2)) :
String(item[18] == undefined? item[18] : Number(item[18]).toFixed(1)) String(item[18] == undefined? item[18] : Number(item[18]).toFixed(2))
// "january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)), // "january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)),
// "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)), // "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)),
// "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)), // "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)),
...@@ -2040,7 +2040,7 @@ export default class MonthlyReport extends Component { ...@@ -2040,7 +2040,7 @@ export default class MonthlyReport extends Component {
console.log(listFR) console.log(listFR)
console.log('subOD',this.state.submissionID) console.log('subOD',this.state.submissionID)
this.setState({dbFR: listFR} , () => { this.setState({dbFR: listFR} , () => {
if (this.state.submissionID != null) { if (this.state.monthlyReportId != null) {
this.createDBFR() this.createDBFR()
} }
}) })
......
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