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
be94de8d
Commit
be94de8d
authored
Jan 07, 2021
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deploy
parent
35357351
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
193 additions
and
104 deletions
+193
-104
CashFlowMR.js
src/container/MonthlyReport/CashFlowMR.js
+175
-102
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+18
-2
No files found.
src/container/MonthlyReport/CashFlowMR.js
View file @
be94de8d
...
@@ -112,6 +112,7 @@ export default class CashFlowMR extends Component {
...
@@ -112,6 +112,7 @@ export default class CashFlowMR extends Component {
}
}
}
}
})
})
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
loading
:
false
})
this
.
setState
({
dataTable
,
loading
:
false
})
}
}
})
})
...
@@ -137,152 +138,224 @@ export default class CashFlowMR extends Component {
...
@@ -137,152 +138,224 @@ export default class CashFlowMR extends Component {
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataTable2
=
this
.
state
.
dataTable
const
handleValueFormula
=
(
value
,
tableMeta
,
column
,
periode
,
forecast
)
=>
{
const
handleValueFormula
=
(
tableMeta
,
colIdx
)
=>
{
let
splitFormula
=
String
(
tableMeta
.
rowData
[
3
]).
split
(
'@'
)
// loading = true
// console.log(tableMeta);
// "@44[M-1]#BS"
let
splitFormula
=
String
(
tableMeta
.
rowData
[
3
]).
split
(
/
([
()@
])
/
)
let
baru
=
[]
let
baru
=
[]
let
anjay
=
[]
let
anjay
=
[]
// console.log(splitFormula);
splitFormula
.
map
((
item
,
index
)
=>
{
splitFormula
.
map
((
item
,
index
)
=>
{
let
items
=
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
)
let
items
=
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
)
let
re
=
/^
[
a-zA-Z0-9
]
+$/
;
let
subForm
=
String
(
item
).
substr
(
0
,
Number
(
String
(
item
).
length
)
-
1
)
let
asd
=
''
// console.log(item);
// console.log(items);
// console.log(subForm);
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
if
(
item
!==
""
)
{
if
(
item
!==
""
)
{
if
(
!
re
.
test
(
items
))
{
if
(
items
==
']'
)
{
if
(
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
)
===
']'
)
{
baru
.
push
(
String
(
item
))
baru
.
push
(
String
(
item
))
}
else
if
(
!
re
.
test
(
items
))
{
}
else
{
baru
.
push
(
subForm
)
baru
.
push
(
String
(
item
).
substr
(
0
,
Number
(
String
(
item
).
length
)
-
1
))
baru
.
push
(
items
)
baru
.
push
(
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
))
}
}
else
{
}
else
{
baru
.
push
(
String
(
item
))
baru
.
push
(
String
(
item
))
}
}
}
}
})
})
// if (tableMeta.columnIndex == 7) {
// console.log(baru);
// console.log(splitFormula)
let
tambahan
=
false
// console.log(baru)
let
opet
=
""
// }
// console.log(baru)
baru
.
map
((
item
,
index
)
=>
{
baru
.
map
((
item
,
index
)
=>
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
if
(
item
==
'X'
)
{
tambahan
=
true
}
else
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
||
item
==
'('
||
item
==
')'
)
{
anjay
.
push
(
item
)
anjay
.
push
(
item
)
}
else
{
}
else
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
forecast
!==
undefined
)
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
forecastt
=
0
let
tst
=
'@'
+
String
(
item
).
replace
(
'[M-1]'
,
'[M1]'
)
forecast
.
map
((
items
,
index
)
=>
{
// console.log(dataTable2[tableMeta.rowIndex]);
if
(
items
.
periode
==
periode
)
{
// console.log(tableMeta);
forecastt
+=
Number
(
items
.
value
)
console
.
log
(
tst
);
}
let
indexID
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
tst
)
})
// console.log(indexID);
anjay
.
push
(
forecastt
)
}
else
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
'[M1]'
)
let
data
=
tableMeta
.
columnIndex
// console.log(tableMeta.columnIndex)
let
indexID
=
tableMeta
.
rowData
[
data
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
tst
}
`
))
// console.log(indexID)
if
(
indexID
!==
-
1
)
{
if
(
indexID
!==
-
1
)
{
let
valuezz
=
tableMeta
.
rowData
[
data
].
formula
[
indexID
].
value
let
valuezz
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
[
indexID
].
value
// baru.push(valuezz)
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
// console.log(valuezz)
// console.log(valuezz)
;
}
}
}
else
{
}
else
{
// console.log(baru);
let
data
=
tableMeta
.
rowData
[
6
].
formula
==
null
?
[]
:
tableMeta
.
rowData
[
6
].
formula
// console.log(value);
// console.log(data)
let
indexID
=
value
.
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
)
&&
val
.
periode
==
Number
(
this
.
props
.
periode
))
let
indexID
=
data
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
))
// console.log(indexID)
if
(
indexID
!==
-
1
)
{
if
(
indexID
!==
-
1
)
{
// console.log(value.formula[indexID].value)
let
valuezz
=
data
[
indexID
].
value
let
valuezz
=
value
.
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
}
}
}
else
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
}
else
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
''
)
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
if
(
tableMeta
.
columnIndex
===
7
||
tableMeta
.
columnIndex
===
19
)
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
''
)
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
22
]
==
tst
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
6
]
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
// } else if (tableMeta.columnIndex === 19) {
// let indexID = dataTable2.findIndex((val) => val[22] == tst)
// if (indexID !== -1) {
// let valuezz = dataTable2[indexID][7].value !== undefined ? dataTable2[indexID][7].value : dataTable2[indexID][7]
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
}
else
{
let
data
=
tableMeta
.
columnIndex
-
1
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
7
]
==
tst
)
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
7
]
==
tst
)
if
(
indexID
!==
-
1
)
{
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
data
].
value
!==
undefined
?
dataTable2
[
indexID
][
data
].
value
:
dataTable2
[
indexID
][
data
]
let
valuezz
=
dataTable2
[
indexID
][
8
]
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
// console.log(tst, data, tableMeta.rowData[data]);
}
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
7
]
==
item
)
// console.log(dataTable2[indexID])
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
tableMeta
.
columnIndex
].
value
==
undefined
?
dataTable2
[
indexID
][
tableMeta
.
columnIndex
]
:
dataTable2
[
indexID
][
tableMeta
.
columnIndex
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
else
{
}
else
{
if
(
item
===
'(-1)'
)
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
7
]
==
item
)
if
(
item
==
'X-1'
)
{
anjay
.
push
(
-
1
)
anjay
.
push
(
-
1
)
}
else
if
(
tambahan
)
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
opet
=
item
}
else
{
anjay
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
tambahan
=
false
opet
=
""
}
}
else
{
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
indexID
][
colIdx
].
value
if
(
item
==
dataTable2
[
tableMeta
.
rowIndex
][
7
])
{
anjay
.
push
(
0
)
}
else
{
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
if
(
item
===
'(-1)'
)
{
anjay
.
push
(
-
1
)
}
}
}
}
// console.log(item);
}
}
}
}
}
}
})
})
// console.log(tableMeta.rowData[5])
// console.log(splitFormula)
// console.log(baru)
// console.log(baru)
// console.log(anjay)
// console.log(anjay)
let
anjay2
=
[]
let
kurung
=
false
let
item1
=
[]
anjay
.
map
((
item
,
index
)
=>
{
if
(
item
==
"("
)
{
kurung
=
true
}
else
if
(
item
==
")"
)
{
kurung
=
false
anjay2
.
push
(
item1
)
item1
=
[]
}
else
{
if
(
kurung
)
{
item1
.
push
(
item
)
}
else
{
anjay2
.
push
(
item
)
}
}
})
let
total
=
0
let
total
=
0
let
opt
=
""
let
opt
=
""
anjay
.
map
((
item
,
index
)
=>
{
let
totalPrio
=
0
if
(
item
==
"+"
)
{
let
optPrio
=
""
opt
=
"tambah"
let
prio
=
false
}
else
if
(
item
==
"-"
)
{
anjay2
.
map
((
item
,
index
)
=>
{
opt
=
"kurang"
if
(
Array
.
isArray
(
item
))
{
}
else
if
(
item
==
"*"
)
{
prio
=
true
opt
=
"kali"
item
.
map
((
items
,
indexs
)
=>
{
}
else
if
(
item
==
"/"
)
{
if
(
items
==
"+"
)
{
opt
=
"bagi"
optPrio
=
"tambah"
}
else
if
(
items
==
"-"
)
{
optPrio
=
"kurang"
}
else
if
(
items
==
"*"
)
{
optPrio
=
"kali"
}
else
if
(
items
==
"/"
)
{
optPrio
=
"bagi"
}
else
{
if
(
optPrio
==
"tambah"
)
{
totalPrio
=
Number
(
totalPrio
)
+
Number
(
items
)
}
else
if
(
optPrio
==
"kurang"
)
{
totalPrio
=
Number
(
totalPrio
)
-
Number
(
items
)
}
else
if
(
optPrio
==
"kali"
)
{
totalPrio
=
Number
(
totalPrio
)
*
Number
(
items
)
}
else
if
(
optPrio
==
"bagi"
)
{
totalPrio
=
Number
(
totalPrio
)
/
Number
(
items
)
==
NaN
?
0
:
Number
(
totalPrio
)
/
Number
(
items
)
}
else
{
totalPrio
+=
Number
(
items
)
}
}
})
if
(
index
==
anjay2
.
length
-
1
)
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
totalPrio
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
totalPrio
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
totalPrio
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
totalPrio
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
totalPrio
)
}
else
{
total
+=
Number
(
totalPrio
)
}
}
}
else
{
}
else
{
item
=
item
==
""
?
0
:
item
if
(
item
==
"+"
)
{
if
(
opt
==
"tambah"
)
{
opt
=
"tambah"
total
=
Number
(
total
)
+
Number
(
item
)
if
(
prio
)
{
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
total
=
Number
(
total
)
-
Number
(
item
)
prio
=
false
}
else
if
(
opt
==
"kali"
)
{
totalPrio
=
0
total
=
Number
(
total
)
*
Number
(
item
)
optPrio
=
""
}
else
if
(
opt
==
"bagi"
)
{
}
total
=
Number
(
total
)
/
Number
(
item
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
item
)
}
else
if
(
item
==
"-"
)
{
opt
=
"kurang"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
else
if
(
item
==
"*"
)
{
opt
=
"kali"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
else
if
(
item
==
"/"
)
{
opt
=
"bagi"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
else
{
}
else
{
total
+=
Number
(
item
)
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
item
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
item
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
item
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
item
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
item
)
}
else
{
total
+=
Number
(
item
)
}
}
}
}
}
})
})
total
=
R
.
equals
(
total
,
NaN
)
?
"0.0"
:
total
// console.log(dataTable2[tableMeta.rowIndex][22])
// console.log(tableMeta.rowData[5])
// if (tableMeta.rowData[5] == 'Beginning Balance') {
// console.log(baru)
// console.log(anjay)
// console.log(total)
// }
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2
[
tableMeta
.
rowIndex
][
6
].
value
=
total
// // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// } else {
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
// }
return
total
return
total
}
}
...
@@ -385,7 +458,7 @@ export default class CashFlowMR extends Component {
...
@@ -385,7 +458,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
value
,
tableMeta
,
2
)).
toFixed
(
1
)}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
/
>
<
/span> : null
}
<
/span> : null
}
<
/div
>
<
/div
>
...
...
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
be94de8d
...
@@ -169,7 +169,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -169,7 +169,7 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
description
,
item
.
description
,
item
.
corporate_annual_target
.
weight
==
""
?
"0%"
:
item
.
corporate_annual_target
.
weight
,
item
.
corporate_annual_target
.
weight
==
""
?
"0%"
:
item
.
corporate_annual_target
.
weight
,
parentTrue
?
item
.
corporate_annual_target
.
uom
:
item
.
uom
,
parentTrue
?
item
.
corporate_annual_target
.
uom
:
item
.
uom
,
parentTrue
?
item
.
corporate_annual_target
.
kpi_type
==
""
?
null
:
item
.
corporate_annual_target
.
kpi_type
:
item
.
kpi_type
==
""
?
null
:
item
.
kpi_type
,
parentTrue
?
item
.
corporate_annual_target
.
jenis_kpi
==
""
?
null
:
item
.
corporate_annual_target
.
jenis_kpi
:
item
.
jenis_kpi
==
""
?
null
:
item
.
kpi_type
,
// parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
// parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue
?
item
.
corporate_annual_target
.
max_ach
==
""
?
null
:
titleCase
(
item
.
corporate_annual_target
.
max_ach
)
:
item
.
max_ach
==
""
?
null
:
titleCase
(
item
.
max_ach
),
parentTrue
?
item
.
corporate_annual_target
.
max_ach
==
""
?
null
:
titleCase
(
item
.
corporate_annual_target
.
max_ach
)
:
item
.
max_ach
==
""
?
null
:
titleCase
(
item
.
max_ach
),
// parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
// parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
...
@@ -1186,7 +1186,23 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1186,7 +1186,23 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
textAlign
:
'center'
}}
>
<
div
style
=
{{
textAlign
:
'center'
}}
>
{
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
null
:
value
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"black"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
suffix
=
{
"%"
}
value
=
{
Number
(
value
).
toFixed
(
1
)}
disabled
=
{
true
}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale
=
{
1
}
/
>
}
/
>
}
}
<
/div
>
<
/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