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
c618f6c1
Commit
c618f6c1
authored
Nov 22, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev/riri' into 'ENV-DEV'
Preview Upload Investment See merge request
!2184
parents
a9d41f17
48608d55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
637 additions
and
1754 deletions
+637
-1754
LOCFMR.js
src/container/MonthlyReport/LOCFMR.js
+236
-789
LOVMR.js
src/container/MonthlyReport/LOVMR.js
+229
-655
ListOfCreditFacilitiesMR.js
src/container/MonthlyReport/ListOfCreditFacilitiesMR.js
+172
-310
No files found.
src/container/MonthlyReport/LOCFMR.js
View file @
c618f6c1
...
...
@@ -145,11 +145,11 @@ export default class LOCF extends Component {
}
if
(
this
.
props
.
dataTablelocf
!==
prevProps
.
dataTablelocf
)
{
let
array
=
this
.
props
.
dataTablelocf
let
datas
=
array
[
array
.
length
-
1
]
this
.
setState
({
dataTable
:
this
.
props
.
dataTablelocf
,
diff
:
datas
[
46
],
perBS
:
datas
[
48
]})
let
datas
=
array
[
array
.
length
-
1
]
this
.
setState
({
dataTable
:
this
.
props
.
dataTablelocf
,
diff
:
datas
[
46
],
perBS
:
datas
[
48
]
})
}
if
(
this
.
props
.
loadingChild
!==
prevProps
.
loadingChild
)
{
this
.
setState
({
loading
:
this
.
props
.
loadingChild
})
this
.
setState
({
loading
:
this
.
props
.
loadingChild
})
}
}
...
...
@@ -499,306 +499,244 @@ export default class LOCF extends Component {
this
.
setState
({
visibleUpload
:
false
,
loading
:
true
,
visibleLOCFMR
:
false
})
let
dataTable
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
if
(
index
==
response
.
data
.
data
.
length
-
1
)
{
dataTable
.
push
([
3
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
borrower_comp_name
===
null
?
this
.
props
.
company
.
company_name
:
item
.
borrower_comp_name
===
""
?
this
.
props
.
company
.
company_name
:
item
.
borrower_comp_name
,
item
.
bank_name
===
null
?
null
:
item
.
bank_name
===
""
?
null
:
{
value
:
item
.
bank_name
},
item
.
type_of_credit
===
null
?
null
:
item
.
type_of_credit
===
""
?
null
:
{
value
:
item
.
type_of_credit
},
item
.
remarks
===
null
?
""
:
item
.
remarks
===
""
?
""
:
item
.
remarks
,
item
.
loan_maturity_date
===
null
||
item
.
loan_maturity_date
===
""
?
null
:
item
.
loan_maturity_date
,
item
.
interest
===
null
||
item
.
interest
===
""
?
"0.00"
:
item
.
interest
,
item
.
currency
===
null
||
item
.
currency
===
""
?
""
:
item
.
currency
,
item
.
loan_plafond_amount_ori
==
null
?
""
:
item
.
loan_plafond_amount_ori
,
item
.
loan_plafond_amount_idr
===
null
?
"0.0"
:
item
.
loan_plafond_amount_idr
===
""
?
"0.0"
:
item
.
loan_plafond_amount_idr
,
item
.
type_of_credit
==
"Investment Loan"
?
item
.
out_loan_ki_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Investment Loan"
?
(
item
.
out_loan_ki_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_ki_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_ki_amount_idr
)
:
"0.0"
,
item
.
type_of_credit
==
"Revolving Loan (KMK)"
?
item
.
out_loan_kmk_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Revolving Loan (KMK)"
?
(
item
.
out_loan_kmk_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_kmk_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_kmk_amount_idr
)
:
"0.0"
,
item
.
type_of_credit
==
"Others"
?
item
.
out_loan_other_type
:
""
,
item
.
type_of_credit
==
"Others"
?
item
.
out_loan_other_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Others"
?
(
item
.
out_loan_other_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_other_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_other_amount_idr
)
:
"0.0"
,
item
.
total_out_loan_ori
===
null
?
"0.0"
:
item
.
total_out_loan_ori
===
""
?
"0.0"
:
item
.
total_out_loan_ori
===
0
?
"0.0"
:
item
.
total_out_loan_ori
,
item
.
total_out_loan_idr
===
null
?
"0.0"
:
item
.
total_out_loan_idr
===
""
?
"0.0"
:
item
.
total_out_loan_idr
,
item
.
remaining_plafond_ori
===
null
?
"0.0"
:
item
.
remaining_plafond_ori
===
""
?
"0.0"
:
item
.
remaining_plafond_ori
,
item
.
remaining_plafond_idr
===
null
?
"0.0"
:
item
.
remaining_plafond_idr
===
""
?
"0.0"
:
item
.
remaining_plafond_idr
,
item
.
current_ratio_financial
==
null
?
""
:
item
.
current_ratio_financial
,
item
.
current_ratio_current
===
null
?
"0.0"
:
item
.
current_ratio_current
===
""
?
"0.0"
:
item
.
current_ratio_current
,
item
.
der_financial
==
null
?
""
:
item
.
der_financial
,
item
.
der_current
===
null
?
"0.0"
:
item
.
der_current
===
""
?
"0.0"
:
item
.
der_current
,
item
.
debt_to_ebitda_financial
==
null
?
""
:
item
.
debt_to_ebitda_financial
,
item
.
debt_to_ebitda_current
===
null
?
"0.0"
:
item
.
debt_to_ebitda_current
===
""
?
"0.0"
:
item
.
debt_to_ebitda_current
,
item
.
ebitda_to_interest_financial
==
null
?
""
:
item
.
ebitda_to_interest_financial
,
item
.
ebitda_to_interest_current
===
null
?
"0.0"
:
item
.
ebitda_to_interest_current
===
""
?
"0.0"
:
item
.
ebitda_to_interest_current
,
item
.
other_ratio1_ratio_name
==
null
?
""
:
item
.
other_ratio1_ratio_name
,
item
.
other_ratio1_financial
===
null
?
"0.0"
:
item
.
other_ratio1_financial
===
""
?
"0.0"
:
item
.
other_ratio1_financial
,
item
.
other_ratio1_current
===
null
?
"0.0"
:
item
.
other_ratio1_current
===
""
?
"0.0"
:
item
.
other_ratio1_current
,
item
.
other_ratio2_ratio_name
==
null
?
""
:
item
.
other_ratio2_ratio_name
,
item
.
other_ratio2_financial
===
null
?
"0.0"
:
item
.
other_ratio2_financial
===
""
?
"0.0"
:
item
.
other_ratio2_financial
,
item
.
other_ratio2_current
===
null
?
"0.0"
:
item
.
other_ratio2_current
===
""
?
"0.0"
:
item
.
other_ratio2_current
,
item
.
other_ratio3_ratio_name
==
null
?
""
:
item
.
other_ratio3_ratio_name
,
item
.
other_ratio3_financial
===
null
?
"0.0"
:
item
.
other_ratio3_financial
===
""
?
"0.0"
:
item
.
other_ratio3_financial
,
item
.
other_ratio3_current
===
null
?
"0.0"
:
item
.
other_ratio3_current
===
""
?
"0.0"
:
item
.
other_ratio3_current
,
item
.
other_ratio4_ratio_name
==
null
?
""
:
item
.
other_ratio4_ratio_name
,
item
.
other_ratio4_financial
===
null
?
"0.0"
:
item
.
other_ratio4_financial
===
""
?
"0.0"
:
item
.
other_ratio4_financial
,
item
.
other_ratio4_current
===
null
?
"0.0"
:
item
.
other_ratio4_current
===
""
?
"0.0"
:
item
.
other_ratio4_current
,
item
.
notes
,
],
[
9
,
""
,
""
,
""
,
""
,
""
,
{
value
:
"Grand Total"
},
null
,
""
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
"notes"
,
999999
],
)
}
else
{
dataTable
.
push
([
3
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
borrower_comp_name
===
null
?
this
.
props
.
company
.
company_name
:
item
.
borrower_comp_name
===
""
?
this
.
props
.
company
.
company_name
:
item
.
borrower_comp_name
,
item
.
bank_name
===
null
?
null
:
item
.
bank_name
===
""
?
null
:
{
value
:
item
.
bank_name
},
item
.
type_of_credit
===
null
?
null
:
item
.
type_of_credit
===
""
?
null
:
{
value
:
item
.
type_of_credit
},
item
.
remarks
===
null
?
""
:
item
.
remarks
===
""
?
""
:
item
.
remarks
,
item
.
loan_maturity_date
===
null
||
item
.
loan_maturity_date
===
""
?
null
:
item
.
loan_maturity_date
,
item
.
interest
===
null
||
item
.
interest
===
""
?
"0.00"
:
item
.
interest
,
item
.
currency
===
null
||
item
.
currency
===
""
?
""
:
item
.
currency
,
item
.
loan_plafond_amount_ori
==
null
?
""
:
item
.
loan_plafond_amount_ori
,
item
.
loan_plafond_amount_idr
===
null
?
"0.0"
:
item
.
loan_plafond_amount_idr
===
""
?
"0.0"
:
item
.
loan_plafond_amount_idr
,
item
.
type_of_credit
==
"Investment Loan"
?
item
.
out_loan_ki_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Investment Loan"
?
(
item
.
out_loan_ki_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_ki_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_ki_amount_idr
)
:
"0.0"
,
item
.
type_of_credit
==
"Revolving Loan (KMK)"
?
item
.
out_loan_kmk_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Revolving Loan (KMK)"
?
(
item
.
out_loan_kmk_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_kmk_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_kmk_amount_idr
)
:
"0.0"
,
item
.
type_of_credit
==
"Others"
?
item
.
out_loan_other_type
:
""
,
item
.
type_of_credit
==
"Others"
?
item
.
out_loan_other_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Others"
?
(
item
.
out_loan_other_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_other_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_other_amount_idr
)
:
"0.0"
,
item
.
total_out_loan_ori
===
null
?
"0.0"
:
item
.
total_out_loan_ori
===
""
?
"0.0"
:
item
.
total_out_loan_ori
,
item
.
total_out_loan_idr
===
null
?
"0.0"
:
item
.
total_out_loan_idr
===
""
?
"0.0"
:
item
.
total_out_loan_idr
,
item
.
remaining_plafond_ori
===
null
?
"0.0"
:
item
.
remaining_plafond_ori
===
""
?
"0.0"
:
item
.
remaining_plafond_ori
,
item
.
remaining_plafond_idr
===
null
?
"0.0"
:
item
.
remaining_plafond_idr
===
""
?
"0.0"
:
item
.
remaining_plafond_idr
,
item
.
current_ratio_financial
==
null
?
""
:
item
.
current_ratio_financial
,
item
.
current_ratio_current
===
null
?
"0.0"
:
item
.
current_ratio_current
===
""
?
"0.0"
:
item
.
current_ratio_current
,
item
.
der_financial
==
null
?
""
:
item
.
der_financial
,
item
.
der_current
===
null
?
"0.0"
:
item
.
der_current
===
""
?
"0.0"
:
item
.
der_current
,
item
.
debt_to_ebitda_financial
==
null
?
""
:
item
.
debt_to_ebitda_financial
,
item
.
debt_to_ebitda_current
===
null
?
"0.0"
:
item
.
debt_to_ebitda_current
===
""
?
"0.0"
:
item
.
debt_to_ebitda_current
,
item
.
ebitda_to_interest_financial
==
null
?
""
:
item
.
ebitda_to_interest_financial
,
item
.
ebitda_to_interest_current
===
null
?
"0.0"
:
item
.
ebitda_to_interest_current
===
""
?
"0.0"
:
item
.
ebitda_to_interest_current
,
item
.
other_ratio1_ratio_name
==
null
?
""
:
item
.
other_ratio1_ratio_name
,
item
.
other_ratio1_financial
===
null
?
"0.0"
:
item
.
other_ratio1_financial
===
""
?
"0.0"
:
item
.
other_ratio1_financial
,
item
.
other_ratio1_current
===
null
?
"0.0"
:
item
.
other_ratio1_current
===
""
?
"0.0"
:
item
.
other_ratio1_current
,
item
.
other_ratio2_ratio_name
==
null
?
""
:
item
.
other_ratio2_ratio_name
,
item
.
other_ratio2_financial
===
null
?
"0.0"
:
item
.
other_ratio2_financial
===
""
?
"0.0"
:
item
.
other_ratio2_financial
,
item
.
other_ratio2_current
===
null
?
"0.0"
:
item
.
other_ratio2_current
===
""
?
"0.0"
:
item
.
other_ratio2_current
,
item
.
other_ratio3_ratio_name
==
null
?
""
:
item
.
other_ratio3_ratio_name
,
item
.
other_ratio3_financial
===
null
?
"0.0"
:
item
.
other_ratio3_financial
===
""
?
"0.0"
:
item
.
other_ratio3_financial
,
item
.
other_ratio3_current
===
null
?
"0.0"
:
item
.
other_ratio3_current
===
""
?
"0.0"
:
item
.
other_ratio3_current
,
item
.
other_ratio4_ratio_name
==
null
?
""
:
item
.
other_ratio4_ratio_name
,
item
.
other_ratio4_financial
===
null
?
"0.0"
:
item
.
other_ratio4_financial
===
""
?
"0.0"
:
item
.
other_ratio4_financial
,
item
.
other_ratio4_current
===
null
?
"0.0"
:
item
.
other_ratio4_current
===
""
?
"0.0"
:
item
.
other_ratio4_current
,
item
.
notes
,
])
}
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// if (index == response.data.data.length - 1) {
dataTable
.
push
([
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
String
(
item
.
bank_name
).
includes
(
'Total'
)
?
null
:
item
.
borrower_comp_name
===
null
?
this
.
props
.
company
.
company_name
:
item
.
borrower_comp_name
===
""
?
this
.
props
.
company
.
company_name
:
item
.
borrower_comp_name
,
item
.
bank_name
===
null
?
null
:
item
.
bank_name
===
""
?
null
:
{
value
:
item
.
bank_name
},
item
.
type_of_credit
===
null
?
null
:
item
.
type_of_credit
===
""
?
null
:
{
value
:
item
.
type_of_credit
},
item
.
remarks
===
null
?
""
:
item
.
remarks
===
""
?
""
:
item
.
remarks
,
item
.
loan_maturity_date
===
null
||
item
.
loan_maturity_date
===
""
?
null
:
item
.
loan_maturity_date
,
item
.
interest
===
null
||
item
.
interest
===
""
?
"0.00"
:
item
.
interest
,
item
.
currency
===
null
||
item
.
currency
===
""
?
""
:
item
.
currency
,
item
.
loan_plafond_amount_ori
==
null
?
""
:
item
.
loan_plafond_amount_ori
,
item
.
loan_plafond_amount_idr
===
null
?
"0.0"
:
item
.
loan_plafond_amount_idr
===
""
?
"0.0"
:
item
.
loan_plafond_amount_idr
,
item
.
type_of_credit
==
"Investment Loan"
?
item
.
out_loan_ki_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Investment Loan"
?
(
item
.
out_loan_ki_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_ki_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_ki_amount_idr
)
:
"0.0"
,
item
.
type_of_credit
==
"Revolving Loan (KMK)"
?
item
.
out_loan_kmk_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Revolving Loan (KMK)"
?
(
item
.
out_loan_kmk_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_kmk_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_kmk_amount_idr
)
:
"0.0"
,
item
.
type_of_credit
==
"Others"
?
item
.
out_loan_other_type
:
""
,
item
.
type_of_credit
==
"Others"
?
item
.
out_loan_other_amount_ori
:
"0.0"
,
item
.
type_of_credit
==
"Others"
?
(
item
.
out_loan_other_amount_idr
===
null
?
"0.0"
:
item
.
out_loan_other_amount_idr
===
""
?
"0.0"
:
item
.
out_loan_other_amount_idr
)
:
"0.0"
,
item
.
total_out_loan_ori
===
null
?
"0.0"
:
item
.
total_out_loan_ori
===
""
?
"0.0"
:
item
.
total_out_loan_ori
===
0
?
"0.0"
:
item
.
total_out_loan_ori
,
item
.
total_out_loan_idr
===
null
?
"0.0"
:
item
.
total_out_loan_idr
===
""
?
"0.0"
:
item
.
total_out_loan_idr
,
item
.
remaining_plafond_ori
===
null
?
"0.0"
:
item
.
remaining_plafond_ori
===
""
?
"0.0"
:
item
.
remaining_plafond_ori
,
item
.
remaining_plafond_idr
===
null
?
"0.0"
:
item
.
remaining_plafond_idr
===
""
?
"0.0"
:
item
.
remaining_plafond_idr
,
item
.
current_ratio_financial
==
null
?
""
:
item
.
current_ratio_financial
,
item
.
current_ratio_current
===
null
?
"0.0"
:
item
.
current_ratio_current
===
""
?
"0.0"
:
item
.
current_ratio_current
,
item
.
der_financial
==
null
?
""
:
item
.
der_financial
,
item
.
der_current
===
null
?
"0.0"
:
item
.
der_current
===
""
?
"0.0"
:
item
.
der_current
,
item
.
debt_to_ebitda_financial
==
null
?
""
:
item
.
debt_to_ebitda_financial
,
item
.
debt_to_ebitda_current
===
null
?
"0.0"
:
item
.
debt_to_ebitda_current
===
""
?
"0.0"
:
item
.
debt_to_ebitda_current
,
item
.
ebitda_to_interest_financial
==
null
?
""
:
item
.
ebitda_to_interest_financial
,
item
.
ebitda_to_interest_current
===
null
?
"0.0"
:
item
.
ebitda_to_interest_current
===
""
?
"0.0"
:
item
.
ebitda_to_interest_current
,
item
.
other_ratio1_ratio_name
==
null
?
""
:
item
.
other_ratio1_ratio_name
,
item
.
other_ratio1_financial
===
null
?
"0.0"
:
item
.
other_ratio1_financial
===
""
?
"0.0"
:
item
.
other_ratio1_financial
,
item
.
other_ratio1_current
===
null
?
"0.0"
:
item
.
other_ratio1_current
===
""
?
"0.0"
:
item
.
other_ratio1_current
,
item
.
other_ratio2_ratio_name
==
null
?
""
:
item
.
other_ratio2_ratio_name
,
item
.
other_ratio2_financial
===
null
?
"0.0"
:
item
.
other_ratio2_financial
===
""
?
"0.0"
:
item
.
other_ratio2_financial
,
item
.
other_ratio2_current
===
null
?
"0.0"
:
item
.
other_ratio2_current
===
""
?
"0.0"
:
item
.
other_ratio2_current
,
item
.
other_ratio3_ratio_name
==
null
?
""
:
item
.
other_ratio3_ratio_name
,
item
.
other_ratio3_financial
===
null
?
"0.0"
:
item
.
other_ratio3_financial
===
""
?
"0.0"
:
item
.
other_ratio3_financial
,
item
.
other_ratio3_current
===
null
?
"0.0"
:
item
.
other_ratio3_current
===
""
?
"0.0"
:
item
.
other_ratio3_current
,
item
.
other_ratio4_ratio_name
==
null
?
""
:
item
.
other_ratio4_ratio_name
,
item
.
other_ratio4_financial
===
null
?
"0.0"
:
item
.
other_ratio4_financial
===
""
?
"0.0"
:
item
.
other_ratio4_financial
,
item
.
other_ratio4_current
===
null
?
"0.0"
:
item
.
other_ratio4_current
===
""
?
"0.0"
:
item
.
other_ratio4_current
,
item
.
notes
,
item
.
diff
,
item
.
per_bs
])
})
if
(
dataTable
.
length
==
0
)
{
dataTable
.
push
(
[
3
,
""
,
""
,
""
,
""
,
this
.
props
.
company
.
company_name
,
null
,
null
,
""
,
null
,
"0.00"
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
0
],
[
9
,
""
,
""
,
""
,
""
,
""
,
{
value
:
"Grand Total"
},
null
,
""
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
"notes"
,
999999
],
)
}
console
.
log
(
dataTable
);
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
dataDelete
:
[]
},
()
=>
{
// this.handleCalculate()
let
lastArray
=
dataTable
[
dataTable
.
length
-
1
]
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOCF'
)
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
23
].
length
>
0
)
{
// console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
})
}
})
// console.log(this.state.buttonError)
let
lastArray
=
dataTable
[
dataTable
.
length
-
1
]
this
.
setState
({
dataTable
,
diff
:
lastArray
[
46
],
perBS
:
lastArray
[
47
],
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
dataDelete
:
[]
},
()
=>
{
console
.
log
(
lastArray
);
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOCF'
,
'upload'
)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
typeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
// console.log(dataTable);
}
}
})
}
uploadLOCF
(
type
)
{
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
this
.
state
.
dataTable
.
map
(
i
=>
{
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
}
//
uploadLOCF(type) {
//
let data = []
//
let error = false
//
this.deleteReport()
//
this.state.dataTable.map(i => {
//
if (i[0] == 3) {
//
if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
//
error = true
//
}
if
(
i
[
7
].
value
==
'Others'
&&
i
[
18
]
==
''
)
{
error
=
true
}
let
tgl
=
String
(
i
[
9
]).
split
(
'-'
)
let
checkUndifined
=
tgl
.
findIndex
((
val
)
=>
val
==
undefined
)
if
(
this
.
props
.
defaultCurrency
.
id
==
2
)
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
// "loan_maturity_date": i[9],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
Number
(
i
[
12
])
==
""
?
"0.0"
:
Number
(
i
[
12
]),
"loan_plafond_amount_idr"
:
Number
(
i
[
13
])
==
""
?
"0.0"
:
Number
(
i
[
13
]),
"out_loan_ki_amount_ori"
:
Number
(
i
[
14
])
==
""
?
"0.0"
:
Number
(
i
[
14
]),
"out_loan_ki_amount_idr"
:
Number
(
i
[
15
])
==
""
?
"0.0"
:
Number
(
i
[
15
]),
"out_loan_kmk_amount_ori"
:
Number
(
i
[
16
])
==
""
?
"0.0"
:
Number
(
i
[
16
]),
"out_loan_kmk_amount_idr"
:
Number
(
i
[
17
])
==
""
?
"0.0"
:
Number
(
i
[
17
]),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
Number
(
i
[
19
])
==
""
?
"0.0"
:
Number
(
i
[
19
]),
"out_loan_other_amount_idr"
:
Number
(
i
[
20
])
==
""
?
"0.0"
:
Number
(
i
[
20
]),
"total_out_loan_ori"
:
Number
(
i
[
21
])
==
""
?
"0.0"
:
Number
(
i
[
21
]),
"total_out_loan_idr"
:
Number
(
i
[
22
])
==
""
?
"0.0"
:
Number
(
i
[
22
]),
"remaining_plafond_ori"
:
Number
(
i
[
23
])
==
""
?
"0.0"
:
Number
(
i
[
23
]),
"remaining_plafond_idr"
:
Number
(
i
[
24
])
==
""
?
"0.0"
:
Number
(
i
[
24
]),
"current_ratio_financial"
:
Number
(
i
[
25
])
==
""
?
"0.00"
:
Number
(
i
[
25
]),
"current_ratio_current"
:
Number
(
i
[
26
])
==
""
?
"0.00"
:
Number
(
i
[
26
]),
"der_financial"
:
Number
(
i
[
27
])
==
""
?
"0.00"
:
Number
(
i
[
27
]),
"der_current"
:
Number
(
i
[
28
])
==
""
?
"0.00"
:
Number
(
i
[
28
]),
"debt_to_ebitda_financial"
:
Number
(
i
[
29
])
==
""
?
"0.00"
:
Number
(
i
[
29
]),
"debt_to_ebitda_current"
:
Number
(
i
[
30
])
==
""
?
"0.00"
:
Number
(
i
[
30
]),
"ebitda_to_interest_financial"
:
Number
(
i
[
31
])
==
""
?
"0.00"
:
Number
(
i
[
31
]),
"ebitda_to_interest_current"
:
Number
(
i
[
32
])
==
""
?
"0.00"
:
Number
(
i
[
32
]),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
Number
(
i
[
34
])
==
""
?
"0.00"
:
Number
(
i
[
34
]),
"other_ratio1_current"
:
Number
(
i
[
35
])
==
""
?
"0.00"
:
Number
(
i
[
35
]),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
Number
(
i
[
37
])
==
""
?
"0.00"
:
Number
(
i
[
37
]),
"other_ratio2_current"
:
Number
(
i
[
38
])
==
""
?
"0.00"
:
Number
(
i
[
38
]),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
Number
(
i
[
40
])
==
""
?
"0.00"
:
Number
(
i
[
40
]),
"other_ratio3_current"
:
Number
(
i
[
41
])
==
""
?
"0.00"
:
Number
(
i
[
41
]),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
Number
(
i
[
43
])
==
""
?
"0.00"
:
Number
(
i
[
43
]),
"other_ratio4_current"
:
Number
(
i
[
44
])
==
""
?
"0.00"
:
Number
(
i
[
44
]),
"notes"
:
i
[
45
],
})
}
else
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
// "loan_maturity_date": i[9],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
fixNumber
(
Number
(
i
[
12
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
12
]),
1
),
"loan_plafond_amount_idr"
:
fixNumber
(
Number
(
i
[
13
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
13
]),
1
),
"out_loan_ki_amount_ori"
:
fixNumber
(
Number
(
i
[
14
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
14
]),
1
),
"out_loan_ki_amount_idr"
:
fixNumber
(
Number
(
i
[
15
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
15
]),
1
),
"out_loan_kmk_amount_ori"
:
fixNumber
(
Number
(
i
[
16
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
16
]),
1
),
"out_loan_kmk_amount_idr"
:
fixNumber
(
Number
(
i
[
17
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
17
]),
1
),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
fixNumber
(
Number
(
i
[
19
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
19
]),
1
),
"out_loan_other_amount_idr"
:
fixNumber
(
Number
(
i
[
20
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
20
]),
1
),
"total_out_loan_ori"
:
fixNumber
(
Number
(
i
[
21
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
21
]),
1
),
"total_out_loan_idr"
:
fixNumber
(
Number
(
i
[
22
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
22
]),
1
),
"remaining_plafond_ori"
:
fixNumber
(
Number
(
i
[
23
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
23
]),
1
),
"remaining_plafond_idr"
:
fixNumber
(
Number
(
i
[
24
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
24
]),
1
),
"current_ratio_financial"
:
fixNumber
(
Number
(
i
[
25
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
25
]),
2
),
"current_ratio_current"
:
fixNumber
(
Number
(
i
[
26
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
26
]),
2
),
"der_financial"
:
fixNumber
(
Number
(
i
[
27
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
27
]),
2
),
"der_current"
:
fixNumber
(
Number
(
i
[
28
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
28
]),
2
),
"debt_to_ebitda_financial"
:
fixNumber
(
Number
(
i
[
29
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
29
]),
2
),
"debt_to_ebitda_current"
:
fixNumber
(
Number
(
i
[
30
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
30
]),
2
),
"ebitda_to_interest_financial"
:
fixNumber
(
Number
(
i
[
31
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
31
]),
2
),
"ebitda_to_interest_current"
:
fixNumber
(
Number
(
i
[
32
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
32
]),
2
),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
fixNumber
(
Number
(
i
[
34
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
34
]),
2
),
"other_ratio1_current"
:
fixNumber
(
Number
(
i
[
35
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
35
]),
2
),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
fixNumber
(
Number
(
i
[
37
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
37
]),
2
),
"other_ratio2_current"
:
fixNumber
(
Number
(
i
[
38
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
38
]),
2
),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
fixNumber
(
Number
(
i
[
40
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
40
]),
2
),
"other_ratio3_current"
:
fixNumber
(
Number
(
i
[
41
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
41
]),
2
),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
fixNumber
(
Number
(
i
[
43
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
43
]),
2
),
"other_ratio4_current"
:
fixNumber
(
Number
(
i
[
44
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
44
]),
2
),
"notes"
:
i
[
45
],
})
}
//
if (i[7].value == 'Others' && i[18] == '') {
//
error = true
//
}
//
let tgl = String(i[9]).split('-')
//
let checkUndifined = tgl.findIndex((val) => val == undefined)
//
if (this.props.defaultCurrency.id == 2) {
//
data.push({
//
"item_report_id": i[1],
//
"borrower_comp_name": i[5],
//
"bank_name": i[6] == null ? [6] : i[6].value,
//
"type_of_credit": i[7] == null ? i[7] : i[7].value,
//
"remarks": i[8],
//
// "loan_maturity_date": i[9],
//
"loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null ? "" : (String(tgl[2]).length <= 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
//
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
//
"interest": i[10] == "" ? "0.00" : i[10],
//
"currency": i[11],
//
"loan_plafond_amount_ori": Number(i[12]) == "" ? "0.0" : Number(i[12]),
//
"loan_plafond_amount_idr": Number(i[13]) == "" ? "0.0" : Number(i[13]),
//
"out_loan_ki_amount_ori": Number(i[14]) == "" ? "0.0" : Number(i[14]),
//
"out_loan_ki_amount_idr": Number(i[15]) == "" ? "0.0" : Number(i[15]),
//
"out_loan_kmk_amount_ori": Number(i[16]) == "" ? "0.0" : Number(i[16]),
//
"out_loan_kmk_amount_idr": Number(i[17]) == "" ? "0.0" : Number(i[17]),
//
// "mtd_vs_previous_month": i[18],
//
"out_loan_other_type": i[18],
//
"out_loan_other_amount_ori": Number(i[19]) == "" ? "0.0" : Number(i[19]),
//
"out_loan_other_amount_idr": Number(i[20]) == "" ? "0.0" : Number(i[20]),
//
"total_out_loan_ori": Number(i[21]) == "" ? "0.0" : Number(i[21]),
//
"total_out_loan_idr": Number(i[22]) == "" ? "0.0" : Number(i[22]),
//
"remaining_plafond_ori": Number(i[23]) == "" ? "0.0" : Number(i[23]),
//
"remaining_plafond_idr": Number(i[24]) == "" ? "0.0" : Number(i[24]),
//
"current_ratio_financial": Number(i[25]) == "" ? "0.00" : Number(i[25]),
//
"current_ratio_current": Number(i[26]) == "" ? "0.00" : Number(i[26]),
//
"der_financial": Number(i[27]) == "" ? "0.00" : Number(i[27]),
//
"der_current": Number(i[28]) == "" ? "0.00" : Number(i[28]),
//
"debt_to_ebitda_financial": Number(i[29]) == "" ? "0.00" : Number(i[29]),
//
"debt_to_ebitda_current": Number(i[30]) == "" ? "0.00" : Number(i[30]),
//
"ebitda_to_interest_financial": Number(i[31]) == "" ? "0.00" : Number(i[31]),
//
"ebitda_to_interest_current": Number(i[32]) == "" ? "0.00" : Number(i[32]),
//
"other_ratio1_ratio_name": i[33],
//
"other_ratio1_financial": Number(i[34]) == "" ? "0.00" : Number(i[34]),
//
"other_ratio1_current": Number(i[35]) == "" ? "0.00" : Number(i[35]),
//
"other_ratio2_ratio_name": i[36],
//
"other_ratio2_financial": Number(i[37]) == "" ? "0.00" : Number(i[37]),
//
"other_ratio2_current": Number(i[38]) == "" ? "0.00" : Number(i[38]),
//
"other_ratio3_ratio_name": i[39],
//
"other_ratio3_financial": Number(i[40]) == "" ? "0.00" : Number(i[40]),
//
"other_ratio3_current": Number(i[41]) == "" ? "0.00" : Number(i[41]),
//
"other_ratio4_ratio_name": i[42],
//
"other_ratio4_financial": Number(i[43]) == "" ? "0.00" : Number(i[43]),
//
"other_ratio4_current": Number(i[44]) == "" ? "0.00" : Number(i[44]),
//
"notes": i[45],
//
})
//
} else {
//
data.push({
//
"item_report_id": i[1],
//
"borrower_comp_name": i[5],
//
"bank_name": i[6] == null ? [6] : i[6].value,
//
"type_of_credit": i[7] == null ? i[7] : i[7].value,
//
"remarks": i[8],
//
// "loan_maturity_date": i[9],
//
"loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null ? "" : (String(tgl[2]).length <= 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
//
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
//
"interest": i[10] == "" ? "0.00" : i[10],
//
"currency": i[11],
//
"loan_plafond_amount_ori": fixNumber(Number(i[12]), 1) == "" ? "0.0" : fixNumber(Number(i[12]), 1),
//
"loan_plafond_amount_idr": fixNumber(Number(i[13]), 1) == "" ? "0.0" : fixNumber(Number(i[13]), 1),
//
"out_loan_ki_amount_ori": fixNumber(Number(i[14]), 1) == "" ? "0.0" : fixNumber(Number(i[14]), 1),
//
"out_loan_ki_amount_idr": fixNumber(Number(i[15]), 1) == "" ? "0.0" : fixNumber(Number(i[15]), 1),
//
"out_loan_kmk_amount_ori": fixNumber(Number(i[16]), 1) == "" ? "0.0" : fixNumber(Number(i[16]), 1),
//
"out_loan_kmk_amount_idr": fixNumber(Number(i[17]), 1) == "" ? "0.0" : fixNumber(Number(i[17]), 1),
//
// "mtd_vs_previous_month": i[18],
//
"out_loan_other_type": i[18],
//
"out_loan_other_amount_ori": fixNumber(Number(i[19]), 1) == "" ? "0.0" : fixNumber(Number(i[19]), 1),
//
"out_loan_other_amount_idr": fixNumber(Number(i[20]), 1) == "" ? "0.0" : fixNumber(Number(i[20]), 1),
//
"total_out_loan_ori": fixNumber(Number(i[21]), 1) == "" ? "0.0" : fixNumber(Number(i[21]), 1),
//
"total_out_loan_idr": fixNumber(Number(i[22]), 1) == "" ? "0.0" : fixNumber(Number(i[22]), 1),
//
"remaining_plafond_ori": fixNumber(Number(i[23]), 1) == "" ? "0.0" : fixNumber(Number(i[23]), 1),
//
"remaining_plafond_idr": fixNumber(Number(i[24]), 1) == "" ? "0.0" : fixNumber(Number(i[24]), 1),
//
"current_ratio_financial": fixNumber(Number(i[25]), 2) == "" ? "0.00" : fixNumber(Number(i[25]), 2),
//
"current_ratio_current": fixNumber(Number(i[26]), 2) == "" ? "0.00" : fixNumber(Number(i[26]), 2),
//
"der_financial": fixNumber(Number(i[27]), 2) == "" ? "0.00" : fixNumber(Number(i[27]), 2),
//
"der_current": fixNumber(Number(i[28]), 2) == "" ? "0.00" : fixNumber(Number(i[28]), 2),
//
"debt_to_ebitda_financial": fixNumber(Number(i[29]), 2) == "" ? "0.00" : fixNumber(Number(i[29]), 2),
//
"debt_to_ebitda_current": fixNumber(Number(i[30]), 2) == "" ? "0.00" : fixNumber(Number(i[30]), 2),
//
"ebitda_to_interest_financial": fixNumber(Number(i[31]), 2) == "" ? "0.00" : fixNumber(Number(i[31]), 2),
//
"ebitda_to_interest_current": fixNumber(Number(i[32]), 2) == "" ? "0.00" : fixNumber(Number(i[32]), 2),
//
"other_ratio1_ratio_name": i[33],
//
"other_ratio1_financial": fixNumber(Number(i[34]), 2) == "" ? "0.00" : fixNumber(Number(i[34]), 2),
//
"other_ratio1_current": fixNumber(Number(i[35]), 2) == "" ? "0.00" : fixNumber(Number(i[35]), 2),
//
"other_ratio2_ratio_name": i[36],
//
"other_ratio2_financial": fixNumber(Number(i[37]), 2) == "" ? "0.00" : fixNumber(Number(i[37]), 2),
//
"other_ratio2_current": fixNumber(Number(i[38]), 2) == "" ? "0.00" : fixNumber(Number(i[38]), 2),
//
"other_ratio3_ratio_name": i[39],
//
"other_ratio3_financial": fixNumber(Number(i[40]), 2) == "" ? "0.00" : fixNumber(Number(i[40]), 2),
//
"other_ratio3_current": fixNumber(Number(i[41]), 2) == "" ? "0.00" : fixNumber(Number(i[41]), 2),
//
"other_ratio4_ratio_name": i[42],
//
"other_ratio4_financial": fixNumber(Number(i[43]), 2) == "" ? "0.00" : fixNumber(Number(i[43]), 2),
//
"other_ratio4_current": fixNumber(Number(i[44]), 2) == "" ? "0.00" : fixNumber(Number(i[44]), 2),
//
"notes": i[45],
//
})
//
}
}
})
let
body
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"locf"
:
data
,
"per_bs"
:
this
.
state
.
perBS
,
"diff"
:
this
.
state
.
diff
,
"total_loan"
:
this
.
state
.
perBS
}
console
.
log
(
JSON
.
stringify
(
body
));
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportLOCF
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
// this.props.onClickClose()
// this.props.getReport()
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
// alert(response.data.status)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
this
.
setState
({
handleDoubleClick
:
0
})
})
}
}
//
}
//
})
//
let body = {
//
"monthly_report_id": this.props.monthlyReportId,
//
"company_id": this.props.company.company_id,
//
"periode": this.props.periode,
//
"report_id": this.props.report_id,
//
"status": type,
//
"months": this.props.month.month_id,
//
"currency_id": this.props.defaultCurrency.id,
//
"locf": data,
//
"per_bs": this.state.perBS,
//
"diff": this.state.diff,
//
"total_loan": this.state.perBS
//
}
//
console.log(JSON.stringify(body));
//
if (error && type == 'submitted') {
//
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
//
} else {
//
api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
//
console.log(response);
//
if (response.data) {
//
if (response.ok) {
//
if (response.data.status === "success") {
//
this.props.saveToMonthlyReport('LOCF')
//
// this.props.onClickClose()
//
// this.props.getReport()
//
} else {
//
if (response.data?.message == "Please Set Up Rate Currency First") {
//
this.setState({ visibleAlertSave: true })
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
//
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
//
setTimeout(() => {
//
localStorage.removeItem(Constant.TOKEN)
//
window.location.reload();
//
}, 1000);
//
}
//
})
//
}
//
// alert(response.data.status)
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
//
}
//
this.setState({ handleDoubleClick: 0 })
//
})
//
}
//
}
getBankData
()
{
let
body
=
{
...
...
@@ -1097,443 +1035,6 @@ export default class LOCF extends Component {
})
}
backToMonthlyReport
(
type
)
{
// this.setState({ loading: true })
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
this
.
state
.
dataTable
.
map
(
i
=>
{
console
.
log
(
i
);
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
}
if
(
i
[
7
].
value
==
'Others'
&&
i
[
18
]
==
''
)
{
error
=
true
}
let
tgl
=
String
(
i
[
9
]).
split
(
'-'
)
let
checkUndifined
=
tgl
.
findIndex
((
val
)
=>
val
==
undefined
)
if
(
this
.
props
.
defaultCurrency
.
id
==
2
)
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9],
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
Number
(
i
[
12
])
==
""
?
"0.0"
:
Number
(
i
[
12
]),
"loan_plafond_amount_idr"
:
Number
(
i
[
13
])
==
""
?
"0.0"
:
Number
(
i
[
13
]),
"out_loan_ki_amount_ori"
:
Number
(
i
[
14
])
==
""
?
"0.0"
:
Number
(
i
[
14
]),
"out_loan_ki_amount_idr"
:
Number
(
i
[
15
])
==
""
?
"0.0"
:
Number
(
i
[
15
]),
"out_loan_kmk_amount_ori"
:
Number
(
i
[
16
])
==
""
?
"0.0"
:
Number
(
i
[
16
]),
"out_loan_kmk_amount_idr"
:
Number
(
i
[
17
])
==
""
?
"0.0"
:
Number
(
i
[
17
]),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
Number
(
i
[
19
])
==
""
?
"0.0"
:
Number
(
i
[
19
]),
"out_loan_other_amount_idr"
:
Number
(
i
[
20
])
==
""
?
"0.0"
:
Number
(
i
[
20
]),
"total_out_loan_ori"
:
Number
(
i
[
21
])
==
""
?
"0.0"
:
Number
(
i
[
21
]),
"total_out_loan_idr"
:
Number
(
i
[
22
])
==
""
?
"0.0"
:
Number
(
i
[
22
]),
"remaining_plafond_ori"
:
Number
(
i
[
23
])
==
""
?
"0.0"
:
Number
(
i
[
23
]),
"remaining_plafond_idr"
:
Number
(
i
[
24
])
==
""
?
"0.0"
:
Number
(
i
[
24
]),
"current_ratio_financial"
:
Number
(
i
[
25
])
==
""
?
"0.00"
:
Number
(
i
[
25
]),
"current_ratio_current"
:
Number
(
i
[
26
])
==
""
?
"0.00"
:
Number
(
i
[
26
]),
"der_financial"
:
Number
(
i
[
27
])
==
""
?
"0.00"
:
Number
(
i
[
27
]),
"der_current"
:
Number
(
i
[
28
])
==
""
?
"0.00"
:
Number
(
i
[
28
]),
"debt_to_ebitda_financial"
:
Number
(
i
[
29
])
==
""
?
"0.00"
:
Number
(
i
[
29
]),
"debt_to_ebitda_current"
:
Number
(
i
[
30
])
==
""
?
"0.00"
:
Number
(
i
[
30
]),
"ebitda_to_interest_financial"
:
Number
(
i
[
31
])
==
""
?
"0.00"
:
Number
(
i
[
31
]),
"ebitda_to_interest_current"
:
Number
(
i
[
32
])
==
""
?
"0.00"
:
Number
(
i
[
32
]),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
Number
(
i
[
34
])
==
""
?
"0.00"
:
Number
(
i
[
34
]),
"other_ratio1_current"
:
Number
(
i
[
35
])
==
""
?
"0.00"
:
Number
(
i
[
35
]),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
Number
(
i
[
37
])
==
""
?
"0.00"
:
Number
(
i
[
37
]),
"other_ratio2_current"
:
Number
(
i
[
38
])
==
""
?
"0.00"
:
Number
(
i
[
38
]),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
Number
(
i
[
40
])
==
""
?
"0.00"
:
Number
(
i
[
40
]),
"other_ratio3_current"
:
Number
(
i
[
41
])
==
""
?
"0.00"
:
Number
(
i
[
41
]),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
Number
(
i
[
43
])
==
""
?
"0.00"
:
Number
(
i
[
43
]),
"other_ratio4_current"
:
Number
(
i
[
44
])
==
""
?
"0.00"
:
Number
(
i
[
44
]),
"notes"
:
i
[
45
],
})
}
else
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9],
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
fixNumber
(
Number
(
i
[
12
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
12
]),
1
),
"loan_plafond_amount_idr"
:
fixNumber
(
Number
(
i
[
13
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
13
]),
1
),
"out_loan_ki_amount_ori"
:
fixNumber
(
Number
(
i
[
14
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
14
]),
1
),
"out_loan_ki_amount_idr"
:
fixNumber
(
Number
(
i
[
15
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
15
]),
1
),
"out_loan_kmk_amount_ori"
:
fixNumber
(
Number
(
i
[
16
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
16
]),
1
),
"out_loan_kmk_amount_idr"
:
fixNumber
(
Number
(
i
[
17
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
17
]),
1
),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
fixNumber
(
Number
(
i
[
19
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
19
]),
1
),
"out_loan_other_amount_idr"
:
fixNumber
(
Number
(
i
[
20
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
20
]),
1
),
"total_out_loan_ori"
:
fixNumber
(
Number
(
i
[
21
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
21
]),
1
),
"total_out_loan_idr"
:
fixNumber
(
Number
(
i
[
22
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
22
]),
1
),
"remaining_plafond_ori"
:
fixNumber
(
Number
(
i
[
23
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
23
]),
1
),
"remaining_plafond_idr"
:
fixNumber
(
Number
(
i
[
24
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
24
]),
1
),
"current_ratio_financial"
:
fixNumber
(
Number
(
i
[
25
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
25
]),
2
),
"current_ratio_current"
:
fixNumber
(
Number
(
i
[
26
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
26
]),
2
),
"der_financial"
:
fixNumber
(
Number
(
i
[
27
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
27
]),
2
),
"der_current"
:
fixNumber
(
Number
(
i
[
28
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
28
]),
2
),
"debt_to_ebitda_financial"
:
fixNumber
(
Number
(
i
[
29
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
29
]),
2
),
"debt_to_ebitda_current"
:
fixNumber
(
Number
(
i
[
30
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
30
]),
2
),
"ebitda_to_interest_financial"
:
fixNumber
(
Number
(
i
[
31
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
31
]),
2
),
"ebitda_to_interest_current"
:
fixNumber
(
Number
(
i
[
32
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
32
]),
2
),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
fixNumber
(
Number
(
i
[
34
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
34
]),
2
),
"other_ratio1_current"
:
fixNumber
(
Number
(
i
[
35
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
35
]),
2
),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
fixNumber
(
Number
(
i
[
37
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
37
]),
2
),
"other_ratio2_current"
:
fixNumber
(
Number
(
i
[
38
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
38
]),
2
),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
fixNumber
(
Number
(
i
[
40
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
40
]),
2
),
"other_ratio3_current"
:
fixNumber
(
Number
(
i
[
41
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
41
]),
2
),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
fixNumber
(
Number
(
i
[
43
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
43
]),
2
),
"other_ratio4_current"
:
fixNumber
(
Number
(
i
[
44
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
44
]),
2
),
"notes"
:
i
[
45
],
})
}
}
})
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"locf"
:
data
,
"per_bs"
:
this
.
state
.
perBS
,
"diff"
:
this
.
state
.
diff
,
"total_loan"
:
this
.
state
.
perBS
}
console
.
log
(
JSON
.
stringify
(
payload
))
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
createMonthlyReportLOCF
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
document
.
body
.
style
.
overflow
=
'unset'
;
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
this
.
props
.
saveToMonthlyReport
()
})
}
}
// else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
}
else
{
this
.
setState
({
loading
:
false
},
()
=>
{
// this.getSubmission()
document
.
body
.
style
.
overflow
=
'unset'
;
})
}
this
.
setState
({
handleDoubleClick
:
0
})
})
}
}
// handleCalculate = () => {
// let dataTable2 = this.state.dataTable
// let data = []
// let error = false
// dataTable2.map(i => {
// if (i[0] == 3) {
// if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
// error = true
// }
// if (i[7].value == 'Others' && i[18] == '') {
// error = true
// }
// let tgl = String(i[9]).split('-')
// let checkUndifined = tgl.findIndex((val) => val == undefined)
// if (this.props.defaultCurrency.id == 2) {
// data.push({
// "item_report_id": i[1],
// "borrower_comp_name": i[5],
// "bank_name": i[6] == null ? [6] : i[6].value,
// "type_of_credit": i[7] == null ? i[7] : i[7].value,
// "remarks": i[8],
// "loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null ? "" : (String(tgl[2]).length <= 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
// "interest": i[10] == "" ? "0.00" : i[10],
// "currency": i[11],
// "loan_plafond_amount_ori": Number(i[12]) == "" ? "0.0" : Number(i[12]),
// "loan_plafond_amount_idr": Number(i[13]) == "" ? "0.0" : Number(i[13]),
// "out_loan_ki_amount_ori": Number(i[14]) == "" ? "0.0" : Number(i[14]),
// "out_loan_ki_amount_idr": Number(i[15]) == "" ? "0.0" : Number(i[15]),
// "out_loan_kmk_amount_ori": Number(i[16]) == "" ? "0.0" : Number(i[16]),
// "out_loan_kmk_amount_idr": Number(i[17]) == "" ? "0.0" : Number(i[17]),
// "out_loan_other_type": i[18],
// "out_loan_other_amount_ori": Number(i[19]) == "" ? "0.0" : Number(i[19]),
// "out_loan_other_amount_idr": Number(i[20]) == "" ? "0.0" : Number(i[20]),
// "total_out_loan_ori": Number(i[21]) == "" ? "0.0" : Number(i[21]),
// "total_out_loan_idr": Number(i[22]) == "" ? "0.0" : Number(i[22]),
// "remaining_plafond_ori": Number(i[23]) == "" ? "0.0" : Number(i[23]),
// "remaining_plafond_idr": Number(i[24]) == "" ? "0.0" : Number(i[24]),
// "current_ratio_financial": Number(i[25]) == "" ? "0.00" : Number(i[25]),
// "current_ratio_current": Number(i[26]) == "" ? "0.00" : Number(i[26]),
// "der_financial": Number(i[27]) == "" ? "0.00" : Number(i[27]),
// "der_current": Number(i[28]) == "" ? "0.00" : Number(i[28]),
// "debt_to_ebitda_financial": Number(i[29]) == "" ? "0.00" : Number(i[29]),
// "debt_to_ebitda_current": Number(i[30]) == "" ? "0.00" : Number(i[30]),
// "ebitda_to_interest_financial": Number(i[31]) == "" ? "0.00" : Number(i[31]),
// "ebitda_to_interest_current": Number(i[32]) == "" ? "0.00" : Number(i[32]),
// "other_ratio1_ratio_name": i[33],
// "other_ratio1_financial": Number(i[34]) == "" ? "0.00" : Number(i[34]),
// "other_ratio1_current": Number(i[35]) == "" ? "0.00" : Number(i[35]),
// "other_ratio2_ratio_name": i[36],
// "other_ratio2_financial": Number(i[37]) == "" ? "0.00" : Number(i[37]),
// "other_ratio2_current": Number(i[38]) == "" ? "0.00" : Number(i[38]),
// "other_ratio3_ratio_name": i[39],
// "other_ratio3_financial": Number(i[40]) == "" ? "0.00" : Number(i[40]),
// "other_ratio3_current": Number(i[41]) == "" ? "0.00" : Number(i[41]),
// "other_ratio4_ratio_name": i[42],
// "other_ratio4_financial": Number(i[43]) == "" ? "0.00" : Number(i[43]),
// "other_ratio4_current": Number(i[44]) == "" ? "0.00" : Number(i[44]),
// "notes": i[45],
// })
// } else {
// data.push({
// "item_report_id": i[1],
// "borrower_comp_name": i[5],
// "bank_name": i[6] == null ? [6] : i[6].value,
// "type_of_credit": i[7] == null ? i[7] : i[7].value,
// "remarks": i[8],
// "loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null ? "" : (String(tgl[2]).length <= 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
// "interest": i[10] == "" ? "0.00" : i[10],
// "currency": i[11],
// "loan_plafond_amount_ori": fixNumber(Number(i[12]), 1) == "" ? "0.0" : fixNumber(Number(i[12]), 1),
// "loan_plafond_amount_idr": fixNumber(Number(i[13]), 1) == "" ? "0.0" : fixNumber(Number(i[13]), 1),
// "out_loan_ki_amount_ori": fixNumber(Number(i[14]), 1) == "" ? "0.0" : fixNumber(Number(i[14]), 1),
// "out_loan_ki_amount_idr": fixNumber(Number(i[15]), 1) == "" ? "0.0" : fixNumber(Number(i[15]), 1),
// "out_loan_kmk_amount_ori": fixNumber(Number(i[16]), 1) == "" ? "0.0" : fixNumber(Number(i[16]), 1),
// "out_loan_kmk_amount_idr": fixNumber(Number(i[17]), 1) == "" ? "0.0" : fixNumber(Number(i[17]), 1),
// "out_loan_other_type": i[18],
// "out_loan_other_amount_ori": fixNumber(Number(i[19]), 1) == "" ? "0.0" : fixNumber(Number(i[19]), 1),
// "out_loan_other_amount_idr": fixNumber(Number(i[20]), 1) == "" ? "0.0" : fixNumber(Number(i[20]), 1),
// "total_out_loan_ori": fixNumber(Number(i[21]), 1) == "" ? "0.0" : fixNumber(Number(i[21]), 1),
// "total_out_loan_idr": fixNumber(Number(i[22]), 1) == "" ? "0.0" : fixNumber(Number(i[22]), 1),
// "remaining_plafond_ori": fixNumber(Number(i[23]), 1) == "" ? "0.0" : fixNumber(Number(i[23]), 1),
// "remaining_plafond_idr": fixNumber(Number(i[24]), 1) == "" ? "0.0" : fixNumber(Number(i[24]), 1),
// "current_ratio_financial": fixNumber(Number(i[25]), 2) == "" ? "0.00" : fixNumber(Number(i[25]), 2),
// "current_ratio_current": fixNumber(Number(i[26]), 2) == "" ? "0.00" : fixNumber(Number(i[26]), 2),
// "der_financial": fixNumber(Number(i[27]), 2) == "" ? "0.00" : fixNumber(Number(i[27]), 2),
// "der_current": fixNumber(Number(i[28]), 2) == "" ? "0.00" : fixNumber(Number(i[28]), 2),
// "debt_to_ebitda_financial": fixNumber(Number(i[29]), 2) == "" ? "0.00" : fixNumber(Number(i[29]), 2),
// "debt_to_ebitda_current": fixNumber(Number(i[30]), 2) == "" ? "0.00" : fixNumber(Number(i[30]), 2),
// "ebitda_to_interest_financial": fixNumber(Number(i[31]), 2) == "" ? "0.00" : fixNumber(Number(i[31]), 2),
// "ebitda_to_interest_current": fixNumber(Number(i[32]), 2) == "" ? "0.00" : fixNumber(Number(i[32]), 2),
// "other_ratio1_ratio_name": i[33],
// "other_ratio1_financial": fixNumber(Number(i[34]), 2) == "" ? "0.00" : fixNumber(Number(i[34]), 2),
// "other_ratio1_current": fixNumber(Number(i[35]), 2) == "" ? "0.00" : fixNumber(Number(i[35]), 2),
// "other_ratio2_ratio_name": i[36],
// "other_ratio2_financial": fixNumber(Number(i[37]), 2) == "" ? "0.00" : fixNumber(Number(i[37]), 2),
// "other_ratio2_current": fixNumber(Number(i[38]), 2) == "" ? "0.00" : fixNumber(Number(i[38]), 2),
// "other_ratio3_ratio_name": i[39],
// "other_ratio3_financial": fixNumber(Number(i[40]), 2) == "" ? "0.00" : fixNumber(Number(i[40]), 2),
// "other_ratio3_current": fixNumber(Number(i[41]), 2) == "" ? "0.00" : fixNumber(Number(i[41]), 2),
// "other_ratio4_ratio_name": i[42],
// "other_ratio4_financial": fixNumber(Number(i[43]), 2) == "" ? "0.00" : fixNumber(Number(i[43]), 2),
// "other_ratio4_current": fixNumber(Number(i[44]), 2) == "" ? "0.00" : fixNumber(Number(i[44]), 2),
// "notes": i[45],
// })
// }
// }
// })
// let body = {
// "monthly_report_id": this.props.monthlyReportId,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "status": 'submitted',
// "months": this.props.month.month_id,
// "currency_id": this.props.defaultCurrency.id,
// "locf": data,
// "per_bs": this.state.perBS,
// "diff": this.state.diff,
// "total_loan": this.state.perBS
// }
// console.log(body);
// api.create().validateSaveLOCF(body).then((response) => {
// console.log(response);
// let dataTable = []
// if (response.data) {
// let res = response.data.data
// const handlePushChild = (item) => {
// let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
// let tgl = String(item.locf.loan_maturity_date).split('-')
// if (indexIDzz === -1) {
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// String(item.locf.bank_name).includes('Total') ? null : item.locf.borrower_comp_name === null || item.locf.borrower_comp_name === "" ? this.props.company.company_name : item.locf.borrower_comp_name,
// item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : { value: item.locf.bank_name },
// item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : { value: item.locf.type_of_credit },
// item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks,
// item.locf.loan_maturity_date == null || item.locf.loan_maturity_date == "" ? null : (item.locf.loan_maturity_date !== "null" ? String(tgl[2]).length > 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(item.locf.loan_maturity_date) : null),
// item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
// item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
// item.locf.loan_plafond_amount_ori,
// item.locf.loan_plafond_amount_idr === null ? "0.0" : item.locf.loan_plafond_amount_idr === "" ? "0.0" : item.locf.loan_plafond_amount_idr,
// item.locf.out_loan_ki_amount_ori,
// item.locf.out_loan_ki_amount_idr === null ? "0.0" : item.locf.out_loan_ki_amount_idr === "" ? "0.0" : item.locf.out_loan_ki_amount_idr,
// item.locf.out_loan_kmk_amount_ori,
// item.locf.out_loan_kmk_amount_idr === null ? "0.0" : item.locf.out_loan_kmk_amount_idr === "" ? "0.0" : item.locf.out_loan_kmk_amount_idr,
// item.locf.out_loan_other_type,
// item.locf.out_loan_other_amount_ori,
// item.locf.out_loan_other_amount_idr === null ? "0.0" : item.locf.out_loan_other_amount_idr === "" ? "0.0" : item.locf.out_loan_other_amount_idr,
// item.locf.total_out_loan_ori === null ? "0.0" : item.locf.total_out_loan_ori === "" ? "0.0" : item.locf.total_out_loan_ori,
// item.locf.total_out_loan_idr === null ? "0.0" : item.locf.total_out_loan_idr === "" ? "0.0" : item.locf.total_out_loan_idr,
// item.locf.remaining_plafond_ori === null ? "0.0" : item.locf.remaining_plafond_ori === "" ? "0.0" : item.locf.remaining_plafond_ori,
// item.locf.remaining_plafond_idr === null ? "0.0" : item.locf.remaining_plafond_idr === "" ? "0.0" : item.locf.remaining_plafond_idr,
// item.locf.current_ratio_financial,
// item.locf.current_ratio_current === null ? "0.0" : item.locf.current_ratio_current === "" ? "0.0" : item.locf.current_ratio_current,
// item.locf.der_financial,
// item.locf.der_current === null ? "0.0" : item.locf.der_current === "" ? "0.0" : item.locf.der_current,
// item.locf.debt_to_ebitda_financial,
// item.locf.debt_to_ebitda_current === null ? "0.0" : item.locf.debt_to_ebitda_current === "" ? "0.0" : item.locf.debt_to_ebitda_current,
// item.locf.ebitda_to_interest_financial,
// item.locf.ebitda_to_interest_current === null ? "0.0" : item.locf.ebitda_to_interest_current === "" ? "0.0" : item.locf.ebitda_to_interest_current,
// item.locf.other_ratio1_ratio_name,
// item.locf.other_ratio1_financial,
// item.locf.other_ratio1_current === null ? "0.0" : item.locf.other_ratio1_current === "" ? "0.0" : item.locf.other_ratio1_current,
// item.locf.other_ratio2_ratio_name,
// item.locf.other_ratio2_financial,
// item.locf.other_ratio2_current === null ? "0.0" : item.locf.other_ratio2_current === "" ? "0.0" : item.locf.other_ratio2_current,
// item.locf.other_ratio3_ratio_name,
// item.locf.other_ratio3_financial,
// item.locf.other_ratio3_current === null ? "0.0" : item.locf.other_ratio3_current === "" ? "0.0" : item.locf.other_ratio3_current,
// item.locf.other_ratio4_ratio_name,
// item.locf.other_ratio4_financial,
// item.locf.other_ratio4_current === null ? "0.0" : item.locf.other_ratio4_current === "" ? "0.0" : item.locf.other_ratio4_current,
// item.locf.notes,
// item.diff,
// item.total_loan,
// item.per_bs
// // index
// ])
// }
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// }
// res.map((item, index) => {
// let tgl = String(item.locf.loan_maturity_date).split('-')
// dataTable.push([
// item.type_report_id,
// item.id,
// item.parent,
// item.formula,
// item.level,
// String(item.locf.bank_name).includes('Total') ? null : item.locf.borrower_comp_name === null || item.locf.borrower_comp_name === "" ? this.props.company.company_name : item.locf.borrower_comp_name,
// item.locf.bank_name === null ? null : item.locf.bank_name === "" ? null : { value: item.locf.bank_name },
// item.locf.type_of_credit === null ? null : item.locf.type_of_credit === "" ? null : { value: item.locf.type_of_credit },
// item.locf.remarks === null || item.locf.remarks === "" ? "" : item.locf.remarks,
// item.locf.loan_maturity_date == null || item.locf.loan_maturity_date == "" ? null : (item.locf.loan_maturity_date !== "null" ? String(tgl[2]).length > 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(item.locf.loan_maturity_date) : null),
// item.locf.interest === null || item.locf.interest === "" ? "0.00" : item.locf.interest,
// item.locf.currency === null || item.locf.currency === "" ? "" : item.locf.currency,
// item.locf.loan_plafond_amount_ori,
// item.locf.loan_plafond_amount_idr === null ? "0.0" : item.locf.loan_plafond_amount_idr === "" ? "0.0" : item.locf.loan_plafond_amount_idr,
// item.locf.out_loan_ki_amount_ori,
// item.locf.out_loan_ki_amount_idr === null ? "0.0" : item.locf.out_loan_ki_amount_idr === "" ? "0.0" : item.locf.out_loan_ki_amount_idr,
// item.locf.out_loan_kmk_amount_ori,
// item.locf.out_loan_kmk_amount_idr === null ? "0.0" : item.locf.out_loan_kmk_amount_idr === "" ? "0.0" : item.locf.out_loan_kmk_amount_idr,
// item.locf.out_loan_other_type,
// item.locf.out_loan_other_amount_ori,
// item.locf.out_loan_other_amount_idr === null ? "0.0" : item.locf.out_loan_other_amount_idr === "" ? "0.0" : item.locf.out_loan_other_amount_idr,
// item.locf.total_out_loan_ori === null ? "0.0" : item.locf.total_out_loan_ori === "" ? "0.0" : item.locf.total_out_loan_ori,
// item.locf.total_out_loan_idr === null ? "0.0" : item.locf.total_out_loan_idr === "" ? "0.0" : item.locf.total_out_loan_idr,
// item.locf.remaining_plafond_ori === null ? "0.0" : item.locf.remaining_plafond_ori === "" ? "0.0" : item.locf.remaining_plafond_ori,
// item.locf.remaining_plafond_idr === null ? "0.0" : item.locf.remaining_plafond_idr === "" ? "0.0" : item.locf.remaining_plafond_idr,
// item.locf.current_ratio_financial,
// item.locf.current_ratio_current === null ? "0.0" : item.locf.current_ratio_current === "" ? "0.0" : item.locf.current_ratio_current,
// item.locf.der_financial,
// item.locf.der_current === null ? "0.0" : item.locf.der_current === "" ? "0.0" : item.locf.der_current,
// item.locf.debt_to_ebitda_financial,
// item.locf.debt_to_ebitda_current === null ? "0.0" : item.locf.debt_to_ebitda_current === "" ? "0.0" : item.locf.debt_to_ebitda_current,
// item.locf.ebitda_to_interest_financial,
// item.locf.ebitda_to_interest_current === null ? "0.0" : item.locf.ebitda_to_interest_current === "" ? "0.0" : item.locf.ebitda_to_interest_current,
// item.locf.other_ratio1_ratio_name,
// item.locf.other_ratio1_financial,
// item.locf.other_ratio1_current === null ? "0.0" : item.locf.other_ratio1_current === "" ? "0.0" : item.locf.other_ratio1_current,
// item.locf.other_ratio2_ratio_name,
// item.locf.other_ratio2_financial,
// item.locf.other_ratio2_current === null ? "0.0" : item.locf.other_ratio2_current === "" ? "0.0" : item.locf.other_ratio2_current,
// item.locf.other_ratio3_ratio_name,
// item.locf.other_ratio3_financial,
// item.locf.other_ratio3_current === null ? "0.0" : item.locf.other_ratio3_current === "" ? "0.0" : item.locf.other_ratio3_current,
// item.locf.other_ratio4_ratio_name,
// item.locf.other_ratio4_financial,
// item.locf.other_ratio4_current === null ? "0.0" : item.locf.other_ratio4_current === "" ? "0.0" : item.locf.other_ratio4_current,
// item.locf.notes,
// item.diff,
// item.total_loan,
// item.per_bs
// // index
// ])
// if (item.children !== null) {
// if (item.children.length > 0) {
// item.children.map((items, indexs) => {
// handlePushChild(items)
// })
// }
// }
// })
// console.log(this.props.dataTablelocf)
// let lastArray = dataTable[res.length - 1]
// this.setState({ dataTable, diff: lastArray[46], perBS: lastArray[48], loading: false, visibleLOCFMR: true }, () => {
// })
// }
// })
// }
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
loading
=
this
.
state
.
loading
...
...
@@ -1541,12 +1042,6 @@ export default class LOCF extends Component {
let
indexNyasar
=
false
let
totalLoan
=
0
// const formatSeparator = (num) => {
// return String(num).replace(/(?<!\..*)(\d)(?=(?:\d{3})+(?:\.|$))/g, '$1,')
// return num
// }
const
handleAction
=
(
typeReport
,
tableMeta
,
typeButton
)
=>
{
// console.log(typeReport)
if
(
typeReport
==
3
)
{
...
...
@@ -1582,29 +1077,29 @@ export default class LOCF extends Component {
}
if
(
value
.
value
!==
undefined
)
{
this
.
setState
({
loading
:
true
})
this
.
setState
({
loading
:
true
})
if
(
value
.
value
==
'Investment Loan'
)
{
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
dataTable2
[
tableMeta
.
rowIndex
][
16
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
17
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
18
]
=
""
dataTable2
[
tableMeta
.
rowIndex
][
19
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
20
]
=
0
}
else
if
(
value
.
value
==
'Revolving Loan (KMK)'
)
{
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
dataTable2
[
tableMeta
.
rowIndex
][
14
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
15
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
18
]
=
""
dataTable2
[
tableMeta
.
rowIndex
][
19
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
20
]
=
0
}
else
if
(
value
.
value
==
'others'
)
{
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
dataTable2
[
tableMeta
.
rowIndex
][
14
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
15
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
16
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
17
]
=
0
}
this
.
setState
({
loading
:
false
})
this
.
setState
({
loading
:
false
})
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
value
}
else
{
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
val
...
...
@@ -4165,54 +3660,6 @@ export default class LOCF extends Component {
<
/MuiThemeProvider>
}
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
margin
:
20
}}
>
<
div
className
=
"col-1"
style
=
{{
paddingLeft
:
0
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
visiblePLMR
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
getItemHierarki
()
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
>
<
div
style
=
{{
backgroundColor
:
'#019ce5'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Back
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
,
paddingRight
:
5
}}
>
<
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
>
<
/div
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
,
maxWidth
:
'100%'
,
paddingLeft
:
5
,
paddingRight
:
15
,
marginTop
:
5
}}
>
<
div
>
<
div
style
=
{{
display
:
'flex'
}}
>
...
...
src/container/MonthlyReport/LOVMR.js
View file @
c618f6c1
...
...
@@ -148,10 +148,10 @@ export default class LOV extends Component {
let
array
=
this
.
props
.
dataTablelov
let
datas
=
array
[
array
.
length
-
1
]
console
.
log
(
datas
);
this
.
setState
({
dataTable
:
this
.
props
.
dataTablelov
,
diff
:
datas
[
16
],
perBS
:
datas
[
18
]})
this
.
setState
({
dataTable
:
this
.
props
.
dataTablelov
,
diff
:
datas
[
16
],
perBS
:
datas
[
18
]
})
}
if
(
this
.
props
.
loadingChild
!==
prevProps
.
loadingChild
)
{
this
.
setState
({
loading
:
this
.
props
.
loadingChild
})
this
.
setState
({
loading
:
this
.
props
.
loadingChild
})
}
}
...
...
@@ -354,7 +354,7 @@ export default class LOV extends Component {
"expected_return"
:
i
[
8
],
"currency"
:
i
[
9
],
"investment_amount_ori"
:
i
[
10
]
!==
undefined
?
Number
(
i
[
10
])
:
i
[
10
],
"investment_amount_cur
r
"
:
i
[
11
]
!==
undefined
?
Number
(
i
[
11
])
:
i
[
11
],
"investment_amount_cur"
:
i
[
11
]
!==
undefined
?
Number
(
i
[
11
])
:
i
[
11
],
"notes"
:
i
[
12
],
})
}
...
...
@@ -400,14 +400,49 @@ export default class LOV extends Component {
})
api
.
create
().
checkUploadMonthlyReportLOV
(
payload
).
then
(
response
=>
{
let
dataTable
=
[]
console
.
log
(
response
)
let
dataTable
=
[]
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
let
tgl
=
String
(
item
.
lov
.
placement_date
).
split
(
'-'
)
if
(
indexIDzz
===
-
1
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
visibleUpload
:
false
,
loading
:
true
,
visibleLOVMR
:
false
})
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
let
tgl
=
String
(
item
.
lov
.
placement_date
).
split
(
'-'
)
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
String
(
item
.
lov
.
institution_name
).
includes
(
'Total'
)
?
null
:
item
.
lov
.
company_name
===
null
||
item
.
lov
.
company_name
===
""
?
this
.
props
.
company
.
company_name
:
item
.
lov
.
company_name
,
item
.
lov
.
institution_name
===
null
||
item
.
lov
.
institution_name
===
""
?
""
:
item
.
lov
.
institution_name
,
item
.
lov
.
type_of_investment
===
null
?
null
:
item
.
lov
.
type_of_investment
===
""
?
null
:
{
value
:
item
.
lov
.
type_of_investment
},
item
.
lov
.
remarks
===
null
||
item
.
lov
.
remarks
===
""
?
""
:
item
.
lov
.
remarks
,
item
.
lov
.
placement_date
==
null
||
item
.
lov
.
placement_date
==
""
?
null
:
(
item
.
lov
.
placement_date
!==
"null"
?
String
(
tgl
[
2
]).
length
>
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
item
.
lov
.
placement_date
)
:
null
),
item
.
lov
.
tenor
===
null
||
item
.
lov
.
tenor
===
""
?
""
:
item
.
lov
.
tenor
,
item
.
lov
.
expected_return
===
null
||
item
.
lov
.
expected_return
===
""
?
"0.0"
:
item
.
lov
.
expected_return
,
item
.
lov
.
currency
===
null
?
null
:
item
.
lov
.
currency
===
""
?
null
:
{
value
:
item
.
lov
.
currency
},
item
.
lov
.
investment_amount_ori
===
null
?
"0.0"
:
item
.
lov
.
investment_amount_ori
===
""
?
"0.0"
:
item
.
lov
.
investment_amount_ori
,
item
.
lov
.
investment_amount_cur
===
null
?
"0.0"
:
item
.
lov
.
investment_amount_cur
===
""
?
"0.0"
:
item
.
lov
.
investment_amount_cur
,
item
.
lov
.
notes
,
item
.
diff
,
item
.
total_loan
,
item
.
per_bs
// index
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
let
tgl
=
String
(
item
.
lov
.
placement_date
).
split
(
'-'
)
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
...
...
@@ -430,223 +465,200 @@ export default class LOV extends Component {
item
.
per_bs
// index
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
let
tgl
=
String
(
item
.
lov
.
placement_date
).
split
(
'-'
)
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
String
(
item
.
lov
.
institution_name
).
includes
(
'Total'
)
?
null
:
item
.
lov
.
company_name
===
null
||
item
.
lov
.
company_name
===
""
?
this
.
props
.
company
.
company_name
:
item
.
lov
.
company_name
,
item
.
lov
.
institution_name
===
null
||
item
.
lov
.
institution_name
===
""
?
""
:
item
.
lov
.
institution_name
,
item
.
lov
.
type_of_investment
===
null
?
null
:
item
.
lov
.
type_of_investment
===
""
?
null
:
{
value
:
item
.
lov
.
type_of_investment
},
item
.
lov
.
remarks
===
null
||
item
.
lov
.
remarks
===
""
?
""
:
item
.
lov
.
remarks
,
item
.
lov
.
placement_date
==
null
||
item
.
lov
.
placement_date
==
""
?
null
:
(
item
.
lov
.
placement_date
!==
"null"
?
String
(
tgl
[
2
]).
length
>
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
item
.
lov
.
placement_date
)
:
null
),
item
.
lov
.
tenor
===
null
||
item
.
lov
.
tenor
===
""
?
""
:
item
.
lov
.
tenor
,
item
.
lov
.
expected_return
===
null
||
item
.
lov
.
expected_return
===
""
?
"0.0"
:
item
.
lov
.
expected_return
,
item
.
lov
.
currency
===
null
?
null
:
item
.
lov
.
currency
===
""
?
null
:
{
value
:
item
.
lov
.
currency
},
item
.
lov
.
investment_amount_ori
===
null
?
"0.0"
:
item
.
lov
.
investment_amount_ori
===
""
?
"0.0"
:
item
.
lov
.
investment_amount_ori
,
item
.
lov
.
investment_amount_cur
===
null
?
"0.0"
:
item
.
lov
.
investment_amount_cur
===
""
?
"0.0"
:
item
.
lov
.
investment_amount_cur
,
item
.
lov
.
notes
,
item
.
diff
,
item
.
total_loan
,
item
.
per_bs
// index
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
})
console
.
log
(
dataTable
)
let
lastArray
=
dataTable
[
res
.
length
-
1
]
console
.
log
(
lastArray
);
this
.
setState
({
dataTable
,
diff
:
lastArray
[
16
],
perBS
:
lastArray
[
18
],
loading
:
false
,
visibleLOVMR
:
true
},
()
=>
{
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOV'
)
})
}
})
}
uploadLOCF
(
type
)
{
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
this
.
state
.
dataTable
.
map
(
i
=>
{
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
}
if
(
i
[
7
].
value
==
'Others'
&&
i
[
18
]
==
''
)
{
error
=
true
}
let
tgl
=
String
(
i
[
9
]).
split
(
'-'
)
let
checkUndifined
=
tgl
.
findIndex
((
val
)
=>
val
==
undefined
)
if
(
this
.
props
.
defaultCurrency
.
id
==
2
)
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
// "loan_maturity_date": i[9],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
Number
(
i
[
12
])
==
""
?
"0.0"
:
Number
(
i
[
12
]),
"loan_plafond_amount_idr"
:
Number
(
i
[
13
])
==
""
?
"0.0"
:
Number
(
i
[
13
]),
"out_loan_ki_amount_ori"
:
Number
(
i
[
14
])
==
""
?
"0.0"
:
Number
(
i
[
14
]),
"out_loan_ki_amount_idr"
:
Number
(
i
[
15
])
==
""
?
"0.0"
:
Number
(
i
[
15
]),
"out_loan_kmk_amount_ori"
:
Number
(
i
[
16
])
==
""
?
"0.0"
:
Number
(
i
[
16
]),
"out_loan_kmk_amount_idr"
:
Number
(
i
[
17
])
==
""
?
"0.0"
:
Number
(
i
[
17
]),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
Number
(
i
[
19
])
==
""
?
"0.0"
:
Number
(
i
[
19
]),
"out_loan_other_amount_idr"
:
Number
(
i
[
20
])
==
""
?
"0.0"
:
Number
(
i
[
20
]),
"total_out_loan_ori"
:
Number
(
i
[
21
])
==
""
?
"0.0"
:
Number
(
i
[
21
]),
"total_out_loan_idr"
:
Number
(
i
[
22
])
==
""
?
"0.0"
:
Number
(
i
[
22
]),
"remaining_plafond_ori"
:
Number
(
i
[
23
])
==
""
?
"0.0"
:
Number
(
i
[
23
]),
"remaining_plafond_idr"
:
Number
(
i
[
24
])
==
""
?
"0.0"
:
Number
(
i
[
24
]),
"current_ratio_financial"
:
Number
(
i
[
25
])
==
""
?
"0.00"
:
Number
(
i
[
25
]),
"current_ratio_current"
:
Number
(
i
[
26
])
==
""
?
"0.00"
:
Number
(
i
[
26
]),
"der_financial"
:
Number
(
i
[
27
])
==
""
?
"0.00"
:
Number
(
i
[
27
]),
"der_current"
:
Number
(
i
[
28
])
==
""
?
"0.00"
:
Number
(
i
[
28
]),
"debt_to_ebitda_financial"
:
Number
(
i
[
29
])
==
""
?
"0.00"
:
Number
(
i
[
29
]),
"debt_to_ebitda_current"
:
Number
(
i
[
30
])
==
""
?
"0.00"
:
Number
(
i
[
30
]),
"ebitda_to_interest_financial"
:
Number
(
i
[
31
])
==
""
?
"0.00"
:
Number
(
i
[
31
]),
"ebitda_to_interest_current"
:
Number
(
i
[
32
])
==
""
?
"0.00"
:
Number
(
i
[
32
]),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
Number
(
i
[
34
])
==
""
?
"0.00"
:
Number
(
i
[
34
]),
"other_ratio1_current"
:
Number
(
i
[
35
])
==
""
?
"0.00"
:
Number
(
i
[
35
]),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
Number
(
i
[
37
])
==
""
?
"0.00"
:
Number
(
i
[
37
]),
"other_ratio2_current"
:
Number
(
i
[
38
])
==
""
?
"0.00"
:
Number
(
i
[
38
]),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
Number
(
i
[
40
])
==
""
?
"0.00"
:
Number
(
i
[
40
]),
"other_ratio3_current"
:
Number
(
i
[
41
])
==
""
?
"0.00"
:
Number
(
i
[
41
]),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
Number
(
i
[
43
])
==
""
?
"0.00"
:
Number
(
i
[
43
]),
"other_ratio4_current"
:
Number
(
i
[
44
])
==
""
?
"0.00"
:
Number
(
i
[
44
]),
"notes"
:
i
[
45
],
})
console
.
log
(
dataTable
)
let
lastArray
=
dataTable
[
dataTable
.
length
-
1
]
console
.
log
(
lastArray
);
this
.
setState
({
dataTable
,
diff
:
lastArray
[
16
],
perBS
:
lastArray
[
18
],
loading
:
false
,
visibleLOVMR
:
true
},
()
=>
{
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOV'
,
'upload'
)
})
}
else
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
// "loan_maturity_date": i[9],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
fixNumber
(
Number
(
i
[
12
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
12
]),
1
),
"loan_plafond_amount_idr"
:
fixNumber
(
Number
(
i
[
13
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
13
]),
1
),
"out_loan_ki_amount_ori"
:
fixNumber
(
Number
(
i
[
14
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
14
]),
1
),
"out_loan_ki_amount_idr"
:
fixNumber
(
Number
(
i
[
15
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
15
]),
1
),
"out_loan_kmk_amount_ori"
:
fixNumber
(
Number
(
i
[
16
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
16
]),
1
),
"out_loan_kmk_amount_idr"
:
fixNumber
(
Number
(
i
[
17
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
17
]),
1
),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
fixNumber
(
Number
(
i
[
19
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
19
]),
1
),
"out_loan_other_amount_idr"
:
fixNumber
(
Number
(
i
[
20
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
20
]),
1
),
"total_out_loan_ori"
:
fixNumber
(
Number
(
i
[
21
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
21
]),
1
),
"total_out_loan_idr"
:
fixNumber
(
Number
(
i
[
22
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
22
]),
1
),
"remaining_plafond_ori"
:
fixNumber
(
Number
(
i
[
23
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
23
]),
1
),
"remaining_plafond_idr"
:
fixNumber
(
Number
(
i
[
24
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
24
]),
1
),
"current_ratio_financial"
:
fixNumber
(
Number
(
i
[
25
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
25
]),
2
),
"current_ratio_current"
:
fixNumber
(
Number
(
i
[
26
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
26
]),
2
),
"der_financial"
:
fixNumber
(
Number
(
i
[
27
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
27
]),
2
),
"der_current"
:
fixNumber
(
Number
(
i
[
28
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
28
]),
2
),
"debt_to_ebitda_financial"
:
fixNumber
(
Number
(
i
[
29
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
29
]),
2
),
"debt_to_ebitda_current"
:
fixNumber
(
Number
(
i
[
30
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
30
]),
2
),
"ebitda_to_interest_financial"
:
fixNumber
(
Number
(
i
[
31
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
31
]),
2
),
"ebitda_to_interest_current"
:
fixNumber
(
Number
(
i
[
32
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
32
]),
2
),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
fixNumber
(
Number
(
i
[
34
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
34
]),
2
),
"other_ratio1_current"
:
fixNumber
(
Number
(
i
[
35
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
35
]),
2
),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
fixNumber
(
Number
(
i
[
37
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
37
]),
2
),
"other_ratio2_current"
:
fixNumber
(
Number
(
i
[
38
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
38
]),
2
),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
fixNumber
(
Number
(
i
[
40
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
40
]),
2
),
"other_ratio3_current"
:
fixNumber
(
Number
(
i
[
41
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
41
]),
2
),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
fixNumber
(
Number
(
i
[
43
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
43
]),
2
),
"other_ratio4_current"
:
fixNumber
(
Number
(
i
[
44
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
44
]),
2
),
"notes"
:
i
[
45
],
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
typeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
let
body
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"locf"
:
data
,
"per_bs"
:
this
.
state
.
perBS
,
"diff"
:
this
.
state
.
diff
,
"total_loan"
:
this
.
state
.
perBS
}
console
.
log
(
JSON
.
stringify
(
body
));
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportLOCF
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
// this.props.onClickClose()
// this.props.getReport()
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
// alert(response.data.status)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
this
.
setState
({
handleDoubleClick
:
0
})
})
}
}
// uploadLOCF(type) {
// let data = []
// let error = false
// this.deleteReport()
// this.state.dataTable.map(i => {
// if (i[0] == 3) {
// if (i[6] == null || i[7] == null || i[8] == "" || i[9] == "" || i[10] == "" || i[11] == "") {
// error = true
// }
// if (i[7].value == 'Others' && i[18] == '') {
// error = true
// }
// let tgl = String(i[9]).split('-')
// let checkUndifined = tgl.findIndex((val) => val == undefined)
// if (this.props.defaultCurrency.id == 2) {
// data.push({
// "item_report_id": i[1],
// "borrower_comp_name": i[5],
// "bank_name": i[6] == null ? [6] : i[6].value,
// "type_of_credit": i[7] == null ? i[7] : i[7].value,
// "remarks": i[8],
// // "loan_maturity_date": i[9],
// "loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null ? "" : (String(tgl[2]).length <= 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
// // "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
// "interest": i[10] == "" ? "0.00" : i[10],
// "currency": i[11],
// "loan_plafond_amount_ori": Number(i[12]) == "" ? "0.0" : Number(i[12]),
// "loan_plafond_amount_idr": Number(i[13]) == "" ? "0.0" : Number(i[13]),
// "out_loan_ki_amount_ori": Number(i[14]) == "" ? "0.0" : Number(i[14]),
// "out_loan_ki_amount_idr": Number(i[15]) == "" ? "0.0" : Number(i[15]),
// "out_loan_kmk_amount_ori": Number(i[16]) == "" ? "0.0" : Number(i[16]),
// "out_loan_kmk_amount_idr": Number(i[17]) == "" ? "0.0" : Number(i[17]),
// // "mtd_vs_previous_month": i[18],
// "out_loan_other_type": i[18],
// "out_loan_other_amount_ori": Number(i[19]) == "" ? "0.0" : Number(i[19]),
// "out_loan_other_amount_idr": Number(i[20]) == "" ? "0.0" : Number(i[20]),
// "total_out_loan_ori": Number(i[21]) == "" ? "0.0" : Number(i[21]),
// "total_out_loan_idr": Number(i[22]) == "" ? "0.0" : Number(i[22]),
// "remaining_plafond_ori": Number(i[23]) == "" ? "0.0" : Number(i[23]),
// "remaining_plafond_idr": Number(i[24]) == "" ? "0.0" : Number(i[24]),
// "current_ratio_financial": Number(i[25]) == "" ? "0.00" : Number(i[25]),
// "current_ratio_current": Number(i[26]) == "" ? "0.00" : Number(i[26]),
// "der_financial": Number(i[27]) == "" ? "0.00" : Number(i[27]),
// "der_current": Number(i[28]) == "" ? "0.00" : Number(i[28]),
// "debt_to_ebitda_financial": Number(i[29]) == "" ? "0.00" : Number(i[29]),
// "debt_to_ebitda_current": Number(i[30]) == "" ? "0.00" : Number(i[30]),
// "ebitda_to_interest_financial": Number(i[31]) == "" ? "0.00" : Number(i[31]),
// "ebitda_to_interest_current": Number(i[32]) == "" ? "0.00" : Number(i[32]),
// "other_ratio1_ratio_name": i[33],
// "other_ratio1_financial": Number(i[34]) == "" ? "0.00" : Number(i[34]),
// "other_ratio1_current": Number(i[35]) == "" ? "0.00" : Number(i[35]),
// "other_ratio2_ratio_name": i[36],
// "other_ratio2_financial": Number(i[37]) == "" ? "0.00" : Number(i[37]),
// "other_ratio2_current": Number(i[38]) == "" ? "0.00" : Number(i[38]),
// "other_ratio3_ratio_name": i[39],
// "other_ratio3_financial": Number(i[40]) == "" ? "0.00" : Number(i[40]),
// "other_ratio3_current": Number(i[41]) == "" ? "0.00" : Number(i[41]),
// "other_ratio4_ratio_name": i[42],
// "other_ratio4_financial": Number(i[43]) == "" ? "0.00" : Number(i[43]),
// "other_ratio4_current": Number(i[44]) == "" ? "0.00" : Number(i[44]),
// "notes": i[45],
// })
// } else {
// data.push({
// "item_report_id": i[1],
// "borrower_comp_name": i[5],
// "bank_name": i[6] == null ? [6] : i[6].value,
// "type_of_credit": i[7] == null ? i[7] : i[7].value,
// "remarks": i[8],
// // "loan_maturity_date": i[9],
// "loan_maturity_date": i[9] == undefined || i[9] == "null" || i[9] == null ? "" : (String(tgl[2]).length <= 2 ? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])),
// // "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
// "interest": i[10] == "" ? "0.00" : i[10],
// "currency": i[11],
// "loan_plafond_amount_ori": fixNumber(Number(i[12]), 1) == "" ? "0.0" : fixNumber(Number(i[12]), 1),
// "loan_plafond_amount_idr": fixNumber(Number(i[13]), 1) == "" ? "0.0" : fixNumber(Number(i[13]), 1),
// "out_loan_ki_amount_ori": fixNumber(Number(i[14]), 1) == "" ? "0.0" : fixNumber(Number(i[14]), 1),
// "out_loan_ki_amount_idr": fixNumber(Number(i[15]), 1) == "" ? "0.0" : fixNumber(Number(i[15]), 1),
// "out_loan_kmk_amount_ori": fixNumber(Number(i[16]), 1) == "" ? "0.0" : fixNumber(Number(i[16]), 1),
// "out_loan_kmk_amount_idr": fixNumber(Number(i[17]), 1) == "" ? "0.0" : fixNumber(Number(i[17]), 1),
// // "mtd_vs_previous_month": i[18],
// "out_loan_other_type": i[18],
// "out_loan_other_amount_ori": fixNumber(Number(i[19]), 1) == "" ? "0.0" : fixNumber(Number(i[19]), 1),
// "out_loan_other_amount_idr": fixNumber(Number(i[20]), 1) == "" ? "0.0" : fixNumber(Number(i[20]), 1),
// "total_out_loan_ori": fixNumber(Number(i[21]), 1) == "" ? "0.0" : fixNumber(Number(i[21]), 1),
// "total_out_loan_idr": fixNumber(Number(i[22]), 1) == "" ? "0.0" : fixNumber(Number(i[22]), 1),
// "remaining_plafond_ori": fixNumber(Number(i[23]), 1) == "" ? "0.0" : fixNumber(Number(i[23]), 1),
// "remaining_plafond_idr": fixNumber(Number(i[24]), 1) == "" ? "0.0" : fixNumber(Number(i[24]), 1),
// "current_ratio_financial": fixNumber(Number(i[25]), 2) == "" ? "0.00" : fixNumber(Number(i[25]), 2),
// "current_ratio_current": fixNumber(Number(i[26]), 2) == "" ? "0.00" : fixNumber(Number(i[26]), 2),
// "der_financial": fixNumber(Number(i[27]), 2) == "" ? "0.00" : fixNumber(Number(i[27]), 2),
// "der_current": fixNumber(Number(i[28]), 2) == "" ? "0.00" : fixNumber(Number(i[28]), 2),
// "debt_to_ebitda_financial": fixNumber(Number(i[29]), 2) == "" ? "0.00" : fixNumber(Number(i[29]), 2),
// "debt_to_ebitda_current": fixNumber(Number(i[30]), 2) == "" ? "0.00" : fixNumber(Number(i[30]), 2),
// "ebitda_to_interest_financial": fixNumber(Number(i[31]), 2) == "" ? "0.00" : fixNumber(Number(i[31]), 2),
// "ebitda_to_interest_current": fixNumber(Number(i[32]), 2) == "" ? "0.00" : fixNumber(Number(i[32]), 2),
// "other_ratio1_ratio_name": i[33],
// "other_ratio1_financial": fixNumber(Number(i[34]), 2) == "" ? "0.00" : fixNumber(Number(i[34]), 2),
// "other_ratio1_current": fixNumber(Number(i[35]), 2) == "" ? "0.00" : fixNumber(Number(i[35]), 2),
// "other_ratio2_ratio_name": i[36],
// "other_ratio2_financial": fixNumber(Number(i[37]), 2) == "" ? "0.00" : fixNumber(Number(i[37]), 2),
// "other_ratio2_current": fixNumber(Number(i[38]), 2) == "" ? "0.00" : fixNumber(Number(i[38]), 2),
// "other_ratio3_ratio_name": i[39],
// "other_ratio3_financial": fixNumber(Number(i[40]), 2) == "" ? "0.00" : fixNumber(Number(i[40]), 2),
// "other_ratio3_current": fixNumber(Number(i[41]), 2) == "" ? "0.00" : fixNumber(Number(i[41]), 2),
// "other_ratio4_ratio_name": i[42],
// "other_ratio4_financial": fixNumber(Number(i[43]), 2) == "" ? "0.00" : fixNumber(Number(i[43]), 2),
// "other_ratio4_current": fixNumber(Number(i[44]), 2) == "" ? "0.00" : fixNumber(Number(i[44]), 2),
// "notes": i[45],
// })
// }
// }
// })
// let body = {
// "monthly_report_id": this.props.monthlyReportId,
// "company_id": this.props.company.company_id,
// "periode": this.props.periode,
// "report_id": this.props.report_id,
// "status": type,
// "months": this.props.month.month_id,
// "currency_id": this.props.defaultCurrency.id,
// "locf": data,
// "per_bs": this.state.perBS,
// "diff": this.state.diff,
// "total_loan": this.state.perBS
// }
// console.log(JSON.stringify(body));
// if (error && type == 'submitted') {
// this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
// } else {
// api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
// console.log(response);
// if (response.data) {
// if (response.ok) {
// if (response.data.status === "success") {
// this.props.saveToMonthlyReport('LOCF')
// // this.props.onClickClose()
// // this.props.getReport()
// } else {
// if (response.data?.message == "Please Set Up Rate Currency First") {
// this.setState({ visibleAlertSave: true })
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
// if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// })
// }
// // alert(response.data.status)
// }
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
// }
// this.setState({ handleDoubleClick: 0 })
// })
// }
// }
getListCurrency
()
{
this
.
setState
({
dataLoaded
:
false
})
api
.
create
().
getDataCurrency
().
then
(
response
=>
{
...
...
@@ -796,444 +808,6 @@ export default class LOV extends Component {
})
}
// getPerBS() {
// let payload = {
// "report_id": this.props.report_id,
// "revision": Number(this.props.revision),
// "periode": this.props.periode,
// "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.props.get_for
// }
// api.create().getPerBSiMontlyReportLOV(payload).then((response) => {
// console.log(response)
// if (this.props.get_for == 'view') {
// this.setState({ perBS: "0.0" })
// } else {
// if (response.data) {
// if (response.data.status == "success") {
// this.setState({
// perBS: this.props.defaultCurrency.id == 1 ? (response.data.data.per_bs == null || response.data.data.per_bs == '' ? fixNumber(Number(0), 1) : fixNumber(Number(response.data.data.per_bs), 1)) : (response.data.data.per_bs == null || response.data.data.per_bs == '' ? Number(0) : Number(response.data.data.per_bs)),
// totalOutStand: response.data.data.total_loan,
// diff: response.data.data.diff
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
// }
// }
// })
// }
backToMonthlyReport
(
type
)
{
// this.setState({ loading: true })
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
this
.
state
.
dataTable
.
map
(
i
=>
{
console
.
log
(
i
);
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
}
if
(
i
[
7
].
value
==
'Others'
&&
i
[
18
]
==
''
)
{
error
=
true
}
let
tgl
=
String
(
i
[
9
]).
split
(
'-'
)
let
checkUndifined
=
tgl
.
findIndex
((
val
)
=>
val
==
undefined
)
if
(
this
.
props
.
defaultCurrency
.
id
==
2
)
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9],
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
Number
(
i
[
12
])
==
""
?
"0.0"
:
Number
(
i
[
12
]),
"loan_plafond_amount_idr"
:
Number
(
i
[
13
])
==
""
?
"0.0"
:
Number
(
i
[
13
]),
"out_loan_ki_amount_ori"
:
Number
(
i
[
14
])
==
""
?
"0.0"
:
Number
(
i
[
14
]),
"out_loan_ki_amount_idr"
:
Number
(
i
[
15
])
==
""
?
"0.0"
:
Number
(
i
[
15
]),
"out_loan_kmk_amount_ori"
:
Number
(
i
[
16
])
==
""
?
"0.0"
:
Number
(
i
[
16
]),
"out_loan_kmk_amount_idr"
:
Number
(
i
[
17
])
==
""
?
"0.0"
:
Number
(
i
[
17
]),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
Number
(
i
[
19
])
==
""
?
"0.0"
:
Number
(
i
[
19
]),
"out_loan_other_amount_idr"
:
Number
(
i
[
20
])
==
""
?
"0.0"
:
Number
(
i
[
20
]),
"total_out_loan_ori"
:
Number
(
i
[
21
])
==
""
?
"0.0"
:
Number
(
i
[
21
]),
"total_out_loan_idr"
:
Number
(
i
[
22
])
==
""
?
"0.0"
:
Number
(
i
[
22
]),
"remaining_plafond_ori"
:
Number
(
i
[
23
])
==
""
?
"0.0"
:
Number
(
i
[
23
]),
"remaining_plafond_idr"
:
Number
(
i
[
24
])
==
""
?
"0.0"
:
Number
(
i
[
24
]),
"current_ratio_financial"
:
Number
(
i
[
25
])
==
""
?
"0.00"
:
Number
(
i
[
25
]),
"current_ratio_current"
:
Number
(
i
[
26
])
==
""
?
"0.00"
:
Number
(
i
[
26
]),
"der_financial"
:
Number
(
i
[
27
])
==
""
?
"0.00"
:
Number
(
i
[
27
]),
"der_current"
:
Number
(
i
[
28
])
==
""
?
"0.00"
:
Number
(
i
[
28
]),
"debt_to_ebitda_financial"
:
Number
(
i
[
29
])
==
""
?
"0.00"
:
Number
(
i
[
29
]),
"debt_to_ebitda_current"
:
Number
(
i
[
30
])
==
""
?
"0.00"
:
Number
(
i
[
30
]),
"ebitda_to_interest_financial"
:
Number
(
i
[
31
])
==
""
?
"0.00"
:
Number
(
i
[
31
]),
"ebitda_to_interest_current"
:
Number
(
i
[
32
])
==
""
?
"0.00"
:
Number
(
i
[
32
]),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
Number
(
i
[
34
])
==
""
?
"0.00"
:
Number
(
i
[
34
]),
"other_ratio1_current"
:
Number
(
i
[
35
])
==
""
?
"0.00"
:
Number
(
i
[
35
]),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
Number
(
i
[
37
])
==
""
?
"0.00"
:
Number
(
i
[
37
]),
"other_ratio2_current"
:
Number
(
i
[
38
])
==
""
?
"0.00"
:
Number
(
i
[
38
]),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
Number
(
i
[
40
])
==
""
?
"0.00"
:
Number
(
i
[
40
]),
"other_ratio3_current"
:
Number
(
i
[
41
])
==
""
?
"0.00"
:
Number
(
i
[
41
]),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
Number
(
i
[
43
])
==
""
?
"0.00"
:
Number
(
i
[
43
]),
"other_ratio4_current"
:
Number
(
i
[
44
])
==
""
?
"0.00"
:
Number
(
i
[
44
]),
"notes"
:
i
[
45
],
})
}
else
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9],
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
fixNumber
(
Number
(
i
[
12
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
12
]),
1
),
"loan_plafond_amount_idr"
:
fixNumber
(
Number
(
i
[
13
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
13
]),
1
),
"out_loan_ki_amount_ori"
:
fixNumber
(
Number
(
i
[
14
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
14
]),
1
),
"out_loan_ki_amount_idr"
:
fixNumber
(
Number
(
i
[
15
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
15
]),
1
),
"out_loan_kmk_amount_ori"
:
fixNumber
(
Number
(
i
[
16
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
16
]),
1
),
"out_loan_kmk_amount_idr"
:
fixNumber
(
Number
(
i
[
17
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
17
]),
1
),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
fixNumber
(
Number
(
i
[
19
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
19
]),
1
),
"out_loan_other_amount_idr"
:
fixNumber
(
Number
(
i
[
20
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
20
]),
1
),
"total_out_loan_ori"
:
fixNumber
(
Number
(
i
[
21
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
21
]),
1
),
"total_out_loan_idr"
:
fixNumber
(
Number
(
i
[
22
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
22
]),
1
),
"remaining_plafond_ori"
:
fixNumber
(
Number
(
i
[
23
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
23
]),
1
),
"remaining_plafond_idr"
:
fixNumber
(
Number
(
i
[
24
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
24
]),
1
),
"current_ratio_financial"
:
fixNumber
(
Number
(
i
[
25
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
25
]),
2
),
"current_ratio_current"
:
fixNumber
(
Number
(
i
[
26
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
26
]),
2
),
"der_financial"
:
fixNumber
(
Number
(
i
[
27
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
27
]),
2
),
"der_current"
:
fixNumber
(
Number
(
i
[
28
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
28
]),
2
),
"debt_to_ebitda_financial"
:
fixNumber
(
Number
(
i
[
29
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
29
]),
2
),
"debt_to_ebitda_current"
:
fixNumber
(
Number
(
i
[
30
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
30
]),
2
),
"ebitda_to_interest_financial"
:
fixNumber
(
Number
(
i
[
31
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
31
]),
2
),
"ebitda_to_interest_current"
:
fixNumber
(
Number
(
i
[
32
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
32
]),
2
),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
fixNumber
(
Number
(
i
[
34
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
34
]),
2
),
"other_ratio1_current"
:
fixNumber
(
Number
(
i
[
35
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
35
]),
2
),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
fixNumber
(
Number
(
i
[
37
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
37
]),
2
),
"other_ratio2_current"
:
fixNumber
(
Number
(
i
[
38
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
38
]),
2
),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
fixNumber
(
Number
(
i
[
40
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
40
]),
2
),
"other_ratio3_current"
:
fixNumber
(
Number
(
i
[
41
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
41
]),
2
),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
fixNumber
(
Number
(
i
[
43
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
43
]),
2
),
"other_ratio4_current"
:
fixNumber
(
Number
(
i
[
44
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
44
]),
2
),
"notes"
:
i
[
45
],
})
}
}
})
let
payload
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"locf"
:
data
,
"per_bs"
:
this
.
state
.
perBS
,
"diff"
:
this
.
state
.
diff
,
"total_loan"
:
this
.
state
.
perBS
}
console
.
log
(
JSON
.
stringify
(
payload
))
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
createMonthlyReportLOCF
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
document
.
body
.
style
.
overflow
=
'unset'
;
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
this
.
props
.
saveToMonthlyReport
()
})
}
}
// else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
}
else
{
this
.
setState
({
loading
:
false
},
()
=>
{
// this.getSubmission()
document
.
body
.
style
.
overflow
=
'unset'
;
})
}
this
.
setState
({
handleDoubleClick
:
0
})
})
}
}
// handleCalculate = () => {
// let dataTable2 = this.state.dataTable
// this.setState({ loading: true }, () => {
// let bankPrev = ""
// let idPrev = 0
// let newData = []
// let dataCoba = []
// let bankNameEmpty = false
// let totalLoan = 0
// dataTable2.map((item, index) => {
// if (item[0] !== 8) {
// if (item[6] == null) {
// bankNameEmpty = true
// } else {
// let groupName = String(item[6].value).split("-")
// let indexAS = dataCoba.findIndex((val) => item[6].value.includes(val.groupName))
// if (indexAS == -1) {
// dataCoba.push({
// groupName: groupName[groupName.length - 1],
// data: [item]
// })
// } else {
// let indexDD = dataCoba[indexAS].data.length - 1 == -1 ? 0 : dataCoba[indexAS].data.length - 1
// if (String(dataCoba[indexAS].data[indexDD]).includes('Total')) {
// let dataAwal = []
// let dataAkhir = []
// dataAwal = dataCoba[indexAS].data.splice(0, dataCoba[indexAS].data.length - 2)
// dataAkhir = dataCoba[indexAS].data.splice(dataCoba[indexAS].data.length - 1, 1)
// dataAwal.push(item)
// dataCoba[indexAS].data = dataAwal.concat(dataAkhir)
// } else {
// dataCoba[indexAS].data.push(item)
// }
// }
// }
// }
// })
// console.log(dataCoba);
// let dataGabung = []
// if (!bankNameEmpty) {
// dataCoba.map((item, index) => {
// item.data.map((items, index) => {
// dataGabung.push(items)
// })
// })
// console.log(dataGabung);
// dataGabung.map((items, index) => {
// console.log(items);
// if (items[0] == 3) {
// console.log(Number(totalLoan));
// this.props.defaultCurrency.id == 1 ? totalLoan += items[22] : totalLoan += items[21]
// }
// if (bankPrev != "") {
// if (items[6].value !== bankPrev) {
// bankPrev = items[6].value
// if (items[6].value == 'Grand Total') {
// // if (dataTable2.length > 2) {
// // newData.push(items)
// // } else {
// if (String(dataGabung[index - 1][6].value).includes('Total ')) {
// newData.push(items)
// } else {
// // if (String(dataGabung[index][6].value).includes('Total ')) {
// // newData.push(items)
// // } else {
// // items[46] = index + 1
// let nameTotal = String(dataGabung[index - 1][6].value).split("-")
// newData.push([
// 8,
// "",
// "",
// "",
// "",
// "",
// { value: 'Total ' + nameTotal[nameTotal.length - 1] },
// null,
// "",
// null,
// "0.00",
// "",
// "",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "",
// "0",
// "0",
// "0",
// "0",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// index],
// items,
// )
// // }
// }
// // }
// } else {
// if (String(dataGabung[index - 1][6].value).includes('Total ')) {
// newData.push(items)
// } else {
// if (String(dataGabung[index][6].value).includes('Total ')) {
// newData.push(items)
// } else {
// items[46] = index + 1
// let nameTotal = String(dataGabung[index - 1][6].value).split("-")
// newData.push([
// 8,
// "",
// "",
// "",
// "",
// "",
// { value: 'Total ' + nameTotal[nameTotal.length - 1] },
// null,
// "",
// null,
// "0.00",
// "",
// "",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "",
// "0",
// "0",
// "0",
// "0",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "0",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// "",
// index],
// items,
// )
// }
// }
// }
// }
// else {
// newData.push(items)
// }
// } else {
// bankPrev = items[6].value
// idPrev = items[0]
// newData.push(items)
// }
// })
// } else {
// if (this.props.get_for == 'edit') {
// this.setState({ snekbar: true, snekbarMsg: 'Bank Names Cannot be Empty' })
// }
// }
// setTimeout(() => {
// // console.log(dataCoba)
// // console.log(dataGabung)
// console.log(newData)
// // console.log(dataTampungBank)
// console.log(totalLoan);
// console.log(this.state.perBS)
// console.log(this.state.diff)
// console.log(bankNameEmpty)
// // dataTable: newData, totalOutStand: newData[newData.length-1][22]
// if (bankNameEmpty) {
// if (this.props.get_for == 'view') {
// this.setState({ loading: false, dataTable: this.state.dataTable, diff: this.state.diff == null ? "0.0" : this.props.defaultCurrency.id == 1 ? fixNumber(Number(0 - this.state.perBS), 1) : Number(0 - this.state.perBS), perBS: this.state.totalOutStand == null ? "0.0" : this.state.totalOutStand, saveDraft: false, saveComp: true })
// } else {
// this.setState({ loading: false, dataTable: this.state.dataTable, diff: this.props.defaultCurrency.id == 1 ? fixNumber(Number(0 - this.state.perBS), 1) : Number(0 - this.state.perBS), saveDraft: false, saveComp: true })
// }
// } else {
// if (this.props.get_for == 'view') {
// if (this.props.defaultCurrency.id == 1) {
// this.setState({ loading: false, dataTable: newData, diff: this.state.diff == null ? "0.0" : fixNumber(Number(fixNumber(Number(totalLoan), 1) - this.state.perBS), 1), perBS: this.state.totalOutStand == null ? "0.0" : this.state.totalOutStand })
// } else {
// this.setState({ loading: false, dataTable: newData, diff: this.state.diff == null ? "0.0" : fixNumber(Number(Number(totalLoan) - this.state.perBS), 1), perBS: this.state.totalOutStand == null ? "0.0" : this.state.totalOutStand })
// }
// } else {
// if (this.props.defaultCurrency.id == 1) {
// this.setState({ loading: false, dataTable: newData, diff: fixNumber(Number(fixNumber(Number(totalLoan), 1) - this.state.perBS), 1), saveDraft: false, saveComp: Number(fixNumber(Number(totalLoan), 1) - this.state.perBS) == 0 || fixNumber(Number(fixNumber(Number(totalLoan), 1) - this.state.perBS), 1) == "-0.0" ? false : true })
// } else {
// this.setState({ loading: false, dataTable: newData, diff: fixNumber(Number(Number(totalLoan) - this.state.perBS), 1), saveDraft: false, saveComp: Number(Number(totalLoan) - this.state.perBS) == 0 || fixNumber(Number(Number(totalLoan) - this.state.perBS), 1) == "-0.0" ? false : true })
// }
// }
// }
// }, 100);
// })
// }
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
...
...
src/container/MonthlyReport/ListOfCreditFacilitiesMR.js
View file @
c618f6c1
...
...
@@ -247,43 +247,6 @@ export default class ListOfCreditFacilities extends Component {
}
}
downloadTemplate
=
async
()
=>
{
let
res
=
await
fetch
(
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/locf/monthly_report/download_template?report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&months=
${
this
.
props
.
month
.
month_id
}
&¤cy_id=
${
this
.
props
.
defaultCurrency
.
id
}
`
)
res
=
await
res
.
blob
()
// console.log(this.props.report_id)
// console.log(this.props.company.company_id)
// console.log(this.props.periode)
// console.log(this.props.month.month_id)
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
'Template Monthly Report List of Credit Facilities.xlsx'
;
a
.
click
();
}
}
async
downloadAllData
()
{
let
url
=
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
&&months=
${
this
.
props
.
month
.
month_id
}
`
let
urls
=
`
${
process
.
env
.
REACT_APP_URL_MAIN_BE
}
/public/transaction/locf/monthly_report/export_monthly_report?monthly_report_id=
${
this
.
props
.
monthlyReportId
}
&&report_id=
${
this
.
props
.
report_id
}
&&company_id=
${
this
.
props
.
company
.
company_id
}
&&year=
${
this
.
props
.
periode
}
&&revision=
${
this
.
props
.
revision
}
&&months=
${
this
.
props
.
month
.
month_id
}
`
// console.log(url);
// console.log(urls);
let
res
=
await
fetch
(
this
.
props
.
monthlyReportId
==
null
?
url
:
urls
)
res
=
await
res
.
blob
()
this
.
setState
({
loading
:
false
})
if
(
res
.
size
>
0
)
{
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
'Monthly Report List of Credit Facilities.xlsx'
;
a
.
click
();
}
}
getSubmission
()
{
this
.
setState
({
loading
:
true
})
let
payload
=
{
...
...
@@ -309,8 +272,9 @@ export default class ListOfCreditFacilities extends Component {
})
}
backToMonthlyReport
(
type
)
{
backToMonthlyReport
LOCF
(
type
)
{
// this.setState({ loading: true })
let
dataTable2
=
this
.
state
.
dataTablelocf
==
undefined
||
this
.
state
.
tambah
==
'tambah'
||
this
.
state
.
tambah
==
'upload'
?
this
.
state
.
dataTableLOCF
:
this
.
state
.
dataTablelocf
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
...
...
@@ -481,9 +445,10 @@ export default class ListOfCreditFacilities extends Component {
handleCalculateLOCF
=
()
=>
{
this
.
setState
({
loading
:
true
})
let
dataTable2
=
this
.
state
.
dataTablelocf
==
undefined
||
this
.
state
.
tambah
==
'tambah'
?
this
.
state
.
dataTableLOCF
:
this
.
state
.
dataTablelocf
let
dataTable2
=
this
.
state
.
dataTablelocf
==
undefined
||
this
.
state
.
tambah
==
'tambah'
||
this
.
state
.
tambah
==
'upload'
?
this
.
state
.
dataTableLOCF
:
this
.
state
.
dataTablelocf
let
data
=
[]
let
error
=
false
console
.
log
(
dataTable2
);
dataTable2
.
map
(
i
=>
{
console
.
log
(
i
[
12
]);
if
(
i
[
0
]
==
3
)
{
...
...
@@ -736,6 +701,7 @@ export default class ListOfCreditFacilities extends Component {
}
}
})
console
.
log
(
error
);
let
lastArrayLOCF
=
dataTablelocf
[
res
.
length
-
1
]
this
.
setState
({
dataTablelocf
,
diffLOCF
:
lastArrayLOCF
[
46
],
perBSLOCF
:
lastArrayLOCF
[
48
],
visibleLOCFMR
:
true
,
loading
:
false
},
()
=>
{
this
.
handleCalculateLOV
()
...
...
@@ -749,7 +715,7 @@ export default class ListOfCreditFacilities extends Component {
this
.
setState
({
loading
:
true
})
console
.
log
(
this
.
state
.
dataTablelov
);
console
.
log
(
this
.
state
.
dataTableLOV
);
let
dataTable2
=
this
.
state
.
dataTablelov
==
undefined
||
this
.
state
.
tambahLOV
==
'tambah'
?
this
.
state
.
dataTableLOV
:
this
.
state
.
dataTablelov
let
dataTable2
=
this
.
state
.
dataTablelov
==
undefined
||
this
.
state
.
tambahLOV
==
'tambah'
||
this
.
state
.
tambahLOV
==
'upload'
?
this
.
state
.
dataTableLOV
:
this
.
state
.
dataTablelov
let
data
=
[]
let
error
=
false
dataTable2
.
map
(
i
=>
{
...
...
@@ -758,7 +724,7 @@ export default class ListOfCreditFacilities extends Component {
error
=
true
}
if
(
i
[
8
]
==
''
&&
i
[
7
]
.
value
==
'Time deposit'
||
i
[
7
]
.
value
==
'N/A'
)
{
if
(
i
[
8
]
==
''
&&
i
[
7
]
?.
value
==
'Time deposit'
||
i
[
7
]?
.
value
==
'N/A'
)
{
error
=
true
}
let
tgl
=
String
(
i
[
9
]).
split
(
'-'
)
...
...
@@ -888,294 +854,190 @@ export default class ListOfCreditFacilities extends Component {
this
.
setState
({
dataTablelov
,
diffLOV
:
lastArrayLOV
[
16
],
perBSLOV
:
lastArrayLOV
[
18
],
loading
:
false
,
visibleLOCFMR
:
true
,
loadingChild
:
false
},
()
=>
{
// this.handleCalculateLOV()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
// handleCalculateLOV = () => {
// let dataTable2 = this.state.dataTableLOV
// console.log(dataTable2);
// }
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
loading
=
this
.
state
.
loading
let
dataTampungBank
=
[]
let
indexNyasar
=
false
let
totalLoan
=
0
// const formatSeparator = (num) => {
// return String(num).replace(/(?<!\..*)(\d)(?=(?:\d{3})+(?:\.|$))/g, '$1,')
// return num
// }
const
handleAction
=
(
typeReport
,
tableMeta
,
typeButton
)
=>
{
// console.log(typeReport)
if
(
typeReport
==
3
)
{
if
(
dataTable2
.
length
==
2
)
{
if
(
typeButton
==
'add'
)
{
return
true
}
else
{
return
false
}
}
else
{
return
true
uploadLOCF
(
type
)
{
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
this
.
state
.
dataTable
.
map
(
i
=>
{
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
}
}
else
{
return
false
}
}
const
handleChange
=
(
value
,
tableMeta
,
column
,
typeChange
,
typeDrop
)
=>
{
let
val
=
''
if
(
typeChange
==
'date'
)
{
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
format
(
value
,
'yyyy-MM-dd'
)
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
false
})
})
}
else
{
if
(
column
!=
8
&&
column
!=
11
&&
column
!=
18
&&
column
!=
25
&&
column
!=
27
&&
column
!=
29
&&
column
!=
31
&&
column
!=
33
&&
column
!=
36
&&
column
!=
39
&&
column
!=
42
&&
column
!=
45
)
{
val
=
String
(
value
).
split
(
","
).
join
(
""
)
val
=
this
.
props
.
defaultCurrency
.
id
==
1
?
fixNumber
(
Number
(
val
),
2
)
:
Number
(
val
)
}
else
{
val
=
String
(
value
).
split
(
","
).
join
(
""
)
if
(
i
[
7
].
value
==
'Others'
&&
i
[
18
]
==
''
)
{
error
=
true
}
if
(
value
.
value
!==
undefined
)
{
if
(
value
.
value
==
'Investment Loan'
)
{
dataTable2
[
tableMeta
.
rowIndex
][
16
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
17
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
18
]
=
""
dataTable2
[
tableMeta
.
rowIndex
][
19
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
20
]
=
0
}
else
if
(
value
.
value
==
'Revolving Loan (KMK)'
)
{
dataTable2
[
tableMeta
.
rowIndex
][
14
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
15
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
18
]
=
""
dataTable2
[
tableMeta
.
rowIndex
][
19
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
20
]
=
0
}
else
if
(
value
.
value
==
'others'
)
{
dataTable2
[
tableMeta
.
rowIndex
][
14
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
15
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
16
]
=
0
dataTable2
[
tableMeta
.
rowIndex
][
17
]
=
0
}
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
value
let
tgl
=
String
(
i
[
9
]).
split
(
'-'
)
let
checkUndifined
=
tgl
.
findIndex
((
val
)
=>
val
==
undefined
)
if
(
this
.
props
.
defaultCurrency
.
id
==
2
)
{
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
// "loan_maturity_date": i[9],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
Number
(
i
[
12
])
==
""
?
"0.0"
:
Number
(
i
[
12
]),
"loan_plafond_amount_idr"
:
Number
(
i
[
13
])
==
""
?
"0.0"
:
Number
(
i
[
13
]),
"out_loan_ki_amount_ori"
:
Number
(
i
[
14
])
==
""
?
"0.0"
:
Number
(
i
[
14
]),
"out_loan_ki_amount_idr"
:
Number
(
i
[
15
])
==
""
?
"0.0"
:
Number
(
i
[
15
]),
"out_loan_kmk_amount_ori"
:
Number
(
i
[
16
])
==
""
?
"0.0"
:
Number
(
i
[
16
]),
"out_loan_kmk_amount_idr"
:
Number
(
i
[
17
])
==
""
?
"0.0"
:
Number
(
i
[
17
]),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
Number
(
i
[
19
])
==
""
?
"0.0"
:
Number
(
i
[
19
]),
"out_loan_other_amount_idr"
:
Number
(
i
[
20
])
==
""
?
"0.0"
:
Number
(
i
[
20
]),
"total_out_loan_ori"
:
Number
(
i
[
21
])
==
""
?
"0.0"
:
Number
(
i
[
21
]),
"total_out_loan_idr"
:
Number
(
i
[
22
])
==
""
?
"0.0"
:
Number
(
i
[
22
]),
"remaining_plafond_ori"
:
Number
(
i
[
23
])
==
""
?
"0.0"
:
Number
(
i
[
23
]),
"remaining_plafond_idr"
:
Number
(
i
[
24
])
==
""
?
"0.0"
:
Number
(
i
[
24
]),
"current_ratio_financial"
:
Number
(
i
[
25
])
==
""
?
"0.00"
:
Number
(
i
[
25
]),
"current_ratio_current"
:
Number
(
i
[
26
])
==
""
?
"0.00"
:
Number
(
i
[
26
]),
"der_financial"
:
Number
(
i
[
27
])
==
""
?
"0.00"
:
Number
(
i
[
27
]),
"der_current"
:
Number
(
i
[
28
])
==
""
?
"0.00"
:
Number
(
i
[
28
]),
"debt_to_ebitda_financial"
:
Number
(
i
[
29
])
==
""
?
"0.00"
:
Number
(
i
[
29
]),
"debt_to_ebitda_current"
:
Number
(
i
[
30
])
==
""
?
"0.00"
:
Number
(
i
[
30
]),
"ebitda_to_interest_financial"
:
Number
(
i
[
31
])
==
""
?
"0.00"
:
Number
(
i
[
31
]),
"ebitda_to_interest_current"
:
Number
(
i
[
32
])
==
""
?
"0.00"
:
Number
(
i
[
32
]),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
Number
(
i
[
34
])
==
""
?
"0.00"
:
Number
(
i
[
34
]),
"other_ratio1_current"
:
Number
(
i
[
35
])
==
""
?
"0.00"
:
Number
(
i
[
35
]),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
Number
(
i
[
37
])
==
""
?
"0.00"
:
Number
(
i
[
37
]),
"other_ratio2_current"
:
Number
(
i
[
38
])
==
""
?
"0.00"
:
Number
(
i
[
38
]),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
Number
(
i
[
40
])
==
""
?
"0.00"
:
Number
(
i
[
40
]),
"other_ratio3_current"
:
Number
(
i
[
41
])
==
""
?
"0.00"
:
Number
(
i
[
41
]),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
Number
(
i
[
43
])
==
""
?
"0.00"
:
Number
(
i
[
43
]),
"other_ratio4_current"
:
Number
(
i
[
44
])
==
""
?
"0.00"
:
Number
(
i
[
44
]),
"notes"
:
i
[
45
],
})
}
else
{
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
val
data
.
push
({
"item_report_id"
:
i
[
1
],
"borrower_comp_name"
:
i
[
5
],
"bank_name"
:
i
[
6
]
==
null
?
[
6
]
:
i
[
6
].
value
,
"type_of_credit"
:
i
[
7
]
==
null
?
i
[
7
]
:
i
[
7
].
value
,
"remarks"
:
i
[
8
],
// "loan_maturity_date": i[9],
"loan_maturity_date"
:
i
[
9
]
==
undefined
||
i
[
9
]
==
"null"
||
i
[
9
]
==
null
?
""
:
(
String
(
tgl
[
2
]).
length
<=
2
?
tgl
[
2
]
+
'-'
+
tgl
[
1
]
+
'-'
+
tgl
[
0
]
:
String
(
i
[
9
])),
// "loan_maturity_date": i[9] !== undefined || i[9] !== "null" || i[9] !== null? (String(tgl[2]).length <= 2? tgl[2] + '-' + tgl[1] + '-' + tgl[0] : String(i[9])) : "",
"interest"
:
i
[
10
]
==
""
?
"0.00"
:
i
[
10
],
"currency"
:
i
[
11
],
"loan_plafond_amount_ori"
:
fixNumber
(
Number
(
i
[
12
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
12
]),
1
),
"loan_plafond_amount_idr"
:
fixNumber
(
Number
(
i
[
13
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
13
]),
1
),
"out_loan_ki_amount_ori"
:
fixNumber
(
Number
(
i
[
14
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
14
]),
1
),
"out_loan_ki_amount_idr"
:
fixNumber
(
Number
(
i
[
15
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
15
]),
1
),
"out_loan_kmk_amount_ori"
:
fixNumber
(
Number
(
i
[
16
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
16
]),
1
),
"out_loan_kmk_amount_idr"
:
fixNumber
(
Number
(
i
[
17
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
17
]),
1
),
// "mtd_vs_previous_month": i[18],
"out_loan_other_type"
:
i
[
18
],
"out_loan_other_amount_ori"
:
fixNumber
(
Number
(
i
[
19
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
19
]),
1
),
"out_loan_other_amount_idr"
:
fixNumber
(
Number
(
i
[
20
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
20
]),
1
),
"total_out_loan_ori"
:
fixNumber
(
Number
(
i
[
21
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
21
]),
1
),
"total_out_loan_idr"
:
fixNumber
(
Number
(
i
[
22
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
22
]),
1
),
"remaining_plafond_ori"
:
fixNumber
(
Number
(
i
[
23
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
23
]),
1
),
"remaining_plafond_idr"
:
fixNumber
(
Number
(
i
[
24
]),
1
)
==
""
?
"0.0"
:
fixNumber
(
Number
(
i
[
24
]),
1
),
"current_ratio_financial"
:
fixNumber
(
Number
(
i
[
25
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
25
]),
2
),
"current_ratio_current"
:
fixNumber
(
Number
(
i
[
26
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
26
]),
2
),
"der_financial"
:
fixNumber
(
Number
(
i
[
27
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
27
]),
2
),
"der_current"
:
fixNumber
(
Number
(
i
[
28
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
28
]),
2
),
"debt_to_ebitda_financial"
:
fixNumber
(
Number
(
i
[
29
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
29
]),
2
),
"debt_to_ebitda_current"
:
fixNumber
(
Number
(
i
[
30
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
30
]),
2
),
"ebitda_to_interest_financial"
:
fixNumber
(
Number
(
i
[
31
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
31
]),
2
),
"ebitda_to_interest_current"
:
fixNumber
(
Number
(
i
[
32
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
32
]),
2
),
"other_ratio1_ratio_name"
:
i
[
33
],
"other_ratio1_financial"
:
fixNumber
(
Number
(
i
[
34
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
34
]),
2
),
"other_ratio1_current"
:
fixNumber
(
Number
(
i
[
35
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
35
]),
2
),
"other_ratio2_ratio_name"
:
i
[
36
],
"other_ratio2_financial"
:
fixNumber
(
Number
(
i
[
37
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
37
]),
2
),
"other_ratio2_current"
:
fixNumber
(
Number
(
i
[
38
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
38
]),
2
),
"other_ratio3_ratio_name"
:
i
[
39
],
"other_ratio3_financial"
:
fixNumber
(
Number
(
i
[
40
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
40
]),
2
),
"other_ratio3_current"
:
fixNumber
(
Number
(
i
[
41
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
41
]),
2
),
"other_ratio4_ratio_name"
:
i
[
42
],
"other_ratio4_financial"
:
fixNumber
(
Number
(
i
[
43
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
43
]),
2
),
"other_ratio4_current"
:
fixNumber
(
Number
(
i
[
44
]),
2
)
==
""
?
"0.00"
:
fixNumber
(
Number
(
i
[
44
]),
2
),
"notes"
:
i
[
45
],
})
}
}
console
.
log
(
dataTable2
[
tableMeta
.
rowIndex
][
column
]);
console
.
log
(
value
)
console
.
log
(
String
(
value
).
split
(
","
).
join
(
""
))
}
const
handleValueDropDown
=
(
value
,
type
,
tableMeta
)
=>
{
let
data
=
type
==
'bankName'
?
this
.
state
.
bankNameList
.
options
:
this
.
state
.
typeOfCreditList
.
options
let
index
=
0
if
(
type
==
'bankName'
&&
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
!=
null
&&
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
!=
""
)
{
indexNyasar
=
true
}
if
(
value
==
null
)
{
index
=
-
1
}
else
{
index
=
data
.
findIndex
((
val
)
=>
String
(
val
.
value
)
==
String
(
value
.
value
))
}
if
(
index
==
-
1
)
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
null
return
null
}
else
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
return
value
}
}
const
handleTableRatio
=
(
value
,
tableMeta
,
column
,
reportName
)
=>
{
let
dataTableRatio
=
this
.
state
.
dataTableRatio
let
indexId
=
dataTableRatio
.
findIndex
((
val
)
=>
String
(
val
[
5
]).
toLocaleLowerCase
()
==
String
(
reportName
).
toLocaleLowerCase
())
let
valuez
=
0
if
(
indexId
!=
-
1
)
{
valuez
=
dataTableRatio
[
indexId
][
Number
(
this
.
props
.
month
.
month_id
)
+
7
]
// console.log(valuez)
if
(
String
(
valuez
).
includes
(
'infinity'
))
{
valuez
=
0
}
}
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
valuez
return
valuez
})
let
body
=
{
"monthly_report_id"
:
this
.
props
.
monthlyReportId
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"currency_id"
:
this
.
props
.
defaultCurrency
.
id
,
"locf"
:
data
,
"per_bs"
:
this
.
state
.
perBS
,
"diff"
:
this
.
state
.
diff
,
"total_loan"
:
this
.
state
.
perBS
}
const
handleFormulaHardcode
=
(
value
,
tableMeta
,
column
)
=>
{
// console.log("------------coba------------------");
// console.log(tableMeta);
// console.log(tableMeta.rowData[0]);
let
valuez
=
0
if
(
tableMeta
.
rowData
[
0
]
==
8
)
{
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
item
[
6
].
value
.
includes
(
String
(
tableMeta
.
rowData
[
6
].
value
).
substr
(
6
,
tableMeta
.
rowData
[
6
].
length
))
&&
item
[
0
]
!=
8
)
{
valuez
+=
Number
(
item
[
column
])
}
})
}
else
if
(
tableMeta
.
rowData
[
0
]
==
9
)
{
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
==
8
)
{
valuez
+=
Number
(
item
[
column
])
console
.
log
(
JSON
.
stringify
(
body
));
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportLOCF
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
// this.props.onClickClose()
// this.props.getReport()
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
// alert(response.data.status)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
})
if
(
column
==
22
)
{
totalLoan
=
valuez
}
}
else
{
if
(
column
==
21
)
{
valuez
=
Number
(
tableMeta
.
rowData
[
14
])
+
Number
(
tableMeta
.
rowData
[
16
])
+
Number
(
tableMeta
.
rowData
[
19
])
}
else
if
(
column
==
22
)
{
valuez
=
Number
(
tableMeta
.
rowData
[
15
])
+
Number
(
tableMeta
.
rowData
[
17
])
+
Number
(
tableMeta
.
rowData
[
20
])
}
else
if
(
column
==
23
)
{
valuez
=
Number
(
tableMeta
.
rowData
[
12
])
-
Number
(
tableMeta
.
rowData
[
21
])
}
else
if
(
column
==
24
)
{
valuez
=
Number
(
tableMeta
.
rowData
[
13
])
-
Number
(
tableMeta
.
rowData
[
22
])
}
}
dataTable2
[
tableMeta
.
rowIndex
][
column
]
=
valuez
return
valuez
}
const
handleTambah
=
(
data
,
rowIndex
)
=>
{
let
newData
=
[]
let
indexxx
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
indexxx
=
index
if
(
item
[
6
]
==
"Grand Total"
)
{
item
[
46
]
=
999999
}
else
{
item
[
46
]
=
indexxx
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
newData
.
push
(
item
)
if
(
index
==
rowIndex
)
{
indexxx
=
index
+
1
newData
.
push
([
3
,
""
,
""
,
""
,
""
,
this
.
props
.
company
.
company_name
,
item
[
6
],
null
,
""
,
null
,
"0.00"
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
indexxx
],
)
}
})
dataTable2
=
newData
.
sort
((
a
,
b
)
=>
a
[
46
]
-
b
[
46
])
this
.
setState
({
dataTable
:
dataTable2
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
console
.
log
(
dataTable2
)
},
500
)
this
.
setState
({
handleDoubleClick
:
0
})
})
}
}
const
handleDelete
=
(
index
)
=>
{
let
dataDelete
=
this
.
state
.
dataDelete
let
berapaInput
=
0
dataTable2
.
map
((
items
,
indexs
)
=>
{
if
(
items
[
0
]
==
3
)
{
berapaInput
+=
1
}
})
dataDelete
.
push
(
dataTable2
[
index
][
1
])
let
prevData
=
dataTable2
[
index
-
1
]
==
undefined
?
null
:
dataTable2
[
index
-
1
][
6
]
let
currentData
=
dataTable2
[
index
][
6
]
let
nextData
=
dataTable2
[
index
+
1
]
==
undefined
?
null
:
dataTable2
[
index
+
1
][
6
]
// handleCalculateLOV = () => {
// let dataTable2 = this.state.dataTableLOV
// console.log(dataTable2);
// }
if
(
nextData
==
null
)
{
dataTable2
.
splice
(
index
,
1
)
}
else
if
(
nextData
.
value
.
includes
(
'Total'
))
{
if
(
prevData
!==
null
&&
currentData
==
null
)
{
dataTable2
.
splice
(
index
,
1
)
}
else
if
(
prevData
!==
null
&&
prevData
.
value
==
currentData
.
value
)
{
dataTable2
.
splice
(
index
,
1
)
}
else
if
(
dataTable2
.
length
>
3
)
{
if
(
prevData
==
null
)
{
if
(
nextData
.
value
.
includes
(
'Grand'
))
{
dataTable2
.
splice
(
index
,
1
)
}
else
{
dataTable2
.
splice
(
index
,
2
)
}
}
else
{
dataTable2
.
splice
(
index
,
2
)
}
}
else
if
(
dataTable2
.
length
==
3
)
{
if
(
prevData
==
null
)
{
if
(
nextData
.
value
.
includes
(
'Grand'
))
{
dataTable2
.
splice
(
index
,
1
)
}
else
{
dataTable2
.
splice
(
index
,
3
)
dataTable2
.
push
(
[
3
,
""
,
""
,
""
,
""
,
this
.
props
.
company
.
company_name
,
null
,
null
,
""
,
null
,
"0.00"
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
0
],
[
9
,
""
,
""
,
""
,
""
,
""
,
{
value
:
"Grand Total"
},
null
,
""
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
"notes"
,
999999
],
)
}
}
else
{
dataTable2
.
splice
(
index
,
1
)
}
}
}
else
{
dataTable2
.
splice
(
index
,
1
)
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
loading
=
this
.
state
.
loading
let
totalLoan
=
0
this
.
setState
({
dataTable
:
dataTable2
,
dataDelete
},
()
=>
{
setTimeout
(()
=>
{
console
.
log
(
this
.
state
.
dataDelete
)
this
.
setState
({
loading
:
false
})
},
100
)
})
}
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)'
}}
>
...
...
@@ -1328,7 +1190,7 @@ export default class ListOfCreditFacilities extends Component {
this
.
state
.
handleDoubleClick
==
1
?
null
:
this
.
setState
({
handleDoubleClick
:
1
,
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
backToMonthlyReport
(
'draft'
)
this
.
backToMonthlyReport
LOCF
(
'draft'
)
},
100
);
})
}
...
...
@@ -1354,7 +1216,7 @@ export default class ListOfCreditFacilities extends Component {
this
.
state
.
handleDoubleClick
==
1
?
null
:
this
.
setState
({
handleDoubleClick
:
1
,
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
backToMonthlyReport
(
'submitted'
)
this
.
backToMonthlyReport
LOCF
(
'submitted'
)
},
100
);
})
}
...
...
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