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.
DS7/DSWeb/Areas/Account/Controllers/ChMonthCloseController.cs

105 lines
3.6 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.Areas.Account.Models.BSNOLB;
using DSWeb.Areas.Account.Models.MsOpBill;
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
using DSWeb.Areas.Account.Models.ChMonthClose;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
namespace DSWeb.Areas.Account.Controllers
{
/// <summary>
/// 月末结账
/// </summary>
[JsonRequestBehavior]
public class ChMonthCloseController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
public ContentResult GetNowPeriod(string condition)
{
Period head = null;
head = ChMonthCloseDAL.GetData(condition, Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string data, string type)
{
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 headData = JsonConvert.Deserialize<Period>(data);
if (type != "-1")
{
var SlSQL = "select COUNT(*) CT from v_op_bill where ISNULL(FEESTATUS,0)=0 AND ACCDATE='" + headData.PERIOD + "' ";
if (headData.SUBCOMP != "")
SlSQL = SlSQL + " and CORPID='" + Convert.ToString(Session["COMPANYID"]).ToString().Trim() + "'";
var RPTPRNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='RPTPRNOCANCEL'");
if (RPTPRNOCANCEL.PARAMVALUE == "1")
{
SlSQL = SlSQL + " and isnull(ISCANCEL,0)<>1 ";
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var strCT = T_ALL_DA.GetStrSQL("CT", SlSQL);
if (strCT != "0" && strCT != "")
{
var jsonRespose3 = new JsonResponse { Success = false, Message = "此会计期间,存在未费用锁定的业务,不能结转!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) };
}
}
DBResult result = ChMonthCloseDAL.MonthClose(headData, type, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ChMonthCloseDAL.GetData("1=1", Convert.ToString(Session["COMPANYID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}