strSql.Append(",c.FEETYPE,(CASE C.FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF");
strSql.Append(",'' BILLTYPE ");
strSql.Append(",'' BILLTYPE,'' MBLNO ");
if(dotype=="1"){
strSql.Append(",'' INVNO,b.SETTLETIME BILLDATE,(select ShowName from [user] where GID=b.SETTLEUSER) as BILLUSER,(select STLNAME from [code_stlmode] where STLCODE=b.SETTLETYPE) as SETTLETYPEREF,'' as CREATEUSER");
strSql.Append(",c.FEETYPE,(CASE C.FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF");
strSql.Append(",'' INVNO,b.SETTLETIME BILLDATE,(select ShowName from [user] where GID=b.SETTLEUSER) as BILLUSER,(select STLNAME from [code_stlmode] where STLCODE=b.SETTLETYPE) as SETTLETYPEREF,'' as CREATEUSER");
strSql.Append(",'结算单' BILLTYPE ");
strSql.Append(",'结算单' BILLTYPE,bs.MBLNO ");
strSql.Append(" FROM ch_fee_do c ");
strSql.Append(" left join ch_fee_settlement b on (b.BILLNO=c.BILLNO) ");
strSql.Append(" left join v_op_bill bs on (bs.BSNO=c.BSNO) ");
strSql.Append(" where (c.ISDELETED=0 or c.ISDELETED IS NULL) ");
strSql.Append(",c.FEETYPE,(CASE C.FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF");
strSql.Append(",b.INVOICENO INVNO,b.INVOICEMAKETIME BILLDATE,(select ShowName from [user] where GID=b.APPLICANT) as BILLUSER,(select ShowName from [user] where GID=b.OPERATOR) as CREATEUSER,'' SETTLETYPEREF");
strSql.Append(",'发票' BILLTYPE ");
strSql.Append(",'发票' BILLTYPE,bs.MBLNO ");
strSql.Append(" FROM ch_fee_do c ");
strSql.Append(" left join ch_fee_invoice b on (b.BILLNO=c.BILLNO) ");
strSql.Append(" left join v_op_bill bs on (bs.BSNO=c.BSNO) ");
strSql.Append(" where (c.ISDELETED=0 or c.ISDELETED IS NULL) ");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP,BillFeeStatus");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF from tMsWlPcHead t ");
=======
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF ");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP,BillFeeStatus");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF from tMsWlPcHead t ");
=======
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF ");