strSql.Append(",case B.ETD when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.ETD,23) end as ETD,B.ETA");
strSql.Append(",case B.OPDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.OPDATE,23) end as OPDATE,B.ENTERP");
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.CARGOID,B.DCLASS");
strSql.Append(" and ISNULL(F.SETTLEMENT,0)<>0 AND ((F.AMOUNT>0 and ISNULL(F.SETTLEMENT,0)>ISNULL(F.INVOICE,0)) or (F.AMOUNT<0 and ISNULL(F.SETTLEMENT,0)<ISNULL(F.INVOICE,0))) ");
strSql.Append(" and ISNULL(F.SETTLEMENT,0)<>0 and ISNULL(F.ISINVOICE,0)=0 AND ((F.AMOUNT>0 and ISNULL(F.SETTLEMENT,0)>ISNULL(F.INVOICE,0)) or (F.AMOUNT<0 and ISNULL(F.SETTLEMENT,0)<ISNULL(F.INVOICE,0))) ");
}
elseif(feerang=="5")
{
strSql.Append(" and ISNULL(F.SETTLEMENT,0)=0 AND ISNULL(F.INVOICE,0)=0 and ISNULL(F.ORDERINVOICE,0)=0 and F.FEETYPE=1 ");
strSql.Append(" and ISNULL(F.SETTLEMENT,0)=0 and ISNULL(F.ISINVOICE,0)=0 AND ISNULL(F.INVOICE,0)=0 and ISNULL(F.ORDERINVOICE,0)=0 and F.FEETYPE=1 ");