Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
myhr-portal
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
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
angular
myhr-portal
Commits
0b2fd967
Commit
0b2fd967
authored
Jul 09, 2025
by
Nattana Chaiyamat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
รายงาน Excel
parent
e5815db4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
excel-report.component.ts
src/app/apps/excel-report/excel-report.component.ts
+25
-4
No files found.
src/app/apps/excel-report/excel-report.component.ts
View file @
0b2fd967
...
...
@@ -4,6 +4,7 @@ import { NgbDate, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import
{
ExcelReportService
}
from
'src/app/service/excel-report.service'
;
import
*
as
FileSaver
from
'file-saver'
;
import
{
IDataOptions
}
from
'@syncfusion/ej2-angular-pivotview'
;
import
{
Subscription
}
from
'rxjs'
;
export
interface
ModalDetail
{
text
:
{
cardHead
:
string
,
search
:
string
[],
tableHead
:
string
[]
}
...
...
@@ -33,6 +34,7 @@ export class ExcelReportComponent implements OnInit {
page
=
1
pageSize
=
10
excelReportServiceSub
?:
Subscription
constructor
(
private
route
:
ActivatedRoute
,
private
ngbModal
:
NgbModal
,
private
excelReportService
:
ExcelReportService
,
...
...
@@ -54,6 +56,8 @@ export class ExcelReportComponent implements OnInit {
});
}
getDataExcelReport
(
templateId
:
string
,
fileName
:
string
)
{
this
.
excelReportServiceSub
?.
unsubscribe
()
this
.
loadingExcel
=
false
this
.
loading
=
true
this
.
excelReport
=
undefined
this
.
variableSheet
=
[]
...
...
@@ -111,6 +115,16 @@ export class ExcelReportComponent implements OnInit {
}
}
ngbtoDate
(
date
?:
NgbDate
)
{
if
(
date
)
{
const
day
=
String
(
date
.
day
).
padStart
(
2
,
'0'
);
const
month
=
String
(
date
.
month
).
padStart
(
2
,
'0'
);
const
year
=
date
.
year
;
return
`
${
year
}
-
${
month
}
-
${
day
}
`
}
return
''
}
openModal
(
data
:
any
,
modal
:
any
)
{
this
.
searchModal
=
''
this
.
page
=
1
...
...
@@ -146,13 +160,20 @@ export class ExcelReportComponent implements OnInit {
const
param
=
this
.
excelReport
.
param
.
variableName
const
data
=
this
.
variableSheet
.
map
((
item
:
any
)
=>
{
if
(
item
.
type
==
'help'
)
{
return
"__"
+
item
.
key
+
"="
+
item
.
value
.
id
}
else
if
(
item
.
type
==
'calendar'
||
item
.
type
==
'list'
||
item
.
type
==
'radio'
||
item
.
type
==
'text'
)
{
return
"__"
+
item
.
key
+
"="
+
item
.
value
return
"__"
+
item
.
key
+
"="
+
this
.
select
[
item
.
key
].
id
}
else
if
(
item
.
type
==
'list'
||
item
.
type
==
'radio'
||
item
.
type
==
'text'
)
{
return
"__"
+
item
.
key
+
"="
+
this
.
select
[
item
.
key
]
}
else
if
(
item
.
type
==
'calendar'
)
{
return
"__"
+
item
.
key
+
"="
+
this
.
ngbtoDate
(
this
.
select
[
item
.
key
])
}
return
""
}).
join
(
'|'
)
this
.
excelReportService
.
downloadTemplateFile
(
fileName
).
subscribe
((
res
:
any
)
=>
{
const
body
=
{
fileName
:
fileName
,
paramObj
:
data
}
this
.
excelReportServiceSub
?.
unsubscribe
()
this
.
excelReportServiceSub
=
this
.
excelReportService
.
printExcelReport
(
body
).
subscribe
((
res
:
any
)
=>
{
const
blob
=
new
Blob
([
res
],
{
type
:
'application/octet-stream'
});
FileSaver
.
saveAs
(
blob
,
fileName
);
this
.
loadingExcel
=
false
...
...
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