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; using DSWeb.MvcShipping.DAL.MsRptSaleBalProfitShareDAL; using DSWeb.MvcShipping.Models.MsOpBillProfit; namespace DSWeb.MvcShipping.Controllers { /// /// 利润报表查询 /// [JsonRequestBehavior] public class MsRptSaleBalProfitShareController : Controller { // // GET: /MvcShipping/MsRptOpProfit public ActionResult Index() { return View(); } /// /// 好品佳和 入口 /// /// public ActionResult HPJHIndex() { return View(); } public ActionResult PlanIndex() { return View(); } public ActionResult LHIndex() { return View(); } public ActionResult RQIndex() { return View(); } public ActionResult BTIndex() { return View(); } public ActionResult HYIndex() { return View(); } public ActionResult TravelFee() { return View(); } public ActionResult CXIndex() { return View(); } // public ActionResult TCIndex() { return View(); } // /// /// 展鸿 入口 /// /// public ActionResult ZHIndex() { return View(); } /// /// 泰邦 提成报表 入口 /// /// public ActionResult TBIndex() { return View(); } public ContentResult BsListData(int start, int limit, string condition, string stlcondition, bool isdrzero, string dcondition,bool isallstl,string sort, string printstr, string sortstr, string dcondition2="") { var dataList = MsRptSaleBalProfitShareDAL.GetDataList(condition, stlcondition, dcondition, dcondition2,isdrzero,isallstl, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetDataListStr(int start, int limit, string condition, string stlcondition, bool isdrzero, string dcondition, bool isallstl, string sort, string printstr, string sortstr, string dcondition2 = "") { var dataListStr = MsRptSaleBalProfitShareDAL.GetDataListStr(condition, stlcondition, dcondition, dcondition2, isdrzero,isallstl,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr }); return new ContentResult() { Content = json }; } public ContentResult GetLHDataList(int start, int limit, string condition, string Month, string sort, string printstr, string sortstr) { var dataList = MsRptSaleBalProfitShareDAL.GetLHDataList(condition, Month, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetRQDataList(int start, int limit, string condition, string stlcondition, bool isdrzero, string dcondition, bool isallstl, string sort, string printstr, string sortstr, string dcondition2 = "") { var dataList = MsRptSaleBalProfitShareDAL.GetRQDataList(condition, stlcondition, dcondition, dcondition2, isdrzero, isallstl, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetBTDataList(int start, int limit, string condition, string stlcondition,string datecondition,string datetype, bool isdrzero, string dcondition, bool isallstl, string sort, string printstr, string sortstr, string dcondition2 = "") { var dataList = MsRptSaleBalProfitShareDAL.GetBTDataList(condition, stlcondition, dcondition, dcondition2, datecondition, datetype, isdrzero, isallstl, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); // var salelist = MsRptSaleBalProfitShareDAL.SumBTData(dataList); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList()}); return new ContentResult() { Content = json }; } public ContentResult GetHYDataList(int start, int limit, string condition, string stlcondition, string datecondition, string datetype, bool isdrzero, string dcondition, bool isallstl, string sort, string printstr, string sortstr, string dcondition2 = "") { var dataList = MsRptSaleBalProfitShareDAL.GetHYDataList(condition, stlcondition, dcondition, dcondition2, datecondition, datetype, isdrzero, isallstl, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); // var salelist = MsRptSaleBalProfitShareDAL.SumBTData(dataList); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetCXDataList(int start, int limit, string condition, string Month, string expDate_Min, string expDate_Max, string sort, string printstr, string sortstr) { var dataList = MsRptSaleBalProfitShareDAL.GetCXDataList(condition, Month, expDate_Min, expDate_Max,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),""); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetCXDataListStr(string condition, string Month, string expDate_Min, string expDate_Max, string sort, string printstr, string sortstr) { var dataListStr = MsRptSaleBalProfitShareDAL.GetCXDataListStr(condition, Month, expDate_Min, expDate_Max, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), ""); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr }); return new ContentResult() { Content = json }; } public ContentResult GetCXTCListData(int start, int limit, string condition, string sort) { var strSql = new StringBuilder(); strSql.Append("SELECT *,(select ShowName from [user] where GID=op_sale_tc.INPUTBY) as INPUTBYREF"); strSql.Append(" FROM op_sale_tc"); strSql.Append(" WHERE 1=1 "); if (!string.IsNullOrEmpty(condition)) { strSql.Append(" and " + condition); } var sortstring = DatasetSort.Getsortstring(sort); if (!string.IsNullOrEmpty(sortstring)) { strSql.Append(" order by " + sortstring); } else { strSql.Append(" order by INPUTDATE"); } var dbparams = new List(); 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 GetZHDataList(int start, int limit, string condition, string isalldr, string isonlystl, string sort, string printstr, string sortstr) { var dataList = MsRptSaleBalProfitShareDAL.GetZHDataList(condition, isalldr, isonlystl, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } /// /// 好品佳和 提成计算 /// /// /// /// /// /// /// /// /// /// public ContentResult GetHPJHDataList(int start, int limit, string condition, string isalldr, string isonlystl, string sort, string printstr, string sortstr) { var dataList = MsRptSaleBalProfitShareDAL.GetHPJHDataList(condition, isalldr, isonlystl, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } /// /// 泰邦 提成计算 /// /// /// /// /// /// /// /// /// /// public ContentResult GetTBDataList(int start, int limit, string condition, string TEU, string PROFITBOUNDS, string sort, string printstr, string sortstr) { var dataList = MsRptSaleBalProfitShareDAL.GetTBDataList(condition, TEU, PROFITBOUNDS, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetTBDataListStr(int start, int limit, string condition, string TEU, string PROFITBOUNDS, string sort, string printstr, string sortstr) { var data = MsRptSaleBalProfitShareDAL.GetTBDataListStr(condition, TEU, PROFITBOUNDS, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = data.ToString() }); return new ContentResult() { Content = json }; } public ContentResult SaveFee(string data) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.SaveFee(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SetFee(string data) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.SetFee(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SetFeeCX(string data, string Month, string expDate_Min, string expDate_Max) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.SetFeeCX(bodyList,Month,expDate_Min,expDate_Max, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult CancelSetFee(string data) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.CancelSetFee(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult CancelSetFeeCX(string data, string type) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.CancelSetFeeCX(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SetFeeRQ(string data,string type,string ffdate) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.SetFeeRQ(bodyList,type,ffdate,Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult CancelSetFeeRQ(string data,string type) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.CancelSetFeeRQ(bodyList, Convert.ToString(Session["USERID"]),type); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetTravelFeeList(int start, int limit, string condition, string sort) { var dataList = MsRptSaleBalProfitShareDAL.GetSaleTravelFeeList(condition,sort); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult SaveTravelFeeDetail(string body) { if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") { var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // var bodyList = JsonConvert.Deserialize>(body); DBResult result = MsRptSaleBalProfitShareDAL.SaveTravelFee(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult DeleteOpSaleTravelDetail(string data) { var headData = JsonConvert.Deserialize>(data); DBResult result = MsRptSaleBalProfitShareDAL.DeleteOpSaleTravelDetail(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } //public ContentResult SumListData(int start, int limit, string condition, string stlcondition, bool isdrzero, string sort, string printstr) //{ // var dataList = MsRptSaleBalProfitShareDAL.GetDataList(condition, isdrzero,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); // var list = dataList.Skip(start).Take(limit); // var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); // return new ContentResult() { Content = json }; //} #region #endregion #region 参照部分 #endregion } }