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
2af9b4e4
Commit
2af9b4e4
authored
Jan 20, 2021
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
Didam See merge request
!1004
parents
d9a1f719
afd8c0a8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
365 additions
and
5 deletions
+365
-5
index.js
src/api/index.js
+3
-1
MonthlyReport.js
src/container/MonthlyReport.js
+359
-1
CashFlowMR.js
src/container/MonthlyReport/CashFlowMR.js
+3
-3
No files found.
src/api/index.js
View file @
2af9b4e4
...
...
@@ -288,6 +288,7 @@ const create = (type = "") => {
const
createMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/fam/monthly_report/create_monthly_report'
,
body
)
const
createMonthlyReportOI
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/monthly_report/create_monthly_report'
,
body
)
const
createMonthlyReportCAT
=
(
body
)
=>
api
.
post
(
'transaction/cat/monthly_report/create_monthly_report'
,
body
)
const
createMonthlyReportCF
=
(
body
)
=>
api
.
post
(
'transaction/cash_flow/monthly_report/create_monthly_report'
,
body
)
// const checkUploadMonthlyReportTP = (body) => api.post('transaction/monthly_report_tp/check_import', body)
const
checkUploadMonthlyReportTP
=
(
body
)
=>
api
.
post
(
'transaction/tax_planning/monthly_report/check_import'
,
body
)
const
checkUploadMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/fam/monthly_report/check_import'
,
body
)
...
...
@@ -568,7 +569,8 @@ const create = (type = "") => {
createPeriodeRevisionMonthly
,
getListUserSubcoMB
,
getListUserSubcoMR
,
validateSubmitReportFAM
validateSubmitReportFAM
,
createMonthlyReportCF
}
}
...
...
src/container/MonthlyReport.js
View file @
2af9b4e4
...
...
@@ -69,7 +69,8 @@ export default class MonthlyReport extends Component {
selectedStatus
:
[],
detailRevisiCheck
:
[],
isApprovedMB
:
false
,
textRevision
:
''
textRevision
:
''
,
dbCF
:
[]
}
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -599,6 +600,7 @@ export default class MonthlyReport extends Component {
// // console.log(this.state.lastStatus);
this
.
historyApproval
()
this
.
getLatestPeriodSubmit
()
this
.
getCashFlow
()
// this.getReport()
// this.getReportAttachment()
api
.
create
().
checkApproverMonthly
().
then
(
response
=>
{
...
...
@@ -991,10 +993,366 @@ export default class MonthlyReport extends Component {
if
(
type
==
'revision'
)
{
api
.
create
().
createPeriodeRevisionMonthly
(
payload
).
then
((
res
))
}
if
(
type
==
"approve"
)
{
this
.
createCashFlow
()
}
this
.
getMonthlyReportID
()
})
}
getCashFlow
()
{
let
payload
=
{
"report_id"
:
13
,
"revision"
:
Number
(
this
.
state
.
lastRevision
),
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"monthly_report_id"
:
this
.
state
.
monthlyReportId
,
"months"
:
this
.
state
.
month
.
month_id
,
"get_for"
:
"edit"
}
api
.
create
().
getHierarkiMontlyReportCF
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
{
value
:
item
.
cash_flow
.
actual
,
formula
:
item
.
cash_flow
.
actual_formula
},
item
.
order
,
false
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
{
value
:
item
.
cash_flow
.
actual
,
formula
:
item
.
cash_flow
.
actual_formula
},
item
.
order
,
false
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
console
.
log
(
dataTable
)
this
.
setState
({
dbCF
:
dataTable
,
loading
:
false
},
()
=>
{
this
.
olahDataCashFlow
(
this
.
state
.
dbCF
)
})
}
})
}
handleValueFormula
=
(
item
,
indexS
)
=>
{
// loading = true
// console.log(tableMeta);
// "@44[M-1]#BS"
let
dbCF
=
this
.
state
.
dbCF
let
splitFormula
=
String
(
item
[
3
]).
split
(
/
([
()@
])
/
)
let
baru
=
[]
let
anjay
=
[]
// console.log(splitFormula);
splitFormula
.
map
((
item
,
index
)
=>
{
let
items
=
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
)
let
subForm
=
String
(
item
).
substr
(
0
,
Number
(
String
(
item
).
length
)
-
1
)
// console.log(item);
// console.log(items);
// console.log(subForm);
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
if
(
item
!==
""
)
{
if
(
items
==
']'
)
{
baru
.
push
(
String
(
item
))
}
else
if
(
!
re
.
test
(
items
))
{
baru
.
push
(
subForm
)
baru
.
push
(
items
)
}
else
{
baru
.
push
(
String
(
item
))
}
}
})
// console.log(baru);
let
tambahan
=
false
let
opet
=
""
let
itung2x
=
''
baru
.
map
((
item
,
index
)
=>
{
if
(
item
==
'X'
)
{
tambahan
=
true
}
else
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
||
item
==
'('
||
item
==
')'
)
{
anjay
.
push
(
item
)
}
else
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
tst
=
'@'
+
String
(
item
).
replace
(
'[M-1]'
,
'[M1]'
)
// console.log(dbCF[tableMeta.rowIndex]);
// console.log(tableMeta);
// console.log(tst);
let
indexID
=
dbCF
[
indexS
][
6
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
tst
)
// console.log(indexID);
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dbCF
[
indexS
][
6
].
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
// console.log(valuezz);
}
}
else
{
let
data
=
dbCF
[
indexS
][
6
].
formula
==
null
?
[]
:
dbCF
[
indexS
][
6
].
formula
// console.log(data)
let
indexID
=
data
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
))
if
(
indexID
!==
-
1
)
{
let
valuezz
=
data
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
}
else
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
tst
=
String
(
item
).
replace
(
'[M-1]'
,
''
)
let
indexID
=
dbCF
.
findIndex
((
val
)
=>
val
[
7
]
==
tst
)
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dbCF
[
indexID
][
8
]
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
let
indexID
=
dbCF
.
findIndex
((
val
)
=>
val
[
7
]
==
item
)
if
(
item
==
'X-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
=
dbCF
[
indexID
][
6
].
value
if
(
item
==
dbCF
[
indexS
][
7
])
{
anjay
.
push
(
0
)
}
else
{
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
else
{
if
(
item
===
'(-1)'
)
{
anjay
.
push
(
-
1
)
}
}
}
}
}
}
})
// console.log(item[5])
// console.log(splitFormula)
// console.log(baru)
// 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
opt
=
""
let
totalPrio
=
0
let
optPrio
=
""
let
prio
=
false
anjay2
.
map
((
item
,
index
)
=>
{
if
(
Array
.
isArray
(
item
))
{
prio
=
true
item
.
map
((
items
,
indexs
)
=>
{
if
(
items
==
"+"
)
{
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
{
if
(
item
==
"+"
)
{
opt
=
"tambah"
if
(
prio
)
{
total
=
Number
(
Number
(
totalPrio
)
+
Number
(
total
))
prio
=
false
totalPrio
=
0
optPrio
=
""
}
}
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
{
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
)
}
}
}
})
// dataTable2[tableMeta.rowIndex][6].value = total
return
total
}
olahDataCashFlow
(
dbCF
)
{
dbCF
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
)
{
item
[
6
].
value
=
this
.
handleValueFormula
(
item
,
index
)
}
})
// console.log(dbCF)
this
.
setState
({
dbCF
},
()
=>
{
this
.
payloadCF
()
})
}
payloadCF
()
{
let
listCF
=
[]
this
.
state
.
dbCF
.
map
((
item
,
index
)
=>
{
if
(
item
[
6
].
value
==
""
||
item
[
6
].
value
==
0
||
item
[
6
].
value
==
"0.0"
)
{
item
[
6
].
value
=
this
.
handleValueFormula
(
item
,
index
)
listCF
.
push
({
"item_report_id"
:
item
[
1
],
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
)
})
}
else
{
listCF
.
push
({
"item_report_id"
:
item
[
1
],
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
)
})
}
})
// console.log(listCF)
this
.
setState
({
dbCF
:
listCF
})
}
createCashFlow
()
{
let
payload
=
{
"monthly_report_id"
:
this
.
state
.
monthlyReportId
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_id"
:
13
,
"status"
:
"submitted"
,
"months"
:
this
.
state
.
month
.
month_id
,
"cash_flow"
:
this
.
state
.
dbCF
}
api
.
create
().
createMonthlyReportCF
(
payload
).
then
((
res
)
=>
{
console
.
log
(
res
)
// if (response.data) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport()
// } else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ loading: false }, () => {
// // this.getSubmission()
// document.body.style.overflow = 'unset';
// })
// }
})
}
render
()
{
const
columns
=
[
"#"
,
"Report Type"
,
{
...
...
src/container/MonthlyReport/CashFlowMR.js
View file @
2af9b4e4
...
...
@@ -492,7 +492,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
value
=
{
this
.
props
.
status
==
'approved'
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
<
/span>
:
...
...
@@ -522,7 +522,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
value
=
{
this
.
props
.
status
==
'approved'
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/>
:
<
LightTooltip
title
=
{
this
.
state
.
minValue
===
null
?
null
:
`Value Should be (
${
this
.
state
.
minValue
}
) up to (
${
this
.
state
.
maxValue
}
)`
}
arrow
>
<
NumberFormat
...
...
@@ -539,7 +539,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
value
=
{
this
.
props
.
status
==
'approved'
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
<
/LightTooltip
>
:
null
}
...
...
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