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
eafe2579
Commit
eafe2579
authored
Dec 29, 2021
by
syadziy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push rounding math
parent
1a05bda9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
34 deletions
+38
-34
CorporateAnnualTarget.js
src/container/BudgetTahunan/CorporateAnnualTarget.js
+33
-34
Utils.js
src/library/Utils.js
+5
-0
No files found.
src/container/BudgetTahunan/CorporateAnnualTarget.js
View file @
eafe2579
...
@@ -9,7 +9,7 @@ import PropagateLoader from "react-spinners/PropagateLoader"
...
@@ -9,7 +9,7 @@ import PropagateLoader from "react-spinners/PropagateLoader"
import
Images
from
'../../assets/Images'
;
import
Images
from
'../../assets/Images'
;
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
Tooltip
from
'@material-ui/core/Tooltip'
;
import
Tooltip
from
'@material-ui/core/Tooltip'
;
import
{
titleCase
}
from
'../../library/Utils'
;
import
{
roundMath
,
titleCase
}
from
'../../library/Utils'
;
import
Constant
from
'../../library/Constant'
;
import
Constant
from
'../../library/Constant'
;
import
{
Alert
,
Autocomplete
}
from
'@material-ui/lab'
;
import
{
Alert
,
Autocomplete
}
from
'@material-ui/lab'
;
import
UploadFile
from
"../../library/Upload"
;
import
UploadFile
from
"../../library/Upload"
;
...
@@ -96,7 +96,6 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -96,7 +96,6 @@ export default class CorporateAnnualTarget extends Component {
this
.
getLatestUpdate
()
this
.
getLatestUpdate
()
// // // console.log(this.props.status)
// // // console.log(this.props.status)
// // // // console.log(this.props.lastStatus);
// // // // console.log(this.props.lastStatus);
}
}
getItemHierarki
()
{
getItemHierarki
()
{
...
@@ -363,22 +362,22 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -363,22 +362,22 @@ export default class CorporateAnnualTarget extends Component {
kpi_type
:
i
[
4
]
===
undefined
?
""
:
String
(
i
[
4
]).
trim
(),
kpi_type
:
i
[
4
]
===
undefined
?
""
:
String
(
i
[
4
]).
trim
(),
max_ach
:
i
[
5
]
===
undefined
?
""
:
String
(
i
[
5
]).
toLocaleLowerCase
()
!==
'unlimited'
?
(
String
(
i
[
5
]).
includes
(
'%'
)
?
String
(
i
[
5
].
trim
())
:
String
(
Number
(
i
[
5
]
*
100
)
+
'%'
))
:
String
(
i
[
5
]).
trim
(),
max_ach
:
i
[
5
]
===
undefined
?
""
:
String
(
i
[
5
]).
toLocaleLowerCase
()
!==
'unlimited'
?
(
String
(
i
[
5
]).
includes
(
'%'
)
?
String
(
i
[
5
].
trim
())
:
String
(
Number
(
i
[
5
]
*
100
)
+
'%'
))
:
String
(
i
[
5
]).
trim
(),
formula
:
i
[
6
]
===
undefined
?
""
:
String
(
i
[
6
]).
trim
(),
formula
:
i
[
6
]
===
undefined
?
""
:
String
(
i
[
6
]).
trim
(),
total_actual_before
:
i
[
7
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
7
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)).
trim
(),
total_actual_before
:
i
[
7
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
7
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
7
]),
1
)).
trim
(),
january
:
i
[
8
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
8
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)).
trim
(),
january
:
i
[
8
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
8
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
8
]),
1
)).
trim
(),
february
:
i
[
9
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
9
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)).
trim
(),
february
:
i
[
9
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
9
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
9
]),
1
)).
trim
(),
march
:
i
[
10
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
10
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
10
]).
toFixed
(
1
)).
trim
(),
march
:
i
[
10
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
10
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
10
]),
1
)).
trim
(),
april
:
i
[
11
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
11
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
11
]).
toFixed
(
1
)).
trim
(),
april
:
i
[
11
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
11
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
11
]),
1
)).
trim
(),
may
:
i
[
12
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
12
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
12
]).
toFixed
(
1
)).
trim
(),
may
:
i
[
12
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
12
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
12
]),
1
)).
trim
(),
june
:
i
[
13
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
13
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
13
]).
toFixed
(
1
)).
trim
(),
june
:
i
[
13
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
13
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
13
]),
1
)).
trim
(),
july
:
i
[
14
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
14
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
14
]).
toFixed
(
1
)).
trim
(),
july
:
i
[
14
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
14
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
14
]),
1
)).
trim
(),
august
:
i
[
15
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
15
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
15
]).
toFixed
(
1
)).
trim
(),
august
:
i
[
15
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
15
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
15
]),
1
)).
trim
(),
september
:
i
[
16
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
16
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)).
trim
(),
september
:
i
[
16
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
16
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
16
]),
1
)).
trim
(),
october
:
i
[
17
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
17
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)).
trim
(),
october
:
i
[
17
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
17
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
17
]),
1
)).
trim
(),
november
:
i
[
18
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
18
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)).
trim
(),
november
:
i
[
18
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
18
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
18
]),
1
)).
trim
(),
december
:
i
[
19
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
19
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
19
]).
toFixed
(
1
)).
trim
(),
december
:
i
[
19
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
19
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
19
]),
1
)).
trim
(),
total_current_year
:
i
[
20
]
==
0
?
"0.0"
:
String
(
Number
(
nilaiTotal
).
toFixed
(
1
)).
trim
(),
total_current_year
:
i
[
20
]
==
0
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
20
]),
1
)).
trim
(),
total_next_year
:
i
[
21
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
21
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
21
]).
toFixed
(
1
)).
trim
(),
total_next_year
:
i
[
21
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
21
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
21
]),
1
)).
trim
(),
total_more_year
:
i
[
22
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
22
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
22
]).
toFixed
(
1
)).
trim
(),
total_more_year
:
i
[
22
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
22
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
22
]),
1
)).
trim
(),
strategic
:
i
[
23
]
===
undefined
?
""
:
String
(
i
[
23
]).
trim
(),
strategic
:
i
[
23
]
===
undefined
?
""
:
String
(
i
[
23
]).
trim
(),
pic
:
i
[
24
]
===
undefined
?
""
:
String
(
i
[
24
]).
trim
()
pic
:
i
[
24
]
===
undefined
?
""
:
String
(
i
[
24
]).
trim
()
})
})
...
@@ -392,22 +391,22 @@ export default class CorporateAnnualTarget extends Component {
...
@@ -392,22 +391,22 @@ export default class CorporateAnnualTarget extends Component {
kpi_type
:
i
[
4
]
===
undefined
?
""
:
String
(
i
[
4
]).
trim
(),
kpi_type
:
i
[
4
]
===
undefined
?
""
:
String
(
i
[
4
]).
trim
(),
max_ach
:
i
[
5
]
===
undefined
?
""
:
String
(
i
[
5
]).
toLocaleLowerCase
()
!==
'unlimited'
?
(
String
(
i
[
5
]).
includes
(
'%'
)
?
String
(
i
[
5
].
trim
())
:
String
(
Number
(
i
[
5
]
*
100
)
+
'%'
))
:
String
(
i
[
5
]).
trim
(),
max_ach
:
i
[
5
]
===
undefined
?
""
:
String
(
i
[
5
]).
toLocaleLowerCase
()
!==
'unlimited'
?
(
String
(
i
[
5
]).
includes
(
'%'
)
?
String
(
i
[
5
].
trim
())
:
String
(
Number
(
i
[
5
]
*
100
)
+
'%'
))
:
String
(
i
[
5
]).
trim
(),
formula
:
i
[
6
]
===
undefined
?
""
:
String
(
i
[
6
]).
trim
(),
formula
:
i
[
6
]
===
undefined
?
""
:
String
(
i
[
6
]).
trim
(),
total_actual_before
:
i
[
7
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
7
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)).
trim
(),
total_actual_before
:
i
[
7
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
7
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
7
]),
1
)).
trim
(),
january
:
i
[
8
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
8
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)).
trim
(),
january
:
i
[
8
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
8
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
8
]),
1
)).
trim
(),
february
:
i
[
9
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
9
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)).
trim
(),
february
:
i
[
9
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
9
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
9
]),
1
)).
trim
(),
march
:
i
[
10
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
10
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
10
]).
toFixed
(
1
)).
trim
(),
march
:
i
[
10
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
10
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
10
]),
1
)).
trim
(),
april
:
i
[
11
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
11
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
11
]).
toFixed
(
1
)).
trim
(),
april
:
i
[
11
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
11
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
11
]),
1
)).
trim
(),
may
:
i
[
12
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
12
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
12
]).
toFixed
(
1
)).
trim
(),
may
:
i
[
12
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
12
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
12
]),
1
)).
trim
(),
june
:
i
[
13
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
13
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
13
]).
toFixed
(
1
)).
trim
(),
june
:
i
[
13
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
13
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
13
]),
1
)).
trim
(),
july
:
i
[
14
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
14
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
14
]).
toFixed
(
1
)).
trim
(),
july
:
i
[
14
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
14
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
14
]),
1
)).
trim
(),
august
:
i
[
15
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
15
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
15
]).
toFixed
(
1
)).
trim
(),
august
:
i
[
15
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
15
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
15
]),
1
)).
trim
(),
september
:
i
[
16
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
16
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)).
trim
(),
september
:
i
[
16
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
16
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
16
]),
1
)).
trim
(),
october
:
i
[
17
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
17
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)).
trim
(),
october
:
i
[
17
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
17
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
17
]),
1
)).
trim
(),
november
:
i
[
18
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
18
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)).
trim
(),
november
:
i
[
18
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
18
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
18
]),
1
)).
trim
(),
december
:
i
[
19
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
19
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
19
]).
toFixed
(
1
)).
trim
(),
december
:
i
[
19
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
19
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
19
]),
1
)).
trim
(),
total_current_year
:
i
[
20
]
==
0
?
"0.0"
:
String
(
Number
(
nilaiTotal
).
toFixed
(
1
)).
trim
(),
total_current_year
:
i
[
20
]
==
0
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
20
]),
1
)).
trim
(),
total_next_year
:
i
[
21
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
21
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
21
]).
toFixed
(
1
)).
trim
(),
total_next_year
:
i
[
21
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
21
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
21
]),
1
)).
trim
(),
total_more_year
:
i
[
22
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
22
]))
===
false
?
"0.0"
:
String
(
Number
(
i
[
22
]).
toFixed
(
1
)).
trim
(),
total_more_year
:
i
[
22
]
===
undefined
?
"0.0"
:
reg
.
test
(
String
(
i
[
22
]))
===
false
?
"0.0"
:
String
(
roundMath
(
Number
(
i
[
22
]),
1
)).
trim
(),
strategic
:
i
[
23
]
===
undefined
?
""
:
String
(
i
[
23
]).
trim
(),
strategic
:
i
[
23
]
===
undefined
?
""
:
String
(
i
[
23
]).
trim
(),
pic
:
i
[
24
]
===
undefined
?
""
:
String
(
i
[
24
]).
trim
()
pic
:
i
[
24
]
===
undefined
?
""
:
String
(
i
[
24
]).
trim
()
})
})
...
...
src/library/Utils.js
View file @
eafe2579
...
@@ -5,4 +5,9 @@ export function titleCase(text) {
...
@@ -5,4 +5,9 @@ export function titleCase(text) {
// .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })
// .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })
return
value
return
value
}
export
function
roundMath
(
number
,
decimalPlaces
)
{
const
factorOfTen
=
Math
.
pow
(
10
,
decimalPlaces
)
return
Math
.
round
(
number
*
factorOfTen
)
/
factorOfTen
}
}
\ No newline at end of file
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