Employee Search (Short Profile, Long Profile, Lifecycle), job card remarks #44

Merged
chapal merged 1 commits from dev_Mohaimen into devqc 2025-07-01 13:03:11 +06:00
13 changed files with 321 additions and 17 deletions

View File

@ -370,7 +370,8 @@ namespace HRM.BO
List<SearchEmployee> FindCordinator(int? id, int? payrollTypeID);
List<SearchEmployee> FindEmpCodeName(int payrolltypeid, string code, string name);
List<SearchEmployee> FindEmpCodeNameForEmployeePicker(int userid, int payrolltypeid, string code, string name);
SearchEmployee get(int empid);
List<SearchEmployee> FindEmpCodeNameForEmployeePickerNew(int userid, int payrolltypeid, string code, string name, bool isForLifeCycle);
SearchEmployee get(int empid);
List<SearchEmployee> GetEmployeeNotYetUser(int payrollTypeID);
List<SearchEmployee> GetTeam(int employeeid);
List<SearchEmployee> GetTeam(int employeeid, EnumStatus enumStatus);

View File

@ -400,8 +400,170 @@ END;";
return tc.ExecuteReader(finalSQl);
}
#endregion
}
internal static IDataReader SearchForEmployeePickerNew(TransactionContext tc, int userID, int payrollTypeID, string code, string name, bool isForLifeCycle)
{
string orderby = "name";
string sqlClause = "";
string top = "";
#endregion
string recurSqlClause = SQLParser.MakeSQL(@"
DECLARE @userid INT = %n;
DECLARE @payrolltypeid INT = %n;
DECLARE @permissionstatus INT = %n;
WITH RecursiveCategory AS
(
SELECT
CATEGORYID
FROM
dbo.CATEGORY
WHERE
CATEGORYID IN (
SELECT REFERENCEID
FROM DATAPERMISSION
WHERE USERID = @userid
AND PAYROLLTYPEID = @payrolltypeid
AND PERMISSIONSTATUS = @permissionstatus
AND PERMISSIONTYPE = %n
)
),
RecursiveGrade AS
(
SELECT
GRADEID
FROM
dbo.GRADES
WHERE
GRADEID IN (
SELECT REFERENCEID
FROM DATAPERMISSION
WHERE USERID = @userid
AND PAYROLLTYPEID = @payrolltypeid
AND PERMISSIONSTATUS = @permissionstatus
AND PERMISSIONTYPE = %n
)
),
RecursiveDepartment AS
(
SELECT
DEPARTMENTID
FROM
dbo.DEPARTMENT
WHERE
DEPARTMENTID IN (
SELECT REFERENCEID
FROM DATAPERMISSION
WHERE USERID = @userid
AND PAYROLLTYPEID = @payrolltypeid
AND PERMISSIONSTATUS = @permissionstatus
AND PERMISSIONTYPE = %n
)
UNION ALL
SELECT
d.DEPARTMENTID
FROM
dbo.DEPARTMENT d
INNER JOIN
RecursiveDepartment rd
ON
d.PARENTID = rd.DEPARTMENTID
),
RecursiveLocation AS
(
SELECT
LOCATIONID
FROM
dbo.LOCATION
WHERE
LOCATIONID IN (
SELECT REFERENCEID
FROM DATAPERMISSION
WHERE USERID = @userid
AND PAYROLLTYPEID = @payrolltypeid
AND PERMISSIONSTATUS = @permissionstatus
AND PERMISSIONTYPE = %n
)
UNION ALL
SELECT
l.LOCATIONID
FROM
dbo.LOCATION l
INNER JOIN
RecursiveLocation rl
ON
l.PARENTID = rl.LOCATIONID
)", userID, payrollTypeID, EnumMenuPermissionStatus.Approved, EnumDataPermissionType.Cagtegory, EnumDataPermissionType.Grade, EnumDataPermissionType.Department, EnumDataPermissionType.Location);
string recurWhereClause = SQLParser.MakeSQL(@"
AND
(
(
EXISTS (SELECT 1 FROM RecursiveCategory)
AND CATEGORYID IN (SELECT CATEGORYID FROM RecursiveCategory)
)
OR
(
EXISTS (SELECT 1 FROM RecursiveGrade)
AND GRADEID IN (SELECT GRADEID FROM RecursiveGrade)
)
OR
(
EXISTS (SELECT 1 FROM RecursiveDepartment)
AND DEPARTMENTID IN (SELECT DEPARTMENTID FROM RecursiveDepartment)
)
OR
(
EXISTS (SELECT 1 FROM RecursiveLocation)
AND LOCATIONID IN (SELECT LOCATIONID FROM RecursiveLocation)
)
)");
//Previous Code For only Live Employee
//sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("PayrollTypeID =%n AND Status = %n", payrollTypeID, EnumStatus.Active);
//New Code For live And Waitiong for join Employee
if (isForLifeCycle == true)
{
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("PayrollTypeID =%n ", payrollTypeID);
}
else
{
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("PayrollTypeID =%n AND (Status = %n OR Status = %n)", payrollTypeID, EnumEmployeeStatus.Live, EnumEmployeeStatus.Waitingforjoin);
}
if (code != string.Empty)
{
//Previous with suggestion
//sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo LIKE %s", ("%" + code + "%"));
//orderby = "EmployeeNo";
//Using TOP
//sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo LIKE %s", ( code + "%")); // Using LIKE Operator
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo = %s", (code)); // Without Using LIKE Operator
orderby = "EmployeeNo";
top = "TOP 5";
//Without suggestion
//sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("EmployeeNo = %s", code );
//orderby = "EmployeeNo";
}
if (name != string.Empty)
sqlClause = SQLParser.TagSQL(sqlClause) + SQLParser.MakeSQL("Name LIKE %s", ("%" + name + "%"));
//string finalSQl = SQLParser.MakeSQL(
// "%q Select %q EmployeeID, EmployeeNo, Name, categoryID, GradeID, LocationID, designationid, DepartmentID From Employee %q %q Order by %s",
// recurSqlClause, top, sqlClause, recurWhereClause, orderby);
string finalSQl = SQLParser.MakeSQL(
"%q Select %q EmployeeID, EmployeeNo, Name, categoryID, GradeID, LocationID, designationid, DepartmentID From Employee %q %q " +
" UNION Select %q EmployeeID, EmployeeNo, Name, categoryID, GradeID, LocationID, designationid, DepartmentID From Employee %q " +
" Order by %s",
recurSqlClause, top, sqlClause, recurWhereClause, top, sqlClause, orderby);
return tc.ExecuteReader(finalSQl);
}
#endregion
}
#endregion
}

