|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.Areas.Account.DAL.Chfee_Recvapplication;
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Recvapplication;
|
|
|
using DSWeb.Areas.Account.Models.Chfee_do_detail;
|
|
|
using DSWeb.Areas.Account.Models.BillChfeeDetail;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using System.Collections.Generic;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Exrate;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
namespace DSWeb.Areas.Account.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class Chfee_recvapplicationController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET:
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult BLEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//付费申请审核
|
|
|
public ActionResult Audit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), 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 };
|
|
|
}
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
ChRecvapplication head = null;
|
|
|
|
|
|
if (handle == "edit")
|
|
|
{
|
|
|
var list = ChrecvapplicationDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request),Convert.ToString(Session["COMPANYID"]));
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
}
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new ChRecvapplication();
|
|
|
}
|
|
|
|
|
|
if (handle == "add")
|
|
|
{
|
|
|
head.APPLICANT = Convert.ToString(Session["USERID"]);
|
|
|
head.APPLICANTNAME = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.RECVTIME = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
// head.CURR = Convert.ToString(Session["LOCALCURR"]);
|
|
|
head.SETTLETYPE = 7;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetBillList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetBodyList(condition,sort);
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetBillListPrint(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = ChrecvapplicationDAL.GetBodyListStr(condition, sort);
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", Data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetBillSum(string condition)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetBodySumList(condition);
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetFeeDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetFeeDataList(condition, 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 };
|
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetBillDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetAddBillList(condition, 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 };
|
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
|
|
|
|
public ContentResult GetFeeDetailList(string sort, string condition)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetFeeDetailList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetAddSum(string condition)
|
|
|
{
|
|
|
var dataList = ChrecvapplicationDAL.GetAddSum(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
|
{
|
|
|
|
|
|
|
|
|
var headData = JsonConvert.Deserialize<ChRecvapplication>(data);
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
|
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
headData.APPLICANT = Convert.ToString(Session["USERID"]);
|
|
|
headData.APPLYTIME = DateTime.Now;
|
|
|
headData.ENTERTIME = DateTime.Now;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='收费申请'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var RECVAPPBILLISCUSTNO = MsSysParamSetDAL.GetData("PARAMNAME='RECVAPPBILLISCUSTNO'");
|
|
|
if (headData.BILLNO != ""&& RECVAPPBILLISCUSTNO.PARAMVALUE == "1")
|
|
|
{
|
|
|
headData.BILLNO = ChrecvapplicationDAL.GetCustNo(headData.BILLNO); }
|
|
|
else
|
|
|
{
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
headData.BILLNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.RECVTIME.ToString().Trim(), headData.APPLYTIME.ToString());
|
|
|
else
|
|
|
headData.BILLNO = PubSysDAL.GetBillNo("0307");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
var ct = ChrecvapplicationDAL.GetRdCount("GID<>'" + headData.GID + "' AND BILLNO='" + headData.BILLNO + "' ");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
var jsonRespose0 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = "收费申请重复,不允许保存!"
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose0) };
|
|
|
}
|
|
|
|
|
|
var BILLNO = headData.BILLNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
if (result.Success == true) { }
|
|
|
else
|
|
|
{
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.BILLNO);
|
|
|
}
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = ChrecvapplicationDAL.GetData(" BILLNO='" + BILLNO + "'", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult AddDetail(string bill, string data, string curr)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<BillChfeeDetail>>(data);
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = ChrecvapplicationDAL.AddDetail(bill, bodyList, curr, Convert.ToString(Session["COMPANYID"]));
|
|
|
if (result.Success) { ChrecvapplicationDAL.p_update_Amount(bill); }
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult AddBill(string billno, string billcust, string billcurr, string feesql, string storeCurrExrate, bool custgroup = false)
|
|
|
{
|
|
|
var exrateList = JsonConvert.Deserialize<List<ChFeeExrate>>(storeCurrExrate);
|
|
|
|
|
|
if ((exrateList == null) || (exrateList.Count == 0))
|
|
|
{
|
|
|
if (billcurr != "")
|
|
|
exrateList = ChrecvapplicationDAL.GetCurrExrateData(billcust, billcurr, feesql, custgroup);
|
|
|
if ((exrateList == null) || (exrateList.Count == 0))
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = ChrecvapplicationDAL.AddBill(billno, billcust, billcurr, feesql, exrateList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), custgroup);
|
|
|
if (result.Success) { ChrecvapplicationDAL.p_update_Amount(billno); }
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "查询成功", Data = exrateList.ToList() };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = ChrecvapplicationDAL.AddBill(billno, billcust, billcurr, feesql, exrateList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
if (result.Success) { ChrecvapplicationDAL.p_update_Amount(billno); }
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult DelBill(string data, string billno)
|
|
|
{
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<Chfee_do_detail>>(data);
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.DelFeeDo(bodyList);
|
|
|
if (result.Success) { ChrecvapplicationDAL.p_update_Amount(billno); }
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<ChRecvapplication>(data);
|
|
|
var dataList = ChrecvapplicationDAL.GetBodyList("BILLNO='" + headData.BILLNO + "'");
|
|
|
DBResult result = ChrecvapplicationDAL.DelFeeDo(dataList);
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
modb.Delete(headData);
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.BILLNO);
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#region 提交和撤销审核
|
|
|
public ContentResult SubmitAudit(string bill)
|
|
|
{
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.SubmitAudit("FeeSettleAudit", Convert.ToString(Session["USERID"]), bill);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SubmitAuditBack(string bill)
|
|
|
{
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.SubmitAuditBack(bill);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SubmitAuditList(string bills)
|
|
|
{
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.SubmitAuditList(bills);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SubmitAuditBackList(string bills)
|
|
|
{
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.SubmitAuditBackList(bills);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult AuditList(string data)
|
|
|
{
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChRecvapplication>>(data);
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.AuditList(bodyList);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult AuditBackList(string data)
|
|
|
{
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChRecvapplication>>(data);
|
|
|
|
|
|
DBResult result = ChrecvapplicationDAL.AuditBackList(bodyList);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult UpdatePrint(string billnos)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
string blUpSQL = " update ch_fee_recvapplication set PRINTCOUNT=ISNULL(PRINTCOUNT,0)+1 where BILLNO IN (" + billnos + ")";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功!";
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|