Commit 1f8f36e2 authored by Riri Novita's avatar Riri Novita

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

OLPA & MB PL Update

See merge request !2014
parents 58fd59c9 1eb78136
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,6 +11,7 @@ import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import * as R from 'ramda';
import Constant from '../../library/Constant';
import { fixNumber, titleCase } from '../../library/Utils';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -202,19 +203,19 @@ export default class BalanceSheetOLPA extends Component {
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Number(item.balance_sheet.january).toFixed(1),
Number(item.balance_sheet.february).toFixed(1),
Number(item.balance_sheet.march).toFixed(1),
Number(item.balance_sheet.april).toFixed(1),
Number(item.balance_sheet.may).toFixed(1),
Number(item.balance_sheet.june).toFixed(1),
Number(item.balance_sheet.july).toFixed(1),
Number(item.balance_sheet.august).toFixed(1),
Number(item.balance_sheet.september).toFixed(1),
Number(item.balance_sheet.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november).toFixed(1), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december).toFixed(1), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
Number(item.balance_sheet.total_current_year).toFixed(1),
Number(item.balance_sheet.january),
Number(item.balance_sheet.february),
Number(item.balance_sheet.march),
Number(item.balance_sheet.april),
Number(item.balance_sheet.may),
Number(item.balance_sheet.june),
Number(item.balance_sheet.july),
Number(item.balance_sheet.august),
Number(item.balance_sheet.september),
Number(item.balance_sheet.october),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december),
Number(item.balance_sheet.total_current_year),
item.order,
item.condition_it_should_be,
item.condition_if_wrong,
......@@ -238,19 +239,19 @@ export default class BalanceSheetOLPA extends Component {
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Number(item.balance_sheet.january).toFixed(1),
Number(item.balance_sheet.february).toFixed(1),
Number(item.balance_sheet.march).toFixed(1),
Number(item.balance_sheet.april).toFixed(1),
Number(item.balance_sheet.may).toFixed(1),
Number(item.balance_sheet.june).toFixed(1),
Number(item.balance_sheet.july).toFixed(1),
Number(item.balance_sheet.august).toFixed(1),
Number(item.balance_sheet.september).toFixed(1),
Number(item.balance_sheet.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november).toFixed(1), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december).toFixed(1), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
Number(item.balance_sheet.total_current_year).toFixed(1),
Number(item.balance_sheet.january),
Number(item.balance_sheet.february),
Number(item.balance_sheet.march),
Number(item.balance_sheet.april),
Number(item.balance_sheet.may),
Number(item.balance_sheet.june),
Number(item.balance_sheet.july),
Number(item.balance_sheet.august),
Number(item.balance_sheet.september),
Number(item.balance_sheet.october),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.november) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december),
Number(item.balance_sheet.total_current_year),
item.order,
item.condition_it_should_be,
item.condition_if_wrong,
......@@ -300,25 +301,47 @@ export default class BalanceSheetOLPA extends Component {
backToOLPA(type) {
let data = []
if (this.props.defaultCurrency.id == 2) {
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])),
})
})
} else {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(fixNumber(Number(i[6]), 1)),
january: i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
february: i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
march: i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
april: i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
may: i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
june: i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
july: i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
august: i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[17].value), 1)) : String(fixNumber(Number(i[17]), 1))),
december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[18].value), 1)) : String(fixNumber(Number(i[18]), 1))),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
})
})
}
let payload = {
"outlook_pa_id": this.props.outlook_pa_id,
"company_id": this.props.company.company_id,
......@@ -431,19 +454,19 @@ export default class BalanceSheetOLPA extends Component {
item.level,
item.item_report,
item.total_actual_before,
Number(item.january).toFixed(1),
Number(item.february).toFixed(1),
Number(item.march).toFixed(1),
Number(item.april).toFixed(1),
Number(item.may).toFixed(1),
Number(item.june).toFixed(1),
Number(item.july).toFixed(1),
Number(item.august).toFixed(1),
Number(item.september).toFixed(1),
Number(item.october).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.november).toFixed(1), formula: item.november_formula } : Number(item.november).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.december).toFixed(1), formula: item.december_formula } : Number(item.december).toFixed(1),
Number(item.total_current_year).toFixed(1),
Number(item.january),
Number(item.february),
Number(item.march),
Number(item.april),
Number(item.may),
Number(item.june),
Number(item.july),
Number(item.august),
Number(item.september),
Number(item.october),
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.november), formula: item.november_formula } : Number(item.november),
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.december), formula: item.december_formula } : Number(item.december),
Number(item.total_current_year),
item.orders,
item.condition_it_should_be,
item.condition_if_wrong,
......@@ -477,25 +500,48 @@ export default class BalanceSheetOLPA extends Component {
uploadBalanceSheet(type) {
let data = []
if (this.props.defaultCurrency.id == 2) {
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])),
})
})
} else {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(fixNumber(Number(i[6]), 1)),
january: i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
february: i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
march: i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
april: i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
may: i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
june: i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
july: i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
august: i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[17].value), 1)) : String(fixNumber(Number(i[17]), 1))),
december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[18].value), 1)) : String(fixNumber(Number(i[18]), 1))),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
})
})
}
let body = {
outlook_pa_id: this.props.outlook_pa_id,
company_id: this.props.company.company_id,
......@@ -571,19 +617,19 @@ export default class BalanceSheetOLPA extends Component {
// console.log(this.state.dataTable)
dataTable.map((i, index) => {
if (String(i[5]) == "Control (should be nil)") {
console.log(this.state.minValue)
console.log(this.state.maxValue)
console.log(Number(i[17].value).toFixed(1))
console.log(Number(i[18].value).toFixed(1))
console.log(Number(i[19]).toFixed(1))
// console.log(this.state.minValue)
// console.log(this.state.maxValue)
// console.log(Number(i[17].value).toFixed(1))
// 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 ((this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[17].value), 1) : Number(i[17].value) < Number(this.state.minValue)) || (this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[17].value), 1) : 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 ((this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[18].value), 1) : Number(i[18].value) < Number(this.state.minValue)) || (this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[18].value), 1) : 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 ((this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[19]), 1) : Number(i[19]) < Number(this.state.minValue)) || (this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[19]), 1) : Number(i[19]) > Number(this.state.maxValue))) {
console.log("masuk selisih control 3")
err = true
}
......@@ -592,19 +638,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))
......@@ -953,7 +999,7 @@ export default class BalanceSheetOLPA extends Component {
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value).toFixed(1)}
// value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
// />
// }
// />
......@@ -970,7 +1016,7 @@ export default class BalanceSheetOLPA extends Component {
placeholder=""
disabled={true}
// disabled={this.props.isApprover == true ? 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={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
......@@ -1005,7 +1051,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1019,7 +1065,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1051,7 +1097,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1065,7 +1111,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1097,7 +1143,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1111,7 +1157,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1143,7 +1189,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1157,7 +1203,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1189,7 +1235,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1203,7 +1249,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1235,7 +1281,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1249,7 +1295,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1281,7 +1327,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1295,7 +1341,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1327,7 +1373,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1341,7 +1387,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1373,7 +1419,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1387,7 +1433,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1419,7 +1465,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1433,7 +1479,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : (Number(value) == 0 ? "0.0" : Number(value))}
decimalScale={1}
/>
}
......@@ -1466,7 +1512,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.status === 'CLOSED' ? Number(value).toFixed(1) : (tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7 ? Number(value.value).toFixed(1) : Number(value).toFixed(1))}
value={this.props.status === 'CLOSED' ? fixNumber(Number(value), 1) : (tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7 ? (fixNumber(Number(value.value), 1) == 0 ? "0.0" : fixNumber(Number(value.value), 1)) : (fixNumber(Number(value), 1) == 0 ? "0.0" : fixNumber(Number(value), 1)))}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1482,7 +1528,7 @@ export default class BalanceSheetOLPA extends Component {
placeholder=""
// disabled={this.props.isApprover == true ? 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)
......@@ -1499,7 +1545,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(tableMeta)), 1) : (Number(handleValue(tableMeta)) == 0 ? "0.0" : Number(handleValue(tableMeta)))}
/>
</span>
:
......@@ -1513,7 +1559,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta)), 1) : (Number(handleValueFormula(value, tableMeta)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta)))}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1523,14 +1569,50 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta)), 1) : (Number(handleValueFormula(value, tableMeta)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta)))}
/>
:
tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] === 7 ?
(Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
this.props.defaultCurrency.id == 1 ?
(fixNumber(Number(handleValidation(value, tableMeta)), 1) >= Number(this.state.minValue) && fixNumber(Number(handleValidation(value, tableMeta)), 1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : fixNumber(Number(handleValidation(value, tableMeta)), 1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `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(handleValidation(value, tableMeta)) == 0 ? "0.0" : fixNumber(Number(handleValidation(value, tableMeta)), 1)}
/>
</LightTooltip>
:
(Number(handleValidation(value, tableMeta)) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1544,7 +1626,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : Number(handleValidation(value, tableMeta))}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1561,7 +1643,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : Number(handleValidation(value, tableMeta))}
/>
</LightTooltip>
:
......@@ -1593,7 +1675,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={this.props.status === 'CLOSED' ? Number(value).toFixed(1) : (tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7 ? Number(value.value).toFixed(1) : Number(value).toFixed(1))}
value={Number(value) == 0 ? "0.0" : this.props.status === 'CLOSED' ? fixNumber(Number(value), 1) : (tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7 ? Number(value.value).toFixed(1) : Number(value).toFixed(1))}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1609,7 +1691,7 @@ export default class BalanceSheetOLPA extends Component {
placeholder=""
// disabled={this.props.isApprover == true ? 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)
......@@ -1626,7 +1708,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(tableMeta)), 1) : (Number(handleValue(tableMeta)) == 0 ? "0.0" : Number(handleValue(tableMeta)))}
/>
</span>
:
......@@ -1640,7 +1722,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta)), 1) : (Number(handleValueFormula(value, tableMeta)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta)))}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1650,14 +1732,15 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta)), 1) : (Number(handleValueFormula(value, tableMeta)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta)))}
/>
:
tableMeta.rowData[0] === 1 ?
null
:
tableMeta.rowData[0] === 7 ?
(Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
this.props.defaultCurrency.id == 1 ?
(fixNumber(Number(handleValidation(value, tableMeta)), 1) >= Number(this.state.minValue) && fixNumber(Number(handleValidation(value, tableMeta)), 1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1671,7 +1754,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : fixNumber(Number(handleValidation(value, tableMeta)), 1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1688,7 +1771,42 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : fixNumber(Number(handleValidation(value, tableMeta)), 1)}
/>
</LightTooltip>
:
(Number(handleValidation(value, tableMeta)) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : Number(handleValidation(value, tableMeta))}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `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(handleValidation(value, tableMeta)) == 0 ? "0.0" : Number(handleValidation(value, tableMeta))}
/>
</LightTooltip>
:
......@@ -1720,7 +1838,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1736,7 +1854,7 @@ export default class BalanceSheetOLPA extends Component {
placeholder=""
// disabled={this.props.isApprover == true ? 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={Number(value) == 0 ? "0.0" : fixNumber(Number(value), 1)}
onBlur={(event) => {
handleChange(event.target.value, tableMeta)
// console.log(dataTable2)
......@@ -1753,7 +1871,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(tableMeta)), 1) : (Number(handleValue(tableMeta)) == 0 ? "0.0" : Number(handleValue(tableMeta)))}
/>
</span>
:
......@@ -1784,7 +1902,43 @@ export default class BalanceSheetOLPA extends Component {
null
:
tableMeta.rowData[0] === 7 ?
(Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
this.props.defaultCurrency.id == 1 ?
(fixNumber(Number(handleValidation(value, tableMeta)), 1) >= Number(this.state.minValue) && fixNumber(Number(handleValidation(value, tableMeta)), 1) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : fixNumber(Number(handleValidation(value, tableMeta)), 1)}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `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(handleValidation(value, tableMeta)) == 0 ? "0.0" : fixNumber(Number(handleValidation(value, tableMeta)), 1)}
/>
</LightTooltip>
:
(Number(handleValidation(value, tableMeta)) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)) <= Number(this.state.maxValue)) ?
<NumberFormat
thousandSeparator={true}
style={{
......@@ -1798,7 +1952,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : Number(handleValidation(value, tableMeta))}
/> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat
......@@ -1815,7 +1969,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
value={Number(handleValidation(value, tableMeta)) == 0 ? "0.0" : Number(handleValidation(value, tableMeta))}
/>
</LightTooltip>
:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,7 +9,7 @@ import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant';
import UploadFile from "../../library/Upload";
import { Alert, Autocomplete } from '@material-ui/lab';
import { titleCase, roundMath } from '../../library/Utils';
import { titleCase, roundMath, fixNumber } from '../../library/Utils';
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import Tooltip from '@material-ui/core/Tooltip';
......@@ -153,24 +153,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
......@@ -192,24 +192,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
......@@ -392,6 +392,7 @@ export default class CorporateAnnualTargetRO extends Component {
stateFR = false
}
// console.log(i[9] == null? "" : i[9].value)
if (this.props.defaultCurrency.id == 2) {
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
// "item_name": String(i[5]),
......@@ -401,22 +402,50 @@ export default class CorporateAnnualTargetRO extends Component {
"kpi_type": i[8] == null ? "" : i[8].value,
"max_ach": i[9] == null ? "" : i[9].value,
"formula": i[10] == null ? "" : i[10].value,
"january": stateFR ? i[0] == 3 ? String(i[11]) : String(Number(i[11].value).toFixed(1)) : String(i[11]),
"february": stateFR ? i[0] == 3 ? String(i[12]) : String(Number(i[12].value).toFixed(1)) : String(i[12]),
"march": stateFR ? i[0] == 3 ? String(i[13]) : String(Number(i[13].value).toFixed(1)) : String(i[13]),
"april": stateFR ? i[0] == 3 ? String(i[14]) : String(Number(i[14].value).toFixed(1)) : String(i[14]),
"may": stateFR ? i[0] == 3 ? String(i[15]) : String(Number(i[15].value).toFixed(1)) : String(i[15]),
"june": stateFR ? i[0] == 3 ? String(i[16]) : String(Number(i[16].value).toFixed(1)) : String(i[16]),
"july": stateFR ? i[0] == 3 ? String(i[17]) : String(Number(i[17].value).toFixed(1)) : String(i[17]),
"august": stateFR ? i[0] == 3 ? String(i[18]) : String(Number(i[18].value).toFixed(1)) : String(i[18]),
"september": stateFR ? i[0] == 3 ? String(i[19]) : String(Number(i[19].value).toFixed(1)) : String(i[19]),
"october": stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"november": stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"december": stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"total_current_year": String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"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": String(i[24]),
"pic": String(i[25])
})
} else {
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
// "item_name": String(i[5]),
// "parent": i[2] == "" ? null : i[2],
"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": i[10] == null ? "" : i[10].value,
"january": stateFR ? i[0] == 3 ? String(i[11]) : String(fixNumber(Number(i[11].value), 1)) : String(i[11]),
"february": stateFR ? i[0] == 3 ? String(i[12]) : String(fixNumber(Number(i[12].value), 1)) : String(i[12]),
"march": stateFR ? i[0] == 3 ? String(i[13]) : String(fixNumber(Number(i[13].value), 1)) : String(i[13]),
"april": stateFR ? i[0] == 3 ? String(i[14]) : String(fixNumber(Number(i[14].value), 1)) : String(i[14]),
"may": stateFR ? i[0] == 3 ? String(i[15]) : String(fixNumber(Number(i[15].value), 1)) : String(i[15]),
"june": stateFR ? i[0] == 3 ? String(i[16]) : String(fixNumber(Number(i[16].value), 1)) : String(i[16]),
"july": stateFR ? i[0] == 3 ? String(i[17]) : String(fixNumber(Number(i[17].value), 1)) : String(i[17]),
"august": stateFR ? i[0] == 3 ? String(i[18]) : String(fixNumber(Number(i[18].value), 1)) : String(i[18]),
"september": stateFR ? i[0] == 3 ? String(i[19]) : String(fixNumber(Number(i[19].value), 1)) : String(i[19]),
"october": stateFR ? i[0] == 3 ? String(i[20]) : String(fixNumber(Number(i[20].value), 1)) : String(i[20]),
"november": stateFR ? i[0] == 3 ? String(i[21]) : String(fixNumber(Number(i[21].value), 1)) : String(i[21]),
"december": stateFR ? i[0] == 3 ? String(i[22]) : String(fixNumber(Number(i[22].value), 1)) : String(i[22]),
"total_current_year": String(fixNumber(Number(i[23]), 1)) == "" ? "0.0" : String(fixNumber(Number(i[23]), 1)),
"strategic": String(i[24]),
"pic": String(i[25])
})
}
})
// console.log(JSON.stringify(data))
let payload = {
......@@ -491,18 +520,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()
})
......@@ -521,7 +550,7 @@ export default class CorporateAnnualTargetRO extends Component {
profit_loss: [],
tax_planning: [],
}
// console.log(body)
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
}
});
......@@ -534,7 +563,7 @@ export default class CorporateAnnualTargetRO extends Component {
}
this.setState({ loading: true, dataTable: [] })
api.create().checkUploadOLPA(payload).then(response => {
console.log(JSON.stringify(this.state.payload));
// console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload)
console.log(response)
if (response.data) {
......@@ -560,19 +589,19 @@ export default class CorporateAnnualTargetRO extends Component {
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).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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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,
......@@ -627,6 +656,7 @@ export default class CorporateAnnualTargetRO extends Component {
stateFR = false
}
if (this.state.defaultCurrencyUpload?.id == 2) {
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_report": String(i[5]),
......@@ -635,22 +665,50 @@ export default class CorporateAnnualTargetRO extends Component {
"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).toFixed(1)) : String(i[11]),
"february": stateFR ? i[0] == 3 ? String(i[12]) : String(Number(i[12].value).toFixed(1)) : String(i[12]),
"march": stateFR ? i[0] == 3 ? String(i[13]) : String(Number(i[13].value).toFixed(1)) : String(i[13]),
"april": stateFR ? i[0] == 3 ? String(i[14]) : String(Number(i[14].value).toFixed(1)) : String(i[14]),
"may": stateFR ? i[0] == 3 ? String(i[15]) : String(Number(i[15].value).toFixed(1)) : String(i[15]),
"june": stateFR ? i[0] == 3 ? String(i[16]) : String(Number(i[16].value).toFixed(1)) : String(i[16]),
"july": stateFR ? i[0] == 3 ? String(i[17]) : String(Number(i[17].value).toFixed(1)) : String(i[17]),
"august": stateFR ? i[0] == 3 ? String(i[18]) : String(Number(i[18].value).toFixed(1)) : String(i[18]),
"september": stateFR ? i[0] == 3 ? String(i[19]) : String(Number(i[19].value).toFixed(1)) : String(i[19]),
"october": stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"november": stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"december": stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"total_current_year": String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"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])
})
} else {
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(fixNumber(Number(i[11].value), 1)) : String(i[11]),
"february": stateFR ? i[0] == 3 ? String(i[12]) : String(fixNumber(Number(i[12].value), 1)) : String(i[12]),
"march": stateFR ? i[0] == 3 ? String(i[13]) : String(fixNumber(Number(i[13].value), 1)) : String(i[13]),
"april": stateFR ? i[0] == 3 ? String(i[14]) : String(fixNumber(Number(i[14].value), 1)) : String(i[14]),
"may": stateFR ? i[0] == 3 ? String(i[15]) : String(fixNumber(Number(i[15].value), 1)) : String(i[15]),
"june": stateFR ? i[0] == 3 ? String(i[16]) : String(fixNumber(Number(i[16].value), 1)) : String(i[16]),
"july": stateFR ? i[0] == 3 ? String(i[17]) : String(fixNumber(Number(i[17].value), 1)) : String(i[17]),
"august": stateFR ? i[0] == 3 ? String(i[18]) : String(fixNumber(Number(i[18].value), 1)) : String(i[18]),
"september": stateFR ? i[0] == 3 ? String(i[19]) : String(fixNumber(Number(i[19].value), 1)) : String(i[19]),
"october": stateFR ? i[0] == 3 ? String(i[20]) : String(fixNumber(Number(i[20].value), 1)) : String(i[20]),
"november": stateFR ? i[0] == 3 ? String(i[21]) : String(fixNumber(Number(i[21].value), 1)) : String(i[21]),
"december": stateFR ? i[0] == 3 ? String(i[22]) : String(fixNumber(Number(i[22].value), 1)) : String(i[22]),
"total_current_year": String(fixNumber(Number(i[23]), 1)) == "" ? "0.0" : String(fixNumber(Number(i[23]), 1)),
"strategic": i[24] == null ? "" : String(i[24]),
"pic": String(i[25])
})
}
})
let payload = {
"outlook_pa_id": this.props.outlook_pa_id,
......@@ -1242,9 +1300,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ color: 'black', fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1399,7 +1457,7 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1426,7 +1484,7 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1453,7 +1511,7 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1474,13 +1532,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1501,13 +1569,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1528,13 +1606,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1555,13 +1643,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1582,13 +1680,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1609,13 +1717,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1636,13 +1754,23 @@ export default class CorporateAnnualTargetRO extends Component {
{
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? (tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)) : (tableMeta.rowData[0] === 6 ? (Number(value.value) == 0 ? "0.0" : Number(value.value)) : Number(value) == 0 ? "0.0" : Number(value))}
/>
}
</div>
......@@ -1670,7 +1798,7 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
(handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
......@@ -1684,9 +1812,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 11)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta, 11)), 1) : Number(handleValueFormula(value, tableMeta, 11)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta, 11))}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1708,10 +1836,10 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 11)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta, 11)), 1) : Number(handleValueFormula(value, tableMeta, 11)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta, 11))}
// value={Number(value).toFixed(1)}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1730,9 +1858,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
disabled={false}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1770,7 +1898,7 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
disabled={true}
value={tableMeta.rowData[0] === 6 ? Number(value.value).toFixed(1) : Number(value).toFixed(1)}
value={tableMeta.rowData[0] === 6 ? fixNumber(Number(value.value), 1) : fixNumber(Number(value), 1)}
/>
:
(handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
......@@ -1784,9 +1912,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 12)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta, 12)), 1) : Number(handleValueFormula(value, tableMeta, 12)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta, 12))}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1808,10 +1936,10 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 12)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValueFormula(value, tableMeta, 12)), 1) : Number(handleValueFormula(value, tableMeta, 12)) == 0 ? "0.0" : Number(handleValueFormula(value, tableMeta, 12))}
// value={Number(value).toFixed(1)}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1830,9 +1958,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
disabled={false}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1870,7 +1998,7 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
(handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
......@@ -1884,9 +2012,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleTotal(tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotal(tableMeta)), 1) : Number(handleTotal(tableMeta)) == 0 ? "0.0" : Number(handleTotal(tableMeta))}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1910,9 +2038,9 @@ export default class CorporateAnnualTargetRO extends Component {
type="text"
placeholder=""
// value={Number(handleValueFormula(value, tableMeta, 13)).toFixed(1)}
value={Number(value).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(value), 1) : Number(value) == 0 ? "0.0" : Number(value)}
disabled
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1931,9 +2059,9 @@ export default class CorporateAnnualTargetRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleTotal(tableMeta)).toFixed(1)}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotal(tableMeta)), 1) : Number(handleTotal(tableMeta)) == 0 ? "0.0" : Number(handleTotal(tableMeta))}
disabled={true}
decimalScale={1}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......
......@@ -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, titleCase } from '../../library/Utils';
const LightTooltip = withStyles((theme) => ({
tooltip: {
......@@ -183,21 +184,21 @@ export default class ProfitLossOLPA extends Component {
item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.total_actual_before === null ? "0.0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
Number(item.profit_loss.january).toFixed(1),
Number(item.profit_loss.february).toFixed(1),
Number(item.profit_loss.march).toFixed(1),
Number(item.profit_loss.april).toFixed(1),
Number(item.profit_loss.may).toFixed(1),
Number(item.profit_loss.june).toFixed(1),
Number(item.profit_loss.july).toFixed(1),
Number(item.profit_loss.august).toFixed(1),
Number(item.profit_loss.september).toFixed(1),
Number(item.profit_loss.october).toFixed(1),
Number(item.profit_loss.november).toFixed(1),
Number(item.profit_loss.december).toFixed(1),
Number(item.profit_loss.total_current_year).toFixed(1),
Number(item.profit_loss.ytd_october).toFixed(1),
Number(item.profit_loss.nov_dec).toFixed(1),
item.profit_loss.january,
item.profit_loss.february,
item.profit_loss.march,
item.profit_loss.april,
item.profit_loss.may,
item.profit_loss.june,
item.profit_loss.july,
item.profit_loss.august,
item.profit_loss.september,
item.profit_loss.october,
item.profit_loss.november,
item.profit_loss.december,
item.profit_loss.total_current_year,
item.profit_loss.ytd_october,
item.profit_loss.nov_dec,
item.order
])
}
......@@ -219,21 +220,21 @@ export default class ProfitLossOLPA extends Component {
item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.total_actual_before === null ? "0.0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
Number(item.profit_loss.january).toFixed(1),
Number(item.profit_loss.february).toFixed(1),
Number(item.profit_loss.march).toFixed(1),
Number(item.profit_loss.april).toFixed(1),
Number(item.profit_loss.may).toFixed(1),
Number(item.profit_loss.june).toFixed(1),
Number(item.profit_loss.july).toFixed(1),
Number(item.profit_loss.august).toFixed(1),
Number(item.profit_loss.september).toFixed(1),
Number(item.profit_loss.october).toFixed(1),
Number(item.profit_loss.november).toFixed(1),
Number(item.profit_loss.december).toFixed(1),
Number(item.profit_loss.total_current_year).toFixed(1),
Number(item.profit_loss.ytd_october).toFixed(1),
Number(item.profit_loss.nov_dec).toFixed(1),
item.profit_loss.january,
item.profit_loss.february,
item.profit_loss.march,
item.profit_loss.april,
item.profit_loss.may,
item.profit_loss.june,
item.profit_loss.july,
item.profit_loss.august,
item.profit_loss.september,
item.profit_loss.october,
item.profit_loss.november,
item.profit_loss.december,
item.profit_loss.total_current_year,
item.profit_loss.ytd_october,
item.profit_loss.nov_dec,
item.order
])
if (item.children !== null) {
......@@ -290,28 +291,54 @@ export default class ProfitLossOLPA extends Component {
backToOLPA(type) {
let data = []
if (this.props.defaultCurrency.id == 2) {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
total_actual_before: String(Number(i[7]).toFixed(1)),
january: String(Number(i[8]).toFixed(1)),
february: String(Number(i[9]).toFixed(1)),
march: String(Number(i[10]).toFixed(1)),
april: String(Number(i[11]).toFixed(1)),
may: String(Number(i[12]).toFixed(1)),
june: String(Number(i[13]).toFixed(1)),
july: String(Number(i[14]).toFixed(1)),
august: String(Number(i[15]).toFixed(1)),
september: String(Number(i[16]).toFixed(1)),
october: String(Number(i[17]).toFixed(1)),
november: String(Number(i[18]).toFixed(1)),
december: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1)),
ytd_october: String(Number(i[21]).toFixed(1)),
nov_dec: String(Number(i[22]).toFixed(1)),
total_actual_before: String(Number(i[7])),
january: String(Number(i[8])),
february: String(Number(i[9])),
march: String(Number(i[10])),
april: String(Number(i[11])),
may: String(Number(i[12])),
june: String(Number(i[13])),
july: String(Number(i[14])),
august: String(Number(i[15])),
september: String(Number(i[16])),
october: String(Number(i[17])),
november: String(Number(i[18])),
december: String(Number(i[19])),
total_current_year: String(Number(i[20])),
ytd_october: String(Number(i[21])),
nov_dec: String(Number(i[22])),
})
})
} else {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
total_actual_before: String(fixNumber(Number(i[7]), 1)),
january: String(fixNumber(Number(i[8]), 1)),
february: String(fixNumber(Number(i[9]), 1)),
march: String(fixNumber(Number(i[10]), 1)),
april: String(fixNumber(Number(i[11]), 1)),
may: String(fixNumber(Number(i[12]), 1)),
june: String(fixNumber(Number(i[13]), 1)),
july: String(fixNumber(Number(i[14]), 1)),
august: String(fixNumber(Number(i[15]), 1)),
september: String(fixNumber(Number(i[16]), 1)),
october: String(fixNumber(Number(i[17]), 1)),
november: String(fixNumber(Number(i[18]), 1)),
december: String(fixNumber(Number(i[19]), 1)),
total_current_year: String(fixNumber(Number(i[20]), 1)),
ytd_october: String(fixNumber(Number(i[21]), 1)),
nov_dec: String(fixNumber(Number(i[22]), 1)),
})
})
}
let payload = {
"outlook_pa_id": this.props.outlook_pa_id,
"company_id": this.props.company.company_id,
......@@ -451,28 +478,54 @@ export default class ProfitLossOLPA extends Component {
uploadProfitLoss(type) {
let data = []
if (this.state.defaultCurrencyUpload?.id == 2) {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
notes: String(i[6]),
total_actual_before: String(Number(i[7]).toFixed(1)),
january: String(Number(i[8]).toFixed(1)),
february: String(Number(i[9]).toFixed(1)),
march: String(Number(i[10]).toFixed(1)),
april: String(Number(i[11]).toFixed(1)),
may: String(Number(i[12]).toFixed(1)),
june: String(Number(i[13]).toFixed(1)),
july: String(Number(i[14]).toFixed(1)),
august: String(Number(i[15]).toFixed(1)),
september: String(Number(i[16]).toFixed(1)),
october: String(Number(i[17]).toFixed(1)),
november: String(Number(i[18]).toFixed(1)),
december: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1)),
ytd_october: String(Number(i[21]).toFixed(1)),
nov_dec: String(Number(i[22]).toFixed(1))
total_actual_before: String(Number(i[7])),
january: String(Number(i[8])),
february: String(Number(i[9])),
march: String(Number(i[10])),
april: String(Number(i[11])),
may: String(Number(i[12])),
june: String(Number(i[13])),
july: String(Number(i[14])),
august: String(Number(i[15])),
september: String(Number(i[16])),
october: String(Number(i[17])),
november: String(Number(i[18])),
december: String(Number(i[19])),
total_current_year: String(Number(i[20])),
ytd_october: String(Number(i[21])),
nov_dec: String(Number(i[22]))
})
})
} else {
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
notes: String(i[6]),
total_actual_before: String(fixNumber(Number(i[7]), 1)),
january: String(fixNumber(Number(i[8]), 1)),
february: String(fixNumber(Number(i[9]), 1)),
march: String(fixNumber(Number(i[10]), 1)),
april: String(fixNumber(Number(i[11]), 1)),
may: String(fixNumber(Number(i[12]), 1)),
june: String(fixNumber(Number(i[13]), 1)),
july: String(fixNumber(Number(i[14]), 1)),
august: String(fixNumber(Number(i[15]), 1)),
september: String(fixNumber(Number(i[16]), 1)),
october: String(fixNumber(Number(i[17]), 1)),
november: String(fixNumber(Number(i[18]), 1)),
december: String(fixNumber(Number(i[19]), 1)),
total_current_year: String(fixNumber(Number(i[20]), 1)),
ytd_october: String(fixNumber(Number(i[21]), 1)),
nov_dec: String(fixNumber(Number(i[22]), 1))
})
})
}
let body = {
outlook_pa_id: this.props.outlook_pa_id,
company_id: this.props.company.company_id,
......@@ -884,7 +937,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -898,8 +951,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -930,7 +983,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -944,8 +997,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -976,7 +1029,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -990,8 +1043,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1022,7 +1075,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1036,8 +1089,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1068,7 +1121,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1082,8 +1135,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1114,7 +1167,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1128,8 +1181,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1160,7 +1213,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1174,8 +1227,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1206,7 +1259,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1220,8 +1273,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1252,7 +1305,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1266,8 +1319,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1298,7 +1351,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1312,8 +1365,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1344,7 +1397,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<div style={{ flex: 1 }}>
......@@ -1358,8 +1411,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
/>
}
/>
......@@ -1391,7 +1444,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1405,10 +1458,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
// 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)
......@@ -1425,7 +1478,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 }}>
......@@ -1439,7 +1492,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={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)
......@@ -1456,7 +1509,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
......@@ -1469,7 +1522,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={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)
......@@ -1486,7 +1539,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
......@@ -1499,7 +1552,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={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)
......@@ -1537,7 +1590,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
tableMeta.rowData[0] === 3 ?
......@@ -1551,10 +1604,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={this.props.defaultCurrency.id == 1 ? 1 : 16}
// 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)
......@@ -1571,7 +1624,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>
:
......@@ -1582,7 +1635,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 ?
......@@ -1592,7 +1645,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
......@@ -1622,7 +1675,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1632,8 +1685,9 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleTotalFY(tableMeta)).toFixed(1)}
fixedDecimalScale={false}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotalFY(tableMeta)), 1) : Number(handleTotalFY(tableMeta)) == 0 ? "0.0" : Number(handleTotalFY(tableMeta))}
/>
</span>
}
......@@ -1662,7 +1716,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1672,8 +1726,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleTotalYTD(tableMeta)).toFixed(1)}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotalYTD(tableMeta)), 1) : Number(handleTotalYTD(tableMeta)) == 0 ? "0.0" : Number(handleTotalYTD(tableMeta))}
/>
</span>
}
......@@ -1702,7 +1756,7 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
value={fixNumber(Number(value), 1)}
/>
:
<span style={{ fontSize: 12, textAlign: 'right' }}>
......@@ -1712,8 +1766,8 @@ export default class ProfitLossOLPA extends Component {
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleTotal(tableMeta)).toFixed(1)}
decimalScale={this.props.defaultCurrency.id == 1 ? 1 : 16}
value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotal(tableMeta)), 1) : Number(handleTotal(tableMeta)) == 0 ? "0.0" : Number(handleTotal(tableMeta))}
/>
</span>
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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