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
43782e23
Commit
43782e23
authored
Sep 21, 2020
by
EKSAD
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apdet judul PL
parent
210c4182
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
102 deletions
+73
-102
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+73
-102
No files found.
src/container/BudgetTahunan/ProfitLoss.js
View file @
43782e23
...
...
@@ -4,7 +4,7 @@ import MUIDataTable from 'mui-datatables';
import
NumberFormat
from
'react-number-format'
;
import
api
from
'../../api'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
{
values
}
from
'ramda'
;
import
{
values
,
type
}
from
'ramda'
;
import
PropagateLoader
from
"react-spinners/PropagateLoader"
import
Images
from
'../../assets/Images'
;
import
ReactTooltip
from
'react-tooltip'
;
...
...
@@ -238,16 +238,16 @@ export default class ProfitLoss extends Component {
}
else
{
let
isi
=
resp
.
rows
.
slice
(
3
)
console
.
log
(
isi
);
console
.
log
(
resp
.
rows
[
2
]
);
let
payload
=
[]
let
reg
=
/^
\d
+
$/
;
let
reg
=
/^
[
-+
]?(?:[
0-9
]
+,
)
*
[
0-9
]
+
(?:\.[
0-9
]
+
)?
$/
;
isi
.
map
((
i
,
index
)
=>
{
if
(
i
.
length
>
0
)
{
payload
.
push
({
item_report_id
:
i
[
0
]
===
undefined
?
""
:
String
(
i
[
0
]).
trim
(),
item_report
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
notes
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
total_actual_before
:
i
[
3
]
===
undefined
?
"0"
:
String
(
i
[
3
]).
trim
(),
total_actual_before
:
i
[
3
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
3
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
(),
january
:
i
[
4
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
february
:
i
[
5
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
5
]))
===
false
?
"0"
:
String
(
i
[
5
]).
trim
(),
march
:
i
[
6
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
6
]))
===
false
?
"0"
:
String
(
i
[
6
]).
trim
(),
...
...
@@ -272,8 +272,8 @@ export default class ProfitLoss extends Component {
report_id
:
this
.
props
.
report_id
,
profit_loss
:
payload
}
console
.
log
(
payload
)
this
.
setState
({
payload
:
body
,
judul
:
resp
.
rows
[
1
][
0
]
})
console
.
log
(
body
)
this
.
setState
({
payload
:
body
,
judul
:
resp
.
rows
[
1
][
0
]
,
judulColumn
:
resp
.
rows
[
2
]
})
}
});
}
...
...
@@ -313,12 +313,15 @@ export default class ProfitLoss extends Component {
item
.
error
]
})
// console.log(dataTable)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
},
()
=>
{
if
(
this
.
state
.
dataTable
[
23
].
length
>
0
)
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
23
].
length
>
0
)
{
console
.
log
(
'masuk'
)
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
})
}
})
// console.log(dataTable)
})
}
}
})
...
...
@@ -388,9 +391,12 @@ export default class ProfitLoss extends Component {
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
)
=>
{
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
// let data = this.state.dataTable2
if
(
type
===
"actual"
)
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
else
{
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
dataTable2
[
tableMeta
.
rowIndex
][
2
])
if
(
indexParent
>
0
)
{
// console.log(indexParent)
...
...
@@ -401,6 +407,7 @@ export default class ProfitLoss extends Component {
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
}
}
const
handleNotes
=
(
value
,
tableMeta
)
=>
{
console
.
log
(
value
)
let
a
=
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
...
...
@@ -489,7 +496,7 @@ export default class ProfitLoss extends Component {
display
:
false
}
},
{
name
:
"Account"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
1
]
:
"Account"
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
key
=
{
columnMeta
.
index
}
style
=
{{
...
style
,
top
:
0
,
zIndex
:
102
,
backgroundColor
:
'#1c71b8'
,
width
:
300
}}
>
...
...
@@ -527,7 +534,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Notes"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
2
]
:
"Notes"
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -564,7 +571,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"31 Dec 2020 Actual"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
3
]
:
`31 Dec
${
Number
(
this
.
props
.
periode
)
-
1
}
Actual`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#37b5e6'
,
width
:
96
}}
>
...
...
@@ -575,7 +582,9 @@ export default class ProfitLoss extends Component {
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
0
]
===
3
?
{
tableMeta
.
rowData
[
0
]
===
4
?
null
:
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -583,77 +592,22 @@ export default class ProfitLoss extends Component {
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
value
}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
handleChange
(
event
.
target
.
value
,
tableMeta
)
console
.
log
(
dataTable2
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
handleValue
(
tableMeta
)}
/
>
<
/span
>
:
tableMeta
.
rowData
[
0
]
===
4
?
null
:
tableMeta
.
rowData
[
0
]
===
6
?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
:
tableMeta
.
rowData
[
0
]
===
5
?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
:
tableMeta
.
rowData
[
0
]
===
1
?
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
null
<
/div
>
}
<
/div
>
)
}
}
},
{
name
:
"Jan 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
4
]
:
`Jan
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -741,7 +695,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Feb 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
5
]
:
`Feb
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -830,7 +784,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Mar 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
6
]
:
`Mar
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -919,7 +873,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Apr 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
7
]
:
`Apr
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1008,7 +962,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"May 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
8
]
:
`May
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1097,7 +1051,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Jun 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
9
]
:
`Jun
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1186,7 +1140,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Jul 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
10
]
:
`Jul
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1275,7 +1229,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Aug 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
11
]
:
`Aug
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1364,7 +1318,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Sep 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
12
]
:
`Sep
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1453,7 +1407,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Oct 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
13
]
:
`Oct
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1542,7 +1496,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Nov 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
14
]
:
`Nov
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1631,7 +1585,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Dec 2021"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
15
]
:
`Dec
${
this
.
props
.
periode
}
`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#1c71b8'
,
width
:
96
}}
>
...
...
@@ -1720,7 +1674,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"Current Total"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
16
]
:
"Current Total"
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#37b5e6'
,
width
:
96
}}
>
...
...
@@ -1809,7 +1763,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"31 Dec 2022 Total"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
17
]
:
`31 Dec
${
Number
(
this
.
props
.
periode
)
+
1
}
Total`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#37b5e6'
,
width
:
96
}}
>
...
...
@@ -1898,7 +1852,7 @@ export default class ProfitLoss extends Component {
}
}
},
{
name
:
"31 Dec 2022 Total"
,
name
:
this
.
state
.
judulColumn
!==
null
?
this
.
state
.
judulColumn
[
18
]
:
`31 Dec
${
Number
(
this
.
props
.
periode
)
+
2
}
Total`
,
options
:
{
customHeadRender
:
(
columnMeta
)
=>
(
<
TableCell
style
=
{{
...
style2
,
top
:
0
,
zIndex
:
99
,
backgroundColor
:
'#37b5e6'
,
width
:
96
}}
>
...
...
@@ -2091,7 +2045,17 @@ export default class ProfitLoss extends Component {
<
div
className
=
"col-1"
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
this
.
backToMasterBudget
(
'draft'
)
:
this
.
props
.
onClickClose
()}
onClick
=
{()
=>
this
.
state
.
editable
===
true
?
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
backToMasterBudget
(
'draft'
)
},
100
);
})
:
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
...
...
@@ -2115,9 +2079,11 @@ export default class ProfitLoss extends Component {
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
}}
},
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'
}}
>
Cancel
<
/Typography
>
...
...
@@ -2173,7 +2139,7 @@ export default class ProfitLoss extends Component {
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
{
this
.
state
.
dataLoaded
&&
(
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
,
height
:
this
.
props
.
height
-
400
}}
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
loading
&&
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
dataTable2
}
...
...
@@ -2187,7 +2153,11 @@ export default class ProfitLoss extends Component {
<
div
style
=
{{
display
:
'flex'
,
width
:
'100%'
,
placeContent
:
'flex-end'
,
padding
:
20
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
visibleProfitLoss
:
true
},
()
=>
this
.
getItemHierarki
())}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
visibleBalanceSheet
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
getItemHierarki
()
},
100
);
})}
style
=
{{
marginRight
:
20
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
...
...
@@ -2197,6 +2167,7 @@ export default class ProfitLoss extends Component {
<
button
className
=
"button"
type
=
"button"
disabled
=
{
this
.
state
.
buttonError
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
...
...
@@ -2218,7 +2189,7 @@ export default class ProfitLoss extends Component {
<
/button
>
<
button
type
=
"button"
//
disabled={this.state.buttonError}
disabled
=
{
this
.
state
.
buttonError
}
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
uploadProfitLoss
()
...
...
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