/// <summary> /// 查询结算历史 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <AccountInfo> GetSettledHistory(ShopSettledHistoryQuery query) { //int total = 0; //var model = Context.AccountDetailInfo.Where(a => a.ShopId == query.ShopId).OrderBy(a => a.Id).FirstOrDefault(); var model = DbFactory.Default.Get <AccountDetailInfo>().Where(a => a.ShopId == query.ShopId).OrderBy(a => a.Id).FirstOrDefault(); var MinDate = query.MinSettleTime.Date; if (model == null) //不存在结算记录返回空 { return new QueryPageModel <AccountInfo>() { Models = new List <AccountInfo>(), Total = 0 } } ; else { MinDate = model.Date.Date; } //var list = Context.AccountInfo.Where(a => a.AccountDate >= MinDate); var list = DbFactory.Default.Get <AccountInfo>().Where(a => a.AccountDate >= MinDate); var result = list.OrderByDescending(o => o.Id).ToPagedList(query.PageNo, query.PageSize); QueryPageModel <AccountInfo> pageModel = new QueryPageModel <AccountInfo>() { Models = result, Total = result.TotalRecordCount }; return(pageModel); }
/// <summary> /// 诊所近一年的结算历史 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <ShopSettledHistory> GetShopYearSettledHistory(ShopSettledHistoryQuery query) { query.MinSettleTime = DateTime.Now.AddYears(-1); ShopAccountItemQuery itemQuery = new ShopAccountItemQuery(); itemQuery.TimeStart = query.MinSettleTime; itemQuery.PageNo = query.PageNo; itemQuery.PageSize = query.PageSize; itemQuery.ShopId = query.ShopId; itemQuery.ShopAccountType = ShopAccountType.SettlementIncome; var account = _iBillingService.GetShopAccountItem(itemQuery);; //var account = _iBillingService.GetSettledHistory(query); QueryPageModel <ShopSettledHistory> result = new QueryPageModel <ShopSettledHistory>(); result.Total = account.Total; List <ShopSettledHistory> history = new List <ShopSettledHistory>(); foreach (var m in account.Models) { ShopSettledHistory h = new ShopSettledHistory(); h.AccountTime = m.CreateTime; h.StartTime = m.CreateTime.Date.AddDays(-m.SettlementCycle); h.EndTime = m.CreateTime.Date; h.SettlementAmount = m.Amount; h.AccountId = long.Parse(m.DetailId); history.Add(h); } result.Models = history; return(result); }
public DataGridModel <ShopSettledHistory> GetShopYearSettledHistory(int page = 1, int pagesize = 10) { CheckShopManageLogin(); var shop = CurrentShop; long shopId = shop.Id; var query = new ShopSettledHistoryQuery() { ShopId = shopId, PageNo = page, PageSize = pagesize }; var model = BillingApplication.GetShopYearSettledHistory(query); DataGridModel <ShopSettledHistory> result = new DataGridModel <ShopSettledHistory>() { rows = model.Models, total = model.Total }; return(result); }