Commit 455b18eb authored by Riri Novita's avatar Riri Novita

pl olpa

parent 344c5b7e
...@@ -188,9 +188,9 @@ export default class ProfitLossOLPA extends Component { ...@@ -188,9 +188,9 @@ export default class ProfitLossOLPA extends Component {
Number(item.profit_loss.october).toFixed(1), Number(item.profit_loss.october).toFixed(1),
Number(item.profit_loss.november).toFixed(1), Number(item.profit_loss.november).toFixed(1),
Number(item.profit_loss.december).toFixed(1), Number(item.profit_loss.december).toFixed(1),
item.profit_loss.total_current_year, Number(item.profit_loss.total_current_year).toFixed(1),
item.profit_loss.ytd_october, Number(item.profit_loss.ytd_october).toFixed(1),
item.profit_loss.nov_dec, Number(item.profit_loss.nov_dec).toFixed(1),
item.order item.order
]) ])
} }
...@@ -224,9 +224,9 @@ export default class ProfitLossOLPA extends Component { ...@@ -224,9 +224,9 @@ export default class ProfitLossOLPA extends Component {
Number(item.profit_loss.october).toFixed(1), Number(item.profit_loss.october).toFixed(1),
Number(item.profit_loss.november).toFixed(1), Number(item.profit_loss.november).toFixed(1),
Number(item.profit_loss.december).toFixed(1), Number(item.profit_loss.december).toFixed(1),
item.profit_loss.total_current_year, Number(item.profit_loss.total_current_year).toFixed(1),
item.profit_loss.ytd_october, Number(item.profit_loss.ytd_october).toFixed(1),
item.profit_loss.nov_dec, Number(item.profit_loss.nov_dec).toFixed(1),
item.order item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -564,6 +564,36 @@ export default class ProfitLossOLPA extends Component { ...@@ -564,6 +564,36 @@ export default class ProfitLossOLPA extends Component {
// console.log(total); // console.log(total);
} }
const handleTotalFY = (tableMeta) => {
let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
}
})
if (tableMeta.rowData[1] === 19865) {
console.log(total);
console.log(dataTable2[tableMeta.rowIndex]);
}
let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") {
let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19]
return totalTMP
} else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
return handleFormula(0, tableMeta, 0)
}
else {
dataTable2[tableMeta.rowIndex][20] = total
return total
}
}
const handleTotal = (tableMeta) => { const handleTotal = (tableMeta) => {
let total = Number(dataTable2[tableMeta.rowIndex][18]) + Number(dataTable2[tableMeta.rowIndex][19]) let total = Number(dataTable2[tableMeta.rowIndex][18]) + Number(dataTable2[tableMeta.rowIndex][19])
dataTable2[tableMeta.rowIndex][22] = total dataTable2[tableMeta.rowIndex][22] = total
...@@ -1498,26 +1528,6 @@ export default class ProfitLossOLPA extends Component { ...@@ -1498,26 +1528,6 @@ export default class ProfitLossOLPA extends Component {
value={Number(handleValue(value, tableMeta)).toFixed(1)} value={Number(handleValue(value, tableMeta)).toFixed(1)}
/> />
</span> </span>
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 6 ? tableMeta.rowData[0] === 6 ?
<NumberFormat <NumberFormat
...@@ -1528,26 +1538,6 @@ export default class ProfitLossOLPA extends Component { ...@@ -1528,26 +1538,6 @@ export default class ProfitLossOLPA extends Component {
disabled={true} disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
tableMeta.rowData[0] === 5 ? tableMeta.rowData[0] === 5 ?
<NumberFormat <NumberFormat
...@@ -1558,26 +1548,6 @@ export default class ProfitLossOLPA extends Component { ...@@ -1558,26 +1548,6 @@ export default class ProfitLossOLPA extends Component {
disabled={true} disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)} value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
/> />
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// value={Number(value).toFixed(1)}
// onBlur={(event) => {
// handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// }}
// />
// }
// />
// </div>
: :
null null
} }
...@@ -1609,23 +1579,17 @@ export default class ProfitLossOLPA extends Component { ...@@ -1609,23 +1579,17 @@ export default class ProfitLossOLPA extends Component {
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
/> />
: :
<div style={{ flex: 1 }}> <span style={{ fontSize: 12, textAlign: 'right' }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<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' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1} decimalScale={1}
value={Number(handleTotalFY(tableMeta)).toFixed(1)}
/> />
} </span>
/>
</div>
} }
</div> </div>
) )
......
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