public ActionResult IndexSubmit(int?[] SelectedEmpIds)
        {
            int PRID = Convert.ToInt32(Request.Form["PRPeriodID"]);
            Expression <Func <MonthlyERPLWOP, bool> > SpecificEntries = c => c.PayrollPeriodID == PRID;
            List <MonthlyERPLWOP> monthlyerplwoplist = MonthlyERPLWOPService.GetIndexSpecific(SpecificEntries);
            Expression <Func <MonthlyERP, bool> > SpecificEntries2 = c => c.PayrollPeriodID == PRID;
            List <MonthlyERP> monthlyerplist = MonthlyERPService.GetIndexSpecific(SpecificEntries2);

            foreach (var emp in SelectedEmpIds)
            {
                if (monthlyerplist.Where(aa => aa.EmployeeID == emp).Count() > 0)
                {
                    MonthlyERP tmonthlyerp = monthlyerplist.First(aa => aa.EmployeeID == emp);
                    tmonthlyerp.Remarks = "Close";
                    MonthlyERPService.PostEdit(tmonthlyerp);
                }
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Index(int?PayrollPeriodID)
        {
            VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;

            if (PayrollPeriodID == null)
            {
                PayrollPeriodID = DDService.GetAllPayrollPeriod().OrderByDescending(aa => aa.PPayrollPeriodID).First().PPayrollPeriodID;
            }
            List <VMMonthlyERP> vmList = new List <VMMonthlyERP>();

            ViewBag.PayrollPeriodID = new SelectList(DDService.GetAllPayrollPeriod().ToList().OrderByDescending(aa => aa.PPayrollPeriodID).ToList(), "PPayrollPeriodID", "PRName", PayrollPeriodID);
            Expression <Func <MonthlyERP, bool> > SpecificEntries2 = c => c.PayrollPeriodID == PayrollPeriodID;
            List <MonthlyERP> monthlyerplist = MonthlyERPService.GetIndexSpecific(SpecificEntries2);
            Expression <Func <MonthlyERPLWOP, bool> > SpecificEntries3 = c => c.PayrollPeriodID == PayrollPeriodID;
            List <MonthlyERPLWOP>      dbMonthlyERPLWOPs = MonthlyERPLWOPService.GetIndexSpecific(SpecificEntries3);
            List <VHR_EmployeeProfile> employees         = GetSpecificEmployeeService.GetSpecificEmployees(LoggedInUser);

            foreach (var emp in employees)
            {
                if (monthlyerplist.Where(aa => aa.EmployeeID == emp.PEmployeeID).Count() > 0)
                {
                    MonthlyERP tmonthlyerp = monthlyerplist.First(aa => aa.EmployeeID == emp.PEmployeeID);
                    if (tmonthlyerp.SingleOTMins > 0 || tmonthlyerp.DoubleOTMins > 0 || tmonthlyerp.LWOPDays > 0)
                    {
                        VMMonthlyERP vm = new VMMonthlyERP();
                        vm.OEmpID          = emp.OEmpID;
                        vm.EmpID           = emp.PEmployeeID;
                        vm.EmpName         = emp.EmployeeName;
                        vm.DesignationName = emp.DesignationName;
                        vm.LocationName    = emp.LocationName;
                        //vm.OUName = emp.OUName;
                        vm.Status = tmonthlyerp.Remarks;
                        if (dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID).Count() > 0)
                        {
                            vm.LWOPDays = dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID && aa.IsHalf != true).Count() + (dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID && aa.IsHalf == true).Count() / 2);
                        }
                        else
                        {
                            vm.LWOPDays = 0;
                        }
                        if (tmonthlyerp.SingleOTMins > 0)
                        {
                            vm.SingleOT = (int)tmonthlyerp.SingleOTMins / 60;
                        }
                        if (tmonthlyerp.DoubleOTMins > 0)
                        {
                            vm.DoubleOT = (int)tmonthlyerp.DoubleOTMins / 60;
                        }
                        vmList.Add(vm);
                    }
                }
                else if (dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID).Count() > 0)
                {
                    VMMonthlyERP vm = new VMMonthlyERP();
                    vm.OEmpID          = emp.OEmpID;
                    vm.EmpID           = emp.PEmployeeID;
                    vm.EmpName         = emp.EmployeeName;
                    vm.DesignationName = emp.DesignationName;
                    vm.LocationName    = emp.LocationName;
                    //vm.OUName = emp.OUName;
                    vm.Status = "Absent," + dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID).First().Remarks;
                    if (dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID).Count() > 0)
                    {
                        vm.LWOPDays = dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID && aa.IsHalf != true).Count() + (dbMonthlyERPLWOPs.Where(aa => aa.EmployeeID == emp.PEmployeeID && aa.IsHalf == true).Count() / 2);
                    }
                    else
                    {
                        vm.LWOPDays = 0;
                    }
                    vmList.Add(vm);
                }
            }
            ViewBag.PRPeriodID = PayrollPeriodID;
            return(View(vmList));
        }