using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsCwVouchersGlSettlementDAL;
using DSWeb.MvcShipping.Models.MsCwVouchersGlSettlementEntity;
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.CommMng.DAL;
using DSWeb.Areas.Account.Models.MsCwVouchersGl3;

namespace DSWeb.MvcShipping.Controllers
{
    [JsonRequestBehavior]
    public class MsCwVouchersGlSettlementController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Edit()
        {
            return View();
        }

        public ActionResult RecvAppEdit()
        {
            return View();
        }
        public ActionResult RecvInvEdit()
        {
            return View();
        }
        public ActionResult RecvBLEdit()
        {
            return View();
        }

        public ActionResult PayAppEdit()
        {
            return View();
        }
        public ActionResult PayBLEdit()
        {
            return View();
        }

        //查询
        public ContentResult GetDataList(int start, int limit, string sort, string condition)
        {
            string sortStr = "";
            if (sort != null)
            {
                sortStr = sort.Replace("SETTLEMODEREF", "SETTLEMODE");
                sortStr = sortStr.Replace("SETTLETYPEREF", "SETTLETYPE");
                sortStr = sortStr.Replace("ACCOUNTREF", "ACCOUNTRMB");
                sortStr = sortStr.Replace("SETTLEUSERREF", "SETTLEUSER");
            }
            var dataList = MsCwVouchersGlSettlementDAL.GetDataList(start, limit,condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), sortStr);
            int count = MsCwVouchersGlSettlementDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]));
            var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
            return new ContentResult() { Content = json };
        }
        public ContentResult GetDataListStr(string condition, string sort)
        {
            var dataListStr = MsCwVouchersGlSettlementDAL.GetDataListStr(condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), sort);
            var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
            return new ContentResult() { Content = json };
        }

        //
    }
}