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
02c0f3bd
Commit
02c0f3bd
authored
Nov 27, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mtd explanation
parent
4c9b2ddc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
46 deletions
+110
-46
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+110
-46
No files found.
src/container/MonthlyReport/ProfitLossMR.js
View file @
02c0f3bd
...
...
@@ -55,12 +55,46 @@ export default class ProfitLossMR extends Component {
super
(
props
)
this
.
state
=
{
dataTable
:
[],
loading
:
true
loading
:
true
,
value
:
0
}
}
componentDidMount
()
{
this
.
getItemHierarki
()
this
.
getSettingControl
()
}
getSettingControl
()
{
let
body
=
{
group
:
'THRESHOLD_VARIANCE'
,
company_id
:
this
.
props
.
company
.
company_id
,
type
:
'PNL'
}
api
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
value
:
response
.
data
.
data
[
0
]
?
response
.
data
.
data
[
0
].
value
:
null
},
()
=>
{
this
.
getItemHierarki
()
})
}
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
})
}
})
}
getItemHierarki
()
{
...
...
@@ -148,7 +182,9 @@ export default class ProfitLossMR extends Component {
})
}
}
})
console
.
log
(
dataTable
,
this
.
state
.
value
);
this
.
setState
({
dataTable
,
loading
:
false
})
}
})
...
...
@@ -268,7 +304,7 @@ export default class ProfitLossMR extends Component {
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
months
:
this
.
props
.
month
.
month_id
,
months
:
"2021"
,
profit_loss
:
payload
}
console
.
log
(
body
)
...
...
@@ -286,12 +322,12 @@ export default class ProfitLossMR extends Component {
this
.
setState
({
visibleUpload
:
false
,
visibleProfitLoss
:
false
,
loading
:
true
})
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
item_report_id
,
item
.
item_report
,
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
paren
t
,
item
.
item_repor
t
,
item
.
notes
,
item
.
rolling_outlook
,
item
.
master_budget
,
...
...
@@ -299,6 +335,13 @@ export default class ProfitLossMR extends Component {
item
.
actual
,
item
.
ytd_actual
,
item
.
actual_previous_month
,
item
.
amount_act_vs_previous_month
,
item
.
percent_act_vs_previous_month
,
item
.
amount_act_vs_mb
,
item
.
percent_act_vs_mb
,
item
.
amount_act_vs_rb
,
item
.
percent_act_vs_rb
,
item
.
mtd_vs_previous_month
,
item
.
mtd_vs_mb
,
item
.
mtd_vs_rb
,
item
.
orders
,
...
...
@@ -307,7 +350,7 @@ export default class ProfitLossMR extends Component {
})
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
16
].
length
>
0
)
{
if
(
item
[
22
].
length
>
0
)
{
// console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
}
...
...
@@ -723,6 +766,7 @@ export default class ProfitLossMR extends Component {
<
div
style
=
{{
textAlign
:
'right'
,
width
:
90
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
@@ -764,7 +808,7 @@ export default class ProfitLossMR extends Component {
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
tableMeta
.
rowData
[
8
]
}
value
=
{
Number
(
tableMeta
.
rowData
[
8
]).
toFixed
(
1
)
}
/
>
}
/
>
...
...
@@ -1407,6 +1451,26 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
21
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
value
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
21
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
false
}
value
=
{
Number
(
tableMeta
.
rowData
[
21
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
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