BigFix 确认书客户信息 预付金额 计算基准 重置频率等字段逻辑修改 确认书用印上传 修改交易去掉交易确认书 默认按交易日期排序
This commit is contained in:
@@ -103,6 +103,10 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
dic["交易对手方全称"] = client.ClientType != "产品" ? client.Name : $"{client.Manager}作为管理人代表{client.Name}";
|
||||
dic["主协议编号"] = client.MainProtocolCode;
|
||||
dic["定义文件编号"] = client.SettleFileNumber;
|
||||
dic["户名"] = bank?.ClientName;
|
||||
dic["银行账号"] = bank?.Card;
|
||||
dic["开户行"] = bank?.Bank;
|
||||
dic["大额行号"] = bank?.Payment;
|
||||
var count = 0;
|
||||
|
||||
var trades = Context.Trades;
|
||||
@@ -112,13 +116,23 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
{
|
||||
var swapPositions = Context.GetSwapPositions(trade.id, true);
|
||||
var swapPosition = swapPositions.Where(x => x.PositionType == 1 || x.PositionType == 2).FirstOrDefault();
|
||||
var interestMargin = swapPositions.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode)).FirstOrDefault();
|
||||
var interestMargins = swapPositions.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode));
|
||||
var initialMarginQuery = swapPositions.Where(x => x.InterestMode == 5);
|
||||
var additionMarginQuery = swapPositions.Where(x => x.InterestMode == 6);
|
||||
var underlyingCode = swapPosition?.UnderlyingCode;
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
var interestMargin = interestMargins.FirstOrDefault(o => o.interest_rest_days != null);
|
||||
if (interestMargin == null)
|
||||
{
|
||||
interestMargin = interestMargins.FirstOrDefault(o => string.IsNullOrWhiteSpace(o.FloatRateUnderlyingCode));
|
||||
}
|
||||
if (interestMargin == null)
|
||||
{
|
||||
interestMargin = interestMargins.FirstOrDefault();
|
||||
}
|
||||
|
||||
dic["成交日期"] = trade.TradeDate?.ToString("yyyy年M月d日");
|
||||
dic["开始日期"] = trade.StartDate?.ToString("yyyy年M月d日");
|
||||
dic["到期日期"] = trade.ExerciseDate?.ToString("yyyy年M月d日");
|
||||
@@ -146,6 +160,7 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
dic["固定利率"] = ((interestMargin?.InterestRateDefault) ?? 0) * 100;
|
||||
dic["参考利率"] = "";
|
||||
dic["重置频率"] = "";
|
||||
dic["计算基准"] = "";
|
||||
if (posiLong)
|
||||
{
|
||||
dic["多头约定利率"] = ((double)interestRate).ToString("0.####") + "%";
|
||||
@@ -162,28 +177,30 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
dic["利差%"] = ((interestMargin?.InterestRateDefault) ?? 0) * 100;
|
||||
dic["参考利率"] = interestMargin?.FloatRateUnderlyingCode;
|
||||
dic["固定利率"] = "";
|
||||
dic["重置频率"] = interestMargin?.interest_rest_days;
|
||||
dic["计算基准"] = interestMargin?.FloatRateUnderlyingCode +" + " + ((interestMargin?.InterestRateDefault) ?? 0) * 100 + "%";
|
||||
dic["重置频率"] = interestMargin?.interest_rest_days + "天";
|
||||
}
|
||||
dic["初始预付金支付日"] = initialMarginQuery.FirstOrDefault()?.HappenDate == null ? "" : interestMargin?.HappenDate?.ToString("【yyyy】年【M】月【d】日");
|
||||
dic["初始预付金支付日"] = trade.TradeDate?.ToString("yyyy年M月d日");
|
||||
|
||||
dic["管理人名称"] = client.Manager;
|
||||
var calculationBasis = interestMargin?.FloatRateUnderlyingCode;
|
||||
if (!string.IsNullOrEmpty(calculationBasis))
|
||||
{
|
||||
calculationBasis += interestRate > 0 ? " + " + ((double)interestRate).ToString("0.####") + "%" : ((double)interestRate).ToString("0.####") + "%";
|
||||
}
|
||||
else
|
||||
{
|
||||
calculationBasis = ((double)interestRate).ToString("0.####") + "%";
|
||||
}
|
||||
//var calculationBasis = interestMargin?.FloatRateUnderlyingCode;
|
||||
//if (!string.IsNullOrEmpty(calculationBasis))
|
||||
//{
|
||||
// calculationBasis += interestRate > 0 ? " + " + ((double)interestRate).ToString("0.####") + "%" : ((double)interestRate).ToString("0.####") + "%";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// calculationBasis = ((double)interestRate).ToString("0.####") + "%";
|
||||
//}
|
||||
|
||||
dic["计算基准"] = calculationBasis;
|
||||
//dic["计算基准"] = calculationBasis;
|
||||
dic["初始保障金率"] = ((clientMarginRate?.InitMarginRate ?? 0) * 100).ToString("0.####") + "%";
|
||||
dic["维持保障金率"] = ((clientMarginRate?.MaintenanceRate ?? 0) * 100).ToString("0.####") + "%";
|
||||
dic["交易费率"] = dic["基本费率"];
|
||||
var initialMarginSum = initialMarginQuery.Sum(x =>
|
||||
x.InterestDirection == 2 ? x.InterestPrincipalFix * -1 : x.InterestPrincipalFix);
|
||||
dic["期初预付金".Insert("期初预付金".Length, "2?")] = trade.StockEqvNotionalReal.ToString("0.##");
|
||||
//var initialMarginSum = initialMarginQuery.Sum(x =>
|
||||
// x.InterestDirection == 2 ? x.InterestPrincipalFix * -1 : x.InterestPrincipalFix);
|
||||
//dic["期初预付金".Insert("期初预付金".Length, "2?")] = initialMarginSum.ToString("0.##");
|
||||
|
||||
}
|
||||
|
||||
var row = new JObject();
|
||||
@@ -194,10 +211,6 @@ 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["户名"] = bank?.ClientName;
|
||||
row["银行账号"] = bank?.Card;
|
||||
row["开户行"] = bank?.Bank;
|
||||
row["大额行号"] = bank?.Payment;
|
||||
|
||||
FormatToDict("期初标的交割全价", (double)((swapPosition?.PosiGrossPrice) ?? 0) * 100, row);
|
||||
FormatToDict("期初标的交割净价", (double)((swapPosition?.PosiNetNoFeePrice) ?? 0) * 100, row);
|
||||
@@ -237,6 +250,7 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator
|
||||
};
|
||||
table1.Add(row);
|
||||
dic["名义本金".Insert("名义本金".Length, "2?")] = StockEqvNotionalRealSum.ToString("0.##");
|
||||
dic["期初预付金".Insert("期初预付金".Length, "2?")] = (StockEqvNotionalRealSum * clientMarginRate?.InitMarginRate)?.ToString("0.##");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user