//strSql.Append(",DATEDIFF([day],b.ETD,(select min(bgndate) from Info_Client_ACCDATE where LINKGID=(select gid from Info_Client where SHORTNAME=b.CUSTOMERNAME)))+1 ACTUALDAY");
//strSql.Append(",DATEDIFF([day],ISNULL(T.SETTLETIME,GETDATE()),(select min(bgndate) from Info_Client_ACCDATE where LINKGID=(select gid from Info_Client where SHORTNAME=b.CUSTOMERNAME))) NODAY");
//strSql.Append(",B.ACCDATE ETDMONTH,(CASE f.ISFEE WHEN 1 THEN '已发放' else '未发放' end) as ISFEEREF,CASE WHEN (B.TTLDR-B.STLTTLDR)<0 THEN 0 ELSE (dbo.GetZHZYTTL(B.STLDATE,B.BSNO)+TTLNODR*ZYRATE*DATEDIFF([day],B.STLDATE,GETDATE())) END ZYTTL ");
//strSql.Append(" FROM v_op_bill_gain_zh B ");
//strSql.Append("LEFT JOIN V_MAX_SETTLEMENTTIME_BSDR T ON (T.BSNO=B.BSNO) ");
//strSql.Append("LEFT JOIN op_sale_proftfee f ON (f.BSNO=B.BSNO) where B.TTLDR<>0 ");
// strSql.Append(",DATEDIFF([day],b.ETD,(select min(bgndate) from Info_Client_ACCDATE where LINKGID=(select gid from Info_Client where SHORTNAME=b.CUSTOMERNAME)))+1 ACTUALDAY");
// strSql.Append(",DATEDIFF([day],ISNULL(T.SETTLETIME,GETDATE()),(select min(bgndate) from Info_Client_ACCDATE where LINKGID=(select gid from Info_Client where SHORTNAME=b.CUSTOMERNAME))) NODAY");
// strSql.Append(",B.ACCDATE ETDMONTH,(CASE f.ISFEE WHEN 1 THEN '已发放' else '未发放' end) as ISFEEREF,0 ZYTTL ");
// strSql.Append(" FROM v_op_bill_gain_zh B ");
// strSql.Append("LEFT JOIN V_MAX_SETTLEMENTTIME_CR T ON (T.BSNO=B.BSNO) ");
// strSql.Append("LEFT JOIN op_sale_proftfee f ON (f.BSNO=B.BSNO) where B.TTLDR=0 ");
// strSql.Append(" order by SALE,(CASE WHEN TTLPROFIT<0 THEN convert(datetime,convert(varchar(7),ACCDATE)+'-01') ELSE convert(datetime,convert(varchar(7),ACCDATE)+'-02') END),SETTLETIME,CREATETIME DESC");
// // strSql.Append(" order by SALE,SETTLETIME,ETD,CREATETIME DESC");
//}
//strSql.Append(" SELECT * FROM ##SALEPROFITSHARE ");