Commit 0770580a authored by Riri Novita's avatar Riri Novita

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents 1d230595 997fb4ce
......@@ -259,6 +259,7 @@ const create = (type = "") => {
const getHierarkiMontlyReportTP = (body) => api.post('transaction/monthly_report_tp/get_report_hierarki', body)
const getHierarkiMontlyReportLOCF = (body) => api.post('transaction/monthly_report_locf/get_report_hierarki', body)
const getHierarkiMontlyReportFAM = (body) => api.post('transaction/monthly_report/fam/get_report_hierarki', body)
const getHierarkiMontlyReportCF = (body) => api.post('transaction/monthly_report_cf/get_report_hierarki', body)
const getHierarkiMontlyReportCAT = (body) => api.post('/transaction/monthly_report/cat/get_report_hierarki', body)
const getLastPeriodMonthly = (idCompany) => api.get(`transaction/monthly_report/get_last_periode/${idCompany}`)
const checkApproverMonthly = () => api.get('transaction/monthly_report/is_approver')
......@@ -498,7 +499,8 @@ const create = (type = "") => {
checkUploadMonthlyReportBS,
uploadMonthlyReportBS,
uploadMonthlyReportFAM,
uploadMonthlyReportTP
uploadMonthlyReportTP,
getHierarkiMontlyReportCF
}
}
......
......@@ -81,7 +81,10 @@ export default class CorporateAnnualTarget extends Component {
handleTekTekTek: 0,
editable: false,
dataCustomerPrs: [],
dataInternalBsn: []
dataInternalBsn: [],
dataFin: [],
dataLearn: [],
handleDataSalah: false,
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -110,6 +113,8 @@ export default class CorporateAnnualTarget extends Component {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
let dataFin = []
let dataLearn = []
// console.log(response)
if (response.data) {
if (response.ok) {
......@@ -140,6 +145,26 @@ export default class CorporateAnnualTarget extends Component {
}
}
if (item.parent_name == 'FINANCIAL PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataFin.push({
id: item.id,
name: item.description,
check: false
})
}
}
if (item.parent_name == 'LEARNING & GROWTH PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataLearn.push({
id: item.id,
name: item.description,
check: false
})
}
}
dataTable.push([
item.type_report_id,
item.id,
......@@ -154,19 +179,19 @@ export default class CorporateAnnualTarget extends Component {
parentTrue ? item.cat.max_ach == "" ? null : { value: titleCase(item.cat.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.description === 'ROIC' ? Number(item.cat.january).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).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.february).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.description === 'ROIC' ? Number(item.cat.march).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.description === 'ROIC' ? Number(item.cat.april).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.description === 'ROIC' ? Number(item.cat.may).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.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.august).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.description === 'ROIC' ? Number(item.cat.september).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.description === 'ROIC' ? Number(item.cat.october).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.description === 'ROIC' ? Number(item.cat.november).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.description === 'ROIC' ? Number(item.cat.december).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 == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.description === 'ROIC' ? Number(item.cat.january).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).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.description === 'ROIC' ? Number(item.cat.february).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.description === 'ROIC' ? Number(item.cat.march).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.description === 'ROIC' ? Number(item.cat.april).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.description === 'ROIC' ? Number(item.cat.may).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.description === 'ROIC' ? 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.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.may).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.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.description === 'ROIC' ? Number(item.cat.august).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.description === 'ROIC' ? Number(item.cat.september).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.description === 'ROIC' ? Number(item.cat.october).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.description === 'ROIC' ? Number(item.cat.november).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.description === 'ROIC' ? Number(item.cat.december).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.description === 'ROIC' ? Number(item.cat.total_next_year).toFixed(1) : item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.description === 'ROIC' ? Number(item.cat.total_more_year).toFixed(1) : item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic,
......@@ -210,7 +235,7 @@ export default class CorporateAnnualTarget extends Component {
item.description === 'ROIC' ? Number(item.cat.october).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.description === 'ROIC' ? Number(item.cat.november).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.description === 'ROIC' ? Number(item.cat.december).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 == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).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.description === 'ROIC' ? Number(item.cat.total_next_year).toFixed(1) : item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.description === 'ROIC' ? Number(item.cat.total_more_year).toFixed(1) : item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic,
......@@ -226,8 +251,8 @@ export default class CorporateAnnualTarget extends Component {
}
}
})
// // console.log(dataTable)
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataTable)
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn, dataFin, dataLearn}, () => {
// // console.log(dataCustomerPrs)
})
} else {
......@@ -299,6 +324,7 @@ export default class CorporateAnnualTarget extends Component {
// console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
let newValidate = false
isi.map((i, index) => {
if (i.length > 0) {
let total = 0
......@@ -318,36 +344,78 @@ export default class CorporateAnnualTarget extends Component {
}
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
}
if (String(i[1]).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") {
newValidate = true
}
if (String(i[1]).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") {
newValidate = false
}
if (i[0] === undefined || i[0] === null) {
if (newValidate) {
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : (String(i[2]).includes('%')? String(i[2].trim()) : (String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%')),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
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: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10].toFixed(1))).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12].toFixed(1))).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13].toFixed(1))).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14].toFixed(1))).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(Number(i[21]).toFixed(1)).trim(),
total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(Number(i[22]).toFixed(1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
})
}
} else {
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : (String(i[2]).includes('%')? String(i[2].trim()) : (String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%')),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
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: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10].toFixed(1))).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12].toFixed(1))).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13].toFixed(1))).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14].toFixed(1))).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(Number(i[21]).toFixed(1)).trim(),
total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(Number(i[22]).toFixed(1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
})
}
// console.log(i[2])
// // console.log(Number(i[2] * 100))
// // // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : (String(i[2]).includes('%')? String(i[2].trim()) : (String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%')),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
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: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10].toFixed(1))).trim(),
april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12].toFixed(1))).trim(),
june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13].toFixed(1))).trim(),
july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14].toFixed(1))).trim(),
august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_current_year: i[20] == 0 ? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(Number(i[21]).toFixed(1)).trim(),
total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(Number(i[22]).toFixed(1)).trim(),
strategic: i[23] === undefined ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : String(i[24]).trim()
})
}
})
......@@ -382,8 +450,8 @@ export default class CorporateAnnualTarget extends Component {
})
// console.log(this.state.payload)
api.create().checkUploadMB(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......@@ -393,6 +461,9 @@ export default class CorporateAnnualTarget extends Component {
let custoId = 0
let bisnsId = 0
let dataDelete = this.state.dataDelete
let dataFin = this.state.dataFin
let dataLearn = this.state.dataLearn
let newValidate = false
response.data.data.map((item, index) => {
if (item.item_report == 'CUSTOMER PERSPECTIVE') {
custoId = item.item_report_id
......@@ -402,6 +473,14 @@ export default class CorporateAnnualTarget extends Component {
bisnsId = item.item_report_id
}
if (String(item.item_report).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") {
newValidate = true
}
if (String(item.item_report).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") {
newValidate = false
}
if (item.type_report_id !== 4 && item.parent !== null && (item.parent == custoId || item.parent == bisnsId)) {
let indexCust = this.state.dataCustomerPrs.findIndex((val) => val.name == item.item_report)
let indexBisn = this.state.dataInternalBsn.findIndex((val) => val.name == item.item_report)
......@@ -414,6 +493,17 @@ export default class CorporateAnnualTarget extends Component {
}
}
if (newValidate == false) {
let indexIDx = dataFin.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase())
let indexIDz = dataLearn.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase())
if (indexIDx != -1) {
dataFin[indexIDx].check = true
}
if (indexIDz != -1) {
dataLearn[indexIDz].check = true
}
}
dataTable.push([
item.type_report_id,
item.item_report_id,
......@@ -428,18 +518,18 @@ export default class CorporateAnnualTarget extends Component {
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 },
item.total_actual_before == "" ? item.total_actual_before : String(item.total_actual_before).indexOf(".") == -1 ? Number(item.total_actual_before) : Number(item.total_actual_before).toFixed(1),
item.item_report === 'ROIC' ? Number(item.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.january, formula: item.january_formula } : item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1),
item.item_report === 'ROIC' ? Number(item.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.february, formula: item.february_formula } : item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1),
item.item_report === 'ROIC' ? Number(item.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.march_formula, formula: item.march_formula } : item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1),
item.item_report === 'ROIC' ? Number(item.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.april, formula: item.april_formula } : item.april == "" ? item.april : String(item.april).indexOf(".") == -1 ? Number(item.april) : Number(item.april).toFixed(1),
item.item_report === 'ROIC' ? Number(item.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.may, formula: item.may_formula } : item.may == "" ? item.may : String(item.may).indexOf(".") == -1 ? Number(item.may) : Number(item.may).toFixed(1),
item.item_report === 'ROIC' ? Number(item.june).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.june, formula: item.june_formula } : item.june == "" ? item.june : String(item.june).indexOf(".") == -1 ? Number(item.june) : Number(item.june).toFixed(1),
item.item_report === 'ROIC' ? Number(item.july).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.july, formula: item.july_formula } : item.july == "" ? item.july : String(item.july).indexOf(".") == -1 ? Number(item.july) : Number(item.july).toFixed(1),
item.item_report === 'ROIC' ? Number(item.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.august, formula: item.august_formula } : item.august == "" ? item.august : String(item.august).indexOf(".") == -1 ? Number(item.august) : Number(item.august).toFixed(1),
item.item_report === 'ROIC' ? Number(item.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.september, formula: item.september_formula } : item.september == "" ? item.september : String(item.september).indexOf(".") == -1 ? Number(item.september) : Number(item.september).toFixed(1),
item.item_report === 'ROIC' ? Number(item.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.october, formula: item.october_formula } : item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october).toFixed(1),
item.item_report === 'ROIC' ? Number(item.november).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.november, formula: item.november_formula } : item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november).toFixed(1),
item.item_report === 'ROIC' ? Number(item.december).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.december, formula: item.december_formula } : item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december).toFixed(1),
item.item_report === 'ROIC' ? Number(item.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.january).toFixed(1) : { value: item.january, formula: item.january_formula } : item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1),
item.item_report === 'ROIC' ? Number(item.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.february).toFixed(1) : { value: item.february, formula: item.february_formula } : item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1),
item.item_report === 'ROIC' ? Number(item.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.march).toFixed(1) : { value: item.march, formula: item.march_formula } : item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1),
item.item_report === 'ROIC' ? Number(item.april).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.april).toFixed(1) : { value: item.april, formula: item.april_formula } : item.april == "" ? item.april : String(item.april).indexOf(".") == -1 ? Number(item.april) : Number(item.april).toFixed(1),
item.item_report === 'ROIC' ? Number(item.may).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.may).toFixed(1) : { value: item.may, formula: item.may_formula } : item.may == "" ? item.may : String(item.may).indexOf(".") == -1 ? Number(item.may) : Number(item.may).toFixed(1),
item.item_report === 'ROIC' ? Number(item.june).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.june).toFixed(1) : { value: item.june, formula: item.june_formula } : item.june == "" ? item.june : String(item.june).indexOf(".") == -1 ? Number(item.june) : Number(item.june).toFixed(1),
item.item_report === 'ROIC' ? Number(item.july).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.july).toFixed(1) : { value: item.july, formula: item.july_formula } : item.july == "" ? item.july : String(item.july).indexOf(".") == -1 ? Number(item.july) : Number(item.july).toFixed(1),
item.item_report === 'ROIC' ? Number(item.august).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.august).toFixed(1) : { value: item.august, formula: item.august_formula } : item.august == "" ? item.august : String(item.august).indexOf(".") == -1 ? Number(item.august) : Number(item.august).toFixed(1),
item.item_report === 'ROIC' ? Number(item.september).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.september).toFixed(1) : { value: item.september, formula: item.september_formula } : item.september == "" ? item.september : String(item.september).indexOf(".") == -1 ? Number(item.september) : Number(item.september).toFixed(1),
item.item_report === 'ROIC' ? Number(item.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.october).toFixed(1) : { value: item.october, formula: item.october_formula } : item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october).toFixed(1),
item.item_report === 'ROIC' ? Number(item.november).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.november).toFixed(1) : { value: item.november, formula: item.november_formula } : item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november).toFixed(1),
item.item_report === 'ROIC' ? Number(item.december).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.december).toFixed(1) : { value: item.december, formula: item.december_formula } : item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december).toFixed(1),
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).toFixed(1),
item.item_report === 'ROIC' ? Number(item.total_next_year).toFixed(1) : item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1),
item.item_report === 'ROIC' ? Number(item.total_more_year).toFixed(1) : item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1),
......@@ -450,9 +540,17 @@ export default class CorporateAnnualTarget extends Component {
item.error
])
})
// // console.log(dataTable)
let checkDataFin = dataFin.filter((val) => val.check == false)
let checkDataLearn = dataLearn.filter((val) => val.check == false)
let handleDataSalah = this.state.handleDataSalah
if (checkDataFin.length > 0 || checkDataLearn.length > 0) {
handleDataSalah = true
}
// console.log(indexCheck)
// // // console.log(this.state.buttonError)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete }, () => {
// console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete, handleDataSalah }, () => {
this.state.dataTable.map(item => {
if (item[30].length > 0) {
// // // console.log('masuk')
......@@ -521,18 +619,18 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(1)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(i[13]),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(1)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(i[14]),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(1)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(i[15]),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(1)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(i[16]),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(1)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(i[17]),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(1)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(i[18]),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(1)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(i[19]),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(i[20]),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(i[21]),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(1)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(i[24]),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(1)) : stateFR ? i[0] == 3? String(i[13]) : String(Number(i[13].value).toFixed(1)) : String(i[13]),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(1)) : stateFR ? i[0] == 3? String(i[14]) : String(Number(i[14].value).toFixed(1)) : String(i[14]),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(1)) : stateFR ? i[0] == 3? String(i[15]) : String(Number(i[15].value).toFixed(1)) : String(i[15]),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(1)) : stateFR ? i[0] == 3? String(i[16]) : String(Number(i[16].value).toFixed(1)) : String(i[16]),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(1)) : stateFR ? i[0] == 3? String(i[17]) : String(Number(i[17].value).toFixed(1)) : String(i[17]),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(1)) : stateFR ? i[0] == 3? String(i[18]) : String(Number(i[18].value).toFixed(1)) : String(i[18]),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(1)) : stateFR ? i[0] == 3? String(i[19]) : String(Number(i[19].value).toFixed(1)) : String(i[19]),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? i[0] == 3? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : stateFR ? i[0] == 3? String(i[23]) : String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(1)) : stateFR ? i[0] == 3? String(i[24]) : String(Number(i[24].value).toFixed(1)) : String(i[24]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[25]).toFixed(1)) : String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": i[6] === 'ROIC' ? String(Number(i[26]).toFixed(1)) : String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": i[6] === 'ROIC' ? String(Number(i[27]).toFixed(1)) : String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
......@@ -549,7 +647,7 @@ export default class CorporateAnnualTarget extends Component {
"status": type,
"cat": data
}
// // console.log(data);
// console.log(data);
// console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // // console.log(response);
......@@ -740,18 +838,18 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(1)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(i[13]),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(1)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(i[14]),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(1)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(i[15]),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(1)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(i[16]),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(1)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(i[17]),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(1)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(i[18]),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(1)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(i[19]),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(i[20]),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(i[21]),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(1)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(i[24]),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[13]) : String(Number(i[13].value).toFixed(1)) : String(i[13]),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[14]) : String(Number(i[14].value).toFixed(1)) : String(i[14]),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[15]) : String(Number(i[15].value).toFixed(1)) : String(i[15]),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[16]) : String(Number(i[16].value).toFixed(1)) : String(i[16]),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[17]) : String(Number(i[17].value).toFixed(1)) : String(i[17]),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[18]) : String(Number(i[18].value).toFixed(1)) : String(i[18]),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[19]) : String(Number(i[19].value).toFixed(1)) : String(i[19]),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[23]) : String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[24]) : String(Number(i[24].value).toFixed(1)) : String(i[24]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[25]).toFixed(1)) : String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": i[6] === 'ROIC' ? String(Number(i[26]).toFixed(1)) : String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": i[6] === 'ROIC' ? String(Number(i[27]).toFixed(1)) : String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
......@@ -1271,7 +1369,11 @@ export default class CorporateAnnualTarget extends Component {
if (idParent !== null) {
let indexsss = dataTable2.findIndex((val) => val[1] == idParent)
if (dataTable2[indexsss][6] == 'FINANCIAL PERSPECTIVE') {
return true
if (tableMeta.rowData[0] == 3) {
return false
} else {
return true
}
} else {
return false
}
......@@ -1744,11 +1846,11 @@ export default class CorporateAnnualTarget extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(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={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
......@@ -3442,23 +3544,23 @@ export default class CorporateAnnualTarget extends Component {
{(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && <button
className="button"
type="button"
disabled={this.state.buttonDraft}
disabled={this.state.buttonDraft? true : this.state.handleDataSalah? true : false}
style={{
backgroundColor: 'transparent',
cursor: this.state.editable === true ? 'default' : 'pointer',
cursor: this.state.editable === true ? 'default' : this.state.handleDataSalah? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.state.editable ?
this.setState({ alert: true }) : this.setState({ loading: true }, () =>
this.setState({ alert: true }) : (this.state.handleDataSalah? null : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("draft")
}, 100);
})
)
))
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......@@ -3469,22 +3571,22 @@ export default class CorporateAnnualTarget extends Component {
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.editable !== true ? 'pointer' : 'default',
cursor: this.state.editable === true ? 'default' : this.state.handleDataSalah? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
disabled={this.state.buttonDraft}
disabled={this.state.buttonDraft? true : this.state.handleDataSalah? true : false}
onClick={() =>
this.state.editable ? this.setState({ alert: true }) :
this.state.buttonError === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) : this.setState({ loading: true }, () =>
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) : (this.state.handleDataSalah? null : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => {
this.uploadCAT("submitted")
}, 100);
})
)
))
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
......
......@@ -2256,11 +2256,11 @@ export default class FixedAssetsMovement extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(handleTotal(tableMeta)).toFixed(1)}
/>
}
/>
......@@ -2290,16 +2290,16 @@ export default class FixedAssetsMovement extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
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)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
disabled={true}
value={Number(handleTotal(tableMeta)).toFixed(1)}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
}
/>
......
......@@ -520,9 +520,11 @@ export default class BalanceSheetMR extends Component {
if (String(item).includes('#')) {
if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
let indexID = dataTable2.findIndex((val) => val[21] == tst)
// let indexID = dataTable2.findIndex((val) => val[21] == tst)
let data = tableMeta.rowData[20]
let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
if (indexID !== -1) {
let valuezz = dataTable2[indexID][9]
let valuezz = data[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
......@@ -584,9 +586,11 @@ export default class BalanceSheetMR extends Component {
let totalPrio = 0
let optPrio = ""
let prio = false
let optPrev = ""
anjay2.map((item, index) => {
if (Array.isArray(item)) {
prio = true
optPrev = opt
item.map((items, indexs) => {
if (items == "+") {
optPrio = "tambah"
......@@ -628,7 +632,17 @@ export default class BalanceSheetMR extends Component {
if (item == "+") {
opt = "tambah"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
if (optPrev == "tambah") {
total = Number(total) + Number(totalPrio)
} else if (optPrev == "kurang") {
total = Number(total) - Number(totalPrio)
} else if (optPrev == "kali") {
total = Number(total) * Number(totalPrio)
} else if (optPrev == "bagi") {
total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
} else {
total += Number(totalPrio)
}
prio = false
totalPrio = 0
optPrio = ""
......@@ -636,7 +650,17 @@ export default class BalanceSheetMR extends Component {
} else if (item == "-") {
opt = "kurang"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
if (optPrev == "tambah") {
total = Number(total) + Number(totalPrio)
} else if (optPrev == "kurang") {
total = Number(total) - Number(totalPrio)
} else if (optPrev == "kali") {
total = Number(total) * Number(totalPrio)
} else if (optPrev == "bagi") {
total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
} else {
total += Number(totalPrio)
}
prio = false
totalPrio = 0
optPrio = ""
......@@ -644,7 +668,17 @@ export default class BalanceSheetMR extends Component {
} else if (item == "*") {
opt = "kali"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
if (optPrev == "tambah") {
total = Number(total) + Number(totalPrio)
} else if (optPrev == "kurang") {
total = Number(total) - Number(totalPrio)
} else if (optPrev == "kali") {
total = Number(total) * Number(totalPrio)
} else if (optPrev == "bagi") {
total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
} else {
total += Number(totalPrio)
}
prio = false
totalPrio = 0
optPrio = ""
......@@ -652,7 +686,17 @@ export default class BalanceSheetMR extends Component {
} else if (item == "/") {
opt = "bagi"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
if (optPrev == "tambah") {
total = Number(total) + Number(totalPrio)
} else if (optPrev == "kurang") {
total = Number(total) - Number(totalPrio)
} else if (optPrev == "kali") {
total = Number(total) * Number(totalPrio)
} else if (optPrev == "bagi") {
total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
} else {
total += Number(totalPrio)
}
prio = false
totalPrio = 0
optPrio = ""
......
......@@ -51,11 +51,227 @@ export default class CashFlowMR extends Component {
}
}
componentDidMount() {
this.getItemHierarki()
// this.getSettingControl()
}
getItemHierarki() {
let payload = {
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"monthly_report_id": this.props.monthlyReportId,
"months": this.props.month.month_id
}
api.create().getHierarkiMontlyReportCF(payload).then(response => {
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
{ value: item.cash_flow.actual, formula: item.cash_flow.actual_formula },
item.order,
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
{ value: item.cash_flow.actual, formula: item.cash_flow.actual_formula },
item.order,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, loading: false })
}
})
}
render() {
let dataTable = [
["1", "2", "2", "2", "2", "2", "3"],
["1", "2", "2", "2", "2", "2", "3"],
]
let dataTable2 = this.state.dataTable
const handleValueFormula = (value, tableMeta, column, periode, forecast) => {
let splitFormula = String(tableMeta.rowData[3]).split('@')
let baru = []
let anjay = []
splitFormula.map((item, index) => {
let items = String(item).substr(Number(String(item).length) - 1, 1)
let re = /^[a-zA-Z0-9]+$/;
let asd = ''
if (item !== "") {
if (!re.test(items)) {
if (String(item).substr(Number(String(item).length) - 1, 1) === ']') {
baru.push(String(item))
} else {
baru.push(String(item).substr(0, Number(String(item).length) - 1))
baru.push(String(item).substr(Number(String(item).length) - 1, 1))
}
} else {
baru.push(String(item))
}
}
})
// if (tableMeta.columnIndex == 7) {
// console.log(splitFormula)
// console.log(baru)
// }
// console.log(baru)
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*') {
anjay.push(item)
} else {
if (String(item).includes('#')) {
if (forecast !== undefined) {
let forecastt = 0
forecast.map((items, index) => {
if (items.periode == periode) {
forecastt += Number(items.value)
}
})
anjay.push(forecastt)
} else if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
// console.log(tableMeta.columnIndex)
let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// console.log(indexID)
if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value
// baru.push(valuezz)
anjay.push(valuezz == "" ? 0 : valuezz)
// console.log(valuezz)
}
} else {
// console.log(baru);
// console.log(value);
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
// console.log(indexID)
if (indexID !== -1) {
// console.log(value.formula[indexID].value)
let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
} else if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
if (tableMeta.columnIndex === 7 || tableMeta.columnIndex === 19) {
let indexID = dataTable2.findIndex((val) => val[22] == tst)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][6]
anjay.push(valuezz == "" ? 0 : valuezz)
}
// } else if (tableMeta.columnIndex === 19) {
// let indexID = dataTable2.findIndex((val) => val[22] == tst)
// if (indexID !== -1) {
// let valuezz = dataTable2[indexID][7].value !== undefined ? dataTable2[indexID][7].value : dataTable2[indexID][7]
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
} else {
let data = tableMeta.columnIndex - 1
let indexID = dataTable2.findIndex((val) => val[7] == tst)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][data].value !== undefined ? dataTable2[indexID][data].value : dataTable2[indexID][data]
anjay.push(valuezz == "" ? 0 : valuezz)
}
// console.log(tst, data, tableMeta.rowData[data]);
}
} else {
let indexID = dataTable2.findIndex((val) => val[7] == item)
// console.log(dataTable2[indexID])
if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz == "" ? 0 : valuezz)
} else {
if (item === '(-1)') {
anjay.push(-1)
}
// console.log(item);
}
}
}
})
// console.log(baru)
// console.log(anjay)
let total = 0
let opt = ""
anjay.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
item = item == "" ? 0 : item
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
})
total = R.equals(total, NaN) ? "0.0" : total
// console.log(dataTable2[tableMeta.rowIndex][22])
// console.log(tableMeta.rowData[5])
// if (tableMeta.rowData[5] == 'Beginning Balance') {
// console.log(baru)
// console.log(anjay)
// console.log(total)
// }
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
// // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
// }
return total
}
let columns = [
{
name: "",
......@@ -129,9 +345,9 @@ export default class CashFlowMR extends Component {
// <TableCell style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
// <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
// </TableCell> :
<TableCell style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
<TableCell style={{ ...style2, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({
style: {
......@@ -142,14 +358,21 @@ export default class CashFlowMR extends Component {
}
}),
customBodyRender: (value, tableMeta, updateValue) => {
console.log(tableMeta);
return (
<div style={{ textAlign: 'right' }}>
{value}
{null}
</div>
)
}
}
}
},
{
name: "",
options: {
display: false
}
},
]
const loadingComponent = (
......@@ -210,7 +433,7 @@ export default class CashFlowMR extends Component {
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable}
data={dataTable2}
columns={columns}
options={options}
/>
......
......@@ -927,41 +927,41 @@ export default class FixedAssetsMovementMR extends Component {
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ borderLeft: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 45, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div style={{ borderBottom: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', border: '1px #fff solid', backgroundColor: '#37b5e6', borderBottom: '1px solid #37b5e6' }}>
<div style={{ borderBottom: '1px #fff solid', padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"Act vs Previous Month"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid', padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div className="column-2" style={{ padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"%"}</span>
</div>
</div>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', border: '1px #fff solid', backgroundColor: '#07a7d0', borderBottom: '1px solid #37b5e6' }}>
<div style={{ borderBottom: '1px #fff solid', padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"Act vs MB"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid', padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<div className="column-2" style={{ padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"%"}</span>
</div>
</div>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
<div style={{ borderBottom: '1px #fff solid' }}>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', border: '1px #fff solid', backgroundColor: '#07a7d0', borderBottom: '1px solid #37b5e6' }}>
<div style={{ borderBottom: '1px #fff solid', padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"Act vs RB"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid', padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<div className="column-2" style={{ padding: 2.5, backgroundColor: '#37b5e6' }}>
<span>{"%"}</span>
</div>
</div>
......@@ -1198,6 +1198,7 @@ export default class FixedAssetsMovementMR extends Component {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
{this.state.loading && loadingComponent}
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
</div>
......@@ -1273,16 +1274,17 @@ export default class FixedAssetsMovementMR extends Component {
</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>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
{/* <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography> */}
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
......@@ -1344,7 +1346,7 @@ export default class FixedAssetsMovementMR extends Component {
onClick={() =>
this.state.editable === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('draft')
})
......@@ -1361,7 +1363,7 @@ export default class FixedAssetsMovementMR extends Component {
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
......@@ -1394,14 +1396,15 @@ export default class FixedAssetsMovementMR extends Component {
</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>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
......@@ -1464,7 +1467,7 @@ export default class FixedAssetsMovementMR extends Component {
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadFAMMR('draft')
})
......@@ -1481,7 +1484,7 @@ export default class FixedAssetsMovementMR extends Component {
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.state.handleTekTekTek === 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.uploadFAMMR('submitted')
})}
......
......@@ -680,7 +680,7 @@ export default class ProfitLossMR extends Component {
}
}
}, {
name: "Rolling Outlook (FY 2021)",
name: `Rolling Outlook (FY ${this.props.periode})`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#07a7d0', width: 96, borderLeft: '1px #fff solid', borderRight: '1px #fff solid' }}>
......
......@@ -197,7 +197,7 @@ export default class TaxPlanningMR extends Component {
} else {
this.setState({ dataTable, loading: false, editable: true })
}
// console.log(this.state.dataTable)
console.log(this.state.dataTable)
})
}
......@@ -243,7 +243,7 @@ export default class TaxPlanningMR extends Component {
}
api.create('UPLOAD').createMonthlyReportTP(payload).then(response => {
// console.log(payload);
console.log(payload);
console.log(response);
if (response.data) {
if (response.data.status === "success") {
......@@ -332,6 +332,7 @@ export default class TaxPlanningMR extends Component {
},
item.trial_balance_fiscal_actual === null ? "0.0" : item.trial_balance_fiscal_actual === "" ? "0.0" : item.trial_balance_fiscal_actual,
item.trial_balance_fiscal_mb === null ? "0.0" : item.trial_balance_fiscal_mb === "" ? "0.0" : item.trial_balance_fiscal_mb,
item.actual_formula,
item.orders,
{ tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf },
{ tbc: item.condition_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf },
......@@ -340,7 +341,7 @@ export default class TaxPlanningMR extends Component {
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
this.state.dataTable.map(item => {
if (item[15].length > 0) {
if (item[16].length > 0) {
// console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
}
......@@ -1064,42 +1065,42 @@ export default class TaxPlanningMR extends Component {
/>
</div>
:
tableMeta.rowData[3] === 7 ? null
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
// </LightTooltip>
tableMeta.rowData[3] === 7 ?
(Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
</LightTooltip>
:
null
}
......@@ -1182,42 +1183,42 @@ export default class TaxPlanningMR extends Component {
/>
</div>
:
tableMeta.rowData[0] === 7 ? null
// (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'black'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
// fontSize: 12,
// textAlign: 'right',
// borderColor: 'transparent',
// margin: 0,
// width: 96,
// backgroundColor: 'transparent',
// color: 'red'
// }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// />
// </LightTooltip>
tableMeta.rowData[0] === 7 ?
(Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/>
</LightTooltip>
:
<div style={{ flex: 1 }}>
<FormControlLabel
......@@ -1331,7 +1332,7 @@ export default class TaxPlanningMR extends Component {
// disabled={true}
// value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
// /> :
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[13].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[14].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
// <NumberFormat
// thousandSeparator={true}
// style={{
......
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