Commit cdd1bb19 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-' into 'master'

subholding ratio

See merge request !667
parents 90e724d9 60f801f2
...@@ -484,6 +484,21 @@ export default class TableSubHolding extends Component { ...@@ -484,6 +484,21 @@ export default class TableSubHolding extends Component {
return total return total
} }
const handleFormulaRatio = (value, tableMeta, month) => {
let total = 0
if (month > 12) {
total = Number(dataTable2[35][7 + month])
} else {
for (let index = 0; index < month; index++) {
total += Number(dataTable2[35][8 + index])
// console.log(index);
}
}
let hasil = Number(value) / total
// console.log(hasil, value, total);
return Number(hasil).toFixed(2)
}
const columnDBBS = [{ const columnDBBS = [{
name: "", name: "",
options: { options: {
...@@ -3026,7 +3041,25 @@ export default class TableSubHolding extends Component { ...@@ -3026,7 +3041,25 @@ export default class TableSubHolding extends Component {
<div className="grid grid-3x content-center"> <div className="grid grid-3x content-center">
<div className="grid grid-4x content-center"> <div className="grid grid-4x content-center">
<div className="col-1"> <div className="col-1">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[8], tableMeta, 1)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3049,7 +3082,25 @@ export default class TableSubHolding extends Component { ...@@ -3049,7 +3082,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-2"> <div className="col-2">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[9], tableMeta, 2)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3072,7 +3123,25 @@ export default class TableSubHolding extends Component { ...@@ -3072,7 +3123,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-3"> <div className="col-3">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[10], tableMeta, 3)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3095,7 +3164,25 @@ export default class TableSubHolding extends Component { ...@@ -3095,7 +3164,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-4"> <div className="col-4">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[11], tableMeta, 4)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3120,7 +3207,25 @@ export default class TableSubHolding extends Component { ...@@ -3120,7 +3207,25 @@ export default class TableSubHolding extends Component {
</div> </div>
<div className="grid grid-4x content-center"> <div className="grid grid-4x content-center">
<div className="col-1"> <div className="col-1">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[12], tableMeta, 5)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3143,7 +3248,25 @@ export default class TableSubHolding extends Component { ...@@ -3143,7 +3248,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-2"> <div className="col-2">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[13], tableMeta, 6)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3166,7 +3289,25 @@ export default class TableSubHolding extends Component { ...@@ -3166,7 +3289,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-3"> <div className="col-3">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[14], tableMeta, 7)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3189,7 +3330,25 @@ export default class TableSubHolding extends Component { ...@@ -3189,7 +3330,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-4"> <div className="col-4">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[15], tableMeta, 8)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3214,7 +3373,25 @@ export default class TableSubHolding extends Component { ...@@ -3214,7 +3373,25 @@ export default class TableSubHolding extends Component {
</div> </div>
<div className="grid grid-4x content-center"> <div className="grid grid-4x content-center">
<div className="col-1"> <div className="col-1">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[16], tableMeta, 9)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3237,7 +3414,25 @@ export default class TableSubHolding extends Component { ...@@ -3237,7 +3414,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-2"> <div className="col-2">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[17], tableMeta, 10)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3260,7 +3455,25 @@ export default class TableSubHolding extends Component { ...@@ -3260,7 +3455,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-3"> <div className="col-3">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[18], tableMeta, 11)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3283,7 +3496,25 @@ export default class TableSubHolding extends Component { ...@@ -3283,7 +3496,25 @@ export default class TableSubHolding extends Component {
} }
</div> </div>
<div className="col-4"> <div className="col-4">
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[19], tableMeta, 12)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3381,7 +3612,25 @@ export default class TableSubHolding extends Component { ...@@ -3381,7 +3612,25 @@ export default class TableSubHolding extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[20], tableMeta, 13)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
...@@ -3426,7 +3675,25 @@ export default class TableSubHolding extends Component { ...@@ -3426,7 +3675,25 @@ export default class TableSubHolding extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[5] === "Return on Invested Capital - YTD (ROIC)" ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 90, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormulaRatio(tableMeta.rowData[21], tableMeta, 14)}
/>
}
/>
</div> :
tableMeta.rowData[0] === 4 ?
null null
: tableMeta.rowData[0] === 1 ? : tableMeta.rowData[0] === 1 ?
null : null :
......
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