username@email.com
2022-08-27 6e2b929cf381e2320ba6e7dec56c0371124d2b51
zhengcaioa/zhengcaioa/Controllers/HR/SalaryCheckController.cs
@@ -21,9 +21,11 @@
        private readonly IWfRunProcessService _wfRunProcessService;
        private readonly IWfHistoryService _wfHistoryService;
        private readonly IWfNeeddeelService _wfNeeddeelService;
        private readonly IPltPageService _pltPageService;
        public SalaryCheckController(ILogger<SalaryCheckController> logger, IHrSalaryService hrSalaryService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService
            , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService)
            , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
              , IPltPageService pltPageService)
        {
            _logger = logger;            
            _hrDeptService = hrDeptService;
@@ -31,10 +33,13 @@
            _wfRunProcessService = wfRunProcessService;
            _wfHistoryService = wfHistoryService;
            _wfNeeddeelService = wfNeeddeelService;
            _pltPageService = pltPageService;
        }
        public IActionResult Index()
        {
            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
            ViewData["curentuser"] = curentuser;
            List<ActionEntity> actionlist = new List<ActionEntity>();
            ActionEntity actionEntity = new ActionEntity();
            actionEntity.OpenType = 0;
@@ -44,14 +49,25 @@
            actionEntity.ActionName = "查询";
            actionlist.Add(actionEntity);
            ActionEntity actionEntity1 = new ActionEntity();
            actionEntity1.OpenType = 0;
            actionEntity1.ActionUrl = "";
            actionEntity1.ActionFun = "Edit";
            actionEntity1.PageIco = "fa fa-plus";
            actionEntity1.ActionName = "核准";
            actionlist.Add(actionEntity1);
            //ActionEntity actionEntity1 = new ActionEntity();
            //actionEntity1.OpenType = 0;
            //actionEntity1.ActionUrl = "";
            //actionEntity1.ActionFun = "Edit";
            //actionEntity1.PageIco = "fa fa-plus";
            //actionEntity1.ActionName = "核准";
            //actionlist.Add(actionEntity1);
            var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/SalaryCheck/Index");
            var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList();
            foreach (var pageEntity in pageEntities1)
            {
                ActionEntity actionEntity1 = new ActionEntity();
                actionEntity1.OpenType = pageEntity.OpenType;
                actionEntity1.ActionUrl = "";
                actionEntity1.ActionFun = pageEntity.PageShortcut;
                actionEntity1.PageIco = pageEntity.PageIco;
                actionEntity1.ActionName = pageEntity.PageName;
                actionlist.Add(actionEntity1);
            }
            ViewBag.editBtn = false;
                        
            ViewData["ActionInfo"] = actionlist;
@@ -70,6 +86,10 @@
        public IActionResult GetList(HrSalaryDTOSearch search)
        {
            //_hrSalaryService.AutoCheck();
            if (!string.IsNullOrEmpty(search.YearMonth222))
            {
                search.YearMonth = search.YearMonth222;
            }
            return new JsonResult(_hrSalaryService.SearchSalaryByPaging(search));
        }
@@ -80,7 +100,13 @@
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult Edit(string id)
        {
        {
            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
            ViewData["curentuser"] = curentuser;
            var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/SalaryCheck/Index");
            var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList();
            ViewData["ActionInfo2"] = pageEntities2;
            HrSalaryDTO dto = new HrSalaryDTO();
            if (!string.IsNullOrEmpty(id))
            {
@@ -98,10 +124,14 @@
            {
                dto.Peichang = 0;
            }
            if (!dto.Jiucuo.HasValue)
            if (!dto.Jiucuo.HasValue || dto.Jiucuo.Value == 0)
            {
                dto.Jiucuo = 0;
            }
            //if (!dto.Yufagongziheji.HasValue)
            //{
            //    dto.Yufagongziheji = 0;
            //}
            ViewData.Model = dto;
            return View();
        }
@@ -188,8 +218,8 @@
                var  salaryDTO  = _hrSalaryService.Get(salaryId);
                    dto = new HrSalaryAppeal();
                    dto.salary_id = salaryId;
                    dto.Year = salaryDTO.Year;
                    dto.Month = salaryDTO.Month;
                    dto.year = salaryDTO.Year;
                    dto.month = salaryDTO.Month;
                dto.createrName = curentuser.UserName;
                dto.tittle = "工资申诉(" + curentuser.UserName + ")";
            }
@@ -292,8 +322,8 @@
            ViewData["ActionInfo"] = actionlist;
            ViewBag.dept = _hrDeptService.GetList().Select(x => new { code = x.Id, label = x.DeptName }).ToList();
            ViewBag.stime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.ToString("yyyy-MM-dd");
            ViewBag.etime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
            ViewBag.stime = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).Date.ToString("yyyy-MM");
            ViewBag.etime = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM");
            return View();
        }
@@ -307,10 +337,76 @@
        {
            //自动确认
            //_hrSalaryService.AutoCheck();
            if (!string.IsNullOrEmpty(search.searchDatestart222))
            {
                search.searchDatestart = search.searchDatestart222;
            }
            if (!string.IsNullOrEmpty(search.searchDateend222))
            {
                search.searchDateend = search.searchDateend222;
            }
            return new JsonResult(_hrSalaryService.SearchByPagingFinish(search));
        }
        #endregion
        #region 工资查询
        public IActionResult SearchIndexRenshi(string UserId)
        {
            List<ActionEntity> actionlist = new List<ActionEntity>();
            ActionEntity actionEntity = new ActionEntity();
            actionEntity.OpenType = 0;
            actionEntity.ActionUrl = "";
            actionEntity.ActionFun = "Search";
            actionEntity.PageIco = "fa fa-search";
            actionEntity.ActionName = "查询";
            actionlist.Add(actionEntity);
            ViewData["ActionInfo"] = actionlist;
            //ViewBag.dept = _hrDeptService.GetList().Select(x => new { code = x.Id, label = x.DeptName }).ToList();
            ViewBag.stime =DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
            ViewBag.etime = DateTime.Now.AddMonths(-1).AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM");
            ViewBag.UserId = UserId;
            return View();
        }
        /// <summary>
        /// 列表内容
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public IActionResult GetSearchListRenshi(HrSalaryDTOSearch search)
        {
            if (!string.IsNullOrEmpty(search.searchDatestart222))
            {
                search.searchDatestart = search.searchDatestart222;
            }
            if (!string.IsNullOrEmpty(search.searchDateend222))
            {
                search.searchDateend = search.searchDateend222;
            }
            //自动确认
            //_hrSalaryService.AutoCheck();
            if (!string.IsNullOrEmpty(search.searchDatestart))
            {
                search.searchDatestart = DateTime.Now.ToString("yyyy-MM");
            }
            if (!string.IsNullOrEmpty(search.searchDateend))
            {
                search.searchDate = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM");
            }
            return new JsonResult(_hrSalaryService.SearchByPagingFinish(search));
        }
        #endregion
    }
}