예제 #1
0
        /// <summary>
        /// 查询财务应收应付分页列表
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <FinanceBillEntity> GetList(FinanceBillEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            if (entity.BillNum.IsNotEmpty())
            {
                entity.Where("BillNum", ECondition.Like, "%" + entity.BillNum + "%");
            }
            if (entity.BillType > 0)
            {
                entity.And(a => a.BillType == entity.BillType);
            }
            if (entity.CateNum.IsNotEmpty())
            {
                entity.And(a => a.CateNum == entity.CateNum);
            }
            if (entity.Title.IsNotEmpty())
            {
                entity.And("Title", ECondition.Like, "%" + entity.Title + "%");
            }
            if (entity.ContractNum.IsNotEmpty())
            {
                entity.And("ContractNum", ECondition.Like, "%" + entity.ContractNum + "%");
            }
            if (entity.Status > 0)
            {
                entity.And(a => a.Status == entity.Status);
            }
            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime dateTime = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-1));
                entity.And(a => a.CreateTime >= dateTime);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime dateTime = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date;
                entity.And(a => a.CreateTime < dateTime);
            }
            if (entity.FromNum.IsNotEmpty())
            {
                entity.And(item => item.FromNum == entity.FromNum);
            }
            if (entity.FromName.IsNotEmpty())
            {
                entity.And("FromName", ECondition.Like, "%" + entity.FromName + "%");
            }
            if (entity.ToNum.IsNotEmpty())
            {
                entity.And(item => item.ToNum == entity.ToNum);
            }
            if (entity.ToName.IsNotEmpty())
            {
                entity.And("ToName", ECondition.Like, "%" + entity.ToName + "%");
            }
            int rowCount = 0;
            List <FinanceBillEntity> listResult = this.FinanceBill.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            if (!listResult.IsNullOrEmpty())
            {
                listResult.ForEach(a =>
                {
                    a.LeavAmount = a.Amount - a.RealPayAmount;
                });
            }
            return(listResult);
        }
예제 #2
0
        /// <summary>
        /// 查询门店的流水记录
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <FinancePayEntity> GeAgencyBilltList(FinancePayEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID)
            ;

            FinanceBillEntity bill = new FinanceBillEntity();

            bill.Include(a => new
            {
                Title       = a.Title,
                FromName    = a.FromName,
                ToName      = a.ToName,
                TotalAmount = a.Amount,
                LastTime    = a.LastTime,
                ContractSn  = a.ContractSn,
                ContractNum = a.ContractNum,
                BillType    = a.BillType,
                CateName    = a.CateName,
                CateNum     = a.CateNum,
            });

            entity.Left <FinanceBillEntity>(bill, new Params <string, string>()
            {
                Item1 = "BillSnNum", Item2 = "SnNum"
            });


            if (entity.PayType > 0)
            {
                entity.And(a => a.PayType == entity.PayType);
            }
            if (entity.BankName.IsNotEmpty())
            {
                entity.Where("BankName", ECondition.Like, "%" + entity.BankName + "%");
            }
            if (entity.PayNum.IsNotEmpty())
            {
                entity.Where("PayNum", ECondition.Like, "%" + entity.PayNum + "%");
            }
            if (entity.CateNum.IsNotEmpty())
            {
                bill.And(a => a.CateNum == entity.CateNum);
            }
            if (entity.Title.IsNotEmpty())
            {
                bill.And("Title", ECondition.Like, "%" + entity.Title + "%");
            }

            if (entity.BeginTime.IsNotEmpty())
            {
                DateTime time = ConvertHelper.ToType <DateTime>(entity.BeginTime, DateTime.Now.AddDays(-7)).Date;
                entity.And(a => a.PayTime >= time);
            }
            if (entity.EndTime.IsNotEmpty())
            {
                DateTime time = ConvertHelper.ToType <DateTime>(entity.EndTime, DateTime.Now).AddDays(1).Date;
                entity.And(a => a.PayTime < time);
            }
            int rowCount = 0;
            List <FinancePayEntity> listResult = this.FinancePay.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);

            pageInfo.RowCount = rowCount;
            return(listResult);
        }