|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.Account.DAL.Chfee_Invoicehexiao;
|
|
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Invoicehexiao;
|
|
|
|
|
using DSWeb.Areas.Account.Models.Chfee_do_detail;
|
|
|
|
|
using DSWeb.Areas.Account.Models.ChfeeDetail;
|
|
|
|
|
using DSWeb.Areas.Account.Models.MsOpBill;
|
|
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Exrate;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
|
|
|
|
|
using DSWeb.Areas.Account.Models.Chfee_do_Sum;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.Account.Controllers
|
|
|
|
|
{
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class Chfee_InvoicehexiaoController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET:
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Audit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult BalIndex()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /
|
|
|
|
|
public ActionResult BalEdit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult PayEdit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult TruckIndex()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /
|
|
|
|
|
public ActionResult TruckEdit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#region GET:
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetDataList(start, limit,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
|
|
int count = ChinvoicehexiaoDAL.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 GetAuditDataList(int start, int limit, string sort, string condition, string isaudit)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetAuditDataList(condition, Convert.ToString(Session["USERID"]), isaudit, 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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
ChInvoicehexiao head = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = ChinvoicehexiaoDAL.GetDataList(0,1,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
head = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new ChInvoicehexiao();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (handle == "add") {
|
|
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBillList(string condition,string sort)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetBodyList(condition,sort);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetTruckBillList(string condition, string sort)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetTruckBodyList(condition, sort);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBillSum(string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetBodySumList(condition);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Chfee_do_Sum> GetBillSumList ( string condition )
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetBodySumList(condition);
|
|
|
|
|
|
|
|
|
|
return dataList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBLListData(int start, int limit, string sort, string condition, string duicondition, string isdebit)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetFeeDataList(condition, isdebit, 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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetTruckBLListData(int start, int limit, string sort, string condition, string duicondition, string isdebit)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetTruckFeeDataList(condition, isdebit, 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 };
|
|
|
|
|
}
|
|
|
|
|
public ContentResult GetFeeDetailList(string condition, string sort)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetFeeDetailList(condition,sort);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBillDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetAddBillList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
|
|
int count = ChinvoicehexiaoDAL.getAddBillTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", totalCount = count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存/删除
|
|
|
|
|
public ContentResult Save(string opstatus, string data)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var headData = JsonConvert.Deserialize<ChInvoicehexiao>(data);
|
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
headData.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
headData.OPDATE = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='发票核销'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
|
|
headData.BILLNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.INVDATE.ToString().Trim(), headData.OPDATE.ToString());
|
|
|
|
|
else
|
|
|
|
|
headData.BILLNO = PubSysDAL.GetBillNo("0302");
|
|
|
|
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
headData.ModelUIStatus = "E";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
if (headData.INVNO != "")
|
|
|
|
|
{
|
|
|
|
|
var ct = ChinvoicehexiaoDAL.GetRdCount("BILLNO<>'" + headData.BILLNO + "' AND INVNO='" + headData.INVNO + "' ");
|
|
|
|
|
if (ct != 0)
|
|
|
|
|
{
|
|
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = false,
|
|
|
|
|
Message = "发票号重复,不允许保存!"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = false,
|
|
|
|
|
Message = "发票号为空,不允许保存!"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);
|
|
|
|
|
headData.MODIFIEDTIME =DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var BILLNO = headData.BILLNO;
|
|
|
|
|
string YuanBiJinE = "";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<Chfee_do_Sum> temp = GetBillSumList(" BILLNO='" + BILLNO + "'");
|
|
|
|
|
foreach (var item in temp)
|
|
|
|
|
{
|
|
|
|
|
YuanBiJinE += (item.CURRENCY + item.AMOUNT+" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
YuanBiJinE = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
headData.YuanBiJinE = YuanBiJinE;
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result=modb.Save(headData);
|
|
|
|
|
if (result.Success == true) {
|
|
|
|
|
if (headData.TAXRATE!=0)
|
|
|
|
|
ChinvoicehexiaoDAL.updateFeeTax(headData.BILLNO,headData.TAXRATE);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.BILLNO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = ChinvoicehexiaoDAL.GetData(" BILLNO='" + BILLNO + "'")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult AddDetail(string bill, string data, string curr,string mblno)
|
|
|
|
|
{
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChFeeDetail>>(data);
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AddDetail(bill, bodyList, curr, mblno, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.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)
|
|
|
|
|
{
|
|
|
|
|
var exrateList = JsonConvert.Deserialize<List<ChFeeExrate>>(storeCurrExrate);
|
|
|
|
|
|
|
|
|
|
if ((exrateList==null)||(exrateList.Count == 0))
|
|
|
|
|
{
|
|
|
|
|
exrateList = ChinvoicehexiaoDAL.GetCurrExrateData(billno, billcust, billcurr, feesql);
|
|
|
|
|
if (exrateList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AddBill(billno, billcust, billcurr, feesql, exrateList, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.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 = ChinvoicehexiaoDAL.AddBill(billno, billcust, billcurr, feesql, exrateList, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.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 = ChinvoicehexiaoDAL.DelFeeDo(bodyList);
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.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<ChInvoicehexiao>(data);
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetBodyList("BILLNO='"+headData.BILLNO+"'");
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.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) };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
//
|
|
|
|
|
#region 审核 驳回
|
|
|
|
|
public ContentResult SubmitAudit(string bill)
|
|
|
|
|
{
|
|
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
|
|
|
if (!canlogin.Success)
|
|
|
|
|
{
|
|
|
|
|
return (ContentResult)canlogin.Data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.SubmitAudit("PayInvAudit", Convert.ToString(Session["USERID"]), bill, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult SubmitAuditBack(string bill)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.SubmitAuditBack("PayInvAudit", Convert.ToString(Session["USERID"]), bill);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult SubmitAuditList(string bills)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.SubmitAuditList("PayInvAudit", Convert.ToString(Session["USERID"]), bills, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult SubmitAuditBackList(string bills)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.SubmitAuditBackList("PayInvAudit", Convert.ToString(Session["USERID"]), bills);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult AuditList(string data)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChInvoicehexiao>>(data);
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AuditList(bodyList, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
public ContentResult AllAudit(string condition, string isaudit)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetAuditDataList(condition, Convert.ToString(Session["USERID"]), isaudit, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),null);
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AuditList(dataList, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
|
|
|
|
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<ChInvoicehexiao>>(data);
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AuditBackList(bodyList, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 入帐申请
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBalPayList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetBalPayList(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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBalData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
ChBalapplication head = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = ChinvoicehexiaoDAL.GetBalPayList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
head = list[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new ChBalapplication();
|
|
|
|
|
head.APPLICANT = Convert.ToString(Session["USERID"]);
|
|
|
|
|
head.APPLICANTNAME = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
public ContentResult SaveBal(string opstatus, string data)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var headData = JsonConvert.Deserialize<ChBalapplication>(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.ToString("yyyy-MM-dd");
|
|
|
|
|
headData.ENTERTIME = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='入账申请'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
|
|
headData.BILLNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.APPLYTIME.ToString().Trim(), headData.APPLYTIME.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
headData.ModelUIStatus = "E";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
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 = ChinvoicehexiaoDAL.GetBalPayData(" BILLNO='" + BILLNO + "'")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult DeleteBal(string data)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<ChBalapplication>(data);
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.DeleteBalDetail(headData.BILLNO);
|
|
|
|
|
|
|
|
|
|
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) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult DelBalBill(string data, string billno)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChInvoicehexiao>>(data);
|
|
|
|
|
|
|
|
|
|
DBResult result = result = ChinvoicehexiaoDAL.AddBalList(bodyList,"");
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.p_update_BalAmount(billno); }
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult AddBalList(string data,string billno)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChInvoicehexiao>>(data);
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AddBalList(bodyList, billno);
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.p_update_BalAmount(billno); }
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult CreateBal(string data)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var headData = new ChBalapplication();
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChInvoicehexiao>>(data);
|
|
|
|
|
var cust = "";
|
|
|
|
|
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
cust = enumValue.CUSTOMERNAME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
|
|
|
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
|
|
headData.APPLICANT = Convert.ToString(Session["USERID"]);
|
|
|
|
|
headData.APPLYTIME = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
headData.ENTERTIME = DateTime.Now;
|
|
|
|
|
headData.CUSTOMERNAME = cust;
|
|
|
|
|
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='入账申请'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
|
|
headData.BILLNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.APPLYTIME.ToString().Trim(), headData.APPLYTIME.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
var BILLNO = headData.BILLNO;
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
if (result.Success == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result = ChinvoicehexiaoDAL.AddBalList(bodyList, BILLNO);
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.p_update_BalAmount(BILLNO); }
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.BILLNO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = ChinvoicehexiaoDAL.GetBalPayData(" BILLNO='" + BILLNO + "'")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public ContentResult LockBalList(string bills)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.LockBalList(bills,true);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult UnLockBalList(string bills)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.LockBalList(bills, false);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 付费申请生成发票核销
|
|
|
|
|
|
|
|
|
|
public ContentResult GetPayListData(string condition,string sort)
|
|
|
|
|
{
|
|
|
|
|
var dataList = ChinvoicehexiaoDAL.GetPayListData(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 AddPayBill(string billno, string paylist, string billcurr, string storeCurrExrate)
|
|
|
|
|
{
|
|
|
|
|
var exrateList = JsonConvert.Deserialize<List<ChFeeExrate>>(storeCurrExrate);
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<ChPayapplication>>(paylist);
|
|
|
|
|
if ((exrateList == null) || (exrateList.Count == 0))
|
|
|
|
|
{
|
|
|
|
|
exrateList = ChinvoicehexiaoDAL.GetAppCurrExrateData(bodyList, billcurr);
|
|
|
|
|
if (exrateList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.AddPayBill(billno, bodyList, billcurr,exrateList, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.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 = ChinvoicehexiaoDAL.AddPayBill(billno, bodyList, billcurr,exrateList, Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
if (result.Success) { ChinvoicehexiaoDAL.p_update_Amount(billno); }
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public ContentResult UpdateApp(string bills, string type)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DBResult result = ChinvoicehexiaoDAL.UpdateApp(bills, type);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|