Esempio n. 1
0
        private List <MenuVM> GetMenuCount(List <MenuVM> Items)
        {
            for (int i = 0; i < Items.Count; i++)
            {
                var item = Items[i];
                switch (item.ProgramId)
                {
                case "expenseaccount_approveindex":
                    item.Count = expenseAccountRepo.GetListByDto(new ExpenseAccountSM()
                    {
                        ApproveStatus = (int)ExpenseAccountApproveStatus.WaitingApprove
                    }, ViewHelp.UserInfo(), 1, 100).RowCount;
                    break;

                case "expenseaccount_failapproved":
                    item.Count = expenseAccountRepo.GetListByDto(new ExpenseAccountSM()
                    {
                        ApproveStatus = (int)ExpenseAccountApproveStatus.FailApproved
                    }, ViewHelp.UserInfo(), 1, 100).RowCount;
                    break;
                }
                ;
                Items[i] = item;
            }
            return(Items);
        }
Esempio n. 2
0
        public async Task <ActionResult> ToExcel(ExpenseAccountSM Sm)
        {
            var Dtos     = expenseAccountRepo.GetExcelListByDto(Sm, ViewHelp.UserInfo());
            var Vms      = Mapper.Map <List <ExpenseAccountExcelVM> >(Dtos);
            var FilePath = ExpenseAccountManager.Instance.ToExcel(Vms);

            Log(Vms, "路径:" + FilePath);
            return(File(new FileStream(FilePath, FileMode.Open), "application/octet-stream", "报销清单_" + ViewHelp.GetUserName() + "_" + DateTime.Now.ToString("yyyyMMddss") + ".xls"));
        }
Esempio n. 3
0
        public async Task <ActionResult> Index(ExpenseAccountSM Sm, int Page = 1, int PageSize = 20)
        {
            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
            };

            Vms.Results = Mapper.Map <IList <ExpenseAccountListDTO>, IList <ExpenseAccountListVM> >(Dtos.Results);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_List", Vms));
            }
            InitSearchSelect();
            return(View(Vms));
        }
Esempio n. 4
0
        public async Task <ActionResult> ApproveIndex(ExpenseAccountSM Sm, int Page = 1, int PageSize = 20)
        {
            if (!Request.IsAjaxRequest())
            {
                Sm.ApproveStatus = (int)ExpenseAccountApproveStatus.WaitingApprove;
            }
            var Dtos = expenseAccountRepo.GetListByDto(Sm, ViewHelp.UserInfo(), Page, PageSize, true);
            var Vms  = new PagedResult <ExpenseAccountListVM>()
            {
                CurrentPage = Dtos.CurrentPage,
                PageSize    = Dtos.PageSize,
                RowCount    = Dtos.RowCount,
                Stats       = Dtos.Stats
            };

            Vms.Results = Mapper.Map <IList <ExpenseAccountListDTO>, IList <ExpenseAccountListVM> >(Dtos.Results);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ApproveList", Vms));
            }
            InitSearchSelect(true, Sm.ApproveStatus.Value);
            return(View(Vms));
        }
Esempio n. 5
0
        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));
        }