Commit 4ad32095 authored by Riri Novita's avatar Riri Novita

update Simulasi OLPA

parent 1349795c
......@@ -592,20 +592,20 @@ export default class BalanceSheetOLPA extends Component {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(Number(i[6]).toFixed(1)),
january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1))),
december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1))),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
total_actual_before: String(Number(i[6])),
january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value)) : String(Number(i[17]))),
december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[18].value)) : String(Number(i[18]))),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
})
})
let body = {
......@@ -753,13 +753,13 @@ export default class BalanceSheetOLPA extends Component {
console.log(Number(i[18].value).toFixed(1))
console.log(Number(i[19]).toFixed(1))
if ((Number(i[17].value).toFixed(1) < Number(this.state.minValue)) || (Number(i[17].value).toFixed(1) > Number(this.state.maxValue))) {
if ((Number(i[17].value) < Number(this.state.minValue)) || (Number(i[17].value) > Number(this.state.maxValue))) {
console.log("masuk selisih control 1")
err = true
} else if ((Number(i[18].value).toFixed(1) < Number(this.state.minValue)) || (Number(i[18].value).toFixed(1) > Number(this.state.maxValue))) {
} else if ((Number(i[18].value) < Number(this.state.minValue)) || (Number(i[18].value) > Number(this.state.maxValue))) {
console.log("masuk selisih control 2")
err = true
} else if ((Number(i[19]).toFixed(1) < Number(this.state.minValue)) || (Number(i[19]).toFixed(1) > Number(this.state.maxValue))) {
} else if ((Number(i[19]) < Number(this.state.minValue)) || (Number(i[19]) > Number(this.state.maxValue))) {
console.log("masuk selisih control 3")
err = true
}
......@@ -768,19 +768,19 @@ export default class BalanceSheetOLPA extends Component {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17])),
december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18])),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
})
})
console.log(JSON.stringify(data))
......
......@@ -321,19 +321,19 @@ export default class CashFlow extends Component {
// }
{
"item_report_id": item[1],
"january": String(item[6].value == undefined ? item[6] : Number(item[6].value).toFixed(1)),
"february": String(item[7].value == undefined ? item[7] : Number(item[7].value).toFixed(1)),
"march": String(item[8].value == undefined ? item[8] : Number(item[8].value).toFixed(1)),
"april": String(item[9].value == undefined ? item[9] : Number(item[9].value).toFixed(1)),
"may": String(item[10].value == undefined ? item[10] : Number(item[10].value).toFixed(1)),
"june": String(item[11].value == undefined ? item[11] : Number(item[11].value).toFixed(1)),
"july": String(item[12].value == undefined ? item[12] : Number(item[12].value).toFixed(1)),
"august": String(item[13].value == undefined ? item[13] : Number(item[13].value).toFixed(1)),
"september": String(item[14].value == undefined ? item[14] : Number(item[14].value).toFixed(1)),
"october": String(item[15].value == undefined ? item[15] : Number(item[15].value).toFixed(1)),
"november": String(item[16].value == undefined ? item[16] : Number(item[16].value).toFixed(1)),
"december": String(item[17].value == undefined ? item[17] : Number(item[17].value).toFixed(1)),
"total_current_year": String(item[18] != '' ? Number(item[18]).toFixed(1) : item[18]),
"january": String(item[6].value == undefined ? item[6] : Number(item[6].value)),
"february": String(item[7].value == undefined ? item[7] : Number(item[7].value)),
"march": String(item[8].value == undefined ? item[8] : Number(item[8].value)),
"april": String(item[9].value == undefined ? item[9] : Number(item[9].value)),
"may": String(item[10].value == undefined ? item[10] : Number(item[10].value)),
"june": String(item[11].value == undefined ? item[11] : Number(item[11].value)),
"july": String(item[12].value == undefined ? item[12] : Number(item[12].value)),
"august": String(item[13].value == undefined ? item[13] : Number(item[13].value)),
"september": String(item[14].value == undefined ? item[14] : Number(item[14].value)),
"october": String(item[15].value == undefined ? item[15] : Number(item[15].value)),
"november": String(item[16].value == undefined ? item[16] : Number(item[16].value)),
"december": String(item[17].value == undefined ? item[17] : Number(item[17].value)),
"total_current_year": String(item[18] != '' ? Number(item[18]) : item[18]),
}
)
})
......
......@@ -73,7 +73,8 @@ export default class CorporateAnnualTargetRO extends Component {
get_for: 'view',
viewOnly: true,
defaultCurrencyUpload: this.props.defaultCurrency,
visibleAlertSave: false
visibleAlertSave: false,
visibleButtonUpload: false
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -154,24 +155,24 @@ export default class CorporateAnnualTargetRO extends Component {
item.formula,
item.level,
item.description,
item.cat.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
item.cat.weight == "" ? Number(0) : Number(weight),
item.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)) : { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)) : { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)) : { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)) : { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)) : { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)) : { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)) : { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)) : { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)) : { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)) : { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)) : { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)) : { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)),
item.cat.total_current_year == "" ? "0" : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january)) : { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february)) : { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march)) : { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april)) : { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may)) : { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june)) : { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july)) : { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august)) : { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september)) : { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october)) : { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november)) : { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december)) : { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december)),
item.cat.total_current_year == "" ? "0" : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year),
item.cat.strategic,
item.cat.pic,
item.order
......@@ -193,24 +194,24 @@ export default class CorporateAnnualTargetRO extends Component {
item.formula,
item.level,
item.description,
item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.weight == '' ? Number(0) : Number(Number(item.weight) * 100),
item.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula == "" ? null : { value: item.formula_ytd },
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)),
item.cat.total_current_year == "" ? 0 : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december)),
item.cat.total_current_year == "" ? 0 : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year),
item.cat.strategic,
item.cat.pic,
item.order
......@@ -550,18 +551,18 @@ export default class CorporateAnnualTargetRO extends Component {
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? (String(i[5]).includes('%') ? String(i[5].trim()) : String(Number(i[5] * 100) + '%')) : String(i[5]).trim(),
formula_ytd: i[6] === undefined ? "" : String(i[6]).trim(),
january: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(roundMath(Number(i[7]), 1)).trim(),
february: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(roundMath(Number(i[8]), 1)).trim(),
march: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(roundMath(Number(i[9]), 1)).trim(),
april: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(roundMath(Number(i[10]), 1)).trim(),
may: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(roundMath(Number(i[11]), 1)).trim(),
june: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(roundMath(Number(i[12]), 1)).trim(),
july: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(roundMath(Number(i[13]), 1)).trim(),
august: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(roundMath(Number(i[14]), 1)).trim(),
september: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(roundMath(Number(i[15]), 1)).trim(),
october: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(roundMath(Number(i[16]), 1)).trim(),
november: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(roundMath(Number(i[17]), 1)).trim(),
december: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(roundMath(Number(i[18]), 1)).trim(),
january: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7])).trim(),
february: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8])).trim(),
march: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9])).trim(),
april: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10])).trim(),
may: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11])).trim(),
june: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12])).trim(),
july: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13])).trim(),
august: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14])).trim(),
september: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15])).trim(),
october: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16])).trim(),
november: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17])).trim(),
december: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18])).trim(),
strategic_initiative: i[20] === undefined ? "" : String(i[20]).trim(),
pic: i[21] === undefined ? "" : String(i[21]).trim()
})
......@@ -668,13 +669,145 @@ export default class CorporateAnnualTargetRO extends Component {
})
}
uploadSimulasi() {
checkUploadSimulasi() {
let payload = {
...this.state.payload,
currency_id: this.state.defaultCurrencyUpload?.id
}
this.setState({ loading: true, dataTable: [] })
console.log(payload)
api.create().checkUploadOLPA(payload).then(response => {
console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ visibleUploadSimulasi: false, visibleCATRO: false, visibleButtonUpload: true })
let dataTable = []
response.data.data.map((item, index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.parent)
let parent_name = ""
if (indexID != -1) {
parent_name = dataTable[indexID][5]
}
dataTable.push([
item.type_report_id,
item.item_report_id,
item.parent,
item.formula,
item.level,
item.item_report,
Number(String(item.weight).substr(0, String(item.weight).length - 1)),
item.uom,
item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type },
item.max_ach == "" || item.max_ach == null ? null : { value: titleCase(item.max_ach) },
item.formula_ytd == "" || item.formula_ytd == null ? null : { value: item.formula_ytd },
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.january) : { value: item.january, formula: item.january_formula } : item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.february) : { value: item.february, formula: item.february_formula } : item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.march) : { value: item.march, formula: item.march_formula } : item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.april) : { value: item.april, formula: item.april_formula } : item.april == "" ? item.april : String(item.april).indexOf(".") == -1 ? Number(item.april) : Number(item.april),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.may) : { value: item.may, formula: item.may_formula } : item.may == "" ? item.may : String(item.may).indexOf(".") == -1 ? Number(item.may) : Number(item.may),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.june) : { value: item.june, formula: item.june_formula } : item.june == "" ? item.june : String(item.june).indexOf(".") == -1 ? Number(item.june) : Number(item.june),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.july) : { value: item.july, formula: item.july_formula } : item.july == "" ? item.july : String(item.july).indexOf(".") == -1 ? Number(item.july) : Number(item.july),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.august) : { value: item.august, formula: item.august_formula } : item.august == "" ? item.august : String(item.august).indexOf(".") == -1 ? Number(item.august) : Number(item.august),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.september) : { value: item.september, formula: item.september_formula } : item.september == "" ? item.september : String(item.september).indexOf(".") == -1 ? Number(item.september) : Number(item.september),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.october) : { value: item.october, formula: item.october_formula } : item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.november) : { value: item.november, formula: item.november_formula } : item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november),
parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.december) : { value: item.december, formula: item.december_formula } : item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december),
item.total_current_year == "" ? item.total_current_year : String(item.total_current_year).indexOf(".") == -1 ? Number(item.total_current_year) : Number(item.total_current_year),
item.strategic,
item.pic,
item.order,
item.error
])
})
// console.log(this.state.buttonError)
console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[27].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// console.log(this.state.dataTable);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
uploadSimulasi(type) {
let data = []
let stateFR = false
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
if (indexID !== -1) {
if (this.state.dataTable[indexID][5] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else {
stateFR = false
}
}
} else {
stateFR = false
}
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_report": String(i[5]),
"weight": String(i[6]),
"uom": String(i[7]),
"kpi_type": i[8] == null ? "" : i[8].value,
"max_ach": i[9] == null ? "" : i[9].value,
"formula_ytd": i[10] == null ? "" : i[10].value,
"january": stateFR ? i[0] == 3 ? String(i[11]) : String(Number(i[11].value)) : String(i[11]),
"february": stateFR ? i[0] == 3 ? String(i[12]) : String(Number(i[12].value)) : String(i[12]),
"march": stateFR ? i[0] == 3 ? String(i[13]) : String(Number(i[13].value)) : String(i[13]),
"april": stateFR ? i[0] == 3 ? String(i[14]) : String(Number(i[14].value)) : String(i[14]),
"may": stateFR ? i[0] == 3 ? String(i[15]) : String(Number(i[15].value)) : String(i[15]),
"june": stateFR ? i[0] == 3 ? String(i[16]) : String(Number(i[16].value)) : String(i[16]),
"july": stateFR ? i[0] == 3 ? String(i[17]) : String(Number(i[17].value)) : String(i[17]),
"august": stateFR ? i[0] == 3 ? String(i[18]) : String(Number(i[18].value)) : String(i[18]),
"september": stateFR ? i[0] == 3 ? String(i[19]) : String(Number(i[19].value)) : String(i[19]),
"october": stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value)) : String(i[20]),
"november": stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value)) : String(i[21]),
"december": stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value)) : String(i[22]),
"total_current_year": String(Number(i[23])) == "" ? "0.0" : String(Number(i[23])),
"strategic": i[24] == null ? "" : String(i[24]),
"pic": String(i[25])
})
})
let payload = {
"outlook_pa_id": this.props.outlook_pa_id,
// "rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.state.defaultCurrencyUpload?.id,
"quartal": 'q1',
"status": type,
"cat": data,
"balance_sheet": [],
"profit_loss": [],
"tax_planning": [],
}
api.create().uploadSimulasiROPL(payload).then(response => {
console.log(response)
if (response.data) {
......@@ -2180,21 +2313,6 @@ export default class CorporateAnnualTargetRO extends Component {
</div>
<div style={{ width: '50%' }}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<a data-tip={'Upload Simulasi'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
>
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
{this.props.isApprover === true || this.state.get_for == 'view' ?
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
......@@ -2220,6 +2338,20 @@ export default class CorporateAnnualTargetRO extends Component {
// </div>
:
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Upload Simulasi'} data-for="upload">
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
>
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
</button>
</a>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<a data-tip={'Download Template'} data-for="template">
<button
style={{
......@@ -2419,6 +2551,122 @@ export default class CorporateAnnualTargetRO extends Component {
</div>
</Paper>
:
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Corporate Annual Target - Revision</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }} />
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
)
}) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
}
</div>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
</div>
<div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ visibleCATRO: true, visibleUpload: false }, () => {
this.handleGetFor('edit')
})
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{this.props.isApprover === true ?
<div className="col-2">
</div> :
<div className="" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>}
{this.state.get_for === 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data</Typography>
</div>
</button>}
</div>
}
</div>
</Paper>
:
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Corporate Annual Target - Revision</Typography>
......@@ -2632,7 +2880,7 @@ export default class CorporateAnnualTargetRO extends Component {
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("PROFIT") && String(this.state.judul).includes("LOSS") ?
this.uploadSimulasi() :
this.checkUploadSimulasi() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
/>
......
......@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
import { fixNumber } from '../../library/Utils';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -758,9 +759,13 @@ export default class ProfitLossOLPA extends Component {
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 8 && index <= 17) {
let valItem = item == undefined || item == "" ? 0 : item
console.log(valItem);
total += Number(valItem)
}
})
// if (tableMeta.rowData[5] == "Sales Price") {
// console.log(total);
// }
dataTable2[tableMeta.rowIndex][21] = total
return total
......@@ -1043,7 +1048,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1057,8 +1062,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1089,7 +1094,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1103,8 +1108,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1135,7 +1140,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1149,8 +1154,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
////decimalScale={1}
/>
}
/>
......@@ -1181,7 +1186,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1195,8 +1200,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1227,7 +1232,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1241,8 +1246,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1273,7 +1278,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1287,8 +1292,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1319,7 +1324,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1333,8 +1338,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1365,7 +1370,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1379,8 +1384,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1411,7 +1416,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1425,8 +1430,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1457,7 +1462,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1471,8 +1476,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1503,7 +1508,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1517,8 +1522,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
//decimalScale={1}
/>
}
/>
......@@ -1550,7 +1555,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1564,10 +1569,10 @@ export default class ProfitLossOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
decimalScale={1}
//decimalScale={1}
// disabled={this.props.isApprover ? true : ((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') ? false : true)}
disabled={this.props.isApprover ? true : false}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
......@@ -1584,7 +1589,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(value, tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : Number(handleValue(value, tableMeta)) == 0 ? "0.0" : Number(handleValue(value, tableMeta))}
/>
</span>
// <div style={{ flex: 1 }}>
......@@ -1598,7 +1603,7 @@ export default class ProfitLossOLPA extends Component {
// type="text"
// placeholder=""
// disabled={this.props.isApprover ? true : ((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') ? false : true)}
// value={Number(value).toFixed(1)}
// value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
......@@ -1615,7 +1620,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(value, tableMeta, 11)), 1) : Number(handleFormula(value, tableMeta, 11)) == 0 ? "0.0" : Number(handleFormula(value, tableMeta, 11))}
/>
// <div style={{ flex: 1 }}>
// <FormControlLabel
......@@ -1628,7 +1633,7 @@ export default class ProfitLossOLPA extends Component {
// type="text"
// placeholder=""
// disabled={this.props.isApprover ? true : ((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') ? false : true)}
// value={Number(value).toFixed(1)}
// value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
......@@ -1645,7 +1650,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(value, tableMeta, 11)), 1) : Number(handleFormula(value, tableMeta, 11)) == 0 ? "0.0" : Number(handleFormula(value, tableMeta, 11))}
/>
// <div style={{ flex: 1 }}>
// <FormControlLabel
......@@ -1658,7 +1663,7 @@ export default class ProfitLossOLPA extends Component {
// type="text"
// placeholder=""
// disabled={this.props.isApprover ? true : ((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') ? false : true)}
// value={Number(value).toFixed(1)}
// value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
......@@ -1696,7 +1701,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1710,10 +1715,10 @@ export default class ProfitLossOLPA extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
decimalScale={1}
//decimalScale={1}
// disabled={this.props.isApprover ? true : ((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') ? false : true)}
disabled={this.props.isApprover ? true : false}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
......@@ -1730,7 +1735,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(value, tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(value, tableMeta)), 1) : Number(handleValue(value, tableMeta)) == 0 ? "0.0" : Number(handleValue(value, tableMeta))}
/>
</span>
:
......@@ -1741,7 +1746,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(value, tableMeta, 12)), 1) : Number(handleFormula(value, tableMeta, 12)) == 0 ? "0.0" : Number(handleFormula(value, tableMeta, 12))}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1751,7 +1756,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(value, tableMeta, 12)), 1) : Number(handleFormula(value, tableMeta, 12)) == 0 ? "0.0" : Number(handleFormula(value, tableMeta, 12))}
/>
:
null
......@@ -1781,7 +1786,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1791,8 +1796,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleTotalFY(tableMeta)).toFixed(1)}
//decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotalFY(tableMeta)), 1) : Number(handleTotalFY(tableMeta)) == 0 ? "0.0" : Number(handleTotalFY(tableMeta))}
/>
</span>
}
......@@ -1821,7 +1826,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1831,8 +1836,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleTotalYTD(tableMeta)).toFixed(1)}
//decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotalYTD(tableMeta)), 1) : Number(handleTotalYTD(tableMeta)) == 0 ? "0.0" : Number(handleTotalYTD(tableMeta))}
/>
</span>
}
......@@ -1861,7 +1866,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1871,8 +1876,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleTotal(tableMeta)).toFixed(1)}
//decimalScale={1}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotal(tableMeta)), 1) : Number(handleTotal(tableMeta)) == 0 ? "0.0" : Number(handleTotal(tableMeta))}
/>
</span>
}
......
......@@ -11,6 +11,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
import { fixNumber } from '../../library/Utils';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -978,64 +979,64 @@ export default class TaxPlanningOLPA extends Component {
january: {
// tbc: String(Number(i[9].tbc).toFixed(1)),
// fcp: String(Number(i[9].fcp).toFixed(1)),
tbf: String(Number(i[9].tbf).toFixed(1))
tbf: String(Number(i[9].tbf))
},
february: {
// tbc: String(Number(i[10].tbc).toFixed(1)),
// fcp: String(Number(i[10].fcp).toFixed(1)),
tbf: String(Number(i[10].tbf).toFixed(1))
// tbc: String(Number(i[10].tbc)),
// fcp: String(Number(i[10].fcp)),
tbf: String(Number(i[10].tbf))
},
march: {
// tbc: String(Number(i[11].tbc).toFixed(1)),
// fcp: String(Number(i[11].fcp).toFixed(1)),
tbf: String(Number(i[11].tbf).toFixed(1))
// tbc: String(Number(i[11].tbc)),
// fcp: String(Number(i[11].fcp)),
tbf: String(Number(i[11].tbf))
},
april: {
// tbc: String(Number(i[12].tbc).toFixed(1)),
// fcp: String(Number(i[12].fcp).toFixed(1)),
tbf: String(Number(i[12].tbf).toFixed(1))
// tbc: String(Number(i[12].tbc)),
// fcp: String(Number(i[12].fcp)),
tbf: String(Number(i[12].tbf))
},
may: {
// tbc: String(Number(i[13].tbc).toFixed(1)),
// fcp: String(Number(i[13].fcp).toFixed(1)),
tbf: String(Number(i[13].tbf).toFixed(1))
// tbc: String(Number(i[13].tbc)),
// fcp: String(Number(i[13].fcp)),
tbf: String(Number(i[13].tbf))
},
june: {
// tbc: String(Number(i[14].tbc).toFixed(1)),
// fcp: String(Number(i[14].fcp).toFixed(1)),
tbf: String(Number(i[14].tbf).toFixed(1))
// tbc: String(Number(i[14].tbc)),
// fcp: String(Number(i[14].fcp)),
tbf: String(Number(i[14].tbf))
},
july: {
// tbc: String(Number(i[15].tbc).toFixed(1)),
// fcp: String(Number(i[15].fcp).toFixed(1)),
tbf: String(Number(i[15].tbf).toFixed(1))
// tbc: String(Number(i[15].tbc)),
// fcp: String(Number(i[15].fcp)),
tbf: String(Number(i[15].tbf))
},
august: {
// tbc: String(Number(i[16].tbc).toFixed(1)),
// fcp: String(Number(i[16].fcp).toFixed(1)),
tbf: String(Number(i[16].tbf).toFixed(1))
// tbc: String(Number(i[16].tbc)),
// fcp: String(Number(i[16].fcp)),
tbf: String(Number(i[16].tbf))
},
september: {
// tbc: String(Number(i[17].tbc).toFixed(1)),
// fcp: String(Number(i[17].fcp).toFixed(1)),
tbf: String(Number(i[17].tbf).toFixed(1))
// tbc: String(Number(i[17].tbc)),
// fcp: String(Number(i[17].fcp)),
tbf: String(Number(i[17].tbf))
},
october: {
// tbc: String(Number(i[18].tbc).toFixed(1)),
// fcp: String(Number(i[18].fcp).toFixed(1)),
tbf: String(Number(i[18].tbf).toFixed(1))
// tbc: String(Number(i[18].tbc)),
// fcp: String(Number(i[18].fcp)),
tbf: String(Number(i[18].tbf))
},
november: {
tbc: String(Number(i[19].tbc).toFixed(1)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[19].fcp).toFixed(2)) : String(Number(i[19].fcp).toFixed(1)),
tbf: String(Number(i[19].tbf).toFixed(1))
tbc: String(Number(i[19].tbc)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[19].fcp).toFixed(2)) : String(Number(i[19].fcp)),
tbf: String(Number(i[19].tbf))
},
december: {
tbc: String(Number(i[20].tbc).toFixed(1)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[20].fcp).toFixed(2)) : String(Number(i[20].fcp).toFixed(1)),
tbf: String(Number(i[20].tbf).toFixed(1))
tbc: String(Number(i[20].tbc)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[20].fcp).toFixed(2)) : String(Number(i[20].fcp)),
tbf: String(Number(i[20].tbf))
},
total_current_year: String(Number(i[21]).toFixed(1))
total_current_year: String(Number(i[21]))
})
})
let body = {
......@@ -1549,38 +1550,38 @@ export default class TaxPlanningOLPA extends Component {
// let dataSub = dex == 1? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc : dex == 2? dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp : dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf
if (dex == 1) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc = Number(total)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbc.value = Number(total)
}
} else if (dex == 2) {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(total)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp.value = Number(total)
}
} else if (dex == 3) {
if (tableMeta.rowData[8] == "Corporate Income Tax") {
if (total < 0) {
total = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(2)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total)
}
} else if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf = Number(total)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].tbf.value = Number(total)
}
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(total)
}
}
return tableMeta.rowData[8] == "Corporate Income Tax" ? Number(total).toFixed(2) : Number(total).toFixed(1)
return tableMeta.rowData[8] == "Corporate Income Tax" ? Number(total) : Number(total)
}
const handleChange = (value, tableMeta, indexChilds) => {
......@@ -1639,7 +1640,7 @@ export default class TaxPlanningOLPA extends Component {
}
})
}
dataTable2[tableMeta.rowIndex][21] = String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(total).toFixed(2) : Number(total).toFixed(1)
dataTable2[tableMeta.rowIndex][21] = String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(total) : Number(total)
return total
}
......@@ -1783,7 +1784,7 @@ export default class TaxPlanningOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? Number(value.tbf).toFixed(2) : Number(value.tbf).toFixed(1)}
value={String(tableMeta.rowData[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? (fixNumber(Number(value.tbf), 2) == 0 ? "0.0" : fixNumber(Number(value.tbf), 2)) : (fixNumber(Number(value.tbf), 1) == 0 ? "0.0" : fixNumber(Number(value.tbf), 1))}
/>
}
/>
......
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