diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 3fd21bf8..fe89dd14 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -413,20 +413,32 @@ namespace YLErp.Modules.SwapModule interests.Add(CalcUnwindInterest(td, valueDate, endDate, positionClone, rate, floatRate, posiPrincipal, closePrincipal, newClosePercent, annualDays, preEodPosition, eventType, add, swap, orginPv, calcFirst, calcLast||newCalcLast)); } } - //当日有平仓或互换记录时,需要把平仓或互换已经结算的利息从计算结果中扣除,避免重复计算 - //互换始终需要扣除;平仓仅不算尾时需要(算尾时利息已包含关闭日,无重叠) - if (closeList != null && closeList.Count > 0 - && (eventType == (int)SwapEventTypeEnum.自动互换 || (!calcLast && !newCalcLast))) + //当日有平仓或互换记录时,避免重复结算 + if (closeList != null && closeList.Count > 0) { foreach (var item in interests) { var closeEvent = closeList.Where(x => x.PositionId == item.PositionId); - var closePnl = closeEvent.Sum(s => s.InterestClosePnL); - var closeAmount = closeEvent.Sum(s => s.InterestAmount); - var closeTdAmount = closeEvent.Sum(s => s.TdInterestAmount); - item.InterestAmount = item.InterestAmount - closeAmount; - item.TdInterestAmount = item.TdInterestAmount - closeTdAmount; - item.InterestClosePnL = item.InterestClosePnL - closePnl; + if (eventType == (int)SwapEventTypeEnum.互换 || eventType == (int)SwapEventTypeEnum.自动互换) + { + // 互换:该仓位当天已有完成事件,直接归0 + if (closeEvent.Any()) + { + item.InterestAmount = 0; + item.TdInterestAmount = 0; + item.InterestClosePnL = 0; + } + } + else if (!calcLast && !newCalcLast) + { + // 平仓不算尾:扣除已结算的利息(算尾时利息已包含关闭日,无重叠) + var closePnl = closeEvent.Sum(s => s.InterestClosePnL); + var closeAmount = closeEvent.Sum(s => s.InterestAmount); + var closeTdAmount = closeEvent.Sum(s => s.TdInterestAmount); + item.InterestAmount = item.InterestAmount - closeAmount; + item.TdInterestAmount = item.TdInterestAmount - closeTdAmount; + item.InterestClosePnL = item.InterestClosePnL - closePnl; + } } } return interests; diff --git a/YLErpWeb/Views/clientbalance/TradeMarketDescSet.cshtml b/YLErpWeb/Views/clientbalance/TradeMarketDescSet.cshtml index 48f33151..9bda37b7 100644 --- a/YLErpWeb/Views/clientbalance/TradeMarketDescSet.cshtml +++ b/YLErpWeb/Views/clientbalance/TradeMarketDescSet.cshtml @@ -100,17 +100,17 @@
@Html.MyAceDropdownInput2("setTemplate", "模板名:  ", YLErp.Web.Controllers.clientbalanceController.GetAllClientBalanceTemplate(), false, "", true, new { onchange = "changeTemplate()" })
-

发件人:

- + @*

发件人:

*@ + @* *@ @if (!PS.Config.Is申万) {