strSql.Append(",F.GID,F.FEETYPE,F.FEENAME,F.FEEDESCRIPTION,F.CUSTOMERNAME AS CUSTNAME,F.UNIT,F.UNITPRICE,F.QUANTITY,F.AMOUNT,F.CURRENCY,F.EXCHANGERATE,F.DEBITNO");
strSql.Append(",CASE WHEN len(DESTINATIONID)<>5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(DESTINATIONID,2)) END as COUNTRY ");
if(LAN=="en-us"){
strSql.Append(",CASE WHEN len(DESTINATIONID)<>5 THEN '' ELSE (select top 1 c_country_ename from t_sys_country_code where c_country_code=LEFT(DESTINATIONID,2)) END as COUNTRY ");
}
else
strSql.Append(",CASE WHEN len(DESTINATIONID)<>5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(DESTINATIONID,2)) END as COUNTRY ");
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,A.REMARK ");
strSql.Append(",(CASE A.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,A.AGENTID,A.REMARK,A.INVNO ");
strSql.Append(",F.CUSTOMERNAME AS CUSTNAME ");
strSql.Append(",C.[DESCRIPTION] AS CUSTFULLNAME ");
strSql.Append(",isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(AMOUNT,0) ELSE 0 END) ELSE 0 END),0) AS RMBDR,");
strSql.Append(",case B.CUSTOMDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.CUSTOMDATE,23) end as CUSTOMDATE,B.SERVICECONTRACTNO");
strSql.Append(",B.CNTR1,B.CNTR2,B.CNTR3,B.CNTR4,B.CNTR5,B.CNTR6,B.CNTR7,B.CNTR8,B.CNTR9,B.CNTR10,B.OTCNTR,B.TRADETYPE,B.GOODSNAME,B.FEESTATUS,B.PKGS,B.CBM,B.ORDERNO,B.SALECORPID,(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP");
strSql.Append(",(CASE B.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,B.AGENTID,B.REMARK ");
strSql.Append(",(CASE B.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,B.AGENTID,B.REMARK,B.INVNO ");
strSql.Append(",F.CUSTOMERNAME AS CUSTNAME ");
strSql.Append(",C.[DESCRIPTION] AS CUSTFULLNAME ");
strSql.Append(",isnull(SUM(CASE FEETYPE WHEN 1 THEN (CASE CURRENCY WHEN 'RMB' THEN ISNULL(AMOUNT,0) ELSE 0 END) ELSE 0 END),0) AS RMBDR,");