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
b6f5fc4c
Commit
b6f5fc4c
authored
Feb 02, 2021
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
Didam See merge request
!1095
parents
d56b1ea3
894e70b5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
552 additions
and
12 deletions
+552
-12
index.js
src/api/index.js
+9
-1
BudgetTahunan.js
src/container/BudgetTahunan.js
+264
-9
SubHolding.js
src/container/Laporan/SubHolding.js
+4
-0
MonthlyReport.js
src/container/MonthlyReport.js
+267
-2
OperatingIndicator.js
src/container/OprIndicator/OperatingIndicator.js
+4
-0
OutlookPA.js
src/container/OutlookPA.js
+4
-0
No files found.
src/api/index.js
View file @
b6f5fc4c
...
...
@@ -247,7 +247,11 @@ const create = (type = "") => {
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
getHierarkiCreateReportFRMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/master_budget/get_report_hierarki'
,
body
)
const
getHierarkiCreateReportFRMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/monthly_report/get_report_hierarki'
,
body
)
const
getFRID
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/get_ratio_id'
,
body
)
const
createReportFRMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/master_budget/create_submission_report'
,
body
)
const
createReportFRMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_ratio/monthly_report/create_monthly_report'
,
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
)
...
...
@@ -645,7 +649,11 @@ const create = (type = "") => {
getFRID
,
getHierarkiReportHistorical
,
getHierarkiReportMTD
,
getHierarkiReportYtd
getHierarkiReportYtd
,
getHierarkiCreateReportFRMB
,
getHierarkiCreateReportFRMR
,
createReportFRMB
,
createReportFRMR
}
}
...
...
src/container/BudgetTahunan.js
View file @
b6f5fc4c
...
...
@@ -74,7 +74,8 @@ export default class BudgetTahunan extends Component {
permissionhandle
:
false
,
userType
:
''
,
PLBSFAMSubmitted
:
false
,
PLID
:
null
PLID
:
null
,
FRID
:
null
}
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -212,6 +213,10 @@ export default class BudgetTahunan extends Component {
}
})
if
(
arrayBaru
.
length
>
0
)
{
companyData
=
companyData
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
))
}
let
defaultProps
=
{
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
...
...
@@ -376,6 +381,10 @@ export default class BudgetTahunan extends Component {
}
})
if
(
arrayBaru
.
length
>
0
)
{
arrayBaru
=
arrayBaru
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
))
}
let
defaultProps
=
{
options
:
arrayBaru
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
...
...
@@ -524,6 +533,7 @@ export default class BudgetTahunan extends Component {
this
.
getLatestPeriodSubmit
()
this
.
getCashFlow
(
type
)
this
.
getPL
(
type
)
this
.
getFR
(
type
)
api
.
create
().
checkApprover
().
then
(
response
=>
{
// // console.log(this.state.btncreate);
// // console.log(this.state.btnedit)
...
...
@@ -1048,15 +1058,15 @@ export default class BudgetTahunan extends Component {
// console.log(listCF)
this
.
setState
({
dbCF
:
listCF
}
,
()
=>
{
if
(
this
.
state
.
submissionID
!=
null
)
{
this
.
createCashFlow
()
}
// if (type != undefined) {
// if (type == 'BS' || type == 'FAM' || type == 'PL') {
// console.log('tarik sis')
// this.createCashFlow()
// }
// if (this.state.submissionID != null) {
// this.createCashFlow()
// }
if
(
type
!=
undefined
)
{
if
(
type
==
'BS'
||
type
==
'FAM'
||
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
this
.
createCashFlow
()
}
}
})
}
...
...
@@ -1587,6 +1597,251 @@ export default class BudgetTahunan extends Component {
})
}
getFR
(
type
)
{
let
FRID
=
null
let
payloadID
=
{
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
}
console
.
log
(
payloadID
);
api
.
create
().
getFRID
(
payloadID
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
)
{
FRID
=
response
.
data
.
data
==
null
?
null
:
response
.
data
.
data
.
ratio_id
}
else
{
FRID
=
null
}
this
.
setState
({
FRID
},
()
=>
{
let
payload
=
{
"report_id"
:
29
,
"revision"
:
Number
(
this
.
state
.
lastRevision
),
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"submission_id"
:
this
.
state
.
FRID
,
}
api
.
create
().
getHierarkiCreateReportFRMB
(
payload
).
then
(
response
=>
{
// console.log(response);
let
dataTable
=
[]
if
(
response
.
data
)
{
// let dataTable = []
console
.
log
(
response
)
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
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
),
])
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
.
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
),
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
console
.
log
(
dataTable
)
this
.
setState
({
dbFR
:
dataTable
,
loading
:
false
},
()
=>
{
this
.
olahDataFR
(
this
.
state
.
dbFR
,
type
)
})
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
})
})
})
}
handleFormulaRatio
=
(
value
,
tableMeta
,
month
)
=>
{
// console.log(dataTable2)
let
dataTable2
=
this
.
state
.
dbFR
let
total
=
0
if
(
month
>
12
)
{
total
=
Number
(
dataTable2
[
35
][
7
+
month
])
}
else
{
for
(
let
index
=
0
;
index
<
month
;
index
++
)
{
total
+=
Number
(
dataTable2
[
35
][
8
+
index
])
// console.log(index);
}
total
=
total
/
month
}
let
hasil
=
Number
(
value
)
/
total
// console.log(hasil, value, total);
return
Number
(
hasil
).
toFixed
(
1
)
}
olahDataFR
(
dbFR
,
type
)
{
// let totalCY = 0
dbFR
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
!=
4
||
item
[
0
]
!=
1
)
{
if
(
item
[
5
]
===
"Return on Invested Capital - YTD (ROIC)"
)
{
item
[
7
]
=
this
.
handleFormulaRatio
(
item
[
7
],
item
,
1
)
item
[
8
]
=
this
.
handleFormulaRatio
(
item
[
8
],
item
,
2
)
item
[
9
]
=
this
.
handleFormulaRatio
(
item
[
9
],
item
,
3
)
item
[
10
]
=
this
.
handleFormulaRatio
(
item
[
10
],
item
,
4
)
item
[
11
]
=
this
.
handleFormulaRatio
(
item
[
11
],
item
,
5
)
item
[
12
]
=
this
.
handleFormulaRatio
(
item
[
12
],
item
,
6
)
item
[
13
]
=
this
.
handleFormulaRatio
(
item
[
13
],
item
,
7
)
item
[
14
]
=
this
.
handleFormulaRatio
(
item
[
14
],
item
,
8
)
item
[
15
]
=
this
.
handleFormulaRatio
(
item
[
15
],
item
,
9
)
item
[
16
]
=
this
.
handleFormulaRatio
(
item
[
16
],
item
,
10
)
item
[
17
]
=
this
.
handleFormulaRatio
(
item
[
17
],
item
,
11
)
item
[
18
]
=
this
.
handleFormulaRatio
(
item
[
18
],
item
,
12
)
// totalCY = Number(item[7]) + Number(item[8]) + Number(item[9]) + Number(item[10]) + Number(item[11]) + Number(item[12]) + Number(item[13]) + Number(item[14]) + Number(item[15]) + Number(item[16]) + Number(item[17]) + Number(item[18])
}
}
})
this
.
setState
({
dbFR
},
()
=>
{
this
.
payloadFR
(
type
)
})
}
payloadFR
(
type
)
{
let
listFR
=
[]
console
.
log
(
this
.
state
.
dbFR
)
let
totalCY
=
0
this
.
state
.
dbFR
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
!=
4
||
item
[
0
]
!=
1
)
{
if
(
item
[
5
]
===
"Return on Invested Capital - YTD (ROIC)"
)
{
item
[
7
]
=
this
.
handleFormulaRatio
(
item
[
7
],
item
,
1
)
item
[
8
]
=
this
.
handleFormulaRatio
(
item
[
8
],
item
,
2
)
item
[
9
]
=
this
.
handleFormulaRatio
(
item
[
9
],
item
,
3
)
item
[
10
]
=
this
.
handleFormulaRatio
(
item
[
10
],
item
,
4
)
item
[
11
]
=
this
.
handleFormulaRatio
(
item
[
11
],
item
,
5
)
item
[
12
]
=
this
.
handleFormulaRatio
(
item
[
12
],
item
,
6
)
item
[
13
]
=
this
.
handleFormulaRatio
(
item
[
13
],
item
,
7
)
item
[
14
]
=
this
.
handleFormulaRatio
(
item
[
14
],
item
,
8
)
item
[
15
]
=
this
.
handleFormulaRatio
(
item
[
15
],
item
,
9
)
item
[
16
]
=
this
.
handleFormulaRatio
(
item
[
16
],
item
,
10
)
item
[
17
]
=
this
.
handleFormulaRatio
(
item
[
17
],
item
,
11
)
item
[
18
]
=
this
.
handleFormulaRatio
(
item
[
18
],
item
,
12
)
totalCY
=
Number
(
item
[
7
])
+
Number
(
item
[
8
])
+
Number
(
item
[
9
])
+
Number
(
item
[
10
])
+
Number
(
item
[
11
])
+
Number
(
item
[
12
])
+
Number
(
item
[
13
])
+
Number
(
item
[
14
])
+
Number
(
item
[
15
])
+
Number
(
item
[
16
])
+
Number
(
item
[
17
])
+
Number
(
item
[
18
])
}
}
listFR
.
push
(
{
"item_report_id"
:
item
[
1
],
"january"
:
String
(
item
[
7
]
==
undefined
?
item
[
7
]
:
Number
(
item
[
7
]).
toFixed
(
1
)),
"february"
:
String
(
item
[
8
]
==
undefined
?
item
[
8
]
:
Number
(
item
[
8
]).
toFixed
(
1
)),
"march"
:
String
(
item
[
9
]
==
undefined
?
item
[
9
]
:
Number
(
item
[
9
]).
toFixed
(
1
)),
"april"
:
String
(
item
[
10
]
==
undefined
?
item
[
10
]
:
Number
(
item
[
10
]).
toFixed
(
1
)),
"may"
:
String
(
item
[
11
]
==
undefined
?
item
[
11
]
:
Number
(
item
[
11
]).
toFixed
(
1
)),
"june"
:
String
(
item
[
12
]
==
undefined
?
item
[
12
]
:
Number
(
item
[
12
]).
toFixed
(
1
)),
"july"
:
String
(
item
[
13
]
==
undefined
?
item
[
13
]
:
Number
(
item
[
13
]).
toFixed
(
1
)),
"august"
:
String
(
item
[
14
]
==
undefined
?
item
[
14
]
:
Number
(
item
[
14
]).
toFixed
(
1
)),
"september"
:
String
(
item
[
15
]
==
undefined
?
item
[
15
]
:
Number
(
item
[
15
]).
toFixed
(
1
)),
"october"
:
String
(
item
[
16
]
==
undefined
?
item
[
16
]
:
Number
(
item
[
16
]).
toFixed
(
1
)),
"november"
:
String
(
item
[
17
]
==
undefined
?
item
[
17
]
:
Number
(
item
[
17
]).
toFixed
(
1
)),
"december"
:
String
(
item
[
18
]
==
undefined
?
item
[
18
]
:
Number
(
item
[
18
]).
toFixed
(
1
)),
"total_current_year"
:
String
(
totalCY
==
undefined
?
totalCY
:
Number
(
totalCY
).
toFixed
(
1
)),
"total_next_year"
:
String
(
item
[
19
]
!=
''
?
Number
(
item
[
19
]).
toFixed
(
1
)
:
item
[
19
]),
"total_more_year"
:
String
(
item
[
20
]
!=
''
?
Number
(
item
[
20
]).
toFixed
(
1
)
:
item
[
20
]),
}
)
})
console
.
log
(
listFR
)
console
.
log
(
'subOD'
,
this
.
state
.
submissionID
)
this
.
setState
({
dbFR
:
listFR
}
,
()
=>
{
if
(
this
.
state
.
submissionID
!=
null
)
{
this
.
createDBFR
()
}
})
}
createDBFR
()
{
let
payload
=
{
// "submission_id": this.state.submissionID,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
29
,
"status"
:
"submitted"
,
"ratio_id"
:
this
.
state
.
FRID
,
"ratio_mb"
:
this
.
state
.
dbFR
,
"months"
:
0
,
}
// console.log(this.state.dbCF)
console
.
log
(
JSON
.
stringify
(
payload
))
api
.
create
().
createReportFRMB
(
payload
).
then
((
res
)
=>
{
console
.
log
(
res
)
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
// } else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ loading: false }, () => {
// // this.getSubmission()
// document.body.style.overflow = 'unset';
// })
// }
})
}
historyApproval
()
{
let
body
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
...
...
src/container/Laporan/SubHolding.js
View file @
b6f5fc4c
...
...
@@ -98,6 +98,10 @@ export default class SubHolding extends Component {
}
})
if
(
arrayBaru
.
length
>
0
)
{
arrayBaru
=
arrayBaru
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
))
}
let
defaultProps
=
{
options
:
arrayBaru
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
...
...
src/container/MonthlyReport.js
View file @
b6f5fc4c
...
...
@@ -621,6 +621,7 @@ export default class MonthlyReport extends Component {
this
.
getLatestPeriodSubmit
()
this
.
getCashFlow
(
type
)
this
.
getPL
(
type
)
this
.
getFR
(
type
)
// this.getReport()
// this.getReportAttachment()
api
.
create
().
checkApproverMonthly
().
then
(
response
=>
{
...
...
@@ -1373,6 +1374,7 @@ export default class MonthlyReport extends Component {
"months"
:
this
.
state
.
month
.
month_id
,
"cash_flow"
:
this
.
state
.
dbCF
}
console
.
log
(
JSON
.
stringify
(
payload
))
api
.
create
().
createMonthlyReportCF
(
payload
).
then
((
res
)
=>
{
console
.
log
(
res
)
// if (response.data) {
...
...
@@ -1413,7 +1415,7 @@ export default class MonthlyReport extends Component {
"company_id"
:
this
.
state
.
company
.
company_id
,
"months"
:
this
.
state
.
month
.
month_id
,
"quarter"
:
0
,
"report_id"
:
1
,
"report_id"
:
28
,
"submission_id"
:
this
.
state
.
PLID
}
...
...
@@ -1787,7 +1789,7 @@ export default class MonthlyReport extends Component {
// "monthly_report_id": this.state.monthlyReportId,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
1
,
"report_id"
:
28
,
"status"
:
"submitted"
,
"months"
:
this
.
state
.
month
.
month_id
,
"quarter"
:
0
,
...
...
@@ -1812,6 +1814,269 @@ export default class MonthlyReport extends Component {
// }
})
}
getFR
(
type
)
{
let
FRID
=
null
let
payloadID
=
{
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
}
console
.
log
(
payloadID
);
api
.
create
().
getFRID
(
payloadID
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
)
{
FRID
=
response
.
data
.
data
==
null
?
null
:
response
.
data
.
data
.
ratio_id
}
else
{
FRID
=
null
}
this
.
setState
({
FRID
},
()
=>
{
let
payload
=
{
"report_id"
:
29
,
"revision"
:
Number
(
this
.
state
.
lastRevision
),
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"submission_id"
:
this
.
state
.
FRID
,
"months"
:
this
.
state
.
month
.
month_id
}
api
.
create
().
getHierarkiCreateReportFRMR
(
payload
).
then
(
response
=>
{
// console.log(response);
let
dataTable
=
[]
if
(
response
.
data
)
{
// let dataTable = []
console
.
log
(
response
)
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
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
.
monthly_january
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_february
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_march
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_april
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_may
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_june
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_july
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_august
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_september
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_october
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_november
).
toFixed
(
1
),
Number
(
item
.
ratio
.
monthly_december
).
toFixed
(
1
),
])
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
.
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
),
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
console
.
log
(
dataTable
)
this
.
setState
({
dbFR
:
dataTable
,
loading
:
false
},
()
=>
{
this
.
olahDataFR
(
this
.
state
.
dbFR
,
type
)
})
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
})
})
})
}
handleFormulaRatio
=
(
value
,
tableMeta
,
month
)
=>
{
// console.log(dataTable2)
let
dataTable2
=
this
.
state
.
dbFR
let
total
=
0
if
(
month
>
12
)
{
total
=
Number
(
dataTable2
[
35
][
7
+
month
])
}
else
{
for
(
let
index
=
0
;
index
<
month
;
index
++
)
{
total
+=
Number
(
dataTable2
[
35
][
8
+
index
])
// console.log(index);
}
total
=
total
/
month
}
let
hasil
=
Number
(
value
)
/
total
// console.log(hasil, value, total);
return
Number
(
hasil
).
toFixed
(
1
)
}
olahDataFR
(
dbFR
,
type
)
{
dbFR
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
!=
4
||
item
[
0
]
!=
1
)
{
if
(
item
[
5
]
===
"Return on Invested Capital - YTD (ROIC)"
)
{
item
[
7
]
=
this
.
handleFormulaRatio
(
item
[
7
],
item
,
1
)
item
[
8
]
=
this
.
handleFormulaRatio
(
item
[
8
],
item
,
2
)
item
[
9
]
=
this
.
handleFormulaRatio
(
item
[
9
],
item
,
3
)
item
[
10
]
=
this
.
handleFormulaRatio
(
item
[
10
],
item
,
4
)
item
[
11
]
=
this
.
handleFormulaRatio
(
item
[
11
],
item
,
5
)
item
[
12
]
=
this
.
handleFormulaRatio
(
item
[
12
],
item
,
6
)
item
[
13
]
=
this
.
handleFormulaRatio
(
item
[
13
],
item
,
7
)
item
[
14
]
=
this
.
handleFormulaRatio
(
item
[
14
],
item
,
8
)
item
[
15
]
=
this
.
handleFormulaRatio
(
item
[
15
],
item
,
9
)
item
[
16
]
=
this
.
handleFormulaRatio
(
item
[
16
],
item
,
10
)
item
[
17
]
=
this
.
handleFormulaRatio
(
item
[
17
],
item
,
11
)
item
[
18
]
=
this
.
handleFormulaRatio
(
item
[
18
],
item
,
12
)
}
}
})
this
.
setState
({
dbFR
},
()
=>
{
this
.
payloadFR
(
type
)
})
}
payloadFR
(
type
)
{
let
listFR
=
[]
console
.
log
(
this
.
state
.
dbFR
)
this
.
state
.
dbFR
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
!=
4
||
item
[
0
]
!=
1
)
{
if
(
item
[
5
]
===
"Return on Invested Capital - YTD (ROIC)"
)
{
item
[
7
]
=
this
.
handleFormulaRatio
(
item
[
7
],
item
,
1
)
item
[
8
]
=
this
.
handleFormulaRatio
(
item
[
8
],
item
,
2
)
item
[
9
]
=
this
.
handleFormulaRatio
(
item
[
9
],
item
,
3
)
item
[
10
]
=
this
.
handleFormulaRatio
(
item
[
10
],
item
,
4
)
item
[
11
]
=
this
.
handleFormulaRatio
(
item
[
11
],
item
,
5
)
item
[
12
]
=
this
.
handleFormulaRatio
(
item
[
12
],
item
,
6
)
item
[
13
]
=
this
.
handleFormulaRatio
(
item
[
13
],
item
,
7
)
item
[
14
]
=
this
.
handleFormulaRatio
(
item
[
14
],
item
,
8
)
item
[
15
]
=
this
.
handleFormulaRatio
(
item
[
15
],
item
,
9
)
item
[
16
]
=
this
.
handleFormulaRatio
(
item
[
16
],
item
,
10
)
item
[
17
]
=
this
.
handleFormulaRatio
(
item
[
17
],
item
,
11
)
item
[
18
]
=
this
.
handleFormulaRatio
(
item
[
18
],
item
,
12
)
}
}
listFR
.
push
(
{
"item_report_id"
:
item
[
1
],
"actual"
:
this
.
state
.
month
.
month_id
==
1
?
String
(
item
[
7
]
==
undefined
?
item
[
7
]
:
Number
(
item
[
7
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
2
?
String
(
item
[
8
]
==
undefined
?
item
[
8
]
:
Number
(
item
[
8
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
3
?
String
(
item
[
9
]
==
undefined
?
item
[
8
]
:
Number
(
item
[
9
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
4
?
String
(
item
[
10
]
==
undefined
?
item
[
10
]
:
Number
(
item
[
10
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
5
?
String
(
item
[
11
]
==
undefined
?
item
[
11
]
:
Number
(
item
[
11
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
6
?
String
(
item
[
12
]
==
undefined
?
item
[
12
]
:
Number
(
item
[
12
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
7
?
String
(
item
[
13
]
==
undefined
?
item
[
13
]
:
Number
(
item
[
13
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
8
?
String
(
item
[
14
]
==
undefined
?
item
[
14
]
:
Number
(
item
[
14
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
9
?
String
(
item
[
15
]
==
undefined
?
item
[
15
]
:
Number
(
item
[
15
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
10
?
String
(
item
[
16
]
==
undefined
?
item
[
16
]
:
Number
(
item
[
16
]).
toFixed
(
1
))
:
this
.
state
.
month
.
month_id
==
11
?
String
(
item
[
17
]
==
undefined
?
item
[
17
]
:
Number
(
item
[
17
]).
toFixed
(
1
))
:
String
(
item
[
18
]
==
undefined
?
item
[
18
]
:
Number
(
item
[
18
]).
toFixed
(
1
))
// "january": String(item[7] == undefined? item[7] : Number(item[7]).toFixed(1)),
// "february": String(item[8] == undefined? item[8] : Number(item[8]).toFixed(1)),
// "march": String(item[9] == undefined? item[9] : Number(item[9]).toFixed(1)),
// "april": String(item[10] == undefined? item[10] : Number(item[10]).toFixed(1)),
// "may": String(item[11] == undefined? item[11] : Number(item[11]).toFixed(1)),
// "june": String(item[12] == undefined? item[12] : Number(item[12]).toFixed(1)),
// "july": String(item[13] == undefined? item[13] : Number(item[13]).toFixed(1)),
// "august": String(item[14] == undefined? item[14] : Number(item[14]).toFixed(1)),
// "september": String(item[15] == undefined? item[15] : Number(item[15]).toFixed(1)),
// "october": String(item[16] == undefined? item[16] : Number(item[16]).toFixed(1)),
// "november": String(item[17] == undefined? item[17] : Number(item[17]).toFixed(1)),
// "december": String(item[18] == undefined? item[18] : Number(item[18]).toFixed(1)),
// "total_next_year": String(item[19] != ''? Number(item[19]).toFixed(1) : item[19]),
// "total_more_year": String(item[20] != ''? Number(item[20]).toFixed(1) : item[20]),
}
)
})
console
.
log
(
listFR
)
console
.
log
(
'subOD'
,
this
.
state
.
submissionID
)
this
.
setState
({
dbFR
:
listFR
}
,
()
=>
{
if
(
this
.
state
.
submissionID
!=
null
)
{
this
.
createDBFR
()
}
})
}
createDBFR
()
{
let
payload
=
{
// "submission_id": this.state.submissionID,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
29
,
"status"
:
"submitted"
,
"ratio_id"
:
this
.
state
.
FRID
,
"ratio_mr"
:
this
.
state
.
dbFR
,
"months"
:
this
.
state
.
month
.
month_id
,
}
// console.log(this.state.dbCF)
console
.
log
(
JSON
.
stringify
(
payload
))
api
.
create
().
createReportFRMR
(
payload
).
then
((
res
)
=>
{
console
.
log
(
res
)
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
// } else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ loading: false }, () => {
// // this.getSubmission()
// document.body.style.overflow = 'unset';
// })
// }
})
}
render
()
{
const
columns
=
[
"#"
,
"Report Type"
,
...
...
src/container/OprIndicator/OperatingIndicator.js
View file @
b6f5fc4c
...
...
@@ -188,6 +188,10 @@ export default class OperatingIndicator extends Component {
}
})
if
(
arrayBaru
.
length
>
0
)
{
arrayBaru
=
arrayBaru
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
))
}
let
defaultProps
=
{
options
:
arrayBaru
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
...
...
src/container/OutlookPA.js
View file @
b6f5fc4c
...
...
@@ -110,6 +110,10 @@ export default class OutlookPA extends Component {
}
})
if
(
arrayBaru
.
length
>
0
)
{
companyData
=
companyData
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
))
}
let
defaultProps
=
{
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
...
...
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