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
c32d3821
Commit
c32d3821
authored
Jan 25, 2021
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riri
parent
4e51ea15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
189 additions
and
85 deletions
+189
-85
index.js
src/api/index.js
+5
-1
SubHolding.js
src/container/Laporan/SubHolding.js
+184
-84
No files found.
src/api/index.js
View file @
c32d3821
...
...
@@ -244,6 +244,8 @@ const create = (type = "") => {
const
getReportTPMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_tax_planning/monthly_report/get_report_hierarki'
,
body
)
const
getReportOIMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_operating_indicator/master_budget/get_report_hierarki'
,
body
)
const
getReportOIMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_operating_indicator/monthly_report/get_report_hierarki'
,
body
)
const
getReportCFSumaMB
=
(
body
)
=>
api
.
post
(
'/transaction/db_cash_flow/master_budget/get_report_hierarki'
,
body
)
const
getReportCFSumaMR
=
(
body
)
=>
api
.
post
(
'/transaction/db_cash_flow/monthly_report/get_report_hierarki'
,
body
)
//CASH FLOW
const
getDetailReportCF
=
(
body
)
=>
api
.
post
(
'/transaction/cash_flow/master_budget/get_report_hierarki'
,
body
)
...
...
@@ -594,7 +596,9 @@ const create = (type = "") => {
getReportTPMB
,
getReportTPMR
,
getReportOIMB
,
getReportOIMR
getReportOIMR
,
getReportCFSumaMB
,
getReportCFSumaMR
}
}
...
...
src/container/Laporan/SubHolding.js
View file @
c32d3821
...
...
@@ -31,12 +31,13 @@ export default class SubHolding extends Component {
{
value
:
1
,
label
:
'DB Profit & Loss Detail'
},
{
value
:
4
,
label
:
'DB Ratio'
},
{
value
:
5
,
label
:
'DB Tax Planning'
},
{
value
:
7
,
label
:
'DB Cash FLow'
},
{
value
:
21
,
label
:
'DB Operating Indicator'
},
{
value
:
7
,
label
:
'DB Cash FLow - Summary'
},
],
report
:
null
,
loading
:
false
,
previewTable
:
false
previewTable
:
false
,
OPID
:
null
}
}
...
...
@@ -777,97 +778,196 @@ export default class SubHolding extends Component {
}
else
{
OPID
=
null
}
this
.
setState
({
OPID
},
()
=>
{
let
payloadOI
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"operating_indicator_id"
:
this
.
state
.
OPID
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
21
}
api
.
create
().
getReportOIMB
(
payloadOI
).
then
(
response
=>
{
// console.log(payload);
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
res
=
response
.
data
.
data
// // // console.log(res)
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
.
master_budget
.
total_actual_before
==
""
?
item
.
master_budget
.
total_actual_before
:
String
(
item
.
master_budget
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_actual_before
)
:
Number
(
item
.
master_budget
.
total_actual_before
).
toFixed
(
1
),
item
.
master_budget
.
january
==
""
?
item
.
master_budget
.
january
:
String
(
item
.
master_budget
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
january
)
:
Number
(
item
.
master_budget
.
january
).
toFixed
(
1
),
item
.
master_budget
.
february
==
""
?
item
.
master_budget
.
february
:
String
(
item
.
master_budget
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
february
)
:
Number
(
item
.
master_budget
.
february
).
toFixed
(
1
),
item
.
master_budget
.
march
==
""
?
item
.
master_budget
.
march
:
String
(
item
.
master_budget
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
march
)
:
Number
(
item
.
master_budget
.
march
).
toFixed
(
1
),
item
.
master_budget
.
april
==
""
?
item
.
master_budget
.
april
:
String
(
item
.
master_budget
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
april
)
:
Number
(
item
.
master_budget
.
april
).
toFixed
(
1
),
item
.
master_budget
.
may
==
""
?
item
.
master_budget
.
may
:
String
(
item
.
master_budget
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
may
)
:
Number
(
item
.
master_budget
.
may
).
toFixed
(
1
),
item
.
master_budget
.
june
==
""
?
item
.
master_budget
.
june
:
String
(
item
.
master_budget
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
june
)
:
Number
(
item
.
master_budget
.
june
).
toFixed
(
1
),
item
.
master_budget
.
july
==
""
?
item
.
master_budget
.
july
:
String
(
item
.
master_budget
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
july
)
:
Number
(
item
.
master_budget
.
july
).
toFixed
(
1
),
item
.
master_budget
.
august
==
""
?
item
.
master_budget
.
august
:
String
(
item
.
master_budget
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
august
)
:
Number
(
item
.
master_budget
.
august
).
toFixed
(
1
),
item
.
master_budget
.
september
==
""
?
item
.
master_budget
.
september
:
String
(
item
.
master_budget
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
september
)
:
Number
(
item
.
master_budget
.
september
).
toFixed
(
1
),
item
.
master_budget
.
october
==
""
?
item
.
master_budget
.
october
:
String
(
item
.
master_budget
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
october
)
:
Number
(
item
.
master_budget
.
october
).
toFixed
(
1
),
item
.
master_budget
.
november
==
""
?
item
.
master_budget
.
november
:
String
(
item
.
master_budget
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
november
)
:
Number
(
item
.
master_budget
.
november
).
toFixed
(
1
),
item
.
master_budget
.
december
==
""
?
item
.
master_budget
.
december
:
String
(
item
.
master_budget
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
december
)
:
Number
(
item
.
master_budget
.
december
).
toFixed
(
1
),
item
.
master_budget
.
total_current_year
==
""
?
item
.
master_budget
.
total_current_year
:
String
(
item
.
master_budget
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_current_year
)
:
Number
(
item
.
master_budget
.
total_current_year
).
toFixed
(
1
),
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
,
item
.
uom
,
item
.
master_budget
.
total_actual_before
==
""
?
item
.
master_budget
.
total_actual_before
:
String
(
item
.
master_budget
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_actual_before
)
:
Number
(
item
.
master_budget
.
total_actual_before
).
toFixed
(
1
),
item
.
master_budget
.
january
==
""
?
item
.
master_budget
.
january
:
String
(
item
.
master_budget
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
january
)
:
Number
(
item
.
master_budget
.
january
).
toFixed
(
1
),
item
.
master_budget
.
february
==
""
?
item
.
master_budget
.
february
:
String
(
item
.
master_budget
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
february
)
:
Number
(
item
.
master_budget
.
february
).
toFixed
(
1
),
item
.
master_budget
.
march
==
""
?
item
.
master_budget
.
march
:
String
(
item
.
master_budget
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
march
)
:
Number
(
item
.
master_budget
.
march
).
toFixed
(
1
),
item
.
master_budget
.
april
==
""
?
item
.
master_budget
.
april
:
String
(
item
.
master_budget
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
april
)
:
Number
(
item
.
master_budget
.
april
).
toFixed
(
1
),
item
.
master_budget
.
may
==
""
?
item
.
master_budget
.
may
:
String
(
item
.
master_budget
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
may
)
:
Number
(
item
.
master_budget
.
may
).
toFixed
(
1
),
item
.
master_budget
.
june
==
""
?
item
.
master_budget
.
june
:
String
(
item
.
master_budget
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
june
)
:
Number
(
item
.
master_budget
.
june
).
toFixed
(
1
),
item
.
master_budget
.
july
==
""
?
item
.
master_budget
.
july
:
String
(
item
.
master_budget
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
july
)
:
Number
(
item
.
master_budget
.
july
).
toFixed
(
1
),
item
.
master_budget
.
august
==
""
?
item
.
master_budget
.
august
:
String
(
item
.
master_budget
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
august
)
:
Number
(
item
.
master_budget
.
august
).
toFixed
(
1
),
item
.
master_budget
.
september
==
""
?
item
.
master_budget
.
september
:
String
(
item
.
master_budget
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
september
)
:
Number
(
item
.
master_budget
.
september
).
toFixed
(
1
),
item
.
master_budget
.
october
==
""
?
item
.
master_budget
.
october
:
String
(
item
.
master_budget
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
october
)
:
Number
(
item
.
master_budget
.
october
).
toFixed
(
1
),
item
.
master_budget
.
november
==
""
?
item
.
master_budget
.
november
:
String
(
item
.
master_budget
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
november
)
:
Number
(
item
.
master_budget
.
november
).
toFixed
(
1
),
item
.
master_budget
.
december
==
""
?
item
.
master_budget
.
december
:
String
(
item
.
master_budget
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
december
)
:
Number
(
item
.
master_budget
.
december
).
toFixed
(
1
),
item
.
master_budget
.
total_current_year
==
""
?
item
.
master_budget
.
total_current_year
:
String
(
item
.
master_budget
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_current_year
)
:
Number
(
item
.
master_budget
.
total_current_year
).
toFixed
(
1
),
item
.
order
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
this
.
setState
({
dataTable
},
()
=>
{
console
.
log
(
this
.
state
.
dataTable
)
this
.
getOIMR
(
payloadOI
)
})
}
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
})
}
})
})
}
})
let
payloadOI
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"operating_indicator_id"
:
OPID
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
21
}
api
.
create
().
getReportOIMB
(
payloadOI
).
then
(
response
=>
{
}
else
if
(
this
.
state
.
report
.
value
===
7
)
{
api
.
create
().
getReportCFSumaMB
(
payload
).
then
(
response
=>
{
// console.log(payload);
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
res
=
response
.
data
.
data
// // //
console.log(res)
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
.
master_budget
.
total_actual_before
==
""
?
item
.
master_budget
.
total_actual_before
:
String
(
item
.
master_budget
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_actual_before
)
:
Number
(
item
.
master_budget
.
total_actual_before
).
toFixed
(
1
),
item
.
master_budget
.
january
==
""
?
item
.
master_budget
.
january
:
String
(
item
.
master_budget
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
january
)
:
Number
(
item
.
master_budget
.
january
).
toFixed
(
1
),
item
.
master_budget
.
february
==
""
?
item
.
master_budget
.
february
:
String
(
item
.
master_budget
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
february
)
:
Number
(
item
.
master_budget
.
february
).
toFixed
(
1
),
item
.
master_budget
.
march
==
""
?
item
.
master_budget
.
march
:
String
(
item
.
master_budget
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
march
)
:
Number
(
item
.
master_budget
.
march
).
toFixed
(
1
),
item
.
master_budget
.
april
==
""
?
item
.
master_budget
.
april
:
String
(
item
.
master_budget
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
april
)
:
Number
(
item
.
master_budget
.
april
).
toFixed
(
1
),
item
.
master_budget
.
may
==
""
?
item
.
master_budget
.
may
:
String
(
item
.
master_budget
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
may
)
:
Number
(
item
.
master_budget
.
may
).
toFixed
(
1
),
item
.
master_budget
.
june
==
""
?
item
.
master_budget
.
june
:
String
(
item
.
master_budget
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
june
)
:
Number
(
item
.
master_budget
.
june
).
toFixed
(
1
),
item
.
master_budget
.
july
==
""
?
item
.
master_budget
.
july
:
String
(
item
.
master_budget
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
july
)
:
Number
(
item
.
master_budget
.
july
).
toFixed
(
1
),
item
.
master_budget
.
august
==
""
?
item
.
master_budget
.
august
:
String
(
item
.
master_budget
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
august
)
:
Number
(
item
.
master_budget
.
august
).
toFixed
(
1
),
item
.
master_budget
.
september
==
""
?
item
.
master_budget
.
september
:
String
(
item
.
master_budget
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
september
)
:
Number
(
item
.
master_budget
.
september
).
toFixed
(
1
),
item
.
master_budget
.
october
==
""
?
item
.
master_budget
.
october
:
String
(
item
.
master_budget
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
october
)
:
Number
(
item
.
master_budget
.
october
).
toFixed
(
1
),
item
.
master_budget
.
november
==
""
?
item
.
master_budget
.
november
:
String
(
item
.
master_budget
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
november
)
:
Number
(
item
.
master_budget
.
november
).
toFixed
(
1
),
item
.
master_budget
.
december
==
""
?
item
.
master_budget
.
december
:
String
(
item
.
master_budget
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
december
)
:
Number
(
item
.
master_budget
.
december
).
toFixed
(
1
),
item
.
master_budget
.
total_current_year
==
""
?
item
.
master_budget
.
total_current_year
:
String
(
item
.
master_budget
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_current_year
)
:
Number
(
item
.
master_budget
.
total_current_year
).
toFixed
(
1
),
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
,
item
.
uom
,
item
.
master_budget
.
total_actual_before
==
""
?
item
.
master_budget
.
total_actual_before
:
String
(
item
.
master_budget
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_actual_before
)
:
Number
(
item
.
master_budget
.
total_actual_before
).
toFixed
(
1
),
item
.
master_budget
.
january
==
""
?
item
.
master_budget
.
january
:
String
(
item
.
master_budget
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
january
)
:
Number
(
item
.
master_budget
.
january
).
toFixed
(
1
),
item
.
master_budget
.
february
==
""
?
item
.
master_budget
.
february
:
String
(
item
.
master_budget
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
february
)
:
Number
(
item
.
master_budget
.
february
).
toFixed
(
1
),
item
.
master_budget
.
march
==
""
?
item
.
master_budget
.
march
:
String
(
item
.
master_budget
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
march
)
:
Number
(
item
.
master_budget
.
march
).
toFixed
(
1
),
item
.
master_budget
.
april
==
""
?
item
.
master_budget
.
april
:
String
(
item
.
master_budget
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
april
)
:
Number
(
item
.
master_budget
.
april
).
toFixed
(
1
),
item
.
master_budget
.
may
==
""
?
item
.
master_budget
.
may
:
String
(
item
.
master_budget
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
may
)
:
Number
(
item
.
master_budget
.
may
).
toFixed
(
1
),
item
.
master_budget
.
june
==
""
?
item
.
master_budget
.
june
:
String
(
item
.
master_budget
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
june
)
:
Number
(
item
.
master_budget
.
june
).
toFixed
(
1
),
item
.
master_budget
.
july
==
""
?
item
.
master_budget
.
july
:
String
(
item
.
master_budget
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
july
)
:
Number
(
item
.
master_budget
.
july
).
toFixed
(
1
),
item
.
master_budget
.
august
==
""
?
item
.
master_budget
.
august
:
String
(
item
.
master_budget
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
august
)
:
Number
(
item
.
master_budget
.
august
).
toFixed
(
1
),
item
.
master_budget
.
september
==
""
?
item
.
master_budget
.
september
:
String
(
item
.
master_budget
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
september
)
:
Number
(
item
.
master_budget
.
september
).
toFixed
(
1
),
item
.
master_budget
.
october
==
""
?
item
.
master_budget
.
october
:
String
(
item
.
master_budget
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
october
)
:
Number
(
item
.
master_budget
.
october
).
toFixed
(
1
),
item
.
master_budget
.
november
==
""
?
item
.
master_budget
.
november
:
String
(
item
.
master_budget
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
november
)
:
Number
(
item
.
master_budget
.
november
).
toFixed
(
1
),
item
.
master_budget
.
december
==
""
?
item
.
master_budget
.
december
:
String
(
item
.
master_budget
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
december
)
:
Number
(
item
.
master_budget
.
december
).
toFixed
(
1
),
item
.
master_budget
.
total_current_year
==
""
?
item
.
master_budget
.
total_current_year
:
String
(
item
.
master_budget
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
master_budget
.
total_current_year
)
:
Number
(
item
.
master_budget
.
total_current_year
).
toFixed
(
1
),
item
.
order
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
this
.
setState
({
dataTable
},
()
=>
{
console
.
log
(
this
.
state
.
dataTable
)
this
.
getOIMR
(
payloadOI
)
})
console
.
log
(
res
)
//
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.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
//
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
//
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
//
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
//
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
//
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
//
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
//
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
//
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
//
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
//
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
//
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
//
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
//
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
//
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,
//
item.uom,
//
item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
//
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
//
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
//
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
//
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
//
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
//
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
//
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
//
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
//
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
//
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
//
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
//
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
//
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
//
item.order
//
])
//
if (item.children !== null) {
//
if (item.children.length > 0) {
//
item.children.map((items, indexs) => {
//
handlePushChild(items)
//
})
//
}
//
}
//
})
//
this.setState({ dataTable }, () => {
//
console.log(this.state.dataTable)
//
this.getOIMR(payloadOI)
//
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
...
...
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