public ActionResult ToExecl(CustomerAmountRecordListViewModel param) { var model = AmountRecordDataBind(param.FilterModel); var list = new List <CustomerAmountRecordToExecl>(); model.PagedList.InnerList.ForEach(p => { var m = new CustomerAmountRecordToExecl() { 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(model)); }
private CustomerAmountRecordListViewModel AmountRecordDataBind(CustomerAmountRecordListFilterModel filter) { var model = new CustomerAmountRecordListViewModel { FilterModel = filter }; decimal totalInFee = 0; decimal totalOutFee = 0; if (!string.IsNullOrWhiteSpace(filter.CustomerCode)) { model.PagedList = _customerService.GetCustomerAmountRecordPagedList(new AmountRecordSearchParam() { CustomerCode = filter.CustomerCode, EndDateTime = filter.EndDateTime, StartDateTime = filter.StartDateTime, Page = filter.Page, PageSize = filter.PageSize }, out totalInFee, out totalOutFee).ToModelAsPageCollection <CustomerAmountRecordExt, CustomerAmountRecordListModel>(); } model.TotalInFee = totalInFee; model.TotalOutFee = totalOutFee; return(model); }
public ActionResult SearchCustomerAmountRecordList(CustomerAmountRecordListViewModel param) { param.FilterModel.Page = 1; return(View(AmountRecordDataBind(param.FilterModel))); }