Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Index(CompanyLimitSM sm)
        {
            var Dtos   = companyLimitRepo.GetList(sm, ViewHelp.GetCompanyIds(), ViewHelp.GetCateIds());
            var models = Mapper.Map <List <CompanyLimitVM> >(Dtos);

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_List", models));
            }
            InitSelect();
            return(View(models));
        }
Ejemplo n.º 3
0
 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());
 }