diff --git a/Framework/YLErp.Core/DBModels/SwapEvent.cs b/Framework/YLErp.Core/DBModels/SwapEvent.cs index 311c25d1..7baa00e5 100644 --- a/Framework/YLErp.Core/DBModels/SwapEvent.cs +++ b/Framework/YLErp.Core/DBModels/SwapEvent.cs @@ -174,6 +174,10 @@ namespace YLErp.DBModels /// public decimal SwapCloseAmount { get; set; } /// + /// 浮动端分红盈亏 + /// + public decimal SwapDividendPnl { get; set; } + /// /// 利息腿/浮动腿 集合,不序列化存储,只做查询 /// public List FlowEvents { get; set; } diff --git a/Framework/YLErp.Core/DBModels/TradeExtend.cs b/Framework/YLErp.Core/DBModels/TradeExtend.cs index 7ab817dd..72772775 100644 --- a/Framework/YLErp.Core/DBModels/TradeExtend.cs +++ b/Framework/YLErp.Core/DBModels/TradeExtend.cs @@ -99,5 +99,10 @@ namespace YLErp.DBModels /// public int SettlementRules { get; set; } = 0; + /// + /// 派息金额支付日 0到期结算日 1派息日+0 2派息日+1 3派息日+2 + /// + public int DividendPayDate { get; set; } = 1; + } } diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index fe89dd14..afd9aa15 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -246,6 +246,7 @@ namespace YLErp.Modules.SwapModule { unwindData.StartDate = preDealDate.Value; } + unwindData.TradeStartDate = td.StartDate; unwindData.ValueDate = dealDate; unwindData.UnwindDate = dealDate; floatEvent.UnwindDate = unwindData.UnwindDate; @@ -421,8 +422,9 @@ namespace YLErp.Modules.SwapModule var closeEvent = closeList.Where(x => x.PositionId == item.PositionId); if (eventType == (int)SwapEventTypeEnum.互换 || eventType == (int)SwapEventTypeEnum.自动互换) { - // 互换:该仓位当天已有完成事件,直接归0 - if (closeEvent.Any()) + // 互换:该仓位当天有同类型的完成事件,直接归0 + var swapCloseEvent = closeEvent.Where(x => x.EventType == eventType); + if (swapCloseEvent.Any()) { item.InterestAmount = 0; item.TdInterestAmount = 0; diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index 888e067f..6cfcbcb7 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -144,7 +144,7 @@ namespace YLErp.Modules.SwapModule if (autoInterval != null) break; } - DealAutoInterests(autoInterests, td, settleDate, preDealDate, posiLongNotional + posiShortNotional, autoInterval); + DealAutoInterests(autoInterests, td, settleDate, preDealDate, posiLongNotional + posiShortNotional, autoInterval, curEodPosis, tradeExtend); //多空组合判断是否已到到期日且无持仓信息 if (longShort && td.ExerciseDate.Value == settleDate && allPositionQty == 0) { @@ -370,9 +370,11 @@ namespace YLErp.Modules.SwapModule /// /// /// 自动互换观察日信息,用于获取结算日期 - private void DealAutoInterests(List autoInterests, trade td, DateTime settleDate, DateTime? preDealDate, decimal StockEqvNotional, IntervalModel interval) + /// 当日浮动端EOD持仓 + /// 交易扩展信息 + private void DealAutoInterests(List autoInterests, trade td, DateTime settleDate, DateTime? preDealDate, decimal StockEqvNotional, IntervalModel interval, List curEodPositions, trade_extend tradeExtend) { - if (autoInterests.Count == 0) + if (autoInterests.Count == 0 && (curEodPositions == null || curEodPositions.All(x => x.PosiDividendSum == 0))) { return; } @@ -391,6 +393,16 @@ namespace YLErp.Modules.SwapModule unwindData.NotionalValue = Convert.ToDecimal(td.OriginalStockEqvNotional ?? 0); unwindData.PosiNotionalValue = StockEqvNotional; + // PayDate 统一用派息金额支付日 + 日历调整 + var dividendPayDateOffset = tradeExtend?.ExtendObj?.DividendPayDate ?? 1; + // 0到期结算日 1派息日+0 2派息日+1 3派息日+2 + var payDays = dividendPayDateOffset > 0 ? dividendPayDateOffset - 1 : 0; + var autoSwapPayDate = QdpCalendarHelper.GetNonHoliday(settleDate.AddDays(payDays)); + unwindData.PayDate = autoSwapPayDate; + + // 给已有利息腿统一赋 PayDate + autoInterests.ForEach(x => x.PayDate = autoSwapPayDate); + // 预付金腿类型列表:初始预付金、追加预付金 var premiumModes = new List() { (int)InterestModeEnum.初始预付金, (int)InterestModeEnum.追加预付金 }; @@ -416,10 +428,58 @@ namespace YLErp.Modules.SwapModule }); unwindData.SwapCloseAmount = interestTotal; // 利息腿金额 - // 总实现盈亏 - unwindData.SwapRealizedPnL = unwindData.SwapCloseAmount + unwindData.SwapMarginRebatePnl; + // 处理浮动端待实现分红:将其转为已实现(到期结算日不处理) + List dividendEvents = new List(); + decimal dividendTotal = 0; + if (curEodPositions != null && dividendPayDateOffset > 0) + { + foreach (var eodPosi in curEodPositions.Where(x => x.PosiDividendSum != 0)) + { + var dividendEvent = new swap_flow_event + { + SwapTradeId = td.id, + SwapTradeNo = td.TradeNumber, + EventType = (int)SwapEventTypeEnum.自动互换, + EventReason = "系统操作-自动互换", + EventDate = settleDate, + UnwindDate = settleDate, + PayDate = autoSwapPayDate, + PositionId = eodPosi.PositionId, + UnderlyingCode = eodPosi.UnderlyingCode, + PayDirection = eodPosi.PosiDirection, + PositionType = eodPosi.PositionType, + PositionQty = eodPosi.PosiQuantity, + Quantity = 0, + ContractSize = eodPosi.ContractSize, + TradingAmountAvg = eodPosi.PosiNetPrice, + PosiGrossPrice = eodPosi.PosiGrossPrice, + PosiNetPrice = eodPosi.PosiNetPrice, + MarkClosePnl = eodPosi.PosiDividendSum, + DividendIn = eodPosi.PosiDividendSum, + CloseFee = 0, + TradingFee = 0, + TradingFeePending = 0, + ClientId = td.ClientId, + DataState = (int)SwapFlowDateStateEnum.完成, + }; + dividendEvents.Add(dividendEvent); + dividendTotal += eodPosi.PosiDividendSum; - SaveAutoSwapDeal(td, autoInterests, unwindData, interval); + // 将EOD持仓的待实现分红转为已实现 + eodPosi.TdCloseDividend += eodPosi.PosiDividendSum; + eodPosi.TdPosiDividend = 0; + eodPosi.RealizedDividend += eodPosi.PosiDividendSum; + eodPosi.PosiDividendSum = 0; + } + } + + // 分红收支加入总实现盈亏 + unwindData.SwapDividendPnl = dividendTotal; + + // 总实现盈亏 + unwindData.SwapRealizedPnL = unwindData.SwapCloseAmount + unwindData.SwapMarginRebatePnl + dividendTotal; + + SaveAutoSwapDeal(td, autoInterests, unwindData, interval, dividendEvents); } /// /// 保存自动互换数据信息 @@ -427,7 +487,7 @@ namespace YLErp.Modules.SwapModule /// /// /// 自动互换观察日信息,用于获取结算日期 - private long SaveAutoSwapDeal(trade td, List flowEvents, UnwindData unwindData, IntervalModel interval) + private long SaveAutoSwapDeal(trade td, List flowEvents, UnwindData unwindData, IntervalModel interval, List dividendEvents = null) { //td.UnWindDate = unwindData.ValueDate; //优先使用 interval.SettlementDate 作为资金记录发生日期,如果没有则使用 ValueDate @@ -446,6 +506,15 @@ namespace YLErp.Modules.SwapModule AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapMarginRebatePnl), ClientCashInCashOut.系统操作_预付金返息, unwindData.ValueDate); } + // 分红:使用派息支付日偏移记录资金记录 + if (unwindData.SwapDividendPnl != 0) + { + var dividendPayDate = (dividendEvents != null && dividendEvents.Count > 0) + ? dividendEvents.First().PayDate.Value + : unwindData.ValueDate; + AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapDividendPnl), ClientCashInCashOut.系统操作_互换, dividendPayDate); + } + string data = JsonConvert.SerializeObject(unwindData); var swapEvent = new SwapEventService(this).AddSwapEventDate(unwindData.ValueDate, unwindData.SwapTradeId, (int)SwapEventTypeEnum.自动互换, data, clientCashId, true, "系统操作-自动互换");//将互换总额存入事件 flowEvents.ForEach(x => @@ -453,6 +522,15 @@ namespace YLErp.Modules.SwapModule x.EventId = swapEvent.id; DbContext.swap_flow_event.Add(x); }); + // 保存分红事件 + if (dividendEvents != null) + { + dividendEvents.ForEach(x => + { + x.EventId = swapEvent.id; + DbContext.swap_flow_event.Add(x); + }); + } UpdateInitalPostion(flowEvents, td.id); return swapEvent.id; } @@ -979,7 +1057,7 @@ namespace YLErp.Modules.SwapModule newEodPayPosition.TdInterestFee = flowEvents.Sum(s => s.InterestFee); newEodPayPosition.TdCloseInterestFee = newEodPayPosition.TdInterestFee; newEodPayPosition.TdCloseInterest = flowEvents.Sum(s => s.InterestClosePnL); - var intersetAcmount = newEodPayPosition.TdInterestPrincipal*(newEodPayPosition.TdInterestRate + newEodPayPosition.FloatRate); + var intersetAcmount = newEodPayPosition.TdInterestPrincipal * (newEodPayPosition.TdInterestRate + newEodPayPosition.FloatRate); if (position.IsAnnualized) { intersetAcmount /= tradeExtend.AnnualDays; @@ -1368,7 +1446,9 @@ namespace YLErp.Modules.SwapModule curretEod.UnderlyingMarketValue = curretEod.UnderlyingPrice * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio; curretEod.PosiMtmPnL = (curretEod.UnderlyingPrice - curretEod.PosiGrossPrice) * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio * directionRatio; curretEod.TdPosiDividend = 0; - if (valueDate > td.StartDate.Value && (curretEod.PosiQuantity > 0)) + // 有互换事件时,分红已全量结算,不再查分红,TdPosiDividend和PosiDividendSum都归0 + var hasSwapEvent = unwindEvents.Any(e => e.EventType == (int)SwapFlowEventTypeEnum.互换 || e.EventType == (int)SwapFlowEventTypeEnum.自动互换); + if (!hasSwapEvent && valueDate > td.StartDate.Value && (curretEod.PosiQuantity > 0)) { decimal tax = um.ValueAddedTax ?? 0; BondPaymentService bondPaymentService = new BondPaymentService(UserInfo); @@ -1382,12 +1462,26 @@ namespace YLErp.Modules.SwapModule curretEod.RealizedPnl = eod.RealizedPnl + curretEod.TdCloseMtmPnl; curretEod.PosiStatus = curretEod.PosiQuantity == 0 ? 1 : 0; var closeQty = unwindEvents.Where(x => x.EventType == (int)SwapFlowEventTypeEnum.平仓).ToList().Sum(s => s.Quantity); - // 当日浮动端平仓盈亏·分红 = 平仓数量/昨天剩余平仓数量 * 昨日浮动端待实现收益·分红 + // 当日浮动端平仓盈亏·分红 curretEod.TdCloseDividend = unwindEvents.Sum(e => e.DividendIn); curretEod.RealizedDividend = curretEod.RealizedDividend + curretEod.TdCloseDividend; - // 浮动端待实现收益·分红 = 昨日 + 当日浮动端分红 - 当日浮动端平仓盈亏·分红 - curretEod.PosiDividendSum = eod.PosiDividendSum + curretEod.TdPosiDividend - curretEod.TdCloseDividend; + // 浮动端待实现收益·分红(有互换事件时全量结算归0;否则用当前持仓从起始日重算) + if (hasSwapEvent) + { + curretEod.PosiDividendSum = 0; + } + else if (curretEod.PosiQuantity > 0) + { + decimal tax = um.ValueAddedTax ?? 0; + BondPaymentService bondPaymentService = new BondPaymentService(UserInfo); + decimal totalPayment = bondPaymentService.CalcPayment(curretEod.UnderlyingCode, td.StartDate.Value, valueDate, curretEod.PosiQuantity, shortRatio, directionRatio); + curretEod.PosiDividendSum = totalPayment / (1 + tax) * (1 - tax); + } + else + { + curretEod.PosiDividendSum = 0; + } curretEod.PosiProfitSum = curretEod.PosiMtmPnL + curretEod.PosiDividendSum + curretEod.PosiFeePending; if (curretEod.PosiStatus == 1) { @@ -1464,7 +1558,7 @@ namespace YLErp.Modules.SwapModule } curretEod.PosiNotionalValue = curretEod.PosiGrossPrice * curretEod.PosiQuantity * curretEod.ContractSize; curretEod.PosiNotionalValue = Math.Round(curretEod.PosiNotionalValue, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero); - curretEod.TdPosiDividend = unwindEvents.Sum(x => x.DividendIn) * directionRatio; + curretEod.TdCloseDividend = unwindEvents.Sum(x => x.DividendIn); curretEod.TdCloseFee = unwindFlowEvents.Sum(x => x.TradingFee + x.TradingFeePending); curretEod.TdCloseQty = unwindQty; curretEod.TdCloseMtmPnl = unwindEvents.Sum(x => x.MarkClosePnl); @@ -1526,7 +1620,21 @@ namespace YLErp.Modules.SwapModule // //curretEod.TdCloseMtmPnl = 0; // //curretEod.TdCloseFee = 0; //} - curretEod.TdCloseDividend = curretEod.TdPosiDividend; + // TdCloseDividend 已由 SetPriceInfoByFlowEvent 设置 + + // 当日新增分红及待实现分红(有互换全量归0,开仓首日两者相同) + curretEod.TdPosiDividend = 0; + var hasSwapEvent = unwindEvents.Any(e => e.EventType == (int)SwapFlowEventTypeEnum.互换 || e.EventType == (int)SwapFlowEventTypeEnum.自动互换); + if (!hasSwapEvent && settleDate > td.StartDate.Value && curretEod.PosiQuantity > 0) + { + decimal tax = um.ValueAddedTax ?? 0; + BondPaymentService bondPaymentService = new BondPaymentService(UserInfo); + decimal payment = bondPaymentService.CalcPayment(curretEod.UnderlyingCode, td.StartDate.Value, settleDate, curretEod.PosiQuantity, shortRatio, directionRatio); + payment = payment / (1 + tax) * (1 - tax); + curretEod.TdPosiDividend = payment; + curretEod.PosiDividendSum = payment; + } + curretEod.UnderlyingMarketValue = curretEod.UnderlyingPrice * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio; curretEod.PosiMtmPnL = (curretEod.UnderlyingPrice - curretEod.PosiGrossPrice) * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio * directionRatio; curretEod.PosiProfitSum = curretEod.PosiMtmPnL + curretEod.PosiDividendSum + curretEod.PosiFeePending; diff --git a/YLErpWeb/Controllers/BondPaymentController.cs b/YLErpWeb/Controllers/BondPaymentController.cs index d0b08dbe..11d0817d 100644 --- a/YLErpWeb/Controllers/BondPaymentController.cs +++ b/YLErpWeb/Controllers/BondPaymentController.cs @@ -78,17 +78,39 @@ namespace YLErp.Web.Controllers return JsonSuccess("删除成功"); } /// - /// 获取某债券期间付息 + /// 获取某债券期间付息,扣除当天已消费部分 /// /// /// /// + /// 交易ID(可选,用于扣除已消费分红) + /// 结算日期(可选) /// - public JsonResult GetBondPayMentInterest(DateTime startDate, DateTime endDate, string underlyingCode) + public JsonResult GetBondPayMentInterest(DateTime startDate, DateTime endDate, string underlyingCode, int? tradeId = null, DateTime? unwindDate = null) { var payments = new BondPaymentService(CurUser).GetBondPayments(underlyingCode, startDate, endDate); - decimal interest = payments.Sum(s => s.payment_interest ?? 0) * 0.01m; - return JsonSuccess("", interest); + decimal totalInterest = payments.Sum(s => s.payment_interest ?? 0) * 0.01m; + + // 考虑增值税,与 EOD UpdateEodPosition 口径一致 + var um = yldb.underlying_manager.FirstOrDefault(x => x.UnderlyingCode == underlyingCode); + if (um != null) + { + decimal tax = um.ValueAddedTax ?? 0; + totalInterest = totalInterest / (1 + tax) * (1 - tax); + } + + decimal consumedDividend = 0; + if (tradeId.HasValue) + { + List swapEventTypes = new List() { (int)SwapEventTypeEnum.互换, (int)SwapEventTypeEnum.自动互换 }; + consumedDividend = yldb.swap_flow_event + .Where(x => x.SwapTradeId == tradeId.Value + && swapEventTypes.Contains(x.EventType) + && x.DataState == (int)SwapFlowDateStateEnum.完成) + .Sum(s => s.DividendIn); + } + + return JsonSuccess("", new { totalInterest, consumedDividend }); } } } diff --git a/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml b/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml index 14e12e6b..6142bde6 100644 --- a/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml +++ b/YLErpWeb/Views/SwapTrade2/SwapIncome.cshtml @@ -48,10 +48,16 @@ + 支付日期 + 年化天数 {{deal.AnnualDays}} + + 平仓总额 {{deal.SwapCloseAmount}} + + @@ -146,11 +152,7 @@ {{priceFormat(floatPosition.PosiGrossPrice)}} {{priceFormat(floatPosition.TradingAmountNetAvg)}} - - - - - + {{floatPosition.TradingAmountAvg}} {{floatPosition.Quantity}} diff --git a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml index 4133bbc4..7ad772a2 100644 --- a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml +++ b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml @@ -236,6 +236,15 @@ +
+ + +
diff --git a/YLErpWeb/Views/SwapTrade2/TradeView.cshtml b/YLErpWeb/Views/SwapTrade2/TradeView.cshtml index 093dd18f..c1d42011 100644 --- a/YLErpWeb/Views/SwapTrade2/TradeView.cshtml +++ b/YLErpWeb/Views/SwapTrade2/TradeView.cshtml @@ -228,6 +228,10 @@ 结算规则 @(trade.trade_extend.ExtendObj.SettlementRules == 0 ? "T+0" : "T+1") + + 派息金额支付日 + @(trade.trade_extend.ExtendObj.DividendPayDate == 0 ? "到期结算日" : "派息日+" + (trade.trade_extend.ExtendObj.DividendPayDate - 1)) +
@@ -840,6 +844,12 @@ 互换日期 @(tc.ValueDate.OtcFormatDate()) + + 支付日期 + @(tc.PayDate?.OtcFormatDate() ?? tc.ValueDate.OtcFormatDate()) + + + 平仓总额 @(tc.SwapCloseAmount.OtcFormat(OtcFormatFlag.StockEqvNotional)) diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js index 9846f8f8..358338b5 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/incomeSwapTrade.js @@ -40,12 +40,15 @@ const vue = new Vue({ }); this.floatPosition = positions[0]; this.initPosiNetPrice = this.floatPosition.PosiNetPrice; + // 互换标的价格固定为期初净价,与平仓不同不需要用户填写 + this.floatPosition.TradingAmountAvg = this.initPosiNetPrice * 100; this.interestList = model.FlowEvents.filter((item) => { return item.InterestMode == 1 || item.InterestMode == 2 || item.InterestMode == 7 || item.InterestMode == 8 || item.InterestMode == 9; }); this.marginList = model.FlowEvents.filter((item) => { return item.InterestMode == 5 || item.InterestMode == 6; }); + this.TradeStartDate = model.TradeStartDate; }, IsBond(instType) { return tradeHelper.IsBond(instType); @@ -96,19 +99,6 @@ const vue = new Vue({ this.dataFormat(); } }, - changeUnderlyingPrice() {//修改标的价格 - this.calcFloatClosePnl(); - }, - refreshUnderlyingPrice() {//刷新标的价格 - var thisObj = this; - main.post("/underlying_manager/GetUnderlyingPriceByCode", - { code: thisObj.floatPosition.UnderlyingCode, ValueDate: thisObj.deal.ValueDate }) - .done(function (res) { - res.obj = res.obj * 100; - thisObj.floatPosition.TradingAmountAvg = otcformat.trading.umprice(res.obj); - thisObj.calcFloatClosePnl(); - }); - }, changeTradingFee() {//修改交易费用 this.calcFloatClosePnl(); }, @@ -178,6 +168,22 @@ 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.TradeStartDate, endDate: thisObj.deal.UnwindDate, underlyingCode: thisObj.floatPosition.UnderlyingCode, tradeId: thisObj.deal.SwapTradeId, unwindDate: thisObj.deal.UnwindDate } + main.post("/BondPayment/GetBondPayMentInterest", postData, { async: false }).done(function (resp) { + let totalDividend = parseFloat(thisObj.deal.PositionQty) * resp.obj.totalInterest * ratio * floatRatio; + let consumedDividend = parseFloat(resp.obj.consumedDividend ?? 0); + // 互换是全量消费,consumedDividend>0 表示分红已被当天互换消费,归0 + thisObj.floatPosition.DividendIn = Math.abs(consumedDividend) > 0 ? 0 : totalDividend; + thisObj.floatPosition.DividendPending = 0; + thisObj.calcFloatClosePnl(); + thisObj.dataFormat(); }); }, incomeTrade() {//互换 diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js index 87c0cbce..ed73c2b1 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeView.js @@ -197,7 +197,7 @@ function unWindSwap(id) { main.open(title, srcurl, { - area: ["90%", "780px"], + area: ["90%", "800px"], end: function () { if (window.parent && window.parent.reloadtrade) { window.parent.reloadtrade(); diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js index eb16694c..c880359d 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/unwindSwapTrade.js @@ -275,11 +275,14 @@ const vue = new Vue({ var thisObj = this; let ratio = this.floatPosition.PositionType == 1 ? 1 : -1; let floatRatio = this.floatPosition.PayDirection == 1 ? 1 : -1; - var postData = { startDate: thisObj.TradeStartDate, endDate: thisObj.deal.UnwindDate, underlyingCode: thisObj.floatPosition.UnderlyingCode } + var postData = { startDate: thisObj.TradeStartDate, endDate: thisObj.deal.UnwindDate, underlyingCode: thisObj.floatPosition.UnderlyingCode, tradeId: thisObj.deal.SwapTradeId, unwindDate: thisObj.deal.UnwindDate } main.post("/BondPayment/GetBondPayMentInterest", postData, { async: false }).done(function (resp) { - thisObj.floatPosition.DividendIn = parseFloat(thisObj.deal.CloseQty) * resp.obj * ratio * floatRatio; + let totalDividend = parseFloat(thisObj.deal.CloseQty) * resp.obj.totalInterest * ratio * floatRatio; + let consumedDividend = parseFloat(resp.obj.consumedDividend ?? 0); + // 互换是全量消费,consumedDividend>0 表示分红已被当天互换消费,归0 + thisObj.floatPosition.DividendIn = Math.abs(consumedDividend) > 0 ? 0 : totalDividend; var posiQty = parseFloat(thisObj.floatPosition.Quantity) - parseFloat(thisObj.deal.CloseQty); - thisObj.floatPosition.DividendPending = posiQty * resp.obj * ratio * floatRatio; + thisObj.floatPosition.DividendPending = posiQty * resp.obj.totalInterest * ratio * floatRatio; thisObj.calcFloatClosePnl(); thisObj.dataFormat(); }); diff --git a/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js b/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js index 51dd8d14..ecbd7a7d 100644 --- a/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js +++ b/YLErpWeb/wwwroot/Scripts/app/trade/tradeApproval.js @@ -747,7 +747,7 @@ function passorreinfo(eid, tradeType, status, isGroup, StructureType) { if (StructureType == "多空组合") { url = "/swaptrade2/SwapLongShortSwap/?enid=" + eid + "&isUseApproval=" + true; } - height = "720px"; + height = "800px"; } else if (status === "行权待复核") { title = "行权审批";