From 116f8171ef0129554a4a6f2a4f14d1cdeb720e0a Mon Sep 17 00:00:00 2001 From: mashfiq Date: Sun, 19 Jan 2025 15:20:09 +0600 Subject: [PATCH] profile letter --- HRM.Report/Class/rptEmployee.cs | 5 ++-- .../employee-profile-reports.component.html | 4 ++-- .../employee-profile-reports.component.ts | 23 +++++++++++++++++-- HRM.UI/Controllers/Report/ReportController.cs | 11 +++++---- HRM.UI/HRM.UI.csproj | 12 ++++++++++ 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/HRM.Report/Class/rptEmployee.cs b/HRM.Report/Class/rptEmployee.cs index c83ba55..c75d562 100644 --- a/HRM.Report/Class/rptEmployee.cs +++ b/HRM.Report/Class/rptEmployee.cs @@ -3630,8 +3630,9 @@ namespace HRM.Report file.ReplaceWords(sFilePath, table); file.CloseWordApplication(); - pdfFilePath = System.IO.Path.ChangeExtension(sFilePath, ".pdf"); - ConvertDocToPdf(sFilePath, pdfFilePath); + //pdfFilePath = System.IO.Path.ChangeExtension(sFilePath, ".pdf"); + //ConvertDocToPdf(sFilePath, pdfFilePath); + pdfFilePath = sFilePath; } return pdfFilePath; diff --git a/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.html b/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.html index 80054c8..9d0c52d 100644 --- a/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.html +++ b/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.html @@ -24,7 +24,7 @@
+ style="width:100%;" (valueChange)="onSelectReport($event)">
- +
diff --git a/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.ts b/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.ts index 5e3099d..27a6a40 100644 --- a/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.ts +++ b/HRM.UI/ClientApp/src/app/reports/employee-profile-reports/employee-profile-reports.component.ts @@ -57,6 +57,7 @@ export class EmployeeProfileReportsComponent implements OnInit { public showPopUp: boolean = false; public src: any; public PDFTitle = ''; + public isViewable: boolean = true; public selectedreportType: EnumProfileReportType; public reportTypes = Object.keys(EnumProfileReportType) @@ -83,6 +84,7 @@ export class EmployeeProfileReportsComponent implements OnInit { public router: Router, public loadingPanel: loadingPanelService, public notificationService: HRMNotificationService, public apiService: ApiService, public authService: AuthService) { + this.apiService.selectedMenuName = 'Profile Reports'; } @@ -152,14 +154,22 @@ export class EmployeeProfileReportsComponent implements OnInit { } else { this.reportService.getGeneratedProfileReportData(data).subscribe(fileData => { - + this.loadingPanel.ShowLoadingPanel = false; if (reportType == 'PDF') { var element = (document.getElementById("pdf-viewer-report")); element.src = URL.createObjectURL(new Blob([fileData], { type: 'application/pdf' })); + + // Doc + // var element = document.getElementById("pdf-viewer-report"); + // const fileUrl = URL.createObjectURL(new Blob([fileData], { type: 'application/msword' })); + + // // Using Google Docs Viewer + // element.src = `https://docs.google.com/gview?url=${encodeURIComponent(fileUrl)}&embedded=true`; } if (reportType == 'Download') - this.downloadBlob(new Blob([fileData], { type: 'application/pdf' }), 'application/pdf', this.PDFTitle); + this.downloadBlob(new Blob([fileData], { type: 'application/msword' }), 'application/msword', this.PDFTitle); + // this.downloadBlob(new Blob([fileData], { type: 'application/pdf' }), 'application/pdf', this.PDFTitle); }, (error) => { @@ -242,7 +252,16 @@ export class EmployeeProfileReportsComponent implements OnInit { // } // ); } + onSelectReport(value: any) { + debugger; + if (this.selectedreportType['value'] != EnumProfileReportType.Appointment_Letter_Staff && this.selectedreportType['value'] != EnumProfileReportType.Appointment_Letter_Worker) { + this.isViewable = true; + } else { + this.isViewable = false; + } + + } } export enum EnumProfileReportType { diff --git a/HRM.UI/Controllers/Report/ReportController.cs b/HRM.UI/Controllers/Report/ReportController.cs index b911a00..c8efb37 100644 --- a/HRM.UI/Controllers/Report/ReportController.cs +++ b/HRM.UI/Controllers/Report/ReportController.cs @@ -1812,15 +1812,16 @@ namespace HRM.UI.Controllers.Report byte[] buffer = new byte[16 * 1024]; buffer = System.IO.File.ReadAllBytes(sFilePath); string contentType = GetFileType(sFilePath); - var name = System.IO.Path.ChangeExtension(lFileName, ".pdf"); + //var name = System.IO.Path.ChangeExtension(lFileName, ".pdf"); + var name = lFileName; if (System.IO.File.Exists(sFilePath)) { System.IO.File.Delete(sFilePath); } - if (System.IO.File.Exists(System.IO.Path.ChangeExtension(sFilePath, ".doc"))) - { - System.IO.File.Delete(System.IO.Path.ChangeExtension(sFilePath, ".doc")); - } + //if (System.IO.File.Exists(System.IO.Path.ChangeExtension(sFilePath, ".doc"))) + //{ + // System.IO.File.Delete(System.IO.Path.ChangeExtension(sFilePath, ".doc")); + //} return File(buffer, contentType, name); } catch (Exception e) diff --git a/HRM.UI/HRM.UI.csproj b/HRM.UI/HRM.UI.csproj index 356a16d..9158fff 100644 --- a/HRM.UI/HRM.UI.csproj +++ b/HRM.UI/HRM.UI.csproj @@ -1172,6 +1172,18 @@ + + + tlbimp + 7 + 8 + 00020905-0000-0000-c000-000000000046 + 0 + false + true + + +