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
dbfeaafc
Commit
dbfeaafc
authored
Dec 02, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apdet formula
parent
880b4c48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
271 additions
and
1 deletion
+271
-1
BalanceSheetMR.js
src/container/MonthlyReport/BalanceSheetMR.js
+271
-1
No files found.
src/container/MonthlyReport/BalanceSheetMR.js
View file @
dbfeaafc
...
...
@@ -128,6 +128,8 @@ export default class BalanceSheetMR extends Component {
item
.
balance_sheet
.
mtd_vs_previous_month
===
""
?
"0"
:
item
.
balance_sheet
.
mtd_vs_previous_month
,
item
.
balance_sheet
.
mtd_vs_mb
===
""
?
"0"
:
item
.
balance_sheet
.
mtd_vs_mb
,
item
.
balance_sheet
.
mtd_vs_rb
===
""
?
"0"
:
item
.
balance_sheet
.
mtd_vs_rb
,
item
.
balance_sheet
.
actual_formula
,
item
.
order
])
}
if
(
item
.
children
!==
null
)
{
...
...
@@ -160,6 +162,8 @@ export default class BalanceSheetMR extends Component {
item
.
balance_sheet
.
mtd_vs_previous_month
===
""
?
"0"
:
item
.
balance_sheet
.
mtd_vs_previous_month
,
item
.
balance_sheet
.
mtd_vs_mb
===
""
?
"0"
:
item
.
balance_sheet
.
mtd_vs_mb
,
item
.
balance_sheet
.
mtd_vs_rb
===
""
?
"0"
:
item
.
balance_sheet
.
mtd_vs_rb
,
item
.
balance_sheet
.
actual_formula
,
item
.
order
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
...
...
@@ -279,13 +283,15 @@ export default class BalanceSheetMR extends Component {
item
.
mtd_vs_previous_month
===
""
?
""
:
item
.
mtd_vs_previous_month
,
item
.
mtd_vs_mb
===
""
?
""
:
item
.
mtd_vs_mb
,
item
.
mtd_vs_rb
===
""
?
""
:
item
.
mtd_vs_rb
===
null
?
0
:
item
.
mtd_vs_rb
,
item
.
actual_formula
,
item
.
orders
,
item
.
error
]
})
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
2
0
].
length
>
0
)
{
if
(
item
[
2
2
].
length
>
0
)
{
// console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
}
...
...
@@ -485,6 +491,213 @@ export default class BalanceSheetMR extends Component {
return
total
}
const
handleValueFormula
=
(
tableMeta
,
colIdx
)
=>
{
// loading = true
let
splitFormula
=
String
(
tableMeta
.
rowData
[
3
]).
split
(
/
([
()@
])
/
)
let
baru
=
[]
let
anjay
=
[]
splitFormula
.
map
((
item
,
index
)
=>
{
let
items
=
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
)
let
subForm
=
String
(
item
).
substr
(
0
,
Number
(
String
(
item
).
length
)
-
1
)
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
if
(
item
!==
""
)
{
if
(
items
==
']'
)
{
baru
.
push
(
String
(
item
))
}
else
if
(
!
re
.
test
(
items
))
{
baru
.
push
(
subForm
)
baru
.
push
(
items
)
}
else
{
baru
.
push
(
String
(
item
))
}
}
})
baru
.
map
((
item
,
index
)
=>
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
||
item
==
'('
||
item
==
')'
)
{
anjay
.
push
(
item
)
}
else
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
''
)
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
21
]
==
tst
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
9
]
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
let
data
=
tableMeta
.
rowData
[
20
]
let
indexID
=
data
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
))
if
(
indexID
!==
-
1
)
{
let
valuezz
=
data
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
}
else
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
''
)
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
21
]
==
tst
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
9
]
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
21
]
==
item
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
colIdx
]
if
(
item
==
dataTable2
[
tableMeta
.
rowIndex
][
22
])
{
anjay
.
push
(
0
)
}
else
{
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
if
(
item
===
'(-1)'
)
{
anjay
.
push
(
-
1
)
}
}
}
}
}
})
let
anjay2
=
[]
let
kurung
=
false
let
item1
=
[]
anjay
.
map
((
item
,
index
)
=>
{
if
(
item
==
"("
)
{
kurung
=
true
}
else
if
(
item
==
")"
)
{
kurung
=
false
anjay2
.
push
(
item1
)
item1
=
[]
}
else
{
if
(
kurung
)
{
item1
.
push
(
item
)
}
else
{
anjay2
.
push
(
item
)
}
}
})
let
total
=
0
let
opt
=
""
let
totalPrio
=
0
let
optPrio
=
""
let
prio
=
false
anjay2
.
map
((
item
,
index
)
=>
{
if
(
Array
.
isArray
(
item
))
{
prio
=
true
item
.
map
((
items
,
indexs
)
=>
{
if
(
items
==
"+"
)
{
optPrio
=
"tambah"
}
else
if
(
items
==
"-"
)
{
optPrio
=
"kurang"
}
else
if
(
items
==
"*"
)
{
optPrio
=
"kali"
}
else
if
(
items
==
"/"
)
{
optPrio
=
"bagi"
}
else
{
if
(
optPrio
==
"tambah"
)
{
totalPrio
=
Number
(
totalPrio
)
+
Number
(
items
)
}
else
if
(
optPrio
==
"kurang"
)
{
totalPrio
=
Number
(
totalPrio
)
-
Number
(
items
)
}
else
if
(
optPrio
==
"kali"
)
{
totalPrio
=
Number
(
totalPrio
)
*
Number
(
items
)
}
else
if
(
optPrio
==
"bagi"
)
{
totalPrio
=
Number
(
totalPrio
)
/
Number
(
items
)
==
NaN
?
0
:
Number
(
totalPrio
)
/
Number
(
items
)
}
else
{
totalPrio
+=
Number
(
items
)
}
}
})
if
(
index
==
anjay2
.
length
-
1
)
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
totalPrio
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
totalPrio
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
totalPrio
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
totalPrio
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
totalPrio
)
}
else
{
total
+=
Number
(
totalPrio
)
}
}
}
else
{
if
(
item
==
"+"
)
{
opt
=
"tambah"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
else
if
(
item
==
"-"
)
{
opt
=
"kurang"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
else
if
(
item
==
"*"
)
{
opt
=
"kali"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
else
if
(
item
==
"/"
)
{
opt
=
"bagi"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
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
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
item
)
}
else
{
total
+=
Number
(
item
)
}
}
}
})
total
=
R
.
equals
(
total
,
NaN
)
?
"0.0"
:
total
// // // total = R.equals(total, NaN) ? "0.0" : total
// // // console.log(dataTable2[tableMeta.rowIndex][22])
// // // console.log(tableMeta.rowData[5])
// // if (tableMeta.rowData[5] == "1.5 Other non-current assets") {
// // if (forecast !== undefined) {
// // if (String(tableMeta.rowData[5]) == "Depreciation & amortisation") {
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(anjay2)
// console.log(total)
// // console.log(dataTable2[tableMeta.rowIndex])
// // }
// // }
// if (dataTable2[tableMeta.rowIndex][colIdx].value == undefined) {
dataTable2
[
tableMeta
.
rowIndex
][
colIdx
]
=
total
// } else {
// dataTable2[tableMeta.rowIndex][column].value = total
// }
// loading = false
return
total
}
let
columns
=
[
{
name
:
""
,
...
...
@@ -624,6 +837,23 @@ export default class BalanceSheetMR extends Component {
value
=
{
Number
(
handleValue
(
tableMeta
,
0
)).
toFixed
(
1
)}
/
>
<
/span>
:
tableMeta
.
rowData
[
0
]
===
5
||
tableMeta
.
rowData
[
0
]
===
6
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
7
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -658,6 +888,23 @@ export default class BalanceSheetMR extends Component {
value
=
{
Number
(
handleValue
(
tableMeta
,
1
)).
toFixed
(
1
)}
/
>
<
/span>
:
tableMeta
.
rowData
[
0
]
===
5
||
tableMeta
.
rowData
[
0
]
===
6
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
8
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -701,6 +948,23 @@ export default class BalanceSheetMR extends Component {
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
5
||
tableMeta
.
rowData
[
0
]
===
6
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
9
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
@@ -1303,6 +1567,12 @@ export default class BalanceSheetMR extends Component {
options
:
{
display
:
false
}
},
{
name
:
""
,
options
:
{
display
:
false
}
}
]
...
...
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