// Criteria Based Single Date public ActionResult EditDateWiseEntries() { try { DateTime _AttDataTo = Convert.ToDateTime(Request.Form["DateFrom"].ToString()); if (DDService.IsDateLieBetweenActivePayroll(_AttDataTo)) { string allEmployees = Request.Form["RosterSelectionRB"].ToString(); string shift = Request.Form["ShiftList"].ToString(); string group = Request.Form["GroupList"].ToString(); string deoartment = Request.Form["DepartmentList"].ToString(); string section = Request.Form["SectionList"].ToString(); string location = Request.Form["LocationList"].ToString(); VMEditAttendanceDateWise vm = DailyAttendanceEditorService.EditDateWiseEntries(_AttDataTo, Request.Form["RosterSelectionRB"].ToString(), Request.Form["ShiftList"].ToString(), Request.Form["LocationList"].ToString(), Request.Form["GroupList"].ToString(), Request.Form["DepartmentList"].ToString(), Request.Form["SectionList"].ToString()); return(View(vm)); } else { CreateHelper(); ViewBag.Message = "Payroll Period is closed"; return(View("Index")); } } catch (Exception) { throw; } }
// Dashboard #region Dashboard Links public ActionResult LoadTMDashboardAttendance(DateTime?date, string Criteria) { VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser; VMEditAttendanceDateWise vm = DailyAttendanceEditorService.GetTMDashboardAttendance((DateTime)date, Criteria, GetSpecificEmployeeService.GetSpecificAttendance(LoggedInUser, (DateTime)date)); return(View("EditDateWiseEntries", vm)); }
public VMEditAttendanceDateWise GetTMDashboardAttendance(DateTime date, string Criteria, List <VAT_DailyAttendance> dailyAttendance) { VMEditAttendanceDateWise vm = new VMEditAttendanceDateWise(); int selectedID = 0; string CriteriaRBName = ""; if (Criteria == "Absent") { vm = GetAttendanceAttributesDateWise(dailyAttendance.Where(aa => aa.AbDays > 0).ToList(), date, Criteria, selectedID); } if (Criteria == "Missing") { vm = GetAttendanceAttributesDateWise(dailyAttendance.Where(aa => (aa.TimeIn != null && aa.TimeOut == null) || (aa.TimeIn == null && aa.TimeOut != null)).ToList(), date, Criteria, selectedID); } if (Criteria == "LateIn") { vm = GetAttendanceAttributesDateWise(dailyAttendance.Where(aa => aa.LateIn > 240).ToList(), date, Criteria, selectedID); } if (Criteria == "EarlyOut") { vm = GetAttendanceAttributesDateWise(dailyAttendance.Where(aa => aa.EarlyOut > 240).ToList(), date, Criteria, selectedID); } vm.CriteriaRBName = CriteriaRBName; return(vm); }
public ActionResult NextEntry(string CriteriaRBName, DateTime?dt, string CriteriaData) { VMEditAttendanceDateWise vm = DailyAttendanceEditorService.EditDateWiseEntries(dt.Value.AddDays(1), CriteriaRBName, CriteriaData, CriteriaData, CriteriaData, CriteriaData, CriteriaData); return(View("EditDateWiseEntries", vm)); }
public ActionResult SaveEditEntriesDateWise(AttEditSingleEmployee Model) { try { int count = Convert.ToInt32(Request.Form["Count"].ToString()); VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser; DateTime dt = Convert.ToDateTime(Request.Form["Date"].ToString()); string Criteria = Request.Form["Criteria"].ToString(); int CriteriaData = Convert.ToInt32(Request.Form["CriteriaData"].ToString()); string CriteriaRBName = (Request.Form["CriteriaRBName"].ToString()); List <DailyAttendance> oldAttendance = new List <DailyAttendance>(); Expression <Func <DailyAttendance, bool> > rbAll = aa => aa.AttDate == dt; oldAttendance = DailyAttendanceService.GetIndexSpecific(rbAll); string Message = ""; for (int i = 1; i <= count; i++) { //int EmpID = Convert.ToInt32(Request.Form["Row" + i.ToString()].ToString()); string empDate = Request.Form["EmpDate-" + i.ToString()].ToString(); DailyAttendance att = oldAttendance.First(aa => aa.EmpDate == empDate); string DutyCode = Request.Form["DutyCode-" + i.ToString()].ToString(); string DutyTime = Request.Form["DutyTime-" + i.ToString()].ToString(); string ShiftTime = Request.Form["ShiftTime-" + i.ToString()].ToString(); string TimeIn = Request.Form["TimeIn-" + i.ToString()].ToString(); string TimeOut = Request.Form["TimeOut-" + i.ToString()].ToString(); string Remarks = Request.Form["Remarks-" + i.ToString()].ToString(); EditAttendanceList editlist = DailyAttendanceEditorService.GetEditAttendanceList(empDate, DutyCode, DutyTime, ShiftTime, TimeIn, TimeOut, Remarks); if (DailyAttendanceEditorService.CheckRecordIsEdited(att, editlist)) { DateTime _NewTimeIn = new DateTime(); DateTime _NewTimeOut = new DateTime(); _NewTimeIn = (DateTime)(att.AttDate + editlist.TimeIn); if (editlist.TimeIn != null && editlist.TimeOut != null) { if (editlist.TimeOut < editlist.TimeIn) { _NewTimeOut = att.AttDate.Value.AddDays(1) + editlist.TimeOut; } else { _NewTimeOut = (DateTime)(att.AttDate + editlist.TimeOut); } DailyAttendanceEditorService.ManualAttendanceProcess(editlist.EmpDate, "", false, _NewTimeIn, _NewTimeOut, editlist.DutyCode, LoggedInUser.PUserID, editlist.DutyTime, Remarks, (short)editlist.ShiftTime.TotalMinutes); } else { if (editlist.TimeIn.TotalMinutes > 0) { _NewTimeIn = (DateTime)(att.AttDate + editlist.TimeIn); } if (editlist.TimeOut.TotalMinutes > 0) { _NewTimeOut = (DateTime)(att.AttDate + editlist.TimeOut); } DailyAttendanceEditorService.ManualAttendanceProcess(editlist.EmpDate, "", false, _NewTimeIn, _NewTimeOut, editlist.DutyCode, LoggedInUser.PUserID, editlist.DutyTime, Remarks, (short)editlist.ShiftTime.TotalMinutes); } DDService.ProcessMonthlyAttendance(dt, (int)att.EmpID, att.EmpNo); } else { } } VMEditAttendanceDateWise vm = DailyAttendanceEditorService.EditDateWiseEntries(dt, CriteriaRBName.ToString(), CriteriaData.ToString(), CriteriaData.ToString(), CriteriaData.ToString(), CriteriaData.ToString(), CriteriaData.ToString()); return(View("EditDateWiseEntries", vm)); } catch (Exception) { throw; } }
private VMEditAttendanceDateWise GetAttendanceAttributesDateWise(List <VAT_DailyAttendance> dailyAttendance, DateTime dtTo, string Criteria, int CriteriaData) { VMEditAttendanceDateWise entries = new VMEditAttendanceDateWise(); List <EditAttendanceListDateWise> list = new List <EditAttendanceListDateWise>(); int i = 1; foreach (var item in dailyAttendance) { EditAttendanceListDateWise eal = new EditAttendanceListDateWise(); eal.EmployeeID = (int)item.EmpID; eal.No = i; i++; eal.EmpNo = item.OEmpID; eal.EmpName = item.EmployeeName; eal.Date = item.AttDate.Value.ToString("dd-MMM-yyyy"); eal.DutyTime = item.DutyTime.Value.Hours.ToString("00") + item.DutyTime.Value.Minutes.ToString("00"); eal.EmpDate = item.EmpDate; eal.DutyCode = item.DutyCode; eal.SystemRemarks = item.Remarks; TimeSpan shiftTime = new TimeSpan(0, (int)item.ShifMin, 0); eal.ShiftTime = shiftTime.Hours.ToString("00") + shiftTime.Minutes.ToString("00"); if (item.TimeIn != null) { eal.TimeIn = item.TimeIn.Value.TimeOfDay.Hours.ToString("00") + item.TimeIn.Value.TimeOfDay.Minutes.ToString("00"); } if (item.TimeOut != null) { eal.TimeOut = item.TimeOut.Value.TimeOfDay.Hours.ToString("00") + item.TimeOut.Value.TimeOfDay.Minutes.ToString("00"); } if (item.WorkMin > 0) { TimeSpan WorkTime = new TimeSpan(0, (int)item.WorkMin, 0); eal.WorkMinutes = WorkTime.Hours.ToString("00") + ":" + WorkTime.Minutes.ToString("00"); } else { eal.WorkMinutes = "0000"; } if (item.DutyCode == "G") { string OT = ""; if (item.GZOTMin > 0) { TimeSpan GZTime = new TimeSpan(0, (int)item.GZOTMin, 0); OT = GZTime.Hours.ToString("00") + ":" + GZTime.Minutes.ToString("00"); } if (item.ExtraMin > 0) { TimeSpan ExtraMin = new TimeSpan(0, (int)item.ExtraMin, 0); OT = ExtraMin.Hours.ToString("00") + ":" + ExtraMin.Minutes.ToString("00"); } eal.OTMin = OT; } else { string OT = ""; if (item.OTMin > 0) { TimeSpan OTTime = new TimeSpan(0, (int)item.OTMin, 0); OT = OTTime.Hours.ToString("00") + ":" + OTTime.Minutes.ToString("00"); } if (item.ExtraMin > 0) { TimeSpan ExtraMin = new TimeSpan(0, (int)item.ExtraMin, 0); OT = ExtraMin.Hours.ToString("00") + ":" + ExtraMin.Minutes.ToString("00"); } eal.OTMin = OT; } if (item.ApprovedOT > 0) { TimeSpan ot = new TimeSpan(0, (int)item.ApprovedOT, 0); eal.ApprovedOTMin = ot.Hours.ToString("00") + ot.Minutes.ToString("00"); } if (item.ApprovedDoubleOT > 0) { TimeSpan ot = new TimeSpan(0, (int)item.ApprovedDoubleOT, 0); eal.ApprovedOTMin = ot.Hours.ToString("00") + ot.Minutes.ToString("00"); } if (item.ApprovedCPL > 0) { TimeSpan ot = new TimeSpan(0, (int)item.ApprovedCPL, 0); eal.ApprovedOTMin = ot.Hours.ToString("00") + ot.Minutes.ToString("00"); } list.Add(eal); } entries.list = list.OrderBy(aa => aa.EmpName).ToList(); entries.Count = list.Count; entries.Criteria = Criteria; entries.CriteriaData = CriteriaData; entries.Date = dtTo.ToString("dd-MMM-yyyy"); return(entries); }
public VMEditAttendanceDateWise EditDateWiseEntries(DateTime _AttDataTo, string Selection, string ShiftList, string LocationList, string GroupList, string DepartmentList, string SectionList) { VMEditAttendanceDateWise vm = new VMEditAttendanceDateWise(); int selectedID = 0; string CriteriaRBName = ""; string Criteria = ""; List <DailyAttendance> dailyAttendance = new List <DailyAttendance>(); switch (Selection) { case "rbAll": Expression <Func <DailyAttendance, bool> > rbAll = aa => aa.AttDate == _AttDataTo; dailyAttendance = DailyAttendanceRepo.FindBy(rbAll); CriteriaRBName = "rbAll"; break; case "rbShift": selectedID = Convert.ToInt32(ShiftList); CriteriaRBName = "rbShift"; Expression <Func <DailyAttendance, bool> > rbShift = aa => aa.AttDate == _AttDataTo && aa.Employee.ShiftID == selectedID; dailyAttendance = DailyAttendanceRepo.FindBy(rbShift); if (dailyAttendance.Count > 0) { Criteria = "Shift: " + dailyAttendance.First().Employee.Shift.ShiftName; } break; case "rbLocation": selectedID = Convert.ToInt32(LocationList); CriteriaRBName = "rbLocation"; Expression <Func <DailyAttendance, bool> > rbLocation = aa => aa.AttDate == _AttDataTo && aa.Employee.LocationID == selectedID; dailyAttendance = DailyAttendanceRepo.FindBy(rbLocation); if (dailyAttendance.Count > 0) { Criteria = "Location: " + dailyAttendance.First().Employee.Location.LocationName; } break; case "rbGroup": selectedID = Convert.ToInt32(GroupList); CriteriaRBName = "rbGroup"; Expression <Func <DailyAttendance, bool> > rbGroup = aa => aa.AttDate == _AttDataTo && aa.Employee.CrewID == selectedID; dailyAttendance = DailyAttendanceRepo.FindBy(rbGroup); if (dailyAttendance.Count > 0) { Criteria = "Group: " + dailyAttendance.First().Employee.Crew.CrewName; } break; case "rbDepartment": selectedID = Convert.ToInt32(DepartmentList); CriteriaRBName = "rbDepartment"; Expression <Func <DailyAttendance, bool> > rbDepartment = aa => aa.AttDate == _AttDataTo && aa.Employee.OrganizationalUnit.OUCommon.POUCommonID == selectedID; dailyAttendance = DailyAttendanceRepo.FindBy(rbDepartment); if (dailyAttendance.Count > 0) { Criteria = "Common OU: " + dailyAttendance.First().Employee.OrganizationalUnit.OUCommon.OUCommonName; } break; case "rbSection": selectedID = Convert.ToInt32(SectionList); CriteriaRBName = "rbSection"; Expression <Func <DailyAttendance, bool> > rbSection = aa => aa.AttDate == _AttDataTo && aa.Employee.OUID == selectedID; dailyAttendance = DailyAttendanceRepo.FindBy(rbSection); if (dailyAttendance.Count > 0) { Criteria = "Organizational Unit: " + dailyAttendance.First().Employee.OrganizationalUnit.OUName; } break; } vm = GetAttendanceAttributesDateWise(dailyAttendance, _AttDataTo, Criteria, selectedID); vm.CriteriaRBName = CriteriaRBName; return(vm); }