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
1d230595
Commit
1d230595
authored
Dec 07, 2020
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oi
parent
f9ca39fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
1 deletion
+86
-1
index.js
src/api/index.js
+2
-0
OperatingIndicatorMR.js
src/container/MonthlyReport/OperatingIndicatorMR.js
+84
-1
No files found.
src/api/index.js
View file @
1d230595
...
...
@@ -274,6 +274,7 @@ const create = (type = "") => {
const
checkUploadMonthlyReportTP
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_tp/check_import'
,
body
)
const
checkUploadMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/fam/check_import'
,
body
)
const
checkUploadMonthlyReportBS
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_bs/check_import'
,
body
)
const
checkUploadMonthlyReportOI
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_oi/check_import'
,
body
)
const
uploadMonthlyReportBS
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_bs/import_monthly_report'
,
body
)
const
uploadMonthlyReportFAM
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/fam/import_monthly_report'
,
body
)
const
uploadMonthlyReportTP
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_tp/import_monthly_report'
,
body
)
...
...
@@ -491,6 +492,7 @@ const create = (type = "") => {
getHierarkiMontlyReportCAT
,
checkUploadMonthlyReportTP
,
checkUploadMonthlyReportFAM
,
checkUploadMonthlyReportOI
,
uploadMonthlyReportPL
,
getMonthlyReport
,
checkUploadMonthlyReportBS
,
...
...
src/container/MonthlyReport/OperatingIndicatorMR.js
View file @
1d230595
...
...
@@ -237,6 +237,89 @@ export default class OperatingIndicatorMR extends Component {
this
.
props
.
onClickClose
()
}
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
({
order
:
i
[
0
]
===
undefined
?
""
:
String
(
i
[
0
]).
trim
(),
item_report_id
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
item_report
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
uom
:
i
[
3
]
===
undefined
?
""
:
String
(
i
[
3
]).
trim
(),
actual
:
i
[
4
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
mtd_vs_mb
:
i
[
5
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
5
]))
===
false
?
"0"
:
String
(
i
[
5
]).
trim
(),
mtd_vs_rb
:
i
[
6
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
6
]))
===
false
?
"0"
:
String
(
i
[
6
]).
trim
(),
})
}
})
let
body
=
{
company_id
:
this
.
props
.
data
.
company
.
company_id
,
periode
:
this
.
props
.
data
.
periode
,
report_id
:
this
.
props
.
data
.
report_id
,
months
:
this
.
props
.
data
.
report_id
===
22
?
1
:
23
?
2
:
24
?
3
:
25
?
4
:
27
?
5
:
28
?
6
:
29
?
7
:
31
?
8
:
32
?
9
:
33
?
10
:
35
?
11
:
36
?
12
:
null
,
monthly_report
:
payload
}
console
.
log
(
body
)
this
.
setState
({
payload
:
body
,
buttonError
:
false
,
judul
:
resp
.
rows
[
1
][
0
]
})
}
});
}
checkUpload
()
{
api
.
create
().
checkUploadMonthlyReportOI
(
this
.
state
.
payload
).
then
(
response
=>
{
// console.log(JSON.stringify(this.state.payload));
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
visibleUpload
:
false
,
visibleOI
:
false
,
loading
:
true
})
let
total
=
0
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
console
.
log
(
item
);
// if (item.type_report_id != null) {
// total += 1
// }
// return [
// item.type_report_id,
// item.item_report_id,
// item.parent,
// item.formula,
// item.level,
// item.item_report,
// item.uom,
// item.rolling_outlook,
// item.master_budget,
// item.rolling_budget,
// item.actual,
// item.amount_act_vs_mb,
// item.percent_act_vs_mb,
// item.amount_act_vs_rb,
// item.percent_act_vs_rb,
// item.mtd_vs_mb,
// item.mtd_vs_rb,
// item.order,
// item.error
// ]
})
// this.setState({ dataTable, dataLoaded: true, loading: false, templateNull : total > 0 ? true : false })
}
}
})
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
const
handleValue
=
(
data
,
type
)
=>
{
...
...
@@ -1424,7 +1507,7 @@ export default class OperatingIndicatorMR extends Component {
this
.
setState
({
uploadStatus
:
'idle'
,
percentage
:
'0'
})
}}
onUpload
=
{()
=>
{
this
.
state
.
judul
===
"MONTHLY REPORT -
OPERATING INDICATOR
"
?
this
.
state
.
judul
===
"MONTHLY REPORT -
MONTHLY REPORT
"
?
this
.
checkUpload
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
...
...
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