Commit 6450e96a authored by EKSAD's avatar EKSAD

test

parent 53d5c621
......@@ -404,50 +404,50 @@ export default class ProfitLoss extends Component {
// console.log(indexParent);
return a
}
// const handleFormula = (data, tableMeta) => {
// let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
// let arrayJumlah = []
// arrayFormula.map((item, indexs) => {
// let index = dataTable2.findIndex((val) => val[1] == item)
// if (index > 0) {
// arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
// } else {
// arrayJumlah.push(item)
// }
// // if (indexs % 2 !== 0) {
// // operator.push(item)
// // }
// })
// let array = arrayJumlah
// let total = 0
// let opt = ""
// array.map((item, index) => {
// if (item == "+") {
// opt = "tambah"
// } else if (item == "-") {
// opt = "kurang"
// } else if (item == "*") {
// opt = "kali"
// } else if (item == "/") {
// opt = "bagi"
// } else {
// if (opt == "tambah") {
// total = Number(total) + Number(item)
// } else if (opt == "kurang") {
// total = Number(total) - Number(item)
// } else if (opt == "kali") {
// total = Number(total) * Number(item)
// } else if (opt == "bagi") {
// total = Number(total) / Number(item)
// } else {
// total += item
// }
// }
// })
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
// return a
const handleFormula = (data, tableMeta) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[1] == item)
if (index > 0) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else {
arrayJumlah.push(item)
}
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
})
let array = arrayJumlah
let total = 0
let opt = ""
array.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item)
} else {
total += item
}
}
})
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a
// }
}
const columns = [{
name: "",
......
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