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
c89e2dc0
Commit
c89e2dc0
authored
Jan 26, 2021
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sumpl
parent
987539a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
88 deletions
+110
-88
SubHolding.js
src/container/Laporan/SubHolding.js
+110
-88
No files found.
src/container/Laporan/SubHolding.js
View file @
c89e2dc0
...
@@ -1267,96 +1267,118 @@ export default class SubHolding extends Component {
...
@@ -1267,96 +1267,118 @@ export default class SubHolding extends Component {
})
})
}
else
if
(
this
.
state
.
report
.
value
===
8
)
{
}
else
if
(
this
.
state
.
report
.
value
===
8
)
{
api
.
create
().
getReportPLSuma
(
payload
).
then
(
response
=>
{
let
dbSumaPL
=
[]
let
payloadPL
=
{...
payload
,
months
:
this
.
state
.
month
.
month_id
}
api
.
create
().
getReportPLSuma
(
payloadPL
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
// if (response.data) {
if
(
response
.
data
)
{
// let dataTable = []
if
(
response
.
data
.
status
===
'success'
)
{
// console.log(response)
let
res
=
response
.
data
.
data
// let res = response.data.data
console
.
log
(
res
)
// const handlePushChild = (item) => {
const
handlePushChild
=
(
item
)
=>
{
// dataTable.push([
let
indexIDzz
=
dbSumaPL
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
// item.type_report_id,
if
(
indexIDzz
===
-
1
)
{
// item.id,
let
mtd_actual
=
item
.
profit_loss
.
mtd_actual
==
''
?
0
:
item
.
profit_loss
.
mtd_actual
// item.parent,
let
mtd
=
item
.
profit_loss
.
mtd
==
''
?
0
:
item
.
profit_loss
.
mtd
// item.formula,
let
persenMtd
=
Number
(
mtd_actual
/
mtd
)
// 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) {
let
ytd_actual
=
item
.
profit_loss
.
ytd_actual
==
''
?
0
:
item
.
profit_loss
.
ytd_actual
// if (item.children.length > 0) {
let
ytd
=
item
.
profit_loss
.
ytd
==
''
?
0
:
item
.
profit_loss
.
ytd
// item.children.map((items, indexs) => {
let
persenYtd
=
Number
(
ytd_actual
/
ytd
)
// handlePushChild(items)
// })
let
quarter_actual
=
item
.
profit_loss
.
quarter_actual
==
''
?
0
:
item
.
profit_loss
.
quarter_actual
// }
let
quarter
=
item
.
profit_loss
.
quarter
==
''
?
0
:
item
.
profit_loss
.
quarter
// }
let
persenQuarter
=
Number
(
quarter_actual
/
quarter
)
// }
// res.map((item, index) => {
let
fy_actual
=
item
.
profit_loss
.
fy_actual
==
''
?
0
:
item
.
profit_loss
.
fy_actual
// dataTable.push([
let
fy
=
item
.
profit_loss
.
fy
==
''
?
0
:
item
.
profit_loss
.
fy
// item.type_report_id,
let
persenFy
=
Number
(
fy_actual
/
fy
)
// item.id,
// item.parent,
dbSumaPL
.
push
([
// item.formula,
item
.
id
,
// item.level,
item
.
profit_loss
.
mtd_actual
,
// item.description,
item
.
profit_loss
.
mtd
,
// item.profit_detail.total_actual_before === null ? "0" : item.profit_detail.total_actual_before === "" ? "0" : item.profit_detail.total_actual_before,
isNaN
(
persenMtd
)?
0
:
persenMtd
*
100
,
// 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
.
mtd_last_year
,
// 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
.
ytd_actual
,
// 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
.
ytd
,
// 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,
isNaN
(
persenYtd
)?
0
:
persenYtd
*
100
,
// 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
.
ytd_last_year
,
// 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
.
quarter_actual
,
// 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
.
quarter
,
// 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,
isNaN
(
persenQuarter
)?
0
:
persenQuarter
*
100
,
// 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
.
quarter_last_year
,
// 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
.
fy_actual
,
// 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
.
fy
,
// 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,
isNaN
(
persenFy
)?
0
:
persenFy
*
100
,
// item.profit_detail.total_current_year,
item
.
profit_loss
.
fy_last_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,
if
(
item
.
children
!==
null
)
{
// item.condition_it_should_be,
if
(
item
.
children
.
length
>
0
)
{
// item.condition_if_wrong,
item
.
children
.
map
((
items
,
indexs
)
=>
{
// item.profit_detail.forecast_formula == null ? [] : item.profit_detail.forecast_formula
handlePushChild
(
items
)
// ])
})
// if (item.children !== null) {
}
// if (item.children.length > 0) {
}
// item.children.map((items, indexs) => {
}
// handlePushChild(items)
res
.
map
((
item
,
index
)
=>
{
// })
let
mtd_actual
=
item
.
profit_loss
.
mtd_actual
==
''
?
0
:
item
.
profit_loss
.
mtd_actual
// }
let
mtd
=
item
.
profit_loss
.
mtd
==
''
?
0
:
item
.
profit_loss
.
mtd
// }
let
persenMtd
=
Number
(
mtd_actual
/
mtd
)
// })
console
.
log
(
persenMtd
)
// // this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
let
ytd_actual
=
item
.
profit_loss
.
ytd_actual
==
''
?
0
:
item
.
profit_loss
.
ytd_actual
// this.setState({ dataTable }, () => {
let
ytd
=
item
.
profit_loss
.
ytd
==
''
?
0
:
item
.
profit_loss
.
ytd
// console.log(this.state.dataTable)
let
persenYtd
=
Number
(
ytd_actual
/
ytd
)
// this.getReportPLMR(payload)
// })
let
quarter_actual
=
item
.
profit_loss
.
quarter_actual
==
''
?
0
:
item
.
profit_loss
.
quarter_actual
// } else {
let
quarter
=
item
.
profit_loss
.
quarter
==
''
?
0
:
item
.
profit_loss
.
quarter
// this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
let
persenQuarter
=
Number
(
quarter_actual
/
quarter
)
// }
this
.
setState
({
previewTable
:
true
,
loading
:
false
,
previewDownload
:
false
})
let
fy_actual
=
item
.
profit_loss
.
fy_actual
==
''
?
0
:
item
.
profit_loss
.
fy_actual
let
fy
=
item
.
profit_loss
.
fy
==
''
?
0
:
item
.
profit_loss
.
fy
let
persenFy
=
Number
(
fy_actual
/
fy
)
dbSumaPL
.
push
([
item
.
id
,
item
.
profit_loss
.
mtd_actual
,
item
.
profit_loss
.
mtd
,
isNaN
(
persenMtd
)?
0
:
persenMtd
*
100
,
item
.
profit_loss
.
mtd_last_year
,
item
.
profit_loss
.
ytd_actual
,
item
.
profit_loss
.
ytd
,
isNaN
(
persenYtd
)?
0
:
persenYtd
*
100
,
item
.
profit_loss
.
ytd_last_year
,
item
.
profit_loss
.
quarter_actual
,
item
.
profit_loss
.
quarter
,
isNaN
(
persenQuarter
)?
0
:
persenQuarter
*
100
,
item
.
profit_loss
.
quarter_last_year
,
item
.
profit_loss
.
fy_actual
,
item
.
profit_loss
.
fy
,
isNaN
(
persenFy
)?
0
:
persenFy
*
100
,
item
.
profit_loss
.
fy_last_year
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
})
}
else
if
(
this
.
state
.
report
.
value
===
9
)
{
}
else
if
(
this
.
state
.
report
.
value
===
9
)
{
api
.
create
().
getReportHierarkiFRMB
(
payload
).
then
(
response
=>
{
api
.
create
().
getReportHierarkiFRMB
(
payload
).
then
(
response
=>
{
...
...
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