bug 修复

This commit is contained in:
吴方海
2025-04-21 15:15:08 +08:00
parent 94ab27d5e6
commit 1a0b25fe04
12 changed files with 27 additions and 66 deletions
@@ -135,7 +135,16 @@ namespace YLErp.Modules.CalcModules
Assert.AreEqual(date20190708, QdpCalendarHelper.GetNonHolidayDefore(date20190708));
#endregion
}
[TestMethod]
public void CalendarBLLGetNonHolidayDeforeTest()
{
var date20250421 = new DateTime(2025, 04, 21);
var date20250418 = new DateTime(2025, 04, 18);
var cudate = QdpCalendarHelper.GetNonHolidayDefore(date20250421.AddDays(0));
var preDate = QdpCalendarHelper.GetNonHolidayDefore(date20250421.AddDays(-1));
Assert.AreEqual(date20250421, cudate);
Assert.AreEqual(date20250418, preDate);
}
[TestMethod]
public void GetObservationDateStringTest()
{
@@ -582,14 +582,7 @@ namespace YLErp.BLL.EodSettlement
DicTotal.TotalMarginTotal = DicTotal.TotalMargin;
DicTotal.RoundedTotalAmountTotal = DicTotal.RoundedTotalAmount;
DicTotal.TotalAmountTotal = DicTotal.TotalAmount;
if (PS.Config.Is湘财)
{
DicTotal.MarginByPayableMarginTotal = Math.Max(-DicTotal.AvailableAmount, 0);
}
else
{
DicTotal.MarginByPayableMarginTotal = DicTotal.MarginByPayableMargin;
}
DicTotal.MarginByPayableMarginTotal = DicTotal.MarginByPayableMarginTotal;
//if (PS.Config.Is广期资本)
//{
// DicTotal.MarginByPayableMarginTotal = Math.Max(-DicTotal.AvailableAmount, 0);
@@ -637,18 +630,7 @@ namespace YLErp.BLL.EodSettlement
DicTotal.RoundedTotalAmountTotal += dc.Value.RoundedTotalAmount;
DicTotal.TotalAmountTotal += dc.Value.TotalAmount;
if (PS.Config.Is湘财)
{
DicTotal.MarginByPayableMarginTotal += Math.Max(-dc.Value.AvailableAmount, 0);
}
else
{
DicTotal.MarginByPayableMarginTotal += dc.Value.MarginByPayableMargin;
}
//if (PS.Config.Is广期资本)
//{
// DicTotal.MarginByPayableMarginTotal = Math.Max(-DicTotal.AvailableAmount, 0);
//}
DicTotal.MarginByPayableMarginTotal += dc.Value.MarginByPayableMarginTotal;
DicTotal.ClosedTradePayableFundTotal += dc.Value.ClosedTradePayableFund;
DicTotal.PositionTradePayableFundTotal += dc.Value.PositionTradePayableFund;
@@ -280,7 +280,7 @@ namespace YLErp.BLL.Eod
// 追保金额=初始保证金金额-盯市金额
item.MarginByPayableMarginTotal = item.NeedAddMargin ? (item.MySideMargin - item.SwapMarketAmount) : 0;
// 可取资金=max(期末结存+min(持仓盈亏,0)-初始保证金,0)
item.DesirableFund =Math.Max( item.MarginBalance + Math.Min(item.RoundedPositionPnl, 0),0);
item.DesirableFund =Math.Max( item.MarginBalance - item.FrozenMarginMoney + Math.Min(item.RoundedPositionPnl, 0),0);
}
return _clientBalanceDic.Values;
@@ -1314,8 +1314,8 @@ namespace YLErp.BLL.Eod
balance.UpdateDate = balance.UpdateDate > lastEodSwap.OptTime ? balance.UpdateDate : lastEodSwap.OptTime;
}
balance.WinLoss += Convert.ToDouble(tdRealizedPnL) * -1;
balance.PositionPnl += Convert.ToDouble(pnl);
balance.RoundedPositionPnl += Math.Round(Convert.ToDouble(pnl), 2);
balance.PositionPnl += Convert.ToDouble(pnl) * -1;
balance.RoundedPositionPnl += Math.Round(Convert.ToDouble(pnl), 2) * -1;
//期权空头浮动盈利=∑max(期权空头持仓*(期权合约成本价-期权合约现价), 0) 从客户角度看的
balance.ClientSellPositionPnl += Convert.ToDouble(lastEodSwap.FloatingPnL) * -1;
}
@@ -317,7 +317,7 @@ namespace YLErp.Modules.ReportModule.SettlementReportModule
WinLoss = clientBalance?.WinLoss ?? 0,
ClosedTradeFundGap = clientBalance?.ClosedTradeFundGap ?? 0,
ClosedTradePayableFund = clientBalance?.ClosedTradePayableFundTotal ?? 0,
PositionTradePayableFund = clientBalance?.PositionTradePayableFundTotal ?? 0,
PositionTradePayableFund = clientBalance?.MarginByPayableMarginTotal ?? 0,
DesirableFund = clientBalance?.DesirableFundTotal ?? 0,
PayableFund = emailData.PayableFund >= 0 ? emailData.PayableFund : (clientBalance?.PayableFundTotal ?? 0),
PositionPv = PS.Config.IsPVRounded ? (clientBalance?.RoundedPositionPv ?? 0) : (clientBalance?.PositionPv ?? 0),
@@ -1350,8 +1350,11 @@ namespace YLErp.Modules.SwapModule
position.UnderlyingInstrumentType = swap.UnderlyingInstrumentType;
position.PosiDirection = swap.PosiDirection;
position.PosiGrossPrice = swap.PosiGrossPrice;
position.PosiNetPrice = swap.PosiQuantity == 0 ? 0 : (swap.PosiGrossPrice + (position.PosiTradingFee / swap.PosiQuantity) * ratio);
position.PosiNetPrice = swap.PosiQuantity == 0 ? 0 : (swap.PosiGrossPrice + (position.PosiTradingFeePending / swap.PosiQuantity) * ratio);
position.PosiNetPrice = Math.Round(position.PosiNetPrice, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
position.PosiNetNoFeePrice = swap.PosiNetNoFeePrice;
position.PosiNetFeePrice = swap.PosiQuantity == 0 ? 0 : (swap.PosiNetNoFeePrice + (position.PosiTradingFeePending / swap.PosiQuantity) * ratio);
position.PosiNetFeePrice = Math.Round(position.PosiNetFeePrice??0, ConsGlobal.PriceRound, MidpointRounding.AwayFromZero);
position.PosiNotionalValue = position.PosiGrossPrice * swap.PosiQuantity * swap.ContractSize;
position.PosiQuantity = swap.PosiQuantity;
position.InterestDirection = swap.InterestDirection;
+1 -1
View File
@@ -625,7 +625,7 @@ namespace YLErp.Web.Controllers
x.HoldingDepositB = -clientBalance.PayableMarginB;
x.SwapPayableMargin = -clientBalance.SwapPayableMargin;
x.AvailableAmount = clientBalance.AvailableAmount;
x.InsuredAmount = clientBalance.PositionTradePayableFundTotal;
x.InsuredAmount = clientBalance.MarginByPayableMarginTotal;
x.MarginMonitoringTime = clientBalance.UpdateDate ?? DateTime.Now;
x.FreezePremium = clientBalance.FreezePremium;
x.ReceivablesPremium = clientBalance.ReceivablesPremium;
@@ -130,7 +130,7 @@
<td>其他收支</td>
<td id="OtherFund"></td>
<td style="font-weight: bold;">追保金额</td>
<td id="PositionTradePayableFund"></td>
<td id="MarginByPayableMargin"></td>
<td></td>
<td></td>
</tr>
+3 -21
View File
@@ -675,28 +675,14 @@
</script>
}
<div class="tabbable">
@*<div class="tabbable">
<ul id="myTab" class="nav nav-tabs nav-main">
<li class="nav-item">
<a class="nav-link @(isCompanyCash?"":"active")" href="/entryexit/entryexitList">客户资金</a>
</li>
@if (PS.Config.ErpElement.IsShowCompanyCash)
{
<li class="nav-item">
<a class="nav-link @(isCompanyCash?"active":"")" href="/entryexit/entryexitList?isCompanyCash=1">公司资金</a>
</li>
}
<li class="nav-item">
<a class="nav-link" href="/clientcashincashout_product/clientcashincashout_productList">抵押品</a>
</li>
@if (PS.Config.ErpElement.IsShowOtherClientCash)
{
<li class="nav-item">
<a class="nav-link" href="/client_cash_other/client_cash_otherList">其他资金</a>
</li>
}
</ul>
</div>
</div>*@
<div class="searchdiv mt-0">
@Html.SearchDateRange("HappenDate", "发生时间")
@@ -743,10 +729,6 @@
@MyControls.Btn("拒绝", "setReject()")
}
}
@if (PS.Config.Company == CompanyEnum.中金)
{
@MyControls.Btn("南向资金全量", "downloadCashInfo()")
}
</div>
</div>
</div>
@@ -18,11 +18,6 @@
@MyControls.Btn("导入", "importVariety()")
}
@MyControls.Btn("导出", "downloadExcel()")
@if (CurUser.基础参数管理.标的品种编辑)
{
@MyControls.Btn("预付金参数导入", "importMarginParams()")
}
<a href="/variety/ExportMarginParams" class="btn btn-primary" target="_blank">预付金参数导出</a>
</div>
@Html.Raw(JqGridSimple.OutTable())
@@ -312,7 +312,7 @@ function SearchClientBalance() {
$("#VmFundSum").text(numFormart(data.VmFundSum));
$("#AvailableFund").text(numFormart(data.AvailableAmount));
$("#OtherFund").text(numFormart(data.OtherFund));
$("#PositionTradePayableFund").text(numFormart(data.PositionTradePayableFundTotal));
$("#MarginByPayableMargin").text(numFormart(data.MarginByPayableMarginTotal));
$("#ToDayRemainFund").text(numFormart(data.AmountFund));
$("#DesirableFund").text(numFormart(data.DesirableFundTotal));
});
@@ -1537,16 +1537,6 @@ var colModel_client = [
formatter: function (cellvalue, options, rowObject) {
return !cellvalue || cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
}
}, {
name: 'Credit',
label: '授信额度',
index: 'Credit',
width: 120,
align: 'right',
sortable: false,
formatter: function (cellvalue, options, rowObject) {
return !cellvalue || cellvalue == "NaN" ? "" : cellvalue.toLocaleString();
}
}
];
@@ -47,7 +47,7 @@ var app = new Vue({
{ text: '客户开户', value: '1' },
{ text: '客户信息修改', value: '5' },
{ text: '交易', value: '2' },
{ text: '资信与授信', value: '3' },
/* { text: '资信与授信', value: '3' },*/
{ text: '出金', value: '4' }
],