profile letter

This commit is contained in:
mashfiq 2025-01-19 15:20:09 +06:00
parent 558c53d4d3
commit 116f8171ef
5 changed files with 44 additions and 11 deletions

View File

@ -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;

View File

@ -24,7 +24,7 @@
<div class="p-col-3">
<kendo-dropdownlist [(ngModel)]="selectedreportType" [data]="reportTypes" [textField]="'text'"
[valueField]="'value'" [defaultItem]="{ text: 'Select Report Type..', value: null }"
style="width:100%;">
style="width:100%;" (valueChange)="onSelectReport($event)">
</kendo-dropdownlist>
</div>
<!-- <div class="p-col-3" align="middle">
@ -46,7 +46,7 @@
</div> -->
</div>
<div class="p-col-12" align="right">
<button kendoButton icon="file-pdf" [primary]="true" (click)="preview('PDF')">Preview</button>
<button kendoButton icon="file-pdf" [primary]="true" (click)="preview('PDF')" *ngIf="isViewable">Preview</button>
<button kendoButton icon="download" [primary]="true" style="margin-left:5px;"
(click)="preview('Download')">Download</button>
</div>

View File

@ -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 = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report"));
element.src = URL.createObjectURL(new Blob([fileData], { type: 'application/pdf' }));
// Doc
// var element = <HTMLIFrameElement>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 {

View File

@ -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)

View File

@ -1172,6 +1172,18 @@
<TypeScriptCompile Remove="ClientApp\src\app\_models\Recruitement\InterviewAssessmentKpi.ts" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Interop.Word">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>7</VersionMinor>
<VersionMajor>8</VersionMajor>
<Guid>00020905-0000-0000-c000-000000000046</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="appsettings.json" />
<EmbeddedResource Include="RDLC\CandidateAssesmentDetails.rdlc" />