Commit 1f2e610b authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'didam' into 'master'

apdet

See merge request !407
parents dc27bcb6 d3b4a1d6
...@@ -245,31 +245,50 @@ export default class CorporateAnnualTarget extends Component { ...@@ -245,31 +245,50 @@ export default class CorporateAnnualTarget extends Component {
let reg = /^\d+$/; let reg = /^\d+$/;
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
let total = 0
let lastValz = 0
let nilaiTotal = 0
if (i[6] !== undefined) {
if (i[6] == 'SUM' || i[6] == 'AVG' || i[6] == 'LAST') {
i.map((items, indexs) => {
if (indexs >= 8 && indexs <= 19) {
let valItem = items == undefined || items == "" ? 0 : items
total += Number(valItem)
if (index == 19) {
lastValz += Number(valItem)
}
}
})
}
nilaiTotal = i[6] == 'SUM'? total : i[6] == 'AVG'? total/12 : lastValz
}
console.log(nilaiTotal)
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : reg.test(String(i[2])) === false ? "" : String(i[2]).trim(), weight: i[2] === undefined ? "" : reg.test(String(i[2])) === false ? "" : String(i[2]).trim(),
uom: i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(), uom: i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : reg.test(String(i[4])) === false ? "" : String(i[4]).trim(), kpi_type: i[4] === undefined ? "" : reg.test(String(i[4])) === false ? "" : String(i[4]).trim(),
formula: i[5] === undefined ? "" : reg.test(String(i[5])) === false ? "" : String(i[5]).trim(), max_ach: i[5] === undefined ? "" : reg.test(String(i[5])) === false ? "" : String(i[5]).trim(),
total_actual_before: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(), formula: i[6] === undefined ? "" : reg.test(String(i[6])) === false ? "" : String(i[6]).trim(),
january: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(), total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
february: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(), january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
march: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(), february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(),
april: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(), march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10].toFixed(1))).trim(),
may: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(), april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(),
june: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(), may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12].toFixed(1))).trim(),
july: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(), june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13].toFixed(1))).trim(),
august: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(), july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14].toFixed(1))).trim(),
september: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(), august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(),
october: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(), september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
november: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(), october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
december: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(), november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
total_current_year: i[19] === undefined ? "0" : reg.test(String(i[19])) === false ? "0" : String(i[19]).trim(), december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(),
total_next_year: i[20] === undefined ? "0" : reg.test(String(i[20])) === false ? "0" : String(i[20]).trim(), total_current_year: i[20] == 0? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(),
total_more_year: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(), total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(Number(i[21]).toFixed(1)).trim(),
strategic: i[22] === undefined ? "" : reg.test(String(i[22])) === false ? "" : String(i[22]).trim(), total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(Number(i[22]).toFixed(1)).trim(),
pic: i[23] === undefined ? "" : reg.test(String(i[23])) === false ? "" : String(i[23]).trim() strategic: i[23] === undefined ? "" : reg.test(String(i[23])) === false ? "" : String(i[23]).trim(),
pic: i[24] === undefined ? "" : reg.test(String(i[24])) === false ? "" : String(i[24]).trim()
}) })
} }
}) })
......
...@@ -520,7 +520,10 @@ export default class BalanceSheet extends Component { ...@@ -520,7 +520,10 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[22] ? {tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ? tableMeta.rowData[22].length > 0 ?
tableMeta.rowData[22][0].field === 'item' ? tableMeta.rowData[22][0].field === 'item' ?
tableMeta.rowData[4] == 0 ? tableMeta.rowData[4] == 0 ?
...@@ -572,6 +575,9 @@ export default class BalanceSheet extends Component { ...@@ -572,6 +575,9 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null
:
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
...@@ -593,7 +599,7 @@ export default class BalanceSheet extends Component { ...@@ -593,7 +599,7 @@ export default class BalanceSheet extends Component {
// }} // }}
/> />
} }
/> />}
</div> </div>
) )
} }
...@@ -610,6 +616,9 @@ export default class BalanceSheet extends Component { ...@@ -610,6 +616,9 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null
:
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -618,7 +627,7 @@ export default class BalanceSheet extends Component { ...@@ -618,7 +627,7 @@ export default class BalanceSheet extends Component {
disabled={true} disabled={true}
decimalScale={1} decimalScale={1}
value={value} value={value}
/> />}
</div> </div>
) )
} }
...@@ -1141,9 +1150,8 @@ export default class BalanceSheet extends Component { ...@@ -1141,9 +1150,8 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={handleValue(value, tableMeta)}
decimalScale={1} decimalScale={1}
disabled={true} value={value}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
......
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