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 {
olahDataCashFlow
(
dataTable2
)
{
console
.
log
(
dataTable2
)
let
listCF
=
[]
dataTable2
.
map
((
item
,
index
)
=>
{
dataTable2
.
map
((
item
,
index
)
=>
{
listCF
.
push
(
{
"item_report_id"
:
item
[
1
],
...
...
@@ -377,7 +377,7 @@ export default class CashFlow extends Component {
let
payload
=
{
"submission_id"
:
this
.
props
.
submissionID
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
.
periode
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
6
,
"status"
:
"submitted"
,
"cash_flow"
:
dbcf
...
...
@@ -3197,31 +3197,31 @@ export default class CashFlow extends Component {
<
/div
>
{
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'
)
?
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
olahDataCashFlow
(
dataTable2
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
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
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
// this.state.buttonError ?
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
// :
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
olahDataCashFlow
(
dataTable2
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
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
>
<
/div
>
<
/button
>
<
/div
>
<
/button
>
<
/div>
:
null
}
:
null
}
<
/div
>
<
/div
>
<
/Paper
>
...
...
src/container/MonthlyReport.js
View file @
c540b6a5
...
...
@@ -72,6 +72,7 @@ export default class MonthlyReport extends Component {
isApprovedMB
:
false
,
textRevision
:
''
,
dbCF
:
[],
dbPL
:
[],
PLBSFAMSubmitted
:
false
,
PLID
:
null
,
monthHome
:
null
...
...
@@ -624,9 +625,11 @@ export default class MonthlyReport extends Component {
// // console.log(this.state.lastStatus);
this
.
historyApproval
()
this
.
getLatestPeriodSubmit
()
// this.getCashFlow(type)
// this.getPL(type)
if
(
type
!=
undefined
)
{
this
.
getCashFlow
(
type
)
this
.
getPL
(
type
)
//
this.getCashFlow(type)
//
this.getPL(type)
}
else
{
this
.
setState
({
loading
:
false
})
}
...
...
@@ -1363,44 +1366,22 @@ export default class MonthlyReport extends Component {
})
// console.log(list
CF)
console
.
log
(
this
.
state
.
db
CF
)
this
.
setState
({
dbCF
:
listCF
},
()
=>
{
if
(
type
!=
undefined
)
{
if
(
type
==
'BS'
||
type
==
'FAM'
||
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
this
.
createCashFlow
()
console
.
log
(
'tarik sis'
)
this
.
createCashFlow
()
}
}
})
}
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
}
createCashFlow
(
payload
)
{
console
.
log
(
JSON
.
stringify
(
payload
))
api
.
create
().
createMonthlyReportCF
(
payload
).
then
((
res
)
=>
{
this
.
saveToMonthlyReport
()
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 {
item
.
level
,
item
.
description
,
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_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_ro
:
0
},
item
.
order
,
item
.
profit_detail
.
notes
])
...
...
@@ -1491,28 +1472,28 @@ export default class MonthlyReport extends Component {
item
.
level
,
item
.
description
,
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
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
?
{
value
:
item
.
profit_detail
.
november
,
formula
:
item
.
profit_detail
.
november_formula
}
:
{
value
:
item
.
profit_detail
.
december
,
formula
:
item
.
profit_detail
.
december_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_ro
:
0
},
item
.
order
,
item
.
profit_detail
.
notes
])
...
...
@@ -1541,14 +1522,14 @@ export default class MonthlyReport extends Component {
}
else
{
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.rowData[3]).split('@')
let
baru
=
[]
...
...
@@ -1579,49 +1560,48 @@ export default class MonthlyReport extends Component {
anjay
.
push
(
item
)
}
else
{
if
(
String
(
item
).
includes
(
'#'
))
{
if
(
forecast
!==
undefined
)
{
let
forecastt
=
0
forecast
.
map
((
items
,
index
)
=>
{
if
(
items
.
periode
==
periode
)
{
forecastt
+=
Number
(
items
.
value
)
}
})
anjay
.
push
(
forecastt
)
// if (typeRO !== undefined) {
// let forecastt = 0
// val.item_formula
// forecast.map((items, index) => {
// if (items.periode == periode) {
// forecastt += Number(items.value)
// }
// })
// 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
{
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
{
// 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
)
let
indexID
=
value
.
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
)
&&
val
.
periode
==
Number
(
this
.
state
.
periode
.
periode
))
if
(
indexID
!==
-
1
)
{
let
valuezz
=
0
if
(
typeRO
!=
undefined
)
{
valuezz
=
value
.
formula
[
indexID
].
value_ro
}
else
{
valuezz
=
value
.
formula
[
indexID
].
value
}
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
}
// }
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
22
]
==
item
)
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
7
]
==
item
)
if
(
indexID
!==
-
1
)
{
// if (forecast !== undefined) {
// console.log(dataTable2[indexID])
// console.log(column)
// console.log(dataTable2[indexID][column])
// }
if
(
forecast
!=
undefined
)
{
// console.log(dataTable2[indexID][column])
let
valuezz
=
0
if
(
typeRO
!=
undefined
)
{
valuezz
=
dataTable2
[
indexID
][
column
].
value_ro
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value_ro
}
else
{
valuezz
=
dataTable2
[
indexID
][
column
].
value
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value
}
let
valuezz
=
dataTable2
[
indexID
][
column
].
value
==
undefined
?
dataTable2
[
indexID
][
column
]
:
dataTable2
[
indexID
][
column
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
}
else
{
if
(
item
===
'(-1)'
)
{
...
...
@@ -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
return
total
...
...
@@ -1759,6 +1747,7 @@ export default class MonthlyReport extends Component {
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
5
||
item
[
0
]
==
6
)
{
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
item
[
6
].
value_ro
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
,
'ro'
)
}
})
// console.log(dbPL)
...
...
@@ -1770,31 +1759,33 @@ export default class MonthlyReport extends Component {
payloadPL
(
type
)
{
let
listPL
=
[]
this
.
state
.
dbPL
.
map
((
item
,
index
)
=>
{
if
(
item
[
6
].
value
==
""
||
item
[
6
].
value
==
0
||
item
[
6
].
value
==
"0.0"
)
{
item
[
6
].
value
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
)
listPL
.
push
({
"item_report_id"
:
item
[
1
],
"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
]
})
}
else
{
listPL
.
push
({
"item_report_id"
:
item
[
1
],
"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
]
})
}
// 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_ro
=
this
.
handleValueFormulaDBPLMR
(
item
[
6
],
item
,
6
,
'ro'
)
listPL
.
push
({
"item_report_id"
:
item
[
1
],
"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
]
})
// } else {
// item[6].value = this.handleValueFormulaDBPLMR(item[6], item, 6)
// listPL.push({
// "item_report_id": item[1],
// "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
(
listPL
)
// console.log(this.state.dbPL)
this
.
setState
({
dbPL
:
listPL
},
()
=>
{
if
(
type
!=
undefined
)
{
if
(
type
==
'PL'
)
{
console
.
log
(
'tarik sis'
)
this
.
createPL
()
if
(
type
==
'PL'
)
{
// console.log(this.state.dbPL)
// this.setState({ loading: false })
console
.
log
(
'tarik sis'
)
this
.
createPL
()
}
}
})
...
...
@@ -1814,6 +1805,7 @@ export default class MonthlyReport extends Component {
}
api
.
create
().
createReportPLMR
(
payload
).
then
((
res
)
=>
{
console
.
log
(
res
)
// console.log(this.state.dbPL)
this
.
setState
({
loading
:
false
})
// if (response.data) {
// if (response.data.status === "success") {
...
...
@@ -3016,7 +3008,10 @@ export default class MonthlyReport extends Component {
onClickClose
=
{()
=>
this
.
setState
({
visibleCF
:
false
,
visibleMonthlyReport
:
true
})}
status
=
{
this
.
state
.
status
}
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 {
visibleCFMR
:
true
,
// valueThreshold: 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
()
{
// this.getItemHierarki()
console
.
log
(
this
.
props
.
PLBSFAMSubmitted
)
this
.
handleViewOnly
()
this
.
getSettingControl
()
}
...
...
@@ -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
()
{
let
dataTable2
=
this
.
state
.
dataTable
...
...
@@ -187,7 +259,7 @@ export default class CashFlowMR extends Component {
// console.log(item);
// console.log(items);
// console.log(subForm);
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
if
(
item
!==
""
)
{
if
(
items
==
']'
)
{
...
...
@@ -218,14 +290,14 @@ export default class CashFlowMR extends Component {
// console.log(tst);
let
indexID
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
.
findIndex
((
val
)
=>
val
.
item_formula
==
tst
)
// console.log(indexID);
if
(
indexID
!==
-
1
)
{
let
valuezz
=
dataTable2
[
tableMeta
.
rowIndex
][
6
].
formula
[
indexID
].
value
anjay
.
push
(
valuezz
==
""
?
0
:
valuezz
)
// console.log(valuezz);
}
}
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)
let
indexID
=
data
.
findIndex
((
val
)
=>
val
.
item_formula
==
String
(
`@
${
item
}
`
))
if
(
indexID
!==
-
1
)
{
...
...
@@ -249,7 +321,7 @@ export default class CashFlowMR extends Component {
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
)
{
opet
=
item
}
else
{
anjay
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
anjay
.
push
(
opet
==
''
?
Number
(
item
)
:
Number
(
String
(
opet
+
String
(
item
))))
tambahan
=
false
opet
=
""
}
...
...
@@ -495,7 +567,7 @@ export default class CashFlowMR extends Component {
disabled
=
{
true
}
value
=
{
this
.
props
.
PLBSFAMSubmitted
?
Number
(
tableMeta
.
rowData
[
6
].
value
)
:
Number
(
handleValueFormula
(
tableMeta
,
6
)).
toFixed
(
1
)}
/
>
<
/span>
<
/span
>
:
tableMeta
.
rowData
[
0
]
===
7
?
// <span style={{ fontSize: 12, textAlign: 'right' }}>
...
...
@@ -523,7 +595,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
placeholder
=
""
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
>
<
NumberFormat
...
...
@@ -540,7 +612,7 @@ export default class CashFlowMR extends Component {
type
=
"text"
placeholder
=
""
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
>
:
null
}
...
...
@@ -645,64 +717,18 @@ export default class CashFlowMR extends Component {
<
/div
>
<
/button
>
<
/div
>
{
/* <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>
{
this
.
state
.
viewOnly
&&
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => {
this.backToMonthlyReport('submitted'
)
})}
//
this.state.buttonError ?
//
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
//
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
payloadCF
(
dataTable2
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
...
...
@@ -714,10 +740,8 @@ export default class CashFlowMR extends Component {
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/div
>
<
/button
>
</div>
*/
}
<
/div>
}
<
/div
>
{
/* : null
} */
}
<
/div
>
<
/Paper
>
<
/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