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
5fd8cf97
Commit
5fd8cf97
authored
Nov 29, 2020
by
Faisal Hamdi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'riri' into 'master'
upload plmr ++ See merge request
!717
parents
8aed1c07
10c98a66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
136 additions
and
10 deletions
+136
-10
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+7
-0
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+129
-10
No files found.
src/container/BudgetTahunan/ProfitLoss.js
View file @
5fd8cf97
...
...
@@ -520,6 +520,7 @@ export default class ProfitLoss extends Component {
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleChange
=
(
value
,
tableMeta
,
type
)
=>
{
console
.
log
(
dataTable2
);
let
val
=
String
(
value
).
split
(
","
).
join
(
""
)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
...
...
@@ -540,6 +541,12 @@ export default class ProfitLoss extends Component {
let
value
=
Number
(
dataTable2
[
tableMeta
.
rowIndex
-
2
][
20
])
/
Number
(
dataTable2
[
tableMeta
.
rowIndex
-
1
][
20
])
dataTable2
[
tableMeta
.
rowIndex
][
20
]
=
R
.
equals
(
value
,
NaN
)
?
"0.0"
:
value
return
R
.
equals
(
value
,
NaN
)
?
"0.0"
:
value
}
else
if
(
String
(
tableMeta
.
rowData
[
5
]).
toLocaleLowerCase
()
==
"total man power"
)
{
console
.
log
(
"masuk"
);
console
.
log
(
dataTable2
[
tableMeta
.
rowIndex
][
20
]);
console
.
log
(
dataTable2
[
tableMeta
.
rowIndex
][
19
]);
let
totalTMP
=
dataTable2
[
tableMeta
.
rowIndex
][
20
]
=
dataTable2
[
tableMeta
.
rowIndex
][
19
]
return
totalTMP
}
else
if
(
indexParent
!==
-
1
&&
String
(
dataTable2
[
indexParent
][
5
]).
toLocaleUpperCase
()
==
"GROSS PROFIT MARGIN (% OF REVENUE)"
)
{
return
handleFormula
(
0
,
tableMeta
,
0
)
}
...
...
src/container/MonthlyReport/ProfitLossMR.js
View file @
5fd8cf97
...
...
@@ -56,6 +56,7 @@ export default class ProfitLossMR extends Component {
this
.
state
=
{
dataTable
:
[],
loading
:
true
,
visiblePLMR
:
true
,
valueThreshold
:
0
}
}
...
...
@@ -215,7 +216,7 @@ export default class ProfitLossMR extends Component {
let
url
=
window
.
URL
.
createObjectURL
(
res
);
let
a
=
document
.
createElement
(
'a'
);
a
.
href
=
url
;
a
.
download
=
'Monthly Report
Balance Sheet
.xlsx'
;
a
.
download
=
'Monthly Report
Profit Loss
.xlsx'
;
a
.
click
();
}
}
...
...
@@ -317,7 +318,7 @@ export default class ProfitLossMR extends Component {
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
visibleUpload
:
false
,
visibleP
rofitLoss
:
false
,
loading
:
true
})
this
.
setState
({
visibleUpload
:
false
,
visibleP
LMR
:
false
,
loading
:
true
})
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
type_report_id
,
...
...
@@ -342,7 +343,7 @@ export default class ProfitLossMR extends Component {
item
.
mtd_vs_previous_month
,
item
.
mtd_vs_mb
,
item
.
mtd_vs_rb
,
item
.
order
,
item
.
order
s
,
item
.
error
]
})
...
...
@@ -355,17 +356,18 @@ export default class ProfitLossMR extends Component {
})
// console.log(this.state.buttonError)
})
console
.
log
(
dataTable
);
}
}
})
}
uploadProfitLoss
(
type
)
{
uploadProfitLoss
MR
(
type
)
{
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
item_report_id
:
i
[
1
],
notes
:
i
[
6
]
,
notes
:
String
(
i
[
6
])
,
rolling_outlook
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)),
master_budget
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)),
rolling_budget
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)),
...
...
@@ -384,7 +386,7 @@ export default class ProfitLossMR extends Component {
})
})
let
body
=
{
//
submission_id: this.props.submissionID,
submission_id
:
this
.
props
.
submissionID
,
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
...
...
@@ -447,7 +449,7 @@ export default class ProfitLossMR extends Component {
let
total
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
data
.
rowData
[
1
]
==
item
[
2
])
{
total
=
item
[
data
.
columnIndex
]
==
undefined
?
(
Number
(
total
)
+
0
)
:
(
Number
(
total
)
+
Number
(
String
(
item
[
data
.
columnIndex
]).
includes
(
'-'
)?
Number
(
String
(
item
[
data
.
columnIndex
]).
substr
(
1
,
String
(
item
[
data
.
columnIndex
]).
length
))
*
-
1
:
Number
(
item
[
data
.
columnIndex
])))
total
=
item
[
data
.
columnIndex
+
type
]
==
undefined
?
(
Number
(
total
)
+
0
)
:
(
Number
(
total
)
+
Number
(
String
(
item
[
data
.
columnIndex
+
type
]).
includes
(
'-'
)?
Number
(
String
(
item
[
data
.
columnIndex
+
type
]).
substr
(
1
,
String
(
item
[
data
.
columnIndex
+
type
]).
length
))
*
-
1
:
Number
(
item
[
data
.
columnIndex
+
type
])))
}
})
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
==
dataTable2
[
data
.
rowIndex
][
2
])
...
...
@@ -1378,7 +1380,7 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
19
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
Number
(
tableMeta
.
rowData
[
19
]).
toFixed
(
1
)
>
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -1433,7 +1435,7 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
20
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
Number
(
tableMeta
.
rowData
[
20
]).
toFixed
(
1
)
>
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -1488,7 +1490,7 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
21
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
Number
(
tableMeta
.
rowData
[
21
]).
toFixed
(
1
)
>
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
@@ -1582,6 +1584,7 @@ export default class ProfitLossMR extends Component {
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Monthly
Report
<
/Typography
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
{
this
.
state
.
visiblePLMR
?
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Profit
Loss
<
/Typography
>
...
...
@@ -1755,6 +1758,122 @@ export default class ProfitLossMR extends Component {
} */
}
<
/div
>
<
/Paper
>
:
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Profit
Loss
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
loading
&&
(
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
dataTable2
}
columns
=
{
columns
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
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%'
}}
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
// this.handleValidate()
},
100
);
})
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
/div
>
<
/button
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
state
.
saveDraft
===
true
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
uploadProfitLossMR
(
'draft'
)
})
}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
as
Draft
<
/Typography
>
<
/div
>
<
/button
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
uploadProfitLossMR
(
'submitted'
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
&
Complete
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/Paper>
}
<
/div
>
{
this
.
state
.
visibleUpload
&&
(
...
...
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