private ReportViewer LoadReport_vMLeaveBalanceWithSR(List <VMLeaveBalance> list, ReportViewer rv)
        {
            rv.LocalReport.ReportPath = Server.MapPath(ReportPath);
            IEnumerable <VMLeaveBalance> ie;

            ie = list.AsQueryable();
            ReportDataSource datasource1 = new ReportDataSource("DataSet1", ie);

            rv.LocalReport.DataSources.Add(datasource1);
            ReportParameter rp  = new ReportParameter("Date", DateTitle, false);
            ReportParameter rp1 = new ReportParameter("Header", CompanyHeader + ReportTitle, false);
            ReportParameter rp2 = new ReportParameter("Footer", ReportFooter, false);

            rv.LocalReport.SetParameters(new ReportParameter[] { rp, rp1, rp2 });
            rv.LocalReport.SubreportProcessing += (object sender, SubreportProcessingEventArgs e) =>
            {
                string           EmpNo = e.Parameters["EmployeeID"].Values.First().ToString();
                VMSelectedFilter vmf   = Session["FiltersModel"] as VMSelectedFilter;
                int                  FinancialYearID = ATAssistant.GetFinancialYearID((DateTime)vmf.DateTo, DDService.GetFinancialYear());
                FinancialYear        dbFinancialYear = DDService.GetFinancialYear().Where(aa => aa.PFinancialYearID == FinancialYearID).First();
                DataTable            dataTable       = QueryBuilder.GetValuesfromDB("select * from VAT_LeaveData  where OEmpID='" + EmpNo + "' and (AttDate >= " + "'" + dbFinancialYear.FYStartDate.Value.ToString("yyyy-MM-ddd") + "'" + " and AttDate <= " + "'" + dbFinancialYear.FYEndDate.Value.ToString("yyyy-MM-ddd") + "'" + " )");
                List <VAT_LeaveData> VATLeaveData    = dataTable.ToList <VAT_LeaveData>();
                e.DataSources.Add(new ReportDataSource("DataSet1", VATLeaveData));
            };
            rv.LocalReport.Refresh();
            return(rv);
        }
        public void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
        {
            string           EmpNo = e.Parameters["EmployeeID"].Values.First().ToString();
            VMSelectedFilter vmf   = Session["FiltersModel"] as VMSelectedFilter;
            int                  FinancialYearID = ATAssistant.GetFinancialYearID((DateTime)vmf.DateTo, DDService.GetFinancialYear());
            FinancialYear        dbFinancialYear = DDService.GetFinancialYear().Where(aa => aa.PFinancialYearID == FinancialYearID).First();
            DataTable            dataTable       = QueryBuilder.GetValuesfromDB("select * from VAT_LeaveData  where OEmpID='" + EmpNo + "' and (AttDate >= " + "'" + dbFinancialYear.FYStartDate.Value.ToString("yyyy-MM-ddd") + "'" + " and AttDate <= " + "'" + dbFinancialYear.FYEndDate.Value.ToString("yyyy-MM-ddd") + "'" + " )");
            List <VAT_LeaveData> VATLeaveData    = dataTable.ToList <VAT_LeaveData>();

            e.DataSources.Add(new ReportDataSource("DataSet1", VATLeaveData));
        }
Ejemplo n.º 3
0
        // GET: Reporting/ReportManager
        public ActionResult Index()
        {
            VMSelectedFilter vmf = new VMSelectedFilter();

            Session["FiltersModel"] = vmf;
            PayrollPeriod prp = ATAssistant.GetPayrollPeriodObject(DateTime.Today, DDService.GetPayrollPeriod());

            if (vmf.DateFrom == null)
            {
                vmf.DateFrom = prp.PRStartDate;
            }
            if (vmf.DateTo == null)
            {
                vmf.DateTo = prp.PREndDate;
            }
            return(View(vmf));
        }
