internal static List <ModelSOTPDList> GetConvertedOTListEmpHR(List <ViewDailyOTEntry> list, List <EmpView> emps) { List <ModelSOTPDList> vm = new List <ModelSOTPDList>(); foreach (var emp in emps) { if (list.Where(aa => aa.EmpID == emp.EmployeeID).Count() > 0) { ModelSOTPDList obj = new ModelSOTPDList(); obj.DailyOTRequestCount = list.Where(aa => aa.EmpID == emp.EmployeeID).Count(); obj.Designation = emp.DesignationName; obj.Section = emp.SectionName; obj.EmpID = emp.EmployeeID; obj.EmpName = emp.FullName; obj.ClaimedOTMins = OTHelper.GetEmployeeCOTHour(list.Where(aa => aa.EmpID == emp.EmployeeID).ToList()); obj.SystemOTMins = OTHelper.GetEmployeeSOTHour(list.Where(aa => aa.EmpID == emp.EmployeeID).ToList()); obj.ClaimedOTHours = OTHelperManager.ConverMinIntoHours(obj.ClaimedOTMins); obj.SystemOTHours = OTHelperManager.ConverMinIntoHours(obj.SystemOTMins); obj.OTAmount = OTHelper.GetOTAmount(list.Where(aa => aa.EmpID == emp.EmployeeID).ToList()); obj.PendingAtSupervisor = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "P").ToList().Count(); obj.PendingAtRecommender = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "F" && aa.UFUserType == "R").ToList().Count(); obj.PendingAtApprover = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "F" && aa.UFUserType == "P").ToList().Count(); obj.Approved = list.Where(aa => aa.EmpID == emp.EmployeeID && aa.StatusID == "A").ToList().Count(); vm.Add(obj); } } return(vm.OrderBy(aa => aa.EmpName).ToList()); }
public static List <ModelSOTPDList> GetConvertedOTListEmp(List <ViewDailyOTEntry> list, List <EmpView> emps) { List <ModelSOTPDList> vm = new List <ModelSOTPDList>(); foreach (var emp in emps) { List <ViewDailyOTEntry> TList = new List <ViewDailyOTEntry>(); TList = list.Where(aa => aa.EmpID == emp.EmployeeID).ToList(); if (TList.Count() > 0) { ModelSOTPDList obj = new ModelSOTPDList(); obj.DailyOTRequestCount = TList.Count(); obj.Designation = emp.DesignationName; obj.Section = emp.SectionName; obj.EmpID = emp.EmployeeID; obj.EmpName = emp.FullName; obj.ClaimedOTMins = (int)TList.Sum(aa => aa.ApprovedOTMin); obj.SystemOTMins = (int)TList.Sum(aa => aa.ActualOTMin); obj.ClaimedOTHours = OTHelperManager.ConverMinIntoHours(obj.ClaimedOTMins); obj.SystemOTHours = OTHelperManager.ConverMinIntoHours(obj.SystemOTMins); obj.OTAmount = OTHelper.GetOTAmount(TList.ToList()); obj.Processed = 1; if (TList.First().PeriodID != null) { obj.PeriodID = (int)TList.First().PeriodID; } else { obj.PeriodID = 0; } if (TList.First().OTProcessingPeriodID != null) { obj.OTProcessPeriodID = (int)TList.First().OTProcessingPeriodID; } else { obj.OTProcessPeriodID = 0; } switch (TList.First().StatusID) { case "P": obj.StatusRemarks = "Pending:" + TList.First().USFullName; break; case "F": obj.StatusRemarks = "Recommend By:" + TList.First().UPFFullName; if (TList.First().UFFFullName != null) { obj.StatusForward = "Recommend By:" + TList.First().UFFFullName; } break; case "C": obj.StatusRemarks = "Cancel:" + TList.First().UCFullName; obj.StatusForward = " "; break; case "A": obj.StatusRemarks = "Approved:" + TList.First().UAFullName; break; case "R": obj.StatusRemarks = "Reject:" + TList.First().URFullName; break; } vm.Add(obj); } } vm = vm.OrderBy(aa => aa.EmpName).ToList(); //if (vm.Count > 0) //{ // ModelSOTPDList obj = new ModelSOTPDList(); // obj.DailyOTRequestCount = list.Count(); // obj.Designation = ""; // obj.Section = ""; // obj.EmpID =0; // obj.EmpName = "Total Employees: "+ vm.Count().ToString(); // obj.ClaimOvertime = vm.Sum(aa=>aa.ClaimOvertime); // obj.SystemOvertime = vm.Sum(aa => aa.SystemOvertime); // obj.OTAmount = vm.Sum(aa => aa.OTAmount); // vm.Add(obj); //} return(vm); }
public static List <ModelDOTEntries> GetConvertedDailyOTListSimple(List <ViewDailyOTEntry> list) { List <ModelDOTEntries> vm = new List <ModelDOTEntries>(); foreach (var item in list.OrderBy(aa => aa.OTDate).ToList()) { ModelDOTEntries obj = new ModelDOTEntries(); obj.EmpDate = item.EmpDate; obj.ClaimedOTHours = OTHelperManager.ConverMinIntoHour(item.ApprovedOTMin); obj.SystemOTHours = OTHelperManager.ConverMinIntoHours(item.ActualOTMin); obj.ClaimedOTMins = (int)item.ApprovedOTMin; obj.SystemOTMins = (int)item.ActualOTMin; obj.Date = OTHelperManager.ConverDateIntoDayString(item.OTDate); if (item.OTAmount > 0) { obj.OTAmount = (int)item.OTAmount; } if (item.TimeIn != null) { obj.TimeIN = item.TimeIn.Value.TimeOfDay.Hours.ToString("00") + ":" + item.TimeIn.Value.TimeOfDay.Minutes.ToString("00"); } else { obj.TimeIN = ""; } if (item.TimeOut != null) { obj.TimeOut = item.TimeOut.Value.TimeOfDay.Hours.ToString("00") + ":" + item.TimeOut.Value.TimeOfDay.Minutes.ToString("00"); } else { obj.TimeOut = ""; } obj.WorkHours = OTHelperManager.ConverMinIntoHours(item.WorkMin); obj.StatusID = item.StatusID; switch (item.StatusID) { case "P": obj.StatusRemarks = "Pending"; obj.StatusForward = " " + item.USFullName; break; case "F": obj.StatusRemarks = "Forward"; if (item.UFFFullName == null) { obj.StatusForward = item.UFFullName; } else { obj.StatusForward = " " + item.UFFFullName; } break; case "C": obj.StatusRemarks = "Cancel"; obj.StatusForward = " " + item.UCFullName; break; case "A": obj.StatusRemarks = "Approved"; obj.StatusForward = " " + item.UAFullName; break; case "R": obj.StatusRemarks = "Reject"; obj.StatusForward = " " + item.URFullName; break; } vm.Add(obj); } return(vm); }