|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.Areas.Import.DAL.ImportSales;
|
|
|
using DSWeb.Areas.Import.Models.ImportTrade;
|
|
|
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.TruckMng.Helper.Repository;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using DSWeb.Areas.Import.DAL.Comm;
|
|
|
using DSWeb.Areas.Import.Models.Comm;
|
|
|
using DSWeb.Areas.Account.DAL.Chfee_Settlement;
|
|
|
using DSWeb.MvcShipping.Models.WMS;
|
|
|
using DSWeb.MvcShipping.DAL.WMS;
|
|
|
using DSWeb.MvcShipping.Controllers;
|
|
|
using DSWeb.Areas.Import.DAL.XXH;
|
|
|
using DSWeb.Areas.Import.DAL.ImportTrade;
|
|
|
using System.Text;
|
|
|
|
|
|
namespace DSWeb.Areas.Import.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class ImportSalesController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET:
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET: /
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult BLEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//付费申请审核
|
|
|
public ActionResult Audit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//财务核销
|
|
|
public ActionResult CWSTL ( )
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CWSTLEdit ( )
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.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 };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetData ( string handle, string condition )
|
|
|
{
|
|
|
ImportSalesmb head = null;
|
|
|
|
|
|
if (handle == "edit" || handle == "audit")
|
|
|
{
|
|
|
var list = ImportSalesDAL.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 ImportSalesmb();
|
|
|
}
|
|
|
|
|
|
if (handle == "add")
|
|
|
{
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
//head.OPRef = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.BSSTATUS = "1";
|
|
|
head.FEESTATUS = "1";
|
|
|
head.CURRENCY = "RMB";
|
|
|
head.AMOUNT = "0";
|
|
|
head.EXCHANGERATE = "1";
|
|
|
head.AMOUNTRMB = "0";
|
|
|
head.SALESTATUS = "0";
|
|
|
//head.SALESDATE = DateTime.Now.ToString();
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult Save ( string opstatus, string data, string SaleDetailList,string OrderFeeList )
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<ImportSalesmb>(data);
|
|
|
var SaleDetailData = JsonConvert.Deserialize<List<ImportSaledetailmb>>(SaleDetailList);
|
|
|
var SaleDetailDEL = JsonConvert.Deserialize<List<ImportSaledetailmb>>("");
|
|
|
var OrderFee = JsonConvert.Deserialize<List<MsOrderFee>>(OrderFeeList);
|
|
|
var OrderFeeDel = JsonConvert.Deserialize<List<MsOrderFee>>("");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(OrderFeeList)) {
|
|
|
|
|
|
foreach (var _f in OrderFee) {
|
|
|
_f.MODIFIEDTIME = System.DateTime.Now.ToString();
|
|
|
_f.MODIFIEDUSER = Session["USERID"].ToString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
|
//headData.SALESNO = PubSysDAL.GetBillNo("0207");
|
|
|
headData.SALESNO = ImportSalesDAL.GetSALESNO(headData.SALESNO);
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
//headData.OP = CookieConfig.GetCookie_UserName(Request);
|
|
|
headData.SALESDATE = DateTime.Now.ToString();
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.ModelUIStatus = "I";
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
var SALESNO = headData.SALESNO;
|
|
|
//if (headData.INVDATE == "") headData.INVDATE = null;
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.Save(headData
|
|
|
, ModelObjectConvert<ImportSaledetailmb>.ToModelObjectList(SaleDetailData)
|
|
|
, ModelObjectConvert<ImportSaledetailmb>.ToModelObjectList(SaleDetailDEL)
|
|
|
, ModelObjectConvert<MsOrderFee>.ToModelObjectList(OrderFee)
|
|
|
, ModelObjectConvert<MsOrderFee>.ToModelObjectList(OrderFeeDel)
|
|
|
);
|
|
|
PubSysDAL.ExecSql(" update Import_Saledetail set CURRENCY='"+headData.CURRENCY+"' ,EXCHANGERATE="+headData.EXCHANGERATE+" where SALESNO='"+headData.SALESNO+"' ");
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = ImportSalesDAL.GetData(" s.SALESNO='" + SALESNO + "'", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult GetCargoList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetCargoList(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 };
|
|
|
}
|
|
|
|
|
|
public ContentResult AddSales(string SALESNO,string CargoList)
|
|
|
{
|
|
|
var _count = 0;
|
|
|
var corpcode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
var userid = CookieConfig.GetCookie_UserId(Request);
|
|
|
_count = ImportSalesDAL.AddSales(SALESNO, CargoList, corpcode, userid);
|
|
|
var _success = false;
|
|
|
if (_count>0){
|
|
|
_success = true;
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = _success, Message = "查询成功", totalCount = _count });
|
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetDetailList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetDetailList(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 };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteDetail(string SALESNO, string GIDList)
|
|
|
{
|
|
|
var _count = 0;
|
|
|
var corpcode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
var userid = CookieConfig.GetCookie_UserId(Request);
|
|
|
_count = ImportSalesDAL.DeleteDetail(SALESNO, GIDList);
|
|
|
var _success = false;
|
|
|
if (_count > 0)
|
|
|
{
|
|
|
_success = true;
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = _success, Message = "查询成功", totalCount = _count });
|
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult Delete ( string data )
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<ImportSalesmb>(data);
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(head);
|
|
|
ContentResult _r = DeleteDetail(head.SALESNO, "");
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFeeList(string SALESNO, string sort)
|
|
|
{
|
|
|
var corpid = Convert.ToString(Session["COMPANYID"]);
|
|
|
var USERID = Convert.ToString(Session["USERID"]);
|
|
|
var DEPTGID = Convert.ToString(Session["DEPTGID"]);
|
|
|
//var OPERATERANGE="";
|
|
|
var VISIBLERANGE = "";
|
|
|
var modName = "modImport_Fee";
|
|
|
var evList = BasicDataRefDAL.GetAR(modName, USERID);
|
|
|
AuthorityRangemb head = null;
|
|
|
|
|
|
if (evList.Count > 0)
|
|
|
head = evList[0];
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new AuthorityRangemb();
|
|
|
//OPERATERANGE = "3";
|
|
|
VISIBLERANGE = "3";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//OPERATERANGE = head.OPERATERANGE;
|
|
|
VISIBLERANGE = head.VISIBLERANGE;
|
|
|
}
|
|
|
var condition = "SALESNO='" + SALESNO + "'";
|
|
|
/* 暂不限制访问范围
|
|
|
if (VISIBLERANGE == "1")
|
|
|
{
|
|
|
condition = condition + " and SALER in(select userid from user_company where companyid='" + corpid + "')";
|
|
|
}
|
|
|
if (VISIBLERANGE == "2")
|
|
|
{
|
|
|
condition = condition + " and SALER in(select userid from user_baseinfo where companyname=(select name from company where gid='" + corpid + "') ";
|
|
|
condition = condition + " and deptname=(select deptname from sys_dept where gid='" + DEPTGID + "')) ";
|
|
|
}
|
|
|
if (VISIBLERANGE == "3")
|
|
|
{
|
|
|
condition = condition + " and SALER ='" + USERID + "'";
|
|
|
}*/
|
|
|
|
|
|
var dataList = ImportSalesDAL.GetFeeList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveFee ( string SALESNO, string chfeebody, string chfeedelbody )
|
|
|
{
|
|
|
var chfeeBodyList = JsonConvert.Deserialize<List<MsChFee_Sales>>(chfeebody);
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsChFee_Sales>>(chfeedelbody);
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", SALESNO,
|
|
|
ModelObjectConvert<MsChFee_Sales>.ToModelObjectList(chfeeBodyList),
|
|
|
ModelObjectConvert<MsChFee_Sales>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SetSettlement ( string SALESNO, string chfeebody )
|
|
|
{
|
|
|
var corpid = Convert.ToString(Session["COMPANYID"]);
|
|
|
var userid = Convert.ToString(Session["USERID"]);
|
|
|
var BILLNO = PubSysDAL.GetBillNo("0304");
|
|
|
var FeeList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
|
|
|
|
|
|
//首先删除相关结算//目前的逻辑已不需要删除旧结算
|
|
|
//var _count2 = ImportSalesDAL.DelSettlement(SALESNO);
|
|
|
|
|
|
//此时在前台调用处已同过js中的MakeFees方法生成费用
|
|
|
//此处要做的是
|
|
|
//1 通过SALESNO查询出所有费用, //现改为由前台提供
|
|
|
//var condition = " isnull(SALESNO,'')<>'' and SALESNO='" + SALESNO + "'";
|
|
|
//var FeeList = ImportSalesDAL.GetFeeList(condition, "");
|
|
|
//2 建立一个Ch_fee_do的对象List,依照费用信息编写和插入ch_fee_do信息
|
|
|
var ChFeeDoList = new List<DSWeb.Areas.Import.Models.ImportTrade.MsChFeeDo>();
|
|
|
var ChFeeDoDEL = new List<DSWeb.Areas.Import.Models.ImportTrade.MsChFeeDo>();//保持为空 仅用来填充参数
|
|
|
decimal AMOUNT = 0;
|
|
|
var CUSTOMERNAME = "";
|
|
|
foreach (var Fee in FeeList)
|
|
|
{
|
|
|
var _do = new DSWeb.Areas.Import.Models.ImportTrade.MsChFeeDo();
|
|
|
_do.GID = Guid.NewGuid().ToString();
|
|
|
_do.BILLNO = "";//SALESNO;
|
|
|
_do.BSNO = Fee.BsNo;
|
|
|
_do.CUSTOMERNAME = Fee.CustomerName;
|
|
|
_do.BSTYPE = "0";
|
|
|
_do.FEEID = Fee.GId;
|
|
|
_do.FEENAME = Fee.FeeName;
|
|
|
_do.CURRENCY = Fee.Currency;
|
|
|
_do.AMOUNT = Fee.Amount.ToString();
|
|
|
_do.DOAMOUNT = Fee.Amount.ToString();
|
|
|
_do.FEETYPE = Fee.FeeType.ToString();
|
|
|
_do.CATEGORY = "2";
|
|
|
_do.BILLSTATUS = "2";
|
|
|
_do.CREATETIME = DateTime.Now.ToString();
|
|
|
_do.EXCHANGERATE = Fee.ExChangerate.ToString();
|
|
|
_do.ORIGAMOUNT = Fee.Amount.ToString();
|
|
|
_do.COMPANYID = corpid;
|
|
|
CUSTOMERNAME = Fee.CustomerName;
|
|
|
ChFeeDoList.Add(_do);
|
|
|
|
|
|
AMOUNT = AMOUNT + Fee.Amount * Fee.ExChangerate;
|
|
|
}
|
|
|
// 并计算总金额
|
|
|
|
|
|
var condition = " SETTLEBILLNO='" + BILLNO + "' ";
|
|
|
decimal SettlementAmount = 0;
|
|
|
//2 建立一个Ch_fee_do的对象List,依照费用信息编写和插入ch_fee_do信息
|
|
|
|
|
|
//
|
|
|
var _countAD = ImportSalesDAL.SetAdvancePay(BILLNO, SALESNO);
|
|
|
var _APD = ChsettlementDAL.GetAPBodyList(condition);
|
|
|
foreach (var apd in _APD)
|
|
|
{
|
|
|
SettlementAmount = SettlementAmount + decimal.Parse(apd.DOAMOUNT);
|
|
|
}
|
|
|
|
|
|
if (AMOUNT != SettlementAmount)
|
|
|
{
|
|
|
var json2 = JsonConvert.Serialize(new { Success = false, Message = "核销的费用金额和预收取用的金额不一致" });
|
|
|
|
|
|
return new ContentResult() { Content = json2 };
|
|
|
}
|
|
|
|
|
|
//3 建立一个Ch_fee_settlement对象,插入数据
|
|
|
var _S = new DSWeb.Areas.Import.Models.ImportTrade.MsChFeeSettlement();
|
|
|
_S.GID = Guid.NewGuid().ToString();
|
|
|
_S.BILLNO = BILLNO;
|
|
|
_S.BILLDATE = DateTime.Now.ToString();
|
|
|
_S.SETTLEMODE = "2";
|
|
|
_S.CUSTOMERNAME = CUSTOMERNAME;
|
|
|
_S.SETTLETYPE = "4";
|
|
|
_S.AMOUNTRMB = AMOUNT.ToString();
|
|
|
_S.ACCOUNTRMB = "";
|
|
|
_S.RATE = "1";
|
|
|
_S.AMOUNTUSD = "0";
|
|
|
_S.ACCOUNTUSD = "";
|
|
|
_S.BILLTYPE = "1";
|
|
|
_S.SETTLEUSER = userid;
|
|
|
_S.SETTLETIME = DateTime.Now.ToString();
|
|
|
_S.ISEXPORT = "0";
|
|
|
_S.BILLSTATUS = "2";
|
|
|
_S.COMPANYID = corpid;
|
|
|
_S.ACCOUNTS_CURRENCY = "0";
|
|
|
_S.ACCOUNTS_RATE = "1";
|
|
|
_S.ACCOUNTS_MONEY = AMOUNT.ToString();
|
|
|
_S.PREPAY_CURRENCY = "0";
|
|
|
_S.PREPAY_RATE = "1";
|
|
|
_S.PREPAY_MONEY = "0";
|
|
|
_S.AHSR_CURRENCY = "0";
|
|
|
_S.AHSR_RATE = "1";
|
|
|
_S.AHSR_MONEY = "0";
|
|
|
_S.FINANCIAL_CURRENCY = "0";
|
|
|
_S.FINANCIAL_RATE = "1";
|
|
|
_S.FINANCIAL_MONEY = "0";
|
|
|
_S.ADVANCE_CURRENCY = "0";
|
|
|
_S.ADVANCE_RATE = "1";
|
|
|
_S.ADVANCE_MONEY = SettlementAmount.ToString();
|
|
|
_S.CURR = "RMB";
|
|
|
|
|
|
//4 将Ch_fee_settlement作为主,Ch_fee_doList作为从进行保存
|
|
|
|
|
|
_S.DbOperationType = DbOperationType.DbotIns;
|
|
|
_S.ModelUIStatus = "I";
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.Save(_S,
|
|
|
ModelObjectConvert<DSWeb.Areas.Import.Models.ImportTrade.MsChFeeDo>.ToModelObjectList(ChFeeDoList),
|
|
|
ModelObjectConvert<DSWeb.Areas.Import.Models.ImportTrade.MsChFeeDo>.ToModelObjectList(ChFeeDoDEL)
|
|
|
);
|
|
|
if (result.Success)
|
|
|
{
|
|
|
var _count3 = ImportSalesDAL.FeeSettlement(BILLNO);
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(new { Success = result.Success, Message = "设置完成", data = BILLNO });
|
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult SetUnSettlement ( string BILLNO )
|
|
|
{
|
|
|
|
|
|
var corpcode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
var userid = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = "设置失败", totalCount = 0 });
|
|
|
var VOUCount = ImportSalesDAL.GetVOUNO(BILLNO);
|
|
|
if (VOUCount > 0)
|
|
|
{
|
|
|
json = JsonConvert.Serialize(new { Success = false, Message = "该次结算已经生成凭证,不能撤销,请联系财务部门", totalCount = 0 });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//var _count2 = ImportSalesDAL.FeeUnSettlement(BILLNO);
|
|
|
var _count = ImportSalesDAL.SetUnSettlement(BILLNO);
|
|
|
if (_count < 0)
|
|
|
{
|
|
|
json = JsonConvert.Serialize(new { Success = false, Message = "设置失败", totalCount = _count });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_count = _count + ImportSalesDAL.ResetDoamount();
|
|
|
json = JsonConvert.Serialize(new { Success = true, Message = "设置成功", totalCount = _count });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult SetSaleStatus(string SALESNO, string SALESTATUS)
|
|
|
{//认款出库
|
|
|
|
|
|
var _count = 0;
|
|
|
|
|
|
if (SALESTATUS == "0") //财务取消申过。前台限制只能对1的进行此操作。
|
|
|
{
|
|
|
_count = ImportSalesDAL.UnLockSaleStatus(SALESNO);
|
|
|
|
|
|
if (_count != -1)
|
|
|
{
|
|
|
_count = ImportSalesDAL.SetSalesUnAudit(SALESNO);
|
|
|
}
|
|
|
}
|
|
|
if (SALESTATUS == "1" ) //财务申过,或撤销提交出库 需同时解锁出库信息 //20160120改为直接算是提交出库
|
|
|
{
|
|
|
//_count = ImportSalesDAL.UnLockSaleStatus(SALESNO);
|
|
|
|
|
|
//if (_count != -1) { _count = ImportSalesDAL.SetSalesAudit(SALESNO); }
|
|
|
_count = ImportSalesDAL.SetSalesAudit(SALESNO);
|
|
|
_count = _count+ImportSalesDAL.LockSaleStatus(SALESNO);
|
|
|
|
|
|
}
|
|
|
if (SALESTATUS == "2") //提交出库(锁定销售单) //实际上不由前台调取 而由/Import/ImportDelivery/LockDelivery生成
|
|
|
{
|
|
|
_count = ImportSalesDAL.LockSaleStatus(SALESNO);
|
|
|
}
|
|
|
if (SALESTATUS == "3") //完结 只改状态
|
|
|
{
|
|
|
_count = ImportSalesDAL.SetSalesOver(SALESNO);
|
|
|
}
|
|
|
|
|
|
if ((SALESTATUS == "1" || SALESTATUS == "0") && _count == -1)
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = "已经进行出库操作,不能解锁", totalCount = _count });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else {
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "设置成功", totalCount = _count });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult SetRKState ( string GID, string PASSED )//仅仅修改认款状态值
|
|
|
{//认款未出库
|
|
|
|
|
|
var _count = ImportSalesDAL.SetRKState(GID,PASSED);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "设置成功", totalCount = _count });
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult GetSALESNO ( string BSNO ) {
|
|
|
var SALESNO = ImportSalesDAL.GetSALESNO(BSNO);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "获取完成",
|
|
|
Data = SALESNO
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult GetSalesStateDataList ( int start, int limit, string sort, string condition )
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetSalesStateDataList(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 };
|
|
|
}
|
|
|
public ContentResult GetSalesAdvancePay_state_DELList ( int start, int limit, string sort, string condition )
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetSalesAdvancePay_state_DELList(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 };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveSalesState ( string YSYFNO, string SalesStateBody, string SalesStateDelBody )
|
|
|
{
|
|
|
|
|
|
var SalesStateBodyList = JsonConvert.Deserialize<List<SalesStateAuditmb>>(SalesStateBody);
|
|
|
var SalesStateBodyDelList = JsonConvert.Deserialize<List<SalesStateAuditmb>>(SalesStateDelBody);
|
|
|
|
|
|
var SalesStateDelList = new List<SalesAdvancePay_state_DELmb>();
|
|
|
if (SalesStateDelBody!="")
|
|
|
{
|
|
|
foreach (var _D in SalesStateBodyDelList)
|
|
|
{
|
|
|
var SalesStateDel = new SalesAdvancePay_state_DELmb();
|
|
|
SalesStateDel.GID = _D.GID;
|
|
|
SalesStateDel.SALESNO = _D.SALESNO;
|
|
|
SalesStateDel.DOAMOUNT = _D.DOAMOUNT;
|
|
|
SalesStateDel.PASSED = _D.PASSED;
|
|
|
SalesStateDel.AD_BILLNO = "";
|
|
|
SalesStateDel.CREATEUSER = _D.CREATEUSER;
|
|
|
SalesStateDel.CREATETIME = _D.CREATETIME;
|
|
|
SalesStateDel.DELETEUSER = Convert.ToString(Session["USERID"]);
|
|
|
SalesStateDel.DELETETIME = DateTime.Now.ToString();
|
|
|
SalesStateDelList.Add(SalesStateDel);
|
|
|
}
|
|
|
}
|
|
|
var SalesStateDelList2 = JsonConvert.Deserialize<List<SalesAdvancePay_state_DELmb>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("AD_BILLNO", YSYFNO,
|
|
|
ModelObjectConvert<SalesStateAuditmb>.ToModelObjectList(SalesStateBodyList),
|
|
|
ModelObjectConvert<SalesStateAuditmb>.ToModelObjectList(SalesStateBodyDelList),
|
|
|
ModelObjectConvert<SalesAdvancePay_state_DELmb>.ToModelObjectList(SalesStateDelList),
|
|
|
ModelObjectConvert<SalesAdvancePay_state_DELmb>.ToModelObjectList(SalesStateDelList2)
|
|
|
);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
//账单列表
|
|
|
public ContentResult GetZDList(string condition)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetZDList(condition);
|
|
|
//var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetZDDetailList(string condition)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetZDDetailList(condition);
|
|
|
//var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult AddZD(string SALESNO,string type)
|
|
|
{
|
|
|
var head = new Import_SaleZDmb();
|
|
|
head.GID = Guid.NewGuid().ToString();
|
|
|
head.SALESNO = SALESNO;
|
|
|
head.CREATEUSER = Session["SHOWNAME"].ToString();
|
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
head.OP = Session["SHOWNAME"].ToString();
|
|
|
head.OPDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
head.ModelUIStatus = "I";
|
|
|
|
|
|
if (type == "1"){
|
|
|
head.REMARK = "期货账单";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
head.REMARK = "现货账单";
|
|
|
}
|
|
|
|
|
|
var _SH=ImportSalesDAL. GetData("s.SALESNO='"+SALESNO+"'");
|
|
|
|
|
|
var DetailList=new List<Import_SaleZDDetailmb>();
|
|
|
var DetailDelList = new List<Import_SaleZDDetailmb>();
|
|
|
|
|
|
var startdate = new List<GeneralModel>();
|
|
|
var CargoList=new List<Cargomb2>();
|
|
|
if(type=="1"){
|
|
|
CargoList=ImportTradeDAL.GetCargoList(" c.gid in(select CARGO_GID from import_saledetail where SALESNO='"+SALESNO+"')");
|
|
|
|
|
|
|
|
|
var sqlstartdate = new StringBuilder();
|
|
|
sqlstartdate.Append(" select '' GID,dbo.trimdate( ");
|
|
|
sqlstartdate.Append(" case isnull((select dbo.trimdate(Unsealdate) from import_main where ContractNo in(select bsno from import_saledetail where SALESNO='" + SALESNO + "')),'') ");
|
|
|
sqlstartdate.Append(" when '' then (select top 1 wmsdate from wms where Cargo_gid in(select cargo_gid from import_saledetail where SALESNO='" + SALESNO + "')) ");
|
|
|
sqlstartdate.Append(" else isnull((select dbo.trimdate(Unsealdate) from import_main where ContractNo in(select bsno from import_saledetail where SALESNO='" + SALESNO + "')),'') end) GVALUE ");
|
|
|
|
|
|
startdate = BasicDataRefDAL.GeneralSelect(sqlstartdate.ToString());
|
|
|
}
|
|
|
|
|
|
|
|
|
var saledetaillist = ImportSalesDAL.GetDetailList("s.SALESNO='" + SALESNO + "'");
|
|
|
foreach (var _sd in saledetaillist) {
|
|
|
var _D = new Import_SaleZDDetailmb();
|
|
|
_D.GID = Guid.NewGuid().ToString();
|
|
|
_D.SALESNO = SALESNO;
|
|
|
_D.ZD_GID = "";
|
|
|
_D.SALEDETAIL_GID = _sd.GID;
|
|
|
_D.BOXCOUNT = _sd.BOXCOUNT;
|
|
|
_D.CURRENCY = _sd.CURRENCY;
|
|
|
_D.WEIGHT = _sd.WEIGHT;
|
|
|
_D.PRICE = _sd.PRICE;
|
|
|
_D.AMOUNT = _sd.AMOUNT;
|
|
|
_D.EXCHANGERATE_CUST = _sd.Exchangerate_Cust;
|
|
|
_D.PREPAYMENT = _sd.PREPAYMENT_ACT;
|
|
|
if (_D.PREPAYMENT == "") {
|
|
|
_D.PREPAYMENT = "0";
|
|
|
}
|
|
|
_D.FUNDRATE = _sd.FUNDRATE;
|
|
|
var dt = new DateTime();
|
|
|
if (_SH.SALESDATE != "")
|
|
|
{
|
|
|
dt = Convert.ToDateTime(_SH.SALESDATE);
|
|
|
dt = dt.AddDays(3);
|
|
|
_D.STOCKDATE_1 = dt.ToString("yyyy-MM-dd");
|
|
|
}else{
|
|
|
_D.STOCKDATE_1 = _sd.STOCKDATE_2;
|
|
|
}
|
|
|
_D.STOCKDATE_2 = _sd.STOCKDATE_2;
|
|
|
_D.AGENCRATE_CUST = _sd.AGENCRATE_Cust;
|
|
|
_D.REMARK = "";
|
|
|
|
|
|
if (type == "1")
|
|
|
{
|
|
|
//期货账单 重量件数取商品信息的单据重量单据件数
|
|
|
foreach (var _C in CargoList)
|
|
|
{
|
|
|
if (_C.GID == _sd.CARGO_GID)
|
|
|
{
|
|
|
_D.WEIGHT = _C.weight;
|
|
|
_D.BOXCOUNT = _C.BoxCount;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (startdate[0].GVALUE != "")
|
|
|
_D.STOCKDATE_1 = startdate[0].GVALUE;
|
|
|
else
|
|
|
_D.STOCKDATE_1 = _sd.STOCKDATE_2;
|
|
|
|
|
|
//_D.REMARK = "期货账单";
|
|
|
}
|
|
|
else {
|
|
|
//_D.REMARK = "现货账单";
|
|
|
}
|
|
|
|
|
|
DetailList.Add(_D);
|
|
|
}
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.Save(head
|
|
|
, ModelObjectConvert<Import_SaleZDDetailmb>.ToModelObjectList(DetailList)
|
|
|
, ModelObjectConvert<Import_SaleZDDetailmb>.ToModelObjectList(DetailDelList));
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = result.Success, Message = "查询成功" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult DelZD(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<Import_SaleZDmb>(data);
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(head
|
|
|
,"delete from Import_SaleZDDetail where ZD_GID='"+head.GID+"'"
|
|
|
, "delete from CH_FEE_ORDER where BSNO='" + head.GID + "'");
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = result.Success, Message = "查询成功" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveZDDetail(string SALESNO, string ZDDetail, string ZDDetaildel)
|
|
|
{
|
|
|
var ZDDetailList = JsonConvert.Deserialize<List<Import_SaleZDDetailmb>>(ZDDetail);
|
|
|
var ZDDetaildelList = JsonConvert.Deserialize<List<Import_SaleZDDetailmb>>(ZDDetaildel);
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("SALESNO", SALESNO,
|
|
|
ModelObjectConvert<Import_SaleZDDetailmb>.ToModelObjectList(ZDDetailList),
|
|
|
ModelObjectConvert<Import_SaleZDDetailmb>.ToModelObjectList(ZDDetaildelList)
|
|
|
);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult MakeOrderFee_RMB2(string ZD_GID,string type)
|
|
|
{
|
|
|
//获取相关费用 计算出目标费用数值
|
|
|
var head = new ImportSalesmb();
|
|
|
var list = ImportSalesDAL.GetDataList(" s.SALESNO=(select SALESNO from import_saleZD where gid='" + ZD_GID + "') ");
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
|
|
|
|
|
|
//var _BodyList = ImportSalesDAL.GetDetailList(" s.SALESNO='" + SALESNO + "' ", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]), "");
|
|
|
|
|
|
var ZDList = ImportSalesDAL.GetZDList(" GID='" + ZD_GID + "'");
|
|
|
var _ZD = ZDList[0];
|
|
|
|
|
|
|
|
|
var _BodyList = ImportSalesDAL.GetZDDetailList(" ZD_GID='" + ZD_GID + "' ");
|
|
|
|
|
|
var OrderFeeList = new List<MsOrderFee_Import>();
|
|
|
|
|
|
var CargoList = new List<Cargomb2>();
|
|
|
//if (type == "1")
|
|
|
//{
|
|
|
CargoList = ImportTradeDAL.GetCargoList(" c.contractno in(select BSNO from import_saledetail where SALESNO in (select SALESNO from Import_SaleZD where GID='" + ZD_GID + "'))");
|
|
|
//}
|
|
|
var AmountAll=0M;
|
|
|
foreach (var _c in CargoList)
|
|
|
{
|
|
|
AmountAll += Convert.ToDecimal(_c.price) * Convert.ToDecimal(_c.weight) * Convert.ToDecimal(_c.Exchangerate);
|
|
|
}
|
|
|
|
|
|
var _count = 0;
|
|
|
foreach (var _SD in _BodyList)
|
|
|
{
|
|
|
var _单价吨 = Convert.ToDecimal(_SD.PRICE) * Convert.ToDecimal(_SD.EXCHANGERATE_CUST) * 1000;
|
|
|
var _销售吨数 = Convert.ToDecimal(_SD.WEIGHT) / 1000;
|
|
|
var _货款RMB = _单价吨 * _销售吨数;
|
|
|
|
|
|
var _件数 = Convert.ToDecimal(_SD.BOXCOUNT);
|
|
|
|
|
|
var _单据件数 = 0M;
|
|
|
var _入库件数 = 0M;
|
|
|
foreach (var _C in CargoList)
|
|
|
{
|
|
|
if (_C.GID == _SD.CARGO_GID)
|
|
|
{
|
|
|
_单据件数 = Convert.ToDecimal( _C.BoxCount);
|
|
|
_入库件数 = Convert.ToDecimal(_C.BOXCOUNT_ACT);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var _冷藏费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'冷藏费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));// * Convert.ToDecimal(_SD.WEIGHT) / 1000
|
|
|
var _冷藏天数 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY, dbo.trimdate('" + _SD.STOCKDATE_1 + "'), dbo.trimdate('" + _SD.STOCKDATE_2 + "')), 0)+1 "));
|
|
|
var _出入库费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'出入库费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
var _出入库费 = _出入库费率 * _销售吨数;
|
|
|
|
|
|
var _倒柜费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'倒柜费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
var _倒柜费 = _倒柜费率 * _销售吨数;
|
|
|
if (_倒柜费率 == 0M && _count==0)
|
|
|
{
|
|
|
_倒柜费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'倒柜费_每柜') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
_倒柜费 = _倒柜费率;
|
|
|
}
|
|
|
var _冷藏费 = _销售吨数 * _冷藏费率 * _冷藏天数;
|
|
|
|
|
|
var _冷库费用 = 0M;
|
|
|
if (type == "出入库") {
|
|
|
_冷库费用 = _冷藏费 + _出入库费;
|
|
|
}
|
|
|
if (type == "倒柜")
|
|
|
{
|
|
|
_冷库费用 = _倒柜费;
|
|
|
}
|
|
|
|
|
|
var _货款应收 = _货款RMB + _冷库费用;
|
|
|
var _定金 = Convert.ToDecimal(_SD.PREPAYMENT);
|
|
|
var _应付尾款 = _货款应收 - _定金;
|
|
|
|
|
|
var _调快费= Convert.ToDecimal(ImportSalesDAL.GetField("select charindex('调快',m.remark_6) TKINDEX from import_main m where contractno=(select contractno from import_cargo where gid='" + _SD.CARGO_GID + "')"));
|
|
|
if (_调快费 > 0 )
|
|
|
{
|
|
|
var _C_Amount = 0M;
|
|
|
foreach (var _c in CargoList)
|
|
|
{
|
|
|
if (_c.GID == _SD.CARGO_GID)
|
|
|
{
|
|
|
_C_Amount = Convert.ToDecimal(_c.price) * Convert.ToDecimal(_c.weight) * Convert.ToDecimal(_c.Exchangerate);
|
|
|
}
|
|
|
}
|
|
|
_调快费 = 1000 * _C_Amount / AmountAll;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_调快费 = 0;
|
|
|
}
|
|
|
var _资金利息利率 = Convert.ToDecimal(_SD.FUNDRATE);
|
|
|
var _资金占用时间 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY, dbo.trimdate('" + _SD.STOCKDATE_1 + "'), dbo.trimdate('" + _SD.STOCKDATE_2 + "')), 0)+1 "));
|
|
|
if (_ZD.REMARK == "期货账单")
|
|
|
{
|
|
|
_货款应收 = _货款RMB + _调快费 + _冷库费用;
|
|
|
}
|
|
|
var _资金利息 = _货款应收 * _资金利息利率 * _资金占用时间 / 30;
|
|
|
if (_ZD.REMARK == "期货账单" && type == "倒柜")
|
|
|
{
|
|
|
_资金利息 = 0M;
|
|
|
}
|
|
|
var _价格备注费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select substring(sd.PRICEREMARK,charindex('+',sd.PRICEREMARK)+1,len(sd.PRICEREMARK)) from import_saledetail sd where gid='" + _SD.SALEDETAIL_GID + "'"));
|
|
|
|
|
|
var _其他费用 = _价格备注费率 * _销售吨数;
|
|
|
var _总应收 = _货款应收 + _资金利息 + _其他费用;
|
|
|
if (_ZD.REMARK == "期货账单")
|
|
|
{
|
|
|
_应付尾款 = _总应收 - _定金;
|
|
|
}
|
|
|
|
|
|
|
|
|
var 单价吨 = NewOrderFee2(head.CUSTOMERNAME, "单价吨", _单价吨, _SD);
|
|
|
OrderFeeList.Add(单价吨);
|
|
|
|
|
|
if (_ZD.REMARK == "期货账单")
|
|
|
{
|
|
|
var 销售吨数 = NewOrderFee2(head.CUSTOMERNAME, "单据吨数", _销售吨数, _SD);
|
|
|
OrderFeeList.Add(销售吨数);
|
|
|
}
|
|
|
if (_ZD.REMARK == "期货账单")
|
|
|
{
|
|
|
var 销售吨数 = NewOrderFee2(head.CUSTOMERNAME, "销售吨数", _销售吨数, _SD);
|
|
|
OrderFeeList.Add(销售吨数);
|
|
|
}
|
|
|
|
|
|
|
|
|
var 件数 = NewOrderFee2(head.CUSTOMERNAME, "件数", _件数, _SD);
|
|
|
OrderFeeList.Add(件数);
|
|
|
var 单据件数 = NewOrderFee2(head.CUSTOMERNAME, "单据件数", _单据件数, _SD);
|
|
|
OrderFeeList.Add(单据件数);
|
|
|
var 入库件数 = NewOrderFee2(head.CUSTOMERNAME, "入库件数", _入库件数, _SD);
|
|
|
OrderFeeList.Add(入库件数);
|
|
|
var 货款RMB = NewOrderFee2(head.CUSTOMERNAME, "货款RMB", _货款RMB, _SD);
|
|
|
OrderFeeList.Add(货款RMB);
|
|
|
|
|
|
if (type == "出入库")
|
|
|
{
|
|
|
var 出入库费率 = NewOrderFee2(head.CUSTOMERNAME, "出入库费率", _出入库费率, _SD);
|
|
|
OrderFeeList.Add(出入库费率);
|
|
|
var 出入库费 = NewOrderFee2(head.CUSTOMERNAME, "出入库费", _出入库费, _SD);
|
|
|
OrderFeeList.Add(出入库费);
|
|
|
var 冷藏费 = NewOrderFee2(head.CUSTOMERNAME, "冷藏费", _冷藏费, _SD);
|
|
|
OrderFeeList.Add(冷藏费);
|
|
|
var 冷藏费率 = NewOrderFee2(head.CUSTOMERNAME, "冷藏费率", _冷藏费率, _SD);
|
|
|
OrderFeeList.Add(冷藏费率);
|
|
|
var 冷藏天数 = NewOrderFee2(head.CUSTOMERNAME, "冷藏天数", _冷藏天数, _SD);
|
|
|
OrderFeeList.Add(冷藏天数);
|
|
|
|
|
|
}
|
|
|
if (type == "倒柜")
|
|
|
{
|
|
|
var 倒柜费率 = NewOrderFee2(head.CUSTOMERNAME, "倒柜费率", _倒柜费率, _SD);
|
|
|
OrderFeeList.Add(倒柜费率);
|
|
|
var 倒柜费 = NewOrderFee2(head.CUSTOMERNAME, "倒柜费", _倒柜费, _SD);
|
|
|
OrderFeeList.Add(倒柜费);
|
|
|
}
|
|
|
var 冷库费用 = NewOrderFee2(head.CUSTOMERNAME, "冷库费用", _冷库费用, _SD);
|
|
|
OrderFeeList.Add(冷库费用);
|
|
|
|
|
|
if (_ZD.REMARK == "期货账单")
|
|
|
{
|
|
|
var 价格备注费率 = NewOrderFee2(head.CUSTOMERNAME, "价格备注费率", _价格备注费率, _SD);
|
|
|
OrderFeeList.Add(价格备注费率);
|
|
|
|
|
|
if (type == "倒柜")
|
|
|
{
|
|
|
//////
|
|
|
}
|
|
|
if (type == "出入库")
|
|
|
{
|
|
|
var 资金利息利率 = NewOrderFee2(head.CUSTOMERNAME, "资金利息利率", _资金利息利率, _SD);
|
|
|
OrderFeeList.Add(资金利息利率);
|
|
|
var 资金占用时间 = NewOrderFee2(head.CUSTOMERNAME, "资金占用时间", _资金占用时间, _SD);
|
|
|
OrderFeeList.Add(资金占用时间);
|
|
|
var 资金利息 = NewOrderFee2(head.CUSTOMERNAME, "资金利息", _资金利息, _SD);
|
|
|
OrderFeeList.Add(资金利息);
|
|
|
|
|
|
}
|
|
|
var 调快费 = NewOrderFee2(head.CUSTOMERNAME, "调快费", _调快费, _SD);
|
|
|
OrderFeeList.Add(调快费);
|
|
|
var 其他费用 = NewOrderFee2(head.CUSTOMERNAME, "其他费用", _其他费用, _SD);
|
|
|
OrderFeeList.Add(其他费用);
|
|
|
var 总应收 = NewOrderFee2(head.CUSTOMERNAME, "总应收", _总应收, _SD);
|
|
|
OrderFeeList.Add(总应收);
|
|
|
}
|
|
|
|
|
|
var 货款应收 = NewOrderFee2(head.CUSTOMERNAME, "货款应收", _货款应收, _SD);
|
|
|
OrderFeeList.Add(货款应收);
|
|
|
var 定金 = NewOrderFee2(head.CUSTOMERNAME, "定金", _定金, _SD);
|
|
|
OrderFeeList.Add(定金);
|
|
|
var 应付尾款 = NewOrderFee2(head.CUSTOMERNAME, "应付尾款", _应付尾款, _SD);
|
|
|
OrderFeeList.Add(应付尾款);
|
|
|
|
|
|
_count++;
|
|
|
}
|
|
|
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsOrderFee_Import>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", ZD_GID,
|
|
|
ModelObjectConvert<MsOrderFee_Import>.ToModelObjectList(OrderFeeList),
|
|
|
ModelObjectConvert<MsOrderFee_Import>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult MakeOrderFee_USD2(string ZD_GID,string type)
|
|
|
{
|
|
|
//获取相关费用 计算出目标费用数值
|
|
|
var head = new ImportSalesmb();
|
|
|
var list = ImportSalesDAL.GetDataList(" s.SALESNO=(select SALESNO from import_saleZD where gid='" + ZD_GID + "') ");
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
|
|
|
var _BodyList = ImportSalesDAL.GetZDDetailList(" ZD_GID='" + ZD_GID + "' ");
|
|
|
|
|
|
var OrderFeeList = new List<MsOrderFee_Import>();
|
|
|
|
|
|
var GDDATA = ImportTradeDAL.GetData_ALL(" M.contractno in(select BSNO from Import_Saledetail where SALESNO in(select SALESNO from Import_SaleZD where GID='" + ZD_GID + "')) ", CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request));
|
|
|
|
|
|
var CargoList = new List<Cargomb2>();
|
|
|
//if (type == "1")
|
|
|
//{
|
|
|
CargoList = ImportTradeDAL.GetCargoList(" c.contractno in(select BSNO from import_saledetail where SALESNO in (select SALESNO from Import_SaleZD where GID='" + ZD_GID + "'))");
|
|
|
//}
|
|
|
var AmountAll = 0M;
|
|
|
foreach (var _c in CargoList)
|
|
|
{
|
|
|
AmountAll += Convert.ToDecimal(_c.price) * Convert.ToDecimal(_c.weight) * Convert.ToDecimal(_c.Exchangerate);
|
|
|
}
|
|
|
|
|
|
var 总重量 = 0M;
|
|
|
foreach (var _SD1 in _BodyList)
|
|
|
{
|
|
|
总重量 += Convert.ToDecimal(_SD1.WEIGHT);
|
|
|
}
|
|
|
var _count = 0;
|
|
|
foreach (var _SD in _BodyList)
|
|
|
{
|
|
|
|
|
|
var CargoList2 = ImportTradeDAL.GetCargoList(" c.gid='" + _SD.CARGO_GID + "'");
|
|
|
var Cargo = CargoList2[0];
|
|
|
|
|
|
var _单价吨 = Convert.ToDecimal(_SD.PRICE) * 1000;
|
|
|
var _销售吨数 = Convert.ToDecimal(_SD.WEIGHT) / 1000;
|
|
|
|
|
|
var _调快费 = Convert.ToDecimal(ImportSalesDAL.GetField("select charindex('调快',m.remark_6) TKINDEX from import_main m where contractno=(select contractno from import_cargo where gid='" + _SD.CARGO_GID + "')"));
|
|
|
if (_调快费 > 0)
|
|
|
{
|
|
|
var _C_Amount = Convert.ToDecimal(Cargo.price) * Convert.ToDecimal(Cargo.weight) * Convert.ToDecimal(Cargo.Exchangerate);
|
|
|
|
|
|
_调快费 = 1000 * _C_Amount / AmountAll;
|
|
|
}
|
|
|
//var _件数 = Convert.ToDecimal(_SD.BOXCOUNT);
|
|
|
var _应收账单汇率 = Convert.ToDecimal(_SD.EXCHANGERATE_CUST);
|
|
|
var _货款币别 = _销售吨数 * _单价吨;
|
|
|
var _货款RMB = _单价吨 * _销售吨数 * _应收账单汇率;
|
|
|
var _手续费 = _货款RMB * 0.001M;
|
|
|
|
|
|
var _电汇费 = 150 * _销售吨数 / (总重量 / 1000);
|
|
|
{
|
|
|
var _C_Amount = Convert.ToDecimal(Cargo.price) * Convert.ToDecimal(Cargo.weight) * Convert.ToDecimal(Cargo.Exchangerate);
|
|
|
|
|
|
_电汇费 = 150 * _C_Amount / AmountAll;
|
|
|
}
|
|
|
|
|
|
var _总货款 = _货款RMB + _手续费 + _电汇费;
|
|
|
var _海关限价吨 = Convert.ToDecimal(Cargo.price_limit) * 1000;
|
|
|
var _海关汇率 = Convert.ToDecimal(Cargo.Exchangerate_Customs);
|
|
|
//var _采购价吨 = Convert.ToDecimal(Cargo.price) * 1000;
|
|
|
var _保率 = Convert.ToDecimal(Cargo.baolv);
|
|
|
var _完税金额 = 0M;
|
|
|
if (_海关限价吨 > _单价吨)
|
|
|
{
|
|
|
_完税金额 = _海关限价吨 * _销售吨数 * _海关汇率 * _保率;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_完税金额 = _单价吨 * _销售吨数 * _海关汇率 * _保率;
|
|
|
}
|
|
|
var _关税税率 = Convert.ToDecimal(Cargo.tax);
|
|
|
var _增值税税率 = Convert.ToDecimal(Cargo.tax_zz);
|
|
|
var _关税 = _完税金额 * _关税税率;
|
|
|
var _增值税 = (_关税 + _完税金额) * _增值税税率;
|
|
|
var _代理费单价 = Convert.ToDecimal(_SD.AGENCRATE_CUST);
|
|
|
var _代理费 = _代理费单价 * _销售吨数;
|
|
|
|
|
|
var _价格备注费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select substring(sd.PRICEREMARK,charindex('+',sd.PRICEREMARK)+1,len(sd.PRICEREMARK)) from import_saledetail sd where gid='" + _SD.SALEDETAIL_GID + "'"));
|
|
|
|
|
|
|
|
|
var _资金利息利率 = Convert.ToDecimal(_SD.FUNDRATE);
|
|
|
var _资金占用时间 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY, dbo.trimdate('" + _SD.STOCKDATE_1 + "'), dbo.trimdate('" + _SD.STOCKDATE_2 + "')), 0)+1 "));
|
|
|
|
|
|
|
|
|
var _冷藏费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'冷藏费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));//* Convert.ToDecimal(_SD.WEIGHT) / 1000
|
|
|
var _冷藏天数 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY, dbo.trimdate('" + _SD.STOCKDATE_1 + "'), dbo.trimdate('" + _SD.STOCKDATE_2 + "')), 0)+1 "));
|
|
|
//var _冷藏费 = _冷藏费率 * _冷藏天数 * _销售吨数;
|
|
|
var _出入库费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'出入库费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
|
|
|
var _倒柜费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'倒柜费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
var _倒柜费 = _倒柜费率 * _销售吨数;
|
|
|
if (_倒柜费率 == 0M && _count == 0)
|
|
|
{
|
|
|
_倒柜费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'倒柜费_每柜') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
_倒柜费 = _倒柜费率;
|
|
|
}
|
|
|
//var _货款应收 = 货款RMB.Amount + (_冷藏费率 * _冷藏天数 * _销售吨数) + _出入库费率 * _销售吨数;
|
|
|
var _冷藏费 = _销售吨数 * _冷藏费率 * _冷藏天数;
|
|
|
var _出入库费 = _销售吨数 * _出入库费率;
|
|
|
//var _倒柜费 = _销售吨数 * _倒柜费率;
|
|
|
|
|
|
var _冷库费用 = 0M;
|
|
|
if (type == "出入库")
|
|
|
{
|
|
|
_冷库费用 = _冷藏费 + _出入库费;
|
|
|
}
|
|
|
if (type == "倒柜")
|
|
|
{
|
|
|
_冷库费用 = _倒柜费;
|
|
|
}
|
|
|
|
|
|
var _定金 = Convert.ToDecimal(_SD.PREPAYMENT);
|
|
|
var _货款应收 = _货款RMB + _手续费 + _电汇费 + _调快费 + _关税 + _增值税 +_代理费+ _冷库费用;
|
|
|
var _资金利息 = _货款应收 * _资金利息利率 * _资金占用时间 / 30;
|
|
|
|
|
|
var _件数 = _SD.BOXCOUNT;
|
|
|
var _入库件数 = 0M;
|
|
|
foreach (var _C in CargoList)
|
|
|
{
|
|
|
if (_C.GID == _SD.CARGO_GID)
|
|
|
{
|
|
|
_入库件数 = Convert.ToDecimal(_C.BOXCOUNT_ACT);
|
|
|
}
|
|
|
}
|
|
|
var _其他费用 = _价格备注费率 * _销售吨数;
|
|
|
var _总应收 = 0M;
|
|
|
|
|
|
if (type == "出入库")
|
|
|
{
|
|
|
_总应收=_货款应收 + _资金利息 + _其他费用;
|
|
|
}
|
|
|
if (type == "倒柜")
|
|
|
{
|
|
|
_总应收 = _货款应收 + _其他费用;
|
|
|
}
|
|
|
|
|
|
var _应付尾款 = _总应收 - _定金;
|
|
|
|
|
|
|
|
|
var 单价吨 = NewOrderFee2(head.CUSTOMERNAME, "单价吨", _单价吨, _SD);
|
|
|
OrderFeeList.Add(单价吨);
|
|
|
var 销售吨数 = NewOrderFee2(head.CUSTOMERNAME, "销售吨数", _销售吨数, _SD);
|
|
|
OrderFeeList.Add(销售吨数);
|
|
|
//var 件数 = NewOrderFee2(head.CUSTOMERNAME, "件数", _件数, _SD);
|
|
|
//OrderFeeList.Add(件数);
|
|
|
var 应收账单汇率 = NewOrderFee2(head.CUSTOMERNAME, "应收账单汇率", _应收账单汇率, _SD);
|
|
|
OrderFeeList.Add(应收账单汇率);
|
|
|
var 货款币别 = NewOrderFee2(head.CUSTOMERNAME, "货款币别", _货款币别, _SD);
|
|
|
OrderFeeList.Add(货款币别);
|
|
|
var 货款RMB = NewOrderFee2(head.CUSTOMERNAME, "货款RMB", _货款RMB, _SD);
|
|
|
OrderFeeList.Add(货款RMB);
|
|
|
var 手续费 = NewOrderFee2(head.CUSTOMERNAME, "手续费", _手续费, _SD);
|
|
|
OrderFeeList.Add(手续费);
|
|
|
var 电汇费 = NewOrderFee2(head.CUSTOMERNAME, "电汇费", _电汇费, _SD);
|
|
|
OrderFeeList.Add(电汇费);
|
|
|
var 总货款 = NewOrderFee2(head.CUSTOMERNAME, "总货款", _总货款, _SD);
|
|
|
OrderFeeList.Add(总货款);
|
|
|
var 海关限价吨 = NewOrderFee2(head.CUSTOMERNAME, "海关限价吨", _海关限价吨, _SD);
|
|
|
OrderFeeList.Add(海关限价吨);
|
|
|
var 海关汇率 = NewOrderFee2(head.CUSTOMERNAME, "海关汇率", _海关汇率, _SD);
|
|
|
OrderFeeList.Add(海关汇率);
|
|
|
//var 采购价吨 = NewOrderFee2(head.CUSTOMERNAME, "采购价吨", _采购价吨, _SD);
|
|
|
//OrderFeeList.Add(采购价吨);
|
|
|
var 保率 = NewOrderFee2(head.CUSTOMERNAME, "保率", _保率, _SD);
|
|
|
OrderFeeList.Add(保率);
|
|
|
var 完税金额 = NewOrderFee2(head.CUSTOMERNAME, "完税金额", _完税金额, _SD);
|
|
|
OrderFeeList.Add(完税金额);
|
|
|
var 关税税率 = NewOrderFee2(head.CUSTOMERNAME, "关税税率", _关税税率, _SD);
|
|
|
OrderFeeList.Add(关税税率);
|
|
|
var 增值税税率 = NewOrderFee2(head.CUSTOMERNAME, "增值税税率", _增值税税率, _SD);
|
|
|
OrderFeeList.Add(增值税税率);
|
|
|
var 关税 = NewOrderFee2(head.CUSTOMERNAME, "关税", _关税, _SD);
|
|
|
OrderFeeList.Add(关税);
|
|
|
var 增值税 = NewOrderFee2(head.CUSTOMERNAME, "增值税", _增值税, _SD);
|
|
|
OrderFeeList.Add(增值税);
|
|
|
var 代理费单价 = NewOrderFee2(head.CUSTOMERNAME, "代理费单价", _代理费单价, _SD);
|
|
|
OrderFeeList.Add(代理费单价);
|
|
|
var 代理费 = NewOrderFee2(head.CUSTOMERNAME, "代理费", _代理费, _SD);
|
|
|
OrderFeeList.Add(代理费);
|
|
|
var 调快费 = NewOrderFee3(head.CUSTOMERNAME, "调快费", _调快费, _SD,GDDATA.remark_6);
|
|
|
OrderFeeList.Add(调快费);
|
|
|
var 价格备注费率 = NewOrderFee2(head.CUSTOMERNAME, "价格备注费率", _价格备注费率, _SD);
|
|
|
OrderFeeList.Add(价格备注费率);
|
|
|
var 货款应收 = NewOrderFee2(head.CUSTOMERNAME, "货款应收", _货款应收, _SD);
|
|
|
OrderFeeList.Add(货款应收);
|
|
|
|
|
|
|
|
|
//var 出入库费率 = NewOrderFee2(head.CUSTOMERNAME, "出入库费率", _出入库费率, _SD);
|
|
|
//OrderFeeList.Add(出入库费率);
|
|
|
//var 倒柜费率 = NewOrderFee2(head.CUSTOMERNAME, "倒柜费率", _倒柜费率, _SD);
|
|
|
//OrderFeeList.Add(倒柜费率);
|
|
|
|
|
|
if (type == "出入库")
|
|
|
{
|
|
|
var 出入库费率 = NewOrderFee2(head.CUSTOMERNAME, "出入库费率", _出入库费率, _SD);
|
|
|
OrderFeeList.Add(出入库费率);
|
|
|
var 出入库费 = NewOrderFee2(head.CUSTOMERNAME, "出入库费", _出入库费, _SD);
|
|
|
OrderFeeList.Add(出入库费);
|
|
|
var 冷藏费 = NewOrderFee2(head.CUSTOMERNAME, "冷藏费", _冷藏费, _SD);
|
|
|
OrderFeeList.Add(冷藏费);
|
|
|
var 冷藏费率 = NewOrderFee2(head.CUSTOMERNAME, "冷藏费率", _冷藏费率, _SD);
|
|
|
OrderFeeList.Add(冷藏费率);
|
|
|
var 冷藏天数 = NewOrderFee2(head.CUSTOMERNAME, "冷藏天数", _冷藏天数, _SD);
|
|
|
OrderFeeList.Add(冷藏天数);
|
|
|
var 资金利息利率 = NewOrderFee2(head.CUSTOMERNAME, "资金利息利率", _资金利息利率, _SD);
|
|
|
OrderFeeList.Add(资金利息利率);
|
|
|
var 资金占用时间 = NewOrderFee2(head.CUSTOMERNAME, "资金占用时间", _资金占用时间, _SD);
|
|
|
OrderFeeList.Add(资金占用时间);
|
|
|
var 资金利息 = NewOrderFee2(head.CUSTOMERNAME, "资金利息", _资金利息, _SD);
|
|
|
OrderFeeList.Add(资金利息);
|
|
|
}
|
|
|
if (type == "倒柜")
|
|
|
{
|
|
|
var 倒柜费率 = NewOrderFee2(head.CUSTOMERNAME, "倒柜费率", _倒柜费率, _SD);
|
|
|
OrderFeeList.Add(倒柜费率);
|
|
|
var 倒柜费 = NewOrderFee2(head.CUSTOMERNAME, "倒柜费", _倒柜费, _SD);
|
|
|
OrderFeeList.Add(倒柜费);
|
|
|
}
|
|
|
|
|
|
|
|
|
var 冷库费用 = NewOrderFee2(head.CUSTOMERNAME, "冷库费用", _冷库费用, _SD);
|
|
|
OrderFeeList.Add(冷库费用);
|
|
|
|
|
|
var 定金 = NewOrderFee2(head.CUSTOMERNAME, "定金", _定金, _SD);
|
|
|
OrderFeeList.Add(定金);
|
|
|
var 入库件数 = NewOrderFee2(head.CUSTOMERNAME, "入库件数", Convert.ToDecimal(_入库件数), _SD);
|
|
|
OrderFeeList.Add(入库件数);
|
|
|
var 件数 = NewOrderFee2(head.CUSTOMERNAME, "件数", Convert.ToDecimal(_件数), _SD);
|
|
|
OrderFeeList.Add(件数);
|
|
|
var 其他费用 = NewOrderFee2(head.CUSTOMERNAME, "其他费用", _其他费用, _SD);
|
|
|
OrderFeeList.Add(其他费用);
|
|
|
var 总应收 = NewOrderFee2(head.CUSTOMERNAME, "总应收", _总应收, _SD);
|
|
|
OrderFeeList.Add(总应收);
|
|
|
var 应付尾款 = NewOrderFee2(head.CUSTOMERNAME, "应付尾款", _应付尾款, _SD);
|
|
|
OrderFeeList.Add(应付尾款);
|
|
|
|
|
|
_count++;
|
|
|
}
|
|
|
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsOrderFee_Import>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", ZD_GID,
|
|
|
ModelObjectConvert<MsOrderFee_Import>.ToModelObjectList(OrderFeeList),
|
|
|
ModelObjectConvert<MsOrderFee_Import>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
private MsOrderFee_Import NewOrderFee2(string CUSTOMERNAME, string FEENAME, decimal AMOUNT, Import_SaleZDDetailmb _ZD)
|
|
|
{
|
|
|
var _r = new MsOrderFee_Import();
|
|
|
_r.CustomerName = CUSTOMERNAME;
|
|
|
_r.FeeName = FEENAME;
|
|
|
_r.Amount = AMOUNT;
|
|
|
_r.GId = System.Guid.NewGuid().ToString();
|
|
|
_r.FeeType = 1;
|
|
|
_r.BsNo = "";
|
|
|
_r.CARGO_GID = _ZD.CARGO_GID;
|
|
|
_r.BXGID = _ZD.ZD_GID;
|
|
|
_r.MODIFIEDTIME = System.DateTime.Now.ToString();
|
|
|
_r.MODIFIEDUSER = Session["USERID"].ToString();
|
|
|
_r.UnitPrice = 0;
|
|
|
return _r;
|
|
|
}
|
|
|
|
|
|
private MsOrderFee_Import NewOrderFee3 ( string CUSTOMERNAME, string FEENAME, decimal AMOUNT, Import_SaleZDDetailmb _ZD,string Remark )
|
|
|
{
|
|
|
var _r = new MsOrderFee_Import();
|
|
|
_r.CustomerName = CUSTOMERNAME;
|
|
|
_r.FeeName = FEENAME;
|
|
|
_r.Amount = AMOUNT;
|
|
|
_r.GId = System.Guid.NewGuid().ToString();
|
|
|
_r.FeeType = 1;
|
|
|
_r.BsNo = "";
|
|
|
_r.CARGO_GID = _ZD.CARGO_GID;
|
|
|
_r.BXGID = _ZD.ZD_GID;
|
|
|
_r.MODIFIEDTIME = System.DateTime.Now.ToString();
|
|
|
_r.MODIFIEDUSER = Session["USERID"].ToString();
|
|
|
_r.Remark = Remark;
|
|
|
_r.UnitPrice = 0;
|
|
|
return _r;
|
|
|
}
|
|
|
|
|
|
public ContentResult SetUse ( string DetailBody )
|
|
|
{
|
|
|
|
|
|
var DetailbodyList = JsonConvert.Deserialize<List<Import_SaleZDmb>>(DetailBody);
|
|
|
var GIDList = "";
|
|
|
|
|
|
foreach (var _d in DetailbodyList)
|
|
|
{
|
|
|
if (GIDList == "")
|
|
|
{
|
|
|
GIDList = "'" + _d.GID + "'";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
GIDList = GIDList + ",'" + _d.GID + "'";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var SQL = "Update Import_SaleZD set ISUSE=1-isnull(ISUSE,0) where GID in(" + GIDList + ")";
|
|
|
|
|
|
var _r = PubSysDAL.ExecSql(SQL);
|
|
|
|
|
|
var jsonRespose = new JsonResponse();
|
|
|
|
|
|
if (_r > 0)
|
|
|
{
|
|
|
jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "设置完成",
|
|
|
Data = null
|
|
|
};
|
|
|
}
|
|
|
else
|
|
|
jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = "设置0条数据",
|
|
|
Data = null
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#region 生成账单费用
|
|
|
public ContentResult GetOrderDataList2(string strCondition)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetOrderDataList(strCondition);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOrderDataList(string billno)
|
|
|
{
|
|
|
var dataList = ImportSalesDAL.GetOrderDataList("BsNo='" + billno + "'" , 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 MakeOrderFee_RMB ( string SALESNO )
|
|
|
{
|
|
|
//获取相关费用 计算出目标费用数值
|
|
|
var head=new ImportSalesmb();
|
|
|
var list = ImportSalesDAL.GetDataList(" s.SALESNO='" + SALESNO + "' ", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
|
|
|
var _BodyList = ImportSalesDAL.GetDetailList(" s.SALESNO='" + SALESNO + "' ", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]), "");
|
|
|
|
|
|
var OrderFeeList = new List<MsOrderFee>();
|
|
|
|
|
|
foreach (var _SD in _BodyList) {
|
|
|
|
|
|
var 货款RMB = NewOrderFee(head.CUSTOMERNAME, "货款RMB", Convert.ToDecimal(_SD.AMOUNTRMB), _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(货款RMB);
|
|
|
|
|
|
var _单价吨 = Convert.ToDecimal(_SD.PRICERMB)*1000;
|
|
|
var _销售吨数 = Convert.ToDecimal(_SD.WEIGHT)/1000;
|
|
|
var _冷藏费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'冷藏费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"))*Convert.ToDecimal(_SD.WEIGHT)/1000;
|
|
|
var _冷藏天数 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY, dbo.trimdate(dateadd(day,3,'"+head.SALESDATE+"')), dbo.trimdate('"+_SD.STOCKDATE_2+"')), 0)+1 ")) ;
|
|
|
var _出入库费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'出入库费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'")) ;
|
|
|
var _倒柜费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'倒柜费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
var _货款应收 = 货款RMB.Amount + (_冷藏费率 * _冷藏天数 * _销售吨数) + _出入库费率 * _销售吨数;
|
|
|
var _定金 = Convert.ToDecimal(_SD.PREPAYMENT_ACT);
|
|
|
var _应付尾款 = _货款应收 - _定金;
|
|
|
|
|
|
var 单价吨 = NewOrderFee(head.CUSTOMERNAME, "单价吨", _单价吨,_SD.CARGO_GID);
|
|
|
OrderFeeList.Add(单价吨);
|
|
|
var 销售吨数 = NewOrderFee(head.CUSTOMERNAME, "销售吨数", _销售吨数, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(销售吨数);
|
|
|
var 冷藏费率 = NewOrderFee(head.CUSTOMERNAME, "冷藏费率", _冷藏费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(冷藏费率);
|
|
|
var 冷藏天数 = NewOrderFee(head.CUSTOMERNAME, "冷藏天数", _冷藏天数, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(冷藏天数);
|
|
|
var 出入库费率 = NewOrderFee(head.CUSTOMERNAME, "出入库费率", _出入库费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(出入库费率);
|
|
|
var 倒柜费率 = NewOrderFee(head.CUSTOMERNAME, "倒柜费率", _倒柜费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(倒柜费率);
|
|
|
var 货款应收 = NewOrderFee(head.CUSTOMERNAME, "货款应收", _货款应收, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(货款应收);
|
|
|
var 定金 = NewOrderFee(head.CUSTOMERNAME, "定金", _定金, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(定金);
|
|
|
var 应付尾款 = NewOrderFee(head.CUSTOMERNAME, "应付尾款", _应付尾款, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(应付尾款);
|
|
|
}
|
|
|
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsOrderFee>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", head.SALESNO,
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(OrderFeeList),
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult MakeOrderFee_USD ( string SALESNO )
|
|
|
{
|
|
|
//获取相关费用 计算出目标费用数值
|
|
|
var head = new ImportSalesmb();
|
|
|
var list = ImportSalesDAL.GetDataList(" s.SALESNO='" + SALESNO + "' ", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (list.Count > 0)
|
|
|
head = list[0];
|
|
|
|
|
|
var _BodyList = ImportSalesDAL.GetDetailList(" s.SALESNO='" + SALESNO + "' ", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]), "");
|
|
|
|
|
|
var OrderFeeList = new List<MsOrderFee>();
|
|
|
|
|
|
var 总重量 = 0M;
|
|
|
foreach (var _SD1 in _BodyList) {
|
|
|
总重量 += Convert.ToDecimal(_SD1.WEIGHT);
|
|
|
}
|
|
|
|
|
|
foreach (var _SD in _BodyList)
|
|
|
{
|
|
|
|
|
|
var CargoList = XXHDAL.GetCargoList(" c.gid='"+_SD.CARGO_GID+"'");
|
|
|
var Cargo = CargoList[0];
|
|
|
|
|
|
var _单价吨 = Convert.ToDecimal(_SD.PRICE) * 1000;
|
|
|
var _销售吨数 = Convert.ToDecimal(_SD.WEIGHT) / 1000;
|
|
|
var _应收账单汇率=Convert.ToDecimal(_SD.Exchangerate_Cust);
|
|
|
var _货款币别 =_销售吨数*_单价吨;
|
|
|
var _货款RMB = _单价吨 * _销售吨数 * _应收账单汇率;
|
|
|
var _手续费 = _货款RMB*0.001M;
|
|
|
var _电汇费 = 150 * _销售吨数 / (总重量/1000);
|
|
|
var _总货款 = _货款RMB + _手续费 + _电汇费;
|
|
|
var _海关限价吨 = Convert.ToDecimal(Cargo.price_limit)*1000;
|
|
|
var _海关汇率 = Convert.ToDecimal(Cargo.Exchangerate_Customs);
|
|
|
var _采购价吨 =Convert.ToDecimal(Cargo.price)*1000;
|
|
|
var _保率=Convert.ToDecimal(Cargo.baolv);
|
|
|
var _完税金额 = 0M;
|
|
|
if (_海关限价吨 > _采购价吨) {
|
|
|
_完税金额 = _海关限价吨 * _销售吨数 * _海关汇率 * _保率;
|
|
|
} else {
|
|
|
_完税金额 = _采购价吨 * _销售吨数 * _海关汇率 * _保率;
|
|
|
}
|
|
|
var _关税税率 = Convert.ToDecimal(Cargo.tax);
|
|
|
var _增值税税率 = Convert.ToDecimal(Cargo.tax_zz);
|
|
|
var _关税 = _完税金额 * _海关汇率 * _关税税率;
|
|
|
var _增值税 = (_关税 + _完税金额) * _增值税税率;
|
|
|
var _代理费单价 = Convert.ToDecimal(_SD.AGENCRATE_Cust);
|
|
|
var _代理费 = _代理费单价 * _销售吨数;
|
|
|
var _调快费 = Convert.ToDecimal(ImportSalesDAL.GetField("select charindex('调快',m.remark_6) TKINDEX from import_main m where contractno=(select contractno from import_cargo where gid='" + _SD.CARGO_GID + "')")) ;
|
|
|
if (_调快费 > 0) { _调快费 = 1000; }
|
|
|
else{
|
|
|
_调快费=0;
|
|
|
}
|
|
|
var _价格备注费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select substring(sd.PRICEREMARK,charindex('+',sd.PRICEREMARK)+1,len(sd.PRICEREMARK)) from import_saledetail sd where gid='" + _SD.GID + "'"));
|
|
|
|
|
|
var _货款应收 = _货款RMB + _手续费 + _电汇费 + _调快费 + _关税 + _增值税;
|
|
|
|
|
|
var _资金利息利率 = Convert.ToDecimal(_SD.FUNDRATE);
|
|
|
var _资金占用时间 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY,dateadd(day,3,s.SALESDATE), sd.STOCKDATE_2), 0)+1 from import_saledetail sd left join import_sales s on s.salesno=sd.salesno where sd.gid='" + _SD.GID + "'")) ;
|
|
|
|
|
|
var _资金利息 = _货款应收 * _资金利息利率 * _资金占用时间/30;
|
|
|
|
|
|
var _冷藏费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'冷藏费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'")) * Convert.ToDecimal(_SD.WEIGHT) / 1000;
|
|
|
var _冷藏天数 = Convert.ToDecimal(ImportSalesDAL.GetField("select isnull(DATEDIFF(DAY, dbo.trimdate(dateadd(day,3,'" + head.SALESDATE + "')), dbo.trimdate('" + _SD.STOCKDATE_2 + "')), 0)+1 "));
|
|
|
var _出入库费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'出入库费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
var _倒柜费率 = Convert.ToDecimal(ImportSalesDAL.GetField("select top 1 dbo.[Get_ClientFee](STORAGENAME,'倒柜费') from WMS where Cargo_gid='" + _SD.CARGO_GID + "'"));
|
|
|
//var _货款应收 = 货款RMB.Amount + (_冷藏费率 * _冷藏天数 * _销售吨数) + _出入库费率 * _销售吨数;
|
|
|
var _冷藏费 = _销售吨数 * _冷藏费率 * _冷藏天数;
|
|
|
var _出入库费 = _销售吨数 * _出入库费率;
|
|
|
var _倒柜费 = _销售吨数 * _倒柜费率;
|
|
|
var _冷库费用 = _冷藏费 + _出入库费 + _倒柜费;
|
|
|
|
|
|
var _定金 = Convert.ToDecimal(_SD.PREPAYMENT_ACT);
|
|
|
|
|
|
var _入库件数 = _SD.BOXCOUNT;
|
|
|
var _其他费用 = _价格备注费率 * _销售吨数;
|
|
|
var _总应收 = _货款应收 + _资金利息 + _其他费用;
|
|
|
|
|
|
var _应付尾款 = _总应收 - _定金;
|
|
|
|
|
|
|
|
|
var 单价吨 = NewOrderFee(head.CUSTOMERNAME, "单价吨", _单价吨, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(单价吨);
|
|
|
var 销售吨数 = NewOrderFee(head.CUSTOMERNAME, "销售吨数", _销售吨数, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(销售吨数);
|
|
|
var 应收账单汇率 = NewOrderFee(head.CUSTOMERNAME, "应收账单汇率", _应收账单汇率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(应收账单汇率);
|
|
|
var 货款币别 = NewOrderFee(head.CUSTOMERNAME, "货款币别", _货款币别, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(货款币别);
|
|
|
var 货款RMB = NewOrderFee(head.CUSTOMERNAME, "货款RMB", _货款RMB, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(货款RMB);
|
|
|
var 手续费 = NewOrderFee(head.CUSTOMERNAME, "手续费", _手续费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(手续费);
|
|
|
var 电汇费 = NewOrderFee(head.CUSTOMERNAME, "电汇费", _电汇费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(电汇费);
|
|
|
var 总货款 = NewOrderFee(head.CUSTOMERNAME, "总货款", _总货款, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(总货款);
|
|
|
var 海关限价吨 = NewOrderFee(head.CUSTOMERNAME, "海关限价吨", _海关限价吨, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(海关限价吨);
|
|
|
var 海关汇率 = NewOrderFee(head.CUSTOMERNAME, "海关汇率", _海关汇率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(海关汇率);
|
|
|
var 采购价吨 = NewOrderFee(head.CUSTOMERNAME, "采购价吨", _采购价吨, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(采购价吨);
|
|
|
var 保率 = NewOrderFee(head.CUSTOMERNAME, "保率", _保率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(保率);
|
|
|
var 完税金额 = NewOrderFee(head.CUSTOMERNAME, "完税金额", _完税金额, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(完税金额);
|
|
|
var 关税税率 = NewOrderFee(head.CUSTOMERNAME, "关税税率", _关税税率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(关税税率);
|
|
|
var 增值税税率 = NewOrderFee(head.CUSTOMERNAME, "增值税税率", _增值税税率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(增值税税率);
|
|
|
var 关税 = NewOrderFee(head.CUSTOMERNAME, "关税", _关税, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(关税);
|
|
|
var 增值税 = NewOrderFee(head.CUSTOMERNAME, "增值税", _增值税, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(增值税);
|
|
|
var 代理费单价 = NewOrderFee(head.CUSTOMERNAME, "代理费单价", _代理费单价, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(代理费单价);
|
|
|
var 代理费 = NewOrderFee(head.CUSTOMERNAME, "代理费", _代理费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(代理费);
|
|
|
var 调快费 = NewOrderFee(head.CUSTOMERNAME, "调快费", _调快费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(调快费);
|
|
|
var 价格备注费率 = NewOrderFee(head.CUSTOMERNAME, "价格备注费率", _价格备注费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(价格备注费率);
|
|
|
var 货款应收 = NewOrderFee(head.CUSTOMERNAME, "货款应收", _货款应收, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(货款应收);
|
|
|
var 资金利息利率 = NewOrderFee(head.CUSTOMERNAME, "资金利息利率", _资金利息利率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(资金利息利率);
|
|
|
var 资金占用时间 = NewOrderFee(head.CUSTOMERNAME, "资金占用时间", _资金占用时间, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(资金占用时间);
|
|
|
var 资金利息 = NewOrderFee(head.CUSTOMERNAME, "资金利息", _资金利息, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(资金利息);
|
|
|
var 冷藏费率 = NewOrderFee(head.CUSTOMERNAME, "冷藏费率", _冷藏费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(冷藏费率);
|
|
|
var 冷藏天数 = NewOrderFee(head.CUSTOMERNAME, "冷藏天数", _冷藏天数, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(冷藏天数);
|
|
|
var 出入库费率 = NewOrderFee(head.CUSTOMERNAME, "出入库费率", _出入库费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(出入库费率);
|
|
|
var 倒柜费率 = NewOrderFee(head.CUSTOMERNAME, "倒柜费率", _倒柜费率, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(倒柜费率);
|
|
|
|
|
|
var 冷藏费 = NewOrderFee(head.CUSTOMERNAME, "冷藏费", _冷藏费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(冷藏费);
|
|
|
var 出入库费 = NewOrderFee(head.CUSTOMERNAME, "出入库费", _出入库费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(出入库费);
|
|
|
var 倒柜费 = NewOrderFee(head.CUSTOMERNAME, "倒柜费", _倒柜费, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(倒柜费);
|
|
|
var 冷库费用 = NewOrderFee(head.CUSTOMERNAME, "冷库费用", _冷库费用, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(冷库费用);
|
|
|
|
|
|
var 定金 = NewOrderFee(head.CUSTOMERNAME, "定金", _定金, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(定金);
|
|
|
var 入库件数 = NewOrderFee(head.CUSTOMERNAME, "入库件数", Convert.ToDecimal(_入库件数), _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(入库件数);
|
|
|
var 其他费用 = NewOrderFee(head.CUSTOMERNAME, "其他费用", _其他费用, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(其他费用);
|
|
|
var 总应收 = NewOrderFee(head.CUSTOMERNAME, "总应收", _总应收, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(总应收);
|
|
|
var 应付尾款 = NewOrderFee(head.CUSTOMERNAME, "应付尾款", _应付尾款, _SD.CARGO_GID);
|
|
|
OrderFeeList.Add(应付尾款);
|
|
|
}
|
|
|
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsOrderFee>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", head.SALESNO,
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(OrderFeeList),
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
private MsOrderFee NewOrderFee ( string CUSTOMERNAME, string FEENAME, decimal AMOUNT ,string CARGO_GID) {
|
|
|
var _r = new MsOrderFee();
|
|
|
_r.CustomerName = CUSTOMERNAME;
|
|
|
_r.FeeName = FEENAME;
|
|
|
_r.Amount = AMOUNT;
|
|
|
_r.GId = System.Guid.NewGuid().ToString();
|
|
|
_r.FeeType = 1;
|
|
|
_r.BsNo = "";
|
|
|
_r.CARGO_GID = CARGO_GID;
|
|
|
_r.MODIFIEDTIME = System.DateTime.Now.ToString();
|
|
|
_r.MODIFIEDUSER = Session["USERID"].ToString();
|
|
|
return _r;
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveOrderFee ( string bsno, string type, string OrderFeeBody )
|
|
|
{
|
|
|
var chfeeBodyList = JsonConvert.Deserialize<List<MsOrderFee>>(OrderFeeBody);
|
|
|
var chfeeDelBodyList = JsonConvert.Deserialize<List<MsOrderFee>>("");
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
DBResult result = modb.SaveComm("BsNo", bsno,
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(chfeeBodyList),
|
|
|
ModelObjectConvert<MsOrderFee>.ToModelObjectList(chfeeDelBodyList)
|
|
|
);
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|