strSql.Append(",[dbo].[GetCustOplbStlDay](A.OPDATE,F.CUSTOMERNAME,A.SALE,A.OPLBNAME) AS STLDATE");
strSql.Append(",[dbo].[GetCustOplbStlDay](A.OPDATE,F.CUSTOMERNAME,A.SALE,A.OPLBNAME) AS STLDATE");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=A.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =F.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 WHEN '半月结' then 15 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=A.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =F.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
}
}
else
else
{
{
strSql.Append(",CASE WHEN A.STLDATE IS NULL THEN dbo.trimdate( A.OPDATE) ELSE dbo.trimdate(A.STLDATE) END STLDATE");
strSql.Append(",CASE WHEN A.STLDATE IS NULL THEN dbo.trimdate( A.OPDATE) ELSE dbo.trimdate(A.STLDATE) END STLDATE");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=A.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =A.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 WHEN '半月结' then 15 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=A.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =A.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
strSql.Append(",[dbo].[GetCustOplbStlDay](B.OPDATE,F.CUSTOMERNAME,B.SALE,B.OPLBNAME) AS STLDATE");
strSql.Append(",[dbo].[GetCustOplbStlDay](B.OPDATE,F.CUSTOMERNAME,B.SALE,B.OPLBNAME) AS STLDATE");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=B.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =F.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 WHEN '半月结' then 15 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=B.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =F.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
}
}
else
else
{
{
strSql.Append(",CASE WHEN B.STLDATE IS NULL THEN dbo.trimdate( B.OPDATE) ELSE dbo.trimdate(B.STLDATE) END STLDATE");
strSql.Append(",CASE WHEN B.STLDATE IS NULL THEN dbo.trimdate( B.OPDATE) ELSE dbo.trimdate(B.STLDATE) END STLDATE");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=B.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =B.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
strSql.Append(",isnull((select top 1 case ACCTYPE WHEN '月结' then accmonth*30 + accdays WHEN '季结' then accmonth*90 + accdays WHEN '旬结' then 10 WHEN '半月结' then 15 else accdays end from Info_Client_ACCDATE where (OPLBNAME='' or OPLBNAME=B.OPLBNAME) AND LINKGID = (select top 1 GID from info_client where shortname =B.CUSTOMERNAME ) AND ((ISNULL(SALE,'')='') or (ISNULL(SALE,'')=B.SALE)) and BGNDATE<=B.OPDATE AND ENDDATE>=B.OPDATE),0) CONTRACTDAY ");
vartastStr=$" update op_seae_edi set MANIFESTSTATUS=MANIFESTSTATUS+' '+'{STATUS}' where HBLNO='{HBLNO}' AND MANIFESTSTATUS not like '%{STATUS}%' ";
vartastStr=$" update op_seae_edi set MANIFESTSTATUS=ISNULL(MANIFESTSTATUS,'')+' '+'{STATUS}' where HBLNO='{HBLNO}' AND ISNULL(MANIFESTSTATUS,'') not like '%{STATUS}%' ";