JinHanShengHang
ddlucky 7 months ago
commit 5ea2c615ab

@ -4827,10 +4827,10 @@ namespace DSWeb.MvcShipping.Controllers
strSql.Append("SUM(G.RMBDR) as RMBDR,SUM(G.RMBCR) AS RMBCR,SUM(G.STLRMBDR) STLRMBDR,SUM(G.STLRMBCR) STLRMBCR,SUM(G.USDDR) AS USDDR,SUM(G.USDCR) AS USDCR,SUM(G.STLUSDDR) STLUSDDR,SUM(G.STLUSDCR) STLUSDCR,SUM(G.OTDR) AS OTDR,SUM(G.OTCR) AS OTCR,SUM(G.STLOTDR) STLOTDR,SUM(G.STLOTCR) STLOTCR,SUM(G.TTLDR) AS TTLDR,SUM(G.TTLCR) AS TTLCR,SUM(G.STLTTLDR) STLTTLDR,SUM(G.STLTTLCR) STLTTLCR");
//else
// strSql.Append("COUNT(DISTINCT B.BSNO) AS BLCOUNT,SUM(G.RMBDR) as RMBDR,SUM(G.RMBCR) AS RMBCR,SUM(G.STLRMBDR) STLRMBDR,SUM(G.STLRMBCR) STLRMBCR,SUM(G.USDDR) AS USDDR,SUM(G.USDCR) AS USDCR,SUM(G.STLUSDDR) STLUSDDR,SUM(G.STLUSDCR) STLUSDCR,SUM(G.OTDR) AS OTDR,SUM(G.OTCR) AS OTCR,SUM(G.STLOTDR) STLOTDR,SUM(G.STLOTCR) STLOTCR,SUM(G.TTLDR) AS TTLDR,SUM(G.TTLCR) AS TTLCR,SUM(G.STLTTLDR) STLTTLDR,SUM(G.STLTTLCR) STLTTLCR");
strSql.Append(",SUM(CASE WHEN A.OPTYPE='普通货' THEN A.NETWEIGHT ELSE 0 END) AS NETWEIGHT,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.TEU ELSE 0 END) AS TEU,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR1 ELSE 0 END) AS CNTR1,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN B.CNTR2 ELSE 0 END) AS CNTR2,");
strSql.Append("SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR3 ELSE 0 END) AS CNTR3,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR4 ELSE 0 END) AS CNTR4,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR5 ELSE 0 END) AS CNTR5,");
strSql.Append("SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR6 ELSE 0 END) AS CNTR6,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR7 ELSE 0 END) AS CNTR7,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR8 ELSE 0 END) AS CNTR8,");
strSql.Append("SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR9 ELSE 0 END) AS CNTR9,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.CNTR10 ELSE 0 END) AS CNTR10,SUM(CASE WHEN A.OPTYPE='普通货' AND (A.BLTYPE='整箱' OR A.BLTYPE='拼箱主票' OR A.BLTYPE='合票主票') THEN A.OTCNTR ELSE 0 END) AS OTCNTR");
strSql.Append(",SUM(CASE WHEN B.OPTYPE='普通货' THEN B.NETWEIGHT ELSE 0 END) AS NETWEIGHT,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.TEU ELSE 0 END) AS TEU,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR1 ELSE 0 END) AS CNTR1,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR2 ELSE 0 END) AS CNTR2,");
strSql.Append("SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR3 ELSE 0 END) AS CNTR3,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR4 ELSE 0 END) AS CNTR4,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR5 ELSE 0 END) AS CNTR5,");
strSql.Append("SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR6 ELSE 0 END) AS CNTR6,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR7 ELSE 0 END) AS CNTR7,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR8 ELSE 0 END) AS CNTR8,");
strSql.Append("SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR9 ELSE 0 END) AS CNTR9,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.CNTR10 ELSE 0 END) AS CNTR10,SUM(CASE WHEN B.OPTYPE='普通货' AND (B.BLTYPE='整箱' OR B.BLTYPE='拼箱主票' OR B.BLTYPE='合票主票') THEN B.OTCNTR ELSE 0 END) AS OTCNTR");
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.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");

