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
a8873758
Commit
a8873758
authored
Dec 03, 2020
by
Faisal Hamdi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'riri' into 'master'
apdet See merge request
!738
parents
04a788ce
ce23bb83
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
55 deletions
+140
-55
OperatingIndicatorMR.js
src/container/MonthlyReport/OperatingIndicatorMR.js
+96
-11
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+3
-3
OperatingIndicator.js
src/container/OprIndicator/OperatingIndicator.js
+41
-41
No files found.
src/container/MonthlyReport/OperatingIndicatorMR.js
View file @
a8873758
...
...
@@ -5,7 +5,9 @@ import NumberFormat from 'react-number-format';
import
{
PropagateLoader
}
from
'react-spinners'
;
import
ReactTooltip
from
'react-tooltip'
;
import
api
from
'../../api'
;
import
*
as
R
from
'ramda'
;
import
Images
from
'../../assets/Images'
;
import
Constant
from
'../../library/Constant'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
...
...
@@ -40,24 +42,65 @@ export default class OperatingIndicatorMR extends Component {
this
.
state
=
{
dataTable
:
[],
loading
:
true
,
minValue
:
0
,
maxValue
:
0
}
}
componentDidMount
()
{
// this.getItemHierarki()
this
.
getSettingControl
()
}
getSettingControl
()
{
let
body
=
{
group
:
'THRESHOLD_VARIANCE'
,
company_id
:
this
.
props
.
company
.
company_id
,
type
:
'BALANCE_SHEET'
}
api
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
minValue
:
response
.
data
.
data
[
0
]
?
response
.
data
.
data
[
0
].
min_value
:
-
5
,
maxValue
:
response
.
data
.
data
[
0
]
?
response
.
data
.
data
[
0
].
max_value
:
5
,
},
()
=>
{
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
()
{
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"report_id"
:
this
.
props
.
report_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"revision"
:
Number
(
this
.
props
.
revision
),
"months"
:
this
.
props
.
month
.
month_id
"periode"
:
this
.
props
.
periode
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"months"
:
this
.
props
.
month
.
month_id
,
// "operating_indicator_id": this.props.data.operatingIndID,
// "report_id": this.props.data.report_id,
// "company_id": this.props.data.company.company_id,
// "periode": this.props.data.periode
}
api
.
create
().
getHierarkiMontlyReportOI
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
console
.
log
(
response
.
data
);
let
dataTable
=
[]
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
...
...
@@ -254,10 +297,12 @@ export default class OperatingIndicatorMR extends Component {
const
handleVariancePercent
=
(
tableMeta
,
dex
,
type
)
=>
{
let
total
=
0
if
(
dex
===
1
)
{
total
=
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
11
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
8
])
// total = Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])
total
=
R
.
equals
((
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
11
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
8
])),
NaN
)
?
'0'
:
R
.
equals
((
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
11
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
8
])),
Infinity
)
?
'0'
:
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
11
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
8
])
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
}
else
if
(
dex
===
2
)
{
total
=
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
13
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
9
])
// total = Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])
total
=
R
.
equals
((
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
13
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
9
])),
NaN
)
?
'0'
:
R
.
equals
((
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
13
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
9
])),
Infinity
)
?
'0'
:
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
13
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
][
9
])
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
}
return
total
...
...
@@ -695,7 +740,7 @@ export default class OperatingIndicatorMR extends Component {
<
div
className
=
"grid grid-2x content-center"
>
<
div
className
=
"column-1"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
120
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
<
div
style
=
{{
flex
:
1
}}
>
...
...
@@ -719,10 +764,10 @@ export default class OperatingIndicatorMR extends Component {
<
/div
>
<
div
className
=
"column-2"
>
<
div
style
=
{{
textAlign
:
'right'
,
width
:
120
}}
>
{
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
div
style
=
{{
flex
:
1
,
width
:
120
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
val
}
...
...
@@ -802,6 +847,26 @@ export default class OperatingIndicatorMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
12
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
12
])
>=
this
.
state
.
maxValue
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
15
]}
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
[
15
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
@@ -838,6 +903,26 @@ export default class OperatingIndicatorMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
14
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>=
this
.
state
.
maxValue
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
16
]}
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
[
16
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
src/container/MonthlyReport/ProfitLossMR.js
View file @
a8873758
...
...
@@ -1436,7 +1436,7 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
1
9
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
19
])
>=
this
.
state
.
maxValue
?
Number
(
tableMeta
.
rowData
[
1
4
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
14
])
>=
this
.
state
.
maxValue
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -1491,7 +1491,7 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
20
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
20
])
>=
this
.
state
.
maxValue
?
Number
(
tableMeta
.
rowData
[
16
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
16
])
>=
this
.
state
.
maxValue
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -1546,7 +1546,7 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
21
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
21
])
>=
this
.
state
.
maxValue
?
Number
(
tableMeta
.
rowData
[
18
])
<=
this
.
state
.
minValue
||
Number
(
tableMeta
.
rowData
[
18
])
>=
this
.
state
.
maxValue
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
src/container/OprIndicator/OperatingIndicator.js
View file @
a8873758
...
...
@@ -89,45 +89,45 @@ export default class OperatingIndicator extends Component {
})
}
getMonth
()
{
api
.
create
().
getMonthTransaction
().
then
(
response
=>
{
console
.
log
(
response
);
let
dateNow
=
new
Date
let
month
=
format
(
dateNow
,
'MMMM'
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
);
let
data
=
response
.
data
.
data
let
monthData
=
data
.
map
((
item
)
=>
{
return
{
month_id
:
item
.
id
,
month_value
:
String
(
item
.
month_name
).
substr
(
0
,
3
)
}
})
let
defaultProps
=
{
options
:
monthData
,
getOptionLabel
:
(
option
)
=>
option
.
month_value
,
};
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
.
month_name
==
month
)
console
.
log
(
index
);
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
]
},
()
=>
{
this
.
getLastPeriod
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
})
}
//
getMonth() {
//
api.create().getMonthTransaction().then(response => {
//
console.log(response);
//
let dateNow = new Date
//
let month = format(dateNow, 'MMMM')
//
if (response.data) {
//
if (response.data.status === "success") {
//
console.log(response);
//
let data = response.data.data
//
let monthData = data.map((item) => {
//
return {
//
month_id: item.id,
//
month_value: String(item.month_name).substr(0, 3)
//
}
//
})
//
let defaultProps = {
//
options: monthData,
//
getOptionLabel: (option) => option.month_value,
//
};
//
let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == month)
//
console.log(index);
//
this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] }, () => {
//
this.getLastPeriod()
//
})
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
//
if (response.data.message.includes("Someone Logged In")) {
//
setTimeout(() => {
//
localStorage.removeItem(Constant.TOKEN)
//
window.location.reload();
//
}, 1000);
//
}
//
})
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
//
}
//
})
//
}
getReportAttachment
()
{
let
payload
=
{
...
...
@@ -233,7 +233,7 @@ export default class OperatingIndicator extends Component {
};
this
.
setState
({
listCompany
:
defaultProps
,
company
:
arrayBaru
.
length
<
1
?
companyData
[
0
]
:
arrayBaru
[
0
]
},
()
=>
{
this
.
get
Month
()
this
.
get
LastPeriod
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
...
@@ -671,7 +671,7 @@ export default class OperatingIndicator extends Component {
data
=
{
this
.
state
.
dataDetail
}
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
month
=
{
this
.
state
.
month
}
//
month={this.state.month}
company
=
{
this
.
state
.
company
}
onClickClose
=
{()
=>
this
.
setState
({
visibleDetailMonthly
:
false
,
visibleOperatingIndicator
:
true
},
()
=>
{
this
.
getOperatingID
()
...
...
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