Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
870b7956
Commit
870b7956
authored
Sep 14, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'deni-dev(pc)' into 'master'
pormule See merge request
!293
parents
df1f8b97
b4f8677e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
285 additions
and
44 deletions
+285
-44
BalanceSheet.js
src/container/BudgetTahunan/BalanceSheet.js
+285
-44
No files found.
src/container/BudgetTahunan/BalanceSheet.js
View file @
870b7956
...
@@ -780,14 +780,13 @@ export default class BalanceSheet extends Component {
...
@@ -780,14 +780,13 @@ export default class BalanceSheet extends Component {
// console.log(indexParent);
// console.log(indexParent);
return a
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 arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let arrayJumlah = []
let
operator
=
[]
arrayFormula.map((item, indexs) => {
arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[1] == item)
let index = dataTable2.findIndex((val) => val[1] == item)
if (index > 0) {
if (index > 0) {
arrayJumlah
.
push
(
dataTable2
[
index
][
column
])
arrayJumlah.push(dataTable2[index][
tableMeta.columnIndex
])
} else {
} else {
arrayJumlah.push(item)
arrayJumlah.push(item)
}
}
...
@@ -795,15 +794,33 @@ export default class BalanceSheet extends Component {
...
@@ -795,15 +794,33 @@ export default class BalanceSheet extends Component {
// operator.push(item)
// operator.push(item)
// }
// }
})
})
let
a
=
arrayJumlah
.
join
(
""
)
let array = arrayJumlah
console
.
log
(
arrayJumlah
);
let total = 0
// if (arrayJumlah.length > 0) {
let opt = ""
// console.log(arrayJumlah);
array.map((item, index) => {
// let a = Number(arrayJumlah[0]) + Number(arrayJumlah[1])
if (item == "+") {
// return a
opt = "tambah"
// } else {
} else if (item == "-") {
// return 'Formula'
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 = [{
const columns = [{
...
@@ -903,10 +920,24 @@ export default class BalanceSheet extends Component {
...
@@ -903,10 +920,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -975,10 +1006,24 @@ export default class BalanceSheet extends Component {
...
@@ -975,10 +1006,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1047,10 +1092,24 @@ export default class BalanceSheet extends Component {
...
@@ -1047,10 +1092,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1119,10 +1178,24 @@ export default class BalanceSheet extends Component {
...
@@ -1119,10 +1178,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1191,10 +1264,24 @@ export default class BalanceSheet extends Component {
...
@@ -1191,10 +1264,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1263,10 +1350,24 @@ export default class BalanceSheet extends Component {
...
@@ -1263,10 +1350,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1335,10 +1436,24 @@ export default class BalanceSheet extends Component {
...
@@ -1335,10 +1436,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1407,10 +1522,24 @@ export default class BalanceSheet extends Component {
...
@@ -1407,10 +1522,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1479,10 +1608,24 @@ export default class BalanceSheet extends Component {
...
@@ -1479,10 +1608,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1551,10 +1694,24 @@ export default class BalanceSheet extends Component {
...
@@ -1551,10 +1694,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1623,10 +1780,24 @@ export default class BalanceSheet extends Component {
...
@@ -1623,10 +1780,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1695,10 +1866,24 @@ export default class BalanceSheet extends Component {
...
@@ -1695,10 +1866,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1767,10 +1952,24 @@ export default class BalanceSheet extends Component {
...
@@ -1767,10 +1952,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1839,10 +2038,24 @@ export default class BalanceSheet extends Component {
...
@@ -1839,10 +2038,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1911,10 +2124,24 @@ export default class BalanceSheet extends Component {
...
@@ -1911,10 +2124,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
@@ -1983,10 +2210,24 @@ export default class BalanceSheet extends Component {
...
@@ -1983,10 +2210,24 @@ export default class BalanceSheet extends Component {
null
null
:
:
tableMeta.rowData[0] === 6 ?
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 ?
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 ?
tableMeta.rowData[0] === 1 ?
value === "" ?
value === "" ?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment