varBLCOUNT=T_ALL_DA.GetStrSQL("BLCOUNT","select count(*) BLCOUNT from OP_SEAE WHERE CUSTOMERNAME='"+headData.CUSTOMERNAME+"' AND DATEDIFF([day],ISNULL(OP_SEAE.STLDATE,OP_SEAE.ETD),GETDATE())>0 ");
if(BLCOUNT=="0")
{
headData.ISCHAOQI="否";
}
else{
headData.ISCHAOQI="是";
};
T_ALL_DAT_ALL_DA=newT_ALL_DA();
varBLCOUNT=T_ALL_DA.GetStrSQL("BLCOUNT","select count(*) BLCOUNT from OP_SEAE WHERE CUSTOMERNAME='"+headData.CUSTOMERNAME+"' AND DATEDIFF([day],ISNULL(OP_SEAE.STLDATE,OP_SEAE.ETD),GETDATE())>0 ");
strSql.Append(",(SELECT TOP 1 STATUS+' '+ CONVERT(varchar(100),COMPTIME, 20) FROM OP_STATUS WHERE BSNO=op_seae.BSNO AND STTYPE='2' ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=OP_SEAE.BSNO) BLISSUESTATUS");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN RMBNODR ELSE 0 END) CRMBNODR");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN USDNODR ELSE 0 END) CUSDNODR");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN TTLNODR ELSE 0 END) CTTLNODR ");
searchStr.Append(" ,sum(CASE WHEN BLISSUESTATUS='提单签出' then RMBNODR else 0 END) RMBNODR_YQC");
searchStr.Append(" ,sum(CASE WHEN BLISSUESTATUS='提单签出' then USDNODR else 0 END) USDNODR_YQC");
searchStr.Append(" ,sum(CASE WHEN BLISSUESTATUS='提单签出' then TTLNODR else 0 END) TTLNODR_YQC");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN CASE WHEN BLISSUESTATUS='提单签出' then RMBNODR else 0 END ELSE 0 END) CRMBNODR_YQC");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN CASE WHEN BLISSUESTATUS='提单签出' then USDNODR else 0 END ELSE 0 END) CUSDNODR_YQC");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN CASE WHEN BLISSUESTATUS='提单签出' then TTLNODR else 0 END ELSE 0 END) CTTLNODR_YQC");
searchStr.Append(" ,sum(CASE WHEN BLISSUESTATUS<>'提单签出' then RMBNODR else 0 END) RMBNODR_WQC");
searchStr.Append(" ,sum(CASE WHEN BLISSUESTATUS<>'提单签出' then USDNODR else 0 END) USDNODR_WQC");
searchStr.Append(" ,sum(CASE WHEN BLISSUESTATUS<>'提单签出' then TTLNODR else 0 END) TTLNODR_WQC");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN CASE WHEN BLISSUESTATUS<>'提单签出' then RMBNODR else 0 END ELSE 0 END) CRMBNODR_WQC");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN CASE WHEN BLISSUESTATUS<>'提单签出' then USDNODR else 0 END ELSE 0 END) CUSDNODR_WQC");
searchStr.Append(" ,SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN CASE WHEN BLISSUESTATUS<>'提单签出' then TTLNODR else 0 END ELSE 0 END) CTTLNODR_WQC");