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
e54317d2
Commit
e54317d2
authored
Oct 06, 2020
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
olpa pl
parent
da5dc009
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
82 deletions
+78
-82
ProfitLossOLPA.js
src/container/OutlookPA/ProfitLossOLPA.js
+78
-82
No files found.
src/container/OutlookPA/ProfitLossOLPA.js
View file @
e54317d2
...
@@ -66,7 +66,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -66,7 +66,7 @@ export default class ProfitLossOLPA extends Component {
"revision"
:
Number
(
this
.
props
.
revision
),
"revision"
:
Number
(
this
.
props
.
revision
),
"periode"
:
this
.
props
.
periode
,
"periode"
:
this
.
props
.
periode
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"
submission_id"
:
this
.
props
.
submissionID
"
outlook_pa_id"
:
this
.
props
.
outlook_pa_id
}
}
api
.
create
().
getLastestUpdateMB
(
payload
).
then
(
response
=>
{
api
.
create
().
getLastestUpdateMB
(
payload
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
data
)
{
...
@@ -79,60 +79,24 @@ export default class ProfitLossOLPA extends Component {
...
@@ -79,60 +79,24 @@ export default class ProfitLossOLPA extends Component {
})
})
}
}
getItemHierarki
()
{
async
getItemHierarki
()
{
this
.
setState
({
loading
:
true
,
judulColumn
:
null
})
this
.
setState
({
loading
:
true
,
judulColumn
:
null
})
let
payload
=
{
let
payload
=
{
"outlook_pa_id"
:
this
.
props
.
outlook_pa_id
,
"report_id"
:
this
.
props
.
report_id
,
"report_id"
:
this
.
props
.
report_id
,
"revision"
:
Number
(
this
.
props
.
revision
)
,
"revision"
:
this
.
props
.
revision
,
"periode"
:
this
.
props
.
periode
,
"periode"
:
this
.
props
.
periode
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
"submission_id"
:
this
.
props
.
submissionID
}
}
api
.
create
().
getDetailReportMB
(
payload
).
then
(
response
=>
{
console
.
log
(
payload
)
console
.
log
(
response
);
let
response
=
await
api
.
create
().
getDetailReportOLPA
(
payload
)
let
dataTable
=
[]
console
.
log
(
response
);
this
.
setState
({
visibleProfitLoss
:
true
})
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
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
.
total_actual_before
===
null
?
"0"
:
item
.
profit_loss
.
total_actual_before
===
""
?
"0"
:
item
.
profit_loss
.
total_actual_before
,
item
.
profit_loss
.
january
,
item
.
profit_loss
.
february
,
item
.
profit_loss
.
march
,
item
.
profit_loss
.
april
,
item
.
profit_loss
.
may
,
item
.
profit_loss
.
june
,
item
.
profit_loss
.
july
,
item
.
profit_loss
.
august
,
item
.
profit_loss
.
september
,
item
.
profit_loss
.
october
,
item
.
profit_loss
.
november
,
item
.
profit_loss
.
december
,
item
.
profit_loss
.
total_current_year
,
item
.
profit_loss
.
total_next_year
,
item
.
profit_loss
.
total_more_year
,
item
.
order
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
dataTable
.
push
([
item
.
type_report_id
,
item
.
type_report_id
,
item
.
id
,
item
.
id
,
...
@@ -159,21 +123,55 @@ export default class ProfitLossOLPA extends Component {
...
@@ -159,21 +123,55 @@ export default class ProfitLossOLPA extends Component {
item
.
profit_loss
.
total_more_year
,
item
.
profit_loss
.
total_more_year
,
item
.
order
item
.
order
])
])
if
(
item
.
children
!==
null
)
{
}
if
(
item
.
children
.
length
>
0
)
{
if
(
item
.
children
!==
null
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
if
(
item
.
children
.
length
>
0
)
{
handlePushChild
(
items
)
item
.
children
.
map
((
items
,
indexs
)
=>
{
}
)
handlePushChild
(
items
)
}
}
)
}
}
})
}
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
else
{
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
}
res
.
map
((
item
,
index
)
=>
{
})
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
.
total_actual_before
===
null
?
"0"
:
item
.
profit_loss
.
total_actual_before
===
""
?
"0"
:
item
.
profit_loss
.
total_actual_before
,
item
.
profit_loss
.
january
,
item
.
profit_loss
.
february
,
item
.
profit_loss
.
march
,
item
.
profit_loss
.
april
,
item
.
profit_loss
.
may
,
item
.
profit_loss
.
june
,
item
.
profit_loss
.
july
,
item
.
profit_loss
.
august
,
item
.
profit_loss
.
september
,
item
.
profit_loss
.
october
,
item
.
profit_loss
.
november
,
item
.
profit_loss
.
december
,
item
.
profit_loss
.
total_current_year
,
item
.
profit_loss
.
total_next_year
,
item
.
profit_loss
.
total_more_year
,
item
.
order
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
else
{
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
editable
:
true
})
}
}
}
handleValue
(
data
)
{
handleValue
(
data
)
{
...
@@ -203,7 +201,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -203,7 +201,7 @@ export default class ProfitLossOLPA extends Component {
}
}
}
}
backTo
MasterBudget
(
type
)
{
backTo
OLPA
(
type
)
{
let
data
=
[]
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
data
.
push
({
...
@@ -228,7 +226,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -228,7 +226,7 @@ export default class ProfitLossOLPA extends Component {
})
})
})
})
let
payload
=
{
let
payload
=
{
"
submission_id"
:
this
.
props
.
submissionID
,
"
outlook_pa_id"
:
this
.
props
.
outlook_pa_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"report_id"
:
this
.
props
.
report_id
,
...
@@ -237,13 +235,13 @@ export default class ProfitLossOLPA extends Component {
...
@@ -237,13 +235,13 @@ export default class ProfitLossOLPA extends Component {
}
}
console
.
log
(
data
);
console
.
log
(
data
);
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
this
.
props
.
saveTo
MasterBudget
(
payload
)
this
.
props
.
saveTo
OLPA
(
payload
)
this
.
props
.
onClickClose
()
this
.
props
.
onClickClose
()
}
}
downloadTemplate
=
async
()
=>
{
downloadTemplate
=
async
()
=>
{
let
res
=
await
fetch
(
let
res
=
await
fetch
(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/
master_budget
/download_template?report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/
outlook_pa
/download_template?report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
`
)
)
res
=
await
res
.
blob
()
res
=
await
res
.
blob
()
console
.
log
(
res
)
console
.
log
(
res
)
...
@@ -306,7 +304,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -306,7 +304,7 @@ export default class ProfitLossOLPA extends Component {
}
}
checkUpload
()
{
checkUpload
()
{
api
.
create
().
checkUpload
MB
(
this
.
state
.
payload
).
then
(
response
=>
{
api
.
create
().
checkUpload
OLPA
(
this
.
state
.
payload
).
then
(
response
=>
{
// console.log(JSON.stringify(this.state.payload));
// console.log(JSON.stringify(this.state.payload));
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
...
@@ -380,15 +378,15 @@ export default class ProfitLossOLPA extends Component {
...
@@ -380,15 +378,15 @@ export default class ProfitLossOLPA extends Component {
})
})
})
})
let
body
=
{
let
body
=
{
submission_id
:
this
.
props
.
submissionID
,
outlook_pa_id
:
this
.
props
.
outlook_pa_id
,
company_id
:
this
.
props
.
company
.
company_id
,
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
report_id
:
this
.
props
.
report_id
,
profit_loss
:
data
,
profit_loss
:
data
,
status
:
type
status
:
type
}
}
console
.
log
(
data
);
console
.
log
(
JSON
.
stringify
(
body
)
);
api
.
create
(
'UPLOAD'
).
upload
MasterBudget
(
body
).
then
(
response
=>
{
api
.
create
(
'UPLOAD'
).
upload
OLPA
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
...
@@ -400,18 +398,16 @@ export default class ProfitLossOLPA extends Component {
...
@@ -400,18 +398,16 @@ export default class ProfitLossOLPA extends Component {
}
else
{
}
else
{
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
alert
(
response
.
problem
)
alert
(
response
.
problem
)
// this.props.onClickClose()
// this.props.getReport()
}
}
})
})
}
}
async
downloadAllData
()
{
async
downloadAllData
()
{
let
url
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/
master_budget/export_master_budget?submission_id=
${
this
.
props
.
submissionID
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
let
url
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/
outlook_pa/export_outlook_pa?outlook_pa_id=
${
this
.
props
.
outlook_pa_id
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
let
sub_null
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/
master_budget/export_master_budget?submission
_id=&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
let
sub_null
=
`https://tia.eksad.com/tia-reporting-dev/public/transaction/
outlook_pa/export_outlook_pa?outlook_pa
_id=&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
`
console
.
log
(
url
);
console
.
log
(
url
);
let
res
=
await
fetch
(
let
res
=
await
fetch
(
this
.
props
.
submissionID
==
null
?
sub_null
:
url
this
.
props
.
outlook_pa_id
==
null
?
sub_null
:
url
)
)
res
=
await
res
.
blob
()
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
...
@@ -450,15 +446,15 @@ export default class ProfitLossOLPA extends Component {
...
@@ -450,15 +446,15 @@ export default class ProfitLossOLPA extends Component {
})
})
})
})
let
payload
=
{
let
payload
=
{
"
submission_id"
:
this
.
props
.
submissionID
,
"
outlook_pa_id"
:
this
.
props
.
outlook_pa_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"report_id"
:
this
.
props
.
report_id
,
"profit_loss"
:
data
,
"profit_loss"
:
data
,
"status"
:
"submitted"
"status"
:
"submitted"
}
}
console
.
log
(
payload
)
//
console.log(payload)
api
.
create
().
validateSubmitReport
(
payload
).
then
((
response
)
=>
{
api
.
create
().
validateSubmitReport
OLPA
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
)
if
(
response
.
data
.
data
.
result
)
{
if
(
response
.
data
.
data
.
result
)
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
false
})
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
false
})
...
@@ -2158,7 +2154,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -2158,7 +2154,7 @@ export default class ProfitLossOLPA extends Component {
<
/button
>
<
/button
>
<
/div
>
<
/div
>
{
this
.
props
.
isApprover
===
true
||
this
.
state
.
dataTable
.
length
==
0
?
null
:
{
this
.
props
.
isApprover
===
true
||
this
.
state
.
dataTable
.
length
==
0
?
null
:
(
this
.
props
.
lastStatus
==
'SUBMIT'
||
this
.
props
.
lastStatus
==
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
?
(
this
.
props
.
lastStatus
==
=
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
<
button
className
=
"button"
className
=
"button"
...
@@ -2196,7 +2192,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -2196,7 +2192,7 @@ export default class ProfitLossOLPA extends Component {
onClick
=
{()
=>
onClick
=
{()
=>
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backTo
MasterBudget
(
'draft'
)
this
.
backTo
OLPA
(
'draft'
)
})
})
}
}
>
>
...
@@ -2212,7 +2208,7 @@ export default class ProfitLossOLPA extends Component {
...
@@ -2212,7 +2208,7 @@ export default class ProfitLossOLPA extends Component {
:
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
backTo
MasterBudget
(
'submitted'
)
this
.
backTo
OLPA
(
'submitted'
)
})}
})}
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
...
...
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