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.
156 lines
8.1 KiB
C#
156 lines
8.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;
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
using DSWeb.MvcShipping.DAL.MsRptSaleLiRunTiChengDAL;
|
|
using DSWeb.MvcShipping.Models.MsOpBillProfit;
|
|
using DSWeb.MvcShipping.Models.MsRptSaleLiRunTiCheng;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 业务员提成报表
|
|
/// </summary>
|
|
[JsonRequestBehavior]
|
|
public class MsRptSaleLiRunTiChengController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
#region 报表页面查询
|
|
public ContentResult GetDataList(int start, int limit, string condition, string ShuiLv, string YeWuFeiYong, string GeRenFeiYong, string accDate, string sort)
|
|
{
|
|
var dataList = MsRptSaleLiRunTiChengDAL.GetDataList(condition, ShuiLv, YeWuFeiYong, GeRenFeiYong, accDate, 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(string condition, string ShuiLv, string YeWuFeiYong, string GeRenFeiYong, string accDate, string sort)
|
|
{
|
|
var dataListStr = MsRptSaleLiRunTiChengDAL.GetDataListStr(condition, ShuiLv, YeWuFeiYong, GeRenFeiYong, accDate, 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 };
|
|
}
|
|
#endregion
|
|
|
|
#region 发放/取消提成
|
|
public ContentResult SetFee(string data, string dataHJ, string ShuiLv, string YeWuFeiYong, string GeRenFeiYong, string accDate)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpBillProfit>>(data);
|
|
var bodyListHJ = JsonConvert.Deserialize<List<MsOpBillProfit>>(dataHJ);
|
|
DBResult result = MsRptSaleLiRunTiChengDAL.SetFee(bodyList, bodyListHJ, ShuiLv, YeWuFeiYong, GeRenFeiYong, accDate, 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, string dataHJ, string ShuiLv, string YeWuFeiYong, string GeRenFeiYong, string accDate)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpBillProfit>>(data);
|
|
var bodyListHJ = JsonConvert.Deserialize<List<MsOpBillProfit>>(dataHJ);
|
|
DBResult result = MsRptSaleLiRunTiChengDAL.CancelSetFee(bodyList, bodyListHJ, ShuiLv, YeWuFeiYong, GeRenFeiYong, accDate, Convert.ToString(Session["USERID"]));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
#endregion
|
|
|
|
#region 维护页面查询
|
|
public ContentResult GetCwUserTiChengList(int start, int limit, string strCondition, string sSALE, string accDate, string sort)
|
|
{
|
|
var dataList = MsRptSaleLiRunTiChengDAL.GetCwUserTiChengList(strCondition, sSALE, accDate, 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 GetCwUserTiChengDetailList(int start, int limit, string strCondition, string sort)
|
|
{
|
|
var dataList = MsRptSaleLiRunTiChengDAL.GetCwUserTiChengDetailList(strCondition, 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 };
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 维护页面保存
|
|
public ContentResult SaveRow(string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
var headRow = JsonConvert.Deserialize<MsRptSaleLiRunTiCheng>(data);
|
|
headRow.MODIFIEDUSER = Convert.ToString(Session["USERID"]).Trim();
|
|
headRow.MODIFIEDTIME = DateTime.Now;
|
|
headRow.DbOperationType = DbOperationType.DbotUpd;
|
|
headRow.ModelUIStatus = "E";
|
|
//
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headRow);
|
|
if (result.Message.ToString().IndexOf("重复键") > -1)
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "数据重复,不允许保存!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = null
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
#endregion
|
|
//
|
|
}
|
|
}
|
|
|