/// <summary> /// 查询财务应收应付 /// </summary> /// <param name="SnNum"></param> /// <returns></returns> public FinanceBillEntity GetSingle(string SnNum) { FinanceBillEntity entity = new FinanceBillEntity(); entity.IncludeAll(); entity.Where(a => a.SnNum == SnNum) .And(a => a.CompanyID == this.CompanyID) .And(a => a.IsDelete == (int)EIsDelete.NotDelete) ; AdminEntity admin = new AdminEntity(); admin.Include(a => new { CreateUserName = a.UserName }); entity.Left <AdminEntity>(admin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); entity = this.FinanceBill.GetSingle(entity); entity.LeavAmount = entity.Amount - entity.RealPayAmount; return(entity); }
/// <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); }