AttendanceProcess Modification

Task No- 20250320-0128
This commit is contained in:
mashfiq 2025-03-24 14:29:03 +06:00
parent 4b7e9c47b1
commit 9200c31f10
7 changed files with 97 additions and 21 deletions

View File

@ -223,7 +223,7 @@ namespace HRM.DA
id);
tc.ExecuteNonQuery("DELETE FROM SalaryMonthly WHERE SalaryProcessID=%n", id);
//}
tc.ExecuteNonQuery("DELETE FROM SalaryProcess WHERE SalaryProcessID=%n", id);
//tc.ExecuteNonQuery("DELETE FROM SalaryProcess WHERE SalaryProcessID=%n", id);
}
internal static void UndoMonthlySalaryByIDs(TransactionContext tc, string ids)

View File

@ -473,7 +473,7 @@ namespace HRM.DA
}
_attnRunSummary = new AttnProcessRunSummary();
_attnRunSummary.ProcessMode = prMode;
// bool isInOutApplicable = false;
//bool isInOutApplicable = false;
_shifts = _shifts ?? new ShiftService().GetAllShift();
@ -483,7 +483,7 @@ namespace HRM.DA
#region Initialization for Attendence Process
Attdate = fromDate;
// isInOutApplicable = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "attendence", "inoutapplicable");
//isInOutApplicable = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "attendence", "inoutapplicable");
List<DailyAttnProcess> dailyattProcesses = new List<DailyAttnProcess>();
List<DailyAttendanceAllowance> dailyAttendanceAllowances = new List<DailyAttendanceAllowance>();
@ -2597,7 +2597,11 @@ namespace HRM.DA
List<Shift> shifts =new ShiftService().GetAllShift();
List<WorkPlanGroup> workPlanGroups = new WorkPlanGroupService().GetAll();
if( employees == null) employees = new EmployeeService().GetAllLive();
//if( employees == null) employees = new EmployeeService().GetAllLive();
if( employees == null)
employees = new EmployeeService().Get(EnumEmployeeStatus.Live, payrolltypeid)
.OrderBy(num => num.EmployeeNo.Length).ThenBy(num => Convert.ToInt32(num.EmployeeNo)).ToList();
List<Employee> discontinueEmps =new EmployeeService().GetDiscontinueEmp(Attdate, DateTime.Now, payrolltypeid);
//List<AttnRawData> attRawdata = new AttnRawDataService().Get(startTime, ToTime, payrolltypeid);// get raw data by a date and order by date, employee, punchTime
@ -2636,7 +2640,6 @@ namespace HRM.DA
foreach (Employee emp in employees)
{
//EmpTempid = emp.ID.Integer;
#region EmployeeWise Setup

View File

@ -2960,9 +2960,9 @@ namespace HRM.DA
}
}
public DateTime GetLastProcessDateUsingPayrollType(int PayrolltypeID)
public DateTime? GetLastProcessDateUsingPayrollType(int PayrolltypeID)
{
DateTime lastProcessDate = DateTime.MinValue;
DateTime? lastProcessDate = null;
TransactionContext tc = null;
try
{
@ -2972,7 +2972,7 @@ namespace HRM.DA
{
lastProcessDate = oreader.GetDateTime("LastProcessDate").HasValue
? oreader.GetDateTime("LastProcessDate").Value
: DateTime.MinValue;
: null;
}
oreader.Close();

View File

@ -209,6 +209,10 @@ export class AttendanceServices {
// return this.apiService.httpGet<EmployeeWorkPlanSetup[]>('/Attendance' + '/getNotYetAssiged');
return this.apiService.httpGet<Employee[]>('/Attendance' + '/getNotYetAssiged');
}
getLastAttnProcessDate() {
// return this.apiService.httpGet<EmployeeWorkPlanSetup[]>('/Attendance' + '/getNotYetAssiged');
return this.apiService.httpGet<Date>('/Attendance' + '/getLastAttnProcessDate');
}
getEmployeeWorkPlanSetupByWPGroupID(groupId: number) {
return this.apiService.httpGet<EmployeeWorkPlanSetup[]>('/Attendance' + '/getEmployeeWorkPlanSetupByWPGroupID' + '/' + groupId);
}

View File

@ -2,7 +2,7 @@
<form>
<div class="card card-w-title">
<div class="p-grid form-group">
<div class="p-col-12 p-md-5">
<div class="p-col-12 p-md-4">
<div class="p-col-12">
<label for="processFromDate">Process From</label>
</div>
@ -17,7 +17,7 @@
</div>
</div>
<div class="p-col-12 p-md-5">
<div class="p-col-12 p-md-4">
<div class="p-col-12">
<label for="processToDate">Process To</label>
</div>
@ -33,12 +33,23 @@
</div>
<div class="p-col-12 p-md-2">
<div class="p-col-12">
<label for="chkIWithEmployee">Employee Wise</label>
</div>
<div class="p-col-12">
<input type="checkbox" (change)="checkBoxChange()" [checked]="withEmployee"
id="withEmployee" kendoCheckBox/>
</div>
</div>
<div class="p-col-12 p-md-2" *ngIf="withEmployee">
<div class="p-col-12">
<label for="employeePicker">Select Employee</label>
</div>
<div class="p-col-12">
<app-employee-picker
[MultiSelect]="true"
[isActive]="withEmployee"
(ItemSelected)="GetSelectedEmployee($event)"
></app-employee-picker>
</div>
@ -47,7 +58,11 @@
<div class="p-grid form-group">
<div class="p-col-12 p-md-5">
<div class="p-col-12">
<label for="txtWP">(Number of Employees not in Work Plan : {{ employees.length }})</label>
<!-- <label for="txtLE">(Number of Attendance Employees : {{ employees.length }})</label> -->
<label for="txtWP">Number of Employees not in Work Plan : {{ employees.length }}</label>
</div>
<div class="p-col-12" *ngIf="lastProcessDate != null">
<label style="color: red;" for="txtWP">Last Process date : {{ lastProcessDate != null ? (lastProcessDate | date: 'dd MMM yyyy') : '' }}</label>
</div>
<div class="p-col-12">
<button icon="rotate"

View File

@ -23,7 +23,9 @@ export class AttendanceProcessComponent {
selectedEmployees: SearchEmployee[] = [];
notYetAssingedList: EmployeeWorkPlanSetup[];
employees: any[] = [];
processStatus:string = "";
lastProcessDate: Date;
processStatus: string = "";
withEmployee: boolean = false;
constructor(public attnService: AttendanceServices, public datatransferservice: DataTransferService,
public loadingPanel: loadingPanelService,
public notificationService: HRMNotificationService,
@ -35,7 +37,7 @@ export class AttendanceProcessComponent {
}
ngOnInit() {
this.notYetAssingedList =[]
this.notYetAssingedList = []
this.fromDate = new Date();
this.toDate = new Date();
this.attnService.getNotYetAssiged().subscribe(
@ -46,7 +48,18 @@ export class AttendanceProcessComponent {
},
() => {
});
this.attnService.getLastAttnProcessDate().subscribe(
(resp) => {
if (resp != null) {
this.lastProcessDate = new Date(resp);
}
},
(x) => {
},
() => {
});
}
public GetSelectedEmployee(childData) {
this.selectedEmployees = childData;
@ -81,18 +94,25 @@ export class AttendanceProcessComponent {
attnRequest.push({ "fromDate": this.fromDate, "toDate": this.toDate, "isWithEmployee": true, "employeeID": 0 });
if (this.selectedEmployees != undefined && this.selectedEmployees.length > 0) {
attnRequest = [];
this.selectedEmployees.forEach(x => {
attnRequest.push({ "fromDate": this.fromDate, "toDate": this.toDate, "isWithEmployee": false, "employeeID": x.employeeID });
});
if (this.withEmployee) {
if (this.selectedEmployees != undefined && this.selectedEmployees.length > 0) {
attnRequest = [];
this.selectedEmployees.forEach(x => {
attnRequest.push({ "fromDate": this.fromDate, "toDate": this.toDate, "isWithEmployee": false, "employeeID": x.employeeID });
});
}
else {
this.notificationService.showWarning('Please Select Employee!');
return;
}
}
this.loadingPanel.ShowLoadingPanel = true;
this.attnService.dailyAttnProcessManual(attnRequest).subscribe(
(x) => {
},
(x) => {
this.loadingPanel.ShowLoadingPanel = false;
@ -106,4 +126,15 @@ export class AttendanceProcessComponent {
this.processStatus = "Attendance Process is completed successfully.";
});
}
public checkBoxChange() {
debugger
if (this.withEmployee) {
this.withEmployee = false;
this.selectedEmployees = [];
}
else
this.withEmployee = true;
}
}

View File

@ -12,6 +12,7 @@ using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlTypes;
using System.Linq;
using System.Threading;
using static iTextSharp.text.pdf.AcroFields;
@ -957,6 +958,22 @@ namespace HRM.UI.Controllers.Attendance
return Ok(items);
}
[HttpGet("getLastAttnProcessDate")]
public ActionResult getLastAttnProcessDate()
{
DateTime? date = new DateTime();
CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User);
try
{
date = new DailyAttnProcessService().GetLastProcessDateUsingPayrollType((int)currentUser.PayrollTypeID);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
return Ok(date);
}
[HttpGet("getEmployeeWorkPlanSetupByWPGroupID/{groupId}")]
public ActionResult GetEmployeeWorkPlanSetupByWPGroupID(int groupId)
@ -2618,6 +2635,12 @@ namespace HRM.UI.Controllers.Attendance
(int)currentUser.PayrollTypeID);
count++;
}
else
{
//employees = new EmployeeService().Get(EnumEmployeeStatus.Live, (int)currentUser.PayrollTypeID)
// .OrderBy(num => num.EmployeeNo.Length).ThenBy(num => Convert.ToInt32(num.EmployeeNo)).ToList();
//count++;
}
for (DateTime attDate = fromDate; attDate <= toDate; attDate = attDate.AddDays(1))
{