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
4db09279
Commit
4db09279
authored
Dec 22, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+++
parent
18f19d7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
65 deletions
+83
-65
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+83
-65
No files found.
src/container/MonthlyReport/ProfitLossMR.js
View file @
4db09279
...
@@ -180,11 +180,68 @@ export default class ProfitLossMR extends Component {
...
@@ -180,11 +180,68 @@ export default class ProfitLossMR extends Component {
api
.
create
().
getHierarkiMontlyReportPL
(
payload
).
then
(
response
=>
{
api
.
create
().
getHierarkiMontlyReportPL
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
let
dataTable
=
[]
let
dataTable
=
[]
let
err
=
false
if
(
response
.
data
)
{
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
if
(
response
.
data
.
status
===
'success'
)
{
const
handlePushChild
=
(
item
)
=>
{
let
res
=
response
.
data
.
data
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
const
handlePushChild
=
(
item
)
=>
{
if
(
indexIDzz
===
-
1
)
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
item
.
profit_loss
.
mtd_vs_previous_month
==
""
&&
Number
(
item
.
profit_loss
.
percent_act_vs_previous_month
)
<
this
.
state
.
minValue
||
Number
(
item
.
profit_loss
.
percent_act_vs_previous_month
)
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
item
.
profit_loss
.
mtd_vs_mb
==
""
&&
Number
(
item
.
profit_loss
.
percent_act_vs_mb
)
<
this
.
state
.
minValue
||
Number
(
item
.
profit_loss
.
percent_act_vs_mb
)
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
item
.
profit_loss
.
mtd_vs_rb
==
""
&&
Number
(
item
.
profit_loss
.
percent_act_vs_rb
)
<
this
.
state
.
minValue
||
Number
(
item
.
profit_loss
.
percent_act_vs_rb
)
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
profit_loss
.
notes
===
""
?
null
:
item
.
profit_loss
.
notes
,
item
.
profit_loss
.
rolling_outlook
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
===
"0"
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
,
item
.
profit_loss
.
master_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
master_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
master_budget
,
item
.
profit_loss
.
rolling_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
,
item
.
profit_loss
.
actual
===
null
?
"0.0"
:
item
.
profit_loss
.
actual
===
""
?
"0.0"
:
item
.
profit_loss
.
actual
,
0
,
item
.
profit_loss
.
actual_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
actual_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
actual_previous_month
,
item
.
profit_loss
.
amount_act_vs_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_previous_month
,
item
.
profit_loss
.
percent_act_vs_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_previous_month
,
item
.
profit_loss
.
amount_act_vs_mb
===
null
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_mb
===
""
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_mb
,
item
.
profit_loss
.
percent_act_vs_mb
===
null
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_mb
===
""
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_mb
,
item
.
profit_loss
.
amount_act_vs_rb
===
null
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_rb
===
""
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_rb
,
item
.
profit_loss
.
percent_act_vs_rb
===
null
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_rb
===
""
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_rb
,
item
.
profit_loss
.
mtd_vs_previous_month
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_previous_month
,
item
.
profit_loss
.
mtd_vs_mb
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_mb
,
item
.
profit_loss
.
mtd_vs_rb
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_rb
,
item
.
order
,
item
.
profit_loss
.
ytd_actual
===
null
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
===
""
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
,
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
if
(
item
.
profit_loss
.
mtd_vs_previous_month
==
""
&&
Number
(
item
.
profit_loss
.
percent_act_vs_previous_month
)
<
this
.
state
.
minValue
||
Number
(
item
.
profit_loss
.
percent_act_vs_previous_month
)
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
item
.
profit_loss
.
mtd_vs_mb
==
""
&&
Number
(
item
.
profit_loss
.
percent_act_vs_mb
)
<
this
.
state
.
minValue
||
Number
(
item
.
profit_loss
.
percent_act_vs_mb
)
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
item
.
profit_loss
.
mtd_vs_rb
==
""
&&
Number
(
item
.
profit_loss
.
percent_act_vs_rb
)
<
this
.
state
.
minValue
||
Number
(
item
.
profit_loss
.
percent_act_vs_rb
)
>
this
.
state
.
maxValue
)
{
err
=
true
}
dataTable
.
push
([
dataTable
.
push
([
item
.
type_report_id
,
item
.
type_report_id
,
item
.
id
,
item
.
id
,
...
@@ -193,7 +250,7 @@ export default class ProfitLossMR extends Component {
...
@@ -193,7 +250,7 @@ export default class ProfitLossMR extends Component {
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
item
.
profit_loss
.
notes
===
""
?
null
:
item
.
profit_loss
.
notes
,
item
.
profit_loss
.
notes
===
""
?
null
:
item
.
profit_loss
.
notes
,
item
.
profit_loss
.
rolling_outlook
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
===
"0"
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
,
item
.
profit_loss
.
rolling_outlook
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
,
item
.
profit_loss
.
master_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
master_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
master_budget
,
item
.
profit_loss
.
master_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
master_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
master_budget
,
item
.
profit_loss
.
rolling_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
,
item
.
profit_loss
.
rolling_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
,
item
.
profit_loss
.
actual
===
null
?
"0.0"
:
item
.
profit_loss
.
actual
===
""
?
"0.0"
:
item
.
profit_loss
.
actual
,
item
.
profit_loss
.
actual
===
null
?
"0.0"
:
item
.
profit_loss
.
actual
===
""
?
"0.0"
:
item
.
profit_loss
.
actual
,
...
@@ -211,71 +268,32 @@ export default class ProfitLossMR extends Component {
...
@@ -211,71 +268,32 @@ export default class ProfitLossMR extends Component {
item
.
order
,
item
.
order
,
item
.
profit_loss
.
ytd_actual
===
null
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
===
""
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
,
item
.
profit_loss
.
ytd_actual
===
null
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
===
""
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
,
])
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
handlePushChild
(
items
)
}
)
}
)
}
}
}
})
if
(
err
===
true
)
{
this
.
setState
({
bebas
:
true
})
}
}
}
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
saveDraft
:
true
})
res
.
map
((
item
,
index
)
=>
{
}
else
{
dataTable
.
push
([
this
.
setState
({
loading
:
false
,
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
item
.
type_report_id
,
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
item
.
id
,
setTimeout
(()
=>
{
item
.
parent
,
localStorage
.
removeItem
(
Constant
.
TOKEN
)
item
.
formula
,
window
.
location
.
reload
();
item
.
level
,
},
1000
);
item
.
description
,
item
.
profit_loss
.
notes
===
""
?
null
:
item
.
profit_loss
.
notes
,
item
.
profit_loss
.
rolling_outlook
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_outlook
,
item
.
profit_loss
.
master_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
master_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
master_budget
,
item
.
profit_loss
.
rolling_budget
===
null
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
===
""
?
"0.0"
:
item
.
profit_loss
.
rolling_budget
,
item
.
profit_loss
.
actual
===
null
?
"0.0"
:
item
.
profit_loss
.
actual
===
""
?
"0.0"
:
item
.
profit_loss
.
actual
,
0
,
item
.
profit_loss
.
actual_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
actual_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
actual_previous_month
,
item
.
profit_loss
.
amount_act_vs_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_previous_month
,
item
.
profit_loss
.
percent_act_vs_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_previous_month
,
item
.
profit_loss
.
amount_act_vs_mb
===
null
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_mb
===
""
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_mb
,
item
.
profit_loss
.
percent_act_vs_mb
===
null
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_mb
===
""
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_mb
,
item
.
profit_loss
.
amount_act_vs_rb
===
null
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_rb
===
""
?
"0.0"
:
item
.
profit_loss
.
amount_act_vs_rb
,
item
.
profit_loss
.
percent_act_vs_rb
===
null
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_rb
===
""
?
"0.0"
:
item
.
profit_loss
.
percent_act_vs_rb
,
item
.
profit_loss
.
mtd_vs_previous_month
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_previous_month
,
item
.
profit_loss
.
mtd_vs_mb
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_mb
,
item
.
profit_loss
.
mtd_vs_rb
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_rb
,
item
.
order
,
item
.
profit_loss
.
ytd_actual
===
null
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
===
""
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
})
})
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
saveDraft
:
true
,
bebas
:
true
})
}
console
.
log
(
dataTable
);
let
err
=
false
dataTable
.
map
((
item
,
index
)
=>
{
if
(
item
[
19
]
==
""
&&
Number
(
item
[
14
])
<
this
.
state
.
minValue
||
Number
(
item
[
14
])
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
item
[
20
]
==
""
&&
Number
(
item
[
16
])
<
this
.
state
.
minValue
||
Number
(
item
[
16
])
>
this
.
state
.
maxValue
)
{
err
=
true
}
if
(
item
[
21
]
==
""
&&
Number
(
item
[
18
])
<
this
.
state
.
minValue
||
Number
(
item
[
18
])
>
this
.
state
.
maxValue
)
{
err
=
true
}
}
})
}
else
{
if
(
err
===
true
)
{
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
saveDraft
:
true
})
this
.
setState
({
bebas
:
true
})
}
}
console
.
log
(
dataTable
);
})
})
}
}
...
...
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