diff --git a/Framework/YLErp.Core/DBModels/SwapFlowEvent.cs b/Framework/YLErp.Core/DBModels/SwapFlowEvent.cs index 36714c93..de644ae3 100644 --- a/Framework/YLErp.Core/DBModels/SwapFlowEvent.cs +++ b/Framework/YLErp.Core/DBModels/SwapFlowEvent.cs @@ -268,6 +268,10 @@ namespace YLErp.DBModels { get { + if (InterestMode==0) + { + return string.Empty; + } return ((InterestModeEnum)InterestMode).ToString(); } } diff --git a/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs b/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs index 5878b5c3..a17503a1 100644 --- a/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs +++ b/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs @@ -35,6 +35,8 @@ namespace YLErp.Models public string PosiPnl { get; set; } + public string MarkClosePnl { get; set; } + public string NetSettleAmout { get; set; } public string MarginInterestAmount { get; set; } } diff --git a/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx b/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx index 33ff999d..1f66aab5 100644 Binary files a/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx and b/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx differ diff --git a/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs b/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs index 452169f2..3daaa585 100644 --- a/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs +++ b/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs @@ -96,12 +96,12 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator //var lastMarginAmount = swapEodPositions.Where(x => ConsTrade.InterestMarginModels.Contains(x.InterestMode)).Sum(s => s.InterestIncomeSum); //var MarginInterestAmount = lastMarginAmount == 0 ? 0 : -lastMarginAmount * PosiNotionalValue / lastMarginAmount; //row.MarginInterestAmount = MarginInterestAmount.ToString("0.00"); - - var r = posi.PosiNetPrice == 0 ? 0 : PosiNotionalValue * posi.PosiNetPrice; - var FloatRate = r == 0 ? 0 : InterestAmount / r; + var FloatRate = PosiNotionalValue == 0 ? 0 : InterestAmount / PosiNotionalValue; row.FloatRate = FloatRate.ToString("0.0000%"); - var PosiPnl = (-flowEventGroup.MarkClosePnl); + var PosiPnl = -(flowEventGroup.MarkClosePnl- tradingFee); row.PosiPnl = PosiPnl.ToString("0.00"); + var markClosePnl = (-flowEventGroup.MarkClosePnl); + row.MarkClosePnl = markClosePnl.ToString("0.00"); var marginBackAmount = unwindFlowEvents.Where(x => ConsTrade.InterestMarginModels.Contains(x.InterestMode)).Sum(s => s.InterestPrincipal); var NetSettleAmout = unwindFlowEvents.Sum(x => x.InterestClosePnL) * -1 + flowEventGroup.MarkClosePnl * -1 + marginBackAmount; row.NetSettleAmout = NetSettleAmout.ToString("0.00"); diff --git a/YLErpDAL/Model/ClientSwapPositionRequest.cs b/YLErpDAL/Model/ClientSwapPositionRequest.cs index a494ae58..34e8de76 100644 --- a/YLErpDAL/Model/ClientSwapPositionRequest.cs +++ b/YLErpDAL/Model/ClientSwapPositionRequest.cs @@ -34,5 +34,7 @@ namespace YLErp.Model public string ClientNumber { get; set; } public string ClientName { get; set; } public string StructureType { get; set; } + + public string ContractCode { get; set; } } } diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index 54e23c14..99a5755b 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -1892,7 +1892,10 @@ namespace YLErp.Modules.SwapModule //item.position.PosiProfitSum += item.position.VTradingFee-item.position.PosiFeePending; SetClientEodPosition(item.position); //item.position.PosiProfitSum += item.TradingFee; - item.NetSettmentAmount = item.position.PosiProfitSum; + var posiProfitSum= item.position.PosiProfitSum; + //item.position.PosiProfitSum 不需要加交易费用 + item.position.PosiProfitSum = item.position.PosiProfitSum - item.position.VTradingFee; + item.NetSettmentAmount = posiProfitSum; var margins = positions.Where(x => x.SwapTradeId == item.position.SwapTradeId); var interests = eodPositions.Where(x => x.SwapTradeId == item.position.SwapTradeId && x.ValueDate == item.position.ValueDate); var eodMargins = interests.Where(x => marginTypes.Contains(x.InterestMode)); @@ -1901,29 +1904,12 @@ namespace YLErp.Modules.SwapModule item.OpenMarginRate = margins.Sum(s => s.InterestRateDefault * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); item.MarginInterestAmount = eodMargins.Sum(s => s.InterestIncomeSum * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); item.InterestAmount = eodInterests.Sum(s => s.InterestIncomeSum * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? -1 : 1)); - if (item.StructureType != "普通债券类收益互换") - { - var floatRateInterest = eodInterests.FirstOrDefault(x => !string.IsNullOrEmpty(x.FloatRateUnderlyingCode)); - item.NetSettmentAmount += item.InterestAmount; - if (floatRateInterest != null) - { - item.InterestRate = floatRateInterest.InterestRateDefault; - item.FloatRateUnderlyingCode = floatRateInterest.FloatRateUnderlyingCode; - } - else - { - item.InterestRate = eodInterests.FirstOrDefault()?.InterestRateDefault ?? 0; - } - } - else - { - item.InterestRate = eodInterests.Sum(s => s.InterestRateDefault); - item.NetSettmentAmount += item.InterestAmount + item.MarginInterestAmount + eodMargins.Sum(s => s.InterestPrincipalFix * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); - } + item.InterestRate = eodInterests.Sum(s => s.InterestRateDefault); + item.NetSettmentAmount += item.InterestAmount + item.MarginInterestAmount + eodMargins.Sum(s => s.InterestPrincipalFix * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); item.NetSettmentAmount = decimal.Parse(item.NetSettmentAmount.ToString("0.00")); if (item.position.PosiNotionalValue != 0 && item.position.PosiNetPrice != 0) { - item.FloatRateAbs = item.position.PosiNotionalValue == 0 ? 0 : item.InterestAmount / (item.position.PosiNotionalValue * item.position.PosiNetPrice); + item.FloatRateAbs = item.position.PosiNotionalValue == 0 ? 0 : item.InterestAmount / item.position.PosiNotionalValue; } SetPosiPrice(item.position); } diff --git a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs index eadb5019..a57f8e0d 100644 --- a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs @@ -475,13 +475,16 @@ namespace YLErp.Modules.SwapModule var tradeQuery = DbContext.trade.Where(tradePredicate); var query = from flow in positionQuery join td in tradeQuery on flow.SwapTradeId equals td.id + join tr in DbContext.trade_contract_r on td.id equals tr.TradeId into tradeContractGroup + from tradeContract in tradeContractGroup.DefaultIfEmpty() select new ClientSwapPositionResponse { FlowEvent = flow, SwapTradeNo = td.TradeNumber, StructureType = td.StructureType, ClientName = td.ClientName, - ClientId = td.ClientId + ClientId = td.ClientId, + ContractCode = tradeContract.ContractCode, }; if (string.IsNullOrEmpty(req.sidx)) { diff --git a/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx b/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx index 7187adee..2ded3ffc 100644 Binary files a/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx and b/YLErpWeb/App_Docs/导出模板/结算报告模板.xlsx differ diff --git a/YLErpWeb/Views/clientbalance/TradeMarketReport_BalanceStatement.cshtml b/YLErpWeb/Views/clientbalance/TradeMarketReport_BalanceStatement.cshtml index 34c6a2a7..765f27b8 100644 --- a/YLErpWeb/Views/clientbalance/TradeMarketReport_BalanceStatement.cshtml +++ b/YLErpWeb/Views/clientbalance/TradeMarketReport_BalanceStatement.cshtml @@ -206,22 +206,6 @@ sortable: false, align: 'right', formatter: moneyTradeFormat - }, { - name: 'MoneySwap', - label: '互换', - index: 'MoneySwap', - width: 150, - sortable: false, - align: 'right', - formatter: moneyTradeFormat - }, { - name: 'MoneySwapMargin', - label: '预付金', - index: 'MoneySwapMargin', - width: 150, - sortable: false, - align: 'right', - formatter: moneyTradeFormat }, { name: 'MoneyOther', label: '其他', @@ -271,10 +255,8 @@ var moneyPriceSum = arguments[0].Sum == null ? "" : arguments[0].Sum.MoneyPriceSum; var moneyUnwindExerSum = arguments[0].Sum == null ? "" : arguments[0].Sum.MoneyUnwindExerSum; var moneyCouponSum = arguments[0].Sum == null ? "" : arguments[0].Sum.MoneyCouponSum; - var moneySwapSum = arguments[0].Sum == null ? "" : arguments[0].Sum.MoneySwapSum; var moneyOtherSum = arguments[0].Sum == null ? "" : arguments[0].Sum.MoneyOtherSum; - var moneySwapMarginSum = arguments[0].Sum == null ? "" : arguments[0].Sum.MoneySwapMarginSum; - jgrid.footerData("set", { HappenDate: "合计:", Direction: main.toNumberExcludingNaN(moneySum), MoneyInOut: moneyInOutSum, MoneyPrice: moneyPriceSum, MoneyUnwindExer: moneyUnwindExerSum, MoneyCoupon: moneyCouponSum, MoneySwap: moneySwapSum, MoneyOther: moneyOtherSum, MoneySwapMargin: moneySwapMarginSum }); + jgrid.footerData("set", { HappenDate: "合计:", Direction: main.toNumberExcludingNaN(moneySum), MoneyInOut: moneyInOutSum, MoneyPrice: moneyPriceSum, MoneyUnwindExer: moneyUnwindExerSum, MoneyCoupon: moneyCouponSum, MoneyOther: moneyOtherSum }); } else { $(".ui-jqgrid-sdiv").hide(); } diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_EodPosition.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_EodPosition.js index 87557703..2abb9762 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_EodPosition.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_EodPosition.js @@ -274,7 +274,7 @@ var colModelGrid = [ sortable: false, }, { name: 'position.PosiProfitSum', - label: '总收益金额', + label: '浮动收益金额', index: 'position.PosiProfitSum', width: 120, align: 'center', diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_HistoricalPositionSwapFlow.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_HistoricalPositionSwapFlow.js index 62d5c117..2917a342 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_HistoricalPositionSwapFlow.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/TradeMarketReport_HistoricalPositionSwapFlow.js @@ -48,8 +48,8 @@ $(function () { colModel: colModelGrid, pager: jQuery('#pagerGrid'), pagerpos: 'left', - rowNum: 100, - rowList: [100, 1000], + rowNum: 20, + rowList: [20,50,100, 1000], footerrow: true, loadComplete: gridComplete, grouping: true @@ -161,9 +161,15 @@ var colModelGrid = [ formatter:'date' }, { name: 'SwapTradeNo', - label: '互换交易编号', + label: '交易编号', index: 'SwapTradeNo', - width: 150, + width: 250, + align: 'center' + }, { + name: 'ContractCode', + label: '确认书编号', + index: 'ContractCode', + width: 250, align: 'center' }, { name: 'FlowEvent.SwapPositionIdPadding', @@ -296,12 +302,11 @@ var colModelGrid = [ align: 'center', formatter: DrictionFormat }, { - name: 'FlowEvent.InterestMode', + name: 'FlowEvent.InterestModeStr', label: '计息基准类型', - index: 'FlowEvent.InterestMode', + index: 'FlowEvent.InterestModeStr', width: 90, align: 'center', - formatter: InterestModeFormat }, { name: 'FlowEvent.InterestPrincipal', label: '计息基准固定值', @@ -315,7 +320,7 @@ var colModelGrid = [ index: 'FlowEvent.InterestRate', width: 140, align: 'center', - formatter: PercentFormat + formatter:PercentFormat }, { name: 'FlowEvent.InterestAmount', label: '利息端平仓盈亏·利息', @@ -477,14 +482,23 @@ function InterestModeFormat(cellValue, options, rowObject) { if (cellValue == 1) { return "固定值"; } - if (cellValue == 2) { + else if (cellValue == 2) { return "合约名义本金规模"; - } if (cellValue == 3) { + } else if (cellValue == 3) { return "持仓名义本金"; } - if (cellValue == 4) { + else if (cellValue == 4) { return "持仓市值"; } + else if (cellValue == 9) { + return "标的期初全价"; + } + else if (cellValue == 5) { + return "初始预付金"; + } + else if (cellValue == 6) { + return "追加预付金"; + } return ""; } function PercentFormat(cellValue, options, rowObject) {