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
c540b6a5
Commit
c540b6a5
authored
Mar 04, 2021
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'GGMAC' into 'master'
update ro pl & mr cf See merge request
!1253
parents
67f70ffb
86d08524
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
224 additions
and
205 deletions
+224
-205
CashFlow.js
src/container/BudgetTahunan/CashFlow.js
+26
-26
MonthlyReport.js
src/container/MonthlyReport.js
+109
-114
CashFlowMR.js
src/container/MonthlyReport/CashFlowMR.js
+89
-65
No files found.
src/container/BudgetTahunan/CashFlow.js
View file @
c540b6a5
...
@@ -336,7 +336,7 @@ export default class CashFlow extends Component {
...
@@ -336,7 +336,7 @@ export default class CashFlow extends Component {
olahDataCashFlow
(
dataTable2
)
{
olahDataCashFlow
(
dataTable2
)
{
console
.
log
(
dataTable2
)
console
.
log
(
dataTable2
)
let
listCF
=
[]
let
listCF
=
[]
dataTable2
.
map
((
item
,
index
)
=>
{
dataTable2
.
map
((
item
,
index
)
=>
{
listCF
.
push
(
listCF
.
push
(
{
{
"item_report_id"
:
item
[
1
],
"item_report_id"
:
item
[
1
],
...
@@ -377,7 +377,7 @@ export default class CashFlow extends Component {
...
@@ -377,7 +377,7 @@ export default class CashFlow extends Component {
let
payload
=
{
let
payload
=
{
"submission_id"
:
this
.
props
.
submissionID
,
"submission_id"
:
this
.
props
.
submissionID
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
.
periode
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
6
,
"report_id"
:
6
,
"status"
:
"submitted"
,
"status"
:
"submitted"
,
"cash_flow"
:
dbcf
"cash_flow"
:
dbcf
...
@@ -3197,31 +3197,31 @@ export default class CashFlow extends Component {
...
@@ -3197,31 +3197,31 @@ export default class CashFlow extends Component {
<
/div
>
<
/div
>
{
this
.
props
.
isApprover
===
true
||
dataTable2
.
length
==
0
?
null
:
{
this
.
props
.
isApprover
===
true
||
dataTable2
.
length
==
0
?
null
:
(
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'
)
?
(
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'
)
?
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
<
button
type
=
"button"
type
=
"button"
// disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick
=
{()
=>
onClick
=
{()
=>
// this.state.buttonError ?
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
// :
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
olahDataCashFlow
(
dataTable2
)
this
.
olahDataCashFlow
(
dataTable2
)
})}
})}
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
outline
:
'none'
,
}}
}}
>
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/button
>
:
null
}
<
/div>
:
null
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/Paper
>
<
/Paper
>
...
...
src/container/MonthlyReport.js
View file @
c540b6a5
...
@@ -72,6 +72,7 @@ export default class MonthlyReport extends Component {
...
@@ -72,6 +72,7 @@ export default class MonthlyReport extends Component {
isApprovedMB
:
false
,
isApprovedMB
:
false
,
textRevision
:
''
,
textRevision
:
''
,
dbCF
:
[],
dbCF
:
[],
dbPL
:
[],
PLBSFAMSubmitted
:
false
,
PLBSFAMSubmitted
:
false
,
PLID
:
null
,
PLID
:
null
,
monthHome
:
null
monthHome
:
null
...
@@ -624,9 +625,11 @@ export default class MonthlyReport extends Component {
...
@@ -624,9 +625,11 @@ export default class MonthlyReport extends Component {
// // console.log(this.state.lastStatus);
// // console.log(this.state.lastStatus);
this
.
historyApproval
()
this
.
historyApproval
()
this
.
getLatestPeriodSubmit
()
this
.
getLatestPeriodSubmit
()
// this.getCashFlow(type)
// this.getPL(type)
if
(
type
!=
undefined
)
{
if
(
type
!=
undefined
)
{
this
.
getCashFlow
(
type
)
//
this.getCashFlow(type)
this
.
getPL
(
type
)
//
this.getPL(type)
}
else
{
}
else
{
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
}
}
...
@@ -1363,44 +1366,22 @@ export default class MonthlyReport extends Component {
...
@@ -1363,44 +1366,22 @@ export default class MonthlyReport extends Component {
})
})
// console.log(list
CF)
console
.
log
(
this
.
state
.
db
CF
)
this
.
setState
({
dbCF
:
listCF
},
()
=>
{
this
.
setState
({
dbCF
:
listCF
},
()
=>
{
if
(
type
!=
undefined
)
{
if
(
type
!=
undefined
)
{
if
(
type
==
'BS'
||
type
==
'FAM'
||
type
==
'PL'
)
{
if
(
type
==
'BS'
||
type
==
'FAM'
||
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
console
.
log
(
'tarik sis'
)
this
.
createCashFlow
()
this
.
createCashFlow
()
}
}
}
}
})
})
}
}
createCashFlow
()
{
createCashFlow
(
payload
)
{
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
}
console
.
log
(
JSON
.
stringify
(
payload
))
console
.
log
(
JSON
.
stringify
(
payload
))
api
.
create
().
createMonthlyReportCF
(
payload
).
then
((
res
)
=>
{
api
.
create
().
createMonthlyReportCF
(
payload
).
then
((
res
)
=>
{
this
.
saveToMonthlyReport
()
console
.
log
(
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';
// })
// }
})
})
}
}
...
@@ -1448,28 +1429,28 @@ export default class MonthlyReport extends Component {
...
@@ -1448,28 +1429,28 @@ export default class MonthlyReport extends Component {
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
this
.
state
.
month
.
month_id
==
1
?
this
.
state
.
month
.
month_id
==
1
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
2
?
this
.
state
.
month
.
month_id
==
2
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
3
?
this
.
state
.
month
.
month_id
==
3
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
4
?
this
.
state
.
month
.
month_id
==
4
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
5
?
this
.
state
.
month
.
month_id
==
5
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
6
?
this
.
state
.
month
.
month_id
==
6
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
7
?
this
.
state
.
month
.
month_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
8
?
this
.
state
.
month
.
month_id
==
8
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
9
?
this
.
state
.
month
.
month_id
==
9
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
10
?
this
.
state
.
month
.
month_id
==
10
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
11
?
this
.
state
.
month
.
month_id
==
11
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
,
value_ro
:
0
}
:
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
},
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
,
value_ro
:
0
},
item
.
order
,
item
.
order
,
item
.
profit_detail
.
notes
item
.
profit_detail
.
notes
])
])
...
@@ -1491,28 +1472,28 @@ export default class MonthlyReport extends Component {
...
@@ -1491,28 +1472,28 @@ export default class MonthlyReport extends Component {
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
this
.
state
.
month
.
month_id
==
1
?
this
.
state
.
month
.
month_id
==
1
?
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
}
:
{
value
:
item
.
profit_detail
.
january
,
formula
:
item
.
profit_detail
.
january_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
2
?
this
.
state
.
month
.
month_id
==
2
?
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
}
:
{
value
:
item
.
profit_detail
.
february
,
formula
:
item
.
profit_detail
.
february_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
3
?
this
.
state
.
month
.
month_id
==
3
?
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
}
:
{
value
:
item
.
profit_detail
.
march
,
formula
:
item
.
profit_detail
.
march_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
4
?
this
.
state
.
month
.
month_id
==
4
?
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
}
:
{
value
:
item
.
profit_detail
.
april
,
formula
:
item
.
profit_detail
.
april_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
5
?
this
.
state
.
month
.
month_id
==
5
?
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
}
:
{
value
:
item
.
profit_detail
.
may
,
formula
:
item
.
profit_detail
.
may_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
6
?
this
.
state
.
month
.
month_id
==
6
?
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
}
:
{
value
:
item
.
profit_detail
.
june
,
formula
:
item
.
profit_detail
.
june_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
7
?
this
.
state
.
month
.
month_id
==
7
?
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
}
:
{
value
:
item
.
profit_detail
.
july
,
formula
:
item
.
profit_detail
.
july_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
8
?
this
.
state
.
month
.
month_id
==
8
?
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
}
:
{
value
:
item
.
profit_detail
.
august
,
formula
:
item
.
profit_detail
.
august_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
9
?
this
.
state
.
month
.
month_id
==
9
?
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
}
:
{
value
:
item
.
profit_detail
.
september
,
formula
:
item
.
profit_detail
.
september_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
10
?
this
.
state
.
month
.
month_id
==
10
?
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
}
:
{
value
:
item
.
profit_detail
.
october
,
formula
:
item
.
profit_detail
.
october_formula
,
value_ro
:
0
}
:
this
.
state
.
month
.
month_id
==
11
?
this
.
state
.
month
.
month_id
==
11
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
,
value_ro
:
0
}
:
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
},
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_formula
,
value_ro
:
0
},
item
.
order
,
item
.
order
,
item
.
profit_detail
.
notes
item
.
profit_detail
.
notes
])
])
...
@@ -1541,14 +1522,14 @@ export default class MonthlyReport extends Component {
...
@@ -1541,14 +1522,14 @@ export default class MonthlyReport extends Component {
}
else
{
}
else
{
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
saveDraft
:
true
,
refresh
:
false
})
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
saveDraft
:
true
,
refresh
:
false
})
}
}
console
.
log
(
dataTable
);
//
console.log(dataTable);
})
})
})
})
})
})
}
}
handleValueFormulaDBPLMR
=
(
value
,
tableMeta
,
column
,
periode
,
forecast
)
=>
{
handleValueFormulaDBPLMR
=
(
value
,
tableMeta
,
column
,
typeRO
)
=>
{
let
splitFormula
=
String
(
tableMeta
[
3
]).
split
(
/
([
()@
])
/
)
let
splitFormula
=
String
(
tableMeta
[
3
]).
split
(
/
([
()@
])
/
)
// let splitFormula = String(tableMeta.rowData[3]).split('@')
// let splitFormula = String(tableMeta.rowData[3]).split('@')
let
baru
=
[]
let
baru
=
[]
...
@@ -1579,49 +1560,48 @@ export default class MonthlyReport extends Component {
...
@@ -1579,49 +1560,48 @@ export default class MonthlyReport extends Component {
anjay
.
push
(
item
)
anjay
.
push
(
item
)
}
else
{
}
else
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
forecast
!==
undefined
)
{
// if (typeRO !== undefined) {
let
forecastt
=
0
// let forecastt = 0
forecast
.
map
((
items
,
index
)
=>
{
// val.item_formula
if
(
items
.
periode
==
periode
)
{
// forecast.map((items, index) => {
forecastt
+=
Number
(
items
.
value
)
// if (items.periode == periode) {
}
// forecastt += Number(items.value)
})
// }
anjay
.
push
(
forecastt
)
// })
// anjay.push(forecastt)
// } else {
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
// let tst = String(item).replace('[M-1]', '')
// let data = column == 7 ? 18 : column - 1
// let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
// let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// if (indexID !== -1) {
// let valuezz = tableMeta.rowData[data].formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
}
else
{
}
else
{
if
(
String
(
item
).
includes
(
'[M-1]'
))
{
let
indexID
=
value
.
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
)
&&
val
.
periode
==
Number
(
this
.
state
.
periode
.
periode
))
// let tst = String(item).replace('[M-1]', '')
if
(
indexID
!==
-
1
)
{
// let data = column == 7 ? 18 : column - 1
let
valuezz
=
0
// let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
if
(
typeRO
!=
undefined
)
{
// let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
valuezz
=
value
.
formula
[
indexID
].
value_ro
}
else
{
// if (indexID !== -1) {
valuezz
=
value
.
formula
[
indexID
].
value
// let valuezz = tableMeta.rowData[data].formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
}
else
{
// console.log(item)
// console.log(value.formula)
let
indexID
=
value
.
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
)
&&
val
.
periode
==
Number
(
this
.
state
.
periode
.
periode
))
if
(
indexID
!==
-
1
)
{
let
valuezz
=
value
.
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
}
}
// }
}
else
{
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
22
]
==
item
)
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
7
]
==
item
)
if
(
indexID
!==
-
1
)
{
if
(
indexID
!==
-
1
)
{
// if (forecast !== undefined) {
let
valuezz
=
0
// console.log(dataTable2[indexID])
if
(
typeRO
!=
undefined
)
{
// console.log(column)
valuezz
=
dataTable2
[
indexID
][
column
].
value_ro
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value_ro
// console.log(dataTable2[indexID][column])
}
else
{
valuezz
=
dataTable2
[
indexID
][
column
].
value
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value
// }
if
(
forecast
!=
undefined
)
{
// console.log(dataTable2[indexID][column])
}
}
let
valuezz
=
dataTable2
[
indexID
][
column
].
value
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
else
{
}
else
{
if
(
item
===
'(-1)'
)
{
if
(
item
===
'(-1)'
)
{
...
@@ -1750,6 +1730,14 @@ export default class MonthlyReport extends Component {
...
@@ -1750,6 +1730,14 @@ export default class MonthlyReport extends Component {
}
}
})
})
if
(
tableMeta
[
5
]
==
"Direct Material"
&&
typeRO
!=
undefined
)
{
console
.
log
(
splitFormula
)
console
.
log
(
baru
)
console
.
log
(
anjay
)
console
.
log
(
anjay2
)
console
.
log
(
total
)
}
total
=
R
.
equals
(
total
,
NaN
)
?
"0.0"
:
total
total
=
R
.
equals
(
total
,
NaN
)
?
"0.0"
:
total
return
total
return
total
...
@@ -1759,6 +1747,7 @@ export default class MonthlyReport extends Component {
...
@@ -1759,6 +1747,7 @@ export default class MonthlyReport extends Component {
dbPL
.
map
((
item
,
index
)
=>
{
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
)
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
)
{
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
item
[
6
].
value_ro
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
,
'ro'
)
}
}
})
})
// console.log(dbPL)
// console.log(dbPL)
...
@@ -1770,31 +1759,33 @@ export default class MonthlyReport extends Component {
...
@@ -1770,31 +1759,33 @@ export default class MonthlyReport extends Component {
payloadPL
(
type
)
{
payloadPL
(
type
)
{
let
listPL
=
[]
let
listPL
=
[]
this
.
state
.
dbPL
.
map
((
item
,
index
)
=>
{
this
.
state
.
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
6
].
value
==
""
||
item
[
6
].
value
==
0
||
item
[
6
].
value
==
"0.0"
)
{
// if (item[6].value == "" || item[6].value == 0 || item[6].value == "0.0") {
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
listPL
.
push
({
item
[
6
].
value_ro
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
,
'ro'
)
"item_report_id"
:
item
[
1
],
listPL
.
push
({
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
),
"item_report_id"
:
item
[
1
],
"rolling_outlook"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value_ro
).
toFixed
(
1
),
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
),
"notes"
:
item
[
8
]
"rolling_outlook"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value_ro
).
toFixed
(
1
),
})
"notes"
:
item
[
8
]
}
else
{
})
listPL
.
push
({
// } else {
"item_report_id"
:
item
[
1
],
// item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
"actual"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value
).
toFixed
(
1
),
// listPL.push({
"rolling_outlook"
:
item
[
0
]
==
1
?
""
:
Number
(
item
[
6
].
value_ro
).
toFixed
(
1
),
// "item_report_id": item[1],
"notes"
:
item
[
8
]
// "actual": item[0] == 1 ? "" : Number(item[6].value).toFixed(1),
})
// "rolling_outlook": item[0] == 1 ? "" : Number(item[6].value_ro).toFixed(1),
}
// "notes": item[8]
// })
// }
})
})
// console.log(this.state.dbPL)
console
.
log
(
listPL
)
this
.
setState
({
dbPL
:
listPL
},
()
=>
{
this
.
setState
({
dbPL
:
listPL
},
()
=>
{
if
(
type
!=
undefined
)
{
if
(
type
!=
undefined
)
{
if
(
type
==
'PL'
)
{
if
(
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
// console.log(this.state.dbPL)
this
.
createPL
()
// this.setState({ loading: false })
console
.
log
(
'tarik sis'
)
this
.
createPL
()
}
}
}
}
})
})
...
@@ -1814,6 +1805,7 @@ export default class MonthlyReport extends Component {
...
@@ -1814,6 +1805,7 @@ export default class MonthlyReport extends Component {
}
}
api
.
create
().
createReportPLMR
(
payload
).
then
((
res
)
=>
{
api
.
create
().
createReportPLMR
(
payload
).
then
((
res
)
=>
{
console
.
log
(
res
)
console
.
log
(
res
)
// console.log(this.state.dbPL)
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
// if (response.data) {
// if (response.data) {
// if (response.data.status === "success") {
// if (response.data.status === "success") {
...
@@ -3016,7 +3008,10 @@ export default class MonthlyReport extends Component {
...
@@ -3016,7 +3008,10 @@ export default class MonthlyReport extends Component {
onClickClose
=
{()
=>
this
.
setState
({
visibleCF
:
false
,
visibleMonthlyReport
:
true
})}
onClickClose
=
{()
=>
this
.
setState
({
visibleCF
:
false
,
visibleMonthlyReport
:
true
})}
status
=
{
this
.
state
.
status
}
status
=
{
this
.
state
.
status
}
lastStatus
=
{
this
.
state
.
lastStatus
}
lastStatus
=
{
this
.
state
.
lastStatus
}
PLBSFAMSubmitted
=
{
this
.
state
.
PLBSFAMSubmitted
}
isApprover
=
{
this
.
state
.
isApprover
}
prevRevision
=
{
this
.
state
.
isSubmit
?
this
.
state
.
prevRevision
:
true
}
PLBSFAMSubmitted
=
{
false
}
createCashFlow
=
{
this
.
createCashFlow
.
bind
(
this
)}
/
>
/
>
)}
)}
...
...
src/container/MonthlyReport/CashFlowMR.js
View file @
c540b6a5
...
@@ -47,13 +47,51 @@ export default class CashFlowMR extends Component {
...
@@ -47,13 +47,51 @@ export default class CashFlowMR extends Component {
visibleCFMR
:
true
,
visibleCFMR
:
true
,
// valueThreshold: 0,
// valueThreshold: 0,
minValue
:
0
,
minValue
:
0
,
maxValue
:
0
maxValue
:
0
,
viewOnly
:
true
}
}
}
}
handleViewOnly
()
{
let
checkApprover
=
false
let
checkLastStatus
=
false
let
checkStatus
=
false
let
checkPrevRev
=
false
if
(
this
.
props
.
isApprover
)
{
checkApprover
=
true
}
else
{
checkApprover
=
false
}
if
(
this
.
props
.
lastStatus
==
'SUBMIT'
||
this
.
props
.
lastStatus
==
'REVISION'
)
{
checkLastStatus
=
true
}
else
{
checkLastStatus
=
false
}
if
(
this
.
props
.
prevRevision
)
{
checkPrevRev
=
true
}
else
{
checkPrevRev
=
false
}
if
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'drat'
||
this
.
props
.
status
===
'submitted'
)
{
checkStatus
=
true
}
else
{
checkStatus
=
false
}
// console.log(checkStatus)
// console.log(checkLastStatus)
// console.log(checkApprover)
// console.log(checkPrevRev)
this
.
setState
({
viewOnly
:
!
checkApprover
&&
checkLastStatus
&&
checkStatus
&&
checkPrevRev
})
}
componentDidMount
()
{
componentDidMount
()
{
// this.getItemHierarki()
// this.getItemHierarki()
console
.
log
(
this
.
props
.
PLBSFAMSubmitted
)
console
.
log
(
this
.
props
.
PLBSFAMSubmitted
)
this
.
handleViewOnly
()
this
.
getSettingControl
()
this
.
getSettingControl
()
}
}
...
@@ -170,6 +208,40 @@ export default class CashFlowMR extends Component {
...
@@ -170,6 +208,40 @@ export default class CashFlowMR extends Component {
}
}
}
}
payloadCF
(
dataTable2
)
{
let
listCF
=
[]
console
.
log
(
dataTable2
)
dataTable2
.
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)
// })
// }
})
this
.
createCashFlow
(
listCF
)
}
createCashFlow
(
listCF
)
{
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
13
,
"status"
:
"submitted"
,
"months"
:
this
.
props
.
month
.
month_id
,
"cash_flow"
:
listCF
}
this
.
props
.
createCashFlow
(
payload
)
}
render
()
{
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataTable2
=
this
.
state
.
dataTable
...
@@ -187,7 +259,7 @@ export default class CashFlowMR extends Component {
...
@@ -187,7 +259,7 @@ export default class CashFlowMR extends Component {
// console.log(item);
// console.log(item);
// console.log(items);
// console.log(items);
// console.log(subForm);
// console.log(subForm);
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
if
(
item
!==
""
)
{
if
(
item
!==
""
)
{
if
(
items
==
']'
)
{
if
(
items
==
']'
)
{
...
@@ -218,14 +290,14 @@ export default class CashFlowMR extends Component {
...
@@ -218,14 +290,14 @@ export default class CashFlowMR extends Component {
// console.log(tst);
// console.log(tst);
let
indexID
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
tst
)
let
indexID
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
tst
)
// console.log(indexID);
// console.log(indexID);
if
(
indexID
!==
-
1
)
{
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
[
indexID
].
value
let
valuezz
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
// console.log(valuezz);
// console.log(valuezz);
}
}
}
else
{
}
else
{
let
data
=
tableMeta
.
rowData
[
6
].
formula
==
null
?
[]
:
tableMeta
.
rowData
[
6
].
formula
let
data
=
tableMeta
.
rowData
[
6
].
formula
==
null
?
[]
:
tableMeta
.
rowData
[
6
].
formula
// console.log(data)
// console.log(data)
let
indexID
=
data
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
))
let
indexID
=
data
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
))
if
(
indexID
!==
-
1
)
{
if
(
indexID
!==
-
1
)
{
...
@@ -249,7 +321,7 @@ export default class CashFlowMR extends Component {
...
@@ -249,7 +321,7 @@ export default class CashFlowMR extends Component {
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
opet
=
item
opet
=
item
}
else
{
}
else
{
anjay
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
anjay
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
tambahan
=
false
tambahan
=
false
opet
=
""
opet
=
""
}
}
...
@@ -495,7 +567,7 @@ export default class CashFlowMR extends Component {
...
@@ -495,7 +567,7 @@ export default class CashFlowMR extends Component {
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
/
>
<
/span>
<
/span
>
:
:
tableMeta
.
rowData
[
0
]
===
7
?
tableMeta
.
rowData
[
0
]
===
7
?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
// <span style={{ fontSize: 12, textAlign: 'right' }}>
...
@@ -523,7 +595,7 @@ export default class CashFlowMR extends Component {
...
@@ -523,7 +595,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
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
>
<
LightTooltip
title
=
{
this
.
state
.
minValue
===
null
?
null
:
`Value Should be (
${
this
.
state
.
minValue
}
) up to (
${
this
.
state
.
maxValue
}
)`
}
arrow
>
<
NumberFormat
<
NumberFormat
...
@@ -540,7 +612,7 @@ export default class CashFlowMR extends Component {
...
@@ -540,7 +612,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
/
>
<
/LightTooltip
>
<
/LightTooltip
>
:
null
}
:
null
}
...
@@ -645,64 +717,18 @@ export default class CashFlowMR extends Component {
...
@@ -645,64 +717,18 @@ export default class CashFlowMR extends Component {
<
/div
>
<
/div
>
<
/button
>
<
/button
>
<
/div
>
<
/div
>
{
/* <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{
this
.
state
.
viewOnly
&&
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false })
// this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft === true ?
null :
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('draft')
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<
button
<
button
type
=
"button"
type
=
"button"
// disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick
=
{()
=>
onClick
=
{()
=>
this.state.buttonError ?
//
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
//
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
//
:
this.state.handleTekTekTek == 1 ? null :
this
.
state
.
handleTekTekTek
==
1
?
null
:
this.setState({ handleTekTekTek: 1 }, () => {
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this.backToMonthlyReport('submitted'
)
this
.
payloadCF
(
dataTable2
)
})}
})}
style
=
{{
style
=
{{
backgroundColor
:
'transparent'
,
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
...
@@ -714,10 +740,8 @@ export default class CashFlowMR extends Component {
...
@@ -714,10 +740,8 @@ export default class CashFlowMR extends Component {
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/div
>
<
/div
>
<
/button
>
<
/button
>
</div>
*/
}
<
/div>
}
<
/div
>
<
/div
>
{
/* : null
} */
}
<
/div
>
<
/div
>
<
/Paper
>
<
/Paper
>
<
/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