Пример #1
0
        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());
        }
Пример #2
0
        internal static List <ModelRDeptPendingList> GetConvertedOTListDeptsHR(List <ViewDailyOTEntry> list, List <EmpView> emps, List <short?> secIds)
        {
            List <ModelRDeptPendingList> vm = new List <ModelRDeptPendingList>();

            foreach (var item in secIds)
            {
                List <EmpView> empsInDept = emps.Where(aa => aa.SecID == item).ToList();
                if (emps.Where(aa => aa.SecID == item).Count() > 0)
                {
                    List <ViewDailyOTEntry> empsDailyOTList = GetEmpsDailyOTList(list, empsInDept);
                    if (empsDailyOTList.Count > 0)
                    {
                        ModelRDeptPendingList obj = new ModelRDeptPendingList();
                        obj.DeptID               = (short)empsInDept.First().SecID;
                        obj.DeptName             = empsInDept.First().SectionName;
                        obj.NoOfEmps             = empsDailyOTList.Select(aa => aa.EmpID).Distinct().ToList().Count.ToString();
                        obj.ClaimOvertime        = (empsDailyOTList.Where(aa => aa.SecID == item && (aa.StatusID == "F" || aa.StatusID == "A" || aa.StatusID == "P")).Sum(aa => aa.ApprovedOTMin) / 60).ToString();
                        obj.SystemOvertime       = (empsDailyOTList.Where(aa => aa.SecID == item && (aa.StatusID == "F" || aa.StatusID == "A" || aa.StatusID == "P")).ToList().Sum(aa => aa.ActualOTMin) / 60).ToString();
                        obj.OTAmount             = OTHelper.GetOTAmount(empsDailyOTList.Where(aa => aa.SecID == item && (aa.StatusID == "F" || aa.StatusID == "A")).ToList());
                        obj.PendingAtSupervisor  = empsDailyOTList.Where(aa => aa.SecID == item && aa.StatusID == "P").ToList().Count();
                        obj.PendingAtRecommender = empsDailyOTList.Where(aa => aa.SecID == item && aa.StatusID == "F" && aa.UFUserType == "R").ToList().Count();
                        obj.PendingAtApprover    = empsDailyOTList.Where(aa => aa.SecID == item && aa.StatusID == "F" && aa.UFUserType == "P").ToList().Count();
                        obj.Approved             = empsDailyOTList.Where(aa => aa.SecID == item && aa.StatusID == "A").ToList().Count();
                        vm.Add(obj);
                    }
                }
            }
            return(vm.OrderBy(aa => aa.DeptName).ToList());
        }
Пример #3
0
        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);
        }