|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.TruckMng.Models.Comm;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.Account.DAL.Chfee_management;
|
|
|
|
|
using DSWeb.Areas.Account.Models.Chfee_management;
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
|
|
using DSWeb.Areas.TruckMng.DAL.Comm;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.Areas.Import.Models.CwVouchers;
|
|
|
|
|
using DSWeb.Areas.Import.Models.CwVouitems;
|
|
|
|
|
using DSWeb.Areas.Import.Models.CwDesign;
|
|
|
|
|
using DSWeb.Areas.Import.Models.CWAccitems;
|
|
|
|
|
using DSWeb.Areas.Import.DAL.CwVouchersDAL;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.Areas.Account.Models.MsCwVouchersGl3;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsCwVouchersGlManagementController : Controller
|
|
|
|
|
{
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 主列表查询
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = Chfee_managementDAL.GetDataList(condition, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
|
|
|
|
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 GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
C_Mmb head = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = Chfee_managementDAL.GetDataList(condition, Convert.ToString(Session["USERID"]));
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
head = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new C_Mmb();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 费用列表查询
|
|
|
|
|
public ContentResult GetFeeList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var _condition = condition;
|
|
|
|
|
List<C_MBodymb> list = Chfee_managementDAL.GetBodyList(_condition, Convert.ToString(Session["USERID"]));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetFeeList_Index ( string condition )
|
|
|
|
|
{
|
|
|
|
|
var _condition = condition;
|
|
|
|
|
List<C_MBodymb_2> list = Chfee_managementDAL.GetBodyList_Index(_condition, Convert.ToString(Session["USERID"]));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 生成总账凭证
|
|
|
|
|
public ContentResult GetCodeCurrencyList(string strGids)
|
|
|
|
|
{
|
|
|
|
|
var dataList = Chfee_managementDAL.GetCodeCurrencyList(strGids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult onAddCwVouchers(string strGids, string dataDiv, string jsonBody)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<MsCwVouchersGl3>(dataDiv);
|
|
|
|
|
List<MsCwVouchersGl4> bodyList = new List<MsCwVouchersGl4>();
|
|
|
|
|
if (jsonBody != null)
|
|
|
|
|
{
|
|
|
|
|
bodyList = JsonConvert.Deserialize<List<MsCwVouchersGl4>>(jsonBody);
|
|
|
|
|
}
|
|
|
|
|
if (bodyList == null && headData.ISRATE == false)
|
|
|
|
|
{
|
|
|
|
|
headData.ISRATE = true;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
DBResult result2 = Chfee_managementDAL.GetIsVoucher(strGids, Convert.ToString(Session["USERID"]));
|
|
|
|
|
if (!result2.Success)
|
|
|
|
|
{
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = result2.Success, Message = result2.Message, Data = "" };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
DBResult result = Chfee_managementDAL.onAddCwVouchers(strGids, headData, bodyList, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
//
|
|
|
|
|
string sGids = "'" + strGids.Trim().Replace(",", "','") + "'";
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
string sVOUCHERNO = T_ALL_DA.GetStrSQL("VOUCHERNO", "select top 1 VOUCHERNO from ch_fee_settlement where gid in (" + sGids + ")");
|
|
|
|
|
//
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = sVOUCHERNO };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetIsVoucher(string strGids)
|
|
|
|
|
{
|
|
|
|
|
DBResult result = Chfee_managementDAL.GetIsVoucher(strGids, Convert.ToString(Session["USERID"]));
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否自动弹出结算总账凭证
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult onIsSettlementsopen()
|
|
|
|
|
{
|
|
|
|
|
DBResult result = Chfee_managementDAL.onIsSettlementsopen(Convert.ToString(Session["USERID"]));
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|