Compare commits

..

No commits in common. "f02f0a4348c7966a93a1dc92904f35f30d842750" and "40e190844f8c038f73cd49aa95638d5afab64b76" have entirely different histories.

4 changed files with 42 additions and 94 deletions

View File

@ -842,21 +842,6 @@ namespace HRM.DA
} }
return tc.ExecuteReader(strSQLQuery); return tc.ExecuteReader(strSQLQuery);
} }
internal static IDataReader GetForOTprocess(TransactionContext tc, EnumEmployeeStatus status, int payrollTypeID, DateTime salarymonth )
{
string strSQLQuery = string.Empty;
if (status == EnumEmployeeStatus.Regardless)
{
strSQLQuery = SQLParser.MakeSQL("SELECT * FROM Employee WHERE PAYROLLTYPEID = %n ", payrollTypeID);
}
else
{
strSQLQuery = SQLParser.MakeSQL("SELECT * FROM Employee WHERE (Status = %n or endofcontractdate between %d and %d) AND PAYROLLTYPEID = %n ",
(int)status,GlobalFunctions.FirstDateOfMonth(salarymonth), GlobalFunctions.LastDateOfMonth(salarymonth), payrollTypeID);
}
return tc.ExecuteReader(strSQLQuery);
}
internal static DataSet GetEmpIDsOfManager(TransactionContext tc, int status, DateTime lastDateOfYear) internal static DataSet GetEmpIDsOfManager(TransactionContext tc, int status, DateTime lastDateOfYear)
{ {

View File

@ -2454,26 +2454,23 @@ namespace HRM.DA
DataSet EmpOTHours = new ShiftTermService().GetEmpOT(oPayrollType.NextPayProcessDate, trm.ID); DataSet EmpOTHours = new ShiftTermService().GetEmpOT(oPayrollType.NextPayProcessDate, trm.ID);
foreach (DataRow Dr in EmpOTHours.Tables[0].Rows) foreach (DataRow Dr in EmpOTHours.Tables[0].Rows)
{ {
//if (Convert.ToDouble(Dr["TotalOT"])>0) Employee tempEmployee = employees.Where(emp => emp.ID.ToString() == Dr["EmployeeID"].ToString()).FirstOrDefault();
//{ if (tempEmployee == null || tempEmployee.IsEligibleOT == false) continue;
Employee tempEmployee = employees.Where(emp => emp.ID.ToString() == Dr["EmployeeID"].ToString()).FirstOrDefault();
if (tempEmployee == null || tempEmployee.IsEligibleOT == false) continue;
if (tempEmployee.GradeID == null) if (tempEmployee.GradeID == null)
{ {
ErrorList.Add(new SalaryProcessStatus(tempEmployee.EmployeeNo, tempEmployee.Name, "Grade not assinged")); ErrorList.Add(new SalaryProcessStatus(tempEmployee.EmployeeNo, tempEmployee.Name, "Grade not assinged"));
continue; continue;
} }
if (Dr["TotalOT"] == DBNull.Value) if (Dr["TotalOT"] == DBNull.Value)
{ {
// ErrorList.Add(new SalaryProcessStatus(tempEmployee.EmployeeNo, tempEmployee.Name, "value can't be null ")); // ErrorList.Add(new SalaryProcessStatus(tempEmployee.EmployeeNo, tempEmployee.Name, "value can't be null "));
continue; continue;
} }
EmpOverTimes = MakeEmployeeOvertimeObj(ref EmpOverTimes, ref ErrorList, tempEmployee, termParameters, EmpOverTimes = MakeEmployeeOvertimeObj(ref EmpOverTimes, ref ErrorList, tempEmployee, termParameters,
oPayrollType, trm.ID, Convert.ToDouble(Dr["TotalOT"]), userid); oPayrollType, trm.ID, Convert.ToDouble(Dr["TotalOT"]), userid);
//}
} }
} }
} }

View File

