Commit 9fdfcdef authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'riri' into 'master'

issue infinity

See merge request !722
parents dad2004e 50c16dc5
...@@ -343,7 +343,7 @@ export default class ProfitLoss extends Component { ...@@ -343,7 +343,7 @@ export default class ProfitLoss extends Component {
checkUpload() { checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true }) this.setState({ visibleUpload: false, visibleProfitLoss: false, loading: true })
...@@ -385,6 +385,7 @@ export default class ProfitLoss extends Component { ...@@ -385,6 +385,7 @@ export default class ProfitLoss extends Component {
}) })
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
}) })
} }
} }
}) })
...@@ -539,12 +540,9 @@ export default class ProfitLoss extends Component { ...@@ -539,12 +540,9 @@ export default class ProfitLoss extends Component {
let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2]) let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20]) let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : value dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : R.equals(value, Infinity) ? "0.0" : value
return R.equals(value, NaN) ? "0.0" : value return R.equals(value, NaN) ? "0.0" : R.equals(value, Infinity) ? "0.0" : value
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") { } else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") {
console.log("masuk");
console.log(dataTable2[tableMeta.rowIndex][20]);
console.log(dataTable2[tableMeta.rowIndex][19]);
let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19] let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19]
return totalTMP return totalTMP
} else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") { } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
...@@ -635,13 +633,13 @@ export default class ProfitLoss extends Component { ...@@ -635,13 +633,13 @@ export default class ProfitLoss extends Component {
} else if (opt == "kali") { } else if (opt == "kali") {
total = Number(total) * Number(item) total = Number(total) * Number(item)
} else if (opt == "bagi") { } else if (opt == "bagi") {
total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item) total = R.equals((Number(total) / Number(item)), NaN) ? '0' : R.equals((Number(total) / Number(item)), Infinity) ? '0' : Number(total) / Number(item)
} else { } else {
total += Number(item) total += Number(item)
} }
} }
}) })
total = R.equals(total, NaN) ? "0.0" : R.equals(total, Infinity) ? "0.0" : total
// if (tableMeta.rowData[1] === 20092) { // if (tableMeta.rowData[1] === 20092) {
// console.log(total); // console.log(total);
// console.log(arrayJumlah); // console.log(arrayJumlah);
......
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