Commit eb5ed1a5 authored by Deni Rinaldi's avatar Deni Rinaldi

isu

parent 89435e14
...@@ -105,7 +105,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -105,7 +105,7 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
"submission_id": this.props.submissionID "submission_id": this.props.submissionID
} }
console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
let dataTable = [] let dataTable = []
let dataCustomerPrs = [] let dataCustomerPrs = []
...@@ -226,7 +226,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -226,7 +226,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
console.log(dataTable) // console.log(dataTable)
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => { this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs) // console.log(dataCustomerPrs)
}) })
...@@ -493,8 +493,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -493,8 +493,19 @@ export default class CorporateAnnualTarget extends Component {
functionUpload(type) { functionUpload(type) {
let data = [] let data = []
let stateFR = false
// // console.log(this.state.dataTable) // // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
if (indexID !== -1) {
if (this.state.dataTable[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else {
stateFR = false
}
}
}
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_report": String(i[6]), "item_report": String(i[6]),
...@@ -504,21 +515,21 @@ export default class CorporateAnnualTarget extends Component { ...@@ -504,21 +515,21 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value, "max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value, "formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]), "total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": String(i[13]) == "" ? "0.0" : String(i[13]), "january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(2)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)) == "" ? "0.0" : String(Number(i[13]).toFixed(1)),
"february": String(i[14]) == "" ? "0.0" : String(i[14]), "february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(2)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)) == "" ? "0.0" : String(Number(i[14]).toFixed(1)),
"march": String(i[15]) == "" ? "0.0" : String(i[15]), "march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(2)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)) == "" ? "0.0" : String(Number(i[15]).toFixed(1)),
"april": String(i[16]) == "" ? "0.0" : String(i[16]), "april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(2)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)) == "" ? "0.0" : String(Number(i[16]).toFixed(1)),
"may": String(i[17]) == "" ? "0.0" : String(i[17]), "may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(2)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)) == "" ? "0.0" : String(Number(i[17]).toFixed(1)),
"june": String(i[18]) == "" ? "0.0" : String(i[18]), "june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(2)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)) == "" ? "0.0" : String(Number(i[18]).toFixed(1)),
"july": String(i[19]) == "" ? "0.0" : String(i[19]), "july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(2)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(Number(i[19]).toFixed(1)) == "" ? "0.0" : String(Number(i[19]).toFixed(1)),
"august": String(i[20]) == "" ? "0.0" : String(i[20]), "august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(2)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(Number(i[20]).toFixed(1)) == "" ? "0.0" : String(Number(i[20]).toFixed(1)),
"september": String(i[21]) == "" ? "0.0" : String(i[21]), "september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(2)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(Number(i[21]).toFixed(1)) == "" ? "0.0" : String(Number(i[21]).toFixed(1)),
"october": String(i[22]) == "" ? "0.0" : String(i[22]), "october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(2)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(Number(i[22]).toFixed(1)) == "" ? "0.0" : String(Number(i[22]).toFixed(1)),
"november": String(i[23]) == "" ? "0.0" : String(i[23]), "november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(2)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"december": String(i[24]) == "" ? "0.0" : String(i[24]), "december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(2)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(Number(i[24]).toFixed(1)) == "" ? "0.0" : String(Number(i[24]).toFixed(1)),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]), "total_current_year": i[6] === 'ROIC' ? String(Number(i[25]).toFixed(2)) : String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]), "total_next_year": i[6] === 'ROIC' ? String(Number(i[26]).toFixed(2)) : String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]), "total_more_year": i[6] === 'ROIC' ? String(Number(i[27]).toFixed(2)) : String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
"strategic": String(i[28]), "strategic": String(i[28]),
"pic": String(i[29]) "pic": String(i[29])
}) })
...@@ -562,12 +573,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -562,12 +573,13 @@ export default class CorporateAnnualTarget extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
// // console.log(this.state.dataTable) // console.log(this.state.dataTable)
let totalWeight = 0 let totalWeight = 0
let dataTableBaru = this.state.dataTable let dataTableBaru = this.state.dataTable
let dataTampung = [] let dataTampung = []
let weightReal = null let weightReal = null
let handleKosongKPIMAXYTD = false let handleKosongKPIMAXYTD = false
let stateFR = false
this.state.dataTable.map((i, index) => { this.state.dataTable.map((i, index) => {
if (i[0] == 1) { if (i[0] == 1) {
dataTampung.push({ dataTampung.push({
...@@ -592,6 +604,10 @@ export default class CorporateAnnualTarget extends Component { ...@@ -592,6 +604,10 @@ export default class CorporateAnnualTarget extends Component {
handleKosongKPIMAXYTD = true handleKosongKPIMAXYTD = true
// // console.log(handleKosongKPIMAXYTD) // // console.log(handleKosongKPIMAXYTD)
} }
} else if (dataTableBaru[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else {
stateFR = false
} }
} }
} }
...@@ -635,18 +651,18 @@ export default class CorporateAnnualTarget extends Component { ...@@ -635,18 +651,18 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value, "max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value, "formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]), "total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": String(i[13]) == "" ? "0.0" : String(i[13]), "january": stateFR ? String(i[13].value) : String(i[13]) == "" ? "0.0" : String(i[13]),
"february": String(i[14]) == "" ? "0.0" : String(i[14]), "february": stateFR ? String(i[14].value) : String(i[14]) == "" ? "0.0" : String(i[14]),
"march": String(i[15]) == "" ? "0.0" : String(i[15]), "march": stateFR ? String(i[15].value) : String(i[15]) == "" ? "0.0" : String(i[15]),
"april": String(i[16]) == "" ? "0.0" : String(i[16]), "april": stateFR ? String(i[16].value) : String(i[16]) == "" ? "0.0" : String(i[16]),
"may": String(i[17]) == "" ? "0.0" : String(i[17]), "may": stateFR ? String(i[17].value) : String(i[17]) == "" ? "0.0" : String(i[17]),
"june": String(i[18]) == "" ? "0.0" : String(i[18]), "june": stateFR ? String(i[18].value) : String(i[18]) == "" ? "0.0" : String(i[18]),
"july": String(i[19]) == "" ? "0.0" : String(i[19]), "july": stateFR ? String(i[19].value) : String(i[19]) == "" ? "0.0" : String(i[19]),
"august": String(i[20]) == "" ? "0.0" : String(i[20]), "august": stateFR ? String(i[20].value) : String(i[20]) == "" ? "0.0" : String(i[20]),
"september": String(i[21]) == "" ? "0.0" : String(i[21]), "september": stateFR ? String(i[21].value) : String(i[21]) == "" ? "0.0" : String(i[21]),
"october": String(i[22]) == "" ? "0.0" : String(i[22]), "october": stateFR ? String(i[22].value) : String(i[22]) == "" ? "0.0" : String(i[22]),
"november": String(i[23]) == "" ? "0.0" : String(i[23]), "november": stateFR ? String(i[23].value) : String(i[23]) == "" ? "0.0" : String(i[23]),
"december": String(i[24]) == "" ? "0.0" : String(i[24]), "december": stateFR ? String(i[24].value) : String(i[24]) == "" ? "0.0" : String(i[24]),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]), "total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]), "total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]), "total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]),
...@@ -689,8 +705,22 @@ export default class CorporateAnnualTarget extends Component { ...@@ -689,8 +705,22 @@ export default class CorporateAnnualTarget extends Component {
backToMasterBudget(type) { backToMasterBudget(type) {
let data = [] let data = []
// // console.log(this.state.dataTable) let stateFR = false
// console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
// // console.log(indexID)
// // console.log(i[2])
if (indexID !== -1) {
// // console.log(dataTableBaru[indexID][6])
if (this.state.dataTable[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else {
stateFR = false
}
}
}
// // // console.log(i[9] == null? "" : i[9].value) // // // console.log(i[9] == null? "" : i[9].value)
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
...@@ -702,26 +732,26 @@ export default class CorporateAnnualTarget extends Component { ...@@ -702,26 +732,26 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value, "max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value, "formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]), "total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": String(i[13]) == "" ? "0.0" : String(i[13]), "january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(2)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)) == "" ? "0.0" : String(Number(i[13]).toFixed(1)),
"february": String(i[14]) == "" ? "0.0" : String(i[14]), "february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(2)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)) == "" ? "0.0" : String(Number(i[14]).toFixed(1)),
"march": String(i[15]) == "" ? "0.0" : String(i[15]), "march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(2)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)) == "" ? "0.0" : String(Number(i[15]).toFixed(1)),
"april": String(i[16]) == "" ? "0.0" : String(i[16]), "april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(2)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)) == "" ? "0.0" : String(Number(i[16]).toFixed(1)),
"may": String(i[17]) == "" ? "0.0" : String(i[17]), "may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(2)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)) == "" ? "0.0" : String(Number(i[17]).toFixed(1)),
"june": String(i[18]) == "" ? "0.0" : String(i[18]), "june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(2)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)) == "" ? "0.0" : String(Number(i[18]).toFixed(1)),
"july": String(i[19]) == "" ? "0.0" : String(i[19]), "july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(2)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(Number(i[19]).toFixed(1)) == "" ? "0.0" : String(Number(i[19]).toFixed(1)),
"august": String(i[20]) == "" ? "0.0" : String(i[20]), "august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(2)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(Number(i[20]).toFixed(1)) == "" ? "0.0" : String(Number(i[20]).toFixed(1)),
"september": String(i[21]) == "" ? "0.0" : String(i[21]), "september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(2)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(Number(i[21]).toFixed(1)) == "" ? "0.0" : String(Number(i[21]).toFixed(1)),
"october": String(i[22]) == "" ? "0.0" : String(i[22]), "october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(2)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(Number(i[22]).toFixed(1)) == "" ? "0.0" : String(Number(i[22]).toFixed(1)),
"november": String(i[23]) == "" ? "0.0" : String(i[23]), "november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(2)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"december": String(i[24]) == "" ? "0.0" : String(i[24]), "december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(2)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(Number(i[24]).toFixed(1)) == "" ? "0.0" : String(Number(i[24]).toFixed(1)),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]), "total_current_year": i[6] === 'ROIC' ? String(Number(i[25]).toFixed(2)) : String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]), "total_next_year": i[6] === 'ROIC' ? String(Number(i[26]).toFixed(2)) : String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]), "total_more_year": i[6] === 'ROIC' ? String(Number(i[27]).toFixed(2)) : String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
"strategic": String(i[28]), "strategic": String(i[28]),
"pic": String(i[29]) "pic": String(i[29])
}) })
}) })
// // console.log(JSON.stringify(data)) // console.log(JSON.stringify(data))
let payload = { let payload = {
"submission_id": this.props.submissionID, "submission_id": this.props.submissionID,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -958,7 +988,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -958,7 +988,7 @@ export default class CorporateAnnualTarget extends Component {
let array = dataTable2[tableMeta.rowIndex][30].filter((val) => val.periode == Number(this.props.periode)) let array = dataTable2[tableMeta.rowIndex][30].filter((val) => val.periode == Number(this.props.periode))
let valuezz = array[0].value let valuezz = array[0].value
console.log(valuezz) // console.log(valuezz)
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
// let indexID = dataTable2[tableMeta.rowIndex][30].findIndex((val) => val.periode == Number(this.props.periode)) // let indexID = dataTable2[tableMeta.rowIndex][30].findIndex((val) => val.periode == Number(this.props.periode))
// if (indexID !== -1) { // if (indexID !== -1) {
...@@ -2924,11 +2954,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2924,11 +2954,11 @@ export default class CorporateAnnualTarget extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ 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={Number(handleTotal(tableMeta)).toFixed(1)} value={Number(handleTotal(tableMeta)).toFixed(1)}
disabled={true} disabled={false}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3011,11 +3041,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3011,11 +3041,11 @@ export default class CorporateAnnualTarget extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ 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={Number(handleTotal(tableMeta)).toFixed(1)} value={Number(handleTotal(tableMeta)).toFixed(1)}
disabled={true} disabled={false}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
......
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