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
eb0f3a3c
Commit
eb0f3a3c
authored
Nov 27, 2020
by
Faisal Hamdi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'faisal' into 'master'
upload mr fam See merge request
!710
parents
50068e1d
136be28d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
3 deletions
+132
-3
index.js
src/api/index.js
+2
-0
FixedAssetsMovementMR.js
src/container/MonthlyReport/FixedAssetsMovementMR.js
+130
-3
No files found.
src/api/index.js
View file @
eb0f3a3c
...
@@ -271,6 +271,7 @@ const create = (type = "") => {
...
@@ -271,6 +271,7 @@ const create = (type = "") => {
const
createMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/fam/create_monthly_report'
,
body
)
const
createMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/fam/create_monthly_report'
,
body
)
const
createMonthlyReportOI
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_oi/create_monthly_report'
,
body
)
const
createMonthlyReportOI
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_oi/create_monthly_report'
,
body
)
const
checkUploadMonthlyReportTP
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_tp/check_import'
,
body
)
const
checkUploadMonthlyReportTP
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_tp/check_import'
,
body
)
const
checkUploadMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/fam/check_import'
,
body
)
// MonthlyPL
// MonthlyPL
...
@@ -484,6 +485,7 @@ const create = (type = "") => {
...
@@ -484,6 +485,7 @@ const create = (type = "") => {
getHierarkiMontlyReportLOCF
,
getHierarkiMontlyReportLOCF
,
getHierarkiMontlyReportFAM
,
getHierarkiMontlyReportFAM
,
checkUploadMonthlyReportTP
,
checkUploadMonthlyReportTP
,
checkUploadMonthlyReportFAM
,
getMonthlyReport
getMonthlyReport
}
}
}
}
...
...
src/container/MonthlyReport/FixedAssetsMovementMR.js
View file @
eb0f3a3c
...
@@ -6,6 +6,8 @@ import Images from '../../assets/Images';
...
@@ -6,6 +6,8 @@ import Images from '../../assets/Images';
import
ReactTooltip
from
'react-tooltip'
;
import
ReactTooltip
from
'react-tooltip'
;
import
NumberFormat
from
'react-number-format'
;
import
NumberFormat
from
'react-number-format'
;
import
{
PropagateLoader
}
from
'react-spinners'
;
import
{
PropagateLoader
}
from
'react-spinners'
;
import
UploadFile
from
'../../library/Upload'
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
tooltip
:
{
...
@@ -41,6 +43,7 @@ export default class FixedAssetsMovementMR extends Component {
...
@@ -41,6 +43,7 @@ export default class FixedAssetsMovementMR extends Component {
dataTable
:
[],
dataTable
:
[],
loading
:
true
loading
:
true
}
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -158,6 +161,92 @@ export default class FixedAssetsMovementMR extends Component {
...
@@ -158,6 +161,92 @@ export default class FixedAssetsMovementMR extends Component {
}
}
}
}
fileHandler
=
(
event
)
=>
{
let
fileObj
=
event
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
console
.
log
(
resp
)
if
(
err
)
{
console
.
log
(
err
);
}
else
{
let
isi
=
resp
.
rows
.
slice
(
3
)
console
.
log
(
isi
);
let
payload
=
[]
let
reg
=
/^
[
-+
]?(?:[
0-9
]
+,
)
*
[
0-9
]
+
(?:\.[
0-9
]
+
)?
$/
;
isi
.
map
((
i
,
index
)
=>
{
if
(
i
.
length
>
0
)
{
payload
.
push
({
item_report_id
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
item_report
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
mtd_mb
:
i
[
3
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
3
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
()
})
}
})
let
body
=
{
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
fixed_asset_movement
:
payload
,
months
:
this
.
props
.
month
.
month_id
}
console
.
log
(
body
)
this
.
setState
({
payload
:
body
,
judul
:
resp
.
rows
[
1
][
0
],
judulColumn
:
resp
.
rows
[
2
]
})
}
});
}
checkUpload
()
{
api
.
create
().
checkUploadMonthlyReportFAM
(
this
.
state
.
payload
).
then
(
response
=>
{
console
.
log
(
JSON
.
stringify
(
this
.
state
.
payload
));
console
.
log
(
this
.
state
.
payload
)
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
visibleUpload
:
false
,
loading
:
true
})
// let dataTable = response.data.data.map((item, index) => {
// return [
// item.type_report_id,
// item.item_report_id,
// item.parent,
// item.formula,
// item.level,
// item.item_report,
// item.total_actual_before,
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.january, formula: item.january_formula } : Number(item.january).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.february, formula: item.february_formula } : Number(item.february).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.march, formula: item.march_formula } : Number(item.march).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.april, formula: item.april_formula } : Number(item.april).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.may, formula: item.may_formula } : Number(item.may).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.june, formula: item.june_formula } : Number(item.june).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.july, formula: item.july_formula } : Number(item.july).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.august, formula: item.august_formula } : Number(item.august).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.september, formula: item.september_formula } : Number(item.september).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1),
// item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1),
// Number(item.total_current_year).toFixed(1),
// Number(item.total_next_year).toFixed(1),
// Number(item.total_more_year).toFixed(1),
// item.orders,
// item.forecast_formula,
// item.before_formula,
// item.error
// ]
// })
// this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
// this.state.dataTable.map(item => {
// if (item[12].length > 0) {
// // console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
// }
// })
// // console.log(this.state.dataTable);
// })
}
}
})
}
backToMonthlyReport
(
type
)
{
backToMonthlyReport
(
type
)
{
console
.
log
(
this
.
state
.
dataTable
);
console
.
log
(
this
.
state
.
dataTable
);
let
data
=
[]
let
data
=
[]
...
@@ -478,7 +567,7 @@ export default class FixedAssetsMovementMR extends Component {
...
@@ -478,7 +567,7 @@ export default class FixedAssetsMovementMR extends Component {
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
<
NumberFormat
thousandSeparator
=
{
true
}
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
9
0
,
backgroundColor
:
'transparent'
}}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
9
6
,
backgroundColor
:
'transparent'
}}
type
=
"text"
type
=
"text"
placeholder
=
""
placeholder
=
""
disabled
=
{
true
}
disabled
=
{
true
}
...
@@ -930,7 +1019,7 @@ export default class FixedAssetsMovementMR extends Component {
...
@@ -930,7 +1019,7 @@ export default class FixedAssetsMovementMR extends Component {
borderColor
:
'transparent'
,
borderColor
:
'transparent'
,
margin
:
5
margin
:
5
}}
}}
onClick
=
{()
=>
null
}
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
true
})
}
>
>
<
img
src
=
{
Images
.
upload
}
/
>
<
img
src
=
{
Images
.
upload
}
/
>
<
/button
>
<
/button
>
...
@@ -1008,7 +1097,8 @@ export default class FixedAssetsMovementMR extends Component {
...
@@ -1008,7 +1097,8 @@ export default class FixedAssetsMovementMR extends Component {
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
handleValidate
()
this
.
setState
({
loading
:
false
})
// this.handleValidate()
},
100
);
},
100
);
})
})
}}
}}
...
@@ -1068,6 +1158,43 @@ export default class FixedAssetsMovementMR extends Component {
...
@@ -1068,6 +1158,43 @@ export default class FixedAssetsMovementMR extends Component {
<
/div
>
<
/div
>
<
/Paper
>
<
/Paper
>
<
/div
>
<
/div
>
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"col-2 content-right"
style
=
{{
maxWidth
:
"inherit"
,
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
setState
({
visibleUpload
:
false
})}
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
UploadFile
type
=
{
this
.
state
.
uploadStatus
}
percentage
=
{
this
.
state
.
percentage
}
result
=
{
this
.
state
.
result
}
acceptedFiles
=
{[
"xlsx"
]}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandler
(
dt
)
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
onUpload
=
{()
=>
{
String
(
this
.
state
.
judul
).
includes
(
"MONTHLY REPORT - FIXED ASSETS MOVEMENT"
)
?
this
.
checkUpload
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
<
/div
>
<
/div
>
)}
<
/div
>
<
/div
>
)
)
}
}
...
...
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