Ejemplo n.º 4
0
        public ActionResult EditRosterSave(FormCollection form)
        {
            int noOfDays = Convert.ToInt16(Request.Form["noOfDays"].ToString());
            List <RosterAttributes> rosters = new List <RosterAttributes>();
            int _RotaAppID = Convert.ToInt32(Request.Form["RotaAppID"].ToString());

            DeleteRosterList(_RotaAppID);
            for (int i = 1; i < noOfDays; i++)
            {
                rosters.Add(new RosterAttributes()
                {
                    DutyTime = ATAssistant.ConvertTime(Request.Form["DT-" + i.ToString()].ToString()),
                    DutyDate = Convert.ToDateTime(Request.Form["Date-" + i.ToString()]),
                    WorkMin  = Convert.ToInt32(Request.Form["WM-" + i.ToString()])
                });
            }
            SaveEditRosterEntries(rosters, _RotaAppID);

            ViewBag.ErrorList = "";
            CreateHelper();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                VMSelectedFilter vmf          = Session["FiltersModel"] as VMSelectedFilter;
                VMLoggedUser     LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;
                DataTable        dataTable    = new DataTable();
                ReportPath = "~/Areas/Reporting/RDLC/Attendance/";
                string DateFromS = vmf.DateFrom.Value.ToString("dd-MMM-yyyy");
                string DateToS   = vmf.DateTo.Value.ToString("dd-MMM-yyyy");
                string query     = QueryBuilder.GetReportQueryForLoggedUser(LoggedInUser, db.VHR_EmployeeProfile.ToList());
                if (query != "")
                {
                    query = " and " + query;
                }

                int    FinancialYearID = ATAssistant.GetFinancialYearID((DateTime)vmf.DateTo, db.FinancialYears.OrderByDescending(aa => aa.PFinancialYearID).ToList());
                String reportName      = Request.QueryString["reportname"];
                switch (reportName)
                {
                case "leaveBalanceEmp_report":        ///YEARLY LEAVE BALANCE REPORT
                    List <VHR_EmployeeProfile> dbEmps     = ReportAssistant.GetEmployeeInfo(LoggedInUser, db.VHR_EmployeeProfile.ToList());
                    List <VHR_EmployeeProfile> dbTempEmps = new List <VHR_EmployeeProfile>();
                    dbEmps = AttendanceFilter.ReportsFilterImplementation(vmf, dbTempEmps, dbEmps);
                    List <LeavePolicy> dbLeavePolicies = db.LeavePolicies.ToList();
                    ReportTitle = "Yearly Leave Ledger Report";
                    ReportPath  = ReportPath + "YEmpProRataBalance.rdlc";
                    FinancialYear dbFinancialYear = db.FinancialYears.Where(aa => aa.PFinancialYearID == FinancialYearID).First();
                    DateTitle = dbFinancialYear.FYStartDate.Value.ToString("dd-MM-yyyy") + " TO " + dbFinancialYear.FYEndDate.Value.ToString("dd-MM-yyyy");
                    List <LeaveQuotaYear> dbLeaveQuotaYear = db.LeaveQuotaYears.Where(aa => aa.FinancialYearID == dbFinancialYear.PFinancialYearID).ToList();
                    List <LeaveData>      dbLeaveDatas     = db.LeaveDatas.Where(aa => aa.AttDate >= dbFinancialYear.FYStartDate && aa.AttDate <= dbFinancialYear.FYEndDate && aa.LeaveTypeID == 5).ToList();
                    DateTitle    = "Leave Balance Statement from Year: " + dbFinancialYear.FYName;
                    ReportFooter = "System Generated Report by: " + LoggedInUser.UserName + " at " + DateTime.Now.ToString("hh:mm tt");
                    reportViewer = LoadReport_vMLeaveBalanceWithSR(ReportAssistant.GetYearlyLeaveBalance(dbEmps, dbFinancialYear, dbLeaveQuotaYear, dbLeavePolicies, dbLeaveDatas, db), reportViewer);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        public ActionResult Create2(VMRosterModel vm)
        {
            List <RosterAttributes> rosterAttributeList = new List <RosterAttributes>();
            VAT_Shift _selectedShift = DDService.GetShift().Where(aa => aa.PShiftID == vm.ShiftID).First();
            int       _RotaAppID     = Convert.ToInt32(Request.Form["RotaAppID"].ToString());


            for (int i = 1; i <= vm.NoOfDays; i++)
            {
                rosterAttributeList.Add(new RosterAttributes()
                {
                    DutyTime = ATAssistant.ConvertTime(Request.Form["DT-" + i.ToString()].ToString()),
                    DutyDate = Convert.ToDateTime(Request.Form["Date-" + i.ToString()]),
                    WorkMin  = Convert.ToInt32(Request.Form["WM-" + i.ToString()])
                });
            }
            VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;

            RosterService.PostCreate2(vm, rosterAttributeList);
            ViewBag.ErrorList = "";
            CreateHelper();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        public ActionResult Create(DailyOvertime obj)
        {
            string _EmpNo = Request.Form["EmpNo"].ToString();
            Expression <Func <VHR_EmployeeProfile, bool> > SpecificEntries121 = c => c.OEmpID == _EmpNo;
            VMLoggedUser LoggedInUser       = Session["LoggedInUser"] as VMLoggedUser;
            List <VHR_EmployeeProfile> _emp = vHR_EmployeeProfile.GetIndexSpecific(SpecificEntries121);

            if (obj.OTDate == null || obj.OTDate <= DateTime.Today.AddDays(-200))
            {
                ModelState.AddModelError("OTDate", "OT Date must be valid");
            }
            else
            {
                if (!DDService.IsDateLieBetweenActivePayroll(obj.OTDate.Value))
                {
                    ModelState.AddModelError("OTDate", "Payroll Period is Closed for this date");
                }
            }
            if ((obj.SingleEncashableOT == null && obj.SingleEncashableOT <= 0) && (obj.DoubleEncashbaleOT == null && obj.DoubleEncashbaleOT <= 0) && (obj.CPLOT == null && obj.CPLOT <= 0))
            {
                ModelState.AddModelError("SingleEncashableOT", "Overtime must be valid");
            }
            if (_emp.Count == 0)
            {
                ModelState.AddModelError("OTDate", "Emp No not exist");
            }
            else
            {
                // int? EmpLocID = _emp.First().LocationID;
                //if (LoggedInUser.UserLoctions.Where(aa => aa.LocationID == EmpLocID).Count() == 0)
                //ModelState.AddModelError("OTDate", "You do not have rights to add overtime for this employee");
                int?EmpDepID = _emp.First().OUCommonID;
                if (LoggedInUser.UserDepartments.Where(aa => aa.DepartmentID == EmpDepID).Count() == 0)
                {
                    ModelState.AddModelError("OTDate", "You do not have rights to add overtime for this employee");
                }
                obj.EmployeeID = _emp.First().PEmployeeID;
                Expression <Func <DailyOvertime, bool> > SpecificEntries2 = c => c.EmployeeID == obj.EmployeeID && c.OTDate == obj.OTDate;
                if (DailyOvertimeService.GetIndexSpecific(SpecificEntries2).Count > 0)
                {
                    ModelState.AddModelError("OTDate", "Already have OT for this date");
                }
            }

            if (ModelState.IsValid)
            {
                if (obj.SingleEncashableOT > 0)
                {
                    obj.SingleEncashableOT = obj.SingleEncashableOT * 60;
                }
                if (obj.DoubleEncashbaleOT > 0)
                {
                    obj.DoubleEncashbaleOT = obj.DoubleEncashbaleOT * 60;
                }
                if (obj.CPLOT > 0)
                {
                    obj.CPLOT = obj.CPLOT * 60;
                }
                obj.AddedByUserID = LoggedInUser.PUserID;
                obj.AddedDate     = DateTime.Now;
                DailyOvertimeService.PostCreate(obj);
                // Update Attendance Data
                Expression <Func <DailyAttendance, bool> > SpecificEntries2 = c => c.EmpID == obj.EmployeeID && c.AttDate == obj.OTDate;
                List <DailyAttendance> attDatas = DailyAttendanceService.GetIndexSpecific(SpecificEntries2).ToList();
                if (attDatas.Count > 0)
                {
                    DailyAttendance attdata = attDatas.First();
                    if (obj.SingleEncashableOT > 0)
                    {
                        attdata.ApprovedOT = (short)obj.SingleEncashableOT;
                    }
                    if (obj.DoubleEncashbaleOT > 0)
                    {
                        attdata.ApprovedDoubleOT = (short)obj.DoubleEncashbaleOT;
                    }
                    if (obj.CPLOT > 0)
                    {
                        attdata.ApprovedCPL = (short)obj.CPLOT;
                    }
                    DailyAttendanceService.PostEdit(attdata);
                    DDService.ProcessMonthlyAttendance((DateTime)obj.OTDate, (int)obj.EmployeeID, obj.EmployeeID.ToString());
                    // Update Employee Pool
                    LeaveCPLPool dbLeavePoolCPL = new LeaveCPLPool();
                    Expression <Func <LeaveCPLPool, bool> > SpecificEntries3 = c => c.EmployeeID == obj.EmployeeID;

                    if (LeaveCPLPoolService.GetIndexSpecific(SpecificEntries3).Count() > 0)
                    {
                        dbLeavePoolCPL = LeaveCPLPoolService.GetIndexSpecific(SpecificEntries3).First();
                        dbLeavePoolCPL.LastEntryDateTime = DateTime.Now;
                        dbLeavePoolCPL.RemainingHours    = dbLeavePoolCPL.RemainingHours + (obj.CPLOT / 60);
                        if (dbLeavePoolCPL.RemainingHours == null)
                        {
                            dbLeavePoolCPL.RemainingHours = 0;
                            dbLeavePoolCPL.RemainingHours = (dbLeavePoolCPL.RemainingHours) + (obj.CPLOT / 60);
                        }
                        dbLeavePoolCPL.TotalHours = (dbLeavePoolCPL.TotalHours) + (obj.CPLOT / 60);
                        if (dbLeavePoolCPL.TotalHours == null)
                        {
                            dbLeavePoolCPL.TotalHours = 0;
                            dbLeavePoolCPL.TotalHours = (dbLeavePoolCPL.TotalHours) + (obj.CPLOT / 60);
                        }
                        dbLeavePoolCPL.CPLDays = 0;
                        LeaveCPLPoolService.PostEdit(dbLeavePoolCPL);
                    }
                    else
                    {
                        dbLeavePoolCPL                   = new LeaveCPLPool();
                        dbLeavePoolCPL.EmployeeID        = obj.EmployeeID;
                        dbLeavePoolCPL.LastEntryDateTime = DateTime.Now;
                        dbLeavePoolCPL.RemainingHours    = obj.CPLOT / 60;
                        dbLeavePoolCPL.TotalHours        = obj.CPLOT / 60;
                        dbLeavePoolCPL.CPLDays           = 0;
                        LeaveCPLPoolService.PostCreate(dbLeavePoolCPL);
                    }
                    // Update CPL
                    if (dbLeavePoolCPL.RemainingHours >= 4)
                    {
                        int   total     = (int)(dbLeavePoolCPL.RemainingHours / 4);
                        float remaining = (float)(dbLeavePoolCPL.RemainingHours - (total * 4));
                        float days      = (float)(total / 2.0);
                        // Add into CPL Balance
                        LeaveCPLEmpBalance dbLeaveBalanceCPL = new LeaveCPLEmpBalance();
                        dbLeaveBalanceCPL.EmployeeID    = obj.EmployeeID;
                        dbLeaveBalanceCPL.EntryDateTime = DateTime.Now;
                        dbLeaveBalanceCPL.ExpireDate    = DateTime.Today.AddDays(60);
                        dbLeaveBalanceCPL.IsExpire      = false;
                        dbLeaveBalanceCPL.RemainingDays = days;
                        dbLeaveBalanceCPL.TotalDays     = days;
                        dbLeaveBalanceCPL.Used          = 0;
                        LeaveCPLEmpBalanceService.PostCreate(dbLeaveBalanceCPL);
                        // update CPL Pool
                        dbLeavePoolCPL.RemainingHours = dbLeavePoolCPL.RemainingHours - (days * 8);
                        //dbLeavePoolCPL.RemainingHours = dbLeavePoolCPL.RemainingHours + remaining;
                        LeaveCPLPoolService.PostEdit(dbLeavePoolCPL);
                        // Get PayrollPeriod
                        PayrollPeriod dbPayrollPeriod = ATAssistant.GetPayrollPeriodObject(obj.OTDate.Value, DDService.GetAllPayrollPeriod());
                        // Update Days in Leave Quota
                        LeaveQuotaYear dbLeaveQuotaYear = new LeaveQuotaYear();
                        Expression <Func <LeaveQuotaYear, bool> > SpecificEntries4 = c => c.FinancialYearID == dbPayrollPeriod.FinancialYearID && c.EmployeeID == obj.EmployeeID && c.LeaveTypeID == 4;
                        if (LeaveQuotaYearService.GetIndexSpecific(SpecificEntries4).Count > 0)
                        {
                            dbLeaveQuotaYear                 = LeaveQuotaYearService.GetIndexSpecific(SpecificEntries4).First();
                            dbLeaveQuotaYear.GrandTotal      = dbLeaveQuotaYear.GrandTotal + days;
                            dbLeaveQuotaYear.GrandRemaining  = dbLeaveQuotaYear.GrandRemaining + days;
                            dbLeaveQuotaYear.YearlyTotal     = dbLeaveQuotaYear.YearlyTotal + days;
                            dbLeaveQuotaYear.YearlyRemaining = dbLeaveQuotaYear.YearlyRemaining + days;
                            LeaveQuotaYearService.PostEdit(dbLeaveQuotaYear);
                        }
                        else
                        {
                            dbLeaveQuotaYear.EmployeeID      = obj.EmployeeID;
                            dbLeaveQuotaYear.FinancialYearID = dbPayrollPeriod.FinancialYearID;
                            dbLeaveQuotaYear.LeaveTypeID     = 4;
                            dbLeaveQuotaYear.GrandTotal      = 0;
                            dbLeaveQuotaYear.GrandRemaining  = 0;
                            dbLeaveQuotaYear.YearlyTotal     = 0;
                            dbLeaveQuotaYear.YearlyRemaining = 0;
                            dbLeaveQuotaYear.GrandTotal      = dbLeaveQuotaYear.GrandTotal + days;
                            dbLeaveQuotaYear.GrandRemaining  = dbLeaveQuotaYear.GrandRemaining + days;
                            dbLeaveQuotaYear.YearlyTotal     = dbLeaveQuotaYear.YearlyTotal + days;
                            dbLeaveQuotaYear.YearlyRemaining = dbLeaveQuotaYear.YearlyRemaining + days;
                            LeaveQuotaYearService.PostCreate(dbLeaveQuotaYear);
                        }
                    }
                }
                //DDService.SaveAuditLog(LoggedInUser.PUserID, AuditFormAttendance.Crew, AuditTypeCommon.Add, obj.PDailyOTID, App_Start.AppAssistant.GetClientMachineInfo());
                return(Json("OK", JsonRequestBehavior.AllowGet));
            }
            return(PartialView("Create", obj));
        }
        // GET: Reporting/AttendanceContainer
        public ActionResult Index()
        {
            String           reportName   = Request.QueryString["reportName"];
            VMSelectedFilter vmf          = Session["FiltersModel"] as VMSelectedFilter;
            VMLoggedUser     LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;
            DataTable        dataTable    = new DataTable();

            ReportPath            = "~/Areas/Reporting/RDLC/Attendance/";
            PerformanceReportPath = "~/Areas/Reporting/RDLC/Performance/";
            string DateFromS = vmf.DateFrom.Value.ToString("dd-MMM-yyyy");
            string DateToS   = vmf.DateTo.Value.ToString("dd-MMM-yyyy");
            string query     = QueryBuilder.GetReportQueryForLoggedUser(LoggedInUser, DDService.GetEmployeeInfo());

            if (query != "")
            {
                query = " and " + query;
            }
            DateTitle = DateFromS + " TO " + DateToS;
            if (vmf.SelectedCompany.Count() == 1)
            {
                if (vmf.SelectedCompany.First().FilterID == 1)
                {
                    CompanyHeader = "BCL - ";
                }
                else if (vmf.SelectedCompany.First().FilterID == 2)
                {
                    CompanyHeader = "A1 - ";
                }
                else
                {
                    CompanyHeader = "Other - ";
                }
            }
            if (vmf.SelectedCompany.Count() == 0 || vmf.SelectedCompany == null)
            {
                CompanyHeader = "";
            }
            // Initilize Report
            ReportViewer reportViewer = new ReportViewer()
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Pixel(1200),
                Height = Unit.Pixel(1300)
            };

            int PayrollPeriodIDStart = ATAssistant.GetPayrollPeriodIDStart((DateTime)vmf.DateFrom, DDService.GetAllPayrollPeriod());
            int PayrollPeriodIDEnd   = ATAssistant.GetPayrollPeriodIDEnd((DateTime)vmf.DateTo, DDService.GetAllPayrollPeriod());
            int FinancialYearID      = ATAssistant.GetFinancialYearID((DateTime)vmf.DateTo, DDService.GetFinancialYear());

            reportViewer.ProcessingMode          = ProcessingMode.Local;
            reportViewer.LocalReport.DisplayName = CompanyHeader + ReportTitle;
            System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
            reportViewer.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.EnableExternalImages = true;
            ReportFooter = "System Generated Report by: " + LoggedInUser.UserName + " at " + DateTime.Now.ToString("hh:mm tt");
            switch (reportName)
            {
                #region ------Monthly Attendance Reports-------
            case "detailed_att":         //EMPLOYEE DETAILED ATTENDANCE REPORT  CAN BE GENERATED DAILY
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " ) " + query);
                List <VAT_DailyAttendance> VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                List <VAT_DailyAttendance> TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle = "Employee Detailed Attendence Report";

                ReportPath   = ReportPath + "EmpAttSummary.rdlc";
                reportViewer = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "monthly_attendance":       //MONTHLY ATTENDANCE SUMMARY REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_MonthlySummary where (PayrollPeriodID >=" + PayrollPeriodIDStart + " and PayrollPeriodID <=" + PayrollPeriodIDEnd + " )" + query);
                List <VAT_MonthlySummary> VATMonthlySummary     = dataTable.ToList <VAT_MonthlySummary>();
                List <VAT_MonthlySummary> TMP_VATMonthlySummary = new List <VAT_MonthlySummary>();
                ReportTitle  = "Employee Monthly Attendance Report";
                ReportPath   = ReportPath + "MRSummary.rdlc";
                reportViewer = LoadReport_VATMonthlySummary(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATMonthlySummary, VATMonthlySummary), reportViewer);
                break;

            case "overtime_summaryreport":     ///MONTHLY OVERTIME SUMMARY REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_MonthlySummary  where ((EncashbaleSingleOT>0 or EncashbaleDoubleOT>0 or CPLConversionOT>0) and PayrollPeriodID=" + PayrollPeriodIDStart + " )" + query);
                List <VAT_MonthlySummary> VATMonthlySummary1     = dataTable.ToList <VAT_MonthlySummary>();
                List <VAT_MonthlySummary> TMP_VATMonthlySummary1 = new List <VAT_MonthlySummary>();
                ReportTitle  = "Monthly Overtime Summary Report";
                ReportPath   = ReportPath + "MonthlyOvertimeSummary.rdlc";
                reportViewer = LoadReport_VATMonthlySummary(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATMonthlySummary1, VATMonthlySummary1), reportViewer);
                break;

            case "monthly_attendanceedit":     ///MONTHLY ATTENDANCE EDIT REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_MonthDataEdit where (PayrollPeriodID >=" + PayrollPeriodIDStart + " and PayrollPeriodID <=" + PayrollPeriodIDEnd + " )" + query);
                List <VAT_MonthDataEdit> VATMonthDataEdit     = dataTable.ToList <VAT_MonthDataEdit>();
                List <VAT_MonthDataEdit> TMP_VATMonthDataEdit = new List <VAT_MonthDataEdit>();
                ReportTitle  = "Monthly Attendance Edit Report";
                ReportPath   = ReportPath + "MonthlyAttendanceEdit.rdlc";
                reportViewer = LoadReport_VATMonthDataEdit(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATMonthDataEdit, VATMonthDataEdit), reportViewer);
                break;

            case "monthly_overtimeapproval":     ///MONTHLY OVERTIME APPROVAL REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_OvertimeHistory where (PayrollPeriodID >=" + PayrollPeriodIDStart + " and PayrollPeriodID <=" + PayrollPeriodIDEnd + " )" + query);
                List <VAT_OvertimeHistory> VATOvertimeHistory     = dataTable.ToList <VAT_OvertimeHistory>();
                List <VAT_OvertimeHistory> TMP_VATOvertimeHistory = new List <VAT_OvertimeHistory>();
                ReportTitle  = "Monthly Overtime Approval History Report";
                ReportPath   = ReportPath + "OvertimeApprovalHistory.rdlc";
                reportViewer = LoadReport_VATOvertimeHistory(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATOvertimeHistory, VATOvertimeHistory), reportViewer);
                break;

                #endregion
                #region --------Daily Attendance Reports----------------
            case "consolidated_attendance":     //CONSOLIDATED ATTENDANCE REPORT
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Employee Consolidated Report";
                ReportPath             = ReportPath + "DRConsolidated.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "daily_attendance_summary":
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Daily Attendance Summary Report";
                ReportPath             = ReportPath + "SMDailyAtt.rdlc";
                reportViewer           = LoadReport_DailyAttendanceSummary(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "consolidated_attendance_download":       //CONSOLIDATED ATTENDANCE DOWNLOADER
                List <VHR_EmployeeProfile> VHREmployeeProfile2     = DDService.GetEmployeeInfo(LoggedInUser);
                List <VHR_EmployeeProfile> TMP_vHREmployeeProfile2 = new List <VHR_EmployeeProfile>();
                VHREmployeeProfile2 = AttendanceFilter.ReportsFilterImplementation(vmf, TMP_vHREmployeeProfile2, VHREmployeeProfile2);
                string val = "";
                val = AttReportingService.GetDailyReportInExcel(VHREmployeeProfile2, LoggedInUser, Convert.ToDateTime(DateFromS), Convert.ToDateTime(DateToS));
                if (val != "")
                {
                    byte[] fileBytes = System.IO.File.ReadAllBytes(val);
                    string fileName  = "ConsolidatedReport.xls";
                    return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
                }
                break;

            case "missing_attendance":     /// EMPLOYEE'S MISSING ATTENDANCE REPORTS
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where ((TimeIn is null and TimeOut is not null) or (TimeIn is not null and TimeOut is null)) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Employee Missing Attendence Report";
                ReportPath             = ReportPath + "DRMissingAtt.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "multipleinout_attendance":     /// EMPLOYEE'S MULTIPLE IN/OUT REPORTS
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendanceDetail  where (Tin1 is not null or Tout1 is not null) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                List <VAT_DailyAttendanceDetail> VATDailyAttendanceDetail     = dataTable.ToList <VAT_DailyAttendanceDetail>();
                List <VAT_DailyAttendanceDetail> TMP_VATDailyAttendanceDetail = new List <VAT_DailyAttendanceDetail>();
                ReportTitle  = "Employee Multiple In/Out Report";
                ReportPath   = ReportPath + "DRMultipleInOut.rdlc";
                reportViewer = LoadReport_VATDailyAttendanceDetail(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendanceDetail, VATDailyAttendanceDetail), reportViewer);
                break;

            case "present_attendance":     ///PRESENT EMPLOYEE REPORT
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (PDays>0) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Present Employees Report";
                ReportPath             = ReportPath + "DRPresent.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "absent_attendance":      //ABSENT EMPLOYEES REPORT
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (AbDays>0) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Absent Employees Report";
                ReportPath             = ReportPath + "DRAbsent.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "latein_attendance":      ///LATE IN EMPLOYEES REPORT
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (LateIn>0) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "LateIn Employees Report";
                ReportPath             = ReportPath + "DRLateIn.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "lateout_attendance":
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (LateOut>0) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "LateOut Employees Report";
                ReportPath             = ReportPath + "DRLateOut.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "earlyin_attendance":
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (EarlyIn>0) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "EarlyIn Employees Report";
                ReportPath             = ReportPath + "DREarlyIn.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "earlyout_attendance":
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (EarlyOut>0) and (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "EarlyOut Employees Report";
                ReportPath             = ReportPath + "DREarlyOut.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "overtime_attendance":
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where ((ApprovedOT>0 or ApprovedDoubleOT>0 or ApprovedCPL>0 ) and AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Employees Overtime Report";
                ReportPath             = ReportPath + "DROverTime.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "edit_attendance":      ////WHO EDITED ATTENDANCE AND WHEN REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttedanceEdit  where (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " ) " + QueryBuilder.GetReportQueryForLoggedUser2(LoggedInUser, DDService.GetEmployeeInfo()));
                List <VAT_DailyAttedanceEdit> VATDailyAttedanceEdit      = dataTable.ToList <VAT_DailyAttedanceEdit>();
                List <VAT_DailyAttedanceEdit> TMP_VATDailyAttendanceEdit = new List <VAT_DailyAttedanceEdit>();
                ReportTitle  = "Manual Attendance User Log Report";
                ReportPath   = ReportPath + "EditAttendanceLog.rdlc";
                reportViewer = LoadReport_VATDailyAttedanceEdit(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendanceEdit, VATDailyAttedanceEdit), reportViewer);
                break;

                #endregion
                #region -------LEAVE REPORTS------------
            case "leave_report":       /// EMPLOYEEWISE LEAVE REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_LeaveData  where  (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                List <VAT_LeaveData> VATLeaveData     = dataTable.ToList <VAT_LeaveData>();
                List <VAT_LeaveData> TMP_VATLeaveData = new List <VAT_LeaveData>();
                ReportTitle  = "Employee wise consolidated Leave Report";
                ReportPath   = ReportPath + "DRLeave.rdlc";
                reportViewer = LoadReport_VATLeaveData(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATLeaveData, VATLeaveData), reportViewer);
                break;

            case "leavedatewise_report":          //DATEWISE LEAVE REPORT
                dataTable        = QueryBuilder.GetValuesfromDB("select * from VAT_LeaveData  where (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " )" + query);
                VATLeaveData     = dataTable.ToList <VAT_LeaveData>();
                TMP_VATLeaveData = new List <VAT_LeaveData>();
                ReportTitle      = "Date wise Leave Report";
                ReportPath       = ReportPath + "DRLeaveDate.rdlc";
                reportViewer     = LoadReport_VATLeaveData(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATLeaveData, VATLeaveData), reportViewer);
                break;

            case "leavebalance_report":        ///YEARLY LEAVE BALANCE REPORT
                List <VHR_EmployeeProfile> VHREmployeeProfile     = DDService.GetEmployeeInfo(LoggedInUser);
                List <VHR_EmployeeProfile> TMP_vHREmployeeProfile = new List <VHR_EmployeeProfile>();
                VHREmployeeProfile = AttendanceFilter.ReportsFilterImplementation(vmf, TMP_vHREmployeeProfile, VHREmployeeProfile);
                ReportTitle        = "Yearly Leave Ledger Report";
                ReportPath         = ReportPath + "DRLeaveBalance.rdlc";
                DateTitle          = "Yearly Leaves Balance Statement";
                reportViewer       = LoadReport_vMLeaveBalance(AttReportingService.GetYearlyLeaveBalance(VHREmployeeProfile, FinancialYearID), reportViewer);
                break;

            case "monthlyleavebalance_report":     //MONTHLY LEAVE BALANCE REPORT
                List <VHR_EmployeeProfile> VHREmployeeProfile1     = DDService.GetEmployeeInfo(LoggedInUser);
                List <VHR_EmployeeProfile> TMP_vHREmployeeProfile1 = new List <VHR_EmployeeProfile>();
                VHREmployeeProfile = AttendanceFilter.ReportsFilterImplementation(vmf, TMP_vHREmployeeProfile1, VHREmployeeProfile1.Where(aa => aa.Status == "Active").ToList());
                ReportTitle        = "Monthly Leave Ledger Report";
                ReportPath         = ReportPath + "DRMonthlyLeaveData.rdlc";
                reportViewer       = LoadReport_vMMonthlyLeaveBalance(AttReportingService.GetMonthlyLeaveBalance(VHREmployeeProfile, FinancialYearID, Convert.ToDateTime(DateFromS), Convert.ToDateTime(DateToS)), reportViewer);
                break;

            case "leaveBalanceEmp_report":        ///YEARLY LEAVE BALANCE REPORT
                VHREmployeeProfile     = DDService.GetEmployeeInfo(LoggedInUser);
                TMP_vHREmployeeProfile = new List <VHR_EmployeeProfile>();
                VHREmployeeProfile     = AttendanceFilter.ReportsFilterImplementation(vmf, TMP_vHREmployeeProfile, VHREmployeeProfile);
                ReportTitle            = "Yearly Leave Ledger Report";
                ReportPath             = ReportPath + "YEmpLeaveBalance.rdlc";
                FinancialYear dbFinancialYear = DDService.GetFinancialYear().Where(aa => aa.PFinancialYearID == FinancialYearID).First();
                DateTitle    = "Leave Balance Statement from Year: " + dbFinancialYear.FYName;
                reportViewer = LoadReport_vMLeaveBalanceWithSR(AttReportingService.GetYearlyLeaveBalance(VHREmployeeProfile, FinancialYearID), reportViewer);
                break;

            case "cplexpire_report":        ///CPL Expire report REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_CPLBalance  where  (ExpireDate >= " + "'" + DateFromS + "'" + " and ExpireDate <= " + "'" + DateToS + "'" + " and IsExpire = 1)" + query);
                List <VAT_CPLBalance> VATCPLBalance     = dataTable.ToList <VAT_CPLBalance>();
                List <VAT_CPLBalance> TMP_VATCPLBalance = new List <VAT_CPLBalance>();
                ReportTitle  = "CPL Balance report";
                ReportPath   = ReportPath + "CPLExpire.rdlc";
                reportViewer = LoadReport_VATCPLBalance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATCPLBalance, VATCPLBalance), reportViewer);
                break;

                #endregion
                #region ---------MISCELLANEOUS REPORTS-----------------
            case "devicedata_report":      //DEVICE DATA REPORT
                dataTable = QueryBuilder.GetValuesfromDB("select * from VAT_DeviceData  where (EntDate >= " + "'" + DateFromS + "'" + " and EntDate <= " + "'" + DateToS + "'" + " )" + query);
                List <VAT_DeviceData> VATDeviceData     = dataTable.ToList <VAT_DeviceData>();
                List <VAT_DeviceData> TMP_VATDeviceData = new List <VAT_DeviceData>();
                ReportTitle  = "Device Data Report";
                ReportPath   = ReportPath + "DRDeviceData.rdlc";
                reportViewer = LoadReport_VATDeviceData(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDeviceData, VATDeviceData), reportViewer);
                break;

            case "unregatt_report":    // Un registered employees
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VAT_DailyAttendance  where (AttDate >= " + "'" + DateFromS + "'" + " and AttDate <= " + "'" + DateToS + "'" + " and LocationID = " + "'" + 144 + "'" + " )");
                VATDailyAttendance     = dataTable.ToList <VAT_DailyAttendance>();
                TMP_VATDailyAttendance = new List <VAT_DailyAttendance>();
                ReportTitle            = "Un-registered Employee Consolidated Report";
                ReportPath             = ReportPath + "DRUnRegEmpAtt.rdlc";
                reportViewer           = LoadReport_VATDailyAttendance(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_VATDailyAttendance, VATDailyAttendance), reportViewer);
                break;

            case "employee_record":
                dataTable              = QueryBuilder.GetValuesfromDB("select * from VHR_EmployeeProfile");
                VHREmployeeProfile     = dataTable.ToList <VHR_EmployeeProfile>();
                TMP_vHREmployeeProfile = new List <VHR_EmployeeProfile>();
                ReportTitle            = "Employee Records";
                ReportPath             = ReportPath + "HREmployeeDetail.rdlc";
                reportViewer           = LoadReport_VHREmployeeProfile(AttendanceFilter.ReportsFilterImplementation(vmf, TMP_vHREmployeeProfile, VHREmployeeProfile), reportViewer);
                break;
                #endregion
            }
            ViewBag.ReportViewer = reportViewer;
            return(View());
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> GetSystemNotification()
        {
            return(await Task.Run(() =>
            {
                StringBuilder list = new StringBuilder();
                VMLoggedUser LoggedInUser = Session["LoggedInUser"] as VMLoggedUser;
                List <VHR_EmployeeProfile> vmList = new List <VHR_EmployeeProfile>();
                int NotificationCount = 0;
                VMNotification vmNotification = new VMNotification();
                if (LoggedInUser.UserAccessTypeID == 2 || LoggedInUser.UserAccessTypeID == 1)
                {
                    if (LoggedInUser.UserAccessTypeID == Convert.ToInt32(UserAccessType.AllEmployees))
                    {
                        Expression <Func <VHR_EmployeeProfile, bool> > SpecificEntries = c => c.Status == "Active";
                        vmList = VHREmployeeService.GetIndexSpecific(SpecificEntries);
                    }
                    else if (LoggedInUser.UserAccessTypeID == Convert.ToInt32(UserAccessType.LocationBased))
                    {
                        if (LoggedInUser.UserLoctions != null)
                        {
                            foreach (var userLocaion in LoggedInUser.UserLoctions)
                            {
                                Expression <Func <VHR_EmployeeProfile, bool> > SpecificEntries = c => c.LocationID == userLocaion.LocationID && c.Status == "Active" && c.Status == "Active";
                                vmList.AddRange(VHREmployeeService.GetIndexSpecific(SpecificEntries));
                            }
                        }
                    }
                    if (vmList.Count > 0)
                    {
                        if (vmList.Where(aa => aa.ShiftID == null).Count() > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                                   "Shifts are not assigned to " + vmList.Where(aa => aa.ShiftID == null).Count().ToString() + " employees.", "Incomplete employee Information", GenerateLinkForSystemNotifications("Shift").ToString()));
                        }
                        if (vmList.Where(aa => aa.LineManagerID == null).Count() > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-commit", "btn border-warning text-warning btn-flat btn-rounded btn-icon btn-sm",
                                                                   "Line Managers are not assigned to " + vmList.Where(aa => aa.LineManagerID == null).Count().ToString() + " employees.", "Incomplete employee Information", GenerateLinkForSystemNotifications("LM").ToString()));
                        }
                        if (vmList.Where(aa => aa.CrewID == null).Count() > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                                   "Crews are not assigned to " + vmList.Where(aa => aa.CrewID == null).Count().ToString() + " employees.", "Incomplete employee Information", GenerateLinkForSystemNotifications("Crew").ToString()));
                        }
                        if (vmList.Where(aa => aa.FPID == null).Count() > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                                   "FPIDs are not assigned to " + vmList.Where(aa => aa.FPID == null).Count().ToString() + " employees.", "Incomplete employee Information", GenerateLinkForSystemNotifications("FPID").ToString()));
                        }
                        // Ccheck for employees wjo dows not have leave balance

                        int FinYearID = ATAssistant.GetFinancialYearID(DateTime.Today, DDService.GetFinancialYear());
                        Expression <Func <LeaveQuotaYear, bool> > SpecificEntries2 = c => c.FinancialYearID == FinYearID;
                        int EmpWithNoQuota = AppAssistant.GetEmployeeWithNoLeaveQuota(LeaveQuotaYearService.GetIndexSpecific(SpecificEntries2).ToList(), vmList);
                        if (EmpWithNoQuota > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                                   "Leave Quota are not assigned to " + EmpWithNoQuota.ToString() + " employees.", "Incomplete employee Information", GenerateLinkForSystemNotifications("LQ").ToString()));
                        }
                    }

                    if (LoggedInUser.UserAccessTypeID == 3)
                    {
                        Expression <Func <VHR_OrganizationalUnit, bool> > SpecificEntries2 = c => c.OUCommonID == null;
                        List <VHR_OrganizationalUnit> OUList = VHROrganizationalUnitService.GetIndexSpecific(SpecificEntries2);
                        if (OUList.Count() > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-merge", "btn border-success text-success btn-flat btn-rounded btn-icon btn-sm",
                                                                   "Common OU are not assigned to " + OUList.Count().ToString() + " orgaizational units.", "Incomplete Organizatinal units Information", GenerateLinkForSystemNotifications("OrganizationalUnit").ToString()));
                        }
                        Expression <Func <VHR_JobTitle, bool> > SpecificEntries3 = c => c.JTCommonID == null;
                        List <VHR_JobTitle> JTList = VHRJobTitleService.GetIndexSpecific(SpecificEntries3);
                        if (JTList.Count() > 0)
                        {
                            NotificationCount++;
                            list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                                   "Common Job titles are not assigned to " + JTList.Count().ToString() + " job titles.", "Incomplete Job Titles Information", GenerateLinkForSystemNotifications("JobTitle").ToString()));
                        }
                    }
                }
                Expression <Func <Notification, bool> > SpecificEntries4 = c => c.UserID == LoggedInUser.PUserID && c.Status == true;
                List <Notification> NotificationList = NotificationService.GetIndexSpecific(SpecificEntries4).OrderByDescending(aa => aa.PNotificationID).ToList();

                foreach (var item in NotificationList.Select(x => new { x.NotificationTypeID, x.NotificationURL }).Distinct())
                {
                    switch (item.NotificationTypeID)
                    {
                    ///ESSP LEAVE  NOTIFICATIONS
                    case 1:     //Pending
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-merge", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Pending Leave Request", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " pending leave application", item.NotificationURL));
                        break;

                    case 2:     //Approved
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Approved Leave Request", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " approved leave application", item.NotificationURL));
                        break;

                    case 3:     //Reject
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Rejected Leave Request", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " rejected leave application", item.NotificationURL));
                        break;

                    ///ESSP LEAVE  NOTIFICATIONS
                    case 10:     //Pending JC
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-merge", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Pending Job Card Request", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " pending job card", item.NotificationURL));
                        break;

                    case 11:     //Approved jc
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Approved Job Card Request", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " approved job card", item.NotificationURL));
                        break;

                    case 12:     //Reject jc
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Rejected Job Card Request", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " rejected job card", item.NotificationURL));
                        break;


                    /// OBJECTIVE SETTING NOTIFICATIONS
                    case 4:     //Pending
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Individual Objective Setting Launched", "Please click above to proceed. ", item.NotificationURL));
                        break;

                    case 5:     //SubmittedToLM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Objective Setting for Review", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " employee's objectives for review.", item.NotificationURL));
                        break;

                    case 6:     //Recommend
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Individual Objective Settings for Approval", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " employee's objectives for review.", item.NotificationURL));
                        break;

                    case 7:     //RevertToEmployee
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Individual Objectives are Reverted", "Please click above to proceed. ", item.NotificationURL));
                        break;

                    case 8:     //RevertToLM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Objective Settings Reverted", "Please click above to proceed. ", item.NotificationURL));
                        break;

                    case 9:     //Approved
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Objectives Sign-off", "Please click above to proceed. ", item.NotificationURL));
                        break;

                    case 13:     //Notification to employee when LM recommends the Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Objectives have been Recommended by Line Manager", "Objectives Approval in Process.", item.NotificationURL));
                        break;

                    case 17:     //Notification to LM when Employee Agrees with Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Agrees with the Objective.", "", item.NotificationURL));
                        break;

                    case 18:    //Notification to LM when Employee DisAgrees with Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Disagrees with the Objective", "", item.NotificationURL));
                        break;

                    /// Annual Appraisals NOTIFICATIONS
                    case 401:     //Pending
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Self Appraisal Launched", "Please click above to proceed ", item.NotificationURL));
                        break;

                    case 402:     //SubmittedToLM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Self Appraisal waiting for your decision", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 403:     //Recommend
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Managers submit annual appraisals", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 404:     //RevertToEmployee
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Annual Appraisal is Reverted", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 405:     //RevertToLM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Annual Appraisal is Reverted", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 406:     //Approved
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Annual Appraisal Approved", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 407:     //Notification to employee when LM recommends the Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Objectives have been Recommended by Line Manager", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 408:     //Notification to LM when Employee Agrees with Annual Appraisal
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Agrees with the Annual Appraisal.", "", item.NotificationURL));
                        break;

                    case 409:    //Notification to LM when Employee DisAgrees with Annual Appraisal
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Disagrees with the Annual Appraisal", "", item.NotificationURL));
                        break;

                    case 410:    //BELL CURVE OK BY DIRECTOR/HOD
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Performance Curve Has been Approved by the HOD", "Please click above to proceed. ", item.NotificationURL));
                        break;

                    ////////////////////////FEEDBACK MEETING NOTIFICATIONS
                    case 14:     //Open
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Performance Feedback Meeting Launched", "Click above to proceed", item.NotificationURL));
                        break;

                    case 15:     //CLOSED BY LM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Performance Feedback Meeting is Closed By LM", "Click here to close Performance Feedback Meeting ", item.NotificationURL));
                        break;

                    case 16:     //Closed
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Performance Feedback Meeting is Closed", "", item.NotificationURL));
                        break;

                    /// MID YEAR REVIEW NOTIFICATIONS
                    case 501:     //Pending
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-branch", "btn border-info text-info btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Review Launched", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 502:     //SubmittedToLM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Pending for Review", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 503:     //Recommend
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Review for Approval", "Please click above .", item.NotificationURL));
                        break;

                    case 504:     //RevertToEmployee
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Review is Reverted", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 505:     //RevertToLM
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Review Reverted", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 506:     //Approved
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Review Sign-off", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 507:     //Notification to employee when LM recommends the Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Mid-Year Review Has been Recommended by Line Manager", "Please click above to proceed.", item.NotificationURL));
                        break;

                    case 508:     //Notification to LM when Employee Agrees with Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Agrees with the Mid-Year Review.", "", item.NotificationURL));
                        break;

                    case 509:    //Notification to LM when Employee DisAgrees with Objective.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Disagrees with the Mid-Year Review", "", item.NotificationURL));
                        break;



                    ////Recruitment Position Approval notifications
                    case 111:     //Pending
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Pending Position Approval", "Please click at above to approve or revert.", item.NotificationURL));
                        break;

                    case 116:     //Approved
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Position Approved", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " approved position.Please click above to view approved position", item.NotificationURL));
                        break;

                    case 117:     //Reject
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Position Reverted", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " reverted position.Please click above to view and again submitt.", item.NotificationURL));
                        break;

                    ////Recruitment Position Requisition notifications
                    case 200:     //InitiateER
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Pending Employee Requisition", "Please click at above to approve or revert.", item.NotificationURL));
                        break;

                    case 201:     //ApprovedER
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Requisition Approval", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " approved employee requisition.Please click above to check candidates for initial shortlisting.", item.NotificationURL));
                        break;

                    case 202:     //Revert ER
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Requisition Reverted", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " reverted employee requisition.Please click above to view and again submitt.", item.NotificationURL));
                        break;

                    case 206:     //Open Shortliting Stage
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Short-listing Open", "Please click at here to view requisition and start shortliting.", item.NotificationURL));
                        break;

                    case 203:     //Initial Shortlisting
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Initial Shortliting", "Please click at above for initial shortlisting.", item.NotificationURL));
                        break;

                    case 204:     //Final Shortlisting
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Final Shortlisting", "Please click at above for Final shortlisting.", item.NotificationURL));
                        break;

                    case 205:     //Interview Schedule
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Final Short-listing Closed", "Please click above to schedule interview for final shortlisted candidates.", item.NotificationURL));
                        break;

                    case 207:     //Test Schedule
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Final Short-listing Closed", "Please click above to schedule test for final shortlisted candidates.", item.NotificationURL));
                        break;

                    case 218:     //Marks Enter
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Test Done", "Please click at above to enter marks of candidates.", item.NotificationURL));
                        break;

                    case 211:     //Test Submission
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Marks Entry Done", "Please click at above to submit marks to HR.", item.NotificationURL));
                        break;

                    case 210:     //Interview Schedule after Test
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Test Stage Completed", "Please click at above to schedule interview.", item.NotificationURL));
                        break;

                    case 212:     //Interview Remarks Entry
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Interview Done", "Please click at above to add remarks against each interview.", item.NotificationURL));
                        break;

                    case 213:     //Interview Submission
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Interview Stage Completed", "Please click at above to create merit list.", item.NotificationURL));
                        break;

                    case 214:     //Interview Submission
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Merit List Submission", "Please click at above to approve merit list.", item.NotificationURL));
                        break;

                    case 215:     //Interview Submission
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Merit List Approved", "Please click at above to see approve merit list.", item.NotificationURL));
                        break;

                    // NOTIFICATION FOR EMPLOYEE PROBATION
                    //RecommendByLM = 601,
                    //RecommendByLM1 = 602,
                    //Approve = 603,
                    //Reject = 604,
                    //RevertToLM = 605,
                    //RevertToLM1 = 606
                    case 601:     //Notification to Line Manager +1 when LM recommends the Probation.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee's Probation Recommended by Line Manager", "Evaluate the Employee's Probation.", item.NotificationURL));
                        break;

                    case 602:     //Notification to Director when LM+1 Approves the Probation.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee's Probation Approved and Recommended by Line Manager +1 ", "Evaluate the Employee's Probation.", item.NotificationURL));
                        break;

                    case 604:     //Notification to LM For Pending Probation.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",

                                                               "Employee's Probation Pending for Recommendation", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " pending Probation Evaluation", item.NotificationURL));

                        break;

                    case 605:     //Notification to LM when LM+1 Reverts the Probation.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee's Probation Reverted by Line Manager +1 ", "Re-Evaluate the Employee's Probation.", item.NotificationURL));
                        break;

                    case 606:     //Notification to LM+1 when Director Reverts the Probation.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee's Probation Reverted By Director", "Re-Evaluate the Employee's Probation.", item.NotificationURL));
                        break;

                    case 607:    //Notification to LM that employee has been Hired
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee has been Hired by the HR Officer", ".", item.NotificationURL));
                        break;

                    case 608:    //Notification to LM that employee extension is expiring
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Extension is going to expire soon", ".", item.NotificationURL));
                        break;

                    case 609:    //Notification to HR
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee Probation Has been Rejected By the Director", ".", item.NotificationURL));
                        break;

                    case 603:    //Notification to HR
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Employee has successfully been probated by Director", "Click above to see the decision", item.NotificationURL));
                        break;

                    // NOTIFICATION FOR Feedback Session
                    //Pending = 1000,
                    //Submitted = 1001,
                    case 1000:     //Notification to Employee When Session Starts.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Feedback Evalution Pending", "Feedback is pending at your desk.Please click at above to view", item.NotificationURL));
                        break;

                    case 1001:     //Notification to Creator When Submitted.
                        NotificationCount++;
                        list.Append(GenerateSingleNotification("icon-git-pull-request", "btn border-primary text-primary btn-flat btn-rounded btn-icon btn-sm",
                                                               "Feedback Evaluation Submitted", "You have " + NotificationList.Where(aa => aa.NotificationTypeID == item.NotificationTypeID).Count().ToString() + " submitted feedback from employees.", item.NotificationURL));
                        break;
                    }
                }
                vmNotification.Notification = list.ToString();
                vmNotification.NotificationCount = NotificationCount.ToString();
                return Json(vmNotification, JsonRequestBehavior.AllowGet);
            }));
        }
