dev_mashfiq #31

Open
Mashfiq wants to merge 8 commits from dev_mashfiq into devqc
5 changed files with 44 additions and 11 deletions
Showing only changes of commit 116f8171ef - Show all commits

View File

@ -3630,8 +3630,9 @@ namespace HRM.Report
file.ReplaceWords(sFilePath, table); file.ReplaceWords(sFilePath, table);
file.CloseWordApplication(); file.CloseWordApplication();
pdfFilePath = System.IO.Path.ChangeExtension(sFilePath, ".pdf"); //pdfFilePath = System.IO.Path.ChangeExtension(sFilePath, ".pdf");
ConvertDocToPdf(sFilePath, pdfFilePath); //ConvertDocToPdf(sFilePath, pdfFilePath);
pdfFilePath = sFilePath;
} }
return pdfFilePath; return pdfFilePath;

View File

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

View File

@ -57,6 +57,7 @@ export class EmployeeProfileReportsComponent implements OnInit {
public showPopUp: boolean = false; public showPopUp: boolean = false;
public src: any; public src: any;
public PDFTitle = ''; public PDFTitle = '';
public isViewable: boolean = true;
public selectedreportType: EnumProfileReportType; public selectedreportType: EnumProfileReportType;
public reportTypes = Object.keys(EnumProfileReportType) public reportTypes = Object.keys(EnumProfileReportType)
@ -83,6 +84,7 @@ export class EmployeeProfileReportsComponent implements OnInit {
public router: Router, public loadingPanel: loadingPanelService, public router: Router, public loadingPanel: loadingPanelService,
public notificationService: HRMNotificationService, public notificationService: HRMNotificationService,
public apiService: ApiService, public authService: AuthService) { public apiService: ApiService, public authService: AuthService) {
this.apiService.selectedMenuName = 'Profile Reports';
} }
@ -152,14 +154,22 @@ export class EmployeeProfileReportsComponent implements OnInit {
} }
else { else {
this.reportService.getGeneratedProfileReportData(data).subscribe(fileData => { this.reportService.getGeneratedProfileReportData(data).subscribe(fileData => {
this.loadingPanel.ShowLoadingPanel = false; this.loadingPanel.ShowLoadingPanel = false;
if (reportType == 'PDF') { if (reportType == 'PDF') {
var element = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report")); var element = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report"));
element.src = URL.createObjectURL(new Blob([fileData], { type: 'application/pdf' })); 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') 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) => { (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 { export enum EnumProfileReportType {

View File

@ -1812,15 +1812,16 @@ namespace HRM.UI.Controllers.Report
byte[] buffer = new byte[16 * 1024]; byte[] buffer = new byte[16 * 1024];
buffer = System.IO.File.ReadAllBytes(sFilePath); buffer = System.IO.File.ReadAllBytes(sFilePath);
string contentType = GetFileType(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)) if (System.IO.File.Exists(sFilePath))
{ {
System.IO.File.Delete(sFilePath); System.IO.File.Delete(sFilePath);
} }
if (System.IO.File.Exists(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")); // System.IO.File.Delete(System.IO.Path.ChangeExtension(sFilePath, ".doc"));
} //}
return File(buffer, contentType, name); return File(buffer, contentType, name);
} }
catch (Exception e) catch (Exception e)

View File

@ -1172,6 +1172,18 @@
<TypeScriptCompile Remove="ClientApp\src\app\_models\Recruitement\InterviewAssessmentKpi.ts" /> <TypeScriptCompile Remove="ClientApp\src\app\_models\Recruitement\InterviewAssessmentKpi.ts" />
</ItemGroup> </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> <ItemGroup>
<EmbeddedResource Include="appsettings.json" /> <EmbeddedResource Include="appsettings.json" />
<EmbeddedResource Include="RDLC\CandidateAssesmentDetails.rdlc" /> <EmbeddedResource Include="RDLC\CandidateAssesmentDetails.rdlc" />