TRS-ZS-450 每日估值单中各tab字段逻辑调整汇总

This commit is contained in:
吴方海
2025-05-28 10:29:09 +08:00
parent 84ea6b09fc
commit 4e4cb17dab
11 changed files with 50 additions and 57 deletions
@@ -268,6 +268,10 @@ namespace YLErp.DBModels
{
get
{
if (InterestMode==0)
{
return string.Empty;
}
return ((InterestModeEnum)InterestMode).ToString();
}
}
@@ -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; }
}
@@ -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");
@@ -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; }
}
}
@@ -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);
}
@@ -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))
{
@@ -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();
}
@@ -274,7 +274,7 @@ var colModelGrid = [
sortable: false,
}, {
name: 'position.PosiProfitSum',
label: '收益金额',
label: '浮动收益金额',
index: 'position.PosiProfitSum',
width: 120,
align: 'center',
@@ -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) {