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
bc6454b9
Commit
bc6454b9
authored
Dec 22, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bikin pusing
parent
4db09279
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
73 deletions
+64
-73
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+64
-73
No files found.
src/container/MonthlyReport/ProfitLossMR.js
View file @
bc6454b9
...
...
@@ -61,20 +61,20 @@ const styleNotesEmpty = {
zIndex
:
99
,
left
:
0
}
const
StyledButton
=
withStyles
({
root
:
{
background
:
'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)'
,
borderRadius
:
3
,
border
:
0
,
color
:
'white'
,
height
:
48
,
padding
:
'0 30px'
,
boxShadow
:
'0 3px 5px 2px rgba(255, 105, 135, .3)'
,
},
label
:
{
textTransform
:
'capitalize'
,
},
})(
Input
);
//
const StyledButton = withStyles({
//
root: {
//
background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
//
borderRadius: 3,
//
border: 0,
//
color: 'white',
//
height: 48,
//
padding: '0 30px',
//
boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
//
},
//
label: {
//
textTransform: 'capitalize',
//
},
//
})(Input);
export
default
class
ProfitLossMR
extends
Component
{
constructor
(
props
)
{
...
...
@@ -88,7 +88,11 @@ export default class ProfitLossMR extends Component {
updateBy
:
'-'
,
notesUpdate
:
'-'
,
bebas
:
false
,
judulColumn
:
null
judulColumn
:
null
,
handleTekTekTek
:
0
,
saveDraft
:
true
,
buttonError
:
true
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -174,7 +178,8 @@ export default class ProfitLossMR extends Component {
"periode"
:
this
.
props
.
periode
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"months"
:
this
.
props
.
month
.
month_id
"months"
:
this
.
props
.
month
.
month_id
,
"get_for"
:
"edit"
}
console
.
log
(
payload
);
api
.
create
().
getHierarkiMontlyReportPL
(
payload
).
then
(
response
=>
{
...
...
@@ -187,14 +192,17 @@ export default class ProfitLossMR extends Component {
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
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
(
item
.
type_report_id
===
3
)
{
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
([
...
...
@@ -233,14 +241,17 @@ export default class ProfitLossMR extends Component {
}
}
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
if
(
item
.
type_report_id
===
3
)
{
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
([
item
.
type_report_id
,
...
...
@@ -540,6 +551,20 @@ export default class ProfitLossMR extends Component {
let
data
=
[]
let
err
=
false
this
.
state
.
dataTable
.
map
((
i
,
index
)
=>
{
if
(
i
[
0
]
===
3
)
{
// console.log(i);
if
(
i
[
19
]
===
""
&&
(
Number
(
i
[
14
])
<
this
.
state
.
minValue
||
Number
(
i
[
14
])
>
this
.
state
.
maxValue
))
{
console
.
log
(
'msk 1'
);
// console.log(i);
err
=
true
}
else
if
(
i
[
20
]
===
""
&&
(
Number
(
i
[
16
])
<
this
.
state
.
minValue
||
Number
(
i
[
16
])
>
this
.
state
.
maxValue
))
{
console
.
log
(
'msk 2'
);
err
=
true
}
else
if
(
i
[
21
]
===
""
&&
(
Number
(
i
[
18
])
<
this
.
state
.
minValue
||
Number
(
i
[
18
])
>
this
.
state
.
maxValue
))
{
console
.
log
(
'msk 3'
);
err
=
true
}
}
data
.
push
({
"item_report_id"
:
i
[
1
],
"notes"
:
i
[
6
],
...
...
@@ -560,20 +585,7 @@ export default class ProfitLossMR extends Component {
"mtd_vs_rb"
:
i
[
21
]
})
})
console
.
log
(
data
);
data
.
map
(
i
=>
{
if
(
i
.
mtd_vs_previous_month
===
""
&&
(
Number
(
i
.
percent_act_vs_previous_month
)
<
this
.
state
.
minValue
||
Number
(
i
.
percent_act_vs_previous_month
)
>
this
.
state
.
maxValue
))
{
// console.log('msk 1');
// console.log(i);
err
=
true
}
else
if
(
i
.
mtd_vs_mb
===
""
&&
(
Number
(
i
.
percent_act_vs_mb
)
<
this
.
state
.
minValue
||
Number
(
i
.
percent_act_vs_mb
)
>
this
.
state
.
maxValue
))
{
// console.log('msk 2');
err
=
true
}
else
if
(
i
.
mtd_vs_rb
===
""
&&
(
Number
(
i
.
percent_act_vs_rb
)
<
this
.
state
.
minValue
||
Number
(
i
.
percent_act_vs_rb
)
>
this
.
state
.
maxValue
))
{
// console.log('msk 3');
err
=
true
}
})
// console.log(JSON.stringify(data))
let
payload
=
{
...
...
@@ -587,10 +599,12 @@ export default class ProfitLossMR extends Component {
}
// console.log(JSON.stringify(payload));
api
.
create
().
validateSubmitReportPL
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
console
.
log
(
response
.
data
.
data
.
result
)
console
.
log
(
err
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
data
.
result
&&
err
===
false
)
{
this
.
setState
({
loading
:
false
,
buttonError
:
false
,
editable
:
false
,
saveDraft
:
false
})
}
else
{
this
.
setState
({
loading
:
false
,
buttonError
:
true
,
editable
:
true
,
saveDraft
:
false
})
...
...
@@ -617,29 +631,6 @@ export default class ProfitLossMR extends Component {
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
// const handleCalculate = () => {
// let error = false
// let messageError = ""
// dataTable2.map((item, index) => {
// if (item[19] == "" && Number(item[14]) <= this.state.minValue || Number(item[14]) >= this.state.maxValue) {
// error = true
// messageError = "MTD Explanation vs Prev. Month is Reqiured"
// }
// if (item[20] == "" && Number(item[16]) <= this.state.minValue || Number(item[16]) >= this.state.maxValue) {
// error = true
// messageError = "MTD Explanation vs MB is Reqiured"
// }
// if (item[21] == "" && Number(item[18]) <= this.state.minValue || Number(item[18]) >= this.state.maxValue) {
// error = true
// messageError = "MTD Explanation vs RB is Reqiured"
// }
// })
// if (error === true) {
// this.setState({ alert: true, messageAlert: messageError, tipeAlert: 'error', loading: false, bebas: true })
// }
// }
const
handleText
=
(
value
,
tableMeta
,
type
)
=>
{
// dataTable2[tableMeta.rowIndex][type] = value
...
...
@@ -1849,7 +1840,7 @@ export default class ProfitLossMR extends Component {
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
}}
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
month
.
month_valu
e
}
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
String
(
this
.
props
.
month
.
month_value
).
toLocaleUpperCas
e
}
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
...
...
@@ -1981,7 +1972,7 @@ export default class ProfitLossMR extends Component {
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
,
bebas
:
false
},
()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
handleValidate
()
},
100
);
...
...
@@ -2023,7 +2014,7 @@ export default class ProfitLossMR extends Component {
<
/button
>
<
button
type
=
"button"
disabled
=
{
this
.
state
.
butto
nError
}
// disabled={this.state.butto
nError}
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
...
...
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