public ActionResult GetCompanyLimit(int year) { var model = new CompanyManagerWelcomeVM(); var companys = ViewHelp.GetCompanyIds(); var roleType = ViewHelp.GetRoleType(); var cateIds = ViewHelp.GetCateIds(); if (!string.IsNullOrEmpty(Request.QueryString["companyIds"])) { companys = Request.QueryString["companyIds"]; roleType = (int)RoleType.CompanyManager; ViewBag.companyName = companyRepo.GetCompanysName(companys, ","); cateIds = ""; } model.CompanyCateLimits = new List <CompanyCateLimitDTO>(); var cateList = changeCateRepo.GetList(roleType, CateDropType.Report, cateIds); if (!string.IsNullOrEmpty(Request.QueryString["companyIds"])) { cateList.Add(new KeyValueVM() { Key = "20", Value = "室内交通费" }); } foreach (var cate in cateList) { var limit = companyLimitRepo.GetCompanysLimit(companys, cate.Key.ToInt(), year); model.CompanyCateLimits.Add(limit); } model.Performance = companyLimitRepo.GetPerformance(companys, year); return(Json(model, JsonRequestBehavior.AllowGet)); }
private void InitSearchSelect() { var CompanyList = companyRepo.GetList(ViewHelp.GetRoleId()); ViewBag.CompanyList = new SelectList(CompanyList, "Key", "Value"); var CateList = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Report, ViewHelp.GetCateIds()); ViewBag.CateList = new SelectList(CateList, "Key", "Value"); }
private void InitSelect(int CateId = 0, int CompanyId = 0, int SeasonType = 0) { var CateList = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Report, ViewHelp.GetCateIds()); ViewBag.CateList = new SelectList(CateList, "Key", "Value", CateId); var CompanyList = companyRepo.GetList(ViewHelp.GetRoleId()); ViewBag.CompanyList = new SelectList(CompanyList, "Key", "Value", CompanyId); var SeasonTypeList = SeasonTypeEnum.Autumn.GetEnumList(); ViewBag.SeasonTypeList = new SelectList(SeasonTypeList, "Key", "Value", SeasonType); }
public ActionResult AdminWelcome(AdminWelcomeSM sm, int page = 1, int pageSize = 40) { sm.Year = sm.Year.HasValue ? sm.Year.Value : 2017; var companyLimits = new List <CompanyCateLimitVM>(); //公司列表 var companys = companyRepo.GetListDto(); if (sm.CompanyId.HasValue) { companys = companys.Where(o => o.Id == sm.CompanyId).ToList(); } //分类列表 var cates = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Report, ViewHelp.GetCateIds()); if (sm.CateId.HasValue) { cates = cates.Where(o => o.Key == sm.CateId.ToString()).ToList(); } ViewBag.Cates = cates; foreach (var company in companys) { var companyLimit = new CompanyCateLimitVM(); companyLimit.CompanyId = company.Id; companyLimit.CompanyName = company.CompanyName; companyLimit.CompanyCateLimits = new List <CompanyCateLimitDTO>(); foreach (var cate in cates) { companyLimit.CompanyCateLimits.Add(companyLimitRepo.GetCompanyLimit(company.Id, cate.Key.ToInt(), sm.Year.Value)); } companyLimits.Add(companyLimit); } var vms = new PagedResult <CompanyCateLimitVM>() { CurrentPage = page, PageSize = pageSize, RowCount = companyLimits.Count, Results = companyLimits.Skip((page - 1) * pageSize).Take(pageSize).ToList() }; if (Request.IsAjaxRequest()) { return(PartialView("_List", vms)); } InitSearchSelect(); return(View(vms)); }
private void InitSelect(int CateId = 0, int CompanyId = 0) { var CateList = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Form, ViewHelp.GetCateIds()); ViewBag.CateList = new SelectList(CateList, "Key", "Value", CateId); var CateGroupList = changeCateRepo.GetGroupList(ViewHelp.GetRoleType(), CateDropType.Form, ViewHelp.GetCateIds()); ViewBag.CateGroupList = new KeyValueGroupVM(CateGroupList, CateId); //录入人和amdin在录入的时候可以录入所有人的公司, //也只有录入人和admin可以编辑和新增,所以目前都是可以选所有的 var CompanyList = companyRepo.GetList(ViewHelp.GetRoleId()); ViewBag.CompanyList = new SelectList(CompanyList, "Key", "Value", CompanyId); }
public ActionResult WelCome() { var RoleTypeId = (RoleType)ViewHelp.GetRoleType(); switch (RoleTypeId) { case RoleType.Admin: return(RedirectToAction("AdminWelcome")); case RoleType.CompanyManager: return(RedirectToAction("CompanyManagerWelcome")); case RoleType.Staff: case RoleType.Area: return(RedirectToAction("StaffWelcome")); } return(View()); }
private void InitSearchSelect(bool IsFromApprove = false, int ApproveStatus = 0) { var DateTypeList = ExpenseAccountDateType.OccurDate.GetEnumList(); ViewBag.DateTypeList = new SelectList(DateTypeList, "Key", "Value"); var CateList = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Search, ViewHelp.GetCateIds()); ViewBag.CateList = new SelectList(CateList, "Key", "Value"); var ApproveStatusList = ExpenseAccountApproveStatus.Created.GetEnumList(); if (IsFromApprove) { ApproveStatusList = ApproveStatusList.Where(o => o.Key != (int)ExpenseAccountApproveStatus.Created).ToList(); } ViewBag.ApproveStatusList = new SelectList(ApproveStatusList, "Key", "Value", ApproveStatus); var CompanyList = companyRepo.GetList(ViewHelp.GetRoleId()); ViewBag.CompanyList = new SelectList(CompanyList, "Key", "Value"); }
public async Task <ActionResult> CompanyLimitDetail(ExpenseAccountSM Sm, int Page = 1, int PageSize = 20) { DateTime sDate, eDate; Sm.Year.GetDateByYear(out sDate, out eDate); Sm.SDate = sDate; Sm.EDate = eDate; if (!Sm.CompanyId.HasValue) { var CompanyList = companyRepo.GetList(ViewHelp.GetRoleId()); Sm.CompanyId = CompanyList.FirstOrDefault().Key.ToInt(); } if (!Sm.CateId.HasValue) { var CateList = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Search, ViewHelp.GetCateIds()); Sm.CateId = CateList.FirstOrDefault().Key.ToInt(); } Sm.IsNotAccount = 0; Sm.ApproveStatus = (int)ExpenseAccountApproveStatus.PassApproved; var Dtos = expenseAccountRepo.GetListByDto(Sm, ViewHelp.UserInfo(), Page, PageSize); var Vms = new PagedResult <ExpenseAccountListVM>() { CurrentPage = Dtos.CurrentPage, PageSize = Dtos.PageSize, RowCount = Dtos.RowCount, Stats = Dtos.Stats }; ViewBag.limit = companyLimitRepo.GetCompanyLimit(Sm.CompanyId.Value, Sm.CateId.Value, Sm.Year); Vms.Results = Mapper.Map <IList <ExpenseAccountListDTO>, IList <ExpenseAccountListVM> >(Dtos.Results); if (Request.IsAjaxRequest()) { return(PartialView("_CompanyLimitDetailList", Vms)); } CompanyLimitInitSearchSelect(); return(View(Vms)); }
public async Task <ActionResult> MonthExpenseStatistics(MonthExpenseStatisticsSM sm) { if (Request.IsAjaxRequest()) { var nameList = new List <string>(); if (!sm.SDate.HasValue) { sm.SDate = DateTime.Now.AddYears(-1); } if (!sm.EDate.HasValue) { sm.EDate = DateTime.Now; } var cateList = changeCateRepo.GetList(ViewHelp.GetRoleType(), CateDropType.Report, ViewHelp.GetCateIds()); sm.CompanyIds = ViewHelp.GetCompanyIds(); sm.RoleType = ViewHelp.GetRoleType(); var dtos = expenseAccountRepo.GetMonthCateList(sm); var list = new Dictionary <string, List <ExpenseAccountMonthCateDTO> >(); if (dtos.Count > 0) { //补全信息 foreach (var cate in cateList) { var BeginDate = new DateTime(sm.SDate.Value.Year, sm.SDate.Value.Month, 1); var EndDate = new DateTime(sm.EDate.Value.Year, sm.EDate.Value.Month, 1); list.Add(cate.Value, new List <ExpenseAccountMonthCateDTO>()); if (BeginDate != EndDate) { //不是同月的 while (BeginDate != EndDate) { var Dto = new ExpenseAccountMonthCateDTO() { CateName = cate.Value, ECMonth = BeginDate.Month, ECYear = BeginDate.Year, SumMoney = 0 }; Dto.SumMoney = dtos.Where(o => o.CateName == cate.Value && o.ECYear == BeginDate.Year && o.ECMonth == BeginDate.Month).Select(o => o.SumMoney).FirstOrDefault(); Dto.SumMoney = Dto.SumMoney ?? 0; list[cate.Value].Add(Dto); nameList.Add(BeginDate.GetMonthName()); BeginDate = BeginDate.AddMonths(1); } } else { //同月的 var Dto = new ExpenseAccountMonthCateDTO() { CateName = cate.Value, ECMonth = BeginDate.Month, ECYear = BeginDate.Year, SumMoney = 0 }; Dto.SumMoney = dtos.Where(o => o.CateName == cate.Value && o.ECYear == BeginDate.Year && o.ECMonth == BeginDate.Month).Select(o => o.SumMoney).FirstOrDefault(); Dto.SumMoney = Dto.SumMoney ?? 0; list[cate.Value].Add(Dto); nameList.Add(BeginDate.GetMonthName()); BeginDate = BeginDate.AddMonths(1); } } } return(Json(new { NameList = nameList, List = list }, JsonRequestBehavior.AllowGet)); } else { ViewBag.MonthList = ViewHelp.GetRecentlyMonthList(); } return(View()); }