diff --git a/Framework/YLErp.Core/DBModels/BondPayment.cs b/Framework/YLErp.Core/DBModels/BondPayment.cs new file mode 100644 index 00000000..bcf23d60 --- /dev/null +++ b/Framework/YLErp.Core/DBModels/BondPayment.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using YieldChain.Security; +using YLErp.DBModels.Base; + +namespace YLErp.DBModels +{ + /// + /// 债券期间付息表 + /// + [Table("bond_payment_info")] + public class BondPayment + { + public long id { get; set; } + + /// + /// 加密主键 + /// + [NotMapped] + public string EncryptId + { + get { return DataProtect.Encrypt(id.ToString()); } + } + /// + /// 债券代码 + /// + [Column("inner_code")] + public int inner_code { get; set; } + + [Column("underlying_code")] + public string underlyingCode { get; set; } + /// + /// 债券代码 + /// + [DisplayName("债券代码")] + [NotMapped] + public string security_id { get; set; } + + /// + /// 债券名称 + /// + [DisplayName("债券名称")] + [NotMapped] + public string symbol { get; set; } + /// + /// 利息税率(%) + /// + [DisplayName("利息税率(%)")] + [Column("interest_tax_rate")] + public decimal? coupon_rate { get; set; } + + /// + /// 现金流发放日 + /// + [DisplayName("理论付息(兑付)日")] + [Column("pay_date_PL")] + public DateTime? payment_date_pl { get; set; } + /// + /// 现金流发放日 + /// + [DisplayName("实际付息(兑付)日")] + [Column("pay_date_act")] + public DateTime? payment_date { get; set; } + /// + /// 每张兑付利息额 + /// + [DisplayName("每张兑付利息额")] + [Column("paying_interest")] + public decimal? payment_interest { get; set; } + /// + /// 每张兑付本金额 + /// + [DisplayName("每张兑付本金额")] + [Column("paying_principal")] + public decimal? payment_parvalue { get; set; } + + /// + /// 每张兑付本息额 + /// + [DisplayName("每张兑付本息额")] + [Column("paying_price")] + public decimal? paying_price { get; set; } + + /// + /// 渠道来源 + /// + [Column("info_source")] + public string channel_source { get; set; } + /// + /// 聚源JSID + /// + public long jsid { get; set; } + /// + /// 发布时间 + /// + [Column("insert_time")] + public DateTime create_time { get; set; } + /// + /// 更新时间 + /// + [Column("update_time")] + public DateTime update_time { get; set; } + } +} diff --git a/Framework/YLErp.Core/DBModels/underlying_manager.cs b/Framework/YLErp.Core/DBModels/underlying_manager.cs index 7c200bcf..89fea84e 100644 --- a/Framework/YLErp.Core/DBModels/underlying_manager.cs +++ b/Framework/YLErp.Core/DBModels/underlying_manager.cs @@ -317,6 +317,11 @@ namespace YLErp.DBModels public string UnderlyingPinYin { get; set; } + /// + /// 聚源内部id + /// + public long? InnerCode { get; set; } + public override string ToString() { return $"{UnderlyingCode}--{UnderlyingName}--{id}--{UnderlyingInstrumentType}"; diff --git a/YLErpDAL/DataBase/YLContext.cs b/YLErpDAL/DataBase/YLContext.cs index 73d418c8..b6ed6e6d 100644 --- a/YLErpDAL/DataBase/YLContext.cs +++ b/YLErpDAL/DataBase/YLContext.cs @@ -406,5 +406,7 @@ namespace YLErp.BLL public DbSet clientMarginConfig { get; set; } public DbSet clientMarginDetail { get; set; } public DbSet tradeContractOaResult { get; set; } + public DbSet bondPayment { get; set; } + } } \ No newline at end of file diff --git a/YLErpDAL/Modules/EodModule/BondPaymentService.cs b/YLErpDAL/Modules/EodModule/BondPaymentService.cs new file mode 100644 index 00000000..05f5a1cf --- /dev/null +++ b/YLErpDAL/Modules/EodModule/BondPaymentService.cs @@ -0,0 +1,159 @@ +using BaseOUDAL; +using DocumentFormat.OpenXml.Bibliography; +using ExcelDataReader.Log; +using YLErp.DBModels; +using YLErp.Helpers; + +namespace YLErp.Modules.EodModule +{ + /// + /// 债券期间付息服务 + /// + public class BondPaymentService : YLBaseService + { + private static IYcLogger Log = LogFactory.GetLogger(nameof(BondPaymentService)); + public BondPaymentService(OptUserInfo userInfo) : base(userInfo) + { + + } + + public SearchListResult SearchList(BondPaymentReq req) + { + var valueDtStart = req.ValueDateStart.Year > 2000 ? req.ValueDateStart : DateTime.Today.AddYears(-1); + var valueDtEnd = req.ValueDateEnd.Year > 2000 ? req.ValueDateEnd.AddDays(1) : DateTime.Today.AddYears(1); + + var predicatUn = PredicateBuilder.Create(d => d.LaunchState == "1"); + var predicatEoc = PredicateBuilder.Create(source => source.payment_date >= valueDtStart && source.payment_date < valueDtEnd); + + if (!string.IsNullOrEmpty(req.DataSource)) + { + predicatEoc = predicatEoc.And(d => d.channel_source.Contains(req.DataSource)); + } + if (!string.IsNullOrEmpty(req.MarketName)) + { + predicatUn = predicatUn.And(d => d.MarketName == req.MarketName); + } + if (!string.IsNullOrEmpty(req.UnderlyingCode)) + { + predicatEoc = predicatEoc.And(d => d.underlyingCode.Contains(req.UnderlyingCode)); + } + if (string.IsNullOrEmpty(req.sidx)) + { + req.sidx = "payment_date"; + req.sord = "desc"; + } + var queryUn = DbContext.underlying_manager.Where(predicatUn).Select(n => new { n.id, n.MarketName, n.UnderlyingCode, n.UnderlyingName, n.UnderlyingInstrumentType, n.InnerCode }); + var query = from un in queryUn + join source in DbContext.bondPayment.Where(predicatEoc) on un.UnderlyingCode equals source.underlyingCode + select new BondPaymentDto + { + id = source.id, + channel_source = source.channel_source, + MarketName = un.MarketName, + security_id = un.UnderlyingCode, + symbol = un.UnderlyingName, + coupon_rate = source.coupon_rate, + payment_date = source.payment_date, + payment_interest = source.payment_interest, + payment_parvalue = source.payment_parvalue, + create_time = source.create_time, + update_time = source.update_time + }; + var result = query.ToSearchList(req); + return result; + } + + public BondPayment SaveBondPayment(BondPayment req) + { + if (req is null) + { + throw new ArgumentNullException(nameof(req)); + } + BondPayment dbmodel; + + if (req.id == 0) + { + DbContext.bondPayment.Add(dbmodel = req); + } + else + { + dbmodel = DbContext.bondPayment.Find(req.id); + if (dbmodel == null) + { + throw new ServiceException("数据不存在"); + } + UpdateChanges(dbmodel, req); + } + dbmodel.update_time = DateTime.Now; + DbContext.SaveChanges(); + + return dbmodel; + } + /// + /// 获取某债券的期间付息情况集合 + /// + /// + /// + /// + /// + public List GetBondPayments(string underylingCode, DateTime startDate, DateTime endDate) + { + var result = DbContext.bondPayment.Where(x => x.underlyingCode == underylingCode && x.payment_date > startDate && x.payment_date <= endDate).AsNoTracking().ToList(); + return result; + } + /// + /// 计算某债券某段时间的期间付息 + /// + /// 债券代码 + /// 计息开始日 + /// 计息结束日 + /// 持仓数量 + /// 多空方向 + /// 收支方向 + /// + public decimal CalcPayment(string underylingCode, DateTime startDate, DateTime endDate, decimal qty, decimal longRatio, decimal payDirection) + { + var payments = GetBondPayments(underylingCode, startDate, endDate); + return CalcPayment(payments, qty, longRatio, payDirection); + } + /// + /// 计算某债券期间付息 + /// + /// 期间付息集合 + /// 持仓数量 + /// 多空方向 + /// 收支方向 + /// + public decimal CalcPayment(List payments, decimal qty, decimal longRatio, decimal payDirection) + { + var interest = payments.Sum(s => s.payment_interest ?? 0); + return interest * qty * 0.01m * longRatio * payDirection; + } + } + + /// + /// + /// + public class BondPaymentReq : BaseSearchReq + { + /// + /// 数据来源 + /// + public string DataSource { get; set; } + + /// + /// 标的代码 + /// + public string UnderlyingCode { get; set; } + + public DateTime ValueDateStart { get; set; } + + public DateTime ValueDateEnd { get; set; } + // 市场 + public string MarketName { get; set; } + } + public class BondPaymentDto : BondPayment + { + public string MarketName { get; set; } + } +} diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 33023148..ef693f9c 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -319,7 +319,7 @@ namespace YLErp.Modules.SwapModule var posiNotionalValue = stockEqvNotional * closePercent;//剩余名义本金 var grossPrice = realPostitions.Where(x => x.PosiDirection > 0).FirstOrDefault()?.PosiGrossPrice; bool tdClose = DbContext.swap_flow_event.Any(x => x.SwapTradeId == tradeId && x.UnwindDate == unwindDate && eventTypes.Contains(x.EventType) && x.DataState == (int)SwapFlowDateStateEnum.完成); - interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, false, false); + interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, false, false); return interests; } /// @@ -880,11 +880,17 @@ namespace YLErp.Modules.SwapModule floatEvent.TradingFeePending = position.PosiTradingFeePending * unwindData.ClosePercent; floatEvent.TradingFeePending = Math.Round(floatEvent.TradingFeePending, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero); floatEvent.TradingFee = closeFee; + BondPaymentService bondPaymentService = new BondPaymentService(UserInfo); + var payments = bondPaymentService.GetBondPayments(floatEvent.UnderlyingCode, td.StartDate.Value, floatEvent.UnwindDate.Value); + floatEvent.DividendIn = bondPaymentService.CalcPayment(payments, unwindQty, longRatio, floatRatio); + floatEvent.DividendIn = Math.Round(floatEvent.DividendIn, 2, MidpointRounding.AwayFromZero); + floatEvent.DividendPending = bondPaymentService.CalcPayment(payments, floatEvent.PositionQty ?? 0, longRatio, floatRatio); + floatEvent.MarkClosePnl = (unwindPrice - position.PosiGrossPrice) * unwindQty * floatRatio * longRatio; - floatEvent.MarkClosePnl = Math.Round(floatEvent.MarkClosePnl + ((floatEvent.TradingFeePending+ closeFee) * floatRatio * -1), ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero); + floatEvent.MarkClosePnl = Math.Round(floatEvent.MarkClosePnl + ((floatEvent.TradingFeePending+ closeFee) * floatRatio * -1) + floatEvent.DividendIn, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero); floatEvent.TradingAmount = unwindPrice * floatEvent.Quantity * floatEvent.ContractSize; floatEvent.TradingAmount = Math.Round(floatEvent.TradingAmount, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero); - floatEvent.OptLog = "流水自动"; + floatEvent.OptLog = "流水自动"; floatEvent.ClientId = td.ClientId; floatEvent.SetOpt(UserInfo); } diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index e18db806..b97a1562 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -1142,6 +1142,13 @@ namespace YLErp.Modules.SwapModule int directionRatio = eod.PosiDirection == (int)SwapDirectionEnum.收取 ? 1 : -1; curretEod.PosiStatus = curretEod.PosiQuantity == 0 ? 1 : 0; var price = UnderlyingCodePrice(eod.UnderlyingCode, dealDate, out decimal vobp); + BondPaymentService bondPaymentService = new BondPaymentService(UserInfo); + if (valueDate > td.StartDate.Value && (curretEod.PosiQuantity > 0 || valueDate == td.UnWindDate)) + { + curretEod.TdPosiDividend = bondPaymentService.CalcPayment(curretEod.UnderlyingCode, eod.ValueDate, valueDate, curretEod.PosiQuantity, shortRatio, directionRatio); + } + curretEod.PosiDividendSum = eod.PosiDividendSum + curretEod.TdPosiDividend; + curretEod.PosiQuantity = eod.PosiQuantity; if (curretEod.PosiStatus == 1) { curretEod.PosiNotionalValue = 0; @@ -1149,8 +1156,8 @@ namespace YLErp.Modules.SwapModule curretEod.UnderlyingPrice = price; curretEod.UnderlyingMarketValue = curretEod.UnderlyingPrice * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio; curretEod.PosiMtmPnL = (curretEod.UnderlyingPrice - curretEod.PosiGrossPrice) * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio * directionRatio; - curretEod.TdPosiDividend = 0; - curretEod.PosiDividendSum = eod.PosiDividendSum + curretEod.TdPosiDividend; + //curretEod.TdPosiDividend = 0; + //curretEod.PosiDividendSum = eod.PosiDividendSum + curretEod.TdPosiDividend; curretEod.PosiProfitSum = curretEod.PosiMtmPnL + curretEod.PosiDividendSum+ curretEod.PosiFeePending; curretEod.TdCloseFee = 0; curretEod.TdCloseQty = 0; diff --git a/YLErpWeb/App_Data/FunctionRight.xml b/YLErpWeb/App_Data/FunctionRight.xml index 33f79ba4..348b101d 100644 --- a/YLErpWeb/App_Data/FunctionRight.xml +++ b/YLErpWeb/App_Data/FunctionRight.xml @@ -53,6 +53,8 @@ + + diff --git a/YLErpWeb/Common/UserInfoRight.cs b/YLErpWeb/Common/UserInfoRight.cs index eca83cde..ead15534 100644 --- a/YLErpWeb/Common/UserInfoRight.cs +++ b/YLErpWeb/Common/UserInfoRight.cs @@ -605,6 +605,8 @@ namespace YLErp.Web public bool 结算管理_日终价格查看 => HasRight("结算管理-日终价格查看"); + public bool 结算管理_债券付息数据查看 => HasRight("结算管理-债券付息数据查看"); + public bool 结算管理_日终价格修改 => HasRight("结算管理-日终价格修改"); public bool 结算管理_结算汇率查看 => HasRight("结算管理-结算汇率查看"); diff --git a/YLErpWeb/Controllers/BondPaymentController.cs b/YLErpWeb/Controllers/BondPaymentController.cs new file mode 100644 index 00000000..d0b08dbe --- /dev/null +++ b/YLErpWeb/Controllers/BondPaymentController.cs @@ -0,0 +1,94 @@ +using Org.BouncyCastle.Ocsp; +using YLErp.DBModels; +using YLErp.Modules.EodModule; + +namespace YLErp.Web.Controllers +{ + public class BondPaymentController : BaseController + { + readonly IViewRenderService _viewRenderer; + + public BondPaymentController(IViewRenderService viewRenderer) + { + _viewRenderer = viewRenderer; + } + + [MyAuthorize("结算管理-债券付息数据查看")] + public ActionResult BondPaymentList() + { + return View(); + } + + [HttpPost] + public JsonResult BondPaymentQuery(BondPaymentReq req) + { + var sList = new BondPaymentService(CurUser).SearchList(req); + return Json(sList); + } + + public ActionResult BondPaymentView(string enid) + { + var intid = DecryptLong(enid); + var r = yldb.bondPayment.Find(intid); + var um = yldb.underlying_manager.FirstOrDefault(x => x.UnderlyingCode == r.underlyingCode); + r.symbol = um?.UnderlyingName; + r.security_id = um?.UnderlyingCode; + return View(r); + } + + public ActionResult BondPaymentEdit(string enid) + { + if (string.IsNullOrEmpty(enid) || enid == "0") + { + return View(new BondPayment()); + } + var intid = DecryptLong(enid); + var dbmodel = yldb.bondPayment.Find(intid); + if (dbmodel == null) + { + return ShowError("找不到数据"); + } + var um = yldb.underlying_manager.FirstOrDefault(x => x.UnderlyingCode == dbmodel.security_id); + dbmodel.symbol = um?.UnderlyingName; + return View(dbmodel); + } + + public JsonResult BondPaymentEditJson(BondPayment req) + { + if (!string.IsNullOrEmpty(req.EncryptId)) + { + req.id = DecryptLong(req.EncryptId); + } + var r = new BondPaymentService(CurUser).SaveBondPayment(req); + + return JsonSuccess("更新成功", r); + } + + [HttpPost] + public JsonResult DeletBondPayment(string id) + { + var intid = DecryptLong(id); + var r = yldb.bondPayment.Find(intid); + if (r == null) + { + return JsonError("找不到债券期间付息信息"); + } + yldb.bondPayment.Remove(r); + yldb.SaveChanges(); + return JsonSuccess("删除成功"); + } + /// + /// 获取某债券期间付息 + /// + /// + /// + /// + /// + public JsonResult GetBondPayMentInterest(DateTime startDate, DateTime endDate, string underlyingCode) + { + var payments = new BondPaymentService(CurUser).GetBondPayments(underlyingCode, startDate, endDate); + decimal interest = payments.Sum(s => s.payment_interest ?? 0) * 0.01m; + return JsonSuccess("", interest); + } + } +} diff --git a/YLErpWeb/Views/BondPayment/BondPaymentEdit.cshtml b/YLErpWeb/Views/BondPayment/BondPaymentEdit.cshtml new file mode 100644 index 00000000..ce6e7b93 --- /dev/null +++ b/YLErpWeb/Views/BondPayment/BondPaymentEdit.cshtml @@ -0,0 +1,57 @@ +@model BondPayment +@{ + ViewBag.Title = "ծȯڼ丶Ϣ | ༭"; + Layout = "~/Views/Shared/_InfoLayout.cshtml"; +} +@section JS +{ + +} +
+ + @Html.HiddenFor(model => model.id) + @Html.HiddenFor(model => model.jsid) + @Html.HiddenFor(model => model.coupon_rate) + @Html.HiddenFor(model => model.payment_parvalue) + @Html.HiddenFor(model => model.paying_price) + @Html.HiddenFor(model => model.channel_source) +

ծȯڼ丶Ϣ޸

+ +
+
+ + +
+
+ + +
+ @Html.MyDateFor(model => model.payment_date) + @Html.MyTextFor(model => model.payment_interest) +
+
+ + + +
+
\ No newline at end of file diff --git a/YLErpWeb/Views/BondPayment/BondPaymentList.cshtml b/YLErpWeb/Views/BondPayment/BondPaymentList.cshtml new file mode 100644 index 00000000..53d3737b --- /dev/null +++ b/YLErpWeb/Views/BondPayment/BondPaymentList.cshtml @@ -0,0 +1,43 @@ +@{ + var DataSources = new List { "Դ", "˹" }; + ViewBag.Title = "ծȯڼ丶Ϣ"; + Layout = "~/Views/Shared/_InfoLayout.cshtml"; +} +@section CSS { + +} + +@section JS { + + +} + + + +
+ @Html.SearchDateRange("ValueDate", "֧") + @Html.MyAceDropdownInput2("DataSource", "Դ", GlobalData.GetSelectItems(DataSources)) + @Html.MyAceDropdownInput2("MarketName", "г", MarketController.GetAllmarketName()) + @Html.ShortInput("UnderlyingCode", "Ĵ") + @MyControls.SearchBtn() + @MyControls.Btn("", "downloadExcel()") +
+ +@Html.Raw(JqGridSimple.OutTable()) + diff --git a/YLErpWeb/Views/BondPayment/BondPaymentView.cshtml b/YLErpWeb/Views/BondPayment/BondPaymentView.cshtml new file mode 100644 index 00000000..0cbccab8 --- /dev/null +++ b/YLErpWeb/Views/BondPayment/BondPaymentView.cshtml @@ -0,0 +1,46 @@ +@model BondPayment +@{ + ViewBag.Title = "债券期间付息|查看"; + Layout = "~/Views/Shared/_InfoLayout.cshtml"; +} +@section JS { + +} + +
+ @if (CurUser.结算管理_日终价格修改) + { + @MyControls.Btn("修改", "window.location.href=('/BondPayment/BondPaymentEdit/?enid=" + Model.EncryptId + "');") + } + @MyControls.Btn("关闭", "layer.closeMe();") +
+ +
+ + @Html.MyDisplayFor(m => m.payment_date, Utilities.ShowValidDatetime(Model.payment_date)) + @Html.MyDisplayFor(m => m.security_id) + @Html.MyDisplayFor(m => m.symbol) + @Html.MyDisplayFor(m => m.payment_interest) + @Html.MyDisplayFor(m => m.update_time, Utilities.ShowValidDatetime(Model.update_time)) +
+
\ No newline at end of file diff --git a/YLErpWeb/Views/eod_trade_value/eodExecV2.cshtml b/YLErpWeb/Views/eod_trade_value/eodExecV2.cshtml index 5a827c72..9423c6cf 100644 --- a/YLErpWeb/Views/eod_trade_value/eodExecV2.cshtml +++ b/YLErpWeb/Views/eod_trade_value/eodExecV2.cshtml @@ -122,6 +122,11 @@ { 日终价格管理 } + @if (CurUser.结算管理_债券付息数据查看) + { + 债券付息数据 + } + @if (CurUser.结算管理_结算汇率查看) { 结算汇率设置 diff --git a/YLErpWeb/YLErpWeb.csproj b/YLErpWeb/YLErpWeb.csproj index b637f139..228d2de2 100644 --- a/YLErpWeb/YLErpWeb.csproj +++ b/YLErpWeb/YLErpWeb.csproj @@ -208,9 +208,15 @@ - + + + + + + + diff --git a/YLErpWeb/wwwroot/Scripts/app/bondPayment/bondpaymentList.js b/YLErpWeb/wwwroot/Scripts/app/bondPayment/bondpaymentList.js new file mode 100644 index 00000000..2b53d3c4 --- /dev/null +++ b/YLErpWeb/wwwroot/Scripts/app/bondPayment/bondpaymentList.js @@ -0,0 +1,89 @@ +$(function () { + $("#DateToValueDate").val(curdate) + $("#DateFromValueDate").val(curdate) + var PostData = { ValueDateEnd: curdate, ValueDateStart: curdate }; + $(".datepicker").datepicker({ changeMonth: true, changeYear: true, showButtonPanel: true, showOtherMonths: true, selectOtherMonths: true }); + var grid = jQuery('#listGrid').jqGrid({ + url: '/BondPayment/BondPaymentQuery', + datatype: 'json', + height: 'auto', + width: '100%', + autowidth: false, + shrinkToFit: false, + viewrecords: true, + jsonReader: { repeatitems: false }, + cmTemplate: { align: 'center', width: 120 }, + mtype: 'POST', + postData: PostData, + colModel: colModelGrid, + pager: jQuery('#pagerGrid'), + pagerpos: 'left', + rowNum: 20, + rowList: [20, 30, 50, 200, 10000], + footerrow: false + }); + function keyEnter(event) { + try { + var e = event ? event : (window.event ? window.event : null); + (e.keyCode == 13) && SearchClick(true); + } catch (e) { } + } + document.onkeydown = keyEnter; +}); + +var colModelGrid = [{ + name: '', label: '操作', index: '', width: 120, formatter: showToolName +}, { + name: 'payment_date', label: '支付日期', index: 'ValueDate', width: 120, formatter: 'date' +}, { + name: 'MarketName', label: '市场', index: 'MarketName', width: 200 +}, { + name: 'security_id', label: '债券代码', index: 'security_id', width: 150 +}, { + name: 'symbol', label: '债券名称', index: 'symbol', width: 200 +}, { + name: 'payment_interest', label: '支付利息', index: 'payment_interest', width: 100 +}, +{ + name: 'update_time', label: '更新时间', index: 'update_time', width: 160, formatter: 'datetime' +}, { + name: 'channel_source', label: '数据来源', index: 'channel_source', sortable: false, width: 120 +}]; + +function showToolName(cellValue, options, rowObject) { + return "".template(rowObject.EncryptId, "查看"); +} + +function startView(id) { + var srcurl = "/BondPayment/BondPaymentView/?enid=" + id; + main.open("查看债券期间付息", srcurl, { area: ['800px', '600px'] }); +} + +function SearchClick(isSearchclick) { + var listGrid = $('#listGrid'); + listGrid.appendPostData({ UnderlyingCode: $("#UnderlyingCode").val() }); + listGrid.appendPostData({ MarketName: $("#MarketName").val() }); + listGrid.appendPostData({ ValueDateStart: $("#DateFromValueDate").val() }); + listGrid.appendPostData({ ValueDateEnd: $("#DateToValueDate").val() }); + listGrid.appendPostData({ DataSource: $("#DataSource").val() }); + if (isSearchclick) { + //点击搜索时默认第一页 + listGrid.jqGrid('setGridParam', { page: 1 }); + } + listGrid.trigger('reloadGrid'); +} + + +function reloadData() { + SearchClick(false); +} + +function downloadExcel() { + var dateTemp = new Date().Format("yyyyMMdd"); + var fileName = "债券期间付息" + dateTemp; + var formatters = _.map(['市场', '债券代码', '债券名称', '支付利息'] + , x => new Object({ colName: x, formatter: "text" })); + formatters.push(_.map(['支付日期', '更新时间'] + , x => new Object({ colName: x, formatter: "datetime" }))); + main.toExcel("listGrid", fileName, "xls", null, "操作", formatters) +} \ No newline at end of file diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js index 50afd3f3..1eff09c5 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js @@ -262,6 +262,20 @@ const vue = new Vue({ }); thisObj.calcCloseAmount(); thisObj.dataFormat(); + thisObj.getDivindIn(); + }); + }, + getDivindIn() { + var thisObj = this; + let ratio = this.floatPosition.PositionType == 1 ? 1 : -1; + let floatRatio = this.floatPosition.PayDirection == 1 ? 1 : -1; + var postData = { startDate: thisObj.floatPosition.PosiStartDate, endDate: thisObj.deal.UnwindDate, underlyingCode: thisObj.floatPosition.UnderlyingCode } + main.post("/BondPayment/GetBondPayMentInterest", postData, { async: false }).done(function (resp) { + thisObj.floatPosition.DividendIn = parseFloat(thisObj.deal.CloseQty) * resp.obj * ratio * floatRatio; + var posiQty = parseFloat(thisObj.floatPosition.Quantity) - parseFloat(thisObj.deal.CloseQty); + thisObj.floatPosition.DividendPending = posiQty * resp.obj * ratio * floatRatio; + thisObj.calcFloatClosePnl(); + thisObj.dataFormat(); }); }, closeTrade() {//平仓