@ -707,12 +707,11 @@ namespace DSWeb.MvcShipping.DAL.MsOpCtnrDAL
strSqlCtnr.Append("update op_ctnmng_ctndetail set ISBERETURN=0 where CTNGID in(select CTNGID from op_ctnmng_detail where CTNGID IN (" + ids + ") AND BSNO='" + BSNO + "')");
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSqlCtnr.ToString(), null);
}
if (isdeletectn)
{
var strSqlMng = new StringBuilder();
strSqlMng.Append("DELETE FROM op_ctnmng_detail WHERE CTNGID IN (" + ids + ") AND BSNO='" + BSNO + "'");
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSqlMng.ToString(), null);
}
// var strSql2 = new StringBuilder();
// strSql2.Append("DELETE FROM op_ctnmng_ctnstatus WHERE CTNGID IN (" + ids + ") AND BSNO='" + BSNO + "'");
// SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql2.ToString(), null);

@ -37244,10 +37244,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
r.WriteLine("MEA+WT+G+KGM:" + Math.Round((ctn.KGS / ctn.CTNNUM), 2, MidpointRounding.AwayFromZero).ToString() + "'");
icount = icount + 1;
}
if (bill.CARGOID == "G") {
r.WriteLine("HAN+NOR'");
icount = icount + 1;
}
if (bill.CARGOID == "R")
{
@ -37291,6 +37288,12 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
}
if (bill.CARGOID == "G")
{
r.WriteLine("HAN+NOR'");
icount = icount + 1;
}
}
}
@ -38370,11 +38373,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
r.WriteLine("MEA+WT+G+KGM:" + Math.Round(ctn.KGS, 3) + "'");
r.WriteLine("MEA+VOL+AAW+CBM:" + Math.Round(ctn.CBM, 3) + "'");
icount = icount + 3;
if (bill.CARGOID == "G")
{
r.WriteLine("HAN+NOR'");
icount = icount + 1;
}
if (bill.CARGOID == "R")
{
if (bill.REEFERF != "")
@ -38386,6 +38385,12 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
r.WriteLine("SEL+" + ctn.SEALNO + "+CA'");
icount = icount + 1;
if (bill.CARGOID == "G")
{
r.WriteLine("HAN+NOR'");
icount = icount + 1;
}
if (bill.CARGOID == "R")
{
var tempset = bill.TEMPSET;

@ -908,6 +908,502 @@ namespace DSWeb.MvcShipping.DAL.MsRptSaleBalProfitShareDAL
#endregion
#region 明海
static public List<MsOpBillProfit> GetMHDataList(string strCondition, string Month, string userid, string usercode, string companyid, string sort = null)
{
DateTime CurDateBegin = Convert.ToDateTime(Month + "-01");
DateTime CurDateEnd = CurDateBegin.AddMonths(1).AddDays(-1);
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
if (!string.IsNullOrEmpty(rangstr))
{
if (!string.IsNullOrEmpty(strCondition))
{
strCondition = strCondition + " and " + rangstr;
}
else
{
strCondition = rangstr;
}
}
var strSql = new StringBuilder();
strSql.Append(" if object_id('tempdb..##SALEPROFITSHARE" + usercode + "') is not null Begin DROP TABLE ##SALEPROFITSHARE" + usercode + " End ");
strSql.Append("SELECT * into ##SALEPROFITSHARE" + usercode + " FROM (SELECT B.BSNO, B.OPLB,B.OPTYPE,B.OPLBNAME, B.BSTYPE,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("B.ETD,B.OPDATE,B.CUSTOMDATE,B.FEESTATUSREF,B.BLFRT,B.BSSOURCEDETAIL,B.STLNAME");
strSql.Append(",CASE WHEN B.STLDATE=B.ETD THEN B.STLDATE ELSE B.STLDATE+1 END STLDATE ");
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.RMBDR,B.RMBCR,B.STLRMBDR,B.STLRMBCR,B.USDDR,B.USDCR,B.STLUSDDR,B.STLUSDCR,B.OTDR,B.OTCR,B.STLOTDR,B.STLOTCR,B.TTLDR,B.TTLCR,B.STLTTLDR,B.STLTTLCR");
strSql.Append(",B.USDPROFIT,B.RMBPROFIT,B.OTPROFIT,B.NOACCTAXTTLPROFIT TTLPROFIT,B.PROFITRATE,B.RMBNODR,B.USDNODR,B.OTNODR,B.TTLNODR,B.RMBNOCR,B.USDNOCR,B.OTNOCR,B.TTLNOCR ");
strSql.Append(",T.SETTLETIME,f.ISFEE,T.STLTTLDR MONTHSTLTTLDR,DATEDIFF([day],B.ETD,T.SETTLETIME) ACTUALDAY,DATEDIFF([day],CASE WHEN B.STLDATE=B.ETD THEN B.STLDATE ELSE DATEADD(day,1,B.STLDATE) END,T.SETTLETIME) NODAY");
strSql.Append(",B.ACCDATE ETDMONTH,(CASE f.ISFEE WHEN 1 THEN '已发放' else '未发放' end) as ISFEEREF ");
strSql.Append(",OPTC,SWTC,KOUXI,JXXS");
strSql.Append(" FROM v_op_bill_gain B ");
strSql.Append("LEFT JOIN V_MAX_SETTLEMENTTIME_BSDR T ON (T.BSNO=B.BSNO) ");
strSql.Append("LEFT JOIN op_sale_proftfee f ON (f.BSNO=B.BSNO) where B.TTLDR=B.STLTTLDR AND B.TTLDR<>0 ");
strSql.Append("AND ((T.SETTLETIME>='" + CurDateBegin.ToString("yyyy-MM-dd") + "' AND T.SETTLETIME<='" + CurDateEnd.ToString("yyyy-MM-dd 23:59:59") + "' ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" and " + strCondition);
}
strSql.Append(" union SELECT B.BSNO, B.OPLB,B.OPTYPE,B.OPLBNAME, B.BSTYPE,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("B.ETD,B.OPDATE,B.CUSTOMDATE,B.FEESTATUSREF,B.BLFRT,B.BSSOURCEDETAIL,B.STLNAME");
strSql.Append(",CASE WHEN B.STLDATE=B.ETD THEN B.STLDATE ELSE B.STLDATE+1 END STLDATE ");
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.RMBDR,B.RMBCR,B.STLRMBDR,B.STLRMBCR,B.USDDR,B.USDCR,B.STLUSDDR,B.STLUSDCR,B.OTDR,B.OTCR,B.STLOTDR,B.STLOTCR,B.TTLDR,B.TTLCR,B.STLTTLDR,B.STLTTLCR");
strSql.Append(",B.USDPROFIT,B.RMBPROFIT,B.OTPROFIT,B.NOACCTAXTTLPROFIT TTLPROFIT,B.PROFITRATE,B.RMBNODR,B.USDNODR,B.OTNODR,B.TTLNODR,B.RMBNOCR,B.USDNOCR,B.OTNOCR,B.TTLNOCR ");
strSql.Append(",T.SETTLETIME,f.ISFEE,0 MONTHSTLTTLDR,DATEDIFF([day],B.ETD,T.SETTLETIME) ACTUALDAY,DATEDIFF([day],CASE WHEN B.STLDATE=B.ETD THEN B.STLDATE ELSE DATEADD(day,1,B.STLDATE) END,T.SETTLETIME) NODAY");
strSql.Append(",B.ACCDATE ETDMONTH,(CASE f.ISFEE WHEN 1 THEN '已发放' else '未发放' end) as ISFEEREF ");
strSql.Append(",OPTC,SWTC,KOUXI,JXXS");
strSql.Append(" FROM v_op_bill_gain B ");
strSql.Append("LEFT JOIN V_MAX_SETTLEMENTTIME_CR T ON (T.BSNO=B.BSNO) ");
strSql.Append("LEFT JOIN op_sale_proftfee f ON (f.BSNO=B.BSNO) where B.TTLCR=B.STLTTLCR AND B.TTLDR=0 ");
strSql.Append(" AND B.ACCDATE>='" + Month + "' ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" and " + strCondition);
}
strSql.Append(" ) AS V ");
//
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by SETTLETIME,CREATETIME DESC");
// strSql.Append(" order by SALE,SETTLETIME,ETD,CREATETIME DESC");
}
return SetMHData(strSql, userid);
}
static public List<MsSaleMonthProfit> GetMHSaleMonthDataList(string strCondition, string Month, DateTime CurDateBegin, string userid)
{
DateTime LastDateBegin = CurDateBegin.AddMonths(-1);
DateTime LastDateEnd = CurDateBegin.AddDays(-1);
DateTime LastThreeDateBegin = CurDateBegin.AddMonths(-3);
DateTime LastFourDateBegin = CurDateBegin.AddMonths(-4);
var strSql = new StringBuilder();
strSql.Append("SELECT SALE,ETDMONTH,SUM(TTLPROFIT) TTLPROFIT,SUM(KOUXI) KOUXI FROM (SELECT B.SALE,B.ACCDATE ETDMONTH,B.TTLPROFIT");
strSql.Append(",KOUXI ");
strSql.Append(" FROM v_op_bill_gain_mhtc B ");
strSql.Append("where ");
strSql.Append(" B.TTLNODR=0 AND B.TTLDR<>0 AND B.TTLPROFIT>=0 ");
strSql.Append("AND B.SETTLETIME<'" + CurDateBegin.ToString("yyyy-MM-dd") + "' AND B.ACCDATE<'" + Month + "' ");
strSql.Append(" AND B.ACCDATE IN (SELECT DISTINCT ACCDATE FROM ##SALEPROFITSHARE" + userid + ") ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" and " + strCondition);
}
//strSql.Append(" union ALL SELECT B.SALE,B.ACCDATE ETDMONTH,BSSOURCE,B.TTLPROFIT");
//strSql.Append(",(CASE WHEN BSSOURCE='直客' THEN TTLPROFIT ELSE 0 END) ZKTTLPROFIT,(CASE WHEN BSSOURCE='直客' THEN 0 ELSE TTLPROFIT END) THTTLPROFIT ");
//strSql.Append(" FROM v_op_bill_gain_tc B ");
//strSql.Append("LEFT JOIN V_MAX_SETTLEMENTTIME_CR T ON (T.BSNO=B.BSNO) ");
//strSql.Append("where B.TTLCR=B.STLTTLCR AND B.TTLDR=0 AND B.TTLPROFIT>=0 ");
//strSql.Append(" AND T.SETTLETIME<='" + LastDateEnd.ToString("yyyy-MM-dd 23:59:59") + "' ");
//strSql.Append(" AND B.ACCDATE IN (SELECT DISTINCT ACCDATE FROM ##SALEPROFITSHARE) ");
//if (!string.IsNullOrEmpty(strCondition))
//{
// strSql.Append(" and " + strCondition);
//}
strSql.Append(" union ALL SELECT B.SALE,B.ACCDATE ETDMONTH,B.TTLPROFIT");
strSql.Append(",KOUXI ");
strSql.Append(" FROM v_op_bill_gain_mhtc B ");
strSql.Append("where B.TTLPROFIT<=0 AND B.ACCDATE<'" + Month + "'");
strSql.Append(" AND B.ACCDATE IN (SELECT DISTINCT ACCDATE FROM ##SALEPROFITSHARE" + userid + ") ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" and " + strCondition);
}
strSql.Append(" ) AS V GROUP BY SALE,ETDMONTH ");
return SetCXSaleMonthData(strSql);
}
static public List<MsSaleMonthProfit> GetMHSaleMonthTTLDataList(string userid)
{
var strSql = new StringBuilder();
strSql.Append("SELECT SALE,ETDMONTH,SUM(TTLPROFIT) TTLPROFIT,SUM(KOUXI) KOUXI FROM (SELECT B.SALE,B.ACCDATE ETDMONTH,B.TTLPROFIT TTLPROFIT");
strSql.Append(",KOUXI ");
strSql.Append(" FROM v_op_bill_gain_mhtc B ");
strSql.Append(" where 1=1 ");
strSql.Append(" AND B.ACCDATE IN (SELECT DISTINCT ACCDATE FROM ##SALEPROFITSHARE" + userid + ") ");
strSql.Append(" ) AS V GROUP BY SALE,ETDMONTH ");
return SetCXSaleMonthData(strSql);
}
private static List<MsOpBillProfit> SetMHData(StringBuilder strSql,string userid)
{
var saleprofitlist = MsInfoSaleProfitShareSetDAL.GetSaleProfitDetailDataList("");
var MsSaleMonthTTLProfitList = GetMHSaleMonthTTLDataList(userid);
var POORDAY = 0;
var MONTHPOORDAY = 0;
SqlCommand cmd = new SqlCommand();
cmd.CommandText = strSql.ToString();
cmd.CommandTimeout = 1200000; //要加这一句
var headList = new List<MsOpBillProfit>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(cmd))
{
while (reader.Read())
{
MsOpBillProfit data = new MsOpBillProfit();
#region Set DB data to Object
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
data.FEESTATUSREF = Convert.ToString(reader["FEESTATUSREF"]);
data.ACCDATE = Convert.ToString(reader["ACCDATE"]);
data.ETDMONTH = Convert.ToString(reader["ETDMONTH"]);
data.OPTYPE = Convert.ToString(reader["OPTYPE"]);
data.OPLB = Convert.ToString(reader["OPLB"]);
data.OPLBNAME = Convert.ToString(reader["OPLBNAME"]);
data.MBLNO = Convert.ToString(reader["MBLNO"]);
data.HBLNO = Convert.ToString(reader["HBLNO"]);
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
data.VESSEL = Convert.ToString(reader["VESSEL"]);
data.VOYNO = Convert.ToString(reader["VOYNO"]);
data.CARRIER = Convert.ToString(reader["CARRIER"]);
data.FORWARDER = Convert.ToString(reader["FORWARDER"]);
data.ETD = Convert.ToString(reader["ETD"]);
data.OPDATE = Convert.ToString(reader["OPDATE"]);
data.CUSTOMDATE = Convert.ToString(reader["CUSTOMDATE"]);
data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]);
data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]);
data.LANE = Convert.ToString(reader["LANE"]);
data.BLFRT = Convert.ToString(reader["BLFRT"]);
data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]);
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);
data.OP = Convert.ToString(reader["OP"]);
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);
data.DOC = Convert.ToString(reader["DOC"]);
data.SALE = Convert.ToString(reader["SALE"]);
data.BSSOURCE = Convert.ToString(reader["BSSOURCE"]);
data.BSSOURCEDETAIL = Convert.ToString(reader["BSSOURCEDETAIL"]);
data.CORPID = Convert.ToString(reader["CORPID"]);
data.STLNAME = Convert.ToString(reader["STLNAME"]);
if (reader["RMBDR"] != DBNull.Value)
data.RMBDR = Convert.ToDecimal(reader["RMBDR"]);
if (reader["RMBCR"] != DBNull.Value)
data.RMBCR = Convert.ToDecimal(reader["RMBCR"]);
if (reader["STLRMBDR"] != DBNull.Value)
data.STLRMBDR = Convert.ToDecimal(reader["STLRMBDR"]);
if (reader["STLRMBCR"] != DBNull.Value)
data.STLRMBCR = Convert.ToDecimal(reader["STLRMBCR"]);
if (reader["RMBNODR"] != DBNull.Value)
data.RMBNODR = Convert.ToDecimal(reader["RMBNODR"]);
if (reader["RMBNOCR"] != DBNull.Value)
data.RMBNOCR = Convert.ToDecimal(reader["RMBNOCR"]);
if (reader["RMBPROFIT"] != DBNull.Value)
data.RMBPROFIT = Convert.ToDecimal(reader["RMBPROFIT"]);
if (reader["USDDR"] != DBNull.Value)
data.USDDR = Convert.ToDecimal(reader["USDDR"]);
if (reader["USDCR"] != DBNull.Value)
data.USDCR = Convert.ToDecimal(reader["USDCR"]);
if (reader["STLUSDDR"] != DBNull.Value)
data.STLUSDDR = Convert.ToDecimal(reader["STLUSDDR"]);
if (reader["STLUSDCR"] != DBNull.Value)
data.STLUSDCR = Convert.ToDecimal(reader["STLUSDCR"]);
if (reader["USDNODR"] != DBNull.Value)
data.USDNODR = Convert.ToDecimal(reader["USDNODR"]);
if (reader["USDNOCR"] != DBNull.Value)
data.USDNOCR = Convert.ToDecimal(reader["USDNOCR"]);
if (reader["USDPROFIT"] != DBNull.Value)
data.USDPROFIT = Convert.ToDecimal(reader["USDPROFIT"]);
if (reader["OTDR"] != DBNull.Value)
data.OTDR = Convert.ToDecimal(reader["OTDR"]);
if (reader["OTCR"] != DBNull.Value)
data.OTCR = Convert.ToDecimal(reader["OTCR"]);
if (reader["STLOTDR"] != DBNull.Value)
data.STLOTDR = Convert.ToDecimal(reader["STLOTDR"]);
if (reader["STLOTCR"] != DBNull.Value)
data.STLOTCR = Convert.ToDecimal(reader["STLOTCR"]);
if (reader["OTNODR"] != DBNull.Value)
data.OTNODR = Convert.ToDecimal(reader["OTNODR"]);
if (reader["OTNOCR"] != DBNull.Value)
data.OTNOCR = Convert.ToDecimal(reader["OTNOCR"]);
if (reader["OTPROFIT"] != DBNull.Value)
data.OTPROFIT = Convert.ToDecimal(reader["OTPROFIT"]);
if (reader["TTLDR"] != DBNull.Value)
data.TTLDR = Convert.ToDecimal(reader["TTLDR"]);
if (reader["TTLCR"] != DBNull.Value)
data.TTLCR = Convert.ToDecimal(reader["TTLCR"]);
if (reader["STLTTLDR"] != DBNull.Value)
data.STLTTLDR = Convert.ToDecimal(reader["STLTTLDR"]);
if (reader["MONTHSTLTTLDR"] != DBNull.Value)
data.MONTHSTLTTLDR = Convert.ToDecimal(reader["MONTHSTLTTLDR"]);
if (reader["STLTTLCR"] != DBNull.Value)
data.STLTTLCR = Convert.ToDecimal(reader["STLTTLCR"]);
if (reader["TTLNODR"] != DBNull.Value)
data.TTLNODR = Convert.ToDecimal(reader["TTLNODR"]);
if (reader["TTLNOCR"] != DBNull.Value)
data.TTLNOCR = Convert.ToDecimal(reader["TTLNOCR"]);
if (reader["TTLPROFIT"] != DBNull.Value)
data.TTLPROFIT = Convert.ToDecimal(reader["TTLPROFIT"]);
if (reader["ACTUALDAY"] != DBNull.Value)
data.ACTUALDAY = Convert.ToInt32(reader["ACTUALDAY"]);
if (reader["NODAY"] != DBNull.Value)
data.NODAY = Convert.ToInt32(reader["NODAY"]);
if (reader["NOMONTH"] != DBNull.Value)
data.NOMONTH = Convert.ToInt32(reader["NOMONTH"]);
if (data.TTLPROFIT < 0)
{
data.ACTUALDAY = 0;
}
var isfind = false;
MsSaleMonthTTLProfitList.ForEach(i =>
{
if (i.SALE == data.SALE && i.ETDMONTH == data.ETDMONTH)
{
data.MONTHTTLPR = i.TTLPROFIT;
}
});
//if (!isfind)
//{
// var salemonthprofit = new MsSaleMonthProfit();
// salemonthprofit.SALE = data.SALE;
// salemonthprofit.ETDMONTH = data.ETDMONTH;
// salemonthprofit.TTLPROFIT = data.TTLPROFIT;
// data.COMPR = data.TTLPROFIT;
// MsSaleMonthProfitList.Add(salemonthprofit);
//}
decimal beginplan = 0;
decimal endplan = 0;
decimal SHAREPR = 0;
if (data.TTLPROFIT <= 0)
{
data.NODAY = 0;
}
var TTLPROFIT = data.TTLPROFIT;
if ((data.COMPR - TTLPROFIT) >= (data.MONTHTTLPR - data.MONTHTRAVEFEE) && data.COMPR > 0)
TTLPROFIT = 0;
else if ((data.COMPR) >= (data.MONTHTTLPR - data.MONTHTRAVEFEE) && (data.COMPR > 0))
TTLPROFIT = (data.MONTHTTLPR - data.MONTHTRAVEFEE) - (data.COMPR - TTLPROFIT);
saleprofitlist.ForEach(i =>
{
if (i.SALE == data.SALE && ((data.COMPR > i.PROFITDOWN) || ((data.COMPR - TTLPROFIT) > i.PROFITDOWN)) && ((data.MONTHTTLPR >= i.PROFITPLAN && i.PROFITPLAN > 0) || (i.PROFITPLAN <= 0)))
{
POORDAY = i.POORDAY;
MONTHPOORDAY = i.MONTHPOORDAY;
if (data.STLNAME == "现结买单" || data.STLNAME == "" || data.STLNAME == null)
{
data.ACTNODAY = data.NODAY;
//if (data.TTLPROFIT < 0)
//{
// data.ACTUALDAY = 0;
//}
if (data.ACTNODAY <= 21)
{
// data.NOMONTH = 0;
data.TiChengQuJian = 100;
}
else if (data.ACTNODAY > 22 && data.ACTNODAY <= 30)
{
// data.NOMONTH = 1;
data.TiChengQuJian = 80;
}
else if (data.ACTNODAY > 31 && data.ACTNODAY <= 45)
{
// data.NOMONTH = 2;
data.TiChengQuJian = 60;
}
else if (data.ACTNODAY > 46)
{
// data.NOMONTH = 3;
data.TiChengQuJian = 0;
}
// data.ACTNODAY = data.NODAY - POORDAY;
}
else
{
data.ACTNODAY = data.NODAY - MONTHPOORDAY;
//if (data.TTLPROFIT < 0)
//{
// data.ACTUALDAY = 0;
//}
if (data.ACTNODAY <= 0)
{
//data.NOMONTH = 0;
data.TiChengQuJian = 100;
}
else if (data.ACTNODAY > 0 && data.ACTNODAY <= 30)
{
// data.NOMONTH = 1;
data.TiChengQuJian = 80;
}
else if (data.ACTNODAY > 30 && data.ACTNODAY <= 60)
{
// data.NOMONTH = 2;
data.TiChengQuJian = 60;
}
else if (data.ACTNODAY > 60)
{
// data.NOMONTH = 3;
data.TiChengQuJian = 0;
}
}
data.TiChengBiLi = i.SHAREPR * data.TiChengQuJian / 100;
SHAREPR = i.SHAREPR;
beginplan = i.PROFITDOWN;
endplan = i.PROFITUP;
if (((data.COMPR - TTLPROFIT) <= i.PROFITUP || data.COMPR <= i.PROFITUP))
{
if (data.COMPR <= i.PROFITUP)
{
var TMPTTLPROFIT = TTLPROFIT;
if ((data.COMPR - TTLPROFIT) <= i.PROFITDOWN) TMPTTLPROFIT = (data.COMPR - i.PROFITDOWN + 1) - (data.TTLPROFIT - TTLPROFIT);
//TMPTTLPROFIT = TMPTTLPROFIT + 1;
data.TiCheng = data.TiCheng + TMPTTLPROFIT * data.TiChengBiLi / 100;
if (!string.IsNullOrEmpty(data.TiChengBiLiStr))
data.TiChengBiLiStr = data.TiChengBiLiStr + "+" + Convert.ToString(data.TiChengQuJian / 100) + "*(" + TMPTTLPROFIT.ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
else
data.TiChengBiLiStr = Convert.ToString(data.TiChengQuJian / 100) + "*(" + TMPTTLPROFIT.ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
}
else
{
var TMPTTLPROFIT = (i.PROFITUP - i.PROFITDOWN) + 1;
if ((data.COMPR - data.TTLPROFIT) > i.PROFITDOWN) TMPTTLPROFIT = (i.PROFITUP - (data.COMPR - data.TTLPROFIT));
if (TTLPROFIT == 0) TMPTTLPROFIT = 0;
data.TiCheng = data.TiCheng + TMPTTLPROFIT * data.TiChengBiLi / 100;
if (!string.IsNullOrEmpty(data.TiChengBiLiStr))
data.TiChengBiLiStr = data.TiChengBiLiStr + "+" + Convert.ToString(data.TiChengQuJian / 100) + "*(" + TMPTTLPROFIT.ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
else
data.TiChengBiLiStr = Convert.ToString(data.TiChengQuJian / 100) + "*(" + TMPTTLPROFIT.ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
}
}
}
});
//decimal lasttc = 0;
//decimal lastpr = 0;
//decimal lasttcxs = 0;
//var TTLPROFIT = data.TTLPROFIT;
// if ((data.COMPR - TTLPROFIT) >= (data.MONTHTTLPR - data.MONTHTRAVEFEE)&&data.COMPR>0)
// TTLPROFIT = 0;
// else if ((data.COMPR) >= (data.MONTHTTLPR - data.MONTHTRAVEFEE)&&(data.COMPR>0))
// TTLPROFIT = (data.MONTHTTLPR - data.MONTHTRAVEFEE)- (data.COMPR - TTLPROFIT);
//data.TiChengBiLiStr = Convert.ToString(data.TiChengQuJian / 100) + "*(" + TTLPROFIT.ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
//if (data.TiChengBiLi != 0) {
// if (beginplan > (data.COMPR - TTLPROFIT)) {
// var bpr = (data.COMPR - beginplan);
// data.TiCheng = Math.Round(data.TiChengBiLi * bpr / 100, 2);
// data.TiChengBiLiStr = Convert.ToString(data.TiChengQuJian / 100) + "*(" + bpr.ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
// lastpr = data.COMPR - TTLPROFIT;
// saleprofitlist.ForEach(i =>
// {
// if (i.SALE == data.SALE && lastpr > i.PROFITDOWN && lastpr <= i.PROFITUP)
// {
// lasttcxs = i.SHAREPR * data.TiChengQuJian / 100;
// SHAREPR = i.SHAREPR;
// beginplan = i.PROFITDOWN;
// endplan = i.PROFITUP;
// }
// });
// if (TTLPROFIT - bpr > 0) {
// lasttc = Math.Round(lasttcxs * (TTLPROFIT - bpr) / 100, 2);
// if (lasttc != 0)
// data.TiChengBiLiStr = data.TiChengBiLiStr + "+" + Convert.ToString(data.TiChengQuJian / 100) + "*(" + (TTLPROFIT - bpr).ToString() + "*" + Convert.ToString(SHAREPR / 100) + ")";
// }
// if (lasttc != 0) {
// data.TiCheng = data.TiCheng + lasttc;
// data.PRREMARK = "系数:" + lasttcxs.ToString() + "提成:" + lasttc.ToString();
// }
// } else
// data.TiCheng = Math.Round(data.TiChengBiLi * TTLPROFIT / 100, 2);
//} else data.TiCheng = 0;
data.PROFITRATE = Convert.ToString(reader["PROFITRATE"]);
if (reader["SETTLETIME"] != DBNull.Value)
data.SETTLETIME = Convert.ToDateTime(reader["SETTLETIME"]).ToString("yyyy-MM-dd");
data.ISSALEFEE = Convert.ToString(reader["ISFEEREF"]);
// data.ACTUALDAY=
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
#region 晨星
static public List<MsOpBillProfit> GetCXDataList(string strCondition, string Month, string expDate_Min, string expDate_Max, string userid, string usercode, string companyid, string sort = null)

