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
bf34a703
Commit
bf34a703
authored
Feb 02, 2021
by
rifkaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
4d3faaf4
e5196900
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
474 additions
and
1099 deletions
+474
-1099
index.js
src/api/index.js
+4
-0
HomePage.js
src/container/HomePage.js
+4
-2
SubHolding.js
src/container/Laporan/SubHolding.js
+163
-127
TableSubHolding.js
src/container/Laporan/TableSubHolding.js
+234
-946
MonthlyReport.js
src/container/MonthlyReport.js
+13
-4
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+56
-20
No files found.
src/api/index.js
View file @
bf34a703
...
...
@@ -241,11 +241,13 @@ const create = (type = "") => {
const
getReportPLDetailMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss_detail/master_budget/get_report_hierarki'
,
body
)
const
getReportPLDetailMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki'
,
body
)
const
getReportPL
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/get_report_hierarki'
,
body
)
const
getReportFR
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/get_report_hierarki'
,
body
)
const
getHierarkiCreateReportPLMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/master_budget/get_report_hierarki'
,
body
)
const
getHierarkiCreateReportPLMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/monthly_report/get_report_hierarki'
,
body
)
const
createReportPLMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/master_budget/create_submission_report'
,
body
)
const
createReportPLMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/monthly_report/create_monthly_report'
,
body
)
const
getPLID
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/get_profit_loss_id'
,
body
)
const
getFRID
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/get_ratio_id'
,
body
)
// const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
// const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/get_report_hierarki', body)
const
getReportPLMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/monthly_report/get_report_hierarki'
,
body
)
...
...
@@ -634,11 +636,13 @@ const create = (type = "") => {
getReportBSSuma
,
getDashboardCAT
,
getReportPL
,
getReportFR
,
getHierarkiCreateReportPLMB
,
getHierarkiCreateReportPLMR
,
createReportPLMB
,
createReportPLMR
,
getPLID
,
getFRID
,
getHierarkiReportHistorical
,
getHierarkiReportMTD
,
getHierarkiReportYtd
...
...
src/container/HomePage.js
View file @
bf34a703
...
...
@@ -415,7 +415,8 @@ class HomePage extends Component {
pathname
:
String
(
tableMeta
.
rowData
[
3
]).
toLocaleLowerCase
().
includes
(
"master"
)
?
`/home/master-budget/`
:
`/home/monthly-report/`
,
state
:
{
userType
:
'approver'
,
rawData
:
this
.
state
.
rawData
[
tableMeta
.
rowIndex
]
rawData
:
this
.
state
.
rawData
[
tableMeta
.
rowIndex
],
month
:
String
(
tableMeta
.
rowData
[
3
]).
toLocaleLowerCase
().
includes
(
"master"
)
?
null
:
this
.
state
.
month
}
}}
>
<
button
...
...
@@ -791,7 +792,8 @@ class HomePage extends Component {
pathname: `/home/monthly-report/`,
state: {
userType: '
user
',
rawData: item
rawData: item,
month: this.state.month
}
}}>
<button
...
...
src/container/Laporan/SubHolding.js
View file @
bf34a703
...
...
@@ -626,11 +626,12 @@ export default class SubHolding extends Component {
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
}
console
.
log
(
payloadID
);
//
console.log(payloadID);
api
.
create
().
getPLID
(
payloadID
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
)
{
PLID
=
response
.
data
.
data
==
null
?
null
:
response
.
data
.
data
.
profit_loss_id
// PLID = response.data.data.profit_loss_id
}
else
{
PLID
=
null
}
...
...
@@ -814,130 +815,165 @@ export default class SubHolding extends Component {
})
})
}
else
if
(
this
.
state
.
report
.
value
===
4
)
{
api
.
create
().
getReportHierarkiFRMB
(
payload
).
then
(
response
=>
{
// console.log(payload);
let
FRID
=
null
let
payloadFRID
=
{
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
}
api
.
create
().
getFRID
(
payloadFRID
).
then
(
response
=>
{
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
uom
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
december
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_more_year
).
toFixed
(
1
),
// Number(item.ratio.monthly_january).toFixed(2),
// Number(item.ratio.monthly_february).toFixed(2),
// Number(item.ratio.monthly_march).toFixed(2),
// Number(item.ratio.monthly_april).toFixed(2),
// Number(item.ratio.monthly_may).toFixed(2),
// Number(item.ratio.monthly_june).toFixed(2),
// Number(item.ratio.monthly_july).toFixed(2),
// Number(item.ratio.monthly_august).toFixed(2),
// Number(item.ratio.monthly_september).toFixed(2),
// Number(item.ratio.monthly_october).toFixed(2),
// Number(item.ratio.monthly_november).toFixed(2),
// Number(item.ratio.monthly_december).toFixed(2),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong,
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
if
(
response
)
{
FRID
=
response
.
data
.
data
==
null
?
null
:
response
.
data
.
data
.
ratio_id
}
else
{
FRID
=
null
}
this
.
setState
({
FRID
},
()
=>
{
let
payloads
=
{...
payload
,
submission_id
:
this
.
state
.
FRID
,
months
:
this
.
state
.
month
.
month_id
,
quarter
:
0
}
api
.
create
().
getReportFR
(
payloads
).
then
(
response
=>
{
console
.
log
(
payload
);
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
uom
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
december
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_more_year
).
toFixed
(
1
),
item
.
ratio
.
monthly_january
,
item
.
ratio
.
monthly_february
,
item
.
ratio
.
monthly_march
,
item
.
ratio
.
monthly_april
,
item
.
ratio
.
monthly_may
,
item
.
ratio
.
monthly_june
,
item
.
ratio
.
monthly_july
,
item
.
ratio
.
monthly_august
,
item
.
ratio
.
monthly_september
,
item
.
ratio
.
monthly_october
,
item
.
ratio
.
monthly_november
,
item
.
ratio
.
monthly_december
,
item
.
ratio
.
monthly_last_year_january
,
item
.
ratio
.
monthly_last_year_february
,
item
.
ratio
.
monthly_last_year_march
,
item
.
ratio
.
monthly_last_year_april
,
item
.
ratio
.
monthly_last_year_may
,
item
.
ratio
.
monthly_last_year_june
,
item
.
ratio
.
monthly_last_year_july
,
item
.
ratio
.
monthly_last_year_august
,
item
.
ratio
.
monthly_last_year_september
,
item
.
ratio
.
monthly_last_year_october
,
item
.
ratio
.
monthly_last_year_november
,
item
.
ratio
.
monthly_last_year_december
,
])
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
oum
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
december
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_more_year
).
toFixed
(
1
),
// Number(item.ratio.monthly_january).toFixed(2),
// Number(item.ratio.monthly_february).toFixed(2),
// Number(item.ratio.monthly_march).toFixed(2),
// Number(item.ratio.monthly_april).toFixed(2),
// Number(item.ratio.monthly_may).toFixed(2),
// Number(item.ratio.monthly_june).toFixed(2),
// Number(item.ratio.monthly_july).toFixed(2),
// Number(item.ratio.monthly_august).toFixed(2),
// Number(item.ratio.monthly_september).toFixed(2),
// Number(item.ratio.monthly_october).toFixed(2),
// Number(item.ratio.monthly_november).toFixed(2),
// Number(item.ratio.monthly_december).toFixed(2),
// item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
oum
,
item
.
ratio
.
total_actual_before
===
null
?
"0.0"
:
item
.
ratio
.
total_actual_before
===
""
?
"0.0"
:
item
.
ratio
.
total_actual_before
,
Number
(
item
.
ratio
.
january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
december
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
ratio
.
total_more_year
).
toFixed
(
1
),
item
.
ratio
.
monthly_january
,
item
.
ratio
.
monthly_february
,
item
.
ratio
.
monthly_march
,
item
.
ratio
.
monthly_april
,
item
.
ratio
.
monthly_may
,
item
.
ratio
.
monthly_june
,
item
.
ratio
.
monthly_july
,
item
.
ratio
.
monthly_august
,
item
.
ratio
.
monthly_september
,
item
.
ratio
.
monthly_october
,
item
.
ratio
.
monthly_november
,
item
.
ratio
.
monthly_december
,
item
.
ratio
.
monthly_last_year_january
,
item
.
ratio
.
monthly_last_year_february
,
item
.
ratio
.
monthly_last_year_march
,
item
.
ratio
.
monthly_last_year_april
,
item
.
ratio
.
monthly_last_year_may
,
item
.
ratio
.
monthly_last_year_june
,
item
.
ratio
.
monthly_last_year_july
,
item
.
ratio
.
monthly_last_year_august
,
item
.
ratio
.
monthly_last_year_september
,
item
.
ratio
.
monthly_last_year_october
,
item
.
ratio
.
monthly_last_year_november
,
item
.
ratio
.
monthly_last_year_december
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
console
.
log
(
this
.
state
.
dataTable
)
// this.setState({ dataTable }, () => {
// console.log(this.state.dataTable)
// this.getRatioMR(payload)
// })
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
})
this
.
setState
({
dataTable
},
()
=>
{
console
.
log
(
this
.
state
.
dataTable
)
this
.
getRatioMR
(
payload
)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
})
})
}
else
if
(
this
.
state
.
report
.
value
===
5
)
{
api
.
create
().
getReportTP
(
payload
).
then
(
response
=>
{
...
...
@@ -1548,7 +1584,7 @@ export default class SubHolding extends Component {
let
persenOL
=
0
if
(
mtd_mb
<
0
)
{
if
(
mtd_actual
<
mtd_mb
)
{
if
(
parseFloat
(
mtd_actual
)
<
parseFloat
(
mtd_mb
)
)
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
}
else
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
+
1
...
...
@@ -1558,7 +1594,7 @@ export default class SubHolding extends Component {
}
if
(
mtd_ol
<
0
)
{
if
(
mtd_actual
<
mtd_ol
)
{
if
(
parseFloat
(
mtd_actual
)
<
parseFloat
(
mtd_ol
)
)
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
}
else
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
+
1
...
...
@@ -1602,7 +1638,7 @@ export default class SubHolding extends Component {
let
persenOL
=
0
if
(
mtd_mb
<
0
)
{
if
(
mtd_actual
<
mtd_mb
)
{
if
(
parseFloat
(
mtd_actual
)
<
parseFloat
(
mtd_mb
)
)
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
}
else
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
+
1
...
...
@@ -1612,7 +1648,7 @@ export default class SubHolding extends Component {
}
if
(
mtd_ol
<
0
)
{
if
(
mtd_actual
<
mtd_ol
)
{
if
(
parseFloat
(
mtd_actual
)
<
parseFloat
(
mtd_ol
)
)
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
}
else
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
+
1
...
...
@@ -2766,10 +2802,10 @@ export default class SubHolding extends Component {
a
.
click
();
}
}
else
if
(
this
.
state
.
report
.
value
===
4
)
{
let
url
=
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/db_ratio/export_report?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submission
ID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
let
url
=
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/db_ratio/export_report?submission_id=
${
this
.
state
.
FRID
===
null
?
""
:
this
.
state
.
FR
ID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
console
.
log
(
url
);
let
res
=
await
fetch
(
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/db_ratio/export_report?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submission
ID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/db_ratio/export_report?submission_id=
${
this
.
state
.
FRID
===
null
?
""
:
this
.
state
.
FR
ID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
)
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
...
...
src/container/Laporan/TableSubHolding.js
View file @
bf34a703
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/container/MonthlyReport.js
View file @
bf34a703
...
...
@@ -73,7 +73,8 @@ export default class MonthlyReport extends Component {
textRevision
:
''
,
dbCF
:
[],
PLBSFAMSubmitted
:
false
,
PLID
:
null
PLID
:
null
,
monthHome
:
null
}
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -116,8 +117,11 @@ export default class MonthlyReport extends Component {
this
.
setState
({
loading
:
true
})
this
.
props
.
selectIndex
(
'Monthly Report'
)
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
// console.log(this.props);
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
,
intent
:
'Home'
,
lastPeriod
:
this
.
props
.
location
.
state
.
rawData
.
periode
,
rawData
:
this
.
props
.
location
.
state
.
rawData
},
()
=>
{
console
.
log
(
this
.
props
);
if
(
this
.
props
.
location
.
state
.
month
!=
null
||
this
.
props
.
location
.
state
.
month
!=
undefined
)
{
this
.
setState
({
monthHome
:
this
.
props
.
location
.
state
.
month
})
}
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
,
intent
:
'Home'
,
lastPeriod
:
this
.
props
.
location
.
state
.
rawData
.
periode
,
rawData
:
this
.
props
.
location
.
state
.
rawData
},
()
=>
{
this
.
getPermission
()
})
}
else
{
...
...
@@ -322,7 +326,12 @@ export default class MonthlyReport extends Component {
};
let
index
=
data
.
findIndex
((
val
)
=>
val
.
month_name
==
month
)
console
.
log
(
index
);
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
]
},
()
=>
{
let
indexMonthHome
=
-
1
if
(
this
.
state
.
monthHome
!=
null
)
{
indexMonthHome
=
monthData
.
findIndex
((
val
)
=>
val
.
month_id
==
this
.
state
.
monthHome
.
month_id
)
}
console
.
log
(
indexMonthHome
)
this
.
setState
({
listMonth
:
defaultProps
,
month
:
indexMonthHome
==
-
1
?
(
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
])
:
monthData
[
indexMonthHome
]
},
()
=>
{
// if (this.state.isApprover === true) {
// if (this.state.submittedOnly) {
// console.log('masuk cuk')
...
...
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
bf34a703
...
...
@@ -70,11 +70,13 @@ export default class CorporateAnnualTargetMR extends Component {
judulColumn
:
null
,
get_for
:
"view"
,
parameterScore
:
[],
parameterPerfom
:
[],
totalScore
:
0
,
perfomanceScore
:
''
,
buttonError
:
true
,
viewOnly
:
true
,
aa
:
0
aa
:
0
,
perfomanceScoreColor
:
'#fff'
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -85,6 +87,7 @@ export default class CorporateAnnualTargetMR extends Component {
this
.
getKPIType
()
this
.
getMaxAch
()
this
.
getParameterGroup
()
this
.
getParameterGroupPerfom
()
this
.
handleViewOnly
()
}
...
...
@@ -139,6 +142,17 @@ export default class CorporateAnnualTargetMR extends Component {
})
}
getParameterGroupPerfom
()
{
api
.
create
().
getParameterByGroupName
({
"group_name"
:
"PERFORMANCE_KPI"
}).
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
if
(
response
.
data
)
{
this
.
setState
({
parameterPerfom
:
response
.
data
.
data
})
}
})
}
getLatestUpdate
()
{
let
payload
=
{
"report_id"
:
this
.
props
.
report_id
,
...
...
@@ -704,7 +718,7 @@ export default class CorporateAnnualTargetMR extends Component {
if
(
item
[
12
]
==
''
||
String
(
item
[
12
])
==
'0'
||
String
(
item
[
12
])
==
'0.0'
)
{
totalSW
=
0
}
else
{
totalSW
=
(
Number
(
totalScorez
)
*
Number
(
handlePercent
)
/
100
0
)
totalSW
=
(
Number
(
totalScorez
)
*
Number
(
handlePercent
)
/
100
)
}
totalSW
=
Number
(
totalSW
).
toFixed
(
2
)
if
(
item
[
0
]
!==
1
&&
item
[
0
]
!==
4
)
{
...
...
@@ -747,6 +761,7 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(datatable3);
let
totalWeightz
=
Number
(
totalWeight
)
/
100
let
totalz
=
Number
(
Number
(
total
).
toFixed
(
2
)
/
Number
(
totalWeightz
)).
toFixed
(
2
)
console
.
log
(
totalz
)
let
lastTotal
=
R
.
equals
(
totalz
,
NaN
)
?
0.0
:
totalz
if
(
R
.
equals
(
totalz
,
NaN
)
||
R
.
equals
(
totalz
,
"NaN"
))
{
...
...
@@ -755,24 +770,45 @@ export default class CorporateAnnualTargetMR extends Component {
lastTotal
=
totalz
}
// console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
if
(
lastTotal
>=
1.00
&&
lastTotal
<=
2.00
)
{
perfomanceScore
=
'K'
}
else
if
(
lastTotal
>=
2.01
&&
lastTotal
<=
2.75
)
{
perfomanceScore
=
'C'
}
else
if
(
lastTotal
>=
2.76
&&
lastTotal
<=
3.00
)
{
perfomanceScore
=
'B-'
}
else
if
(
lastTotal
>=
3.01
&&
lastTotal
<=
3.75
)
{
perfomanceScore
=
'B'
}
else
if
(
lastTotal
>=
3.76
&&
lastTotal
<=
4.00
)
{
perfomanceScore
=
'B+'
}
else
if
(
lastTotal
>=
4.01
&&
lastTotal
<=
4.75
)
{
perfomanceScore
=
'BS'
}
else
if
(
lastTotal
>=
4.76
&&
lastTotal
<=
5.00
)
{
perfomanceScore
=
'IST'
console
.
log
(
Number
(
Number
(
total
).
toFixed
(
2
)
/
Number
(
totalWeightz
)).
toFixed
(
2
))
let
listPerfomanceDefault
=
this
.
state
.
parameterPerfom
.
filter
((
val
)
=>
String
(
val
.
company_name
).
toLocaleLowerCase
()
==
"default"
)
let
performanceScore
=
''
let
perfomanceScoreColor
=
'#fff'
if
(
listPerfomanceDefault
.
length
>
0
)
{
listPerfomanceDefault
.
map
((
item
,
index
)
=>
{
console
.
log
(
Number
(
lastTotal
))
console
.
log
(
Number
(
item
.
min_value
))
console
.
log
(
Number
(
item
.
max_value
))
if
(
Number
(
lastTotal
)
>=
Number
(
item
.
min_value
)
&&
Number
(
lastTotal
)
<=
Number
(
item
.
max_value
))
{
console
.
log
(
'masuk'
)
perfomanceScore
=
item
.
description
perfomanceScoreColor
=
item
.
value
}
})
}
// console.log(Number(lastTotal))
console
.
log
(
this
.
state
.
parameterPerfom
)
console
.
log
(
listPerfomanceDefault
)
console
.
log
(
perfomanceScore
)
console
.
log
(
perfomanceScoreColor
)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
// perfomanceScore = 'C'
// } else if (lastTotal >= 2.76 && lastTotal <= 3.00) {
// perfomanceScore = 'B-'
// } else if (lastTotal >= 3.01 && lastTotal <= 3.75) {
// perfomanceScore = 'B'
// } else if (lastTotal >= 3.76 && lastTotal <= 4.00) {
// perfomanceScore = 'B+'
// } else if (lastTotal >= 4.01 && lastTotal <= 4.75) {
// perfomanceScore = 'BS'
// } else if (lastTotal >= 4.76 && lastTotal <= 5.00) {
// perfomanceScore = 'IST'
// }
setTimeout
(()
=>
{
this
.
setState
({
totalScore
:
lastTotal
,
perfomanceScore
,
loading
:
false
},
()
=>
{
this
.
setState
({
totalScore
:
lastTotal
,
perfomanceScore
,
loading
:
false
,
perfomanceScoreColor
},
()
=>
{
this
.
setState
({
loading
:
true
})
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
...
...
@@ -1871,7 +1907,7 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
padding
:
5
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
PERFOMANCE
<
/Typography
>
<
/div
>
<
div
style
=
{{
borderStyle
:
'solid'
,
backgroundColor
:
this
.
handleBackgroundPerf
(
this
.
state
.
totalScore
)
,
borderWidth
:
'0px 1px 1px 1px'
,
padding
:
5
,
minWidth
:
200
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
div
style
=
{{
borderStyle
:
'solid'
,
backgroundColor
:
this
.
state
.
perfomanceScoreColor
,
borderWidth
:
'0px 1px 1px 1px'
,
padding
:
5
,
minWidth
:
200
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
{
!
this
.
state
.
loading
&&
(
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'black'
,
fontWeight
:
'bold'
}}
>
{
this
.
state
.
perfomanceScore
}
<
/Typography
>
)}
...
...
@@ -2039,7 +2075,7 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
padding
:
5
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
PERFOMANCE
<
/Typography
>
<
/div
>
<
div
style
=
{{
borderStyle
:
'solid'
,
backgroundColor
:
this
.
handleBackgroundPerf
(
this
.
state
.
totalScore
)
,
borderWidth
:
'0px 1px 1px 1px'
,
padding
:
5
,
minWidth
:
200
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
div
style
=
{{
borderStyle
:
'solid'
,
backgroundColor
:
this
.
state
.
perfomanceScoreColor
,
borderWidth
:
'0px 1px 1px 1px'
,
padding
:
5
,
minWidth
:
200
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'black'
,
fontWeight
:
'bold'
}}
>
{
this
.
state
.
perfomanceScore
}
<
/Typography
>
<
/div
>
<
/div
>
...
...
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