public async Task <IActionResult> GetAllUserBillsList(int?page, int?limit, string searchInput) { SearchReport_DetailsDto search = string.IsNullOrWhiteSpace(searchInput) ? new SearchReport_DetailsDto() : JsonConvert.DeserializeObject <SearchReport_DetailsDto>(searchInput); var lst = await _reportService.GetDetailsViewData(search).ToPagedListAsync(page ?? 0, limit ?? int.MaxValue); var result = new ReturnViewModel <AccountBill>() { count = lst.Total, data = lst.Items }; return(Json(result)); }
/// <summary> /// 获取收支明细 /// </summary> /// <returns></returns> public IQueryable <Report_DetailsDto> GetDetailsViewData(SearchReport_DetailsDto input) { var billQuey = _accountbillrepository.QueryNoTracking() .WhereIf(input.BegDate.HasValue, x => x.AccountDate >= input.BegDate.Value) .WhereIf(input.EndDate.HasValue, x => x.AccountDate <= input.EndDate.Value.AddDays(1).AddSeconds(-1)) .WhereIf(input.UserID.HasValue, x => x.CreateUserID == input.UserID.Value) .Where(x => !x.IsDelete) ; var result = from a in billQuey select new Report_DetailsDto() { BillType = a.BillType == BillTypeEnum.Income ? "收入" : "支出", ItemType = a.ItemType, AccountMoney = a.AccountMoney, AccountDate = a.AccountDate, CreateDisPlayName = a.CreateDisPlayName }; return(result.OrderBy(x => x.BillType)); }