Commit ed4d3356 authored by d.arizona's avatar d.arizona

update last

parent 758245e9
...@@ -128,7 +128,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -128,7 +128,7 @@ export default class CorporateAnnualTargetMR extends Component {
checkStatus = false checkStatus = false
} }
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev}) this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
} }
getParameterGroup() { getParameterGroup() {
...@@ -238,7 +238,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -238,7 +238,7 @@ export default class CorporateAnnualTargetMR extends Component {
]) ])
// let index = dataTable.findIndex((val) => val[5] == item.description) // let index = dataTable.findIndex((val) => val[5] == item.description)
console.log(index, length - 1) console.log(index, length - 1)
if (index == length -1 && item.parent_name == "LEARNING & GROWTH PERSPECTIVE") { if (index == length - 1 && item.parent_name == "LEARNING & GROWTH PERSPECTIVE") {
dataTable.push([ dataTable.push([
4, 4,
0, 0,
...@@ -705,9 +705,9 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -705,9 +705,9 @@ export default class CorporateAnnualTargetMR extends Component {
let target = item[12] == "" ? 0 : Number(item[12]) let target = item[12] == "" ? 0 : Number(item[12])
if (target < 0) { if (target < 0) {
if (actual >= target) { if (actual >= target) {
totalAch = ((target-actual) / target) + 1 totalAch = ((target - actual) / target) + 1
} else { } else {
totalAch = (target-actual) / target totalAch = (target - actual) / target
} }
} else if (target == 0) { } else if (target == 0) {
if (target <= actual) { if (target <= actual) {
...@@ -734,22 +734,30 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -734,22 +734,30 @@ export default class CorporateAnnualTargetMR extends Component {
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase()) let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase())
let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id) let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0 let totalScore = 0
let achx100 = item[9] == '100%' && (item[8] == 'HIB' || item[8] == 'HIG')? Number(totalAch) / 100 > 1 ? 1 : Number(totalAch) / 100 : Number(totalAch) / 100 let achx100 = item[9] == '100%' && (item[8] == 'HIB' || item[8] == 'HIG') ? Number(totalAch) / 100 > 1 ? 1 : Number(totalAch) / 100 : Number(totalAch) / 100
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(listParameterFilter)
// console.log(listParameterFilterCompany)
// // console.log(Number(item.min_value))
// console.log(Number(item.max_value))
// }
if (listParameterFilterCompany.length == 0) { if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((item, index) => { listParameterFilter.map((items, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) { if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(item.value) totalScore = Number(items.value)
} }
}) })
} else { } else {
listParameterFilterCompany.map((item, index) => { listParameterFilterCompany.map((items, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) { if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(item.value) totalScore = Number(items.value)
} }
}) })
} }
let totalScorez = Number(totalScore).toFixed(0) let totalScorez = Number(totalScore).toFixed(0)
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(totalScorez)
// }
//Score X Weight //Score X Weight
let totalSW = 0 let totalSW = 0
let handlePercent = '' let handlePercent = ''
...@@ -835,6 +843,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -835,6 +843,7 @@ export default class CorporateAnnualTargetMR extends Component {
console.log(listPerfomanceDefault) console.log(listPerfomanceDefault)
console.log(perfomanceScore) console.log(perfomanceScore)
console.log(perfomanceScoreColor) console.log(perfomanceScoreColor)
console.log(datatable3)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) { // if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K' // perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) { // } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
...@@ -851,10 +860,10 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -851,10 +860,10 @@ export default class CorporateAnnualTargetMR extends Component {
// perfomanceScore = 'IST' // perfomanceScore = 'IST'
// } // }
setTimeout(() => { setTimeout(() => {
this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor}, () => { this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor }, () => {
this.setState({loading: true}) this.setState({ loading: true })
setTimeout(() => { setTimeout(() => {
this.setState({loading: false}) this.setState({ loading: false })
}, 500); }, 500);
}) })
}, 500); }, 500);
...@@ -1288,9 +1297,9 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1288,9 +1297,9 @@ export default class CorporateAnnualTargetMR extends Component {
let target = tableMeta.rowData[12] == "" ? 0 : Number(tableMeta.rowData[12]) let target = tableMeta.rowData[12] == "" ? 0 : Number(tableMeta.rowData[12])
if (target < 0) { if (target < 0) {
if (actual >= target) { if (actual >= target) {
total = ((target-actual) / target) + 1 total = ((target - actual) / target) + 1
} else { } else {
total = (target-actual) / target total = (target - actual) / target
} }
} else if (target == 0) { } else if (target == 0) {
if (target <= actual) { if (target <= actual) {
...@@ -1333,12 +1342,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1333,12 +1342,12 @@ export default class CorporateAnnualTargetMR extends Component {
} }
}) })
} }
if (Number(tableMeta.rowData[12]) > Number(0)){ if (Number(tableMeta.rowData[12]) == Number(0)) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(0).toFixed(0) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(0).toFixed(0)
return Number(0).toFixed(0) return Number(0).toFixed(0)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
} }
} }
...@@ -1351,13 +1360,13 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1351,13 +1360,13 @@ export default class CorporateAnnualTargetMR extends Component {
// } // }
if (tableMeta.rowData[0] == 4) { if (tableMeta.rowData[0] == 4) {
let totalScore = 0 let totalScore = 0
dataTable2.map((item,index) => { dataTable2.map((item, index) => {
if(item[0] !== 4 && item[0] !== 1) { if (item[0] !== 4 && item[0] !== 1) {
totalScore += Number(item[15]) totalScore += Number(item[15])
} }
}) })
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(2) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(2)
if (tableMeta.rowIndex == dataTable2.length -1) { if (tableMeta.rowIndex == dataTable2.length - 1) {
someXXX = Number(totalScore).toFixed(2) someXXX = Number(totalScore).toFixed(2)
console.log(someXXX) console.log(someXXX)
} }
...@@ -1789,9 +1798,9 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1789,9 +1798,9 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 75 }}> <div style={{ width: 75 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2? {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 ?
null : null :
tableMeta.rowData[0] === 4? tableMeta.rowData[0] === 4 ?
handleTotal(tableMeta) handleTotal(tableMeta)
: :
this.state.get_for == 'view' ? this.state.get_for == 'view' ?
......
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