@ -356,7 +356,7 @@ Ext.extend(Shipping.MsChDuiIndex, Ext.Panel, {
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsChDui/Edit');
DsOpenEditWin('/MvcShipping/MsChDui/Edit', record.data.DUINO);
}, this);
//#region formSearch

@ -19,7 +19,7 @@ namespace DSWeb.SoftMng.Common
/// <returns>如果参数存在不安全字符则返回true</returns>
public static bool SqlFilterExist(string source)
{
string pattern = @"(insert|(?<!is)delete(?!(?<=isdelete))|database|(?<=[\p{L}\p{N}_])\bgo\b(?=[\p{L}\p{N}_])|(?<!\s)\bgo\b(?!\s)(?:(?!\r?\n).)*|(?<=\r?\n)\bgo\b(?:(?!\r?\n).)*(?=\r?\n)|\bgo\b(?=(?:(?!\r?\n).)*\s*$)|db_name|sys.|exec|create|grant|revoke|alter|execute|drop|openrowset|drop table|update|truncate|asc\(|mid\(|char\(|xp_cmdshell|netlocalgroup administrators|net user|dec|exec|database|chr|declare)([\s+.*]|$)";
string pattern = @"(insert|(?<!is)delete(?!(?<=isdelete))|database|(?<=[\p{L}\p{N}_])\bgo\b(?=[\p{L}\p{N}_])|(?<!\s)\bgo\b(?!\s)(?:(?!\r?\n).)*|(?<=\r?\n)\bgo\b(?:(?!\r?\n).)*(?=\r?\n)|\bgo\b(?=(?:(?!\r?\n).)*\s*$)|db_name|sys.|exec|create|grant|revoke|alter|execute|drop|openrowset|drop table|update|truncate|asc\(|mid\(|char\(|xp_cmdshell|netlocalgroup administrators|net user|exec|database|chr|declare)([\s+.*]|$)";
if (Regex.IsMatch(source, pattern, RegexOptions.IgnoreCase))
return true;
return false;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Loading…
Cancel
Save