strSql.Append(",case A.OPDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), A.OPDATE,23) end as OPDATE,A.ENTERP,A.DELIVERYDATE");
strSql.Append(",case A.CUSTOMDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), A.CUSTOMDATE,23) end as CUSTOMDATE,A.SERVICECONTRACTNO");
strSql.Append(",A.CNTR1,A.CNTR2,A.CNTR3,A.CNTR4,A.CNTR5,A.CNTR6,A.CNTR7,A.CNTR8,A.CNTR9,A.CNTR10,A.OTCNTR,A.TRADETYPE,A.GOODSNAME,A.FEESTATUS,A.PKGS,A.CBM,A.ORDERNO,A.SALECORPID,(select [NAME] from [company] where GID=A.SALECORPID) as SALECORP");
strSql.Append(",(CASE A.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,A.AGENTID ");
strSql.Append(",SUM(G.NOACCTAXOTCR) NOACCTAXOTCR,SUM(G.NOACCTAXTTLDR) NOACCTAXTTLDR,SUM(G.NOACCTAXTTLCR) NOACCTAXTTLCR,SUM(G.NOACCTAXUSDDR-G.NOACCTAXUSDCR) AS NOACCTAXUSDPROFIT");
strSql.Append(",SUM(G.NOACCTAXRMBDR-G.NOACCTAXRMBCR) AS NOACCTAXRMBPROFIT,SUM(G.NOACCTAXOTDR-G.NOACCTAXOTCR) AS NOACCTAXOTPROFIT,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS NOACCTAXTTLPROFIT ");
// strSql.Append(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
strSql.Append(" FROM V_OP_BS B ");
strSql.Append("LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) ");
// strSql.Append(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
strSql.Append(" cd.COUNTRY,cd.CHAU ");
strSql.Append(" FROM V_OP_BS B left join code_disport cd on cd.PORT=b.DESTINATION ");
strSql.Append("LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) ");