'20220708发布'

QDHHYT
ddlucky 2 years ago
parent 398beb1a26
commit ea4e04a09f

@ -63,7 +63,7 @@ namespace DSWeb.MvcShipping.Controllers
if (!string.IsNullOrEmpty(strDa)) if (!string.IsNullOrEmpty(strDa))
{ {
strDa = strDa.Replace("B.",""); strDa = strDa.Replace("B.", "");
if (!string.IsNullOrEmpty(condition)) if (!string.IsNullOrEmpty(condition))
{ {
condition = condition + " and " + strDa; condition = condition + " and " + strDa;
@ -270,7 +270,7 @@ 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_gain_sum_INV G"); strSql.Append(" FROM v_op_gain_sum_INV G");
strSql.Append(" Where " + feecondition); strSql.Append(" Where " + feecondition);
strSql.Append("GROUP BY BSNO) G ON (G.BSNO=A.BSNO) "); strSql.Append("GROUP BY BSNO) G ON (G.BSNO=A.BSNO) ");
@ -283,7 +283,7 @@ namespace DSWeb.MvcShipping.Controllers
else else
{ {
strSql.Append("LEFT JOIN v_op_gain_sum G ON (G.BSNO=A.BSNO) "); strSql.Append("LEFT JOIN v_op_gain_sum G ON (G.BSNO=A.BSNO) ");
// strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.BSNO=A.BSNO) "); // strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.BSNO=A.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 ");
@ -355,11 +355,11 @@ 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_gain_sum_INV G"); strSql.Append(" FROM v_op_gain_sum_INV G");
strSql.Append(" Where " + feecondition); strSql.Append(" Where " + feecondition);
strSql.Append("GROUP BY BSNO) G ON (G.BSNO=B.BSNO) "); strSql.Append("GROUP BY BSNO) G ON (G.BSNO=B.BSNO) ");
// strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.BSNO=B.BSNO) "); // strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.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 ISNULL(G.BSNO,'')<>'' "); strSql.Append(" WHERE ISNULL(G.BSNO,'')<>'' ");
@ -367,7 +367,7 @@ namespace DSWeb.MvcShipping.Controllers
else else
{ {
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 OP_CLOSE CL ON (CL.BSNO=B.BSNO) "); // strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.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 ");
@ -603,7 +603,7 @@ 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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -620,7 +620,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql.Append(" FROM v_op_gain_sum_INV G"); strSql.Append(" FROM v_op_gain_sum_INV G");
strSql.Append(" Where " + feecondition); strSql.Append(" Where " + feecondition);
strSql.Append("GROUP BY BSNO) G ON (G.BSNO=B.BSNO) "); strSql.Append("GROUP BY BSNO) G ON (G.BSNO=B.BSNO) ");
// strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.BSNO=B.BSNO) "); // strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.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 ISNULL(G.BSNO,'')<>'' "); strSql.Append(" WHERE ISNULL(G.BSNO,'')<>'' ");
@ -628,7 +628,7 @@ namespace DSWeb.MvcShipping.Controllers
else else
{ {
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 OP_CLOSE CL ON (CL.BSNO=B.BSNO) "); // strSql.Append("LEFT JOIN OP_CLOSE CL ON (CL.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 ");
@ -847,7 +847,7 @@ 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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
@ -1083,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_BS B "); strSql.Append(" FROM V_OP_BILL 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");
@ -1317,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_BS B "); strSql.Append(" FROM V_OP_BILL 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");
@ -1353,7 +1353,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql.Append(" Group by B.SALE "); strSql.Append(" Group by B.SALE ");
} }
else else
strSql.Append(" Group by B.SALE, B.BSSOURCE "); strSql.Append(" Group by B.SALE, B.BSSOURCE ");
@ -1553,7 +1553,7 @@ 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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); 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))
@ -1619,7 +1619,7 @@ namespace DSWeb.MvcShipping.Controllers
var sortstring = DatasetSort.Getsortstring(sort); var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring)) if (!string.IsNullOrEmpty(sortstring))
{ {
// sortstring = sortstring.Replace("SALEDEPT", "U.DEPTNAME"); // sortstring = sortstring.Replace("SALEDEPT", "U.DEPTNAME");
strSql.Append(" order by " + sortstring); strSql.Append(" order by " + sortstring);
} }
else else
@ -1791,7 +1791,7 @@ 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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -1825,11 +1825,11 @@ namespace DSWeb.MvcShipping.Controllers
} }
if (OPRPTONLYOP.PARAMVALUE == "1") if (OPRPTONLYOP.PARAMVALUE == "1")
{ {
strSql.Append(" Group by B.OP "); strSql.Append(" Group by B.OP,OP_SEAE.ORDEROP ");
} }
else else
{ {
strSql.Append(" Group by B.OP, B.BSTYPE "); strSql.Append(" Group by B.OP, B.BSTYPE,OP_SEAE.ORDEROP ");
} }
@ -1847,7 +1847,8 @@ namespace DSWeb.MvcShipping.Controllers
strSql.Append(" order by B.OP"); strSql.Append(" order by B.OP");
} }
else { else
{
strSql.Append(" order by B.OP, B.BSTYPE"); strSql.Append(" order by B.OP, B.BSTYPE");
@ -1965,9 +1966,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(",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))
@ -2034,10 +2033,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(",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) ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -2193,9 +2189,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(",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))
{ {
@ -2260,9 +2254,7 @@ 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(",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) ");
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");
@ -2417,9 +2409,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(",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))
{ {
@ -2482,10 +2472,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_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");
@ -2638,9 +2625,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(",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))
{ {
@ -2706,10 +2691,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_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");
@ -2864,9 +2846,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(",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))
{ {
@ -2929,10 +2909,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_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");
@ -3085,9 +3062,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(",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))
{ {
@ -3150,10 +3125,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_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");
@ -3374,7 +3346,7 @@ 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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -3406,7 +3378,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql.Append(" and " + condition); strSql.Append(" and " + condition);
} }
} }
strSql.Append(" Group by B.DOC,OP_SEAE.ORDEROP "); strSql.Append(" Group by B.DOC,OP_SEAE.ORDEROP ");
@ -3418,7 +3390,7 @@ namespace DSWeb.MvcShipping.Controllers
} }
else else
{ {
strSql.Append(" order by B.DOC"); strSql.Append(" order by B.DOC");
} }
@ -3440,7 +3412,7 @@ namespace DSWeb.MvcShipping.Controllers
} }
else else
{ {
strSql.Append(" order by B.DOC"); strSql.Append(" order by B.DOC");
} }
@ -3591,7 +3563,7 @@ 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_BS B "); strSql.Append(" FROM V_OP_BILL B ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -3819,7 +3791,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_BS B "); strSql.Append(" FROM V_OP_BILL B ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -4037,7 +4009,7 @@ 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_BS B "); strSql.Append(" FROM V_OP_BILL B ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -4320,7 +4292,7 @@ namespace DSWeb.MvcShipping.Controllers
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
if (!string.IsNullOrEmpty(feecondition)) if (!string.IsNullOrEmpty(feecondition))
{ {
@ -4426,22 +4398,22 @@ namespace DSWeb.MvcShipping.Controllers
var strSql = new StringBuilder(); var strSql = new StringBuilder();
strSql.Append("SELECT B.BSNO, B.OPLB,B.OPTYPE,B.OPLBNAME, B.BSTYPE,B.BLTYPE,B.CUSTOMERNAME, B.CUSTNO, B.MBLNO, B.HBLNO,B.VESSEL, B.VOYNO, B.INPUTBY, B.CREATETIME, B.BSSTATUS, B.SALE, B.OP, B.DOC,"); strSql.Append("SELECT B.BSNO, B.OPLB,B.OPTYPE,B.OPLBNAME, B.BSTYPE,B.BLTYPE,B.CUSTOMERNAME, B.CUSTNO, B.MBLNO, B.HBLNO,B.VESSEL, B.VOYNO, B.INPUTBY, B.CREATETIME, B.BSSTATUS, B.SALE, B.OP, B.DOC,");
strSql.Append("C.[DESCRIPTION] AS CUSTFULLNAME, "); strSql.Append("C.[DESCRIPTION] AS CUSTFULLNAME, ");
strSql.Append("B.ETD,B.PKGS,B.CBM,B.NETWEIGHT"); strSql.Append("B.ETD,B.PKGS,B.CBM,B.NETWEIGHT");
strSql.Append(",B.OPDATE,B.ENTERP,B.REMARK"); strSql.Append(",B.OPDATE,B.ENTERP,B.REMARK");
strSql.Append(",case B.FEESTATUS when 1 then '锁定' else '未锁定' end as FEESTATUSREF"); strSql.Append(",case B.FEESTATUS when 1 then '锁定' else '未锁定' end as FEESTATUSREF");
strSql.Append(",B.CUSTSERVICE, B.PORTLOAD, B.PORTDISCHARGE, B.CUSTOMNO, B.ACCDATE,B.CARRIER, B.BSSOURCE, B.LANE, B.FORWARDER,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.CNTRTOTAL,B.CORPID");
strSql.Append(",B.TRADETYPE,B.GOODSNAME,B.FEESTATUS"); strSql.Append(",B.TRADETYPE,B.GOODSNAME,B.FEESTATUS");
strSql.Append(",SUM(G.RMBDR) RMBDR,SUM(G.RMBCR) RMBCR,SUM(G.STLRMBDR) STLRMBDR,SUM(G.STLRMBCR) STLRMBCR,SUM(G.USDDR) USDDR,SUM(G.USDCR) USDCR,"); strSql.Append(",SUM(G.RMBDR) RMBDR,SUM(G.RMBCR) RMBCR,SUM(G.STLRMBDR) STLRMBDR,SUM(G.STLRMBCR) STLRMBCR,SUM(G.USDDR) USDDR,SUM(G.USDCR) USDCR,");
strSql.Append("SUM(G.STLUSDDR) STLUSDDR,SUM(G.STLUSDCR) STLUSDCR,SUM(G.OTDR) OTDR,SUM(G.OTCR) OTCR,SUM(G.STLOTDR) STLOTDR,SUM(G.STLOTCR) STLOTCR,SUM(G.TTLDR) TTLDR,"); strSql.Append("SUM(G.STLUSDDR) STLUSDDR,SUM(G.STLUSDCR) STLUSDCR,SUM(G.OTDR) OTDR,SUM(G.OTCR) OTCR,SUM(G.STLOTDR) STLOTDR,SUM(G.STLOTCR) STLOTCR,SUM(G.TTLDR) TTLDR,");
strSql.Append("SUM(G.TTLCR) TTLCR,SUM(G.STLTTLDR) STLTTLDR,SUM(G.STLTTLCR) STLTTLCR"); strSql.Append("SUM(G.TTLCR) TTLCR,SUM(G.STLTTLDR) STLTTLDR,SUM(G.STLTTLCR) STLTTLCR");
strSql.Append(",SUM(ISNULL(G.USDDR-G.USDCR,0)) AS USDPROFIT,SUM(ISNULL(G.RMBDR-G.RMBCR,0)) AS RMBPROFIT,SUM(ISNULL(G.OTDR-G.OTCR,0)) AS OTPROFIT,SUM(ISNULL(G.TTLDR-G.TTLCR,0)) AS TTLPROFIT "); strSql.Append(",SUM(ISNULL(G.USDDR-G.USDCR,0)) AS USDPROFIT,SUM(ISNULL(G.RMBDR-G.RMBCR,0)) AS RMBPROFIT,SUM(ISNULL(G.OTDR-G.OTCR,0)) AS OTPROFIT,SUM(ISNULL(G.TTLDR-G.TTLCR,0)) AS TTLPROFIT ");
strSql.Append(",SUM(ISNULL(G.RMBDR-G.STLRMBDR,0)) AS RMBNODR,SUM(ISNULL(G.USDDR-G.STLUSDDR,0)) AS USDNODR,SUM(ISNULL(G.OTDR-G.STLOTDR,0)) AS OTNODR,SUM(ISNULL(G.TTLDR-G.STLTTLDR,0)) AS TTLNODR"); strSql.Append(",SUM(ISNULL(G.RMBDR-G.STLRMBDR,0)) AS RMBNODR,SUM(ISNULL(G.USDDR-G.STLUSDDR,0)) AS USDNODR,SUM(ISNULL(G.OTDR-G.STLOTDR,0)) AS OTNODR,SUM(ISNULL(G.TTLDR-G.STLTTLDR,0)) AS TTLNODR");
strSql.Append(",SUM(ISNULL(G.RMBCR-G.STLRMBCR,0)) AS RMBNOCR,SUM(ISNULL(G.USDCR-G.STLUSDCR,0)) AS USDNOCR,SUM(ISNULL(G.OTCR-G.STLOTCR,0)) AS OTNOCR,SUM(ISNULL(G.TTLCR-G.STLTTLCR,0)) AS TTLNOCR"); strSql.Append(",SUM(ISNULL(G.RMBCR-G.STLRMBCR,0)) AS RMBNOCR,SUM(ISNULL(G.USDCR-G.STLUSDCR,0)) AS USDNOCR,SUM(ISNULL(G.OTCR-G.STLOTCR,0)) AS OTNOCR,SUM(ISNULL(G.TTLCR-G.STLTTLCR,0)) AS TTLNOCR");
strSql.Append(",SUM(G.NOTAXRMBDR) NOTAXRMBDR,SUM(G.NOTAXRMBCR) NOTAXRMBCR,SUM(G.NOTAXUSDDR) NOTAXUSDDR,SUM(G.NOTAXUSDCR) NOTAXUSDCR,SUM(G.NOTAXOTDR) NOTAXOTDR"); strSql.Append(",SUM(G.NOTAXRMBDR) NOTAXRMBDR,SUM(G.NOTAXRMBCR) NOTAXRMBCR,SUM(G.NOTAXUSDDR) NOTAXUSDDR,SUM(G.NOTAXUSDCR) NOTAXUSDCR,SUM(G.NOTAXOTDR) NOTAXOTDR");
strSql.Append(",SUM(G.NOTAXOTCR) NOTAXOTCR,SUM(G.NOTAXTTLDR) NOTAXTTLDR,SUM(G.NOTAXTTLCR) NOTAXTTLCR,SUM(G.NOTAXUSDDR-G.NOTAXUSDCR) AS NOTAXUSDPROFIT"); strSql.Append(",SUM(G.NOTAXOTCR) NOTAXOTCR,SUM(G.NOTAXTTLDR) NOTAXTTLDR,SUM(G.NOTAXTTLCR) NOTAXTTLCR,SUM(G.NOTAXUSDDR-G.NOTAXUSDCR) AS NOTAXUSDPROFIT");
strSql.Append(",SUM(G.NOTAXRMBDR-G.NOTAXRMBCR) AS NOTAXRMBPROFIT,SUM(G.NOTAXOTDR-G.NOTAXOTCR) AS NOTAXOTPROFIT,SUM(G.NOTAXTTLDR-G.NOTAXTTLCR) AS NOTAXTTLPROFIT "); strSql.Append(",SUM(G.NOTAXRMBDR-G.NOTAXRMBCR) AS NOTAXRMBPROFIT,SUM(G.NOTAXOTDR-G.NOTAXOTCR) AS NOTAXOTPROFIT,SUM(G.NOTAXTTLDR-G.NOTAXTTLCR) AS NOTAXTTLPROFIT ");
strSql.Append(",SUM(G.TTLDR-G.NOACCTAXTTLDR) AS TTLTAXDR,SUM(G.TTLCR-G.NOACCTAXTTLCR) AS TTLTAXCR,SUM(G.TTLDR-G.NOACCTAXTTLDR-(G.TTLCR-G.NOACCTAXTTLCR)) AS TTLTAXPROFIT"); strSql.Append(",SUM(G.TTLDR-G.NOACCTAXTTLDR) AS TTLTAXDR,SUM(G.TTLCR-G.NOACCTAXTTLCR) AS TTLTAXCR,SUM(G.TTLDR-G.NOACCTAXTTLDR-(G.TTLCR-G.NOACCTAXTTLCR)) AS TTLTAXPROFIT");
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");
@ -4449,26 +4421,26 @@ 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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); 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 ");
if (!string.IsNullOrEmpty(condition)) if (!string.IsNullOrEmpty(condition))
{ {
strSql.Append(" and " + condition); strSql.Append(" and " + condition);
} }
strSql.Append(" GROUP BY B.BSNO, B.OPLB,B.OPTYPE,B.OPLBNAME, B.BSTYPE,B.BLTYPE,B.CUSTOMERNAME, B.CUSTNO, B.MBLNO, B.HBLNO,B.VESSEL, B.VOYNO, B.INPUTBY, B.CREATETIME, B.BSSTATUS, B.SALE, B.OP, B.DOC,"); strSql.Append(" GROUP BY B.BSNO, B.OPLB,B.OPTYPE,B.OPLBNAME, B.BSTYPE,B.BLTYPE,B.CUSTOMERNAME, B.CUSTNO, B.MBLNO, B.HBLNO,B.VESSEL, B.VOYNO, B.INPUTBY, B.CREATETIME, B.BSSTATUS, B.SALE, B.OP, B.DOC,");
strSql.Append("C.[DESCRIPTION] , "); strSql.Append("C.[DESCRIPTION] , ");
strSql.Append("B.ETD,B.PKGS,B.CBM,B.NETWEIGHT"); strSql.Append("B.ETD,B.PKGS,B.CBM,B.NETWEIGHT");
strSql.Append(",B.OPDATE,B.ENTERP,B.REMARK"); strSql.Append(",B.OPDATE,B.ENTERP,B.REMARK");
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,OP_SEAE.ORDEROP"); 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"))
@ -4524,50 +4496,50 @@ namespace DSWeb.MvcShipping.Controllers
} }
} }
public ContentResult BsParentListData( string condition, string sort) public ContentResult BsParentListData(string condition, string sort)
{ {
var strSql = new StringBuilder(); var strSql = new StringBuilder();
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(",OP_SEAE.ORDEROP"); strSql.Append(",OP_SEAE.ORDEROP");
strSql.Append(" FROM V_OP_BS B "); strSql.Append(" FROM V_OP_BILL B ");
strSql.Append(" LEFT JOIN OP_SEAE ON (OP_SEAE.BSNO=B.BSNO) "); 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(" WHERE 1=1 "); strSql.Append(" WHERE 1=1 ");
if (!string.IsNullOrEmpty(condition)) if (!string.IsNullOrEmpty(condition))
{ {
strSql.Append(" and " + condition); strSql.Append(" and " + condition);
} }
var sortstring = DatasetSort.Getsortstring(sort); var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring)) if (!string.IsNullOrEmpty(sortstring))
{ {
strSql.Append(" order by " + sortstring); strSql.Append(" order by " + sortstring);
} }
else else
{ {
strSql.Append(" order by B.ETD DESC,B.MBLNO"); strSql.Append(" order by B.ETD DESC,B.MBLNO");
} }
var dbparams = new List<CustomDbParamter>(); var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter(); var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL"; paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String; paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input; paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString(); paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL); dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set"); var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(0, 50, dbRptResult, "Result_Set", true); var json = RptHelper.GetRptJsonResult(0, 50, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json }; return new ContentResult() { Content = json };
} }
@ -4614,10 +4586,10 @@ namespace DSWeb.MvcShipping.Controllers
} }
else if (visiblerange == "2") else if (visiblerange == "2")
{ {
var rangeDa = new RangeDA(); var rangeDa = new RangeDA();
var deptid = rangeDa.GetDEPTGID(userid); var deptid = rangeDa.GetDEPTGID(userid);
str = " (B.OP in (select showname from vw_user where deptgid='" + deptid + "') OR B.SALE in (select showname from vw_user where deptgid='" + deptid + "') OR B.CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') " str = " (B.OP in (select showname from vw_user where deptgid='" + deptid + "') OR B.SALE in (select showname from vw_user where deptgid='" + deptid + "') OR B.CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') "
+ " OR B.DOC in (select showname from vw_user where deptgid='" + deptid + "') OR B.FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') )"; + " OR B.DOC in (select showname from vw_user where deptgid='" + deptid + "') OR B.FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') )";
} }
else if (visiblerange == "5") else if (visiblerange == "5")

@ -4,7 +4,7 @@
<ProjectView>ShowAllFiles</ProjectView> <ProjectView>ShowAllFiles</ProjectView>
<NameOfLastUsedPublishProfile>H:\DS7\DSWeb\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>H:\DS7\DSWeb\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress /> <Use64BitIISExpress />
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save