Commit 9ec25f0b authored by rifkaki's avatar rifkaki

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

parents 9800dcfe e15ac065
...@@ -310,11 +310,11 @@ export default class OutlookPA extends Component { ...@@ -310,11 +310,11 @@ export default class OutlookPA extends Component {
let data = [] let data = []
response.data.data.map((item) => { response.data.data.map((item) => {
if (this.state.isApprover) { if (this.state.isApprover) {
if (item >= 2000 && item <= (Number(currentYear) + 10)) { if (item >= 2000 && item <= (Number(currentYear) + 1)) {
data.push(item) data.push(item)
} }
} else { } else {
if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) { if ((item >= 2000) && (item == Number(this.state.lastPeriod) + 1 || item < Number(this.state.lastPeriod) + 1)) {
data.push(item) data.push(item)
} }
} }
...@@ -328,11 +328,11 @@ export default class OutlookPA extends Component { ...@@ -328,11 +328,11 @@ export default class OutlookPA extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 10) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : Number(this.state.lastPeriod) + 1)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val == periode)
// console.log(data) // console.log(data)
// console.log(this.state.lastPeriod) // console.log(this.state.lastPeriod)
// console.log(periodeData) // console.log(periode)
// console.log(index) // console.log(index)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
if (this.state.isApprover === true) { if (this.state.isApprover === true) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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