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
891972bd
Commit
891972bd
authored
Jan 29, 2021
by
rifkaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
edb6c71b
9ab9eaed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
80 deletions
+118
-80
SubHolding.js
src/container/Laporan/SubHolding.js
+111
-59
TableSubHolding.js
src/container/Laporan/TableSubHolding.js
+7
-21
No files found.
src/container/Laporan/SubHolding.js
View file @
891972bd
...
...
@@ -1397,25 +1397,98 @@ export default class SubHolding extends Component {
}
})
}
else
if
(
this
.
state
.
report
.
value
===
7
)
{
let
payload
=
{
"report_id"
:
2
,
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
,
"months"
:
this
.
state
.
month
.
month_id
,
"revision"
:
this
.
state
.
revisionType
,
"quarter"
:
0
,
"submission_id"
:
this
.
state
.
submissionID
}
api
.
create
().
getReportBSSuma
(
payload
).
then
(
response
=>
{
console
.
log
(
payload
);
let
dbSumaBS
=
[]
let
payloadBS
=
{...
payload
,
report_id
:
2
,
months
:
this
.
state
.
month
.
month_id
,
quarter
:
0
}
api
.
create
().
getReportBSSuma
(
payloadBS
).
then
(
response
=>
{
// console.log(payloadBS);
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
dataTable
.
push
([
if
(
response
.
data
.
status
===
'success'
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dbSumaBS
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
let
mtd_actual
=
item
.
balance_sheet
.
mtd_actual
==
''
?
0
:
item
.
balance_sheet
.
mtd_actual
let
mtd_ol
=
item
.
balance_sheet
.
mtd_ol
==
''
?
0
:
item
.
balance_sheet
.
mtd_ol
let
mtd_mb
=
item
.
balance_sheet
.
mtd_mb
==
''
?
0
:
item
.
balance_sheet
.
mtd_mb
let
persenMtd
=
0
let
persenOL
=
0
if
(
mtd_mb
<
0
)
{
if
(
mtd_actual
<
mtd_mb
)
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
}
else
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
+
1
}
}
else
{
persenMtd
=
Number
(
mtd_actual
/
mtd_mb
)
}
if
(
mtd_ol
<
0
)
{
if
(
mtd_actual
<
mtd_ol
)
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
}
else
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
+
1
}
}
else
{
persenOL
=
Number
(
mtd_actual
/
mtd_ol
)
}
dbSumaBS
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
balance_sheet
.
mtd_last_month
,
item
.
balance_sheet
.
mtd_actual
,
item
.
balance_sheet
.
mtd_mb
,
isNaN
(
persenMtd
)
||
persenMtd
==
'Infinity'
||
persenMtd
==
'-Infinity'
?
(
item
.
balance_sheet
.
mtd_mb
==
''
||
item
.
balance_sheet
.
mtd_mb
==
0
?
-
0
:
0
)
:
(
item
.
balance_sheet
.
mtd_mb
==
''
||
item
.
balance_sheet
.
mtd_mb
==
0
?
persenMtd
*
-
100
:
persenMtd
*
100
),
item
.
balance_sheet
.
mtd_ol
,
isNaN
(
persenOL
)
||
persenOL
==
'Infinity'
||
persenOL
==
'-Infinity'
?
(
item
.
balance_sheet
.
mtd_ol
==
''
||
item
.
balance_sheet
.
mtd_ol
==
0
?
-
0
:
0
)
:
(
item
.
balance_sheet
.
mtd_ol
==
''
||
item
.
balance_sheet
.
mtd_ol
==
0
?
persenOL
*
-
100
:
persenOL
*
100
),
item
.
balance_sheet
.
mtd_last_year
,
item
.
balance_sheet
.
forecast_next_year
,
item
.
balance_sheet
.
forecast_more_year
,
item
.
order
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
let
mtd_actual
=
item
.
balance_sheet
.
mtd_actual
==
''
?
0
:
item
.
balance_sheet
.
mtd_actual
let
mtd_ol
=
item
.
balance_sheet
.
mtd_ol
==
''
?
0
:
item
.
balance_sheet
.
mtd_ol
let
mtd_mb
=
item
.
balance_sheet
.
mtd_mb
==
''
?
0
:
item
.
balance_sheet
.
mtd_mb
let
persenMtd
=
0
let
persenOL
=
0
if
(
mtd_mb
<
0
)
{
if
(
mtd_actual
<
mtd_mb
)
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
}
else
{
persenMtd
=
Number
((
mtd_mb
-
mtd_actual
)
/
mtd_mb
)
+
1
}
}
else
{
persenMtd
=
Number
(
mtd_actual
/
mtd_mb
)
}
if
(
mtd_ol
<
0
)
{
if
(
mtd_actual
<
mtd_ol
)
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
}
else
{
persenOL
=
Number
((
mtd_ol
-
mtd_actual
)
/
mtd_ol
)
+
1
}
}
else
{
persenOL
=
Number
(
mtd_actual
/
mtd_ol
)
}
dbSumaBS
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
...
...
@@ -1425,57 +1498,36 @@ export default class SubHolding extends Component {
item
.
balance_sheet
.
mtd_last_month
,
item
.
balance_sheet
.
mtd_actual
,
item
.
balance_sheet
.
mtd_mb
,
i
tem
.
balance_sheet
.
percent_of_mb
,
i
sNaN
(
persenMtd
)
||
persenMtd
==
'Infinity'
||
persenMtd
==
'-Infinity'
?
(
item
.
balance_sheet
.
mtd_mb
==
''
||
item
.
balance_sheet
.
mtd_mb
==
0
?
-
0
:
0
)
:
(
item
.
balance_sheet
.
mtd_mb
==
''
||
item
.
balance_sheet
.
mtd_mb
==
0
?
persenMtd
*
-
100
:
persenMtd
*
100
)
,
item
.
balance_sheet
.
mtd_ol
,
i
tem
.
balance_sheet
.
percent_of_ol
,
i
sNaN
(
persenOL
)
||
persenOL
==
'Infinity'
||
persenOL
==
'-Infinity'
?
(
item
.
balance_sheet
.
mtd_ol
==
''
||
item
.
balance_sheet
.
mtd_ol
==
0
?
-
0
:
0
)
:
(
item
.
balance_sheet
.
mtd_ol
==
''
||
item
.
balance_sheet
.
mtd_ol
==
0
?
persenOL
*
-
100
:
persenOL
*
100
)
,
item
.
balance_sheet
.
mtd_last_year
,
item
.
balance_sheet
.
forecast_next_year
,
item
.
balance_sheet
.
forecast_more_year
,
item
.
order
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
balance_sheet
.
mtd_last_month
,
item
.
balance_sheet
.
mtd_actual
,
item
.
balance_sheet
.
mtd_mb
,
item
.
balance_sheet
.
percent_of_mb
,
item
.
balance_sheet
.
mtd_ol
,
item
.
balance_sheet
.
percent_of_ol
,
item
.
balance_sheet
.
mtd_last_year
,
item
.
balance_sheet
.
forecast_next_year
,
item
.
balance_sheet
.
forecast_more_year
,
item
.
order
])
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
)
})
}
}
}
})
this
.
setState
({
dataTable
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
// this.setState({ dataTable }, () => {
})
this
.
setState
({
dataTable
:
dbSumaBS
,
previewTable
:
true
,
loading
:
false
,
previewDownload
:
true
})
console
.
log
(
this
.
state
.
dataTable
)
// // this.getBalanceSheetMR(payload)
// })
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
dataTable
:
[],
previewTable
:
false
,
loading
:
false
,
previewDownload
:
false
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
...
...
src/container/Laporan/TableSubHolding.js
View file @
891972bd
...
...
@@ -1042,22 +1042,6 @@ export default class TableSubHolding extends Component {
return total
}
const handleMTDPercent = (tableMeta, dex, type) => {
let total = 0
// if (tableMeta.rowData[5] === "Cash and cash equivalent" ) {
// console.log(tableMeta);
// console.log(dataTable2);
// }
if (dex === 1) {
total = R.equals((Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][8])), NaN) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][8])), Infinity) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][8])), -Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][8])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
} else if (dex === 2) {
total = R.equals((Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][10])), NaN) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][10])), Infinity) ? "0" : R.equals((Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][10])), -Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][7]) / Number(dataTable2[tableMeta.rowIndex][10])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
}
return total
}
let datas = [
["ABCD", "Testing", { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }],
["Total Assets", "Notes", { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }]
...
...
@@ -15052,7 +15036,7 @@ export default class TableSubHolding extends Component {
}
}
}, {
name: `MTD
2021
`,
name: `MTD
${this.props.periode}
`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#000', backgroundColor: '#07a7d0', top: 0, zIndex: 102, fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
...
...
@@ -15180,8 +15164,9 @@ export default class TableSubHolding extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 70, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={`%`}
disabled={true}
value={Number(
handleMTDPercent(tableMeta, 1, 3)
).toFixed(1)}
value={Number(
tableMeta.rowData[9]
).toFixed(1)}
/>
}
/>
...
...
@@ -15228,8 +15213,9 @@ export default class TableSubHolding extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
suffix={'%'}
disabled={true}
value={Number(
handleMTDPercent(tableMeta, 2, 5)
).toFixed(1)}
value={Number(
tableMeta.rowData[11]
).toFixed(1)}
/>
}
/>
...
...
@@ -15266,7 +15252,7 @@ export default class TableSubHolding extends Component {
}
}
}, {
name:
"2022"
,
name:
`${(this.props.periode) + 1}`
,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, top: 0, zIndex: 102, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
...
...
@@ -15311,7 +15297,7 @@ export default class TableSubHolding extends Component {
}
}
}, {
name:
"2023"
,
name:
`${(this.props.periode) + 2}`
,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, top: 0, zIndex: 102, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
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