You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
234 lines
9.1 KiB
C#
234 lines
9.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 费用状态查询
|
|
/// </summary>
|
|
[JsonRequestBehavior]
|
|
public class MsRptFeeModifyController : Controller
|
|
{
|
|
//
|
|
// GET: /MvcShipping/MsRptFeeStatus
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
public ContentResult BsListData(int start, int limit, string condition, string sort, string printstr)
|
|
{
|
|
var strDa = GetRangDAStr("index", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
if (!string.IsNullOrEmpty(strDa))
|
|
{
|
|
if (!string.IsNullOrEmpty(condition))
|
|
{
|
|
condition = condition + " and " + strDa;
|
|
}
|
|
else
|
|
{
|
|
condition = strDa;
|
|
}
|
|
}
|
|
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT B.BSNO, B.OPLB, 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("case B.ETD when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.ETD,23) end as ETD");
|
|
strSql.Append(",case B.OPDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.OPDATE,23) end as OPDATE,B.ENTERP");
|
|
strSql.Append(",case B.CUSTOMDATE when '1900-01-01 00:00:00.000' then '' else CONVERT(varchar(100), B.CUSTOMDATE,23) end as CUSTOMDATE");
|
|
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(",ISNULL((SELECT SUM(CASE [TYPE] WHEN 1 THEN (CASE WHEN APPLYTYPE IN (1,3) THEN AMOUNT*ExChangerate*-1 ELSE AMOUNT*ExChangerate END) ELSE");
|
|
strSql.Append(" (CASE WHEN APPLYTYPE IN (1,3) THEN AMOUNT*ExChangerate ELSE AMOUNT*ExChangerate*-1 END) END) FROM CH_FEE_MODIFY WHERE BSNO=B.BSNO and APPLYSTATUS=2),0) AS MODIFYPR");
|
|
strSql.Append(" FROM v_op_bill B ");
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
{
|
|
strSql.Append(" Where " + condition);
|
|
}
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql.Append(" order by " + sortstring);
|
|
}
|
|
else
|
|
{
|
|
|
|
strSql.Append(" order by B.CUSTOMERNAME,B.OPLB,B.CREATETIME DESC");
|
|
|
|
}
|
|
|
|
if ((!string.IsNullOrEmpty(printstr)) && (printstr == "true"))
|
|
{
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "完成",
|
|
Data = strSql.ToString()
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
var paramps_sSQL = new CustomDbParamter();
|
|
paramps_sSQL.ParameterName = "@sSQL";
|
|
paramps_sSQL.DbType = DbType.String;
|
|
paramps_sSQL.Direction = ParameterDirection.Input;
|
|
paramps_sSQL.Value = strSql.ToString();
|
|
dbparams.Add(paramps_sSQL);
|
|
|
|
|
|
|
|
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
|
|
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeModify(string condition)
|
|
{
|
|
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("select ch_fee_modify.BSNO,ch_fee_modify.FEEID,ch_fee_modify.FEENAME,");
|
|
strSql.Append("ch_fee_modify.TYPE,(case ch_fee_modify.TYPE when 1 then '收'else '付' end) as TYPEREF,ch_fee_modify.APPLYTYPE,");
|
|
strSql.Append("(case ch_fee_modify.APPLYTYPE when 1 then '申请修改'else '申请删除' end) as APPLYTYPEREF,");
|
|
strSql.Append("ch_fee_modify.APPLYUSER,(select ShowName from [user] where GID=ch_fee_modify.APPLYUSER) as APPLYUSERREF,ch_fee_modify.APPLYTIME,");
|
|
strSql.Append("ch_fee_modify.AUDITUSER,(select ShowName from [user] where GID=ch_fee_modify.AUDITUSER) as AUDITUSERREF,ch_fee_modify.AUDITTIME,");
|
|
strSql.Append(" ch_fee_modify.GROUPID from ch_fee_modify where ch_fee_modify.APPLYTYPE in (1,3) and APPLYSTATUS=2 ");
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
{
|
|
strSql.Append(" and " + condition);
|
|
}
|
|
|
|
strSql.Append(" order by APPLYTIME");
|
|
|
|
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
var paramps_sSQL = new CustomDbParamter();
|
|
paramps_sSQL.ParameterName = "@sSQL";
|
|
paramps_sSQL.DbType = DbType.String;
|
|
paramps_sSQL.Direction = ParameterDirection.Input;
|
|
paramps_sSQL.Value = strSql.ToString();
|
|
dbparams.Add(paramps_sSQL);
|
|
|
|
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
|
|
var json = RptHelper.GetRptJsonResult(0, 100, dbRptResult, "Result_Set", true);
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public static string GetRangDAStr(string tb, string userid, string usercode, string companyid)
|
|
{
|
|
string str = "";
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT ");
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE ");
|
|
strSql.Append(" from VW_User_Authority ");
|
|
strSql.Append(" where [NAME]='modFeeModifyreportRange' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
string visiblerange = "4";
|
|
string operaterange = "4";
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
|
|
while (reader.Read())
|
|
{
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
break;
|
|
}
|
|
reader.Close();
|
|
}
|
|
if (visiblerange == "4")
|
|
{
|
|
str = "1=2";
|
|
}
|
|
else if (visiblerange == "3")
|
|
{
|
|
|
|
str = " (B.OP='" + usercode + "' OR B.SALE='" + usercode + "')";
|
|
|
|
}
|
|
else if (visiblerange == "2")
|
|
{
|
|
if (tb == "index")
|
|
{
|
|
var rangeDa = new RangeDA();
|
|
var deptname = rangeDa.GetDEPTNAME(userid);
|
|
var userstr = new StringBuilder();
|
|
userstr.Append(" select SHOWNAME from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')");
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
{
|
|
str = "";
|
|
while (reader.Read())
|
|
{
|
|
if (str == "")
|
|
{
|
|
str = " (B.OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
}
|
|
else
|
|
{
|
|
str = str + " or B.OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
};
|
|
}
|
|
str = str + ")";
|
|
reader.Close();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
str = " UPPER(B.Corpid)='" + companyid + "'";
|
|
}
|
|
|
|
}
|
|
else if (visiblerange == "1")
|
|
{
|
|
str = " UPPER(B.Corpid)='" + companyid + "'";
|
|
}
|
|
|
|
return str;
|
|
}
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|