/// <summary> /// 分页获取店铺的收支明细 /// </summary> /// <param name="query">查询实体</param> /// <returns></returns> public static QueryPageModel <ShopAccountItem> GetShopAccountItem(ShopAccountItemQuery query) { var model = _iBillingService.GetShopAccountItem(query); QueryPageModel <ShopAccountItem> item = new QueryPageModel <ShopAccountItem>(); item.Total = model.Total; List <ShopAccountItem> items = new List <ShopAccountItem>(); foreach (var m in model.Models) { ShopAccountItem shopAccountItem = new ShopAccountItem(); shopAccountItem.AccountNo = m.AccountNo; shopAccountItem.ShopId = m.ShopId; shopAccountItem.ShopAccountType = m.TradeType; shopAccountItem.Balance = m.Balance.ToString(); shopAccountItem.CreateTime = m.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"); var detailLink = string.Empty; shopAccountItem.DetailId = m.DetailId; if (m.IsIncome) { shopAccountItem.Income = m.Amount.ToString(); } else { shopAccountItem.Expenditure = m.Amount.ToString(); } shopAccountItem.Id = m.Id; items.Add(shopAccountItem); } item.Models = items; return(item); }
private GetBuilder <ShopAccountItemInfo> ToWhere(ShopAccountItemQuery query) { var itemQuery = DbFactory.Default.Get <ShopAccountItemInfo>(); if (query.ShopId.HasValue) { itemQuery.Where(a => a.ShopId == query.ShopId.Value); } if (!string.IsNullOrEmpty(query.ShopName)) { List <ShopInfo> infos = DbFactory.Default.Get <ShopInfo>().Where(s => s.ShopName.Contains(query.ShopName)).ToList(); var shopIds = infos.Select(a => a.Id); itemQuery.Where(p => p.ShopId.ExIn(shopIds)); } if (query.IsIncome.HasValue) { itemQuery.Where(a => a.IsIncome == query.IsIncome.Value); } if (query.ShopAccountType.HasValue) { itemQuery.Where(a => a.TradeType == query.ShopAccountType.Value); } if (query.TimeStart.HasValue) { itemQuery.Where(a => a.CreateTime >= query.TimeStart.Value); } if (query.TimeEnd.HasValue) { var end = query.TimeEnd.Value.Date.AddDays(1); itemQuery.Where(a => a.CreateTime < end); } return(itemQuery); }
/// <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); }
private IQueryable <ShopAccountItemInfo> ToWhere(ShopAccountItemQuery query) { var itemQuery = Context.ShopAccountItemInfo.AsQueryable(); if (query.ShopId.HasValue) { itemQuery = itemQuery.Where(a => a.ShopId == query.ShopId.Value); } if (!string.IsNullOrEmpty(query.ShopName)) { itemQuery = itemQuery.Where(p => p.ShopName.Contains(query.ShopName)); } if (query.IsIncome.HasValue) { itemQuery = itemQuery.Where(a => a.IsIncome == query.IsIncome.Value); } if (query.ShopAccountType.HasValue) { itemQuery = itemQuery.Where(a => a.TradeType == query.ShopAccountType.Value); } if (query.TimeStart.HasValue) { itemQuery = itemQuery.Where(a => a.CreateTime >= query.TimeStart.Value); } if (query.TimeEnd.HasValue) { var end = query.TimeEnd.Value.Date.AddDays(1); itemQuery = itemQuery.Where(a => a.CreateTime < end); } return(itemQuery); }
/// <summary> /// 分页获取诊所的收支明细 /// </summary> /// <param name="query">查询实体</param> /// <returns></returns> public static QueryPageModel <ShopAccountItem> GetShopAccountItem(ShopAccountItemQuery query) { var model = _iBillingService.GetShopAccountItem(query); return(new QueryPageModel <ShopAccountItem>() { Total = model.Total, Models = model.Models.Map <List <ShopAccountItem> >() }); }
/// <summary> /// 分页获取店铺流水 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <ShopAccountItemInfo> GetShopAccountItem(ShopAccountItemQuery query) { int total = 0; var itemQuery = ToWhere(query); itemQuery = itemQuery.GetPage(out total, d => d.OrderByDescending(o => o.Id), query.PageNo, query.PageSize); return(new QueryPageModel <ShopAccountItemInfo>() { Models = itemQuery.ToList(), Total = total }); }
/// <summary> /// 获取诊所帐户流水 /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="type"></param> /// <returns></returns> public ActionResult ExportShopAccountItemlist(DateTime?startDate, DateTime?endDate, ShopAccountType?type) { ShopAccountItemQuery query = new ShopAccountItemQuery(); query.TimeStart = startDate; query.TimeEnd = endDate; query.ShopAccountType = type; query.ShopId = CurrentSellerManager.ShopId; var models = BillingApplication.GetShopAccountItemNoPage(query); return(ExcelView("收支明细", models)); }
public ActionResult ExportSettlementList(DateTime?startDate, DateTime?endDate) { if (startDate == null) { startDate = endDate.HasValue ? endDate.Value.AddYears(-1) : DateTime.Now.AddYears(-1); } var query = new ShopAccountItemQuery(); query.TimeStart = startDate; query.TimeEnd = endDate; query.ShopAccountType = ShopAccountType.SettlementIncome; query.ShopId = CurrentSellerManager.ShopId; var data = BillingApplication.GetShopAccountItemNoPage(query); return(ExcelView("已结算列表", data)); }
/// <summary> /// 店铺结算明细 /// </summary> /// <param name="page"></param> /// <param name="pagesize"></param> /// <returns></returns> public DataGridModel <ShopAccountItem> GetShopAccountItem(int page = 1, int pagesize = 10, bool?isIncome = null) { CheckShopManageLogin(); var shop = CurrentShop; long shopId = shop.Id; var query = new ShopAccountItemQuery() { PageNo = page, PageSize = pagesize, ShopId = shopId, IsIncome = isIncome }; var model = BillingApplication.GetShopAccountItem(query); DataGridModel <ShopAccountItem> result = new DataGridModel <ShopAccountItem>() { rows = model.Models, total = model.Total }; return(result); }
/// <summary> /// 已结算数据 /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="shopName"></param> /// <param name="page"></param> /// <param name="rows"></param> /// <returns></returns> public ViewResult ExportSettlementList(DateTime?startDate, DateTime?endDate, string shopName) { if (startDate == null) { startDate = endDate.HasValue ? endDate.Value.AddYears(-1).Date : DateTime.Now.AddYears(-1).Date; } var query = new ShopAccountItemQuery(); query.ShopName = shopName; query.TimeStart = startDate; query.TimeEnd = endDate; query.ShopAccountType = ShopAccountType.SettlementIncome; var data = BillingApplication.GetAllShopAccountItem(query); return(ExcelView("已结算列表", data)); }
public JsonResult SettlementList(DateTime?startDate, DateTime?endDate, int page, int rows) { if (startDate == null) { startDate = endDate.HasValue ? endDate.Value.AddYears(-1).Date : DateTime.Now.AddYears(-1).Date; } var query = new ShopAccountItemQuery(); query.PageNo = page; query.PageSize = rows; query.TimeStart = startDate; query.TimeEnd = endDate; query.ShopAccountType = ShopAccountType.SettlementIncome; query.ShopId = CurrentSellerManager.ShopId; var data = BillingApplication.GetShopAccountItem(query); if (data.Models == null || data.Models.Count == 0) { return(Json(new { rows = new object[0], total = 0 }, true)); } var models = data.Models.Select(item => { return(new { Id = item.Id, Amount = item.Amount, DetailId = item.DetailId, CreateTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Cycle = item.Cycle }); }); return(Json(new { rows = models, data.Total }, true)); }
/// <summary> /// 分页获取店铺流水 /// </summary> /// <param name="query"></param> /// <returns></returns> public QueryPageModel <ShopAccountItemInfo> GetShopAccountItem(ShopAccountItemQuery query) { var db = ToWhere(query); switch (query.Sort.ToLower()) { case "amount": if (query.IsAsc) { db.OrderBy(p => p.Amount); } else { db.OrderByDescending(p => p.Amount); } break; case "createtime": if (query.IsAsc) { db.OrderBy(p => p.CreateTime); } else { db.OrderByDescending(p => p.CreateTime); } break; default: db.OrderByDescending(o => o.Id); break; } var models = db.ToPagedList(query.PageNo, query.PageSize); return(new QueryPageModel <ShopAccountItemInfo>() { Models = models, Total = models.TotalRecordCount }); }
public JsonResult SettlementList(ShopAccountItemQuery query) { if (!query.TimeStart.HasValue) { query.TimeStart = query.TimeEnd.HasValue ? query.TimeEnd.Value.AddYears(-1).Date : DateTime.Now.AddYears(-1).Date; } query.ShopAccountType = ShopAccountType.SettlementIncome; var data = BillingApplication.GetShopAccountItem(query); var models = data.Models.Select(item => new SettlementListModel { Id = item.Id, ShopId = item.ShopId, ShopName = item.ShopName, Amount = item.Amount, DetailId = item.DetailId, CreateTime = item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Cycle = item.Cycle }); return(Json(new { rows = models, data.Total }, true)); }
public JsonResult GetShopAccountItemlist(DateTime?startDate, DateTime?endDate, ShopAccountType?type, int page, int rows) { ShopAccountItemQuery query = new ShopAccountItemQuery(); query.PageNo = page; query.PageSize = rows; query.TimeStart = startDate; query.TimeEnd = endDate; query.ShopAccountType = type; query.ShopId = CurrentSellerManager.ShopId; var model = BillingApplication.GetShopAccountItem(query); var result = new { rows = model.Models.Select(p => new { p.Id, p.ShopId, p.ShopName, CreateTime = p.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), p.AccountNo, p.AccountType, p.ShopAccountType, p.Balance, p.DetailId, p.DetailLink, p.IsIncome, p.Amount, p.Income, p.Expenditure, p.ReMark, p.AccoutID }), total = model.Total }; return(Json(result)); }
/// <summary> /// 获取店铺流水 /// </summary> /// <param name="query"></param> /// <returns></returns> public List <ShopAccountItemInfo> GetAllShopAccountItem(ShopAccountItemQuery query) { var itemQuery = ToWhere(query); return(itemQuery.ToList()); }
/// <summary> /// 获取诊所的收支明细 /// </summary> /// <param name="query">查询实体</param> /// <returns></returns> public static List <ShopAccountItem> GetShopAccountItemNoPage(ShopAccountItemQuery query) { var models = _iBillingService.GetShopAccountItemNoPage(query); return(models.Map <List <ShopAccountItem> >()); }