1508 lines
68 KiB
C#
1508 lines
68 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.Core;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region AttnWiseAllowance
|
|
|
|
[Serializable]
|
|
public class AttnWiseAllowance : BasicBaseObject
|
|
{
|
|
#region Constructor
|
|
|
|
public AttnWiseAllowance()
|
|
{
|
|
_shiftID = _provisionID = 0;
|
|
_shiftName = _ProvisionName = string.Empty;
|
|
_multiple = _fixedAmount = _percentOfBasic = 0;
|
|
_considerShiftHour = _hoursOverShift = false;
|
|
_payrollTypeID = 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region ShiftID : int
|
|
|
|
private int _shiftID;
|
|
|
|
public int ShiftID
|
|
{
|
|
get { return _shiftID; }
|
|
set { _shiftID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
//Not Saved In Database only get
|
|
|
|
#region ShiftName : string
|
|
|
|
private string _shiftName;
|
|
|
|
public string ShiftName
|
|
{
|
|
get { return _shiftName; }
|
|
set { _shiftName = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ProvisionID : int
|
|
|
|
private int _provisionID;
|
|
|
|
public int ProvisionID
|
|
{
|
|
get { return _provisionID; }
|
|
set { _provisionID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region payrollTypeID : ID
|
|
|
|
private int _payrollTypeID;
|
|
|
|
public int PayrollTypeID
|
|
{
|
|
get { return _payrollTypeID; }
|
|
set
|
|
{
|
|
//base.OnPropertyChange<ID>("payrollTypeID", _payrollTypeID, value);
|
|
_payrollTypeID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region TimeDependent : Bool
|
|
|
|
public bool TimeDependent { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region FromTime : DateTime
|
|
|
|
private DateTime _fromTime;
|
|
|
|
public DateTime FromTime
|
|
{
|
|
get { return _fromTime; }
|
|
set
|
|
{
|
|
//base.OnPropertyChange<DateTime>("fromTime", _fromTime, value);
|
|
_fromTime = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region WorkTime : Double
|
|
|
|
public double WorkTime { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region GraceTime : Double
|
|
|
|
public double GraceTime { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region ToTime : DateTime
|
|
|
|
private DateTime _toTime;
|
|
|
|
public DateTime ToTime
|
|
{
|
|
get { return _toTime; }
|
|
set
|
|
{
|
|
//base.OnPropertyChange<DateTime>("toTime", _toTime, value);
|
|
_toTime = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region OutTimeDependent : bool
|
|
public bool OutTimeDependent { get; set; }
|
|
#endregion
|
|
#region OutTime : DateTime
|
|
public DateTime OutTime { get; set; }
|
|
#endregion
|
|
//Not Saved In Database only get
|
|
|
|
#region ProvisionName : string
|
|
|
|
private string _ProvisionName;
|
|
|
|
public string ProvisionName
|
|
{
|
|
get { return _ProvisionName; }
|
|
set { _ProvisionName = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ProvisionType : EnumAttnWiseProvisionType
|
|
|
|
private enumPayrollComponentType _provisionType;
|
|
|
|
public enumPayrollComponentType ProvisionType
|
|
{
|
|
get { return _provisionType; }
|
|
set { _provisionType = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ConsiderShiftHour : bool
|
|
|
|
private bool _considerShiftHour;
|
|
|
|
public bool ConsiderShiftHour
|
|
{
|
|
get { return _considerShiftHour; }
|
|
set { _considerShiftHour = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ConsiderPresentHour : bool
|
|
|
|
private bool _considerPresentHour;
|
|
|
|
public bool ConsiderPresentHour
|
|
{
|
|
get { return _considerPresentHour; }
|
|
set { _considerPresentHour = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region HoursOverShift : bool
|
|
|
|
private bool _hoursOverShift;
|
|
|
|
public bool HoursOverShift
|
|
{
|
|
get { return _hoursOverShift; }
|
|
set { _hoursOverShift = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region OnLeave : bool
|
|
|
|
private bool _onLeave;
|
|
|
|
public bool OnLeave
|
|
{
|
|
get { return _onLeave; }
|
|
set { _onLeave = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region OnHoliday : bool
|
|
|
|
private bool _onHoliday;
|
|
|
|
public bool OnHoliday
|
|
{
|
|
get { return _onHoliday; }
|
|
set { _onHoliday = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ConsiderOutTime : bool
|
|
|
|
private bool _considerOutTime;
|
|
|
|
public bool ConsiderOutTime
|
|
{
|
|
get { return _considerOutTime; }
|
|
set { _considerOutTime = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Multiple : double
|
|
|
|
private double _multiple;
|
|
|
|
public double Multiple
|
|
{
|
|
get { return _multiple; }
|
|
set { _multiple = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region FixedAmount : double
|
|
|
|
private double _fixedAmount;
|
|
|
|
public double FixedAmount
|
|
{
|
|
get { return _fixedAmount; }
|
|
set { _fixedAmount = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PercentOfBasic : double
|
|
|
|
private double _percentOfBasic;
|
|
|
|
public double PercentOfBasic
|
|
{
|
|
get { return _percentOfBasic; }
|
|
set { _percentOfBasic = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
//#region Service Factory IAttnWiseAllowanceService : IAttnWiseAllowanceService
|
|
|
|
//internal static IAttnWiseAllowanceService Service
|
|
//{
|
|
// get { return Services.Factory.CreateService<IAttnWiseAllowanceService>(typeof(IAttnWiseAllowanceService)); }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
#endregion
|
|
|
|
//#region Functions
|
|
|
|
//public static AttnWiseAllowance Get(ID nID)
|
|
//{
|
|
// AttnWiseAllowance oAttnWiseAllowance = null;
|
|
// #region Cache Header
|
|
// oAttnWiseAllowance = (AttnWiseAllowance)_cache["Get", nID];
|
|
// if (oAttnWiseAllowance != null)
|
|
// return oAttnWiseAllowance;
|
|
// #endregion
|
|
// oAttnWiseAllowance = Service.Get(nID, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
// #region Cache Footer
|
|
// _cache.Add(oAttnWiseAllowance, "Get", nID);
|
|
// #endregion
|
|
// return oAttnWiseAllowance;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<AttnWiseAllowance> Get()
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// ObjectsTemplate<AttnWiseAllowance> oAttnWiseAllowances = _cache["Get"] as ObjectsTemplate<AttnWiseAllowance>;
|
|
// if (oAttnWiseAllowances != null)
|
|
// return oAttnWiseAllowances;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// oAttnWiseAllowances = Service.Get(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(oAttnWiseAllowances, "Get");
|
|
|
|
// #endregion
|
|
|
|
// return oAttnWiseAllowances;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<AttnWiseAllowance> Get(int shiftId, EnumAttendanceType attnType, bool value)
|
|
//{
|
|
// #region Cache Header
|
|
// ObjectsTemplate<AttnWiseAllowance> oAttnWiseAllowances = _cache["Get"] as ObjectsTemplate<AttnWiseAllowance>;
|
|
// if (oAttnWiseAllowances != null)
|
|
// return oAttnWiseAllowances;
|
|
// #endregion
|
|
// try
|
|
// {
|
|
// oAttnWiseAllowances = Service.Get(shiftId, attnType, value);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
// #region Cache Footer
|
|
// _cache.Add(oAttnWiseAllowances, "Get");
|
|
// #endregion
|
|
// return oAttnWiseAllowances;
|
|
//}
|
|
|
|
//public ID Save()
|
|
//{
|
|
// this.SetAuditTrailProperties();
|
|
// return Service.Save(this);
|
|
//}
|
|
|
|
//public void Delete()
|
|
//{
|
|
// Service.Delete(ID);
|
|
//}
|
|
|
|
|
|
//public static ObjectsTemplate<AttnWiseAllowance> GetApplicableItem(ObjectsTemplate<AttnWiseAllowance> attnSetups, DailyAttnProcess atProcess)
|
|
//{
|
|
// // if (atProcess.AttenType == EnumAttendanceType.Absent) return null;
|
|
// //if (atProcess.ShiftID == null) return null;
|
|
|
|
|
|
// ObjectsTemplate<AttnWiseAllowance> oattBens = new ObjectsTemplate<AttnWiseAllowance>();
|
|
|
|
// #region Add Besic Salary
|
|
// if (atProcess.WorkDayType == EnumWorkPlanDayType.WorkingDay)
|
|
// {
|
|
// AttnWiseAllowance oatb = new AttnWiseAllowance();
|
|
// oatb._provisionType = enumPayrollComponentType.Ordinary_Hour;
|
|
// oatb._shiftID = atProcess.ShiftID.Integer;
|
|
// oatb.ProvisionID = 1;
|
|
// oatb.ConsiderShiftHour = true;
|
|
// oattBens.Add(oatb);
|
|
// }
|
|
// #endregion
|
|
|
|
// #region Over Time
|
|
// if (atProcess.OTHour > 0)
|
|
// {
|
|
// AttnWiseAllowance oatbHortal = new AttnWiseAllowance();
|
|
// oatbHortal._provisionType = enumPayrollComponentType.Over_Time;
|
|
// oatbHortal._shiftID = atProcess.ShiftID.Integer;
|
|
// oatbHortal.HoursOverShift = true;
|
|
// oatbHortal.ProvisionID = OvertimeConstant.SHIFT_OVER_TIME;
|
|
// oattBens.Add(oatbHortal);
|
|
// }
|
|
|
|
// if (atProcess.AttenType == EnumAttendanceType.Present && atProcess.Holiday != null)
|
|
// {
|
|
|
|
// //if (atProcess.Holiday.HolidayType == HolidayType.Hartal)
|
|
// //{
|
|
// // AttnWiseAllowance oatbHortal = new AttnWiseAllowance();
|
|
// // oatbHortal._provisionType = enumPayrollComponentType.Over_Time;
|
|
// // oatbHortal._shiftID = atProcess.ShiftID.Integer;
|
|
// // oatbHortal.ConsiderShiftHour = true;
|
|
// // oatbHortal.ProvisionID = OvertimeConstant.HARTAL_OVER_TIME;
|
|
// // oattBens.Add(oatbHortal);
|
|
|
|
// // // Timely Hartal Attandance Bonus
|
|
|
|
// // if (atProcess.InTime != null && (atProcess.Holiday.ToTime - atProcess.InTime).Hours <= 2)
|
|
// // {
|
|
// // AttnWiseAllowance HartalAttn = new AttnWiseAllowance();
|
|
// // HartalAttn._provisionType = enumPayrollComponentType.Over_Time;
|
|
// // HartalAttn._shiftID = atProcess.ShiftID.Integer;
|
|
// // HartalAttn.ConsiderShiftHour = true;
|
|
// // HartalAttn.ProvisionID = OvertimeConstant.HARTAL_END_ATTANDANCE;
|
|
// // oattBens.Add(HartalAttn);
|
|
// // }
|
|
// //}
|
|
// //else
|
|
// //{
|
|
// AttnWiseAllowance oatbNHoliday = new AttnWiseAllowance();
|
|
// oatbNHoliday._provisionType = enumPayrollComponentType.Over_Time;
|
|
// oatbNHoliday._shiftID = atProcess.ShiftID.Integer;
|
|
// oatbNHoliday.ConsiderShiftHour = true;
|
|
// oatbNHoliday.ProvisionID = OvertimeConstant.NATIONAL_HOLIDAY_OVER_TIME;
|
|
// oattBens.Add(oatbNHoliday);
|
|
// //}
|
|
// }
|
|
// #endregion
|
|
|
|
|
|
// List<AttnWiseAllowance> shiftItems = attnSetups.FindAll((delegate (AttnWiseAllowance osetup)
|
|
// {
|
|
// return osetup.ProvisionType == enumPayrollComponentType.Allowance &&
|
|
// osetup.ShiftID == atProcess.ShiftID.Integer;
|
|
// }));
|
|
|
|
// foreach (AttnWiseAllowance item in shiftItems)
|
|
// {
|
|
// if (atProcess.AttenType == EnumAttendanceType.Present || atProcess.AttenType == EnumAttendanceType.Delay || atProcess.AttenType == EnumAttendanceType.Late || atProcess.AttenType == EnumAttendanceType.Early)
|
|
// {
|
|
// if (item.OnLeave == false && item.OnHoliday == false)
|
|
// {
|
|
// oattBens.Add(item);
|
|
// }
|
|
// }
|
|
|
|
// if (atProcess.AttenType == EnumAttendanceType.OutSideDuty && atProcess.WorkDayType == EnumWorkPlanDayType.WorkingDay)
|
|
// {
|
|
// if (item.OnLeave == false && item.OnHoliday == false)
|
|
// {
|
|
// oattBens.Add(item);
|
|
// }
|
|
// }
|
|
|
|
// if (atProcess.AttenType == EnumAttendanceType.Leave)
|
|
// {
|
|
// if (item.OnLeave == true)
|
|
// {
|
|
// oattBens.Add(item);
|
|
// }
|
|
// }
|
|
|
|
// if (atProcess.AttenType == EnumAttendanceType.Holiday)
|
|
// {
|
|
// if (item.OnHoliday == true)
|
|
// {
|
|
// oattBens.Add(item);
|
|
// }
|
|
// }
|
|
|
|
|
|
// // check Conveyance in first of leave
|
|
|
|
// //if (atProcess.Shift.ShortName.ToUpper() == "E" && atProcess.OutTime != null && ((DateTime)atProcess.OutTime).Date > atProcess.InTime.Date)
|
|
// //{
|
|
// // if (oattBens.Exists(x => x.ProvisionType == enumPayrollComponentType.Allowance && x.ProvisionID == 107) == false)
|
|
// // {
|
|
|
|
// // AttnWiseAllowance conv = new AttnWiseAllowance();
|
|
// // conv._provisionType = enumPayrollComponentType.Allowance;
|
|
// // conv._shiftID =5; // Night Shift
|
|
// // conv.Multiple = 1;
|
|
// // conv.ProvisionID = 107;
|
|
// // oattBens.Add(conv);
|
|
// // }
|
|
// //}
|
|
|
|
// if (atProcess.AttenType == EnumAttendanceType.Leave && atProcess.leaveEntry != null
|
|
// && (oattBens.Exists(x => x.ProvisionType == enumPayrollComponentType.Allowance && x.ProvisionID == 82) == false))
|
|
// {
|
|
// if (atProcess.leaveEntry.AppliedLeaveDate == atProcess.AttnDate)
|
|
// {
|
|
// AttnWiseAllowance conv = new AttnWiseAllowance();
|
|
// conv._provisionType = enumPayrollComponentType.Allowance;
|
|
// conv._shiftID = atProcess.ShiftID.Integer;
|
|
// conv.Multiple = 1;
|
|
// conv.ProvisionID = 82;
|
|
// oattBens.Add(conv);
|
|
// }
|
|
// }
|
|
|
|
// //AttnWiseAllowance setupItem = new AttnWiseAllowance();
|
|
// //switch (atProcess.AttenType)
|
|
// //{
|
|
// // case EnumAttendanceType.OutSideDuty:
|
|
// // case EnumAttendanceType.Present:
|
|
// // case EnumAttendanceType.Delay:
|
|
// // case EnumAttendanceType.Late:
|
|
// // case EnumAttendanceType.Early:
|
|
// // setupItem = shiftItems.FirstOrDefault((delegate(AttnWiseAllowance osetup) { return osetup.OnLeave == false && osetup.OnHoliday == false; }));
|
|
// // if(setupItem!=null)oattBens.Add(setupItem);
|
|
// // break;
|
|
// // case EnumAttendanceType.Leave:
|
|
// // setupItem = shiftItems.FirstOrDefault((delegate(AttnWiseAllowance osetup) { return osetup.OnLeave == true; }));
|
|
// // if(setupItem!=null)oattBens.Add(setupItem);
|
|
// // break;
|
|
|
|
// // case EnumAttendanceType.Holiday:
|
|
// // case EnumAttendanceType.WeeklyHoliday:
|
|
// // setupItem = shiftItems.FirstOrDefault((delegate(AttnWiseAllowance osetup) { return osetup.OnHoliday == true; }));
|
|
// // if(setupItem!=null)oattBens.Add(setupItem);
|
|
// // break;
|
|
// // default:
|
|
// // break;
|
|
// //}
|
|
|
|
|
|
// }
|
|
|
|
// return oattBens;
|
|
//}
|
|
|
|
|
|
//public static ObjectsTemplate<AttnWiseAllowance> GetAllApplicableItem(ObjectsTemplate<AttnWiseAllowance> attnSetups, DailyAttnProcess atProcess, AttnNationalHoliday anHoliday, ObjectsTemplate<Leave> oLeaves, bool isWorkingDay)
|
|
//{
|
|
// ObjectsTemplate<AttnWiseAllowance> oattBens = new ObjectsTemplate<AttnWiseAllowance>();
|
|
|
|
// #region Unusede Commented Code block 1
|
|
// //AttnWiseAllowance normalOT = null;
|
|
// //AttnWiseAllowance HartallOT = null;
|
|
// //AttnWiseAllowance festivalOT = null;
|
|
// //AttnWiseAllowance dayOffOT = null;
|
|
|
|
// //#region Add Besic Salary
|
|
// //if (anHoliday == null)
|
|
// //{
|
|
// // AttnWiseAllowance oatb = new AttnWiseAllowance();
|
|
// // //if (atProcess.OTHour > 0)
|
|
// // //{
|
|
// // // normalOT = new AttnWiseAllowance();
|
|
// // // normalOT._provisionType = enumPayrollComponentType.Over_Time;
|
|
// // // normalOT._shiftID = atProcess.ShiftID.Integer;
|
|
// // // normalOT.HoursOverShift = true;
|
|
// // // normalOT.ProvisionID = OvertimeConstant.SHIFT_OVER_TIME;
|
|
// // // oattBens.Add(normalOT);
|
|
// // //}
|
|
// // if (atProcess.WorkDayType == EnumWorkPlanDayType.WorkingDay)
|
|
// // {
|
|
// // oatb.ProvisionType = enumPayrollComponentType.Ordinary_Hour;
|
|
// // oatb.ShiftID = atProcess.ShiftID.Integer;
|
|
// // oatb.ProvisionID = 1;
|
|
// // oatb.ConsiderShiftHour = true;
|
|
// // oattBens.Add(oatb);
|
|
// // }
|
|
// // //if (atProcess.WorkDayType == EnumWorkPlanDayType.WeeklyHoliday)
|
|
// // //{
|
|
// // // dayOffOT = new AttnWiseAllowance();
|
|
// // // dayOffOT._provisionType = enumPayrollComponentType.Over_Time;
|
|
// // // dayOffOT._shiftID = atProcess.ShiftID.Integer;
|
|
// // // dayOffOT.ConsiderShiftHour = true;
|
|
// // // dayOffOT.ProvisionID = OvertimeConstant.HARTAL_END_ATTANDANCE; //DAY_OFF_OVERTIME
|
|
// // // oattBens.Add(dayOffOT);
|
|
// // //}
|
|
// //}
|
|
// //#endregion
|
|
|
|
// //#region Over Time
|
|
|
|
// //if (anHoliday != null && (atProcess.AttenType == EnumAttendanceType.Present || atProcess.AttenType == EnumAttendanceType.Leave))
|
|
// //{
|
|
// // //if (atProcess.OTHour > 0)
|
|
// // //{
|
|
// // // normalOT = new AttnWiseAllowance();
|
|
// // // normalOT.ProvisionType = enumPayrollComponentType.Over_Time;
|
|
// // // normalOT.ShiftID = atProcess.ShiftID.Integer;
|
|
// // // normalOT.HoursOverShift = true;
|
|
// // // normalOT.ProvisionID = OvertimeConstant.SHIFT_OVER_TIME;
|
|
// // // oattBens.Add(normalOT);
|
|
// // //}
|
|
// // if (anHoliday.HolidayType == HolidayType.Hartal || anHoliday.HolidayType == HolidayType.Other)
|
|
// // {
|
|
// // //if (anHoliday.HolidayType == HolidayType.Hartal)
|
|
// // //{
|
|
// // // HartallOT = new AttnWiseAllowance();
|
|
// // // HartallOT.ProvisionType = enumPayrollComponentType.Over_Time;
|
|
// // // HartallOT.ShiftID = atProcess.ShiftID.Integer;
|
|
// // // HartallOT.ConsiderShiftHour = true;
|
|
// // // HartallOT.ProvisionID = OvertimeConstant.HARTAL_OVER_TIME;
|
|
// // // oattBens.Add(HartallOT);
|
|
// // //}
|
|
// // if (atProcess.WorkDayType == EnumWorkPlanDayType.WorkingDay)
|
|
// // {
|
|
// // AttnWiseAllowance oatb = new AttnWiseAllowance();
|
|
// // oatb.ProvisionType = enumPayrollComponentType.Ordinary_Hour;
|
|
// // oatb.ShiftID = atProcess.ShiftID.Integer;
|
|
// // oatb.ProvisionID = 1;
|
|
// // oatb.ConsiderShiftHour = true;
|
|
// // oattBens.Add(oatb);
|
|
// // }
|
|
// // }
|
|
// // else
|
|
// // {
|
|
// // //festivalOT = new AttnWiseAllowance();
|
|
// // //festivalOT._provisionType = enumPayrollComponentType.Over_Time;
|
|
// // //festivalOT._shiftID = atProcess.ShiftID.Integer;
|
|
// // //festivalOT.ConsiderShiftHour = true;
|
|
// // //festivalOT.ProvisionID = OvertimeConstant.NATIONAL_HOLIDAY_OVER_TIME;
|
|
// // //oattBens.Add(festivalOT);
|
|
// // }
|
|
// //}
|
|
// //#endregion
|
|
|
|
// #endregion
|
|
|
|
// foreach (var attnSetup in attnSetups)
|
|
// {
|
|
// if (attnSetup.FromTime != DateTime.MinValue)
|
|
// {
|
|
// attnSetup.FromTime = atProcess.AttnDate.Date.Add(attnSetup.FromTime.TimeOfDay);
|
|
// }
|
|
// }
|
|
|
|
// List<AttnWiseAllowance> attnWiseAllowances = GetAttnWiseAllowances(attnSetups, atProcess, atProcess.ShiftID.Integer);
|
|
|
|
// if (atProcess.HasDualShift && atProcess.SecondaryShift != null)
|
|
// {
|
|
// attnWiseAllowances = GetAttnWiseAllowances(attnSetups, atProcess, atProcess.SecondaryShift.ID.Integer);
|
|
// }
|
|
|
|
// #region Unusede Code block 2
|
|
// //if (anHoliday == null && atProcess.AttenType == EnumAttendanceType.OutSideDuty)
|
|
// //{
|
|
// // oattBens.AddRange(attnWiseAllowances);
|
|
// //}
|
|
// //####
|
|
// //if (anHoliday != null && anHoliday.HolidayType == HolidayType.Hartal && atProcess.AttenType == EnumAttendanceType.OutSideDuty)
|
|
// //{
|
|
// // oattBens.AddRange(shiftItems);
|
|
// //}
|
|
// #endregion
|
|
|
|
// #region Unusede Code block 3
|
|
|
|
// //if (atProcess.AttenType == EnumAttendanceType.Leave)
|
|
// //{
|
|
// // attnWiseAllowances = attnWiseAllowances.Where(o => o.OnLeave == true && (o.TimeDependent ? (o.FromTime.TimeOfDay >= InTime.TimeOfDay && o.FromTime.TimeOfDay <= OutTime.TimeOfDay) : true)).ToObjectsTemplate();
|
|
|
|
|
|
// // //if (atProcess.leaveEntry != null)
|
|
// // //{
|
|
// // // Leave leave = oLeaves.Where(o => o.ID == atProcess.leaveEntry.LeaveID).FirstOrDefault();
|
|
// // // if (leave != null)
|
|
// // // {
|
|
// // // //if (atProcess.leaveEntry.LeaveID == ID.FromInteger(4) || atProcess.leaveEntry.LeaveID == ID.FromInteger(21))
|
|
// // // if (leave.Code == "DL" || leave.Code == "ZL")
|
|
// // // {
|
|
// // // //Need to Discuss With Chapal Vai.
|
|
// // // oattBens.RemoveAll(o => o.ProvisionType != enumPayrollComponentType.Ordinary_Hour);
|
|
// // // attnWiseAllowances = new List<AttnWiseAllowance>();
|
|
// // // return oattBens;
|
|
// // // }
|
|
// // // else if (leave.Code == "RL")
|
|
// // // {
|
|
// // // if (atProcess.leaveEntry.AppliedLeaveDate.Date == atProcess.AttnDate)
|
|
// // // {
|
|
// // // AttnWiseAllowance conv = new AttnWiseAllowance();
|
|
// // // conv._provisionType = enumPayrollComponentType.Allowance;
|
|
// // // conv.ProvisionName = "Conveyance Allowance";
|
|
// // // conv._shiftID = atProcess.ShiftID.Integer;
|
|
// // // conv.Multiple = 1;
|
|
// // // conv.ProvisionID = 82;
|
|
// // // oattBens.Add(conv);
|
|
// // // oattBens.AddRange(attnWiseAllowances);
|
|
// // // }
|
|
// // // return oattBens;
|
|
// // // }
|
|
// // // else
|
|
// // // {
|
|
// // // if (atProcess.leaveEntry.AppliedLeaveDate.Date == atProcess.AttnDate)
|
|
// // // {
|
|
// // // AttnWiseAllowance conv = new AttnWiseAllowance();
|
|
// // // conv._provisionType = enumPayrollComponentType.Allowance;
|
|
// // // conv.ProvisionName = "Conveyance Allowance";
|
|
// // // conv._shiftID = atProcess.ShiftID.Integer;
|
|
// // // conv.Multiple = 1;
|
|
// // // conv.ProvisionID = 82;
|
|
// // // oattBens.Add(conv);
|
|
// // // oattBens.AddRange(attnWiseAllowances);
|
|
// // // }
|
|
// // // }
|
|
// // // }
|
|
// // //}
|
|
|
|
// //}
|
|
// #endregion
|
|
|
|
// #region Unusede Code block 4
|
|
|
|
// //if (anHoliday != null && anHoliday.HolidayType != HolidayType.Hartal && anHoliday.HolidayType != HolidayType.Other
|
|
// // && (atProcess.AttenType == EnumAttendanceType.Present || atProcess.AttenType == EnumAttendanceType.Holiday || atProcess.AttenType == EnumAttendanceType.OutSideDuty) && atProcess.InTime != DateTime.MinValue && atProcess.OutTime != DateTime.MinValue)
|
|
// //{
|
|
// // shiftItems = shiftItems.Where(o => o.OnHoliday == true).ToObjectsTemplate();
|
|
// // oattBens.AddRange(shiftItems);
|
|
// //}
|
|
|
|
// //if (anHoliday != null && (anHoliday.HolidayType == HolidayType.Hartal || anHoliday.HolidayType == HolidayType.Other) && atProcess.AttenType == EnumAttendanceType.Present && atProcess.InTime != DateTime.MinValue && atProcess.OutTime != DateTime.MinValue)
|
|
// //{
|
|
// // shiftItems = shiftItems.Where(o => o.OnHoliday == true).ToObjectsTemplate();
|
|
// // oattBens.AddRange(shiftItems);
|
|
// //}
|
|
|
|
// //if (anHoliday == null && (atProcess.WorkDayType == EnumWorkPlanDayType.WorkingDay || atProcess.WorkDayType == EnumWorkPlanDayType.WeeklyHoliday) && atProcess.InTime != DateTime.MinValue && atProcess.OutTime != DateTime.MinValue)
|
|
// //{
|
|
// // oattBens.AddRange(shiftItems);
|
|
// //}
|
|
// #endregion
|
|
|
|
// if (atProcess.InTime != DateTime.MinValue && atProcess.OutTime != DateTime.MinValue)
|
|
// {
|
|
// oattBens.AddRange(attnWiseAllowances);
|
|
// }
|
|
// return oattBens;
|
|
//}
|
|
|
|
//private static List<AttnWiseAllowance> GetAttnWiseAllowances(ObjectsTemplate<AttnWiseAllowance> attnSetups, DailyAttnProcess atProcess, int shiftID)
|
|
//{
|
|
// DateTime InTime = atProcess.InTime;
|
|
// DateTime OutTime = atProcess.OutTime2 != DateTime.MinValue ?
|
|
// atProcess.OutTime2 :
|
|
// atProcess.OutTime != DateTime.MinValue ?
|
|
// atProcess.OutTime : DateTime.MinValue;
|
|
|
|
// //List<AttnWiseAllowance> attnWiseAllowances = attnSetups.
|
|
// // Where(osetup => osetup.ShiftID == shiftID &&
|
|
// // (osetup.ProvisionType == enumPayrollComponentType.Allowance || osetup.ProvisionType == enumPayrollComponentType.Over_Time) &&
|
|
// // (osetup.TimeDependent ? (osetup.FromTime >= InTime && osetup.FromTime <= OutTime) : true)).
|
|
// // ToList();
|
|
|
|
// List<AttnWiseAllowance> attnWiseAllowances = attnSetups.Where(osetup => osetup.ShiftID == shiftID &&
|
|
// (osetup.ProvisionType == enumPayrollComponentType.Allowance || osetup.ProvisionType == enumPayrollComponentType.Over_Time) &&
|
|
// (osetup.TimeDependent ? (atProcess.OTHour + (osetup.GraceTime / 60.0) >= osetup.WorkTime) : true)).
|
|
// ToList();
|
|
|
|
|
|
// if (atProcess.WorkDayType == EnumWorkPlanDayType.WorkingDay)
|
|
// {
|
|
// // Take general allowances
|
|
// // Take holiday allowance if next day is holiday and out time is in next day
|
|
// attnWiseAllowances = attnWiseAllowances.Where(x => !x.OnHoliday ||
|
|
// ((atProcess.NextWorkDayType == EnumWorkPlanDayType.WeeklyHoliday || atProcess.NextWorkDayType == EnumWorkPlanDayType.NationalHoliday) &&
|
|
// x.OnHoliday && x.ConsiderOutTime && OutTime.Date > atProcess.AttnDate)).ToObjectsTemplate();
|
|
// }
|
|
// else if (atProcess.WorkDayType == EnumWorkPlanDayType.WeeklyHoliday || atProcess.WorkDayType == EnumWorkPlanDayType.NationalHoliday)
|
|
// {
|
|
// // Take general allowances
|
|
// // Tske holiday allowances which does not consider out time
|
|
// // Take holiday allowance if next day is holiday and out time is in next day
|
|
// attnWiseAllowances = attnWiseAllowances.
|
|
// Where(x => !x.OnHoliday ||
|
|
// (x.OnHoliday && !x.ConsiderOutTime) ||
|
|
// ((atProcess.NextWorkDayType == EnumWorkPlanDayType.WeeklyHoliday || atProcess.NextWorkDayType == EnumWorkPlanDayType.NationalHoliday) &&
|
|
// x.OnHoliday && x.ConsiderOutTime && OutTime.Date > atProcess.AttnDate)).ToObjectsTemplate();
|
|
// }
|
|
|
|
// // If there is one or more time dependent allowance
|
|
// if (attnWiseAllowances.Where(x => x.TimeDependent).Count() > 1)
|
|
// {
|
|
// //DateTime maxFromTime = attnWiseAllowances.Where(x => x.TimeDependent).Max(x => x.FromTime);
|
|
// double workTime = attnWiseAllowances.Where(x => x.TimeDependent).Max(x => x.WorkTime);
|
|
|
|
// // Take all not time dependent allowances
|
|
// // Take only the maximum time dependent allowance
|
|
// //attnWiseAllowances = attnWiseAllowances.Where(x => !x.TimeDependent ||
|
|
// // x.FromTime == maxFromTime)
|
|
// // .ToList();
|
|
// attnWiseAllowances = attnWiseAllowances.Where(x => !x.TimeDependent ||
|
|
// x.WorkTime == workTime)
|
|
// .ToList();
|
|
// }
|
|
|
|
// return attnWiseAllowances;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<AttnWiseAllowance> GetApplicableItem(ObjectsTemplate<AttnWiseAllowance> attnSetups, BadliDailyRecruit badliDailyRecruit)
|
|
//{
|
|
// ObjectsTemplate<AttnWiseAllowance> oattBens = new ObjectsTemplate<AttnWiseAllowance>();
|
|
// List<AttnWiseAllowance> applicableShiftItems = new List<AttnWiseAllowance>();
|
|
// //#region Add Besic Salary
|
|
// //AttnWiseAllowance oatb = attnSetups.FirstOrDefault(o => o.ProvisionType == enumPayrollComponentType.Badli_Shift_Allowance);
|
|
// //if (oatb != null)
|
|
// //{
|
|
// // oatb._shiftID = badliDailyRecruit.ShiftID.Integer;
|
|
// // oatb.ProvisionID = 1;
|
|
// // oatb.ProvisionName = "Badli Shift Allowance";
|
|
// // oatb.ConsiderShiftHour = true;
|
|
// // oattBens.Add(oatb);
|
|
// //}
|
|
// //#endregion
|
|
// List<AttnWiseAllowance> shiftItems = attnSetups.Where(o => o.ShiftID == badliDailyRecruit.ShiftID.Integer).ToList();
|
|
|
|
// if (badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.WorkingDay || badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.WeeklyHoliday)
|
|
// {
|
|
// applicableShiftItems = shiftItems.Where(o => o.OnLeave == false && o.OnHoliday == false).ToObjectsTemplate();
|
|
// oattBens.AddRange(applicableShiftItems);
|
|
// }
|
|
// if (badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.NationalHoliday)
|
|
// {
|
|
// applicableShiftItems = shiftItems.Where(o => o.OnLeave == false && o.OnHoliday == false).ToObjectsTemplate();
|
|
// oattBens.AddRange(applicableShiftItems);
|
|
// applicableShiftItems = shiftItems.Where(o => o.OnHoliday == true).ToObjectsTemplate();
|
|
// oattBens.AddRange(applicableShiftItems);
|
|
// }
|
|
// if (badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.HartalDay)
|
|
// {
|
|
// applicableShiftItems = shiftItems.Where(o => o.OnLeave == false && o.OnHoliday == false).ToObjectsTemplate();
|
|
// oattBens.AddRange(applicableShiftItems);
|
|
// applicableShiftItems = shiftItems.Where(o => o.OnLeave == true).ToObjectsTemplate();
|
|
// oattBens.AddRange(applicableShiftItems);
|
|
// }
|
|
|
|
// //foreach (AttnWiseAllowance item in shiftItems)
|
|
// //{
|
|
// // if (badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.WorkingDay || badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.WeeklyHoliday)
|
|
// // {
|
|
// // if (item.OnLeave == false && item.OnHoliday == false)
|
|
// // {
|
|
// // oattBens.Add(item);
|
|
// // }
|
|
// // }
|
|
// // if (badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.NationalHoliday)
|
|
// // {
|
|
// // if (item.OnLeave == false && item.OnHoliday == true)
|
|
// // {
|
|
// // oattBens.Add(item);
|
|
// // }
|
|
// // }
|
|
// // if (badliDailyRecruit.WorkDayType == EnumWorkPlanDayType.HartalDay)
|
|
// // {
|
|
// // if (item.OnLeave == true && item.OnHoliday == false)
|
|
// // {
|
|
// // oattBens.Add(item);
|
|
// // }
|
|
// // }
|
|
// //}
|
|
// return oattBens;
|
|
//}
|
|
|
|
//public double GetCalculatedHour(DailyAttnProcess attProcess, Shift sft, ObjectsTemplate<Leave> oLeaves)
|
|
//{
|
|
// double amount = 0;
|
|
// double frac = 0;
|
|
// int grace = 0;
|
|
// bool graceIsUsed = false;
|
|
// if (this.ConsiderShiftHour)
|
|
// {
|
|
// if (this.ProvisionType == enumPayrollComponentType.Ordinary_Hour)
|
|
// {
|
|
// amount = 0;
|
|
// if (attProcess.AttenType == EnumAttendanceType.Absent)
|
|
// amount = 8; // No Need In-Out Time
|
|
// else if (attProcess.AttenType == EnumAttendanceType.Leave)
|
|
// {
|
|
// if (attProcess.leaveEntry != null)
|
|
// {
|
|
// Leave leave = oLeaves.Where(o => o.ID == attProcess.leaveEntry.LeaveID).FirstOrDefault();
|
|
// if (leave != null)
|
|
// {
|
|
// if (leave.Code == "DL")
|
|
// amount = 8;
|
|
// else if (leave.Code == "ZL") //'Z Leave'
|
|
// amount = 8;
|
|
// else
|
|
// amount = 0;// No Need In-Out Time
|
|
// }
|
|
// }
|
|
// else
|
|
// amount = 0;
|
|
// }
|
|
// else if (attProcess.AttenType == EnumAttendanceType.OutSideDuty)
|
|
// amount = 0; // No Need In-Out Time
|
|
// else if (attProcess.ReferenceID != null && attProcess.AttenType == EnumAttendanceType.Present) // Present but have a hourly leave
|
|
// amount = 0; // No Need In-Out Time
|
|
// else if (attProcess.AttenType == EnumAttendanceType.Present && attProcess.InTime == DateTime.MinValue || attProcess.OutTime == DateTime.MinValue)
|
|
// amount = 8;
|
|
// else if (attProcess.AttenType == EnumAttendanceType.Present && attProcess.EarlyHour > 0 && attProcess.InTime != DateTime.MinValue && attProcess.OutTime != DateTime.MinValue)
|
|
// {
|
|
// ////frac = ((Math.Round(attProcess.EarlyHour, 2) - Math.Floor(attProcess.EarlyHour)));
|
|
// ////amount = Math.Floor(attProcess.EarlyHour) + ((frac < .5) ? (double)0 : (double)1);
|
|
// //amount = 0;
|
|
// //double fac = ((Math.Round(attProcess.EarlyHour, 2) - Math.Floor(attProcess.EarlyHour)));
|
|
// ////amount = 8 - Math.Floor(attProcess.EarlyHour) + ((fac < .5) ? (double)0 : (double)1);
|
|
// //amount = Math.Floor(attProcess.EarlyHour) + ((fac < .5) ? (double)0 : (double).5);
|
|
// //if (amount < 0 || amount>7.9) amount = 0;
|
|
// amount = 0;
|
|
|
|
// DateTime shiftInTime = sft.InTime;
|
|
// DateTime shiftOutTime = sft.OutTime;
|
|
|
|
// DateTime attnInTime = attProcess.InTime;
|
|
// DateTime attnOutTime = attProcess.OutTime;
|
|
// TimeSpan intimeSpan;
|
|
// TimeSpan outTimeSpan;
|
|
// TimeSpan workingHourSpan;
|
|
|
|
// if (attnInTime.TimeOfDay > shiftInTime.TimeOfDay)
|
|
// {
|
|
// intimeSpan = attnInTime.TimeOfDay;
|
|
// }
|
|
// else
|
|
// intimeSpan = shiftInTime.TimeOfDay;
|
|
|
|
// if (attnOutTime.TimeOfDay < shiftOutTime.TimeOfDay)
|
|
// {
|
|
// outTimeSpan = attnOutTime.TimeOfDay;
|
|
// }
|
|
// else
|
|
// outTimeSpan = shiftOutTime.TimeOfDay;
|
|
// workingHourSpan = outTimeSpan - intimeSpan;
|
|
// double workingHour = workingHourSpan.TotalHours;
|
|
// if (workingHour < 0)
|
|
// {
|
|
// workingHour = (24 + workingHour);
|
|
// if (workingHour > 8)
|
|
// workingHour = 8;
|
|
// else
|
|
// {
|
|
// frac = ((Math.Round(workingHour, 2) - Math.Floor(workingHour)));
|
|
// workingHour = Math.Floor(workingHour) + ((frac < .5) ? (double).5 : (double)1);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// if (workingHour >= 8)
|
|
// workingHour = 8;
|
|
// else
|
|
// {
|
|
// frac = ((Math.Round(workingHour, 2) - Math.Floor(workingHour)));
|
|
// workingHour = Math.Floor(workingHour) + ((frac < .5) ? (double).5 : (double)1);
|
|
// }
|
|
// }
|
|
// if (sft.ShortName == "F") //General Shift HO-Thursday (Total Working Hour=7)
|
|
// {
|
|
// if (workingHour >= 7)
|
|
// {
|
|
// workingHour = 7;
|
|
// amount = 7 - workingHour;
|
|
// }
|
|
// if (workingHour < 7)
|
|
// {
|
|
// amount = 7 - workingHour;
|
|
// }
|
|
// }
|
|
// else if (sft.ShortName == "G") //Common Shift-3 Thursday (Total Working Hour=4)
|
|
// {
|
|
// if (workingHour >= 4)
|
|
// {
|
|
// workingHour = 4;
|
|
// amount = 4 - workingHour;
|
|
// }
|
|
// if (workingHour < 4)
|
|
// {
|
|
// amount = 4 - workingHour;
|
|
// }
|
|
|
|
// }
|
|
// else
|
|
// amount = 8 - workingHour;
|
|
// if (attProcess.Holiday != null)
|
|
// amount = 0;
|
|
// #region start
|
|
// //DateTime shiftInTime = sft.InTime;
|
|
// //DateTime shiftOutTime = sft.OutTime;
|
|
|
|
// //DateTime attnInTime = attProcess.InTime;
|
|
// //DateTime attnOutTime = attProcess.OutTime;
|
|
// //TimeSpan intimeSpan;
|
|
// //TimeSpan outTimeSpan;
|
|
// //TimeSpan intimeSpanTemp;
|
|
// //TimeSpan outTimeSpanTemp;
|
|
// //TimeSpan workingHourSpan;
|
|
|
|
// //if (attnInTime.TimeOfDay > shiftInTime.TimeOfDay)
|
|
// //{
|
|
// // intimeSpan = attnInTime.TimeOfDay;
|
|
// // intimeSpanTemp = attnInTime.TimeOfDay;
|
|
// // graceIsUsed = true;
|
|
// // if (intimeSpan.Minutes < grace && intimeSpan.Minutes != 0)
|
|
// // intimeSpanTemp = new TimeSpan(intimeSpan.Hours, 0, intimeSpan.Seconds);
|
|
// // if (intimeSpan.Minutes >= grace)
|
|
// // intimeSpanTemp = new TimeSpan(intimeSpan.Hours, 30, intimeSpan.Seconds);
|
|
// // if (intimeSpan.Minutes == 0)
|
|
// // intimeSpanTemp = new TimeSpan(intimeSpan.Hours - 1, 30, intimeSpan.Seconds);
|
|
// //}
|
|
// //else
|
|
// // intimeSpanTemp = shiftInTime.TimeOfDay;
|
|
|
|
// //if (attnOutTime.TimeOfDay < shiftOutTime.TimeOfDay)
|
|
// //{
|
|
// // outTimeSpan = attnOutTime.TimeOfDay;
|
|
// // outTimeSpanTemp = attnOutTime.TimeOfDay;
|
|
// // if (graceIsUsed == false)
|
|
// // {
|
|
// // if (outTimeSpan.Minutes != 0)
|
|
// // {
|
|
// // if (outTimeSpan.Minutes < grace)
|
|
// // outTimeSpanTemp = new TimeSpan(outTimeSpan.Hours, 30, outTimeSpan.Seconds);
|
|
// // if (outTimeSpan.Minutes > grace)
|
|
// // outTimeSpanTemp = new TimeSpan(outTimeSpan.Hours + 1, 0, outTimeSpan.Seconds);
|
|
// // }
|
|
// // }
|
|
// //}
|
|
// //else
|
|
// // outTimeSpanTemp = shiftOutTime.TimeOfDay;
|
|
|
|
// //workingHourSpan = outTimeSpanTemp - intimeSpanTemp;
|
|
// //double workingHour = workingHourSpan.TotalHours;
|
|
// //if (workingHourSpan.Minutes >= 30 && workingHour > 0)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours, 30, workingHourSpan.Seconds);
|
|
// //if (workingHourSpan.Minutes != 0)
|
|
// //{
|
|
// // if (workingHourSpan.Minutes < 30 && workingHour > 0)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours, 0, workingHourSpan.Seconds);
|
|
// //}
|
|
// //workingHour = workingHourSpan.TotalHours;
|
|
// //if (workingHour < 0)
|
|
// //{
|
|
// // double value = workingHour;
|
|
// // double decPart = value - Math.Truncate(workingHour);
|
|
// // if (decPart != 0 && workingHourSpan.Minutes >= -30)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours - 1, 30, workingHourSpan.Seconds);
|
|
// // else if (decPart != 0)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours - 1, 0, workingHourSpan.Seconds);
|
|
// // workingHour = workingHourSpan.TotalHours;
|
|
// // workingHour = 24 + workingHour;
|
|
// //}
|
|
// //if (workingHour > 8) workingHour = 8;
|
|
// //amount = 8- workingHour;
|
|
// //if (amount < 0)
|
|
// //{
|
|
// // amount = (24 + amount);
|
|
// // if (amount > 8)
|
|
// // amount = 8;
|
|
// //}
|
|
// #endregion
|
|
|
|
// }
|
|
// //amount = (Math.Ceiling(2 * attProcess.EarlyHour)) / 2;
|
|
// //amount = attProcess.EarlyHour;
|
|
// else if (attProcess.AttenType == EnumAttendanceType.Present && attProcess.LateHour > 0 && attProcess.InTime != DateTime.MinValue && attProcess.OutTime != DateTime.MinValue)
|
|
// {
|
|
// //double fac = ((Math.Round(attProcess.LateHour, 2) - Math.Floor(attProcess.LateHour)));
|
|
// ////amount = 8 - Math.Floor(attProcess.LateHour) + ((fac < .5) ? (double)0 : (double)1);
|
|
// //amount = Math.Floor(attProcess.LateHour) + ((fac < .5) ? (double)0 : (double).5);
|
|
// //if (amount < 0 || amount > 7.9) amount = 0;
|
|
|
|
// amount = 0;
|
|
|
|
// DateTime shiftInTime = sft.InTime;
|
|
// DateTime shiftOutTime = sft.OutTime;
|
|
|
|
// DateTime attnInTime = attProcess.InTime;
|
|
// DateTime attnOutTime = attProcess.OutTime;
|
|
// TimeSpan intimeSpan;
|
|
// TimeSpan outTimeSpan;
|
|
// TimeSpan workingHourSpan;
|
|
|
|
// if (attnInTime.TimeOfDay > shiftInTime.TimeOfDay)
|
|
// {
|
|
// intimeSpan = attnInTime.TimeOfDay;
|
|
// }
|
|
// else
|
|
// intimeSpan = shiftInTime.TimeOfDay;
|
|
|
|
// if (attnOutTime.TimeOfDay < shiftOutTime.TimeOfDay)
|
|
// {
|
|
// outTimeSpan = attnOutTime.TimeOfDay;
|
|
// }
|
|
// else
|
|
// outTimeSpan = shiftOutTime.TimeOfDay;
|
|
// workingHourSpan = outTimeSpan - intimeSpan;
|
|
// double workingHour = workingHourSpan.TotalHours;
|
|
// if (workingHour < 0)
|
|
// {
|
|
// workingHour = (24 + workingHour);
|
|
// if (workingHour > 8)
|
|
// workingHour = 8;
|
|
// else
|
|
// {
|
|
// frac = ((Math.Round(workingHour, 2) - Math.Floor(workingHour)));
|
|
// workingHour = Math.Floor(workingHour) + ((frac < .5) ? (double).5 : (double)1);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// if (workingHour >= 8)
|
|
// workingHour = 8;
|
|
// else
|
|
// {
|
|
// frac = ((Math.Round(workingHour, 2) - Math.Floor(workingHour)));
|
|
// workingHour = Math.Floor(workingHour) + ((frac < .5) ? (double).5 : (double)1);
|
|
// }
|
|
// }
|
|
// if (sft.ShortName == "F") //General Shift HO-Thursday (Total Working Hour=7)
|
|
// {
|
|
// if (workingHour >= 7)
|
|
// {
|
|
// workingHour = 7;
|
|
// amount = 7 - workingHour;
|
|
// }
|
|
// if (workingHour < 7)
|
|
// {
|
|
// amount = 7 - workingHour;
|
|
// }
|
|
// }
|
|
// else if (sft.ShortName == "G") //Common Shift-3 Thursday (Total Working Hour=4)
|
|
// {
|
|
// if (workingHour >= 4)
|
|
// {
|
|
// workingHour = 4;
|
|
// amount = 4 - workingHour;
|
|
// }
|
|
// if (workingHour < 4)
|
|
// {
|
|
// amount = 4 - workingHour;
|
|
// }
|
|
|
|
// }
|
|
// else
|
|
// amount = 8 - workingHour;
|
|
// if (attProcess.Holiday != null)
|
|
// amount = 0;
|
|
|
|
// #region End
|
|
|
|
// //DateTime shiftInTime = sft.InTime;
|
|
// //DateTime shiftOutTime = sft.OutTime;
|
|
|
|
// //DateTime attnInTime = attProcess.InTime;
|
|
// //DateTime attnOutTime = attProcess.OutTime;
|
|
// //TimeSpan intimeSpan;
|
|
// //TimeSpan outTimeSpan;
|
|
// //TimeSpan intimeSpanTemp;
|
|
// //TimeSpan outTimeSpanTemp;
|
|
// //TimeSpan workingHourSpan;
|
|
|
|
// //if (attnInTime.TimeOfDay > shiftInTime.TimeOfDay)
|
|
// //{
|
|
// // intimeSpan = attnInTime.TimeOfDay;
|
|
// // intimeSpanTemp = attnInTime.TimeOfDay;
|
|
// // graceIsUsed = true;
|
|
// // if (intimeSpan.Minutes < grace && intimeSpan.Minutes != 0)
|
|
// // intimeSpanTemp = new TimeSpan(intimeSpan.Hours, 0, intimeSpan.Seconds);
|
|
// // if (intimeSpan.Minutes >= grace)
|
|
// // intimeSpanTemp = new TimeSpan(intimeSpan.Hours, 30, intimeSpan.Seconds);
|
|
// // if (intimeSpan.Minutes == 0)
|
|
// // intimeSpanTemp = new TimeSpan(intimeSpan.Hours - 1, 30, intimeSpan.Seconds);
|
|
// //}
|
|
// //else
|
|
// // intimeSpanTemp = shiftInTime.TimeOfDay;
|
|
|
|
// //if (attnOutTime.TimeOfDay < shiftOutTime.TimeOfDay)
|
|
// //{
|
|
// // outTimeSpan = attnOutTime.TimeOfDay;
|
|
// // outTimeSpanTemp = attnOutTime.TimeOfDay;
|
|
// // if (graceIsUsed == false)
|
|
// // {
|
|
// // if (outTimeSpan.Minutes != 0)
|
|
// // {
|
|
// // if (outTimeSpan.Minutes < grace)
|
|
// // outTimeSpanTemp = new TimeSpan(outTimeSpan.Hours, 30, outTimeSpan.Seconds);
|
|
// // if (outTimeSpan.Minutes > grace)
|
|
// // outTimeSpanTemp = new TimeSpan(outTimeSpan.Hours + 1, 0, outTimeSpan.Seconds);
|
|
// // }
|
|
// // }
|
|
// //}
|
|
// //else
|
|
// // outTimeSpanTemp = shiftOutTime.TimeOfDay;
|
|
|
|
// //workingHourSpan = outTimeSpanTemp - intimeSpanTemp;
|
|
// //double workingHour = workingHourSpan.TotalHours;
|
|
// //if (workingHourSpan.Minutes >= 30 && workingHour > 0)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours, 30, workingHourSpan.Seconds);
|
|
// //if (workingHourSpan.Minutes != 0)
|
|
// //{
|
|
// // if (workingHourSpan.Minutes < 30 && workingHour > 0)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours, 0, workingHourSpan.Seconds);
|
|
// //}
|
|
// //workingHour = workingHourSpan.TotalHours;
|
|
// //if (workingHour < 0)
|
|
// //{
|
|
// // double value = workingHour;
|
|
// // double decPart = value - Math.Truncate(workingHour);
|
|
// // if (decPart != 0 && workingHourSpan.Minutes >= -30)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours - 1, 30, workingHourSpan.Seconds);
|
|
// // else if (decPart != 0)
|
|
// // workingHourSpan = new TimeSpan(workingHourSpan.Hours - 1, 0, workingHourSpan.Seconds);
|
|
// // workingHour = workingHourSpan.TotalHours;
|
|
// // workingHour = 24 + workingHour;
|
|
// //}
|
|
// //amount = 8 - workingHour;
|
|
// //if (amount < 0)
|
|
// //{
|
|
// // amount = (24 + amount);
|
|
// // if (amount > 8)
|
|
// // amount = 8;
|
|
// //}
|
|
|
|
// #endregion
|
|
|
|
// }
|
|
|
|
// // amount = attProcess.LateHour;
|
|
// //double i = Math.Floor(amount);
|
|
// //if (i != 0)
|
|
// //{
|
|
// // decimal precision = (decimal)amount - Math.Floor((decimal)amount);
|
|
// // if (precision >= (decimal)0.5)
|
|
// // {
|
|
// // amount = Math.Ceiling(amount);
|
|
// // }
|
|
// // else
|
|
// // {
|
|
// // amount = Math.Round(amount,0);
|
|
// // }
|
|
// //}
|
|
// else if (attProcess.AttenType == EnumAttendanceType.Present && attProcess.LateHour == 0 && attProcess.EarlyHour == 0 && attProcess.InTime != DateTime.MinValue && attProcess.OutTime != DateTime.MinValue)
|
|
// amount = 0;
|
|
// if (amount > 8) amount = 8;
|
|
// if (amount < 0) amount = 0;
|
|
// return amount;
|
|
|
|
// }
|
|
// //double hours = 0;
|
|
// if (attProcess.InTime == DateTime.MinValue || attProcess.OutTime == DateTime.MinValue)
|
|
// amount = 0;
|
|
// else
|
|
// {
|
|
// TimeSpan diff = sft.OutTime - sft.InTime;
|
|
// double shiftHours = diff.Hours < 0 ? 24 + diff.Hours : diff.Hours; //(sft.OutTime - sft.InTime).Hours;
|
|
// diff = attProcess.OutTime - attProcess.InTime;
|
|
// double inoutdeff = diff.Hours < 0 ? 24 + diff.Hours : diff.Hours; //(sft.OutTime - sft.InTime).Hours;
|
|
// if (shiftHours <= inoutdeff)
|
|
// {
|
|
// amount = shiftHours;
|
|
// }
|
|
// else
|
|
// {
|
|
// DateTime tempTime = new DateTime(attProcess.InTime.Year, attProcess.InTime.Month, attProcess.InTime.Day, sft.InTime.Hour, sft.InTime.Minute, sft.InTime.Second);
|
|
// DateTime inTm = attProcess.InTime;
|
|
// DateTime outTm = attProcess.OutTime.AddMinutes(sft.EarlyExitBefore);
|
|
// if (tempTime >= attProcess.InTime)
|
|
// inTm = tempTime;
|
|
// else if (Math.Abs((tempTime - attProcess.InTime).TotalMinutes) < sft.LateCalcualtion)
|
|
// inTm = tempTime;
|
|
// else inTm = attProcess.InTime;
|
|
|
|
// tempTime = new DateTime(attProcess.OutTime.Year, attProcess.OutTime.Month, attProcess.OutTime.Day, sft.OutTime.Hour, sft.OutTime.Minute, sft.OutTime.Second);
|
|
// if (tempTime <= attProcess.OutTime)
|
|
// outTm = tempTime;
|
|
// else if (Math.Abs((tempTime - attProcess.OutTime).TotalMinutes) < sft.EarlyExitBefore)
|
|
// outTm = tempTime;
|
|
// else outTm = attProcess.OutTime;
|
|
|
|
// TimeSpan totalDif = outTm - inTm;
|
|
// amount = totalDif.TotalHours < 0 ? 24 + totalDif.TotalHours : totalDif.TotalHours;
|
|
// frac = ((Math.Round(amount, 2) - Math.Floor(amount)));
|
|
// amount = Math.Floor(amount) + ((frac < .5) ? (double)0 : (double)1);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// else if (this.HoursOverShift)
|
|
// amount = attProcess.OTHour;
|
|
// else if (this.ConsiderPresentHour)
|
|
// {
|
|
// if (attProcess.InTime == DateTime.MinValue || attProcess.OutTime == DateTime.MinValue)
|
|
// amount = 0;
|
|
// TimeSpan diff = attProcess.OutTime - attProcess.InTime;
|
|
// amount = diff.TotalHours;
|
|
|
|
// }
|
|
// else amount = this.Multiple;
|
|
|
|
|
|
// //#region Hartal & Other Exception
|
|
|
|
// //if (attProcess.Holiday != null && attProcess.Holiday.HolidayType == HolidayType.Hartal)
|
|
// //{
|
|
// // DateTime shiftInTime = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, attProcess.Shift.InTime.Hour, attProcess.Shift.InTime.Minute, attProcess.Shift.InTime.Second);
|
|
// // //if (amount >= 4) amount = 8;
|
|
// // if (this.ProvisionType == enumPayrollComponentType.Over_Time && this.ProvisionID == OvertimeConstant.HARTAL_OVER_TIME)
|
|
// // {
|
|
// // if (shiftInTime == attProcess.Holiday.ToTime)
|
|
// // amount = 2;
|
|
// // }
|
|
// //}
|
|
|
|
// //#endregion
|
|
|
|
|
|
// return amount;
|
|
//}
|
|
|
|
//public double GetCalculatedHour(DailyAttnProcess attProcess, Shift sft, ObjectsTemplate<AttnNationalHoliday> _AttNHolidays)
|
|
//{
|
|
// AttnNationalHoliday attnNHoliday = new AttnNationalHoliday();
|
|
// double amount = 0;
|
|
// int holidayhour = 0;
|
|
// DateTime hortalStart = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, 6, 0, 0);
|
|
// DateTime hortalEnd; //= new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, 6, 0, 0);
|
|
// DateTime TempStartTime;
|
|
// DateTime TempEndTime;
|
|
// if (this.ConsiderShiftHour)
|
|
// {
|
|
// if (this.ProvisionType == enumPayrollComponentType.Ordinary_Hour)
|
|
// {
|
|
// amount = 0;
|
|
// if (attProcess.AttenType == EnumAttendanceType.Absent)
|
|
// amount = 8; // No Need In-Out Time
|
|
// else if (attProcess.EarlyHour > 0)
|
|
// amount = 8 - attProcess.EarlyHour;
|
|
// else if (attProcess.LateHour > 0)
|
|
// amount = 8 - attProcess.LateHour;
|
|
|
|
// return amount;
|
|
|
|
// }
|
|
// if ((attProcess.WorkDayType == EnumWorkPlanDayType.NationalHoliday && this.ProvisionType == enumPayrollComponentType.Over_Time))
|
|
// {
|
|
// attnNHoliday = _AttNHolidays.Where(o => o.ID == attProcess.ReferenceID).FirstOrDefault();
|
|
// if (attnNHoliday != null)
|
|
// {
|
|
// if (attnNHoliday.HolidayType != HolidayType.Hartal)
|
|
// {
|
|
// if (attProcess.InTime == DateTime.MinValue || attProcess.OutTime == DateTime.MinValue)
|
|
// amount = 0;
|
|
// else
|
|
// {
|
|
// double shiftHours = (sft.OutTime - sft.InTime).Hours;
|
|
// if (shiftHours <= (attProcess.OutTime - attProcess.InTime).Hours)
|
|
// {
|
|
// amount = shiftHours;
|
|
// }
|
|
// else
|
|
// {
|
|
// DateTime tempTime = new DateTime(attProcess.InTime.Year, attProcess.InTime.Month, attProcess.InTime.Day, sft.InTime.Hour, sft.InTime.Minute, sft.InTime.Second);
|
|
// DateTime inTm = attProcess.InTime;
|
|
// DateTime outTm = attProcess.OutTime.AddMinutes(sft.EarlyExitBefore);
|
|
// if (sft.InTime.Hour > attProcess.InTime.Hour)
|
|
// inTm = tempTime;
|
|
// else if (Math.Abs(tempTime.Subtract(attProcess.InTime).Minutes) < sft.LateCalcualtion)
|
|
// inTm = tempTime;
|
|
// else inTm = attProcess.InTime;
|
|
|
|
// tempTime = new DateTime(attProcess.OutTime.Year, attProcess.OutTime.Month, attProcess.OutTime.Day, sft.OutTime.Hour, sft.OutTime.Minute, sft.OutTime.Second);
|
|
|
|
// if (Math.Abs(tempTime.Subtract(attProcess.OutTime).Minutes) < sft.EarlyExitBefore)
|
|
// outTm = tempTime;
|
|
// else outTm = attProcess.OutTime;
|
|
|
|
// TimeSpan totalDif = outTm - inTm;
|
|
// amount = totalDif.TotalHours;
|
|
// // if (amount < 0) amount = 0;
|
|
// amount = Math.Round(amount, 2);
|
|
|
|
// }
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// if (attProcess.InTime != DateTime.MinValue && attProcess.OutTime != DateTime.MinValue)
|
|
// {
|
|
// holidayhour = Convert.ToInt32(attnNHoliday.HolidayHour);
|
|
// holidayhour = holidayhour + 6;
|
|
// hortalEnd = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, holidayhour, 0, 0);
|
|
// if (hortalEnd.Hour < sft.InTime.Hour)
|
|
// {
|
|
// amount = 0;
|
|
// return amount;
|
|
// }
|
|
// if (hortalStart.Hour >= sft.InTime.Hour)
|
|
// {
|
|
// TempStartTime = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, hortalStart.Hour, hortalStart.Minute, 0);//hortalStart.Hour;
|
|
// }
|
|
// else
|
|
// {
|
|
// TempStartTime = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, sft.InTime.Hour, sft.InTime.Minute, 0);//hortalStart.Hour;
|
|
// }
|
|
|
|
// if (hortalEnd.Hour <= sft.OutTime.Hour)
|
|
// {
|
|
// TempEndTime = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, hortalEnd.Hour, hortalEnd.Minute, 0);//hortalStart.Hour;
|
|
// }
|
|
// else
|
|
// {
|
|
// TempEndTime = new DateTime(attProcess.AttnDate.Year, attProcess.AttnDate.Month, attProcess.AttnDate.Day, sft.OutTime.Hour, sft.OutTime.Minute, 0);//hortalStart.Hour;
|
|
// }
|
|
|
|
// TimeSpan totalDif = TempEndTime - TempStartTime;
|
|
// amount = totalDif.TotalHours;
|
|
// //amount = (TempEndTime - TempStartTime).Hours;
|
|
// }
|
|
// else
|
|
// {
|
|
// amount = 0;
|
|
// }
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// amount = 0;
|
|
// }
|
|
|
|
// return amount;
|
|
// }
|
|
// //double hours = 0;
|
|
// if (attProcess.InTime == DateTime.MinValue || attProcess.OutTime == DateTime.MinValue)
|
|
// amount = 0;
|
|
// else
|
|
// {
|
|
// double shiftHours = (sft.OutTime - sft.InTime).Hours;
|
|
// if (shiftHours < 0)
|
|
// {
|
|
// shiftHours = 24 + shiftHours;
|
|
// }
|
|
// if (shiftHours <= (attProcess.OutTime - attProcess.InTime).Hours)
|
|
// {
|
|
// amount = shiftHours;
|
|
// }
|
|
// else
|
|
// {
|
|
// DateTime tempTime = new DateTime(attProcess.InTime.Year, attProcess.InTime.Month, attProcess.InTime.Day, sft.InTime.Hour, sft.InTime.Minute, sft.InTime.Second);
|
|
// DateTime inTm = attProcess.InTime;
|
|
// DateTime outTm = attProcess.OutTime.AddMinutes(sft.EarlyExitBefore);
|
|
// if (sft.InTime.Hour > attProcess.InTime.Hour)
|
|
// inTm = tempTime;
|
|
// else if (Math.Abs(tempTime.Subtract(attProcess.InTime).Minutes) < sft.LateCalcualtion)
|
|
// inTm = tempTime;
|
|
// else inTm = attProcess.InTime;
|
|
|
|
// tempTime = new DateTime(attProcess.OutTime.Year, attProcess.OutTime.Month, attProcess.OutTime.Day, sft.OutTime.Hour, sft.OutTime.Minute, sft.OutTime.Second);
|
|
|
|
// if (Math.Abs(tempTime.Subtract(attProcess.OutTime).Minutes) < sft.EarlyExitBefore)
|
|
// outTm = tempTime;
|
|
// else outTm = attProcess.OutTime;
|
|
|
|
// TimeSpan totalDif = outTm - inTm;
|
|
// amount = totalDif.TotalHours;
|
|
// // if (amount < 0) amount = 0;
|
|
// amount = Math.Round(amount, 2);
|
|
|
|
// //if (amount < 0)
|
|
// // amount = 24 + amount;
|
|
|
|
// //else amount = Math.Floor(amount);
|
|
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// else if (this.HoursOverShift)
|
|
// amount = attProcess.OTHour;
|
|
// else if (this.ConsiderPresentHour)
|
|
// {
|
|
// if (attProcess.InTime == DateTime.MinValue || attProcess.OutTime == DateTime.MinValue)
|
|
// amount = 0;
|
|
// TimeSpan diff = attProcess.OutTime - attProcess.InTime;
|
|
// amount = diff.TotalHours;
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// amount = this.Multiple;
|
|
// }
|
|
// if (amount < 0)
|
|
// {
|
|
// amount = 24 + amount;
|
|
// }
|
|
// return amount;
|
|
//}
|
|
|
|
//#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
//#region IAttnWiseAllowanceService
|
|
|
|
//public interface IAttnWiseAllowanceService
|
|
//{
|
|
// AttnWiseAllowance Get(ID id, int payrollTypeID);
|
|
// ObjectsTemplate<AttnWiseAllowance> Get(int payrollTypeID);
|
|
// ObjectsTemplate<AttnWiseAllowance> Get(int shiftId, EnumAttendanceType attnType, bool value);
|
|
// ID Save(AttnWiseAllowance item);
|
|
// void Delete(ID id);
|
|
//}
|
|
|
|
//#endregion
|
|
} |