Commit 870b7956 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

pormule

See merge request !293
parents df1f8b97 b4f8677e
......@@ -780,14 +780,13 @@ export default class BalanceSheet extends Component {
// console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, column) => {
const handleFormula = (data, tableMeta) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let operator = []
arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[1] == item)
if (index > 0) {
arrayJumlah.push(dataTable2[index][column])
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else {
arrayJumlah.push(item)
}
......@@ -795,15 +794,33 @@ export default class BalanceSheet extends Component {
// operator.push(item)
// }
})
let a = arrayJumlah.join("")
console.log(arrayJumlah);
// if (arrayJumlah.length > 0) {
// console.log(arrayJumlah);
// let a = Number(arrayJumlah[0]) + Number(arrayJumlah[1])
// return a
// } else {
// return 'Formula'
// }
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
}
}
})
return total
}
const columns = [{
......@@ -903,10 +920,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>{handleFormula(value, tableMeta, 6)}</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -975,10 +1006,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1047,10 +1092,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1119,10 +1178,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1191,10 +1264,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1263,10 +1350,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1335,10 +1436,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1407,10 +1522,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1479,10 +1608,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1551,10 +1694,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1623,10 +1780,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1695,10 +1866,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1767,10 +1952,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1839,10 +2038,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1911,10 +2124,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
value === "" ?
......@@ -1983,10 +2210,24 @@ export default class BalanceSheet extends Component {
null
:
tableMeta.rowData[0] === 6 ?
<span>Formula</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 5 ?
<span>Formula Summary</span>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/>
:
tableMeta.rowData[0] === 1 ?
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