예제 #1
0
        /// <summary>
        /// 根据过滤条件,返回检索数据的Sql文
        /// </summary>
        /// <param name="baseFilter"></param>
        /// <returns></returns>
        protected override string GetSearchSql(BaseFilter baseFilter)
        {
            RelativeDaySearchDunFilter filter       = baseFilter as RelativeDaySearchDunFilter;
            RelativeDayExportDunFilter exportFilter = baseFilter as RelativeDayExportDunFilter;

            if (filter == null && exportFilter == null)
            {
                return("");
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(" SELECT BillID");
            sb.Append("       ,BusinessID");
            //sb.Append("       ,CustomerID");
            sb.Append("       ,BillType");
            sb.Append("       ,BillStatus");
            sb.Append("       ,BillMonth");
            sb.Append("       ,CompanyKey");
            sb.Append("       ,BeginTime");
            sb.Append("       ,EndTime");
            sb.Append("       ,LimitTime");
            sb.Append("       ,CreateTime");
            //sb.Append("       ,OperatorID");
            sb.Append("       ,IsCurrent");
            sb.Append("       ,FullPaidTime");
            sb.Append("       ,IsShelve");
            //sb.Append("       ,DeductionID");
            //sb.Append("       ,IsFixed");
            sb.Append("       ,DueDate");
            sb.Append(" FROM dbo.Bill WITH (NOLOCK)");

            if (filter != null)
            {
                sb.Append(" WHERE BusinessID IN ('" + filter.BusinessIds + "')");
            }
            else if (exportFilter != null)
            {
                sb.Append(" WHERE BusinessID IN ('" + exportFilter.BusinessIds + "')");
            }

            sb.Append(" ORDER BY BillID");

            return(sb.ToString());
        }
        /// <summary>
        /// 根据过滤条件,返回检索数据的Sql文
        /// </summary>
        /// <param name="baseFilter"></param>
        /// <returns></returns>
        protected override string GetSearchSql(BaseFilter baseFilter)
        {
            RelativeDaySearchDunFilter filter       = baseFilter as RelativeDaySearchDunFilter;
            RelativeDayExportDunFilter exportFilter = baseFilter as RelativeDayExportDunFilter;

            if (filter == null && exportFilter == null)
            {
                return("");
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(" SELECT BillItemID");
            sb.Append("       ,BillID");
            sb.Append("       ,Subject");
            sb.Append("       ,DueDate");
            sb.Append("       ,Amount");
            sb.Append("       ,DueAmt");
            sb.Append("       ,ReceivedAmt");
            sb.Append("       ,CreateTime");
            sb.Append("       ,FullPaidTime");
            sb.Append("       ,Overdue");
            sb.Append("       ,SubjectType");
            sb.Append("       ,IsCurrent");
            sb.Append("       ,IsShelve");
            sb.Append("       ,BusinessID");
            sb.Append("       ,PenaltyIntAmt");
            sb.Append(" FROM dbo.BillItem WITH (NOLOCK)");
            sb.Append(" WHERE BillID IN (SELECT BillID FROM dbo.Bill ");

            if (filter != null)
            {
                sb.Append(" WHERE BusinessID IN ('" + filter.BusinessIds + "'))");
            }
            else if (exportFilter != null)
            {
                sb.Append(" WHERE BusinessID IN ('" + exportFilter.BusinessIds + "'))");
            }

            return(sb.ToString());
        }