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
f94b40ab
Commit
f94b40ab
authored
May 29, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev/riri' into 'ENV-DEV'
Update Monthly Currency See merge request
!1818
parents
3f0d787f
a65e5958
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
349 additions
and
30 deletions
+349
-30
EditApprovalMatrix.js
src/container/ApprovalMatrix/EditApprovalMatrix.js
+3
-1
MonthlyReport.js
src/container/MonthlyReport/MonthlyReport.js
+118
-13
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+12
-2
SubHolding.js
src/container/Reports/SubHolding.js
+123
-12
RollingOutlook.js
src/container/RollingOutlook/RollingOutlook.js
+93
-2
No files found.
src/container/ApprovalMatrix/EditApprovalMatrix.js
View file @
f94b40ab
...
...
@@ -51,7 +51,7 @@ export default class EditApprovalMatrix extends Component {
getDetailAM
()
{
api
.
create
().
getDetailAM
(
this
.
props
.
data
[
1
]).
then
(
response
=>
{
//
console.log(response)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
...
...
@@ -89,6 +89,8 @@ export default class EditApprovalMatrix extends Component {
getUserData
()
{
api
.
create
().
getApprovedByAM
().
then
((
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
this
.
state
.
getUserId
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
...
...
src/container/MonthlyReport/MonthlyReport.js
View file @
f94b40ab
...
...
@@ -95,7 +95,21 @@ export default class MonthlyReport extends Component {
isCheckAll
:
false
,
downloadedFileReportId
:
null
,
arrayReport
:
[],
popupDownload
:
false
popupDownload
:
false
,
defaultCurrency
:
null
,
dataCurrency
:
[],
currency
:
[],
visibleAlertSave
:
false
,
dataCurrency
:
[
{
"id"
:
1
,
"value"
:
"IDR"
},
{
"id"
:
2
,
"value"
:
"USD"
,
}
]
}
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -237,6 +251,7 @@ export default class MonthlyReport extends Component {
"periode"
:
this
.
state
.
periode
.
periode
,
"report_type"
:
"Monthly Report"
,
"months"
:
this
.
state
.
month
.
month_id
,
"currency_id"
:
this
.
state
.
defaultCurrency
.
id
}
api
.
create
().
getMonthlyReport
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
...
...
@@ -308,6 +323,7 @@ export default class MonthlyReport extends Component {
};
this
.
setState
({
listCompany
:
defaultProps
,
company
:
companyData
[
0
],
company_active
:
defaultProps
},
()
=>
{
this
.
getMonth
()
this
.
getCurrency
(
this
.
state
.
company
.
company_id
)
// console.log(this.state.company_active)
})
}
else
{
...
...
@@ -459,6 +475,51 @@ export default class MonthlyReport extends Component {
})
}
getCurrency
(
companyID
)
{
console
.
log
(
companyID
);
api
.
create
().
getDetailPerusahaan
(
companyID
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
datas
=
[]
if
(
response
.
data
.
data
.
currency
.
length
>
0
)
{
response
.
data
.
data
.
currency
.
map
((
item
)
=>
{
// console.log(item);
datas
.
push
({
id
:
item
.
currencyId
,
value
:
item
.
currencyName
})
})
}
let
index
=
datas
.
findIndex
((
val
)
=>
val
.
id
==
response
.
data
.
data
.
default_currency
)
this
.
setState
({
defaultCurrencyID
:
response
.
data
.
data
.
default_currency
,
currency
:
datas
,
defaultCurrency
:
index
==
-
1
?
null
:
datas
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
...
...
@@ -548,9 +609,10 @@ export default class MonthlyReport extends Component {
}
// console.log(response.data.data.length)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
indexID
==
null
?
arrayBaru
[
0
]
:
arrayBaru
[
indexID
],
company_submit
:
defaultProps
},
()
=>
{
// console.log(response.data.data.length
)
console
.
log
(
this
.
state
.
company
)
if
(
response
.
data
.
data
.
length
>
0
)
{
this
.
getRevision
()
this
.
getCurrency
(
this
.
state
.
company
.
company_id
)
}
else
{
// console.log(this.state.listCompany)
// console.log(this.state.company_submit)
...
...
@@ -1817,13 +1879,13 @@ 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
)
}
//
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
...
...
@@ -2266,7 +2328,7 @@ export default class MonthlyReport extends Component {
// }
async
handleGenerateReport
(
data
)
{
let
{
selectReport
,
monthlyReportId
,
company
,
periode
,
revisionTable
,
month
,
downloadedFileReportId
}
=
this
.
state
let
{
selectReport
,
monthlyReportId
,
company
,
periode
,
revisionTable
,
month
,
downloadedFileReportId
,
defaultCurrency
}
=
this
.
state
if
(
selectReport
.
length
>
0
)
{
let
result
=
[]
console
.
log
(
'mulai hit'
)
...
...
@@ -2274,9 +2336,9 @@ export default class MonthlyReport extends Component {
let
urlReport
=
items
===
8
?
"profit_loss"
:
items
===
12
?
"tax_planning"
:
items
===
7
?
"balance_sheet"
:
items
===
9
?
"fam"
:
items
===
13
?
"cash_flow"
:
items
===
11
?
"locf"
:
items
===
10
?
"cat"
:
null
let
datas
=
data
.
findIndex
((
val
)
=>
val
[
4
]
==
items
)
let
report
=
data
[
datas
]
let
url
=
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/
${
urlReport
}
/monthly_report/export_monthly_report?monthly_report_id=
${
monthlyReportId
}
&&report_id=
${
report
[
4
]}
&&company_id=
${
company
.
company_id
}
&&year=
${
periode
.
periode
}
&&revision=
${
report
[
2
]}
&&months=
${
month
.
month_id
}
&&download_file_report_id=
${
downloadedFileReportId
}
`
let
url
=
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/
${
urlReport
}
/monthly_report/export_monthly_report?monthly_report_id=
${
monthlyReportId
}
&&report_id=
${
report
[
4
]}
&&company_id=
${
company
.
company_id
}
&&year=
${
periode
.
periode
}
&&revision=
${
report
[
2
]}
&&months=
${
month
.
month_id
}
&&download_file_report_id=
${
downloadedFileReportId
}
&¤cy_id=
${
defaultCurrency
.
id
}
`
let
res
=
await
fetch
(
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/
${
urlReport
}
/monthly_report/export_monthly_report?monthly_report_id=
${
monthlyReportId
===
null
?
""
:
monthlyReportId
}
&&report_id=
${
report
[
4
]}
&&company_id=
${
company
.
company_id
}
&&year=
${
periode
.
periode
}
&&revision=
${
report
[
2
]}
&&months=
${
month
.
month_id
}
&&download_file_report_id=
${
downloadedFileReportId
}
`
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/
${
urlReport
}
/monthly_report/export_monthly_report?monthly_report_id=
${
monthlyReportId
===
null
?
""
:
monthlyReportId
}
&&report_id=
${
report
[
4
]}
&&company_id=
${
company
.
company_id
}
&&year=
${
periode
.
periode
}
&&revision=
${
report
[
2
]}
&&months=
${
month
.
month_id
}
&&download_file_report_id=
${
downloadedFileReportId
}
&¤cy_id=
${
defaultCurrency
.
id
}
`
)
if
(
res
.
status
===
200
)
{
result
=
[...
result
,
res
];
...
...
@@ -2843,7 +2905,7 @@ export default class MonthlyReport extends Component {
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
,
marginTop
:
20
}}
>
<
Autocomplete
multiple
id
=
"tags-standard"
...
...
@@ -2859,6 +2921,32 @@ export default class MonthlyReport extends Component {
value
=
{
this
.
state
.
selectedStatus
}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Submission Status"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
/>
<
Autocomplete
id
=
"tipe"
disableClearable
options
=
{
this
.
state
.
currency
}
getOptionLabel
=
{(
option
)
=>
option
.
value
}
value
=
{
this
.
state
.
defaultCurrency
}
// onChange={(event, newInputValue) => this.setState({ defaultCurrency: newInputValue })}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
defaultCurrency
:
newInputValue
},
()
=>
{
this
.
getRevision
()
})}
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Currency"
margin
=
"normal"
style
=
{{
marginTop
:
7
,
marginLeft
:
20
}}
/>
}
// renderInput={(params) =>
// <TextField
// {...params}
// variant="standard"
// label="Currency"
// margin="normal"
// style={{ marginTop: 6 }}
// // InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
// // InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
// />
// }
/>
{
/* <Autocomplete
{...this.state.listCompany}
multiple
...
...
@@ -2879,6 +2967,7 @@ export default class MonthlyReport extends Component {
disabled
=
{
this
.
state
.
listCompany
===
null
?
true
:
false
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
,
loading
:
true
},
()
=>
{
this
.
getMonthlyReportID
()
this
.
getCurrency
(
newInputValue
.
company_id
)
})}
disableClearable
style
=
{{
width
:
250
}}
...
...
@@ -3257,6 +3346,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3278,6 +3369,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3300,6 +3393,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3322,6 +3417,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3342,6 +3439,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3363,6 +3462,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3383,6 +3484,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
@@ -3401,6 +3504,8 @@ export default class MonthlyReport extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
monthlyReportId
=
{
this
.
state
.
monthlyReportId
}
...
...
src/container/MonthlyReport/ProfitLossMR.js
View file @
f94b40ab
...
...
@@ -93,7 +93,9 @@ export default class ProfitLossMR extends Component {
saveDraft
:
true
,
buttonError
:
true
,
viewOnly
:
true
,
get_for
:
'view'
get_for
:
'view'
,
defaultCurrencyUpload
:
this
.
props
.
defaultCurrency
,
visibleAlertSave
:
false
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -223,6 +225,7 @@ export default class ProfitLossMR extends Component {
"company_id"
:
this
.
props
.
company
.
company_id
,
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"get_for"
:
this
.
state
.
get_for
}
console
.
log
(
payload
);
...
...
@@ -402,6 +405,7 @@ export default class ProfitLossMR extends Component {
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"profit_loss"
:
data
}
console
.
log
(
payload
);
...
...
@@ -474,7 +478,11 @@ export default class ProfitLossMR extends Component {
}
checkUpload
()
{
api
.
create
().
checkUploadMonthlyReportPL
(
this
.
state
.
payload
).
then
(
response
=>
{
let
payload
=
{
...
this
.
state
.
payload
,
currency_id
:
this
.
state
.
defaultCurrencyUpload
?.
id
}
api
.
create
().
checkUploadMonthlyReportPL
(
payload
).
then
(
response
=>
{
// console.log(JSON.stringify(this.state.payload));
console
.
log
(
response
)
if
(
response
.
data
)
{
...
...
@@ -568,6 +576,7 @@ export default class ProfitLossMR extends Component {
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"status"
:
type
,
"profit_loss"
:
data
}
...
...
@@ -653,6 +662,7 @@ export default class ProfitLossMR extends Component {
"report_id"
:
this
.
props
.
report_id
,
"status"
:
"submitted"
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"profit_loss"
:
data
}
// console.log(JSON.stringify(payload));
...
...
src/container/Reports/SubHolding.js
View file @
f94b40ab
...
...
@@ -14,6 +14,21 @@ import { format } from 'date-fns';
const
Alert
=
withStyles
({
})((
props
)
=>
<
MuiAlert
elevation
=
{
6
}
variant
=
"filled"
{...
props
}
/>
)
;
const
defaultReport
=
[
{
value
:
2
,
label
:
'DB Balance Sheet'
,
report
:
1
},
{
value
:
3
,
label
:
'DB Profit & Loss'
,
report
:
2
},
{
value
:
1
,
label
:
'DB Profit & Loss Detail'
,
report
:
2
},
{
value
:
4
,
label
:
'DB Ratio'
,
report
:
1
},
{
value
:
5
,
label
:
'DB Tax Planning'
,
report
:
1
},
{
value
:
21
,
label
:
'DB Operating Indicator'
,
report
:
1
},
{
value
:
6
,
label
:
'Cash Flow - Summary'
,
report
:
1
},
{
value
:
7
,
label
:
'Balance Sheet - Summary'
,
report
:
1
},
{
value
:
8
,
label
:
'Profit Loss - Summary'
,
report
:
2
},
{
value
:
9
,
label
:
'Financial Ratio - Summary'
,
report
:
1
},
{
value
:
11
,
label
:
'CAT Performance Quarterly'
,
report
:
1
},
{
value
:
10
,
label
:
'CAT Performance Appraisal'
,
report
:
1
},
]
export
default
class
SubHolding
extends
Component
{
constructor
(
props
)
{
super
(
props
)
...
...
@@ -26,19 +41,11 @@ export default class SubHolding extends Component {
company
:
null
,
listPeriode
:
null
,
periode
:
null
,
reportType
:
[
{
value
:
2
,
label
:
'DB Balance Sheet'
},
reportType
:
defaultReport
,
reportType2
:
[
{
value
:
3
,
label
:
'DB Profit & Loss'
},
{
value
:
1
,
label
:
'DB Profit & Loss Detail'
},
{
value
:
4
,
label
:
'DB Ratio'
},
{
value
:
5
,
label
:
'DB Tax Planning'
},
{
value
:
21
,
label
:
'DB Operating Indicator'
},
{
value
:
6
,
label
:
'Cash Flow - Summary'
},
{
value
:
7
,
label
:
'Balance Sheet - Summary'
},
{
value
:
8
,
label
:
'Profit Loss - Summary'
},
{
value
:
9
,
label
:
'Financial Ratio - Summary'
},
{
value
:
11
,
label
:
'CAT Performance Quarterly'
},
{
value
:
10
,
label
:
'CAT Performance Appraisal'
},
],
report
:
null
,
loading
:
false
,
...
...
@@ -51,7 +58,22 @@ export default class SubHolding extends Component {
quarter
:
null
,
uom
:
null
,
approveMB
:
false
,
approveMonthly
:
false
approveMonthly
:
false
,
defaultCurrency
:
null
,
defaultCurrencyID
:
null
,
dataCurrency
:
[],
currency
:
[],
visibleAlertSave
:
false
,
dataCurrency
:
[
{
"id"
:
1
,
"value"
:
"IDR"
},
{
"id"
:
2
,
"value"
:
"USD"
,
}
]
}
}
...
...
@@ -183,6 +205,7 @@ export default class SubHolding extends Component {
let
index
=
arrayBaru
.
findIndex
((
val
)
=>
val
.
company_id
==
comID
)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
arrayBaru
.
length
<
1
?
companyData
[
0
]
:
(
index
==
-
1
?
arrayBaru
[
0
]
:
arrayBaru
[
index
])
},
()
=>
{
this
.
getLastPeriod
()
this
.
getCurrency
(
this
.
state
.
company
.
company_id
)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
...
@@ -200,6 +223,60 @@ export default class SubHolding extends Component {
})
}
getCurrency
(
companyID
)
{
// console.log(companyID);
api
.
create
().
getDetailPerusahaan
(
companyID
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
datas
=
[]
if
(
response
.
data
.
data
.
currency
.
length
>
0
)
{
response
.
data
.
data
.
currency
.
map
((
item
)
=>
{
// console.log(item);
datas
.
push
({
id
:
item
.
currencyId
,
value
:
item
.
currencyName
})
})
}
let
index
=
datas
.
findIndex
((
val
)
=>
val
.
id
==
response
.
data
.
data
.
default_currency
)
this
.
setState
({
defaultCurrencyID
:
response
.
data
.
data
.
default_currency
,
currency
:
datas
,
// report: response.data.data.default_currency == 2 && this.state.defaultCurrency == 1 ? this.state.reportType2[0] : this.state.reportType[0],
defaultCurrency
:
index
==
-
1
?
null
:
datas
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
changeCurrency
(
idCurrency
)
{
if
(
this
.
state
.
defaultCurrencyID
==
2
&&
idCurrency
==
1
)
{
this
.
setState
({
reportType
:
this
.
state
.
reportType2
,
report
:
this
.
state
.
reportType2
[
0
]
})
}
else
{
this
.
setState
({
reportType
:
this
.
state
.
reportType
,
report
:
this
.
state
.
reportType
[
0
]
})
}
}
getLastPeriod
()
{
api
.
create
().
getLastPeriod
(
this
.
state
.
company
.
company_id
).
then
(
response
=>
{
console
.
log
(
response
);
...
...
@@ -354,6 +431,7 @@ export default class SubHolding extends Component {
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"report_type"
:
"Master Budget"
,
"currency_id"
:
this
.
state
.
defaultCurrency
.
id
}
this
.
getApproveMB
()
this
.
getApproveMonthly
()
...
...
@@ -445,7 +523,9 @@ export default class SubHolding extends Component {
"revision"
:
this
.
state
.
revisionType
,
"periode"
:
this
.
state
.
periode
.
periode
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"submission_id"
:
this
.
state
.
submissionID
"submission_id"
:
this
.
state
.
submissionID
,
"currency_id"
:
this
.
state
.
defaultCurrency
.
id
}
if
(
this
.
state
.
report
.
value
===
1
)
{
api
.
create
().
getAllReportPLDetail
(
payload
).
then
(
response
=>
{
...
...
@@ -4174,6 +4254,7 @@ export default class SubHolding extends Component {
}
render
()
{
let
{
defaultCurrencyID
,
report
}
=
this
.
state
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'fixed'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
<
PropagateLoader
...
...
@@ -4254,6 +4335,7 @@ export default class SubHolding extends Component {
disabled
=
{
this
.
state
.
intent
===
'Home'
?
true
:
false
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
,
loading
:
true
,
previewTable
:
false
},
()
=>
{
this
.
getReportType
()
this
.
getCurrency
(
newInputValue
.
company_id
)
})}
disableClearable
style
=
{{
width
:
250
}}
...
...
@@ -4273,6 +4355,35 @@ export default class SubHolding extends Component {
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Months"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
month
}
/> : null : null
}
<
Autocomplete
id
=
"tipe"
disabled
=
{
this
.
state
.
intent
===
'Home'
?
true
:
false
}
options
=
{
this
.
state
.
currency
}
getOptionLabel
=
{(
option
)
=>
option
.
value
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
defaultCurrency
:
newInputValue
,
loading
:
true
,
previewTable
:
false
},
()
=>
{
// console.log(defaultCurrencyID);
// console.log(newInputValue.id);
// if (defaultCurrencyID == 2 && newInputValue.id == 1) {
// this.setState({ report: this.state.reportType2[0], reportType: this.state.reportType2 })
// console.log("report 1");
// } else if (defaultCurrencyID == 2 && newInputValue.id == 2) {
// console.log(this.state.reportType)
// this.setState({ report: defaultReport[0], reportType: defaultReport }, () => {
// console.log(this.state.reportType)
// })
// console.log("report 2");
// }
let
bizpar
=
defaultCurrencyID
==
2
&&
newInputValue
.
id
==
1
?
defaultReport
.
filter
(
e
=>
e
.
report
===
2
)
:
defaultReport
this
.
setState
({
report
:
bizpar
[
0
],
reportType
:
bizpar
})
this
.
getReportType
()
})}
disableClearable
style
=
{{
width
:
250
,
marginLeft
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Currency"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
defaultCurrency
}
/
>
{
/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listUom}
// getOptionLabel={(option) => titleCase(option.label)}
...
...
src/container/RollingOutlook/RollingOutlook.js
View file @
f94b40ab
...
...
@@ -94,7 +94,21 @@ export default class RollingOutlook extends Component {
isCheckAll
:
false
,
downloadedFileReportId
:
null
,
arrayReport
:
[],
popupDownload
:
false
popupDownload
:
false
,
defaultCurrency
:
null
,
dataCurrency
:
[],
currency
:
[],
visibleAlertSave
:
false
,
dataCurrency
:
[
{
"id"
:
1
,
"value"
:
"IDR"
},
{
"id"
:
2
,
"value"
:
"USD"
,
}
]
}
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -221,6 +235,7 @@ export default class RollingOutlook extends Component {
// console.log(response.data.data.length)
if
(
response
.
data
.
data
.
length
>
0
)
{
this
.
getRevision
()
this
.
getCurrency
(
this
.
state
.
company
.
company_id
)
}
else
{
// console.log(this.state.listCompany)
// console.log(this.state.company_submit)
...
...
@@ -249,6 +264,50 @@ export default class RollingOutlook extends Component {
})
}
getCurrency
(
companyID
)
{
// console.log(companyID);
api
.
create
().
getDetailPerusahaan
(
companyID
).
then
(
response
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
let
data
=
response
.
data
.
data
let
datas
=
[]
if
(
response
.
data
.
data
.
currency
.
length
>
0
)
{
response
.
data
.
data
.
currency
.
map
((
item
)
=>
{
// console.log(item);
datas
.
push
({
id
:
item
.
currencyId
,
value
:
item
.
currencyName
})
})
}
let
index
=
datas
.
findIndex
((
val
)
=>
val
.
id
==
response
.
data
.
data
.
default_currency
)
this
.
setState
({
defaultCurrencyID
:
response
.
data
.
data
.
default_currency
,
currency
:
datas
,
defaultCurrency
:
index
==
-
1
?
null
:
datas
[
index
]
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
getReportAttachment
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
...
...
@@ -1881,7 +1940,7 @@ export default class RollingOutlook extends Component {
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Rolling
Outlook
&
CAT
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
...
...
@@ -1901,6 +1960,27 @@ export default class RollingOutlook extends Component {
/>
}
value
=
{
this
.
state
.
periode
}
/
>
<
Autocomplete
id
=
"tipe"
disableClearable
style
=
{{
width
:
250
}}
options
=
{
this
.
state
.
currency
}
getOptionLabel
=
{(
option
)
=>
option
.
value
}
value
=
{
this
.
state
.
defaultCurrency
}
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
defaultCurrency
:
newInputValue
},
()
=>
{
this
.
getRevision
()
})}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
variant
=
"standard"
label
=
"Currency"
margin
=
"normal"
style
=
{{
marginLeft
:
25
,
marginTop
:
7
}}
/
>
}
/
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
Autocomplete
...
...
@@ -1946,6 +2026,7 @@ export default class RollingOutlook extends Component {
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
this
.
getCurrency
(
newInputValue
.
company_id
)
})}
disableClearable
style
=
{{
width
:
250
}}
...
...
@@ -2328,6 +2409,8 @@ export default class RollingOutlook extends Component {
open
=
{
this
.
props
.
open
}
report_id
=
{
this
.
state
.
report_id
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
rollingOutlookID
=
{
this
.
state
.
rollingOutlookID
}
...
...
@@ -2348,6 +2431,8 @@ export default class RollingOutlook extends Component {
open
=
{
this
.
props
.
open
}
report_id
=
{
this
.
state
.
report_id
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
rollingOutlookID
=
{
this
.
state
.
rollingOutlookID
}
...
...
@@ -2368,6 +2453,8 @@ export default class RollingOutlook extends Component {
open
=
{
this
.
props
.
open
}
report_id
=
{
this
.
state
.
report_id
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
rollingOutlookID
=
{
this
.
state
.
rollingOutlookID
}
...
...
@@ -2388,6 +2475,8 @@ export default class RollingOutlook extends Component {
open
=
{
this
.
props
.
open
}
report_id
=
{
this
.
state
.
report_id
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
rollingOutlookID
=
{
this
.
state
.
rollingOutlookID
}
...
...
@@ -2409,6 +2498,8 @@ export default class RollingOutlook extends Component {
open
=
{
this
.
props
.
open
}
report_id
=
{
this
.
state
.
report_id
}
company
=
{
this
.
state
.
company
}
defaultCurrency
=
{
this
.
state
.
defaultCurrency
}
currency
=
{
this
.
state
.
currency
}
revision
=
{
this
.
state
.
revisionTable
}
periode
=
{
this
.
state
.
periode
.
periode
}
rollingOutlookID
=
{
this
.
state
.
rollingOutlookID
}
...
...
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