コード例 #1
0
ファイル: ReportController.cs プロジェクト: KuldipBhuva/TDMS
        public ActionResult PayrollReport(PayrollItem model)
        {
            List <PayrollItem> payrollItemList = new List <PayrollItem>();
            PayrollService     payrollService  = new PayrollService();
            int?cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            if (cid == 0)
            {
                cid = model.CompId;
            }
            payrollItemList = payrollService.GetPayrollDetailsReport(model.Month, model.Year, cid);
            PayrollItem payrollitem = new PayrollItem();

            payrollitem.lstPayroll = new List <PayrollItem>();
            payrollitem.lstPayroll.AddRange(payrollItemList);
            BindMonthYear();
            List <CompanyItem> clsCompany = new List <CompanyItem>();

            clsCompany             = payrollService.BindCompany();
            payrollitem.lstCompany = new List <CompanyItem>();
            payrollitem.lstCompany.AddRange(clsCompany);
            return(View(payrollitem));
        }
コード例 #2
0
        public ActionResult Create()
        {
            objPayService = new PayrollService();
            objPayItem    = new PayrollItem();

            List <CompanyItem> clsCompany = new List <CompanyItem>();

            clsCompany            = objPayService.BindCompany();
            objPayItem.lstCompany = new List <CompanyItem>();
            objPayItem.lstCompany.AddRange(clsCompany);
            BindMonthYear();

            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            List <PayrollItem> lstPayoll = new List <PayrollItem>();

            lstPayoll             = objPayService.GridPayroll(cid);
            objPayItem.lstPayroll = new List <PayrollItem>();

            objPayItem.lstPayroll.AddRange(lstPayoll);
            return(View(objPayItem));
        }
コード例 #3
0
        public ActionResult Edit(int CompId, int Month, int Year)
        {
            objPayService = new PayrollService();
            objPayItem    = new PayrollItem();
            List <PayrollItem>  PayItem = new List <PayrollItem>();
            List <EmployeeItem> lstEmp  = new List <EmployeeItem>();

            PayItem = objPayService.GetPayrollDetails1(Month, Year, CompId);

            if (PayItem.Count != 0)
            {
                objPayItem.lstPayroll = new List <PayrollItem>();
                TempData["Msg"]       = "EmployeeExists";
                objPayItem.lstPayroll.AddRange(PayItem);
                ViewBag.MonthList = Month;
                ViewBag.YearList  = Year;
            }

            List <CompanyItem> clsCompany = new List <CompanyItem>();

            clsCompany            = objPayService.BindCompany();
            objPayItem.lstCompany = new List <CompanyItem>();
            objPayItem.lstCompany.AddRange(clsCompany);
            BindMonthYear();

            // return View("_List", objPayItem);
            return(View(objPayItem));
        }
コード例 #4
0
ファイル: ReportController.cs プロジェクト: KuldipBhuva/TDMS
        public ActionResult PayrollReport()
        {
            PayrollService payrollService = new PayrollService();
            PayrollItem    payrollitem    = new PayrollItem();
            //List<PayrollItem> payrollItemList = new List<PayrollItem>();
            //payrollItemList = payrollService.GetPayrollDetails1();
            //payrollitem.lstPayroll = new List<PayrollItem>();
            //payrollitem.lstPayroll.AddRange(payrollItemList);

            List <CompanyItem> clsCompany = new List <CompanyItem>();

            clsCompany             = payrollService.BindCompany();
            payrollitem.lstCompany = new List <CompanyItem>();
            payrollitem.lstCompany.AddRange(clsCompany);
            BindMonthYear();
            //return View(objPayItem);
            return(View(payrollitem));
        }
コード例 #5
0
        public ActionResult Create(IEnumerable <EmployeeItem> lstEmployee, PayrollItem payroll, IEnumerable <PayrollItem> lstPayroll)
        {
            string strMsg = "";

            if (TempData["Msg"] != "")
            {
                strMsg = TempData["Msg"].ToString();
            }

            objPayService = new PayrollService();
            List <CompanyItem> clsCompany = new List <CompanyItem>();

            clsCompany            = objPayService.BindCompany();
            objPayItem.lstCompany = new List <CompanyItem>();
            objPayItem.lstCompany.AddRange(clsCompany);
            BindMonthYear();
            var lstEmp = lstEmployee.ToList();

            for (int i = 0; i < lstEmployee.ToList().Count; i++)
            {
                objPayItem = new PayrollItem();

                var ID = lstEmp[i].id;

                objPayItem.Month  = Convert.ToInt32(payroll.Month);
                objPayItem.Year   = Convert.ToInt32(payroll.Year);
                objPayItem.CompId = Convert.ToInt32(payroll.CompId);
                objPayItem.Empid  = lstEmp[i].id;
                objPayItem.OT     = lstEmp[i].OT;
                objPayItem.DA     = lstEmp[i].DA;
                if (payroll.Month == 2)
                {
                    if ((payroll.Year % 4 == 0 && payroll.Year % 100 != 0) || (payroll.Year % 400 == 0))
                    {
                        objPayItem.TotalDays = 29;

                        objPayItem.Days = lstEmp[i].Days;
                    }
                    else
                    {
                        objPayItem.TotalDays = 28;
                        objPayItem.Days      = lstEmp[i].Days;
                    }
                }
                if (payroll.Month == 1 || payroll.Month == 3 || payroll.Month == 5 || payroll.Month == 7 || payroll.Month == 8 || payroll.Month == 10 || payroll.Month == 12)
                {
                    objPayItem.TotalDays = 31;
                    if (lstEmp[i].Days > 31)
                    {
                        objPayItem.lstEmployee = new List <EmployeeItem>();
                        objPayItem.lstEmployee.AddRange(lstEmp);
                        ViewBag.ErrorMsg = "Data Not Successfully Added..Check Proper Days";
                        ModelState.AddModelError(string.Empty, "The item cannot be removed");
                        return(View());
                    }
                    else
                    {
                        objPayItem.Days = lstEmp[i].Days;
                    }
                }
                if (payroll.Month == 4 || payroll.Month == 6 || payroll.Month == 9 || payroll.Month == 11)
                {
                    objPayItem.TotalDays = 30;
                    if (lstEmp[i].Days > 30)
                    {
                        ViewBag.ErrorMsg = "Data Not Successfully Added..Check Proper Days";
                        return(View(objPayItem));
                    }
                    else
                    {
                        objPayItem.Days = lstEmp[i].Days;
                    }
                }
                List <CompanyItem> clsCompany1 = new List <CompanyItem>();
                clsCompany1           = objPayService.BindCompany();
                objPayItem.lstCompany = new List <CompanyItem>();
                objPayItem.lstCompany.AddRange(clsCompany1);
                if (strMsg.ToString() == "")
                {
                    objPayService.InsertPayroll(objPayItem);
                }
                else
                {
                    objPayService.UpdatePayroll(objPayItem);
                }
            }
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            List <PayrollItem> lstPayoll = new List <PayrollItem>();

            lstPayoll             = objPayService.GridPayroll(cid);
            objPayItem.lstPayroll = new List <PayrollItem>();
            objPayItem.lstPayroll.AddRange(lstPayoll);
            ModelState.Clear();
            return(View(objPayItem));
        }