Merge remote-tracking branch 'origin/glms/feature/1.4.2' into glms/feature/1.4.2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using YLErp.BLL;
|
||||
using YLErp.Core.Helpers;
|
||||
using YLErp.DBModels;
|
||||
using YLErp.DBModels.Consts;
|
||||
@@ -315,9 +316,40 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
dic["初始保障金率"] = ((double)initRate * 100).ToString("N4");
|
||||
dic["维持保障金率"] = ((double)maintainRate * 100).ToString("N4");
|
||||
|
||||
// 期初预付比例和金额
|
||||
dic["期初预付比例"] = ((double)initRate * 100).ToString("0.##");
|
||||
dic["期初预付金额"] = ((trade.OriginalStockEqvNotional ?? 0) * (double)initRate).ToString("N2");
|
||||
// 期初预付/期初现金交换:预付=初始预付金腿合计(模板口径:可全部或部分授信替代),
|
||||
// 现金=资金记录实付现金(ClientCashInCashOut:Action=应付预付金且 Money<0 即客户期初实付;
|
||||
// 授信部分不产生资金流水,平仓返还为正数、追加保证金是独立Action,均不落入该口径)
|
||||
var notional = trade.OriginalStockEqvNotional ?? 0;
|
||||
var initialLegs = swapPositions.Where(x => x.InterestMode == (int)InterestModeEnum.初始预付金).ToList();
|
||||
var initialLegIds = initialLegs.Select(x => x.id).ToList();
|
||||
double cashPaid;
|
||||
using (var db = new YLContext())
|
||||
{
|
||||
cashPaid = db.ClientCashInCashOut
|
||||
.Where(x => x.TradeId == trade.id && x.Action == ClientCashInCashOut.系统操作_应付预付金
|
||||
&& x.ValidState != ConsGlobal.InValid && x.Money < 0
|
||||
&& (x.Deal == 0 || initialLegIds.Contains(x.Deal)))
|
||||
.Sum(x => x.Money) ?? 0;
|
||||
}
|
||||
var cashRatio = notional == 0 ? 0 : -cashPaid / notional * 100;
|
||||
dic["期初现金交换比例"] = cashRatio.ToString("0.##");
|
||||
dic["期初现金交换金额"] = (-cashPaid).ToString("N2");
|
||||
|
||||
// 期初预付比例和金额:有应付腿取腿合计(合约录入值),无应付腿(无预付金模板/合约维度盯市)走模板率兜底
|
||||
var totalPayable = initialLegs
|
||||
.Select(x => x.InterestPrincipalFix * (x.InterestDirection == 1 ? 1m : -1m))
|
||||
.Where(x => x > 0)
|
||||
.Sum();
|
||||
if (totalPayable > 0)
|
||||
{
|
||||
dic["期初预付比例"] = (notional == 0 ? 0 : (double)totalPayable / notional * 100).ToString("0.##");
|
||||
dic["期初预付金额"] = ((double)totalPayable).ToString("N2");
|
||||
}
|
||||
else
|
||||
{
|
||||
dic["期初预付比例"] = ((double)initRate * 100).ToString("0.##");
|
||||
dic["期初预付金额"] = (notional * (double)initRate).ToString("N2");
|
||||
}
|
||||
bool posiLong = IsCustomerLong(swapPosition);
|
||||
var maintainRatePercent = (double)maintainRate * 100; // A(%)
|
||||
|
||||
@@ -441,9 +473,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
}
|
||||
|
||||
// 期初预付金利率(InterestMode == 初始预付金)
|
||||
var initialMarginPosition = swapPositions
|
||||
.Where(x => x.InterestMode == (int)InterestModeEnum.初始预付金)
|
||||
.FirstOrDefault();
|
||||
var initialMarginPosition = initialLegs.FirstOrDefault();
|
||||
dic["期初预付金利率"] = initialMarginPosition != null
|
||||
? ((double)initialMarginPosition.InterestRateDefault * 100).ToString("N4")
|
||||
: "0.0000";
|
||||
@@ -507,18 +537,9 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
}
|
||||
|
||||
// 基本费率 = PosiTradingFeePending / 名义本金 * 100
|
||||
var notional = trade.OriginalStockEqvNotional ?? 0;
|
||||
var tradingFee = (double)swapPosition.PosiTradingFeePending;
|
||||
var basicFeeRate = notional == 0 ? 0 : tradingFee / notional * 100;
|
||||
dic["基本费率"] = basicFeeRate.ToString("0.####");
|
||||
|
||||
// 期初现金交换比例和金额(使用初始预付金数据)
|
||||
dic["期初现金交换比例"] = initialMarginPosition != null
|
||||
? ((double)initialMarginPosition.InterestRateDefault * 100).ToString("N4")
|
||||
: "0.0000";
|
||||
dic["期初现金交换金额"] = initialMarginPosition != null
|
||||
? ((double)initialMarginPosition.InterestPrincipalFix).ToString("N2")
|
||||
: "0.00";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
</table>
|
||||
</div>
|
||||
@*规则15区间追保录入(客户原型全量手工录入,资产类型区块式):纯利率债区块固定展开4个期限档、每档一套参数;其他资产类型区块一套参数、无期限档;x/y 字段保留兼容存量数据*@
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border" style="padding:6px 10px; margin-top:10px;">
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border spanBlk" style="padding:6px 10px; margin-top:10px;">
|
||||
<p style="margin:4px 0; font-weight:bold;">
|
||||
参数组{{blk.no}}:<span v-if="marginTemplate.UnderlyingSeperateType == @((int)UnderlyingSeperateTypeEnum.CustomInstrumentType)">资产类型:{{underlyingTypeNames(blk.ut)}}</span>
|
||||
@*ETF 子类(仅纯基金区块展示):选 可转债ETF/科创债ETF 分期限档(展开4档),其他子类/不区分不分档*@
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
</table>
|
||||
</div>
|
||||
@*规则15区间追保录入(客户原型全量手工录入,资产类型区块式):纯利率债区块固定展开4个期限档、每档一套参数;其他资产类型区块一套参数、无期限档;x/y 字段保留兼容存量数据*@
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border" style="padding:6px 10px; margin-top:10px;">
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border spanBlk" style="padding:6px 10px; margin-top:10px;">
|
||||
<p style="margin:4px 0; font-weight:bold;">
|
||||
参数组{{blk.no}}:<span v-if="marginTemplate.UnderlyingSeperateType == @((int)UnderlyingSeperateTypeEnum.CustomInstrumentType)">资产类型:{{underlyingTypeNames(blk.ut)}}</span>
|
||||
@*ETF 子类(仅纯基金区块展示):选 可转债ETF/科创债ETF 分期限档(展开4档),其他子类/不区分不分档*@
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
</table>
|
||||
</div>
|
||||
@*规则15区间追保录入(客户原型全量手工录入,资产类型区块式):纯利率债区块固定展开4个期限档、每档一套参数;其他资产类型区块一套参数、无期限档;x/y 字段保留兼容存量数据*@
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border" style="padding:6px 10px; margin-top:10px;">
|
||||
<div v-for="blk in ruleRangeBlocks" v-bind:key="'spanblk'+blk.key" class="border spanBlk" style="padding:6px 10px; margin-top:10px;">
|
||||
<p style="margin:4px 0; font-weight:bold;">
|
||||
参数组{{blk.no}}:<span v-if="marginTemplate.UnderlyingSeperateType == @((int)UnderlyingSeperateTypeEnum.CustomInstrumentType)">资产类型:{{underlyingTypeNames(blk.ut)}}</span>
|
||||
@*ETF 子类(仅纯基金区块展示):选 可转债ETF/科创债ETF 分期限档(展开4档),其他子类/不区分不分档*@
|
||||
|
||||
@@ -88,3 +88,15 @@ p {
|
||||
padding-top: 5px;
|
||||
padding-bottom: unset;
|
||||
}
|
||||
|
||||
/*区间追保结构区块:单元格里多个数字输入与文字并列,全局 input[type=text] 152px 会把单元格内容挤成两行,调窄保证单行*/
|
||||
.spanBlk table input[type=text] {
|
||||
width: 50px;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
}
|
||||
|
||||
/*同区块表格单元格边距:bootstrap .table 默认 0.75rem,压缩使表格更紧凑*/
|
||||
.spanBlk table th, .spanBlk table td {
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user