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
26dd8f51
Commit
26dd8f51
authored
Jan 29, 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
dbf60bc4
e9ecf0f7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1033 additions
and
46 deletions
+1033
-46
index.js
src/api/index.js
+15
-4
BudgetTahunan.js
src/container/BudgetTahunan.js
+481
-2
SubHolding.js
src/container/Laporan/SubHolding.js
+124
-39
MonthlyReport.js
src/container/MonthlyReport.js
+406
-1
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+7
-0
No files found.
src/api/index.js
View file @
26dd8f51
...
@@ -240,7 +240,13 @@ const create = (type = "") => {
...
@@ -240,7 +240,13 @@ const create = (type = "") => {
const
getAllReportPLDetail
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss_detail/get_report_hierarki'
,
body
)
const
getAllReportPLDetail
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss_detail/get_report_hierarki'
,
body
)
const
getReportPLDetailMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss_detail/master_budget/get_report_hierarki'
,
body
)
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
getReportPLDetailMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki'
,
body
)
const
getReportPLMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/master_budget/get_report_hierarki'
,
body
)
const
getReportPL
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/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 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
)
const
getReportPLMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_profit_loss/monthly_report/get_report_hierarki'
,
body
)
const
getReportTPMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_tax_planning/master_budget/get_report_hierarki'
,
body
)
const
getReportTPMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_tax_planning/master_budget/get_report_hierarki'
,
body
)
const
getReportTPMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_tax_planning/monthly_report/get_report_hierarki'
,
body
)
const
getReportTPMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_tax_planning/monthly_report/get_report_hierarki'
,
body
)
...
@@ -603,8 +609,8 @@ const create = (type = "") => {
...
@@ -603,8 +609,8 @@ const create = (type = "") => {
getReportBSMR
,
getReportBSMR
,
getReportPLDetailMB
,
getReportPLDetailMB
,
getReportPLDetailMR
,
getReportPLDetailMR
,
getReportPLMB
,
//
getReportPLMB,
getReportPLMR
,
//
getReportPLMR,
getReportTPMB
,
getReportTPMB
,
getReportTPMR
,
getReportTPMR
,
getReportTP
,
getReportTP
,
...
@@ -622,7 +628,12 @@ const create = (type = "") => {
...
@@ -622,7 +628,12 @@ const create = (type = "") => {
getReportFRMR
,
getReportFRMR
,
getReportFRLastMR
,
getReportFRLastMR
,
getReportBSSuma
,
getReportBSSuma
,
getDashboardCAT
getDashboardCAT
,
getReportPL
,
getHierarkiCreateReportPLMB
,
getHierarkiCreateReportPLMR
,
createReportPLMB
,
createReportPLMR
}
}
}
}
...
...
src/container/BudgetTahunan.js
View file @
26dd8f51
...
@@ -522,6 +522,7 @@ export default class BudgetTahunan extends Component {
...
@@ -522,6 +522,7 @@ export default class BudgetTahunan extends Component {
this
.
historyApproval
()
this
.
historyApproval
()
this
.
getLatestPeriodSubmit
()
this
.
getLatestPeriodSubmit
()
this
.
getCashFlow
(
type
)
this
.
getCashFlow
(
type
)
this
.
getPL
(
type
)
api
.
create
().
checkApprover
().
then
(
response
=>
{
api
.
create
().
checkApprover
().
then
(
response
=>
{
// // console.log(this.state.btncreate);
// // console.log(this.state.btncreate);
// // console.log(this.state.btnedit)
// // console.log(this.state.btnedit)
...
@@ -571,7 +572,7 @@ export default class BudgetTahunan extends Component {
...
@@ -571,7 +572,7 @@ export default class BudgetTahunan extends Component {
"submission_id"
:
this
.
state
.
submissionID
"submission_id"
:
this
.
state
.
submissionID
}
}
api
.
create
().
getDetailReportCF
(
payload
).
then
(
response
=>
{
api
.
create
().
getDetailReportCF
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
//
console.log(response);
let
dataTable
=
[]
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
let
res
=
response
.
data
.
data
...
@@ -1023,7 +1024,7 @@ export default class BudgetTahunan extends Component {
...
@@ -1023,7 +1024,7 @@ export default class BudgetTahunan extends Component {
"april"
:
String
(
item
[
10
].
value
==
undefined
?
item
[
10
]
:
Number
(
item
[
10
].
value
).
toFixed
(
1
)),
"april"
:
String
(
item
[
10
].
value
==
undefined
?
item
[
10
]
:
Number
(
item
[
10
].
value
).
toFixed
(
1
)),
"may"
:
String
(
item
[
11
].
value
==
undefined
?
item
[
11
]
:
Number
(
item
[
11
].
value
).
toFixed
(
1
)),
"may"
:
String
(
item
[
11
].
value
==
undefined
?
item
[
11
]
:
Number
(
item
[
11
].
value
).
toFixed
(
1
)),
"june"
:
String
(
item
[
12
].
value
==
undefined
?
item
[
12
]
:
Number
(
item
[
12
].
value
).
toFixed
(
1
)),
"june"
:
String
(
item
[
12
].
value
==
undefined
?
item
[
12
]
:
Number
(
item
[
12
].
value
).
toFixed
(
1
)),
"july"
:
String
(
item
[
13
].
value
==
undefined
?
item
[
13
]
:
Number
(
item
[
13
].
value
.
toFixed
(
1
)
)),
"july"
:
String
(
item
[
13
].
value
==
undefined
?
item
[
13
]
:
Number
(
item
[
13
].
value
).
toFixed
(
1
)),
"august"
:
String
(
item
[
14
].
value
==
undefined
?
item
[
14
]
:
Number
(
item
[
14
].
value
).
toFixed
(
1
)),
"august"
:
String
(
item
[
14
].
value
==
undefined
?
item
[
14
]
:
Number
(
item
[
14
].
value
).
toFixed
(
1
)),
"september"
:
String
(
item
[
15
].
value
==
undefined
?
item
[
15
]
:
Number
(
item
[
15
].
value
).
toFixed
(
1
)),
"september"
:
String
(
item
[
15
].
value
==
undefined
?
item
[
15
]
:
Number
(
item
[
15
].
value
).
toFixed
(
1
)),
"october"
:
String
(
item
[
16
].
value
==
undefined
?
item
[
16
]
:
Number
(
item
[
16
].
value
).
toFixed
(
1
)),
"october"
:
String
(
item
[
16
].
value
==
undefined
?
item
[
16
]
:
Number
(
item
[
16
].
value
).
toFixed
(
1
)),
...
@@ -1088,6 +1089,484 @@ export default class BudgetTahunan extends Component {
...
@@ -1088,6 +1089,484 @@ export default class BudgetTahunan extends Component {
})
})
}
}
getPL
(
type
)
{
let
payload
=
{
"report_id"
:
6
,
"revision"
:
Number
(
this
.
state
.
lastRevision
),
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"submission_id"
:
this
.
state
.
submissionID
,
"months"
:
0
,
"quarter"
:
0
,
}
api
.
create
().
getHierarkiCreateReportPLMB
(
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
.
profit_detail
.
total_actual_before
===
null
?
"0"
:
item
.
profit_detail
.
total_actual_before
===
""
?
"0"
:
item
.
profit_detail
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
item
.
profit_detail
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
item
.
profit_detail
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
item
.
profit_detail
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
item
.
profit_detail
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
item
.
profit_detail
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
item
.
profit_detail
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
item
.
profit_detail
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
item
.
profit_detail
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
item
.
profit_detail
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
item
.
profit_detail
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
item
.
profit_detail
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
}
:
item
.
profit_detail
.
december
,
item
.
profit_detail
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_more_year
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
profit_detail
.
forecast_formula
==
null
?
[]
:
item
.
profit_detail
.
forecast_formula
])
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
.
profit_detail
.
total_actual_before
===
null
?
"0"
:
item
.
profit_detail
.
total_actual_before
===
""
?
"0"
:
item
.
profit_detail
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
item
.
profit_detail
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
item
.
profit_detail
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
item
.
profit_detail
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
item
.
profit_detail
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
item
.
profit_detail
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
item
.
profit_detail
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
item
.
profit_detail
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
item
.
profit_detail
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
item
.
profit_detail
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
item
.
profit_detail
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
item
.
profit_detail
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
}
:
item
.
profit_detail
.
december
,
item
.
profit_detail
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_more_year
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
profit_detail
.
forecast_formula
==
null
?
[]
:
item
.
profit_detail
.
forecast_formula
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
// console.log(dataTable)
this
.
setState
({
dbPL
:
dataTable
,
loading
:
false
},
()
=>
{
this
.
olahDataPL
(
this
.
state
.
dbPL
,
type
)
})
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
})
}
handleValueFormulaDBPL
=
(
indexDBCF
,
value
,
tableMeta
,
column
,
periode
,
forecast
)
=>
{
let
splitFormula
=
String
(
tableMeta
[
3
]).
split
(
/
([
()@
])
/
)
// let splitFormula = String(tableMeta.rowData[3]).split('@')
let
baru
=
[]
let
anjay
=
[]
let
dataTable2
=
this
.
state
.
dbPL
// if (forecast !== undefined) {
// console.log(tableMeta)
// }
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_
]
+$/
;
let
asd
=
''
if
(
item
!==
""
)
{
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
(
forecast
!==
undefined
)
{
let
forecastt
=
0
forecast
.
map
((
items
,
index
)
=>
{
if
(
items
.
periode
==
periode
)
{
forecastt
+=
Number
(
items
.
value
)
}
})
anjay
.
push
(
forecastt
)
}
else
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
''
)
let
data
=
column
==
7
?
18
:
column
-
1
let
period
=
data
==
18
?
Number
(
this
.
props
.
periode
)
-
1
:
this
.
props
.
periode
let
indexID
=
tableMeta
.
rowData
[
data
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
tst
}
`
)
&&
val
.
periode
==
period
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
tableMeta
.
rowData
[
data
].
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
// console.log(item)
let
indexID
=
value
.
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
)
&&
val
.
periode
==
Number
(
this
.
state
.
periode
.
periode
))
if
(
indexID
!==
-
1
)
{
let
valuezz
=
value
.
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
}
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
22
]
==
item
)
if
(
indexID
!==
-
1
)
{
// if (forecast !== undefined) {
// console.log(dataTable2[indexID])
// console.log(column)
// console.log(dataTable2[indexID][column])
// }
if
(
forecast
!=
undefined
)
{
// console.log(dataTable2[indexID][column])
}
let
valuezz
=
dataTable2
[
indexID
][
column
].
value
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value
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
{
// console.log(item.length)
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
return
total
}
handleForecastDBPL
=
(
index
,
tableMeta
,
periode
,
column
)
=>
{
let
total
=
0
let
dataTable2
=
this
.
state
.
dbPL
if
(
tableMeta
[
3
].
includes
(
'#PL'
))
{
dataTable2
[
index
][
25
].
map
((
item
,
index
)
=>
{
if
(
item
.
periode
==
periode
)
{
total
+=
Number
(
item
.
value
)
}
})
}
else
{
total
=
this
.
handleValueFormulaDBPL
(
dataTable2
[
index
][
column
],
tableMeta
,
column
,
periode
,
dataTable2
[
index
][
25
])
}
return
total
}
olahDataPL
(
dbPL
,
type
)
{
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
||
item
[
0
]
==
7
)
{
item
[
7
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
7
],
item
,
7
)
item
[
8
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
8
],
item
,
8
)
item
[
9
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
9
],
item
,
9
)
item
[
10
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
10
],
item
,
10
)
item
[
11
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
11
],
item
,
11
)
item
[
12
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
12
],
item
,
12
)
item
[
13
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
13
],
item
,
13
)
item
[
14
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
14
],
item
,
14
)
item
[
15
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
15
],
item
,
15
)
item
[
16
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
16
],
item
,
16
)
item
[
17
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
17
],
item
,
17
)
item
[
18
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
18
],
item
,
18
)
item
[
20
]
=
this
.
handleForecastDBPL
(
index
,
item
,
`
${
Number
(
this
.
state
.
periode
.
periode
)
+
1
}
`
,
20
)
item
[
21
]
=
this
.
handleForecastDBPL
(
index
,
item
,
`
${
Number
(
this
.
state
.
periode
.
periode
)
+
2
}
`
,
21
)
}
})
this
.
setState
({
dbPL
},
()
=>
{
this
.
payloadPL
(
type
)
})
}
payloadPL
(
type
)
{
let
listPL
=
[]
console
.
log
(
this
.
state
.
dbPL
)
this
.
state
.
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
||
item
[
0
]
==
7
)
{
// if (item[7].value == "" || item[7].value == 0 || item[7].value == "0.0") {
item
[
7
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
7
],
item
,
7
)
// }
// if (item[8].value == "" || item[8].value == 0 || item[8].value == "0.0") {
item
[
8
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
8
],
item
,
8
)
// }
// if (item[9].value == "" || item[9].value == 0 || item[9].value == "0.0") {
item
[
9
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
9
],
item
,
9
)
// }
// if (item[10].value == "" || item[10].value == 0 || item[10].value == "0.0") {
item
[
10
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
10
],
item
,
10
)
// }
// if (item[11].value == "" || item[11].value == 0 || item[11].value == "0.0") {
item
[
11
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
11
],
item
,
11
)
// }
// if (item[12].value == "" || item[12].value == 0 || item[12].value == "0.0") {
item
[
12
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
12
],
item
,
12
)
// }
// if (item[13].value == "" || item[13].value == 0 || item[13].value == "0.0") {
item
[
13
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
13
],
item
,
13
)
// }
// if (item[14].value == "" || item[14].value == 0 || item[14].value == "0.0") {
item
[
14
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
14
],
item
,
14
)
// }
// if (item[15].value == "" || item[15].value == 0 || item[15].value == "0.0") {
item
[
15
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
15
],
item
,
15
)
// }
// if (item[16].value == "" || item[16].value == 0 || item[16].value == "0.0") {
item
[
16
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
16
],
item
,
16
)
// }
// if (item[17].value == "" || item[17].value == 0 || item[17].value == "0.0") {
item
[
17
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
17
],
item
,
17
)
// }
// if (item[18].value == "" || item[18].value == 0 || item[18].value == "0.0") {
item
[
18
].
value
=
this
.
handleValueFormulaDBPL
(
index
,
item
[
18
],
item
,
18
)
// }
// if (item[20] == "" || item[20] == 0 || item[20] == "0.0") {
item
[
20
]
=
this
.
handleForecastDBPL
(
index
,
item
,
`
${
Number
(
this
.
state
.
periode
.
periode
)
+
1
}
`
,
20
)
// }
// if (item[21] == "" || item[21] == 0 || item[21] == "0.0") {
item
[
21
]
=
this
.
handleForecastDBPL
(
index
,
item
,
`
${
Number
(
this
.
state
.
periode
.
periode
)
+
2
}
`
,
21
)
// }
}
listPL
.
push
(
{
"item_report_id"
:
item
[
1
],
"january"
:
String
(
item
[
7
].
value
==
undefined
?
item
[
7
]
:
Number
(
item
[
7
].
value
).
toFixed
(
1
)),
"february"
:
String
(
item
[
8
].
value
==
undefined
?
item
[
8
]
:
Number
(
item
[
8
].
value
).
toFixed
(
1
)),
"march"
:
String
(
item
[
9
].
value
==
undefined
?
item
[
9
]
:
Number
(
item
[
9
].
value
).
toFixed
(
1
)),
"april"
:
String
(
item
[
10
].
value
==
undefined
?
item
[
10
]
:
Number
(
item
[
10
].
value
).
toFixed
(
1
)),
"may"
:
String
(
item
[
11
].
value
==
undefined
?
item
[
11
]
:
Number
(
item
[
11
].
value
).
toFixed
(
1
)),
"june"
:
String
(
item
[
12
].
value
==
undefined
?
item
[
12
]
:
Number
(
item
[
12
].
value
).
toFixed
(
1
)),
"july"
:
String
(
item
[
13
].
value
==
undefined
?
item
[
13
]
:
Number
(
item
[
13
].
value
).
toFixed
(
1
)),
"august"
:
String
(
item
[
14
].
value
==
undefined
?
item
[
14
]
:
Number
(
item
[
14
].
value
).
toFixed
(
1
)),
"september"
:
String
(
item
[
15
].
value
==
undefined
?
item
[
15
]
:
Number
(
item
[
15
].
value
).
toFixed
(
1
)),
"october"
:
String
(
item
[
16
].
value
==
undefined
?
item
[
16
]
:
Number
(
item
[
16
].
value
).
toFixed
(
1
)),
"november"
:
String
(
item
[
17
].
value
==
undefined
?
item
[
17
]
:
Number
(
item
[
17
].
value
).
toFixed
(
1
)),
"december"
:
String
(
item
[
18
].
value
==
undefined
?
item
[
18
]
:
Number
(
item
[
18
].
value
).
toFixed
(
1
)),
"total_current_year"
:
String
(
item
[
19
]),
"total_next_year"
:
String
(
item
[
20
]
!=
''
?
Number
(
item
[
20
]).
toFixed
(
1
)
:
item
[
20
]),
"total_more_year"
:
String
(
item
[
21
]
!=
''
?
Number
(
item
[
21
]).
toFixed
(
1
)
:
item
[
21
]),
"notes"
:
""
,
}
)
})
console
.
log
(
listPL
)
this
.
setState
({
dbPL
:
listPL
}
,
()
=>
{
// if (this.state.submissionID != null) {
// this.createDBPL()
// }
if
(
type
!=
undefined
)
{
if
(
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
this
.
createDBPL
()
}
}
})
}
createDBPL
()
{
let
payload
=
{
"submission_id"
:
this
.
state
.
submissionID
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
1
,
"status"
:
"submitted"
,
"profit_loss_mb"
:
this
.
state
.
dbPL
,
"months"
:
0
,
}
// console.log(this.state.dbCF)
console
.
log
(
JSON
.
stringify
(
payload
))
api
.
create
().
createReportPLMB
(
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
()
{
historyApproval
()
{
let
body
=
{
let
body
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"company_id"
:
this
.
state
.
company
.
company_id
,
...
...
src/container/Laporan/SubHolding.js
View file @
26dd8f51
...
@@ -621,7 +621,8 @@ export default class SubHolding extends Component {
...
@@ -621,7 +621,8 @@ export default class SubHolding extends Component {
}
}
})
})
}
else
if
(
this
.
state
.
report
.
value
===
3
)
{
}
else
if
(
this
.
state
.
report
.
value
===
3
)
{
api
.
create
().
getReportPLMB
(
payload
).
then
(
response
=>
{
let
payloads
=
{...
payload
,
months
:
this
.
state
.
month
.
month_id
,
quarter
:
0
}
api
.
create
().
getReportPL
(
payloads
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
)
{
let
dataTable
=
[]
let
dataTable
=
[]
...
@@ -635,26 +636,68 @@ export default class SubHolding extends Component {
...
@@ -635,26 +636,68 @@ export default class SubHolding extends Component {
item
.
formula
,
item
.
formula
,
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
item
.
profit_detail
.
total_actual_before
===
null
?
"0"
:
item
.
profit_detail
.
total_actual_before
===
""
?
"0"
:
item
.
profit_detail
.
total_actual_before
,
item
.
profit_loss
.
total_actual_before
===
null
?
"0"
:
item
.
profit_loss
.
total_actual_before
===
""
?
"0"
:
item
.
profit_loss
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
item
.
profit_detail
.
january
,
item
.
profit_loss
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
item
.
profit_detail
.
february
,
item
.
profit_loss
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
item
.
profit_detail
.
march
,
item
.
profit_loss
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
item
.
profit_detail
.
april
,
item
.
profit_loss
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
item
.
profit_detail
.
may
,
item
.
profit_loss
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
item
.
profit_detail
.
june
,
item
.
profit_loss
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
item
.
profit_detail
.
july
,
item
.
profit_loss
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
item
.
profit_detail
.
august
,
item
.
profit_loss
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
item
.
profit_detail
.
september
,
item
.
profit_loss
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
item
.
profit_detail
.
october
,
item
.
profit_loss
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
item
.
profit_detail
.
november
,
item
.
profit_loss
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
}
:
item
.
profit_detail
.
december
,
item
.
profit_loss
.
december
,
item
.
profit_detail
.
total_current_year
,
item
.
profit_loss
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_next_year
,
item
.
profit_loss
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_more_year
,
item
.
profit_loss
.
total_more_year
,
// item.profit_detail.total_actual_before === null ? "0" : item.profit_detail.total_actual_before === "" ? "0" : item.profit_detail.total_actual_before,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.december,
// item.profit_detail.total_current_year,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_next_year,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_more_year,
item
.
order
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
condition_if_wrong
,
item
.
profit_detail
.
forecast_formula
==
null
?
[]
:
item
.
profit_detail
.
forecast_formula
[],
""
,
item
.
profit_loss
.
monthly_january
,
item
.
profit_loss
.
monthly_february
,
item
.
profit_loss
.
monthly_march
,
item
.
profit_loss
.
monthly_april
,
item
.
profit_loss
.
monthly_may
,
item
.
profit_loss
.
monthly_june
,
item
.
profit_loss
.
monthly_july
,
item
.
profit_loss
.
monthly_august
,
item
.
profit_loss
.
monthly_september
,
item
.
profit_loss
.
monthly_october
,
item
.
profit_loss
.
monthly_november
,
item
.
profit_loss
.
monthly_december
,
item
.
profit_loss
.
monthly_last_year_january
,
item
.
profit_loss
.
monthly_last_year_february
,
item
.
profit_loss
.
monthly_last_year_march
,
item
.
profit_loss
.
monthly_last_year_april
,
item
.
profit_loss
.
monthly_last_year_may
,
item
.
profit_loss
.
monthly_last_year_june
,
item
.
profit_loss
.
monthly_last_year_july
,
item
.
profit_loss
.
monthly_last_year_august
,
item
.
profit_loss
.
monthly_last_year_september
,
item
.
profit_loss
.
monthly_last_year_october
,
item
.
profit_loss
.
monthly_last_year_november
,
item
.
profit_loss
.
monthly_last_year_december
,
item
.
profit_loss
.
notes
])
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
!==
null
)
{
...
@@ -673,26 +716,68 @@ export default class SubHolding extends Component {
...
@@ -673,26 +716,68 @@ export default class SubHolding extends Component {
item
.
formula
,
item
.
formula
,
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
item
.
profit_detail
.
total_actual_before
===
null
?
"0"
:
item
.
profit_detail
.
total_actual_before
===
""
?
"0"
:
item
.
profit_detail
.
total_actual_before
,
item
.
profit_loss
.
total_actual_before
===
null
?
"0"
:
item
.
profit_loss
.
total_actual_before
===
""
?
"0"
:
item
.
profit_loss
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
item
.
profit_detail
.
january
,
item
.
profit_loss
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
item
.
profit_detail
.
february
,
item
.
profit_loss
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
item
.
profit_detail
.
march
,
item
.
profit_loss
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
item
.
profit_detail
.
april
,
item
.
profit_loss
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
item
.
profit_detail
.
may
,
item
.
profit_loss
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
item
.
profit_detail
.
june
,
item
.
profit_loss
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
item
.
profit_detail
.
july
,
item
.
profit_loss
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
item
.
profit_detail
.
august
,
item
.
profit_loss
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
item
.
profit_detail
.
september
,
item
.
profit_loss
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
item
.
profit_detail
.
october
,
item
.
profit_loss
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
item
.
profit_detail
.
november
,
item
.
profit_loss
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
}
:
item
.
profit_detail
.
december
,
item
.
profit_loss
.
december
,
item
.
profit_detail
.
total_current_year
,
item
.
profit_loss
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_next_year
,
item
.
profit_loss
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
profit_detail
.
total_more_year
,
item
.
profit_loss
.
total_more_year
,
// item.profit_detail.total_actual_before === null ? "0" : item.profit_detail.total_actual_before === "" ? "0" : item.profit_detail.total_actual_before,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.december,
// item.profit_detail.total_current_year,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_next_year,
// item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? 0 : item.profit_detail.total_more_year,
item
.
order
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
condition_if_wrong
,
item
.
profit_detail
.
forecast_formula
==
null
?
[]
:
item
.
profit_detail
.
forecast_formula
[],
""
,
item
.
profit_loss
.
monthly_january
,
item
.
profit_loss
.
monthly_february
,
item
.
profit_loss
.
monthly_march
,
item
.
profit_loss
.
monthly_april
,
item
.
profit_loss
.
monthly_may
,
item
.
profit_loss
.
monthly_june
,
item
.
profit_loss
.
monthly_july
,
item
.
profit_loss
.
monthly_august
,
item
.
profit_loss
.
monthly_september
,
item
.
profit_loss
.
monthly_october
,
item
.
profit_loss
.
monthly_november
,
item
.
profit_loss
.
monthly_december
,
item
.
profit_loss
.
monthly_last_year_january
,
item
.
profit_loss
.
monthly_last_year_february
,
item
.
profit_loss
.
monthly_last_year_march
,
item
.
profit_loss
.
monthly_last_year_april
,
item
.
profit_loss
.
monthly_last_year_may
,
item
.
profit_loss
.
monthly_last_year_june
,
item
.
profit_loss
.
monthly_last_year_july
,
item
.
profit_loss
.
monthly_last_year_august
,
item
.
profit_loss
.
monthly_last_year_september
,
item
.
profit_loss
.
monthly_last_year_october
,
item
.
profit_loss
.
monthly_last_year_november
,
item
.
profit_loss
.
monthly_last_year_december
,
item
.
profit_loss
.
notes
])
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
if
(
item
.
children
.
length
>
0
)
{
...
@@ -702,11 +787,11 @@ export default class SubHolding extends Component {
...
@@ -702,11 +787,11 @@ export default class SubHolding extends Component {
}
}
}
}
})
})
//
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
this
.
setState
({
dataTable
},
()
=>
{
// this.setState({ dataTable , loading: false
}, () => {
console
.
log
(
this
.
state
.
dataTable
)
console
.
log
(
this
.
state
.
dataTable
)
this
.
getReportPLMR
(
payload
)
//
this.getReportPLMR(payload)
})
//
})
}
else
{
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
}
}
...
...
src/container/MonthlyReport.js
View file @
26dd8f51
...
@@ -21,6 +21,7 @@ import CorporateAnnualTargetMR from './MonthlyReport/CorporateAnnualTargetMR';
...
@@ -21,6 +21,7 @@ import CorporateAnnualTargetMR from './MonthlyReport/CorporateAnnualTargetMR';
import
CashFlowMR
from
'./MonthlyReport/CashFlowMR'
;
import
CashFlowMR
from
'./MonthlyReport/CashFlowMR'
;
import
{
DatePicker
}
from
'@material-ui/pickers'
;
import
{
DatePicker
}
from
'@material-ui/pickers'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
*
as
R
from
'ramda'
var
ct
=
require
(
"../library/CustomTable"
);
var
ct
=
require
(
"../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable
());
...
@@ -609,6 +610,7 @@ export default class MonthlyReport extends Component {
...
@@ -609,6 +610,7 @@ export default class MonthlyReport extends Component {
this
.
historyApproval
()
this
.
historyApproval
()
this
.
getLatestPeriodSubmit
()
this
.
getLatestPeriodSubmit
()
this
.
getCashFlow
(
type
)
this
.
getCashFlow
(
type
)
this
.
getPL
(
type
)
// this.getReport()
// this.getReport()
// this.getReportAttachment()
// this.getReportAttachment()
api
.
create
().
checkApproverMonthly
().
then
(
response
=>
{
api
.
create
().
checkApproverMonthly
().
then
(
response
=>
{
...
@@ -1316,7 +1318,7 @@ export default class MonthlyReport extends Component {
...
@@ -1316,7 +1318,7 @@ export default class MonthlyReport extends Component {
item
[
6
].
value
=
this
.
handleValueFormula
(
item
,
index
)
item
[
6
].
value
=
this
.
handleValueFormula
(
item
,
index
)
}
}
})
})
//
console.log(dbCF)
console
.
log
(
dbCF
)
this
.
setState
({
dbCF
},
()
=>
{
this
.
setState
({
dbCF
},
()
=>
{
this
.
payloadCF
(
type
)
this
.
payloadCF
(
type
)
})
})
...
@@ -1380,6 +1382,409 @@ export default class MonthlyReport extends Component {
...
@@ -1380,6 +1382,409 @@ export default class MonthlyReport extends Component {
})
})
}
}
getPL
(
type
)
{
let
payload
=
{
"revision"
:
Number
(
this
.
state
.
lastRevision
),
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"months"
:
this
.
state
.
month
.
month_id
,
"quarter"
:
0
,
"report_id"
:
1
,
"submission_id"
:
0
}
api
.
create
().
getHierarkiCreateReportPLMR
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
let
dataTable
=
[]
let
err
=
false
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
,
this
.
state
.
month
.
month_id
==
1
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
this
.
state
.
month
.
month_id
==
2
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
this
.
state
.
month
.
month_id
==
3
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
this
.
state
.
month
.
month_id
==
4
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
this
.
state
.
month
.
month_id
==
5
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
this
.
state
.
month
.
month_id
==
6
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
this
.
state
.
month
.
month_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
this
.
state
.
month
.
month_id
==
8
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
this
.
state
.
month
.
month_id
==
9
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
this
.
state
.
month
.
month_id
==
10
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
this
.
state
.
month
.
month_id
==
11
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
},
item
.
order
,
])
}
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
,
this
.
state
.
month
.
month_id
==
1
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
this
.
state
.
month
.
month_id
==
2
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
this
.
state
.
month
.
month_id
==
3
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
this
.
state
.
month
.
month_id
==
4
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
this
.
state
.
month
.
month_id
==
5
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
this
.
state
.
month
.
month_id
==
6
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
this
.
state
.
month
.
month_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
this
.
state
.
month
.
month_id
==
8
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
this
.
state
.
month
.
month_id
==
9
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
this
.
state
.
month
.
month_id
==
10
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
this
.
state
.
month
.
month_id
==
11
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
},
item
.
order
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
console
.
log
(
dataTable
)
this
.
setState
({
dbPL
:
dataTable
},
()
=>
{
this
.
olahDataPL
(
this
.
state
.
dbPL
,
type
)
})
}
else
{
this
.
setState
({
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
saveDraft
:
true
,
refresh
:
false
})
}
console
.
log
(
dataTable
);
})
}
handleValueFormulaDBPLMR
=
(
value
,
tableMeta
,
column
,
periode
,
forecast
)
=>
{
let
splitFormula
=
String
(
tableMeta
[
3
]).
split
(
/
([
()@
])
/
)
// let splitFormula = String(tableMeta.rowData[3]).split('@')
let
baru
=
[]
let
anjay
=
[]
// let colIndex = tableMeta.columnIndex + column
let
dataTable2
=
this
.
state
.
dbPL
// if (forecast !== undefined) {
// console.log(tableMeta)
// }
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_
]
+$/
;
let
asd
=
''
if
(
item
!==
""
)
{
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
(
forecast
!==
undefined
)
{
let
forecastt
=
0
forecast
.
map
((
items
,
index
)
=>
{
if
(
items
.
periode
==
periode
)
{
forecastt
+=
Number
(
items
.
value
)
}
})
anjay
.
push
(
forecastt
)
}
else
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
// let tst = String(item).replace('[M-1]', '')
// let data = column == 7 ? 18 : column - 1
// let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
// let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// if (indexID !== -1) {
// let valuezz = tableMeta.rowData[data].formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
}
else
{
// console.log(item)
// console.log(value.formula)
let
indexID
=
value
.
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
)
&&
val
.
periode
==
Number
(
this
.
state
.
periode
.
periode
))
if
(
indexID
!==
-
1
)
{
let
valuezz
=
value
.
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
}
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
22
]
==
item
)
if
(
indexID
!==
-
1
)
{
// if (forecast !== undefined) {
// console.log(dataTable2[indexID])
// console.log(column)
// console.log(dataTable2[indexID][column])
// }
if
(
forecast
!=
undefined
)
{
// console.log(dataTable2[indexID][column])
}
let
valuezz
=
dataTable2
[
indexID
][
column
].
value
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value
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
)
}
}
})
// if (tableMeta.rowData[5] == "1.0 Cash inflow/ (outflow) from Operating Activities") {
// console.log(anjay2)
// }
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
{
// console.log(item.length)
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
return
total
}
olahDataPL
(
dbPL
,
type
)
{
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
)
{
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
}
})
// console.log(dbPL)
this
.
setState
({
dbPL
},
()
=>
{
this
.
payloadPL
(
type
)
})
}
payloadPL
(
type
)
{
let
listPL
=
[]
this
.
state
.
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
6
].
value
==
""
||
item
[
6
].
value
==
0
||
item
[
6
].
value
==
"0.0"
)
{
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
listPL
.
push
({
"item_report_id"
:
item
[
1
],
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
)
})
}
else
{
listPL
.
push
({
"item_report_id"
:
item
[
1
],
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
)
})
}
})
console
.
log
(
listPL
)
this
.
setState
({
dbPL
:
listPL
}
,
()
=>
{
if
(
type
!=
undefined
)
{
if
(
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
this
.
createPL
()
}
}
})
}
createPL
()
{
let
payload
=
{
"monthly_report_id"
:
this
.
state
.
monthlyReportId
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
1
,
"status"
:
"submitted"
,
"months"
:
this
.
state
.
month
.
month_id
,
"quarter"
:
0
,
"profit_loss_mr"
:
this
.
state
.
dbPL
}
api
.
create
().
createReportPLMR
(
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
()
{
render
()
{
const
columns
=
[
"#"
,
"Report Type"
,
const
columns
=
[
"#"
,
"Report Type"
,
{
{
...
...
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
26dd8f51
...
@@ -748,6 +748,13 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -748,6 +748,13 @@ export default class CorporateAnnualTargetMR extends Component {
let
totalWeightz
=
Number
(
totalWeight
)
/
100
let
totalWeightz
=
Number
(
totalWeight
)
/
100
let
totalz
=
Number
(
Number
(
total
).
toFixed
(
2
)
/
Number
(
totalWeightz
)).
toFixed
(
2
)
let
totalz
=
Number
(
Number
(
total
).
toFixed
(
2
)
/
Number
(
totalWeightz
)).
toFixed
(
2
)
let
lastTotal
=
R
.
equals
(
totalz
,
NaN
)
?
0.0
:
totalz
let
lastTotal
=
R
.
equals
(
totalz
,
NaN
)
?
0.0
:
totalz
if
(
R
.
equals
(
totalz
,
NaN
)
||
R
.
equals
(
totalz
,
"NaN"
))
{
lastTotal
=
0.0
}
else
{
lastTotal
=
totalz
}
// console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
// console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
if
(
lastTotal
>=
1.00
&&
lastTotal
<=
2.00
)
{
if
(
lastTotal
>=
1.00
&&
lastTotal
<=
2.00
)
{
perfomanceScore
=
'K'
perfomanceScore
=
'K'
...
...
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