profile reports

This commit is contained in:
mashfiq 2025-01-14 18:23:48 +06:00
parent 89f9dddd85
commit 4f7337c5b7
13 changed files with 3217 additions and 2855 deletions

View File

@ -3991,4 +3991,13 @@ namespace HRM.BO
ReadyInOneYear = 2,
ReadyInTwoYears = 3
}
public enum EnumProfileReportType : short
{
Print_CV = 1,
Employee_Service_Book = 2,
Appointment_Letter_Worker = 3,
Appointment_Letter_Staff = 4,
Appointment_Letter_Officer = 5
}
}

View File

@ -19,6 +19,7 @@ using Org.BouncyCastle.Ocsp;
using HRM.Service;
using HRM.BO.Configuration;
using Microsoft.Extensions.Configuration;
using NPOI.SS.Formula.Functions;
namespace HRM.Report
{
@ -2918,12 +2919,14 @@ namespace HRM.Report
}
//Echotex Profile Reports
public byte[] GetEmployeeCV(HREmployee employee/*Employee employee*/, int payrollTypeId, string reportType)
public byte[] GetEmployeeCV(int empid, int payrollTypeId, string reportType)
{
ReportProcessor reportProcessor = new ReportProcessor();
try
{
HREmployee employee = new HREmployeeService().Get(empid);
DataRow oRow = null;
//_rImageManager = new RemoteImageManager();
String RDLC = "HRM.Report.RDLC.EmployeeCV.rdlc";
@ -3285,10 +3288,11 @@ namespace HRM.Report
// return leaveReocd;
//}
public byte[] GetAsstOfficeAndAbove(HREmployee employee, int payrollTypeID, string reportType)
public byte[] GetAsstOfficeAndAbove(int empid, int payrollTypeID, string reportType)
{
try
{
Employee employee = new EmployeeService().Get(empid);
String RDLC = "HRM.Report.RDLC.ApLetterForAssistantOfficerToAbove.rdlc";
DataSet dSet = new DataSet();
@ -3296,10 +3300,6 @@ namespace HRM.Report
dTable.TableName = "dsCompany_EmployeeAppointmentInfo";
dSet.Tables.Add(dTable);
List<ReportParameter> _parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("CompanyName", System.Configuration.ConfigurationSettings.AppSettings["CompanyName"]);
_parameters.Add(parameter);
double total = 0;
if (dSet.Tables[0].Rows.Count > 0)
@ -3311,19 +3311,24 @@ namespace HRM.Report
// Convert.ToDouble(dSet.Tables[0].Rows[0]["Food"]);
}
SystemInformation systemInformation = new SystemInformationService().Get();
List<ReportParameter> _parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("CompanyName", systemInformation.name);
_parameters.Add(parameter);
parameter = new ReportParameter("AmountInWord", Global.NumericFunctions.AmountInWords((decimal)total, "", " only"));
_parameters.Add(parameter);
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.CommonReportView(null, RDLC, dSet, null, null, true, payrollTypeID, reportType);
return reportProcessor.CommonReportView(null, RDLC, dSet, null, _parameters, false, payrollTypeID, reportType);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
private DataTable CollectDataForEnglishAppointment(HREmployee employee, int payrollTypeID)
private DataTable CollectDataForEnglishAppointment(Employee employee, int payrollTypeID)
{
DataRow oRow = null;
PayrollDataSet.dsCompany.EmployeeAppointmentInfoDataTable dEmpInfo = new HRM.Report.PayrollDataSet.dsCompany.EmployeeAppointmentInfoDataTable();
@ -3370,32 +3375,33 @@ namespace HRM.Report
oRow["Designation"] = drBasic["Designation"];
oRow["Basic"] = employee.BasicSalary;
List<ADParameter> adParams = null;
List<ADParameter> adParams = new ADParameterService().Get(employee.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance, payrollTypeID);
List<ADParameterEmployee> adParamEmps = null;
adParams = new ADParameterService().Get(employee.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance, payrollTypeID);
//EmployeeGradeSalary oEmpGradeSalary = new EmployeeGradeSalaryService().Get();
EmployeeGradeSalary oEmpGradeSalary = new EmployeeGradeSalaryService().GetBasicOnDateBAT(employee.ID, DateTime.Now);
if (adParams != null)
{
foreach (ADParameter adParam in adParams)
{
//double amount = new ADParameterService().GetGradeDefinedAmount(employee, employee.BasicSalary, employee.GrossSalary);
//switch (adParam.AllowanceDeduction.Code.Trim())
//{
// case "008":
// oRow["HouseRent"] = amount;
// break;
// case "010":
// oRow["Conveyence"] = amount;
// break;
// case "011":
// oRow["Medical"] = amount;
// break;
// case "006":
// oRow["Food"] = amount;
// break;
// default:
// break;
//}
double amount = new ADParameterService().GetGradeDefinedAmount(employee, employee.BasicSalary, employee.GrossSalary, oEmpGradeSalary, adParam);
switch (adParam.AllowanceDeduction.Code.Trim())
{
case "008":
oRow["HouseRent"] = amount;
break;
case "010":
oRow["Conveyence"] = amount;
break;
case "011":
oRow["Medical"] = amount;
break;
case "006":
oRow["Food"] = amount;
break;
default:
break;
}
}
}

View File

@ -45,6 +45,7 @@
<None Remove="RDLC\AllDigitalServiceBook.rdlc" />
<None Remove="RDLC\AllEmpTaxInfo.rdlc" />
<None Remove="RDLC\AllMedicalClaim.rdlc" />
<None Remove="RDLC\ApLetterForAssistantOfficerToAbove.rdlc" />
<None Remove="RDLC\ApointmentLetterForStuff.rdlc" />
<None Remove="RDLC\ApointmentLetterForWorker.rdlc" />
<None Remove="RDLC\ArrearBankAdvice.rdlc" />
@ -321,6 +322,7 @@
<EmbeddedResource Include="RDLC\AllDigitalServiceBook.rdlc" />
<EmbeddedResource Include="RDLC\AllEmpTaxInfo.rdlc" />
<EmbeddedResource Include="RDLC\AllMedicalClaim.rdlc" />
<EmbeddedResource Include="RDLC\ApLetterForAssistantOfficerToAbove.rdlc" />
<EmbeddedResource Include="RDLC\ApointmentLetterForStuff.rdlc" />
<EmbeddedResource Include="RDLC\ApointmentLetterForWorker.rdlc" />
<EmbeddedResource Include="RDLC\ArrearBankAdvice.rdlc" />

File diff suppressed because it is too large Load Diff

View File

@ -3911,21 +3911,25 @@
</ReportParameter>
<ReportParameter Name="CompanyInfo">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Report_Parameter_1</Prompt>
</ReportParameter>
<ReportParameter Name="Logo">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Report_Parameter_2</Prompt>
</ReportParameter>
<ReportParameter Name="Address">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Report_Parameter_3</Prompt>
</ReportParameter>
<ReportParameter Name="Phone">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>Report_Parameter_4</Prompt>
</ReportParameter>

View File

@ -838,7 +838,7 @@ namespace HRM.Report
reportParameters.Add(rParam);
// rParam = new ReportParameter("CompanyInfo", oPT.Description.ToString());
rParam = new ReportParameter("CompanyInfo", payrollType != null ? payrollType.CompanyName : string.Empty);
rParam = new ReportParameter("CompanyInfo", payrollType != null ? (payrollType.CompanyName != null && payrollType.CompanyName.Trim() != "" ? payrollType.CompanyName : systemInformation?.name) : string.Empty);
reportParameters.Add(rParam);
rParam = new ReportParameter("SearchCriteria", "");

View File

@ -130,4 +130,7 @@ export class ReportServices {
getAttendanceReport(param: any, reportType: string) {
return this.apiService.httpPost<any>('/Report/getAttendanceReport/' + reportType, param);
}
getProfileReportData(param: any): Observable<HttpEvent<any>> {
return this.apiService.httpPost<any>('/Report/getProfileReportData/', param);
}
}

View File

@ -0,0 +1,66 @@
<app-loading-panel> </app-loading-panel>
<div class="card" style="padding:10px;">
<div class="p-grid" style="justify-content: center">
<div class="p-col-12">
<fieldset style="border-radius: 5px;">
<div class="p-grid" style="margin-top: auto; margin-bottom: auto;">
<div class="p-col-4">
<app-employee-picker
[setSelectedEmp]="selectedEmployee"
(ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker>
</div>
<div class="p-col-1">
<label>Authorized Person</label>
</div>
<div class="p-col-3">
<kendo-dropdownlist [(ngModel)]="authorizedPerson" [data]="authorizedPersons" [textField]="'name'"
[valueField]="'id'" [defaultItem]="{ name: 'Select Authorized Person..', id: null }"
style="width:100%;">
</kendo-dropdownlist>
</div>
<div class="p-col-1">
<label>Report</label>
</div>
<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%;">
</kendo-dropdownlist>
</div>
<!-- <div class="p-col-3" align="middle">
<label>Salary Allocation Date</label>
</div>
<div class="p-col-3">
<kendo-datepicker [(ngModel)]="salaryAllocationDate" [format]="salaryAllocationDateFormat"
[bottomView]="bottomView" [topView]="topview" style="width:100%"></kendo-datepicker>
</div>
<div class="p-col-3" align="middle" *ngIf="showLocation">
<label>Location</label>
</div>
<div class="p-col-3" *ngIf="showLocation">
<kendo-dropdownlist [(ngModel)]="selectedLocation" [data]="locations"
[defaultItem]="{ name: 'Select Location..', id: 0 }" [textField]="'name'" [valueField]="'id'"
(valueChange)="locationChange($event)"
style="width:100%;">
</kendo-dropdownlist>
</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-excel" [primary]="true" style="margin-left:5px;"
(click)="preview('EXCEL')">Export</button>
</div>
</fieldset>
</div>
</div>
</div>
<div class="card" *ngIf="showPopUp" class="blur-background">
<kendo-window [height]="600" title="{{PDFTitle}}" *ngIf="showPopUp" (close)="closeForm()"
[style]="{'min-width': '70%','max-width': '100%', 'max-height': '100%'}">
<app-loading-panel> </app-loading-panel>
<div class='embed-responsive'>
<iframe class="pdf-viewer" id="pdf-viewer-report" type='application/pdf' [zoom]="zoomLevel"></iframe>
</div>
</kendo-window>
</div>

View File

@ -0,0 +1,194 @@
import { Component, OnInit } from '@angular/core';
import { DynamicPicker, EnumDynamicpickerType } from '../../picker/dynamic-picker/Dynamic-Picker';
import {
EnumBloodGroup,
EnumExtension,
EnumGender,
EnumMaritalStatus,
EnumSearchFrom,
EnumSearchObjDataType,
EnumSearchParameter,
EnumSQLOperator,
EnumStatus
} from '../../_models/enums';
import { SearchEmployee, SearchManager } from '../../_models/Employee/searchEmployee';
import { EmployeeServices } from '../../_services/employee/employee.service';
import { EmployeeBasicInfo } from '../../_models/report/employee-basic-info';
import { Router } from '@angular/router';
import { EmployeeDetailInfo } from '../../_models/report/employeeDetailInfo';
import { loadingPanelService } from '../../hrm-loding panel/loding.panel.service';
import { ColumnDefinition, Columns, ReportViewerListColumn } from '../report-viewer/repor-viewer-object';
import { AttendanceServices } from '../../_services/attendance/attendance.service';
import { DailyAttnByStatusReport } from '../../_models/Attendance/dailyAttnByStatusReport';
import { HRMNotificationService } from '../../app.notification.service';
import { DataStateChangeEvent, GridDataResult, PageChangeEvent, SelectableSettings, SelectableMode } from '@progress/kendo-angular-grid';
import { ExcelExportData } from '@progress/kendo-angular-excel-export';
import { DataResult, GroupDescriptor, process, State } from '@progress/kendo-data-query';
import { ReportServices } from '../../_services/reports/report.service';
import { DomSanitizer } from '@angular/platform-browser';
import { BasicService } from '../../_services/Basic/basic.service';
import { LoanService } from 'src/app/_services/payroll/loan.service';
import { ApiService } from '../../app.api.service';
import { TaxParameter } from '../../_models/Payroll/Tax/taxParameter';
import { TaxService } from '../../_services/payroll/tax.service';
import { LeaveService } from '../../_services/leave/leave.service';
import { PayrollType } from '../../_models/Authentication/payrollType';
import { User } from '../../_models/Authentication/user';
import { AuthService } from '../../_services/auth/auth.service';
import { saveAs } from 'file-saver';
import { SalaryService } from '../../_services/payroll/salary.service';
import { LoanIssue } from 'src/app/_models/Payroll/Loan/loanIssue';
import { Bank } from 'src/app/_models/Basic/bank';
import { formatDate } from '@progress/kendo-angular-intl';
import { encodeBase64 } from '@progress/kendo-file-saver';
import { AuthorizedPerson } from 'src/app/adhoc-feature/authorized-persons/authorizedPerson';
import { Employee } from 'src/app/_models/Employee/employee';
import { HrEmployee } from 'src/app/_models/HREmployee/hrEmployee';
@Component({
selector: 'app-employee-profile-reports',
templateUrl: './employee-profile-reports.component.html',
styleUrls: ['./employee-profile-reports.component.scss']
})
export class EmployeeProfileReportsComponent implements OnInit {
public showPopUp: boolean = false;
public src: any;
public PDFTitle = '';
public selectedreportType: EnumProfileReportType;
public reportTypes = Object.keys(EnumProfileReportType)
.filter(key => !isNaN(Number(EnumProfileReportType[key])))
.map(key => ({
text: key.replace(/_/g, ' '),
value: EnumProfileReportType[key]
}));
public authorizedPersons: AuthorizedPerson[] = [];
public authorizedPerson: AuthorizedPerson;
public selectedEmployee: SearchEmployee;
public employee: HrEmployee;
constructor(public employeeService: EmployeeServices,
public attendanceService: AttendanceServices,
public reportService: ReportServices,
private sanitizer: DomSanitizer,
public basicService: BasicService,
public loanService: LoanService,
public taxService: TaxService,
public salaryService: SalaryService,
public leaveYearService: LeaveService,
public router: Router, public loadingPanel: loadingPanelService,
public notificationService: HRMNotificationService,
public apiService: ApiService, public authService: AuthService) {
}
ngOnInit(): void {
this.loadAuthorizedPerson();
}
closeForm(): void {
this.showPopUp = false;
this.loadingPanel.ShowLoadingPanel = false;
}
preview(reportType: string) {
debugger;
const data = {
reportID: this.selectedreportType['value'],
personID: this.authorizedPerson.id,
employeeID: this.selectedEmployee.employeeID,
reportType: reportType
};
this.loadingPanel.ShowLoadingPanel = true;
if (reportType === 'PDF')
this.showPopUp = true;
this.reportService.getProfileReportData(data).subscribe(
(resp: any) => {
if (reportType === 'PDF') {
this.src = URL.createObjectURL(this.b64toBlob(resp, 'application/pdf', 1024));
var element = <HTMLIFrameElement>(document.getElementById("pdf-viewer-report"));
element.src = this.src;
} else if (reportType === 'EXCEL') {
this.downloadFile(resp);
}
},
(err) => {
this.closeForm();
console.log(err);
this.notificationService.showError(err.error);
this.loadingPanel.ShowLoadingPanel = false;
},
() => {
this.loadingPanel.ShowLoadingPanel = false;
// this.loadGrid();
}
);
}
downloadFile(blobContent) {
let blob = new Blob([this.b64toBlob(blobContent, 'application/data:application/vnd.ms-excel', 1024)], {});
saveAs(blob, this.PDFTitle + '.xls');
}
b64toBlob(b64Data, contentType, sliceSize) {
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
const blob = new Blob(byteArrays, { type: contentType });
return blob;
}
public loadAuthorizedPerson() {
this.employeeService.getAuthorizedPerson().subscribe(
(resp) => {
this.authorizedPersons = resp as AuthorizedPerson[];
},
(err: any) => {
this.notificationService.showError(err.error);
this.loadingPanel.ShowLoadingPanel = false;
}
);
}
public GetSelectedEmployee(childData: any) {
if (childData === undefined) {
this.employee = new HrEmployee();
return;
}
this.selectedEmployee = childData;
// this.employeeService.getHREmployeeID(this.selectedEmployee.employeeID).subscribe(
// (resp: any) => {
// this.employee = resp;
// },
// (err: any) => {
// this.notificationService.showError(err.error);
// }
// );
}
}
export enum EnumProfileReportType {
Print_CV = 1,
// Employee_Service_Book = 2,
Appointment_Letter_Worker = 3,
Appointment_Letter_Staff = 4,
Appointment_Letter_Officer = 5
}

View File

@ -30,6 +30,7 @@ import { PfLedgerComponent } from './pf-ledger/pf-ledger.component';
import { CcWiseBonusSummaryComponent } from './cc-wise-bonus-summary/cc-wise-bonus-summary.component';
import { CcwiseSalarySummaryComponent } from './ccwise-salary-summary/ccwise-salary-summary.component';
import { CcwiseNewPfMemberWithAmountComponent } from './ccwise-new-pf-member-with-amount/ccwise-new-pf-member-with-amount.component';
import { EmployeeProfileReportsComponent } from './employee-profile-reports/employee-profile-reports.component';
const routes: Routes = [
@ -160,6 +161,7 @@ const routes: Routes = [
{ path: 'report-viewer/721', component: ReportViewerComponent, canActivate: [AuthGuard] },
{ path: 'report-viewer/722', component: ReportViewerComponent, canActivate: [AuthGuard] },
{ path: 'report-viewer/723', component: ReportViewerComponent, canActivate: [AuthGuard] },
{ path: 'report-viewer/profile-reports', component: EmployeeProfileReportsComponent, canActivate: [AuthGuard] },
];

View File

@ -48,6 +48,7 @@ import { PfLedgerComponent } from './pf-ledger/pf-ledger.component';
import { CcWiseBonusSummaryComponent } from './cc-wise-bonus-summary/cc-wise-bonus-summary.component';
import { CcwiseSalarySummaryComponent } from './ccwise-salary-summary/ccwise-salary-summary.component';
import { CcwiseNewPfMemberWithAmountComponent } from './ccwise-new-pf-member-with-amount/ccwise-new-pf-member-with-amount.component';
import { EmployeeProfileReportsComponent } from './employee-profile-reports/employee-profile-reports.component';
@NgModule({
declarations: [
@ -74,7 +75,8 @@ import { CcwiseNewPfMemberWithAmountComponent } from './ccwise-new-pf-member-wit
PfLedgerComponent,
CcWiseBonusSummaryComponent,
CcwiseSalarySummaryComponent,
CcwiseNewPfMemberWithAmountComponent
CcwiseNewPfMemberWithAmountComponent,
EmployeeProfileReportsComponent
],
imports: [
CommonModule,

View File

@ -1695,6 +1695,54 @@ namespace HRM.UI.Controllers.Report
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(bytes);
}
[HttpPost("getProfileReportData")]
public ActionResult getProfileReportData(dynamic data)
{
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
var items = Newtonsoft.Json.JsonConvert.DeserializeObject(Convert.ToString(data));
EnumProfileReportType reportid = (EnumProfileReportType)items["reportID"].ToObject<int>();
int personID = 0;
int employeeID = 0;
if (items["personID"] != null)
personID = (int)items["personID"].ToObject<int>();
if (items["employeeID"] != null)
employeeID = (int)items["employeeID"].ToObject<int>();
string reportType = (string)items["reportType"].ToObject<string>();
int payrollTypeId = currentUser.PayrollTypeID.GetValueOrDefault();
byte[] bytes = null;
try
{
switch (reportid)
{
case EnumProfileReportType.Print_CV:
bytes = new rptEmployee().GetEmployeeCV(employeeID, payrollTypeId, reportType);
break;
case EnumProfileReportType.Employee_Service_Book:
break;
case EnumProfileReportType.Appointment_Letter_Officer:
bytes = new rptEmployee().GetAsstOfficeAndAbove(employeeID, payrollTypeId, reportType);
break;
case EnumProfileReportType.Appointment_Letter_Worker:
break;
case EnumProfileReportType.Appointment_Letter_Staff:
break;
default:
break;
}
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(bytes);
}
}