191 lines
11 KiB
C#
191 lines
11 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Data;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
namespace HRM.BO
|
|
|
|
{
|
|
public class EmpChangeDesignation : AuditTrailBase
|
|
{
|
|
|
|
public EmpChangeDesignation()
|
|
{
|
|
EmployeeID = 0;
|
|
DesignationID = 0;
|
|
IsArrear = false;
|
|
NewJoiner = false;
|
|
Franctionate = 0;
|
|
GradeID = 0;
|
|
}
|
|
|
|
public int EmployeeID { get; set; }
|
|
public DateTime EffectDateFrom { get; set; }
|
|
public DateTime EffectedDateTo { get; set; }
|
|
public int DesignationID { get; set; }
|
|
public double BasicSalary { get; set; }
|
|
public string Remarks { get; set; }
|
|
|
|
public bool IsArrear { get; set; }
|
|
public bool NewJoiner { get; set; }
|
|
public double Franctionate { get; set; }
|
|
public int GradeID { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// if employee is null, do the process for all employee's
|
|
/// </summary>
|
|
///
|
|
//public List<EmpChangeDesignation> DesignationAttachment(Employee emp)
|
|
//{
|
|
// List<SalaryMonthly> lastmonthsalaries = new List<SalaryMonthly>();
|
|
// lastmonthsalaries = SalaryMonthly.Get(emp.ID.ToString(), Payroll.BO.SystemInformation.CurrentSysInfo.LastPayProcessDate);
|
|
// List<SalaryMonthly> CurrentMonth = new List<SalaryMonthly> ();
|
|
// CurrentMonth.Add(new SalaryMonthly());
|
|
// CurrentMonth[0].EmployeeID= emp.ID;
|
|
|
|
// DesignationAttachment(lastmonthsalaries,CurrentMonth);
|
|
|
|
// return CurrentMonth[0].DesignationChanges;
|
|
//}
|
|
//public void DesignationAttachment( List<SalaryMonthly> lastmonthsalaries, List<SalaryMonthly> CurrentSalaries)
|
|
//{
|
|
// #region Designation change in fraction month
|
|
|
|
|
|
// List<EmpLifeCycle> empLifecycles = EmpLifeCycle.GetByCreateDate(SystemInformation.CurrentSysInfo.LastPayProcessDate, SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
|
|
|
|
|
|
// var emplifecycles = empLifecycles.Where(x => x.DesignationID != null)
|
|
// .GroupBy(x => x.EmployeeID.Integer)
|
|
// .Select(x => new { EmployeeID = x.Key }).ToList();
|
|
|
|
|
|
// foreach (var lEntry in emplifecycles)
|
|
// {
|
|
// List<EmpChangeDesignation> empdngs = new List<EmpChangeDesignation>();
|
|
// List<EmpLifeCycle> empCount = empLifecycles.Where(x => x.EmployeeID.Integer == (int)lEntry.EmployeeID && x.DesignationID != null).ToObjectsTemplate();
|
|
// SalaryMonthly omonthyly = CurrentSalaries.FirstOrDefault(x => x.EmployeeID.Integer == lEntry.EmployeeID);
|
|
// if (omonthyly == null) continue;
|
|
// empdngs = new List<EmpChangeDesignation>();
|
|
// int count = 0;
|
|
// foreach (EmpLifeCycle item in empCount)
|
|
// {
|
|
// if (item.DesignationID == null) continue;
|
|
// bool Isnew = !lastmonthsalaries.Exists(x => x.EmployeeID.Integer == item.EmployeeID.Integer);
|
|
|
|
// count = count + 1;
|
|
// if (empCount.Count > count)
|
|
// if (empCount.GetRange(count, empCount.Count - count).Any(x => x.EffectDate == item.EffectDate) == true) continue;
|
|
|
|
// if (item.EffectDate < PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|
// {
|
|
// if (item.EffectDate == GlobalExtensions.PayrollFirstDateOfMonth(item.EffectDate))
|
|
// {
|
|
// EmpChangeDesignation ecd = new EmpChangeDesignation();
|
|
// ecd.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd.DesignationID = (Isnew == true) ? omonthyly.DesignationID : lastmonthsalaries.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).DesignationID;
|
|
// ecd.EffectDateFrom = item.EffectDate;
|
|
// ecd.EffectedDateTo = SystemInformation.CurrentSysInfo.LastPayProcessDate;
|
|
// // ecd.GradeID = (Isnew == true) ? omonthyly.GradeID : lastmonthsalaries.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).GradeID; ;
|
|
// ecd.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|
// ecd.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd.EffectDateFrom, ecd.EffectedDateTo);
|
|
// ecd.IsArrear = true;
|
|
// ecd.NewJoiner = Isnew;
|
|
// empdngs.Add(ecd);
|
|
// }
|
|
// else
|
|
// {
|
|
|
|
// if (Isnew == false)
|
|
// {
|
|
// EmpChangeDesignation ecd1 = new EmpChangeDesignation();
|
|
// ecd1.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd1.DesignationID = lastmonthsalaries.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).DesignationID;
|
|
// ecd1.EffectDateFrom = GlobalExtensions.PayrollFirstDateOfMonth(item.EffectDate);
|
|
// ecd1.EffectedDateTo = item.EffectDate.AddDays(-1);
|
|
// ecd1.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd1.EffectDateFrom, ecd1.EffectedDateTo);
|
|
// ecd1.IsArrear = true;
|
|
// ecd1.NewJoiner = Isnew;
|
|
// ecd1.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|
// empdngs.Add(ecd1);
|
|
// }
|
|
|
|
// EmpChangeDesignation ecd2 = new EmpChangeDesignation();
|
|
// ecd2.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd2.DesignationID = item.DesignationID;
|
|
// ecd2.EffectDateFrom = item.EffectDate;
|
|
// ecd2.EffectedDateTo = SystemInformation.CurrentSysInfo.LastPayProcessDate;
|
|
// ecd2.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd2.EffectDateFrom, ecd2.EffectedDateTo);
|
|
// ecd2.IsArrear = true;
|
|
// ecd2.NewJoiner = Isnew;
|
|
// ecd2.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|
// empdngs.Add(ecd2);
|
|
// }
|
|
|
|
// if (count == empCount.Count)
|
|
// {
|
|
// EmpChangeDesignation ecd3 = new EmpChangeDesignation();
|
|
// ecd3.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd3.DesignationID = item.DesignationID;
|
|
// ecd3.EffectDateFrom = PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
// ecd3.EffectedDateTo = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|
// ecd3.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd3.EffectDateFrom, ecd3.EffectedDateTo);
|
|
// ecd3.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|
|
|
// empdngs.Add(ecd3);
|
|
// }
|
|
|
|
// }
|
|
// else if (item.EffectDate > PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|
// {
|
|
|
|
// if (Isnew == false)
|
|
// {
|
|
// EmpChangeDesignation ecd4 = new EmpChangeDesignation();
|
|
// ecd4.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd4.DesignationID = (Isnew == true) ? omonthyly.DesignationID : lastmonthsalaries.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).DesignationID;
|
|
// ecd4.EffectDateFrom = GlobalExtensions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|
// ecd4.EffectedDateTo = item.EffectDate.AddDays(-1);
|
|
// ecd4.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd4.EffectDateFrom, ecd4.EffectedDateTo);
|
|
// ecd4.GradeID = (item.GradeID == null) ? omonthyly.GradeID : lastmonthsalaries.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).GradeID; ; ;
|
|
// empdngs.Add(ecd4);
|
|
// }
|
|
|
|
// EmpChangeDesignation ecd5 = new EmpChangeDesignation();
|
|
// ecd5.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd5.DesignationID = item.DesignationID;
|
|
// ecd5.EffectDateFrom = item.EffectDate;
|
|
// ecd5.EffectedDateTo = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|
// ecd5.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd5.EffectDateFrom, ecd5.EffectedDateTo);
|
|
// ecd5.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|
|
|
|
|
// empdngs.Add(ecd5);
|
|
// }
|
|
// else
|
|
// {
|
|
// if (count == empCount.Count)
|
|
// {
|
|
// EmpChangeDesignation ecd4 = new EmpChangeDesignation();
|
|
// ecd4.EmployeeID = ID.FromInteger(lEntry.EmployeeID);
|
|
// ecd4.DesignationID = item.DesignationID;
|
|
// ecd4.EffectDateFrom = item.EffectDate;
|
|
// ecd4.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|
// ecd4.EffectedDateTo = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|
// ecd4.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd4.EffectDateFrom, ecd4.EffectedDateTo);
|
|
// empdngs.Add(ecd4);
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// SalaryMonthly osalary = CurrentSalaries.FirstOrDefault(x => x.EmployeeID.Integer == lEntry.EmployeeID);
|
|
// if (osalary != null) osalary.DesignationChanges = empdngs;
|
|
// }
|
|
// #endregion
|
|
//}
|
|
}
|
|
}
|