Ejemplo n.º 10
0
        public static List <VMLeaveBalance> GetYearlyLeaveBalance(List <VHR_EmployeeProfile> dbEmps, FinancialYear dbFinYear, List <LeaveQuotaYear> dbLeaveQuotaYears, List <LeavePolicy> dbLeavePolicies,
                                                                  List <LeaveData> dbLeaveDatas, ABESSPEntities db)
        {
            List <VMLeaveBalance> vmLeaveBalanceList = new List <VMLeaveBalance>();

            foreach (var dbEmp in dbEmps)
            {
                float          TotalLvDays    = 21;
                VMLeaveBalance vmLeaveBalance = new VMLeaveBalance();
                if (dbEmp.ALPolicyID != null && dbLeavePolicies.Where(aa => aa.PLeavePolicyID == dbEmp.ALPolicyID).Count() > 0)
                {
                    TotalLvDays = (float)dbLeavePolicies.First(aa => aa.PLeavePolicyID == dbEmp.ALPolicyID).TotalDays;
                }
                vmLeaveBalance.PEmployeeID   = dbEmp.PEmployeeID;
                vmLeaveBalance.EmployeeName  = dbEmp.EmployeeName;
                vmLeaveBalance.DOJ           = dbEmp.DOJ;
                vmLeaveBalance.ServiceLength = GetServiceLength(dbEmp.DOJ, dbEmp.ResignDate);
                if (dbEmp.Status == "Resigned")
                {
                    vmLeaveBalance.OEmpID = dbEmp.OEmpID + " (Resigned Date: " + dbEmp.ResignDate.Value.ToString("dd-MM-yyyy") + ")";
                    int PayrollPeriodIDEnd      = ATAssistant.GetPayrollPeriodIDEnd(dbEmp.ResignDate.Value, db.PayrollPeriods.ToList());
                    List <MonthData> monthDatas = db.MonthDatas.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.AbsentDays > 0).ToList();
                    if (monthDatas.Count() > 0)
                    {
                        vmLeaveBalance.Absents = (float)monthDatas.Sum(aa => aa.AbsentDays);
                    }
                }
                else
                {
                    vmLeaveBalance.OEmpID = dbEmp.OEmpID;
                }
                // vmLeaveBalance.OUName = dbEmp.OUName;
                vmLeaveBalance.LocationName       = dbEmp.LocationName;
                vmLeaveBalance.JobTitleName       = dbEmp.JobTitleName;
                vmLeaveBalance.EmploymentTypeName = dbEmp.EmploymentTypeName;
                vmLeaveBalance.LWOP = dbLeaveDatas.Where(aa => aa.EmpID == dbEmp.PEmployeeID && aa.HalfLeave == false).Count() + (dbLeaveDatas.Where(aa => aa.EmpID == dbEmp.PEmployeeID && aa.HalfLeave == true).Count() / 2);
                if (dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 1).Count() > 0) // AL
                {
                    LeaveQuotaYear dbLeaveQuotaYear = dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 1).First();
                    vmLeaveBalance.TotalAL   = dbLeaveQuotaYear.YearlyTotal;
                    vmLeaveBalance.BalanceAL = dbLeaveQuotaYear.YearlyRemaining;
                    vmLeaveBalance.AvailAL   = vmLeaveBalance.TotalAL - vmLeaveBalance.BalanceAL;
                    if (dbEmp.Status == "Resigned")
                    {
                        // Check for if employee join in same financial year
                        float Divider     = 1;
                        float WorkingDays = 0;
                        if (dbEmp.DOJ.Value >= dbFinYear.FYStartDate)
                        {
                            Divider     = (dbFinYear.FYEndDate.Value - dbEmp.DOJ.Value).Days + 1;
                            WorkingDays = (dbEmp.ResignDate.Value - dbEmp.DOJ.Value).Days + 1;
                        }
                        else
                        {
                            Divider     = 365;
                            WorkingDays = (dbEmp.ResignDate.Value - dbFinYear.FYStartDate.Value).Days + 1;
                        }
                        float  ProRataLeave = (float)(vmLeaveBalance.TotalAL * WorkingDays) / Divider;
                        double decimalValue = Math.Round((double)ProRataLeave, 1);
                        vmLeaveBalance.ProrataAL = decimalValue;
                    }
                }
                if (dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 1).Count() > 0) // ACCU
                {
                    LeaveQuotaYear dbLeaveQuotaYear = dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 1).First();
                    vmLeaveBalance.TotalAccum   = dbLeaveQuotaYear.CFFromLastYear;
                    vmLeaveBalance.BalanceAccum = dbLeaveQuotaYear.CFRemaining;
                    vmLeaveBalance.AvailAccum   = vmLeaveBalance.TotalAccum - vmLeaveBalance.BalanceAccum;
                    vmLeaveBalance.ProrataAccum = vmLeaveBalance.BalanceAccum;
                }
                if (dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 2).Count() > 0) // CL
                {
                    LeaveQuotaYear dbLeaveQuotaYear = dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 2).First();
                    vmLeaveBalance.TotalCL   = dbLeaveQuotaYear.YearlyTotal;
                    vmLeaveBalance.BalanceCL = dbLeaveQuotaYear.YearlyRemaining;
                    vmLeaveBalance.AvailCL   = vmLeaveBalance.TotalCL - vmLeaveBalance.BalanceCL;
                }
                if (dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 3).Count() > 0) //SL
                {
                    LeaveQuotaYear dbLeaveQuotaYear = dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 3).First();
                    vmLeaveBalance.TotalSL   = dbLeaveQuotaYear.YearlyTotal;
                    vmLeaveBalance.BalanceSL = dbLeaveQuotaYear.YearlyRemaining;
                    vmLeaveBalance.AvailSL   = vmLeaveBalance.TotalSL - vmLeaveBalance.BalanceSL;
                }
                if (dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 4).Count() > 0) //CPL
                {
                    LeaveQuotaYear dbLeaveQuotaYear = dbLeaveQuotaYears.Where(aa => aa.EmployeeID == dbEmp.PEmployeeID && aa.LeaveTypeID == 4).First();
                    vmLeaveBalance.TotalCPL   = dbLeaveQuotaYear.YearlyTotal;
                    vmLeaveBalance.BalanceCPL = dbLeaveQuotaYear.YearlyRemaining;
                    vmLeaveBalance.AvailCPL   = vmLeaveBalance.TotalCPL - vmLeaveBalance.BalanceCPL;
                }
                vmLeaveBalanceList.Add(vmLeaveBalance);
            }



            return(vmLeaveBalanceList);
        }