确认书保证金率模板修改
This commit is contained in:
Binary file not shown.
@@ -118,6 +118,9 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
var PosiTradingFeePending = 0.0;
|
||||
var allSwapPositions = Context.GetSwapPositions(trades.Select(x => x.id).ToList(), true);
|
||||
var allinterestMargins = allSwapPositions.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode));
|
||||
// 计算初始预付金率和维持预付金率(加权)
|
||||
decimal initialMarginRate = 0;
|
||||
decimal maintainMarginRate = 0;
|
||||
foreach (var trade in trades)
|
||||
{
|
||||
var swapPositions = Context.GetSwapPositions(trade.id, true);
|
||||
@@ -128,6 +131,8 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
var additionMarginQuery = swapPositions.Where(x => x.InterestMode == 6);
|
||||
var underlyingCode = swapPosition?.UnderlyingCode;
|
||||
var clientMarginRate = YLErp.Modules.UnderlyingModule.UnderlyingHelper.GetApplicableMarginRate(client.id, underlyingCode, trade.TradeDate.Value);
|
||||
initialMarginRate += (clientMarginRate?.init_rate ?? 0)* Convert.ToDecimal(trade.OriginalStockEqvNotional);
|
||||
maintainMarginRate += (clientMarginRate?.maintain_rate ?? 0) * Convert.ToDecimal(trade.OriginalStockEqvNotional);
|
||||
if (count == 0)
|
||||
{
|
||||
var interestMargin = allinterestMargins.FirstOrDefault(o => o.interest_rest_days != null);
|
||||
@@ -198,8 +203,6 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
//}
|
||||
|
||||
//dic["计算基准"] = calculationBasis;
|
||||
dic["初始保障金率"] = ((clientMarginRate?.init_rate ?? 0) * 100).ToString("0.####") + "%";
|
||||
dic["维持保障金率"] = ((clientMarginRate?.maintain_rate ?? 0) * 100).ToString("0.####") + "%";
|
||||
dic["期初预付金".Insert("期初预付金".Length, "2?")] = (StockEqvNotionalRealSum * Convert.ToDouble(clientMarginRate?.init_rate??0)).ToString("0.##");
|
||||
//var initialMarginSum = initialMarginQuery.Sum(x =>
|
||||
// x.InterestDirection == 2 ? x.InterestPrincipalFix * -1 : x.InterestPrincipalFix);
|
||||
@@ -215,7 +218,8 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
row["开始日期"] = trade.StartDate?.ToString("【yyyy】年【M】月【d】日");
|
||||
row["到期日期"] = trade.ExerciseDate?.ToString("【yyyy】年【M】月【d】日");
|
||||
row["成交日期2"] = trade.TradeDate?.ToString("【yyyy】年【M】月【d】日");
|
||||
|
||||
row["初始保障金率"] = ((clientMarginRate?.init_rate ?? 0) * 100).ToString("0.####") + "%";
|
||||
row["维持保障金率"] = ((clientMarginRate?.maintain_rate ?? 0) * 100).ToString("0.####") + "%";
|
||||
FormatToDict("期初标的交割全价", (double)((swapPosition?.PosiGrossPrice) ?? 0) * 100, row);
|
||||
FormatToDict("期初标的交割净价", (double)((swapPosition?.PosiNetNoFeePrice) ?? 0) * 100, row);
|
||||
//row["利差"] = ((interestMargin?.InterestRateDefault) ?? 0) * 100;
|
||||
@@ -259,8 +263,11 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
dic["交易费率"] = dic["基本费率"];
|
||||
dic["交易费用"] = PosiTradingFeePending;
|
||||
dic["名义本金".Insert("名义本金".Length, "2?")] = StockEqvNotionalRealSum.ToString("0.##");
|
||||
|
||||
|
||||
initialMarginRate = initialMarginRate / Convert.ToDecimal(StockEqvNotionalRealSum);
|
||||
maintainMarginRate= maintainMarginRate / Convert.ToDecimal(StockEqvNotionalRealSum);
|
||||
dic["初始保障金率"] = (initialMarginRate * 100).ToString("0.####") + "%";
|
||||
dic["维持保障金率"] = (maintainMarginRate * 100).ToString("0.####") + "%";
|
||||
|
||||
clientduties = clientduties.Where(x => x.ContactTypeId.Contains("3")).OrderBy(o => o.id).ToList();//交易确认书邮件接收人
|
||||
if (clientduties.Count > 0)
|
||||
|
||||
@@ -195,8 +195,8 @@ namespace YLErp.Modules.TradeModule
|
||||
foreach (var t in matchingPositions) {
|
||||
var marginDetail = UnderlyingHelper.GetApplicableMarginRate(t.ClientId, t.UnderlyingCode, t.TradeDate.Value);
|
||||
var rate = marginDetail?.init_rate ?? 0;
|
||||
weightedMarginSum += rate*Convert.ToDecimal(t.OriginalNotional);
|
||||
totalCount+= Convert.ToDecimal(t.OriginalNotional);
|
||||
weightedMarginSum += rate*Convert.ToDecimal(t.OriginalStockEqvNotional);
|
||||
totalCount+= Convert.ToDecimal(t.OriginalStockEqvNotional);
|
||||
}
|
||||
marginRate = weightedMarginSum / totalCount;
|
||||
marginRate=Math.Round(marginRate, 4); // 保留四位小数
|
||||
|
||||
@@ -628,43 +628,20 @@ function SendOAHub() {
|
||||
}
|
||||
|
||||
// 检查选中的行中是否有无确认书的情况
|
||||
var hasNoConfirmBook = false;
|
||||
var hasOAStatus = false;
|
||||
var ids = [];
|
||||
var contractCodes = [];
|
||||
|
||||
rowIds.forEach((v, i, arr) => {
|
||||
var rowId = v;
|
||||
var data = jgrid.jqGrid('getRowData', rowId);
|
||||
if (data.id) {
|
||||
ids.push(data.id);
|
||||
contractCodes.push(data.ContractCode);
|
||||
|
||||
// 检查是否有无确认书的情况
|
||||
if (!data.ContractCode) {
|
||||
hasNoConfirmBook = true;
|
||||
}
|
||||
|
||||
// 检查是否有已发送OA的情况
|
||||
if (data.OAStatus && data.OAStatus !== "") {
|
||||
hasOAStatus = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 根据不同情况显示不同提示
|
||||
if (hasNoConfirmBook) {
|
||||
main.confirm("选中的交易中有无确认书附件的情况,确定提交OA吗?", function() {
|
||||
batchSubmitOA(connection, ids);
|
||||
});
|
||||
} else if (hasOAStatus) {
|
||||
main.confirm("选中的交易中有已经提交过OA的情况,确定再次提交新的OA吗?", function() {
|
||||
batchSubmitOA(connection, ids);
|
||||
});
|
||||
} else {
|
||||
// 有确认书且OA状态为未发送过:无提示,直接在OA中起草内容
|
||||
main.confirm("即将逐条提交OA,随时会中断,请及时检查OA状态", function () {
|
||||
batchSubmitOA(connection, ids);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 批量提交OA的函数
|
||||
|
||||
Reference in New Issue
Block a user