@ -1564,37 +1564,6 @@ namespace HRM.DA
return employees; return employees;
} }
public List<Employee> GetForOTprocess(EnumEmployeeStatus status, int payrollTypeID, DateTime salarymonth)
{
List<Employee> employees = new List<Employee>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(EmployeeDA.GetForOTprocess(tc, status, payrollTypeID, salarymonth));
employees = this.CreateObjects<Employee>(dr);
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 employees;
}
public DataTable GetEmpIDsOfManager(int status, DateTime lastDateOfYear) public DataTable GetEmpIDsOfManager(int status, DateTime lastDateOfYear)
{ {

View File

@ -524,21 +524,21 @@ namespace HRM.DA
{ {
bulkCopy.BulkCopyTimeout = 6000; // in seconds bulkCopy.BulkCopyTimeout = 6000; // in seconds
bulkCopy.ColumnMappings.Add("PROCESSID", "ProcessId"); bulkCopy.ColumnMappings.Add("PROCESSID", "PROCESSID");
bulkCopy.ColumnMappings.Add("PROCESSMONTH", "ProcessMonth"); bulkCopy.ColumnMappings.Add("PROCESSMONTH", "PROCESSMONTH");
bulkCopy.ColumnMappings.Add("EMPID", "EmpID"); bulkCopy.ColumnMappings.Add("EMPID", "EMPID");
bulkCopy.ColumnMappings.Add("AMOUNT", "Amount"); bulkCopy.ColumnMappings.Add("AMOUNT", "AMOUNT");
bulkCopy.ColumnMappings.Add("TERMID", "TermID"); bulkCopy.ColumnMappings.Add("TERMID", "TERMID");
bulkCopy.ColumnMappings.Add("HOURS", "Hours"); bulkCopy.ColumnMappings.Add("HOURS", "HOURS");
bulkCopy.ColumnMappings.Add("CREATEDBY", "CreatedBy"); bulkCopy.ColumnMappings.Add("CREATEDBY", "CREATEDBY");
bulkCopy.ColumnMappings.Add("CREATIONDATE", "CreationDate"); bulkCopy.ColumnMappings.Add("CREATIONDATE", "CREATIONDATE");
bulkCopy.ColumnMappings.Add("MODIFIEDBY", "ModifiedBy"); bulkCopy.ColumnMappings.Add("MODIFIEDBY", "MODIFIEDBY");
bulkCopy.ColumnMappings.Add("MODIFIEDDATE", "ModifiedDate"); bulkCopy.ColumnMappings.Add("MODIFIEDDATE", "MODIFIEDDATE");
bulkCopy.ColumnMappings.Add("TERMPARAMETERID", "TermParameterID"); bulkCopy.ColumnMappings.Add("TERMPARAMETERID", "TERMPARAMETERID");
bulkCopy.ColumnMappings.Add("EMPOVERTIMEID", "EmpOverTimeID"); bulkCopy.ColumnMappings.Add("EMPOVERTIMEID", "EMPOVERTIMEID");
bulkCopy.ColumnMappings.Add("ARREARAMOUNT", "ArrearAmount"); bulkCopy.ColumnMappings.Add("ARREARAMOUNT", "ARREARAMOUNT");
bulkCopy.ColumnMappings.Add("OTMONTH", "OTMonth"); bulkCopy.ColumnMappings.Add("OTMONTH", "OTMONTH");
bulkCopy.ColumnMappings.Add("PAYROLLTYPEID", "PayrollTypeID"); bulkCopy.ColumnMappings.Add("PAYROLLTYPEID", "PAYROLLTYPEID");
bulkCopy.DestinationTableName = "OTProcess"; bulkCopy.DestinationTableName = "OTProcess";
@ -614,7 +614,7 @@ namespace HRM.DA
public void Process(List<Employee> emps, int userid, int payrolltypeid) public void Process(List<Employee> emps, int userid, int payrolltypeid)
{ {
TermParameter.EntryType = new SystemConfigarationService().GetconfigStringValue(EnumConfigurationType.Logic,"overtime", "entrytype"); // TermParameter.EntryType = ConfigurationManager.GetStringValue("overtime", "entrytype", EnumConfigurationType.Logic);
bool calOnEarnedBasic = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "overtime", "earnedbasic"); bool calOnEarnedBasic = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "overtime", "earnedbasic");
int basicOnMonth = Convert.ToInt32(new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "overtime", "basicondate")); int basicOnMonth = Convert.ToInt32(new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "overtime", "basicondate"));
bool fixedotmonth = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "overtime", "fixedotmonth"); bool fixedotmonth = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "overtime", "fixedotmonth");
@ -623,7 +623,7 @@ namespace HRM.DA
PayrollType ptype = new PayrollTypeService().Get(payrolltypeid); PayrollType ptype = new PayrollTypeService().Get(payrolltypeid);
List<Employee> omployees = emps; List<Employee> omployees = emps;
if (emps == null) omployees = new EmployeeService().GetForOTprocess(EnumEmployeeStatus.Live, payrolltypeid, ptype.NextPayProcessDate); if (emps == null) omployees = new EmployeeService().Get(EnumEmployeeStatus.Live, payrolltypeid);
_OtProcess = new List<OTProcess>(); _OtProcess = new List<OTProcess>();
_EmpOvertimes = new EmployeeOverTimeService().Get(ptype.NextPayProcessDate, payrolltypeid); _EmpOvertimes = new EmployeeOverTimeService().Get(ptype.NextPayProcessDate, payrolltypeid);
double basicSalary = 0; double basicSalary = 0;
@ -835,16 +835,13 @@ namespace HRM.DA
TermParameter tparam = TermParameter.GetParameter(this._termParameters, (int)ot.Employee.GradeID, ot.TermID); TermParameter tparam = TermParameter.GetParameter(this._termParameters, (int)ot.Employee.GradeID, ot.TermID);
if (tparam == null) throw new Exception("OT parameter/Policy not found for the employee:" if (tparam == null) throw new Exception("OT parameter/Policy not found for the employee:"
+ ot.Employee.EmployeeNo + " " + ot.Employee.Name); + ot.Employee.EmployeeNo + " " + ot.Employee.Name);
//double nHour = ot.OTHours; double nHour = ot.OTHours;
////if ((ot.OTHours - nHour) == 0) //if ((ot.OTHours - nHour) == 0)
////{ //{
//// throw new Exception("Monthly OT hours can be zero"); // throw new Exception("Monthly OT hours can be zero");
////} //}
//nHour = Math.Floor(ot.OTHours); nHour = Math.Floor(ot.OTHours);
//nHour += (ot.OTHours - nHour) * 100 / 60; nHour += (ot.OTHours - nHour) * 100 / 60;
double nHour = TermParameter.EntryType.ToUpper() == "MINUTE" ? // Means decimal part is in minutes
Math.Round(Math.Floor(ot.OTHours) + (((ot.OTHours - Math.Floor(ot.OTHours)) * 100.00) / 60.00), 2)
: Math.Round(ot.OTHours, 2);
switch (tparam.Type) switch (tparam.Type)
{ {
case EnumOverTimeType.AnyAmount: case EnumOverTimeType.AnyAmount:
@ -856,7 +853,7 @@ namespace HRM.DA
case EnumOverTimeType.FixedAmount: case EnumOverTimeType.FixedAmount:
return ot.OTHours ; return ot.OTHours ;
case EnumOverTimeType.HourlyBasicPercent: case EnumOverTimeType.HourlyBasicPercent:
return this.ConvertToHourlyRate(nBasic, ot.OTMonth, _hoursInMonth) * nHour * (tparam.Amount/100); return this.ConvertToHourlyRate(nBasic, ot.OTMonth, tparam.housInMonth) * ot.OTHours * (tparam.Amount/100);
case EnumOverTimeType.HourlyFlatAmount: case EnumOverTimeType.HourlyFlatAmount:
return ot.OTHours * tparam.Amount; return ot.OTHours * tparam.Amount;
case EnumOverTimeType.HoursOfMonth: case EnumOverTimeType.HoursOfMonth:
@ -914,8 +911,8 @@ namespace HRM.DA
process.OTMonth = GlobalFunctions.LastDateOfMonth(ot.OTMonth); process.OTMonth = GlobalFunctions.LastDateOfMonth(ot.OTMonth);
process.TermID = ot.TermID; process.TermID = ot.TermID;
process.TermParameterID = ot.TermParameterID; process.TermParameterID = ot.TermParameterID;
process.TotalHour = Math.Round(ot.OTHours, 2); process.TotalHour = ot.OTHours;
process.Amount = Math.Round(this.GetPayableAmount(ot, Math.Round(nBasic))); process.Amount = this.GetPayableAmount(ot, nBasic);
process.PayrollTypeID = ot.PayrollTypeID; process.PayrollTypeID = ot.PayrollTypeID;
return process; return process;