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.

151 lines
8.1 KiB
C#

using System;
using System.Data;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.Models.RptCwGLDetailColumn;
using DSWeb.MvcShipping.DAL.RptCwGLDetailColumnDAL;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.EntityDA;
using DSWeb.Areas.RptMng.Comm;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class RptCwGLDetailColumnController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
//查询
public ContentResult GetDataList(int start, int limit, string sort, string condition, string ACCDATEbgn, string ACCDATEend, string strCURRENCY, string strACCID, string strCustNAME, string strDeptName, string strSALE, string strITEMNAME, string strSubjectAccount, int acctype)
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
String strSql = RptCwGLDetailColumnDAL.GetDataList(condition, ACCDATEbgn, ACCDATEend, strCURRENCY, strACCID, strCustNAME, strDeptName, strSALE, strITEMNAME, strSubjectAccount, acctype, 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() });
DataSet ds = T_ALL_DA.GetAllSQL(strSql.ToString());
var json = RptHelper.GetRptJsonResult(start, limit, ds, true);
return new ContentResult() { Content = json };
}
//打印
public ContentResult GetDataListStr(string condition, string ACCDATEbgn, string ACCDATEend, string strCURRENCY, string strACCID, string strCustNAME, string strDeptName, string strSALE, string strITEMNAME, string strSubjectAccount, int acctype)
{
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 dataListStr = RptCwGLDetailColumnDAL.GetDataListStr(condition, ACCDATEbgn, ACCDATEend, strCURRENCY, strACCID, strCustNAME, strDeptName, strSALE, strITEMNAME, strSubjectAccount, acctype, 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 GetDataListSQL(string condition, string ACCDATEbgn, string ACCDATEend, string strCURRENCY, string strACCID, string strCustNAME, string strDeptName, string strSALE, string strITEMNAME, string strSubjectAccount, int acctype)
{
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 dataListStr = RptCwGLDetailColumnDAL.GetDataListSQL(condition, ACCDATEbgn, ACCDATEend, strCURRENCY, strACCID, strCustNAME, strDeptName, strSALE, strITEMNAME, strSubjectAccount, acctype, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
//dataListStr = "select " + dataListStr + "";
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
#region 币别_下拉框
public JsonResult GetCodeCurrencyList()
{
var evList = RptCwGLDetailColumnDAL.GetCodeCurrencyList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeCurrencyModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 核算项目_下拉框
public JsonResult GetSubjectAccount(string condition, string ACCDATEbgn)
{
var evList = RptCwGLDetailColumnDAL.GetSubjectAccount(condition, ACCDATEbgn, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = true, data = new SubjectAccountModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 判断是否显示核算项目
public ContentResult GetIsSubject(string condition, string ACCDATEbgn)
{
DBResult result = RptCwGLDetailColumnDAL.GetIsSubject(condition, ACCDATEbgn, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 子科目_循环列
public JsonResult GetCwAccitemsGl(string condition, string ACCDATEbgn, string ACCDATEend, string strCURRENCY, string strACCID, string strCustNAME, string strDeptName, string strSALE, string strITEMNAME)
{
var evList = RptCwGLDetailColumnDAL.GetCwAccitemsGl(condition, ACCDATEbgn, ACCDATEend, strCURRENCY, strACCID, strCustNAME, strDeptName, strSALE, strITEMNAME, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 核算项目_循环列
public JsonResult GetSubject(string condition, string ACCDATEbgn, string ACCDATEend, string strCURRENCY, string strACCID, string strCustNAME, string strDeptName, string strSALE, string strITEMNAME, string strSubjectAccount)
{
var evList = RptCwGLDetailColumnDAL.GetSubject(condition, ACCDATEbgn, ACCDATEend, strCURRENCY, strACCID, strCustNAME, strDeptName, strSALE, strITEMNAME, strSubjectAccount, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
}
}