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
8024c348
Commit
8024c348
authored
Dec 29, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
apdet kuy See merge request
!873
parents
32fc915e
251a7fde
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
240 additions
and
72 deletions
+240
-72
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+239
-29
FixedAssetsMovementMR.js
src/container/MonthlyReport/FixedAssetsMovementMR.js
+1
-43
No files found.
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
8024c348
...
...
@@ -12,6 +12,7 @@ import { Alert, Autocomplete } from '@material-ui/lab';
import
UploadFile
from
'../../library/Upload'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
{
PropagateLoader
}
from
'react-spinners'
;
import
*
as
R
from
'ramda'
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
...
...
@@ -180,6 +181,7 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
corporate_annual_target
.
score
===
null
?
"0"
:
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
score_x_weight
,
item
.
corporate_annual_target
.
notes
===
null
?
""
:
item
.
corporate_annual_target
.
notes
,
item
.
corporate_annual_target
.
actual_formula
===
null
?
[]
:
item
.
corporate_annual_target
.
actual_formula
])
}
if
(
item
.
children
!==
null
)
{
...
...
@@ -212,6 +214,7 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
corporate_annual_target
.
score
===
null
?
"0"
:
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
score_x_weight
,
item
.
corporate_annual_target
.
notes
===
null
?
""
:
item
.
corporate_annual_target
.
notes
,
item
.
corporate_annual_target
.
actual_formula
===
null
?
[]
:
item
.
corporate_annual_target
.
actual_formula
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
...
...
@@ -342,6 +345,7 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
score_x_weight
,
item
.
notes
,
item
.
order
,
item
.
actual_formula
===
null
?
[]
:
item
.
actual_formula
,
item
.
error
]
})
...
...
@@ -608,25 +612,218 @@ export default class CorporateAnnualTargetMR extends Component {
let
dataDelete
=
this
.
state
.
dataDelete
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
// let total = 0
// let lastValz = 0
if
(
type
==
'text'
)
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
}
else
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
// dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index >= 13 && index <= 24) {
// let valItem = item == undefined || item == "" ? 0 : item
// total += Number(valItem)
// if (index == 24) {
// lastValz += Number(valItem)
// }
// }
// })
// let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value
// dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
// // // console.log(dataTable2[tableMeta.rowIndex])
}
const
handleValueFormula
=
(
tableMeta
,
colIdx
)
=>
{
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
))
}
}
})
// console.log(baru);
let
tambahan
=
false
let
opet
=
""
baru
.
map
((
item
,
index
)
=>
{
if
(
item
==
'X'
)
{
tambahan
=
true
}
else
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]'
,
'[M1]'
)
console
.
log
(
tst
);
let
indexID
=
dataTable2
[
tableMeta
.
rowIndex
][
17
].
findIndex
((
val
)
=>
val
.
item_formula
==
tst
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
tableMeta
.
rowIndex
][
17
][
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
let
data
=
tableMeta
.
rowData
[
17
]
==
null
?
[]
:
tableMeta
.
rowData
[
17
]
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
[
17
]
==
tst
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
8
]
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
17
]
==
item
)
if
(
item
==
'X-1'
)
{
anjay
.
push
(
-
1
)
}
else
if
(
tambahan
)
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
opet
=
item
}
else
{
anjay
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
tambahan
=
false
opet
=
""
}
}
else
{
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
colIdx
]
if
(
item
==
dataTable2
[
tableMeta
.
rowIndex
][
28
])
{
anjay
.
push
(
0
)
}
else
{
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
if
(
item
===
'(-1)'
)
{
anjay
.
push
(
-
1
)
}
}
}
}
}
}
})
console
.
log
(
baru
)
console
.
log
(
anjay
)
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
dataTable2
[
tableMeta
.
rowIndex
][
colIdx
]
=
total
return
total
}
const
handleChangeDropdown
=
(
value
,
tableMeta
)
=>
{
...
...
@@ -682,13 +879,18 @@ export default class CorporateAnnualTargetMR extends Component {
if
(
this
.
props
.
isApprover
)
{
return
false
}
else
{
if
((
this
.
props
.
lastStatus
==
'SUBMIT'
||
this
.
props
.
lastStatus
==
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
))
{
//
if ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) {
if
(
idParent
!==
null
)
{
console
.
log
(
tableMeta
)
let
indexsss
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
idParent
)
if
(
dataTable2
[
indexsss
][
6
]
==
'CUSTOMER PERSPECTIVE'
||
dataTable2
[
indexsss
][
6
]
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
)
{
if
(
dataTable2
[
indexsss
][
5
]
==
'CUSTOMER PERSPECTIVE'
||
dataTable2
[
indexsss
][
5
]
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
)
{
return
true
}
else
{
return
false
if
(
typeReport
==
3
)
{
return
true
}
else
{
return
false
}
}
}
else
{
if
(
typeReport
==
null
||
typeReport
==
3
)
{
...
...
@@ -704,9 +906,9 @@ export default class CorporateAnnualTargetMR extends Component {
return
false
}
}
}
else
{
return
false
}
//
} else {
//
return false
//
}
}
}
...
...
@@ -785,8 +987,8 @@ export default class CorporateAnnualTargetMR extends Component {
total
=
actual
/
target
}
total
=
String
(
total
)
==
'NaN'
||
String
(
total
)
==
'Infinity'
||
String
(
total
)
==
'-Infinity'
?
0
:
total
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
total
)
.
toFixed
(
1
)
return
Number
(
total
)
.
toFixed
(
1
)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
total
)
*
100
return
Number
(
total
)
*
100
}
const
handleScore
=
(
tableMeta
)
=>
{
...
...
@@ -796,8 +998,9 @@ export default class CorporateAnnualTargetMR extends Component {
let
parameterMix
=
`
${
parameterKpi
}
_
${
parameterAch
}
`
let
listParameterFilter
=
listParameter
.
filter
((
val
)
=>
val
.
setting_type
==
String
(
parameterMix
).
toLocaleUpperCase
())
let
totalScore
=
0
let
achx100
=
Number
(
tableMeta
.
rowData
[
13
])
/
100
listParameterFilter
.
map
((
item
,
index
)
=>
{
if
(
Number
(
tableMeta
.
rowData
[
13
])
>=
Number
(
item
.
min_value
)
&&
Number
(
tableMeta
.
rowData
[
13
]
)
<=
Number
(
item
.
max_value
))
{
if
(
Number
(
achx100
)
>=
Number
(
item
.
min_value
)
&&
Number
(
achx100
)
<=
Number
(
item
.
max_value
))
{
totalScore
=
Number
(
item
.
value
)
}
})
...
...
@@ -882,8 +1085,8 @@ export default class CorporateAnnualTargetMR extends Component {
<
/div
>
:
<
div
style
=
{{
width
:
300
}}
>
{
tableMeta
.
rowData
[
30
]
?
tableMeta
.
rowData
[
30
].
length
>
0
?
{
tableMeta
.
rowData
[
18
]
?
tableMeta
.
rowData
[
18
].
length
>
0
?
<
div
style
=
{{
paddingLeft
:
20
*
Number
(
tableMeta
.
rowData
[
4
])
}}
>
<
LightTooltip
title
=
{
"Report Items Not Registered"
}
arrow
>
<
span
style
=
{{
fontSize
:
12
,
color
:
'red'
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
""
:
val
}
<
/span
>
...
...
@@ -1034,12 +1237,12 @@ export default class CorporateAnnualTargetMR extends Component {
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
this
.
state
.
get_for
==
'view'
?
"black"
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
style
=
{{
color
:
this
.
state
.
get_for
==
'view'
?
"black"
:
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
],
tableMeta
)?
"#5198ea"
:
'black'
,
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
value
=
{
Number
(
value
).
toFixed
(
1
)}
value
=
{
tableMeta
.
rowData
[
0
]
===
5
||
tableMeta
.
rowData
[
0
]
===
6
?
Number
(
handleValueFormula
(
tableMeta
,
tableMeta
.
columnIndex
))
:
Number
(
value
).
toFixed
(
1
)}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
disabled
=
{
this
.
state
.
get_for
==
'view'
}
disabled
=
{
this
.
state
.
get_for
==
'view'
?
true
:
!
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
],
tableMeta
)
}
decimalScale
=
{
1
}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
@@ -1246,7 +1449,14 @@ export default class CorporateAnnualTargetMR extends Component {
)
}
}
}
},
{
name
:
""
,
options
:
{
display
:
false
}
},
]
const
loadingComponent
=
(
...
...
src/container/MonthlyReport/FixedAssetsMovementMR.js
View file @
8024c348
...
...
@@ -622,27 +622,7 @@ export default class FixedAssetsMovementMR extends Component {
})
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
}
...
...
@@ -819,18 +799,7 @@ export default class FixedAssetsMovementMR extends Component {
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
tableMeta
.
rowData
[
0
]
===
5
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
90
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
<
/span>
:
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -855,17 +824,6 @@ export default class FixedAssetsMovementMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
tableMeta
.
rowData
[
0
]
===
5
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
90
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
7
)).
toFixed
(
1
)}
/
>
<
/span>
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
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