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
c214903c
Commit
c214903c
authored
Apr 17, 2021
by
Faisal Hamdi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'faisal' into 'master'
Faisal See merge request
!1419
parents
a6a73f8c
99b41a7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
19 deletions
+110
-19
SubHolding.js
src/container/Laporan/SubHolding.js
+60
-10
TableSubHolding.js
src/container/Laporan/TableSubHolding.js
+50
-9
No files found.
src/container/Laporan/SubHolding.js
View file @
c214903c
...
...
@@ -38,8 +38,8 @@ export default class SubHolding extends Component {
{
value
:
7
,
label
:
'Balance Sheet - Summary'
},
{
value
:
8
,
label
:
'Profit Loss - Summary'
},
{
value
:
9
,
label
:
'Financial Ratio - Summary'
},
{
value
:
1
0
,
label
:
'CAT Performance Quarterly'
},
{
value
:
1
1
,
label
:
'CAT Performance Appraisal'
},
{
value
:
1
1
,
label
:
'CAT Performance Quarterly'
},
{
value
:
1
0
,
label
:
'CAT Performance Appraisal'
},
],
report
:
null
,
loading
:
false
,
...
...
@@ -2881,7 +2881,7 @@ export default class SubHolding extends Component {
})
})
})
}
else
if
(
this
.
state
.
report
.
value
===
1
0
)
{
}
else
if
(
this
.
state
.
report
.
value
===
1
1
)
{
let
dbCATPQ
=
[];
let
payloadCATPQ
=
{...
payload
,
report_id
:
17
,
quarter
:
this
.
state
.
quarter
.
name
}
api
.
create
().
getReportCATPQ
(
payloadCATPQ
).
then
(
response
=>
{
...
...
@@ -2967,7 +2967,7 @@ export default class SubHolding extends Component {
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
else
if
(
this
.
state
.
report
.
value
===
1
1
)
{
}
else
if
(
this
.
state
.
report
.
value
===
1
0
)
{
let
dbCATPA
=
[]
let
payloadCATPA
=
{...
payload
,
months
:
this
.
state
.
month
.
month_id
,
get_for
:
"view"
}
api
.
create
().
getReportCATPA
(
payloadCATPA
).
then
(
response
=>
{
...
...
@@ -2980,7 +2980,56 @@ export default class SubHolding extends Component {
let
indexIDzz
=
dbCATPA
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
let
parentTrue
=
item
.
parent_name
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
||
item
.
parent_name
==
'CUSTOMER PERSPECTIVE'
let
weight
=
String
(
item
.
corporate_annual_target
.
weight
).
substr
(
0
,
String
(
item
.
corporate_annual_target
.
weight
).
length
-
1
)
let
weight
=
String
(
item
.
corporate_annual_target
.
weight
).
substr
(
0
,
String
(
item
.
corporate_annual_target
.
weight
).
length
-
1
)
let
achivementYtd
=
0
if
(
item
.
formula_ytd
==
'HIB'
)
{
let
actual
=
item
.
corporate_annual_target
.
actual_ytd
==
""
?
0
:
Number
(
item
.
corporate_annual_target
.
actual_ytd
)
let
target
=
item
.
corporate_annual_target
.
target_ytd
==
""
?
0
:
Number
(
item
.
corporate_annual_target
.
target_ytd
)
if
(
target
<
0
)
{
if
(
actual
>
target
)
{
achivementYtd
=
(
actual
/
target
)
-
1
}
else
{
achivementYtd
=
(
actual
/
target
)
}
}
else
if
(
target
==
0
)
{
if
(
target
>=
actual
)
{
achivementYtd
=
1.26
}
else
{
achivementYtd
=
0
}
}
else
{
if
(
actual
==
target
)
{
achivementYtd
=
(
actual
/
target
)
}
else
{
achivementYtd
=
2
-
(
actual
/
target
)
}
}
}
else
{
let
actual
=
item
.
corporate_annual_target
.
actual_ytd
==
""
?
0
:
Number
(
item
.
corporate_annual_target
.
actual_ytd
)
let
target
=
item
.
corporate_annual_target
.
target_ytd
==
""
?
0
:
Number
(
item
.
corporate_annual_target
.
target_ytd
)
if
(
target
<
0
)
{
if
(
actual
>=
target
)
{
achivementYtd
=
((
target
-
actual
)
/
target
)
+
1
}
else
{
achivementYtd
=
(
target
-
actual
)
/
target
}
}
else
if
(
target
==
0
)
{
if
(
target
<=
actual
)
{
achivementYtd
=
1.26
}
else
{
achivementYtd
=
0
}
}
else
{
// if (actual <= target) {
achivementYtd
=
(
actual
/
target
)
// } else {
// achivementYtd = 1 - (actual / target)
// }
}
}
// total = String(total) == 'NaN' || String(total) == 'Infinity' || String(total) == '-Infinity' ? 0 : total
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) * 100
dbCATPA
.
push
([
item
.
type_report_id
,
item
.
id
,
...
...
@@ -2995,7 +3044,7 @@ export default class SubHolding extends Component {
item
.
formula_ytd
,
item
.
corporate_annual_target
.
actual_ytd
,
item
.
corporate_annual_target
.
target_ytd
,
i
tem
.
corporate_annual_target
.
achivement_ytd
,
i
sNaN
(
achivementYtd
)
||
achivementYtd
==
'Infinity'
||
achivementYtd
==
'-Infinity'
?
0
:
(
Number
(
achivementYtd
)
*
100
)
,
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
,
item
.
order
...
...
@@ -3821,9 +3870,9 @@ export default class SubHolding extends Component {
a
.
download
=
'Report Financial Ratio - Summary.xlsx'
;
a
.
click
();
}
}
else
if
(
this
.
state
.
report
.
value
===
1
0
)
{
}
else
if
(
this
.
state
.
report
.
value
===
1
1
)
{
let
res
=
await
fetch
(
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/cat/performance_quarterly/export?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submissionID
}
&&report_id=
4
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/cat/performance_quarterly/export?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submissionID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
)
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
...
...
@@ -3834,10 +3883,11 @@ export default class SubHolding extends Component {
a
.
download
=
'Report CAT Performance Quarterly.xlsx'
;
a
.
click
();
}
}
else
if
(
this
.
state
.
report
.
value
===
1
1
)
{
}
else
if
(
this
.
state
.
report
.
value
===
1
0
)
{
let
res
=
await
fetch
(
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/cat/performance_appraisal/export?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submissionID
}
&&report_id=
4
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/cat/performance_appraisal/export?submission_id=
${
this
.
state
.
submissionID
===
null
?
""
:
this
.
state
.
submissionID
}
&&report_id=
${
this
.
state
.
report
.
value
}
&&company_id=
${
this
.
state
.
company
.
company_id
}
&&year=
${
this
.
state
.
periode
.
periode
}
&&revision=
${
this
.
state
.
revisionType
}
`
)
console
.
log
(
res
);
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
if
(
res
.
size
>
0
)
{
...
...
src/container/Laporan/TableSubHolding.js
View file @
c214903c
...
...
@@ -38,7 +38,8 @@ export default class TableSubHolding extends Component {
constructor(props) {
super(props)
this.state = {
perfomanceScoreColor: '#fff'
perfomanceScoreColor: '#fff',
parameterScore: [],
}
}
...
...
@@ -1049,6 +1050,39 @@ export default class TableSubHolding extends Component {
return total
}
const handleScore = (tableMeta) => {
console.log(tableMeta);
console.log(this.state.parameterScore);
let listParameter = this.state.parameterScore
let parameterKpi = tableMeta.rowData[8]
let parameterAch = String(tableMeta.rowData[9]).includes('%') ? `MAX${String(tableMeta.rowData[9]).substr(0, String(tableMeta.rowData[9]).length - 1)}` : String(tableMeta.rowData[9])
let parameterMix = `${parameterKpi}_${parameterAch}`
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase() && String(val.company_name).toLocaleLowerCase() === "default")
let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0
let achx100 = tableMeta.rowData[9] == '100%' && (tableMeta.rowData[8] == 'HIB' || tableMeta.rowData[8] == 'HIG') ? Number(tableMeta.rowData[13]) / 100 > 1 ? 1 : Number(tableMeta.rowData[13]) / 100 : Number(tableMeta.rowData[13]) / 100
if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((item, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
totalScore = Number(item.value)
}
})
} else {
listParameterFilterCompany.map((item, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
totalScore = Number(item.value)
}
})
}
if (Number(tableMeta.rowData[12]) == Number(0)) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(0).toFixed(0)
return Number(0).toFixed(0)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
}
}
const columnDBBS = [{
name: "",
options: {
...
...
@@ -27367,7 +27401,7 @@ export default class TableSubHolding extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(
2
)}
value={Number(value).toFixed(
1
)}
disabled={true}
/>
}
...
...
@@ -27399,7 +27433,7 @@ export default class TableSubHolding extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(
2
)}
value={Number(value).toFixed(
1
)}
disabled={true}
/>
}
...
...
@@ -27432,7 +27466,7 @@ export default class TableSubHolding extends Component {
type="text"
placeholder=""
suffix={'%'}
value={Number(value).toFixed(
2
)}
value={Number(value).toFixed(
1
)}
disabled={true}
/>
}
...
...
@@ -27457,15 +27491,22 @@ export default class TableSubHolding extends Component {
null :
<FormControlLabel
style={{ margin: 0 }}
value={Number(value).toFixed(
1
)}
value={Number(value).toFixed(
0
)}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
value={handleScore(tableMeta)}
// value={Number(value).toFixed(1)}
decimalScale={0}
disabled={true}
// onBlur={(event) => {
// // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
}
/>
...
...
@@ -27496,7 +27537,7 @@ export default class TableSubHolding extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(
2
)}
value={Number(value).toFixed(
1
)}
disabled={true}
/>
}
...
...
@@ -27521,12 +27562,12 @@ export default class TableSubHolding extends Component {
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={this.props.type === 2 ? columnDBBS : this.props.type === 1 ? columnDBPLDetail : this.props.type === 3 ? columnDBPL : this.props.type === 4 ? columnDBFR : this.props.type === 5 ? columnDBTP : this.props.type === 7 ? columnSummaryBS : this.props.type === 21 ? columnDBOI : this.props.type === 6? columnDBCF : this.props.type === 8 ? columnSummaryPL : this.props.type === 9 ? columnSummaryFR : this.props.type === 1
0 ? columnCatPQ : this.props.type === 11
? columnCatPA : columns}
columns={this.props.type === 2 ? columnDBBS : this.props.type === 1 ? columnDBPLDetail : this.props.type === 3 ? columnDBPL : this.props.type === 4 ? columnDBFR : this.props.type === 5 ? columnDBTP : this.props.type === 7 ? columnSummaryBS : this.props.type === 21 ? columnDBOI : this.props.type === 6? columnDBCF : this.props.type === 8 ? columnSummaryPL : this.props.type === 9 ? columnSummaryFR : this.props.type === 1
1 ? columnCatPQ : this.props.type === 10
? columnCatPA : columns}
options={options}
/>
</MuiThemeProvider>
</div>
{this.props.type === 1
1
?
{this.props.type === 1
0
?
<div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div>
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