EchoTex_Payroll/HRM.UI/ClientApp/src/app/_models/Attendance/dailyAttnProcess.ts

122 lines
3.9 KiB
TypeScript
Raw Normal View History

2024-10-14 10:01:49 +06:00
import {Employee} from '../Employee/employee';
import {EnumAttendanceType, EnumClaimWFStatus, EnumLateAttendanceType, EnumWFAttnStatus, enumwfStatus, EnumWorkPlanDayType} from '../enums';
import {LeaveEntry} from '../Leave/leaveEntry';
import {MonthlyWorkPlan} from './monthlyWorkPlan';
import {Shift} from './shift';
import {BaseObject} from '../Basic/baseObject';
import { Data } from '@angular/router';
import { SearchEmployee } from '../Employee/searchEmployee';
export class DailyAttnProcess extends BaseObject {
constructor() {
super();
// this.lMApproveDate = new Date();
this.lineManagerID = null;
this.inTimeLatitude = undefined;
this.outTimeLatitude = undefined;
this.inTimeLongitude = undefined;
this.outTimeLongitude = undefined;
this.inTimeNearestAddress = '';
this.outTimeNearestAddress = '';
this.employeeID = null;
this.attnDate = new Date();
this.shiftID = null;
this.inTime = new Date();
this.outTime = new Date();
this.actualInTime = new Date();
this.actualOutTime = new Date();
this.workDayType = EnumWorkPlanDayType.WorkingDay;
this.attenType = EnumAttendanceType.Present;
this.comments = '';
this.reason = '';
this.otRemarks = '';
this.isManualEntry = true;
this.isFromMobile = false;
this.isLate = true;
this.lateHour = 0;
this.earlyHour = 0;
this.otHour = 0;
this.approvedOTHour = 0;
this.referenceID = undefined;
this.wfStatus = EnumWFAttnStatus.None;
this.workHour = 8;
this.lmApproveDate = null;
this.empApplyDate = null;
this.actualInTime = new Date();
this.actualOutTime = new Date();
this.actualShiftID = null;
this.shift= null;
}
attnDate: Date;
inTime: Date;
outTime: Date;
employeeID: number;
shiftID?: number;
workDayType: EnumWorkPlanDayType;
attenType: EnumAttendanceType;
isManualEntry: boolean;
isLate: boolean;
lateHour: number;
earlyHour: number;
otHour: number;
referenceID: number;
workHour: number;
actualInTime: Date;
actualOutTime: Date;
actualInOutTime : string;
actualShiftID: number;
reason: string;
isFromMobile: boolean;
inTimeLatitude: string;
outTimeLatitude: string;
inTimeLongitude: string;
outTimeLongitude: string;
inTimeNearestAddress: string;
outTimeNearestAddress: string;
comments: string;
empApplyDate?: Date;
empRemarks: string;
lmApproveDate?: Date;
lineManagerID?: number;
onbehalfEmpID?: number;
lmRemarks: string;
otRemarks: string;
approvedOTHour: number;
wfStatus: EnumWFAttnStatus;
employee: SearchEmployee;
shift: Shift;
remarksType: number;
public CalculateLateHour(attnProcess: DailyAttnProcess, oshift: Shift): number {
var totalLateMinute: number = 0;
if (attnProcess.inTime == undefined) return 0;
var attntemptime: Date = new Date(attnProcess.inTime);
var oshift: Shift;
if (attnProcess.shiftID == null) return totalLateMinute;
var shiftInTime: Date = new Date(oshift.inTime);
if (oshift != null && attnProcess.inTime != null) {
if (attntemptime.getHours() * 60 + attntemptime.getMinutes()
> shiftInTime.getHours() * 60 + shiftInTime.getMinutes() + oshift.flexibleHour) {
totalLateMinute = (attntemptime.getHours() * 60 + attntemptime.getMinutes()) -
(shiftInTime.getHours() * 60 + shiftInTime.getMinutes());
if (totalLateMinute < oshift.lateCalcualtion) {
totalLateMinute = 0;
}
}
}
if (totalLateMinute < 0) totalLateMinute = 0;
totalLateMinute = Math.floor((totalLateMinute / 60)) + (totalLateMinute % 60) / 100;
return totalLateMinute;
}
}