예제 #1
0
        private IQueryable <PendingSettlementOrdersInfo> ToWhere(PendingSettlementOrderQuery query)
        {
            var pendingQuery = Context.PendingSettlementOrdersInfo.AsQueryable();

            if (query.ShopId.HasValue)
            {
                pendingQuery = pendingQuery.Where(a => a.ShopId == query.ShopId.Value);
            }
            if (query.OrderId.HasValue)
            {
                pendingQuery = pendingQuery.Where(a => a.OrderId == query.OrderId.Value);
            }
            if (query.OrderStart.HasValue)
            {
                pendingQuery = pendingQuery.Where(a => a.OrderFinshTime >= query.OrderStart.Value);
            }
            if (query.OrderEnd.HasValue)
            {
                var end = query.OrderEnd.Value.Date.AddDays(1);
                pendingQuery = pendingQuery.Where(a => a.OrderFinshTime < end);
            }
            if (!string.IsNullOrEmpty(query.ShopName))
            {
                pendingQuery = pendingQuery.Where(a => a.ShopName.Contains(query.ShopName));
            }
            if (query.ShopId.HasValue)
            {
                pendingQuery = pendingQuery.Where(p => p.ShopId == query.ShopId.Value);
            }
            if (!string.IsNullOrEmpty(query.PaymentName))
            {
                pendingQuery = pendingQuery.Where(a => a.PaymentTypeName == query.PaymentName);
            }
            return(pendingQuery);
        }
예제 #2
0
        /// <summary>
        ///分页获取待结算预约单列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public static List <PendingSettlementOrders> GetPendingSettlementOrdersNoPage(PendingSettlementOrderQuery query)
        {
            QueryPageModel <PendingSettlementOrders> orders = new QueryPageModel <PendingSettlementOrders>();
            var models                 = _iBillingService.GetPendingSettlementOrdersNoPage(query);
            var result                 = Mapper.Map <List <PendingSettlementOrdersInfo>, List <PendingSettlementOrders> >(models);
            var settlementCycle        = SiteSettingApplication.GetSiteSettings().WeekSettlement;
            var end                    = _iBillingService.GetLastSettlementTime();
            var CurrentSettlementCycle = GetDateBilingTime(settlementCycle, end, DateTime.Now); //节省一次查询

            foreach (var m in result)
            {
                m.DistributorCommission = m.DistributorCommission - m.DistributorCommissionReturn;
                m.PlatCommission        = m.PlatCommission - m.PlatCommissionReturn;
                if (m.OrderFinshTime < CurrentSettlementCycle.StartTime) //如果预约单完成时间不在当前结算周期之内
                {
                    var cycle = GetDateBilingTime(settlementCycle, end, m.OrderFinshTime);
                    m.SettlementCycle = "此预约单为" + cycle.StartTime.ToString("yyyy-MM-dd HH:mm:ss") + "至" + cycle.EndTime.ToString("yyyy-MM-dd HH:mm:ss") + "周期内预约单";
                }
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// 获取待结算订单
        /// </summary>
        /// <param name="query">待结算订单查询实体</param>
        /// <returns></returns>
        public List <PendingSettlementOrdersInfo> GetPendingSettlementOrdersNoPage(PendingSettlementOrderQuery query)
        {
            var pendingQuery = ToWhere(query);

            return(pendingQuery.ToList());
        }
예제 #4
0
        /// <summary>
        /// 分页获取待结算订单
        /// </summary>
        /// <param name="query">待结算订单查询实体</param>
        /// <returns></returns>
        public QueryPageModel <PendingSettlementOrdersInfo> GetPendingSettlementOrders(PendingSettlementOrderQuery query)
        {
            int total        = 0;
            var pendingQuery = ToWhere(query);

            pendingQuery = pendingQuery.GetPage(out total, d => d.OrderByDescending(o => o.Id), query.PageNo, query.PageSize);
            return(new QueryPageModel <PendingSettlementOrdersInfo>()
            {
                Models = pendingQuery.ToList(), Total = total
            });
        }