View File

@ -326,8 +326,45 @@ namespace HRM.DA
return searchEmployees;
}
public List<SearchEmployee> FindEmpCodeNameForEmployeePickerNew(int userID, int payrollTypeID, string code, string name, bool isForLifeCycle)
{
List<SearchEmployee> searchEmployees = new List<SearchEmployee>();
public List<SearchEmployee> GetEmployeeNotYetUser(int payrollTypeID)
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(SearchEmployeeDA.SearchForEmployeePickerNew(tc, userID, payrollTypeID, code, name, isForLifeCycle));
searchEmployees = this.CreateObjects<SearchEmployee>(dr);
//while (dr.Read())
//{
// SearchEmployee item = new SearchEmployee();
// item.Name = dr.GetString("name");
// item.EmployeeNo = dr.GetString("employeeNo");
// searchEmployees.Add(item);
//}
dr.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return searchEmployees;
}
public List<SearchEmployee> GetEmployeeNotYetUser(int payrollTypeID)
{
List<SearchEmployee> searchEmployees = new List<SearchEmployee>();

View File

@ -105,6 +105,12 @@ export class EmployeeServices {
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getEmpCodeNameForEmployeePickerInput' + '/' + ncode + '/' + nname);
}
getEmpCodeNameForEmployeePickerInputNew(code?: string, name?: string, isForLifeCycle? : boolean) {
let nname = this.apiService.getApiDefaultData(name);
let ncode = this.apiService.getApiDefaultData(code);
let nIsForLifeCycle = this.apiService.getApiDefaultBoolData(isForLifeCycle);
return this.apiService.httpGet<SearchEmployee[]>('/Employee/getEmpCodeNameForEmployeePickerInputNew' + '/' + ncode + '/' + nname + '/' + nIsForLifeCycle);
}
getEmployees() {
return this.apiService.httpGet(this.apiService.base_url + 'getemployees');

View File

@ -168,6 +168,10 @@ export class ApiService {
return (str === undefined || str === null || str.trim() === '') ? undefined : str;
}
getApiDefaultBoolData(value: boolean) {
return (value === undefined || value === null) ? false : value;
}
getApiDateString(dDate: Date) {
if (dDate === undefined || dDate === null) {
return dDate;

View File

@ -282,6 +282,9 @@
set
</button>
<kendo-grid-spacer></kendo-grid-spacer>
<label for="status" style="font-weight: bold;">Remarks</label>
<kendo-textbox placeholder="Remarks" [(ngModel)]="_remarks" style="width: 30%;"></kendo-textbox>
</ng-template>
<kendo-grid-column field="shiftID" title="Date" width="8%">
<ng-template kendoGridCellTemplate let-dataItem>

View File

@ -39,6 +39,7 @@ export class AttendanceManualEditForSingleEmployeeComponent implements OnInit {
selectedOutTime: Date;
dailyAttenProcessList: DailyAttnProcess[];
_overTime: number = 0;
_remarks: string = "";
statusList = [
{ value: 1, name: 'Present' },
{ value: 2, name: 'Absent' },
@ -223,6 +224,9 @@ export class AttendanceManualEditForSingleEmployeeComponent implements OnInit {
}
this.dailyAttenProcessList.forEach(x => {
if(this._remarks){
x.comments = this._remarks;
}
x.isManualEntry = true;
if (x.wfStatus != EnumWFAttnStatus.None) {
this.notificationService.showError(x.attnDate.toDateString() +" is in approval stage, so manual edit is not allowed");

View File

@ -207,7 +207,6 @@ export class AttendanceManualEditForMultipleEmployeeComponent implements OnInit
}
updateobject(type: number) {
debugger;
if (this.selectedRemarks != undefined) {
if (this.remarksList.find(y => y.value == this.selectedRemarks).name == "Other") {
this.isOtherRemarks = true;
@ -215,6 +214,13 @@ export class AttendanceManualEditForMultipleEmployeeComponent implements OnInit
this.isOtherRemarks = false;
}
}
else if (type == 3){
let oShift : Shift = this.shifts.find(x => x.id === this.selectedShiftID);
if(oShift && oShift.id > 0){
this.selectInTime = new Date(oShift.inTime);
this.selectedOutTime = new Date(oShift.outTime);
}
}
this.dailyAttenProcessList.forEach(x => {
if (type == 1) {
x.actualInTime = x.inTime;
@ -366,6 +372,12 @@ export class AttendanceManualEditForMultipleEmployeeComponent implements OnInit
}
var msg: string = "";
this.dailyAttenProcessList.forEach(x => {
if(this.selectedRemarks){
let remarks = this.remarksList.find(y => y.value == this.selectedRemarks);
if(remarks){
x.comments = remarks.name;
}
}
x.isManualEntry = true;
if (x.wfStatus != EnumWFAttnStatus.None) {
msg = msg + "Employee: " + x.employee.employeeNo + ". Datais in approval stage, so manual edit is not allowed; ";

View File

@ -11,7 +11,7 @@
</label>
</div>
<div *ngIf="!newEmployee" class="p-col-12 p-lg-4">
<app-employee-picker [isActive]="!newEmployee"
<app-employee-picker [isActive]="!newEmployee" [ForLifeCycleSearch]="true"
(ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker>
</div>
<div *ngIf="newEmployee" class="p-col-12 p-lg-4">

View File

@ -15,7 +15,7 @@
</div>
<div class="p-col-12 p-md-12 p-lg-6" style="margin:auto;">
<app-employee-picker for="chkIsnew" id="idself" [isActive]="!newEmployee"
[setSelectedEmp]="selectedEmployee"
[setSelectedEmp]="selectedEmployee" [ForLifeCycleSearch]="true"
(ItemSelected)="GetSelectedEmployee($event)"></app-employee-picker>
</div>
</div>

View File

@ -15,6 +15,7 @@
(ItemSelected)="GetSelectedEmployee($event)"
[setSelectedEmp]="_pickerSelecteEmp"
[isActive]="empPickerActive"
[ForLifeCycleSearch]="true"
></app-employee-picker>
</div>

View File

@ -102,10 +102,10 @@ export class EmployeePickerComponent implements OnInit {
isSpanArrowDown: boolean = true;
isSpanArrowUp: boolean = false;
gridHeight: number = 305;
@Input() public payrollTypeID: number;
@Input() public isRecruitment: number;
@Input() public set isClear(value) {
debugger;
if (value) {
this.selectedItems = [];
// this.count=0;
@ -187,6 +187,11 @@ export class EmployeePickerComponent implements OnInit {
/** role-permission-entry ctor */
@Input() fixedGrades: number[] = undefined;
private _isForLifeCycle = false;
@Input()
public set ForLifeCycleSearch(value: boolean) {
this._isForLifeCycle = value ?? false;
}
public pageSize = 25;
public skip = 0;
@ -454,10 +459,10 @@ export class EmployeePickerComponent implements OnInit {
} else {
name = value;
}
this.loadingEmployee = true;
// this.empSrvc.getEmpCodeName(code, name)
this.empSrvc.getEmpCodeNameForEmployeePickerInput(code, name)
.subscribe(
debugger;
if(this._isForLifeCycle === false){
this.loadingEmployee = true;
this.empSrvc.getEmpCodeNameForEmployeePickerInput(code, name).subscribe(
(resp: any) => {
this.searchEmployees = resp;
},
@ -470,14 +475,36 @@ export class EmployeePickerComponent implements OnInit {
this.loadingEmployee = false;
this.empCodeNameListSource = [];
this.searchEmployees.forEach(x => {
this.empCodeNameListSource.push(x.employeeNo + ' ' + x.name);
});
this.empCodeNameList = this.empCodeNameListSource.filter((s) =>
s.toLowerCase().indexOf(value.toLowerCase()) !== -1);
s.toLowerCase().indexOf(value.toLowerCase()) !== -1);
}
);
}
else{
this.loadingEmployee = true;
this.empSrvc.getEmpCodeNameForEmployeePickerInputNew(code, name, this._isForLifeCycle).subscribe(
(resp: any) => {
this.searchEmployees = resp;
},
(err: any) => {
// ON ERROR
this.loadingEmployee = false;
},
() => {
// ON Success
this.loadingEmployee = false;
this.empCodeNameListSource = [];
this.searchEmployees.forEach(x => {
this.empCodeNameListSource.push(x.employeeNo + ' ' + x.name);
});
this.empCodeNameList = this.empCodeNameListSource.filter((s) =>
s.toLowerCase().indexOf(value.toLowerCase()) !== -1);
}
);
}
/*} else {
this.empCodeNameList = this.empCodeNameListSource.filter((s) =>

View File

@ -822,7 +822,54 @@ namespace HRM.UI.Controllers
return Ok(olist);
}
[HttpGet("getEmployeeAttachments/{empId}")]
[HttpGet("getEmpCodeNameForEmployeePickerInputNew/{code}/{name}/{isForLifeCycle}")]
public ActionResult getEmpCodeNameForEmployeePickerInputNew(string code, string name, bool isForLifeCycle)
{
code = GlobalFunctions.GetApiDefaultData(code);
name = GlobalFunctions.GetApiDefaultData(name);
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
List<SearchEmployee> olist = new List<SearchEmployee>();
try
{
//olist = _serachManager.FindEmpCodeName((int) currentUser.PayrollTypeID, code, name);
if (code != "")
{
List<SearchEmployee> unorderedList = _serachManager.FindEmpCodeNameForEmployeePickerNew((int)currentUser.UserID, (int)currentUser.PayrollTypeID, code, name, isForLifeCycle);
olist = unorderedList
.OrderBy(item => item.EmployeeNo != code) // False (0) for priority value, True (1) for others
.ThenBy(item => item.EmployeeNo).ToList();
}
else
{
olist = _serachManager.FindEmpCodeNameForEmployeePickerNew((int)currentUser.UserID, (int)currentUser.PayrollTypeID, code, name, isForLifeCycle);
}
//List<Grade> grades = new GradeService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//List<Department> departments = new DepartmentService().Get(EnumStatus.Regardless, (int)currentUser.PayrollTypeID);
//olist.ForEach(x=>
//{
// var grd = grades.FirstOrDefault(d => d.ID == x.GradeID);
// if(grd != null) x.gradeName = grd.Name;
// var designation = designations.FirstOrDefault(d => d.ID == x.designationID);
// if (designation != null) x.designationName = designation.Name;
// var department = departments.FirstOrDefault(d => d.ID == x.DepartmentID);
// if (department != null) x.departmentName = department.Name;
//}); // Secondary ordering (alphabetical)
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
return Ok(olist);
}
[HttpGet("getEmployeeAttachments/{empId}")]
public ActionResult GetEmployeeAttachments(int empId)
{
List<empFileupload> items = new List<empFileupload>();