@ -515,7 +515,10 @@ namespace DSWeb.MvcShipping.Controllers
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.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.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(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -557,7 +560,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( ",B.CUSTOMDATE" ) ;
strSql . Append ( ",B.CUSTOMDATE" ) ;
strSql . Append ( ",B.FEESTATUS" ) ;
strSql . Append ( ",B.FEESTATUS" ) ;
strSql . Append ( ",B.CUSTSERVICE,B.FRCUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE,B.DESTINATION, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID" ) ;
strSql . Append ( ",B.CUSTSERVICE,B.FRCUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE,B.DESTINATION, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID" ) ;
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 ") ;
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, OP_SEAE.ORDEROP ") ;
}
}
else
else
@ -599,7 +602,9 @@ namespace DSWeb.MvcShipping.Controllers
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.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(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -639,7 +644,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( ",B.CUSTOMDATE" ) ;
strSql . Append ( ",B.CUSTOMDATE" ) ;
strSql . Append ( ",B.FEESTATUS" ) ;
strSql . Append ( ",B.FEESTATUS" ) ;
strSql . Append ( ",B.CUSTSERVICE,B.FRCUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE,B.DESTINATION, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID" ) ;
strSql . Append ( ",B.CUSTSERVICE,B.FRCUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE,B.DESTINATION, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID" ) ;
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 ") ;
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, OP_SEAE.ORDEROP ") ;
}
}
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
@ -770,7 +775,11 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -837,7 +846,10 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -1000,7 +1012,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -1069,7 +1083,7 @@ namespace DSWeb.MvcShipping.Controllers
// strSql.Append(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,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 NOACCTAXTTLPROFIT");
strSql . Append ( " FROM V_OP_B ILL B ") ;
strSql . Append ( " FROM V_OP_B S B ") ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -1303,7 +1317,7 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_B ILL B ") ;
strSql . Append ( " FROM V_OP_B S B ") ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -1469,7 +1483,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.SALE) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.SALE) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
@ -1536,7 +1552,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.SALE) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.SALE) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -1703,7 +1721,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
@ -1770,7 +1790,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -1943,7 +1965,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.OP) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.OP) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
@ -2010,7 +2034,10 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.OP) " ) ;
strSql . Append ( " LEFT JOIN VW_user U ON (U.SHOWNAME=B.OP) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -2166,7 +2193,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -2231,7 +2260,9 @@ namespace DSWeb.MvcShipping.Controllers
// strSql.Append(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
// strSql.Append(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -2386,7 +2417,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -2450,7 +2483,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -2603,7 +2638,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -2670,7 +2707,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -2825,7 +2864,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -2889,7 +2930,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -3042,7 +3085,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -3106,7 +3151,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -3261,7 +3308,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -3324,7 +3373,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -3355,7 +3406,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( " and " + condition ) ;
strSql . Append ( " and " + condition ) ;
}
}
}
}
strSql . Append ( " Group by B.DOC ") ;
strSql . Append ( " Group by B.DOC ,OP_SEAE.ORDEROP ") ;
@ -3539,7 +3590,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -3699,7 +3752,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -3763,7 +3818,9 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
// strSql.Append(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,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 NOACCTAXTTLPROFIT");
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -3914,7 +3971,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -3977,7 +4036,9 @@ namespace DSWeb.MvcShipping.Controllers
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -4190,7 +4251,9 @@ namespace DSWeb.MvcShipping.Controllers
}
}
else
else
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN V_OP_BILL A ON (A.PARENTID=B.BSNO) " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
@ -4256,7 +4319,9 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( ", (CASE WHEN (SUM(G.TTLCR))= 0 THEN 0 ELSE CONVERT(NUMERIC(18,2),ltrim(str((SUM(G.TTLDR-G.TTLCR)) / (SUM(G.TTLCR)) * 100, 10, 2))) END) AS PROFITRATE" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
if ( ! string . IsNullOrEmpty ( feecondition ) )
if ( ! string . IsNullOrEmpty ( feecondition ) )
{
{
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
strSql . Append ( "LEFT JOIN (SELECT BSNO, sum(RMBDR) RMBDR,SUM(RMBCR) RMBCR,SUM(STLRMBDR) STLRMBDR,SUM(STLRMBCR) STLRMBCR,SUM(USDDR) USDDR" ) ;
@ -4381,11 +4446,13 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( ",SUM(G.NOACCTAXRMBDR) NOACCTAXRMBDR,SUM(G.NOACCTAXRMBCR) NOACCTAXRMBCR,SUM(G.NOACCTAXUSDDR) NOACCTAXUSDDR,SUM(G.NOACCTAXUSDCR) NOACCTAXUSDCR,SUM(G.NOACCTAXOTDR) NOACCTAXOTDR" ) ;
strSql . Append ( ",SUM(G.NOACCTAXRMBDR) NOACCTAXRMBDR,SUM(G.NOACCTAXRMBCR) NOACCTAXRMBCR,SUM(G.NOACCTAXUSDDR) NOACCTAXUSDDR,SUM(G.NOACCTAXUSDCR) NOACCTAXUSDCR,SUM(G.NOACCTAXOTDR) NOACCTAXOTDR" ) ;
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.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.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(",SUM(G.NOACCTAXTTLDR) AS TTLACCTAXDR,SUM(G.NOACCTAXTTLCR) AS TTLACCTAXCR,SUM(G.NOACCTAXTTLDR-G.NOACCTAXTTLCR) AS TTLACCTAXPROFIT");
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN v_op_gain_sum G ON (G.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN v_op_gain_sum G ON (G.BSNO=B.BSNO) " ) ;
strSql . Append ( " LEFT JOIN info_client C ON (C.SHORTNAME=B.CUSTOMERNAME) " ) ;
strSql . Append ( " LEFT JOIN info_client C ON (C.SHORTNAME=B.CUSTOMERNAME) " ) ;
strSql . Append ( " WHERE 1=1 " ) ;
strSql . Append ( " WHERE 1=1 " ) ;
@ -4401,7 +4468,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( ",B.CUSTOMDATE" ) ;
strSql . Append ( ",B.CUSTOMDATE" ) ;
strSql . Append ( ",B.FEESTATUS" ) ;
strSql . Append ( ",B.FEESTATUS" ) ;
strSql . Append ( ",B.CUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID" ) ;
strSql . Append ( ",B.CUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,B.NETWEIGHT,B.KGS,B.TEU,B.CNTRTOTAL,B.CORPID" ) ;
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 ") ;
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, OP_SEAE.ORDEROP ") ;
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
@ -4464,8 +4531,10 @@ namespace DSWeb.MvcShipping.Controllers
strSql . Append ( "SELECT B.BSNO,B.MBLNO,B.OPTYPE, B.CUSTNO,B.ACCDATE,G.TTLDR-G.TTLCR TTLPROFIT" ) ;
strSql . Append ( "SELECT B.BSNO,B.MBLNO,B.OPTYPE, B.CUSTNO,B.ACCDATE,G.TTLDR-G.TTLCR TTLPROFIT" ) ;
strSql . Append ( " FROM V_OP_BILL B " ) ;
strSql . Append ( ",OP_SEAE.ORDEROP" ) ;
strSql . Append ( "LEFT JOIN v_op_gain_sum G ON (G.BSNO=B.BSNO) " ) ;
strSql . Append ( " FROM V_OP_BS B " ) ;
strSql . Append ( " LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) " ) ;
strSql . Append ( "LEFT JOIN v_op_gain_sum G ON (G.BSNO=B.BSNO) " ) ;
strSql . Append ( " WHERE 1=1 " ) ;
strSql . Append ( " WHERE 1=1 " ) ;