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
40cd343a
Commit
40cd343a
authored
Jan 06, 2021
by
Riri Novita
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'riri' into 'master'
apdet pl See merge request
!909
parents
1b6def5d
32e17113
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
141 deletions
+70
-141
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+70
-141
No files found.
src/container/MonthlyReport/ProfitLossMR.js
View file @
40cd343a
...
...
@@ -201,16 +201,9 @@ export default class ProfitLossMR extends Component {
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
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,9 +226,9 @@ export default class ProfitLossMR extends Component {
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
.
profit_loss
.
mtd_vs_previous_month
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_previous_month
,
item
.
order
,
item
.
profit_loss
.
ytd_actual
===
null
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
===
""
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
,
])
...
...
@@ -250,16 +243,9 @@ export default class ProfitLossMR extends Component {
}
res
.
map
((
item
,
index
)
=>
{
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
,
...
...
@@ -281,9 +267,9 @@ export default class ProfitLossMR extends Component {
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
.
profit_loss
.
mtd_vs_previous_month
===
null
?
""
:
item
.
profit_loss
.
mtd_vs_previous_month
,
item
.
order
,
item
.
profit_loss
.
ytd_actual
===
null
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
===
""
?
"0.0"
:
item
.
profit_loss
.
ytd_actual
,
])
...
...
@@ -368,9 +354,9 @@ export default class ProfitLossMR extends Component {
"percent_act_vs_mb"
:
i
[
16
],
"amount_act_vs_rb"
:
i
[
17
],
"percent_act_vs_rb"
:
i
[
18
],
"mtd_vs_
previous_month
"
:
i
[
19
],
"mtd_vs_
m
b"
:
i
[
20
],
"mtd_vs_
rb"
:
i
[
21
]
"mtd_vs_
mb
"
:
i
[
19
],
"mtd_vs_
r
b"
:
i
[
20
],
"mtd_vs_
previous_month"
:
i
[
21
],
})
})
let
payload
=
{
...
...
@@ -427,9 +413,9 @@ export default class ProfitLossMR extends Component {
item_report
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
notes
:
i
[
3
]
===
undefined
?
""
:
String
(
i
[
3
]).
trim
(),
actual
:
i
[
4
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
mtd_vs_
previous_month
:
i
[
5
]
===
undefined
?
""
:
String
(
i
[
5
]).
trim
(),
mtd_vs_
mb
:
i
[
6
]
===
undefined
?
""
:
String
(
i
[
6
]).
trim
(),
mtd_vs_
rb
:
i
[
7
]
===
undefined
?
""
:
String
(
i
[
7
]).
trim
(),
mtd_vs_
mb
:
i
[
5
]
===
undefined
?
""
:
String
(
i
[
5
]).
trim
(),
mtd_vs_
rb
:
i
[
6
]
===
undefined
?
""
:
String
(
i
[
6
]).
trim
(),
mtd_vs_
previous_month
:
i
[
7
]
===
undefined
?
""
:
String
(
i
[
7
]).
trim
(),
})
}
})
...
...
@@ -480,9 +466,9 @@ export default class ProfitLossMR extends Component {
// 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
.
mtd_vs_previous_month
,
item
.
orders
,
item
.
ytd_actual
===
null
?
""
:
item
.
ytd_actual
===
""
?
""
:
item
.
ytd_actual
,
item
.
error
...
...
@@ -521,9 +507,9 @@ export default class ProfitLossMR extends Component {
percent_act_vs_mb
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)),
amount_act_vs_rb
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)),
percent_act_vs_rb
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)),
mtd_vs_
previous_month
:
String
(
i
[
19
]),
mtd_vs_
m
b
:
String
(
i
[
20
]),
mtd_vs_
rb
:
String
(
i
[
21
]),
mtd_vs_
mb
:
String
(
i
[
19
]),
mtd_vs_
r
b
:
String
(
i
[
20
]),
mtd_vs_
previous_month
:
String
(
i
[
21
]),
})
})
let
body
=
{
...
...
@@ -570,17 +556,18 @@ export default class ProfitLossMR extends Component {
this
.
state
.
dataTable
.
map
((
i
,
index
)
=>
{
if
(
i
[
0
]
===
3
)
{
// console.log(i);
if
(
i
[
19
]
===
""
&&
(
Number
(
i
[
1
4
])
<
this
.
state
.
minValue
||
Number
(
i
[
14
])
>
this
.
state
.
maxValue
))
{
if
(
i
[
19
]
===
""
&&
(
Number
(
i
[
1
6
])
<
this
.
state
.
minValue
||
Number
(
i
[
16
])
>
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
}
// 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
],
...
...
@@ -597,9 +584,9 @@ export default class ProfitLossMR extends Component {
"percent_act_vs_mb"
:
i
[
16
],
"amount_act_vs_rb"
:
i
[
17
],
"percent_act_vs_rb"
:
i
[
18
],
"mtd_vs_
previous_month
"
:
i
[
19
],
"mtd_vs_
m
b"
:
i
[
20
],
"mtd_vs_
rb"
:
i
[
21
]
"mtd_vs_
mb
"
:
i
[
19
],
"mtd_vs_
r
b"
:
i
[
20
],
"mtd_vs_
previous_month"
:
i
[
21
],
})
})
...
...
@@ -1737,13 +1724,13 @@ export default class ProfitLossMR extends Component {
<
div
style
=
{{
borderBottom
:
"1px #fff solid"
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
padding
:
5
,
height
:
40
}}
>
{
columnMeta
.
name
}
<
/div
>
<
div
className
=
"grid grid-3x"
style
=
{{
...
style2
,
backgroundColor
:
'#1c71b8'
,
color
:
'#fff'
,
fontSize
:
12
,
fontWeight
:
'bold'
,
position
:
"sticky"
}}
>
<
div
className
=
"column-1"
style
=
{{
placeSelf
:
'center'
,
textAlign
:
'center'
,
padding
:
5
,
borderRight
:
"1px #fff solid"
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
height
:
45
}}
>
<
span
>
{
"vs
Prev Month
"
}
<
/span
>
<
span
>
{
"vs
MB
"
}
<
/span
>
<
/div
>
<
div
className
=
"column-2"
style
=
{{
placeSelf
:
'center'
,
textAlign
:
'center'
,
padding
:
5
,
borderRight
:
"1px #fff solid"
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
height
:
45
}}
>
<
span
>
{
"vs
M
B"
}
<
/span
>
<
span
>
{
"vs
R
B"
}
<
/span
>
<
/div
>
<
div
className
=
"column-3"
style
=
{{
placeSelf
:
'center'
,
textAlign
:
'center'
,
padding
:
5
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
height
:
45
}}
>
<
span
>
{
"vs
RB
"
}
<
/span
>
<
span
>
{
"vs
Prev Month
"
}
<
/span
>
<
/div
>
<
/div
>
<
/th
>
...
...
@@ -1773,7 +1760,7 @@ export default class ProfitLossMR extends Component {
defaultValue
=
{
tableMeta
.
rowData
[
19
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
1
4
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
color
:
Number
(
tableMeta
.
rowData
[
1
6
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
textAlign
:
'left'
}
}}
...
...
@@ -1786,8 +1773,8 @@ export default class ProfitLossMR extends Component {
style
=
{{
margin
:
0
}}
// value={tableMeta.rowData[19]}
control
=
{
tableMeta
.
rowData
[
19
]
===
""
&&
(
Number
(
tableMeta
.
rowData
[
1
4
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>
this
.
state
.
maxValue
)
?
<
LightTooltipError
title
=
{
"MTD Explanation vs
Prev. Month
is Reqiured"
}
arrow
>
tableMeta
.
rowData
[
19
]
===
""
&&
(
Number
(
tableMeta
.
rowData
[
1
6
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>
this
.
state
.
maxValue
)
?
<
LightTooltipError
title
=
{
"MTD Explanation vs
MB
is Reqiured"
}
arrow
>
<
Input
disableUnderline
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
minHeight
:
30
,
padding
:
0
}}
...
...
@@ -1818,13 +1805,11 @@ export default class ProfitLossMR extends Component {
type
=
"text"
placeholder
=
""
multiline
=
{
true
}
// disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[19]}
disabled
=
{
this
.
props
.
isApprover
?
true
:
(
this
.
state
.
get_for
==
'view'
?
true
:
false
)}
defaultValue
=
{
tableMeta
.
rowData
[
19
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
1
4
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
color
:
Number
(
tableMeta
.
rowData
[
1
6
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
textAlign
:
'left'
}
}}
...
...
@@ -1855,7 +1840,7 @@ export default class ProfitLossMR extends Component {
defaultValue
=
{
tableMeta
.
rowData
[
20
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
16
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
color
:
'#5198ea'
,
textAlign
:
'left'
}
}}
...
...
@@ -1868,45 +1853,17 @@ export default class ProfitLossMR extends Component {
style
=
{{
margin
:
0
}}
// value={value}
control
=
{
tableMeta
.
rowData
[
20
]
===
""
&&
(
Number
(
tableMeta
.
rowData
[
16
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>
this
.
state
.
maxValue
)
?
<
LightTooltipError
title
=
{
"MTD Explanation vs MB is Reqiured"
}
arrow
>
<
Input
disableUnderline
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
minHeight
:
30
,
padding
:
0
}}
type
=
"text"
placeholder
=
""
multiline
=
{
true
}
// value={tableMeta.rowData[20]}
disabled
=
{
this
.
props
.
isApprover
?
true
:
(
this
.
state
.
get_for
==
'view'
?
true
:
false
)}
defaultValue
=
{
tableMeta
.
rowData
[
20
]}
inputProps
=
{{
style
:
{
color
:
"#5198ea"
,
textAlign
:
'left'
,
backgroundColor
:
'#ffac99'
,
minHeight
:
30
,
padding
:
0
}
}}
onBlur
=
{(
event
)
=>
{
handleText
(
event
.
target
.
value
,
tableMeta
,
1
)
}}
/
>
<
/LightTooltipError>
:
<
Input
disableUnderline
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
multiline
=
{
true
}
// disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[20]}
disabled
=
{
this
.
props
.
isApprover
?
true
:
(
this
.
state
.
get_for
==
'view'
?
true
:
false
)}
defaultValue
=
{
tableMeta
.
rowData
[
20
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
16
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
color
:
'#5198ea'
,
textAlign
:
'left'
}
}}
...
...
@@ -1937,7 +1894,7 @@ export default class ProfitLossMR extends Component {
defaultValue
=
{
tableMeta
.
rowData
[
21
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
18
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
18
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
color
:
'#5198ea'
,
textAlign
:
'left'
}
}}
...
...
@@ -1950,45 +1907,17 @@ export default class ProfitLossMR extends Component {
style
=
{{
margin
:
0
}}
// value={value}
control
=
{
tableMeta
.
rowData
[
21
]
===
""
&&
(
Number
(
tableMeta
.
rowData
[
18
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
18
])
>
this
.
state
.
maxValue
)
?
<
LightTooltipError
title
=
{
"MTD Explanation vs RB is Reqiured"
}
arrow
>
<
Input
disableUnderline
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
,
minHeight
:
30
,
padding
:
0
}}
type
=
"text"
placeholder
=
""
multiline
=
{
true
}
disabled
=
{
this
.
props
.
isApprover
?
true
:
(
this
.
state
.
get_for
==
'view'
?
true
:
false
)}
// value={tableMeta.rowData[21]}
defaultValue
=
{
tableMeta
.
rowData
[
21
]}
inputProps
=
{{
style
:
{
color
:
"#5198ea"
,
textAlign
:
'left'
,
backgroundColor
:
'#ffac99'
,
minHeight
:
30
,
padding
:
0
}
}}
onBlur
=
{(
event
)
=>
{
handleText
(
event
.
target
.
value
,
tableMeta
,
2
)
}}
/
>
<
/LightTooltipError>
:
<
Input
disableUnderline
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'left'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
multiline
=
{
true
}
// disabled={Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? false : true}
// value={tableMeta.rowData[21]}
disabled
=
{
this
.
props
.
isApprover
?
true
:
(
this
.
state
.
get_for
==
'view'
?
true
:
false
)}
defaultValue
=
{
tableMeta
.
rowData
[
21
]}
inputProps
=
{{
style
:
{
color
:
Number
(
tableMeta
.
rowData
[
18
])
<
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
18
])
>
this
.
state
.
maxValue
?
"#5198ea"
:
'#5198ea'
,
color
:
'#5198ea'
,
textAlign
:
'left'
}
}}
...
...
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