//账户异动记录列表封装方法 private BillingViewModels List(BillingFilterModel filter) { if (IsPostRequest) { filter.Page = 1; } var viewModels = new BillingViewModels { Filter = filter }; var param = new AmountRecordSearchParam //B_LMS.Data { CustomerCode = _workContext.User.UserUame, StartDateTime = filter.StartDateTime, EndDateTime = filter.EndDateTime, Page = filter.Page, PageSize = filter.PageSize }; decimal totalInFee = 0; decimal totalOutFee = 0; var list = _billingService.GetCustomerAmountRecordPagedList(param, out totalInFee, out totalOutFee); viewModels.BillingList = list.ToModelAsPageCollection <CustomerAmountRecordExt, BillingModel>();//LMS_Db.Entities与LMS.UserCenter.Controllers.BillingController映射 viewModels.TotalInFee = totalInFee; viewModels.TotalOutFee = totalOutFee; return(viewModels); }
public ActionResult ToExecl(BillingViewModels param) { var viewModel = List(param.Filter); var list = new List <BillingExecModel>(); viewModel.BillingList.InnerList.ForEach(p => { var m = new BillingExecModel() { Balance = p.Balance, CreatedOn = p.CreatedOn, CustomerCode = p.CustomerCode, MoneyChangeTypeShortName = p.MoneyChangeTypeShortName, Remark = p.Remark, SerialNumber = p.SerialNumber, InCash = 0, OutCash = 0 }; if (p.Amount.HasValue) { if (p.Amount.Value > 0) { m.InCash = p.Amount.Value; } else { m.OutCash = p.Amount.Value; } } list.Add(m); }); var titleList = new List <string> { "CustomerCode-客户代码", "CreatedOn-日期", "MoneyChangeTypeShortName-费用类型", "Remark-费用说明", "InCash-进账金额", "OutCash-出账金额", "Balance-帐户结余" }; ExportExcelByWeb.WriteToDownLoad(list, titleList, null); return(View(viewModel)); }