Files
zszq-trs/YLErpDAL/Modules/SuperviseReportModule/SAC/Service/ReportPeriodicReportSACService.cs
T
2024-05-09 14:06:26 +08:00

1792 lines
162 KiB
C#

using BaseOUDAL;
using System.Data;
using System.Linq.Expressions;
using YLErp.BLL;
using YLErp.DBModels.Consts;
using YLErp.DBModels.Enums;
using YLErp.Helpers;
using YLErp.Modules.SuperviseReportModule.SAC.Common;
using YLErp.Modules.SuperviseReportModule.SAC.Model;
using YLErp.QdpModule;
using static YLErp.DBModels.Consts.ConsReport;
namespace YLErp.Modules.SuperviseReportModule.SAC.Service
{
class ReportPeriodicReportSACService : ReportBaseService
{
public ReportPeriodicReportSACService(OptUserInfo optUser) : base(optUser)
{ }
protected override string _excelDataSourcePath => "定期报告\\";
protected override string _excelDataSourceFileName => "import_SAC_template.xlsx";
protected override DataFlagsEnum BusiDataType => DataFlagsEnum.A1011;
private List<OptFlagsEnum> _validOperationType = null;
public override List<OptFlagsEnum> ValidOperationType
{
get
{
if (_validOperationType == null)
{
_validOperationType = new List<OptFlagsEnum>() {
OptFlagsEnum.A,
OptFlagsEnum.U,
OptFlagsEnum.D,
};
}
return _validOperationType;
}
}
DateTime minDate = DateTime.MinValue;
DateTime maxDate = DateTime.MinValue;
protected override SuperviseReportTypeEnum ReportType => SuperviseReportTypeEnum.SAC_PeriodicReportSAC;
readonly List<SACReportNotes> noteList = new List<SACReportNotes>();
public override bool CheckRequestParamer(ReportInfo req, out string errMsg)
{
if (!base.CheckRequestParamer(req, out errMsg))
{
return false;
}
if (req.SACReportDate == null)
{
errMsg = "SAC定期报告对应的报告月份不应为空";
return false;
}
switch (req.SACReportStatus)
{
case OptFlagsEnum.U:
case OptFlagsEnum.D:
minDate = req.SACReportDate.Value.Date.AddDays(-req.SACReportDate.Value.Day).AddDays(1);
maxDate = req.SACReportDate.Value.Date.AddMonths(1).AddDays(-req.SACReportDate.Value.Day);
var note = base.GetReportNotes(ReportType, formatInfoTag(req.SACReportDate?.ToString("yyyy-MM"))).FirstOrDefault();
if (note == null)
{
errMsg = $"{minDate.ToString("yyyy-MM-dd")}~{maxDate.ToString("yyyy-MM-dd")}不存在报送成功的SAC定期报告记录,请重新选择";
return false;
}
break;
case OptFlagsEnum.A:
if (base.GetReportNotes(ReportType, formatInfoTag(req.SACReportDate.Value.ToString("yyyy-MM"))).Any())
{
minDate = req.SACReportDate.Value.Date.AddDays(-req.SACReportDate.Value.Day).AddDays(1);
maxDate = req.SACReportDate.Value.Date.AddMonths(1).AddDays(-req.SACReportDate.Value.Day);
errMsg = $"{minDate.ToString("yyyy-MM-dd")}~{maxDate.ToString("yyyy-MM-dd")}最新SAC定期报告记录已报送成功,请选择补正";
return false;
}
break;
default:
break;
}
errMsg = "";
return true;
}
protected override BodyModel GenerateBody(out bool noData, out List<string> fileList)
{
fileList = new List<string>();
noData = true;
var model = new BodyModel();
var cacheKey = $"{BusiDataType}";
var cacheValue = formatInfoTag(_reqInfo.SACReportDate.Value.ToString("yyyy-MM"));
if (ReportStatus.CheckCacheInfo(cacheKey, cacheValue))
{
return model;
}
var note = base.GetReportNotes(ReportType, cacheValue).FirstOrDefault();
if (note == null && _operationType == OptFlagsEnum.A)
{
note = new SACReportNotes()
{
InfoCache = $"{{\"Tag\":\"{_reqInfo.SACReportDate.Value.ToString("yyyy-MM")}\"}}",
IsValid = true,
};
}
else
{
switch (_operationType)
{
case OptFlagsEnum.A:
noData = true;//新增数据已报送,跳过
return model;
case OptFlagsEnum.U:
note.IsValid = true;
break;
case OptFlagsEnum.D:
note.IsValid = false;
break;
case OptFlagsEnum.NONE:
default:
throw new ServiceException("未知操作类型");
}
}
//if (((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template) && ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System))
//{
// model.PeriodicReportSAC = GetPeriodicReportSACFromExcelAndDb();
//}
//else if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.System) == SAC_ReportDataSourceEnum.System)
//{
// model.PeriodicReportSAC = GetPeriodicReportSACFromDb();
//}
//else if ((PS.Config.ErpElement.SAC_ReportDataSource & SAC_ReportDataSourceEnum.Template) == SAC_ReportDataSourceEnum.Template)
//{
// model.PeriodicReportSAC = GetPeriodicReportSACFromExcel();
//}
model.PeriodicReportSAC = GetPeriodicReportSACFromExcel();
model.PeriodicReportSAC.OperationType = _operationType;
noData = string.IsNullOrWhiteSpace(model?.PeriodicReportSAC?.MainAgreementAddedThisMonth);
ReportStatus.AddCacheInfo(cacheKey, cacheValue);
if (!noData)
{
if (_operationType != OptFlagsEnum.A)
{
model.PeriodicReportSAC.BizID = note.BizId;
}
model.PeriodicReportSAC.ExceID = base.formatExceID();
note.id = 0;
note.ExceId = model.PeriodicReportSAC.ExceID;
note.CreateTime = DateTime.Now;
note.FileTag = FileTag;
note.ReportType = ReportType;
note.ReportDate = _reqInfo.ReportDate;
note.InfoTag = formatInfoTag(_reqInfo.SACReportDate.Value.ToString("yyyy-MM"), true);
note.OptTime = note.CreateTime;
note.RetCode = "";
note.RetMsg = "";
note.ReportResponse = false;
note.BizId = "";
note.changeStatus = false;
noteList.Add(note);
}
return model;
}
private PeriodicReportSACModel GetPeriodicReportSACFromDb()
{
var monthStart = QdpCalendarHelper.GetNonHoliday(_reqInfo.SACReportDate.Value.AddDays(-_reqInfo.SACReportDate.Value.Day + 1));
var lastMonthEnd = QdpCalendarHelper.GetNonHolidayDefore(monthStart.AddDays(-1));
var monthEnd = QdpCalendarHelper.GetNonHolidayDefore(monthStart.AddMonths(1).AddDays(-monthStart.Day));
var yearStart = QdpCalendarHelper.GetNonHoliday(new DateTime(_reqInfo.SACReportDate.Value.Year, 01, 01));
var lastYearEnd = QdpCalendarHelper.GetNonHolidayDefore(yearStart.AddDays(-1));
var yearEnd = monthEnd;
var model = new PeriodicReportSACModel();
using (var baseDb = new ClientDBContext())
{
using (var db = new YLContext())
{
model.Year = _reqInfo.SACReportDate.Value.Year.ToString("0000");
model.Month = _reqInfo.SACReportDate.Value.Month.ToString("0");
model.MainAgreementAddedThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate >= monthStart && O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString();
model.MainAgreementAccumulatedThisYear = DbContext.sac_report_notes.Where(O => O.ReportDate >= yearStart && O.ReportDate <= yearEnd && O.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString();
model.MainAgreementValidedAtEndOfThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_MasterAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A") && O.IsValid).Count().ToString();
model.SupplementalAgreementAddedThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate >= monthStart && O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString();
model.SupplementalAgreementAccumulatedThisYear = DbContext.sac_report_notes.Where(O => O.ReportDate >= yearStart && O.ReportDate <= yearEnd && O.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString();
model.SupplementalAgreementValidedAtTheEndOfThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_SupAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A") && O.IsValid).Count().ToString();
model.PerformanceGuaranteeAgreementAddedThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate >= monthStart && O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString();
model.PerformanceGuaranteeAgreementAccumulatedThisYear = DbContext.sac_report_notes.Where(O => O.ReportDate >= yearStart && O.ReportDate <= yearEnd && O.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A")).Count().ToString();
model.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth = DbContext.sac_report_notes.Where(O => O.ReportDate <= monthEnd && O.ReportType == SuperviseReportTypeEnum.SAC_PerformanceGuaranteeAgrmt && O.ReportResponse && O.InfoTag.EndsWith("_A") && O.IsValid).Count().ToString();
var contractCount = from tc in db.trade_cash join tr in db.trade_contract_r on tc.id equals tr.TradeCashId where tr.Type == "交易确认书" && !tc.IsDeleted && tr.IsValid select tc.ValueDate;
model.TransactionConfirmationAddedThisMonth = contractCount.Where(O => O >= monthStart && O <= monthEnd).Count().ToString();
model.TransactionConfirmationBookAccumulatedThisYear = contractCount.Where(O => O >= yearStart && O <= yearEnd).Count().ToString();
model.TransactionConfirmationValidedAtEndOfThisMonth = contractCount.Where(O => O <= monthEnd).Count().ToString();
var endAction = new List<string>() { "系统操作-平仓费", "系统操作-行权费" };
var selfClientInfos = baseDb.client.Where(O => O.ProcessOptDate <= monthEnd && O.ProcessStatus == "已开户" && O.ClientType == "产品").Select(O => O.id).ToList();
var dotSelfClientInfos = baseDb.client.Where(O => O.ProcessOptDate <= monthEnd && O.ProcessStatus == "已开户" && O.ClientType != "产品").Select(O => O.id).ToList();
var latestTradeInfos =
(from et in db.eod_trade
where et.ValueDate == monthEnd && et.TradeStatus == "确认成交"
join ep in db.eod_trade_position on new { et.TradeId, et.ValueDate } equals new { ep.TradeId, ep.ValueDate }
join um in db.underlying_manager on et.UnderlyingCode equals um.UnderlyingCode
join tr in db.trade_contract_r.Where(O => O.Type == "交易确认书" && O.IsValid) on et.TradeId equals tr.TradeId into tempTr
from tr in tempTr.DefaultIfEmpty()
select new
{
et = new xodTradeBase() { TradeJson = et.TradeJson },
um,
tr,
ep.Pv,
})
.ToArray().Select(O => new
{
O.et.trade.StockEqvNotional,
O.et.trade.TradeType,
O.um.UnderlyingInstrumentType,
O.et.trade.ClientId,
O.et.trade.StockEqvNotionalReal,
O.et.trade.StartDate,
O.et.trade.ExerciseDate,
O.et.trade.TradePrice,
O.et.trade.PremiumRate,
O.et.trade.OriginalStockEqvNotional,
ContractCode = O.tr?.ContractCode,
O.um.CommodityCode,
O.et.trade.ParticipationRate,
O.et.trade.AnnualizeFactor,
O.um.UnderlyingName,
O.um.UnderlyingCode,
O.um.MarketCode,
O.um.MarketName,
O.et.trade.PositionMarginRate,
O.et.trade.trade_swap,
O.Pv,
}).ToArray();
var lastMonthTradeInfos = (from et in db.eod_trade join um in db.underlying_manager on et.UnderlyingCode equals um.UnderlyingCode join ts in db.trade_span.Where(O => O.ValueDate == lastMonthEnd) on et.TradeId equals ts.TradeId where et.ValueDate == lastMonthEnd && et.TradeStatus == "确认成交" select new { et = new xodTradeBase() { TradeJson = et.TradeJson }, ts.WorstCastClientPayable, um }).ToArray().Select(O => new { O.et.trade.id, O.et.trade.StockEqvNotional, O.et.TradeType, O.um.UnderlyingInstrumentType, O.WorstCastClientPayable }).ToArray();
var latestMonthNewTradeInfos = (from t in db.trade join tc in db.trade_cash.Where(O => O.ValueDate >= monthStart && O.ValueDate <= monthEnd && O.Action == "系统操作-期权费" && O.ValidState != "InValid" && !O.IsDeleted) on t.id equals tc.TradeId join um in db.underlying_manager on t.UnderlyingCode equals um.UnderlyingCode join tr in db.trade_contract_r on tc.id equals tr.TradeCashId into tempTr from tr in tempTr.DefaultIfEmpty() where tr.IsValid select new { t.id, StockEqvNotional = t.OriginalStockEqvNotional, t.TradeType, um.UnderlyingInstrumentType, t.ClientId, t.StockEqvNotionalReal, t.StartDate, t.ExerciseDate, t.TradePrice, t.PremiumRate, t.OriginalStockEqvNotional, tr.ContractCode, um.CommodityCode, um.UnderlyingName, um.UnderlyingCode, um.MarketName }).ToArray();
var latestMonthEndTradeInfos = (from t in db.trade join tc in db.trade_cash.Where(O => O.ValueDate >= monthStart && O.ValueDate <= monthEnd && endAction.Contains(O.Action) && O.ValidState != "InValid" && !O.IsDeleted) on t.id equals tc.TradeId join um in db.underlying_manager on t.UnderlyingCode equals um.UnderlyingCode select new { t.id, StockEqvNotional = (tc.UnwindNotional / t.OriginalNotional * t.OriginalStockEqvNotional), t.TradeType, um.UnderlyingInstrumentType }).ToArray();
var latestMonthTradeInfos = (from et in db.eod_trade join um in db.underlying_manager on et.UnderlyingCode equals um.UnderlyingCode join ts in db.trade_span.Where(O => O.ValueDate == monthEnd) on et.TradeId equals ts.TradeId where et.ValueDate == monthEnd && et.TradeStatus == "确认成交" select new { et = new xodTradeBase() { TradeJson = et.TradeJson }, ts.WorstCastClientPayable, um }).ToArray().Select(O => new { O.et.trade.id, O.et.trade.StockEqvNotional, O.et.TradeType, O.um.UnderlyingInstrumentType, O.WorstCastClientPayable }).ToArray();
var latestYearNewTradeInfos = (from t in db.trade join tc in db.trade_cash.Where(O => O.ValueDate >= yearStart && O.ValueDate <= yearEnd && O.Action == "系统操作-期权费" && O.ValidState != "InValid" && !O.IsDeleted) on t.id equals tc.TradeId join um in db.underlying_manager on t.UnderlyingCode equals um.UnderlyingCode select new { t.id, StockEqvNotional = t.OriginalStockEqvNotional, t.TradeType, um.UnderlyingInstrumentType }).ToArray();
var totleStockEqvNotional = (latestTradeInfos.Sum(O => (double?)O.StockEqvNotional) ?? 0);
var latestNetAssets = _reqInfo.LatestNetAssets;
model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence = totleStockEqvNotional.ToString();
model.NetCapitalAtEndOfTheMonth = latestNetAssets.ToString();
model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital = latestNetAssets == 0 ? "0" : (totleStockEqvNotional / latestNetAssets * 100).ToString("0.00");
model.OTCOptionHasSignedByLegalPerson = dotSelfClientInfos.Count.ToString();
model.OTCOptionsHaveContractedProducts = selfClientInfos.Count.ToString();
model.OTCOptionsForTheMonthOfTheNewAddLegalPerson = baseDb.client.Where(O => O.ProcessStatus == "已开户" && O.ProcessOptDate >= monthStart && O.ProcessOptDate <= monthEnd && O.ClientType != "产品").Count().ToString();
model.OTCOptionsForTheMonthOfTheNewAddProduct = baseDb.client.Where(O => O.ProcessStatus == "已开户" && O.ProcessOptDate >= monthStart && O.ProcessOptDate <= monthEnd && O.ClientType == "产品").Count().ToString();
model.OTCOptionsLegalPersonInDurationForThisMouth = dotSelfClientInfos.Count.ToString();
model.OTCOptionsProductsInDurationForThisMouth = selfClientInfos.Count.ToString();
model.IncomeSwapHasSignedLegalPersonNumber = dotSelfClientInfos.Count.ToString();
model.IncomeSwapHasSignedProductNumber = selfClientInfos.Count.ToString();
model.IncomeSwapForTheMonthOfTheNewAddLegalPerson = model.OTCOptionsForTheMonthOfTheNewAddLegalPerson;
model.IncomeSwapForTheMonthOfTheNewAddProduct = model.OTCOptionsForTheMonthOfTheNewAddProduct;
model.IncomeSwapLegalPersonInDurationForThisMouth = dotSelfClientInfos.Count.ToString();
model.IncomeSwapProductsInDurationForThisMouth = selfClientInfos.Count.ToString();
var tempList = new List<string> { "StockIF", "Stock", "CommodityFutures" };
model.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsCommoditiesLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsOtherSubjectLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticStockIndexLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeCommoditiesLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeOtherSubjectLastMonthDurationScale = (lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.TotalOfLastMonthDurationScale = (lastMonthTradeInfos.Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsWithinTheIndexThisMonthOfTheNewScale = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsToAddScaleDomesticStocksInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.TotalOfTheNewSizeOfTheIncreaseInThisMonth = (latestMonthNewTradeInfos.Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsTerminateScaleDomesticStockIndexThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsTerminateScaleDomesticStocksInThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.TotalOfTerminationOfTheScaleOfThisMonth = (latestMonthEndTradeInfos.Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsWithinIndividualStocksInThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsCommoditiesInThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsOtherSubjectThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticStockIndexThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeCommoditiesThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.RevenueExchangeOtherSubjectThisMonthDurationScale = (latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.TotalOfThisMonthDurationScale = (latestMonthTradeInfos.Sum(O => (double?)O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory = (latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.IncomeSwapDomesticStockHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear = (latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.TotalNewScaleInThisYear = (latestYearNewTradeInfos.Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OTCOptionsStockIndexAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsStockAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsCommoditiesAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsOtherSubjectAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.TotalNumberOfContractsAtTheEndOfLastMonth = lastMonthTradeInfos.GroupBy(O => O.id).Count().ToString();
model.OTCOptionsStockIndexThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsStockThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber = latestMonthNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.IncomeSwapDomesticStockIndexNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapDomesticStockNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapCommoditiesNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapOtherSubjectNewContractInThisMonth = latestMonthNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.TotalNumberOfNewContractsInThisMonth = latestMonthNewTradeInfos.GroupBy(O => O.id).Count().ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber = latestMonthEndTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.TotalNumberOfContractsTerminatedThisMonth = latestMonthEndTradeInfos.GroupBy(O => O.id).Count().ToString();
model.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.TotalNumberOfContractsAtTheEndOfThisMonth = latestMonthTradeInfos.GroupBy(O => O.id).Count().ToString();
model.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType != "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "StockIF").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "Stock").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && O.UnderlyingInstrumentType == "CommodityFutures").GroupBy(O => O.id).Count().ToString();
model.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear = latestYearNewTradeInfos.Where(O => O.TradeType == "收益互换" && !tempList.Contains(O.UnderlyingInstrumentType)).GroupBy(O => O.id).Count().ToString();
model.TotalNumberOfNewContractsInThisYear = latestYearNewTradeInfos.GroupBy(O => O.id).Count().ToString();
var totalNominalPrincipalAmountOfSwapThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => (double?)O.StockEqvNotional) ?? 0;
var totalNominalPrincipalAmountOfSwapLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => (double?)O.StockEqvNotional) ?? 0;
model.TotalNominalPrincipalAmountOfSwapThisMonth = totalNominalPrincipalAmountOfSwapThisMonth.ToString();
model.TotalNominalPrincipalAmountOfSwapLastMonth = totalNominalPrincipalAmountOfSwapLastMonth.ToString();
var theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => O.WorstCastClientPayable) ?? 0;
var theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => O.WorstCastClientPayable) ?? 0;
model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth.ToString();
model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth.ToString();
model.SwapCashCollateralValueThisMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth.ToString();
model.SwapCashCollateralValueLastMonth = theValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth.ToString();
model.SwapSecuritiesCollateralValueThisMonth = 0.ToString();
model.SwapSecuritiesCollateralValueLastMonthThisMonth = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet = 0.ToString();
model.SwapNumberOfDefaultCustomersAtThisMonthThisMonth = 0.ToString();
model.SwapNumberOfDefaultCustomersAtThisMonthLastMonth = 0.ToString();
model.SwapDefaultTransactionNumberAtThisMonthThisMonth = 0.ToString();
model.SwapDefaultTransactionNumberAtThisMonthLastMonth = 0.ToString();
model.TotalSwapDefaultCustomerNumberInThisYearThisMonth = 0.ToString();
model.TotalSwapDefaultCustomerNumberInThisYearLastMonth = 0.ToString();
model.SwapNumberOfDefaultCustomersInThisYearThisMonth = 0.ToString();
model.SwapNumberOfDefaultCustomersInThisYearLastMonth = 0.ToString();
var totalNominalPrincipalAmountOfOptionThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => (double?)O.StockEqvNotional) ?? 0;
var totalNominalPrincipalAmountOfOptionLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => (double?)O.StockEqvNotional) ?? 0;
model.TotalNominalPrincipalAmountOfOptionThisMonth = totalNominalPrincipalAmountOfOptionThisMonth.ToString();
model.TotalNominalPrincipalAmountOfOptionLastMonth = totalNominalPrincipalAmountOfOptionLastMonth.ToString();
var theValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = latestMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => O.WorstCastClientPayable) ?? 0;
var theValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = lastMonthTradeInfos.Where(O => O.TradeType == "远期").Sum(O => O.WorstCastClientPayable) ?? 0;
model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth.ToString();
model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth.ToString();
model.OptionCashCollateralValueThisMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth.ToString();
model.OptionCashCollateralValueLastMonth = theValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth.ToString();
model.OptionSecuritiesCollateralValueThisMonth = 0.ToString();
model.OptionSecuritiesCollateralValueLastMonth = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet = 0.ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet = 0.ToString();
model.OptionNumberOfDefaultCustomersAtThisMonthThisMonth = 0.ToString();
model.OptionNumberOfDefaultCustomersAtThisMonthLastMonth = 0.ToString();
model.OptionTransactionNumberAtThisMonthThisMonth = 0.ToString();
model.OptionTransactionNumberAtThisMonthLastMonth = 0.ToString();
model.TotalOptionDefaultCustomerNumberInThisYearThisMonth = 0.ToString();
model.TotalOptionDefaultCustomerNumberInThisYearLastMonth = 0.ToString();
model.OptionNumberOfDefaultCustomersInThisYearThisMonth = 0.ToString();
model.OptionNumberOfDefaultCustomersInThisYearLastMonth = 0.ToString();
model.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth = (latestMonthTradeInfos.Sum(O => O.WorstCastClientPayable) ?? 0).ToString();
model.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth = (lastMonthTradeInfos.Sum(O => O.WorstCastClientPayable) ?? 0).ToString();
model.CashBalanceAtEndOfThisMonth = _reqInfo.LatestMonthCash.ToString("0.00");
model.CashBalanceAtEndOfLastMonth = _reqInfo.LastMonthCash.ToString("0.00");
var positionTradeTypes = new List<string>() { "股票", "债券", "银行理财", "信托", "保险" };
var latestMonthPosition = db.eod_trade_position.Where(O => O.ValueDate == monthEnd && O.ClientId == 0).Select(O => new { O.TradeType, O.Pv });
var lastMonthPosition = db.eod_trade_position.Where(O => O.ValueDate == lastMonthEnd && O.ClientId == 0).Select(O => new { O.TradeType, O.Pv });
model.HoldStockMarketValueAtEndOfThisMonth = (latestMonthPosition.Where(O => O.TradeType == "股票").Sum(O => (double?)O.Pv) ?? 0).ToString();
model.HoldStockMarketValueAtEndOfLastMonth = (lastMonthPosition.Where(O => O.TradeType == "股票").Sum(O => (double?)O.Pv) ?? 0).ToString();
model.HoldMarketValueOfBondsAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString();
model.HoldMarketValueOfBondsAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString();
model.OwnedAssetManagementProductsAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString();
model.OwnedAssetManagementProductsAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "债券").Sum(O => O.Pv).ToString();
model.OwnedBankFinanceAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "银行理财").Sum(O => O.Pv).ToString();
model.OwnedBankFinanceAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "银行理财").Sum(O => O.Pv).ToString();
model.HoldTrustProductAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "信托").Sum(O => O.Pv).ToString();
model.HoldTrustProductAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "信托").Sum(O => O.Pv).ToString();
model.InsuranceProductsAreHeldAtTheEndOfThisMonth = 0.ToString();// latestMonthPosition.Where(O => O.TradeType == "保险").Sum(O => O.Pv).ToString();
model.InsuranceProductsAreHeldAtTheEndOfLastMonth = 0.ToString();// lastMonthPosition.Where(O => O.TradeType == "保险").Sum(O => O.Pv).ToString();
model.HoldOtherProductsAtTheEndOfThisMonth = (latestMonthPosition.Where(O => !positionTradeTypes.Contains(O.TradeType)).Sum(O => (double?)O.Pv) ?? 0).ToString();
model.HoldOtherProductsAtTheEndOfLastMonth = (lastMonthPosition.Where(O => !positionTradeTypes.Contains(O.TradeType)).Sum(O => (double?)O.Pv) ?? 0).ToString();
var monthEndTrades = (from t in db.trade
join tc in db.trade_cash
on t.id equals tc.TradeId
where tc.ValueDate >= monthStart && tc.ValueDate <= monthEnd && tc.Action != "系统操作-期权费" && !tc.IsDeleted && tc.ValidState != "InValid"
select new { t, tc.Amount }).ToArray();
model.SettledSwapItemsAtThisMonth = latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换").GroupBy(O => O.id).Count().ToString();
model.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth = (latestMonthEndTradeInfos.Where(O => O.TradeType == "收益互换").Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.SwapIncomeCashFlow = (monthEndTrades.Where(O => O.t.TradeType == "收益互换").Sum(O => (double?)(O.Amount > 0 ? O.Amount : 0)) ?? 0).ToString();
model.SwapExpensesCashFlow = (monthEndTrades.Where(O => O.t.TradeType == "收益互换").Sum(O => (double?)(O.Amount < 0 ? O.Amount : 0)) ?? 0).ToString();
model.CashFlowCorrespondingToNetIncomeOnSwapMargin = (monthEndTrades.Where(O => O.t.TradeType == "收益互换").Sum(O => (double?)O.Amount) ?? 0).ToString();
model.SwapHedgeCost = 0.ToString();
var tradeTypes = new List<string>() { "收益互换", "远期" };
model.SettledOptionItemsAtThisMonth = latestMonthEndTradeInfos.Where(O => !tradeTypes.Contains(O.TradeType)).GroupBy(O => O.id).Count().ToString();
model.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth = (latestMonthEndTradeInfos.Where(O => !tradeTypes.Contains(O.TradeType)).Sum(O => O.StockEqvNotional) ?? 0).ToString();
model.OptionPremiumIncome = (monthEndTrades.Where(O => !tradeTypes.Contains(O.t.TradeType)).Sum(O => O.t.TradePrice * (O.t.BuySell == "买入" ? -1 : 1)) ?? 0).ToString();
model.OptionHedgeCost = 0.ToString();
var balanceOfSwapRealizedGainsAndLossesAtThisMonth = GetRealizedPnl(PredicateBuilder.Create<trade>(t => t.TradeType == "收益互换"), monthStart, monthEnd);
var balanceOfOptionRealizedGainsAndLossesAtThisMonth = GetRealizedPnl(PredicateBuilder.Create<trade>(t => !tradeTypes.Contains(t.TradeType)), monthStart, monthEnd);
model.BalanceOfSwapRealizedGainsAndLossesAtThisMonth = balanceOfSwapRealizedGainsAndLossesAtThisMonth.ToString();
model.BalanceOfOptionRealizedGainsAndLossesAtThisMonth = balanceOfOptionRealizedGainsAndLossesAtThisMonth.ToString();
var balanceOfSwapRealizedGainsAndLossesAtThisYear = GetRealizedPnl(PredicateBuilder.Create<trade>(t => t.TradeType == "收益互换"), yearStart, yearEnd);
var balanceOfOptionRealizedGainsAndLossesAtThisYear = GetRealizedPnl(PredicateBuilder.Create<trade>(t => !tradeTypes.Contains(t.TradeType)), yearStart, yearEnd);
model.BalanceOfSwapRealizedGainsAndLossesAtThisYear = balanceOfSwapRealizedGainsAndLossesAtThisYear.ToString();
model.BalanceOfOptionRealizedGainsAndLossesAtThisYear = balanceOfOptionRealizedGainsAndLossesAtThisYear.ToString();
var balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = GetPositionPnl(PredicateBuilder.Create<trade>(t => t.TradeType == "收益互换"), lastMonthEnd, monthEnd);
var balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = GetPositionPnl(PredicateBuilder.Create<trade>(t => !tradeTypes.Contains(t.TradeType)), lastMonthEnd, monthEnd);
model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth.ToString();
model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth.ToString();
var balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = GetPositionPnl(PredicateBuilder.Create<trade>(t => t.TradeType == "收益互换"), lastYearEnd, yearEnd);
var balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = GetPositionPnl(PredicateBuilder.Create<trade>(t => !tradeTypes.Contains(t.TradeType)), lastYearEnd, yearEnd);
model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear.ToString();
model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear.ToString();
model.BalanceOfSwapTotalGainsAndLossesAtThisMonth = (balanceOfSwapRealizedGainsAndLossesAtThisMonth + balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth).ToString();
model.BalanceOfOptionTotalGainsAndLossesAtThisMonth = (balanceOfOptionRealizedGainsAndLossesAtThisMonth + balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth).ToString();
model.BalanceOfSwapTotalGainsAndLossesAtThisYear = (balanceOfSwapRealizedGainsAndLossesAtThisYear + balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear).ToString();
model.BalanceOfOptionTotalGainsAndLossesAtThisYear = (balanceOfOptionRealizedGainsAndLossesAtThisYear + balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear).ToString();
model.MarginOfSubsistSwap = "0";
model.HedgedMarketValueOfSwap = "0";
model.LeverageRatiOfSwap = "0";
model.MarginOfSubsistStockIndexSwap = "0";
model.HedgedMarketValueOfStockIndexSwap = "0";
model.LeverageRatioOfStockIndexSwap = "0";
model.MarginOfSubsistStockSwap = "0";
model.HedgedMarketValueOfStockSwap = "0";
model.LeverageRatioOfStockSwap = "0";
model.MarginandPremiumOfSubsistOption = "0";
model.HedgedMarketValueOfOption = "0";
model.LeverageRatioOfOption = "0";
model.MarginandPremiumOfSubsistStockIndexOption = "0";
model.HedgedMarketValueOfStockIndexOption = "0";
model.LeverageRatioOfStockIndexOption = "0";
model.MarginandPremiumOfSubsistStockOption = "0";
model.HedgedMarketValueOfStockOption = "0";
model.LeverageRatioOfStockOption = "0";
model.IncreaseBusinessDetailsThisMonthTuple = new List<IncreaseBusinessDetailsThisMonthModel>();
var config = db.valuedate.FirstOrDefault(x => x.State == valuedate.当前使用);
foreach (var item in latestMonthNewTradeInfos)
{
var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId);
var newTrade = new IncreaseBusinessDetailsThisMonthModel();
newTrade.NameOfSecuritiesCompany = config.SuperviseMainName;
newTrade.NameOfCounterparty = client.Name;
if (client.ClientType == "产品")
{
newTrade.CounterpartyProductName = client.Name;
}
newTrade.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(item.ContractCode);
switch (item.TradeType)
{
case "收益互换":
newTrade.BusinessType = BusinessTypeMap["互换"];
newTrade.ReturnSwapObjectSecondClass = GetSACUndrlygAssetDtldTypeMap(SwapUndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode);
break;
case "远期":
newTrade.BusinessType = BusinessTypeMap["远期"];
break;
default:
newTrade.BusinessType = BusinessTypeMap["期权"];
newTrade.OptionObjectSecondClass = GetSACUndrlygAssetDtldTypeMap(UndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode);
newTrade.NonAnnualOptionFee = ((item.PremiumRate ?? (item.TradePrice / item.OriginalStockEqvNotional) ?? 0) * 100).ToString("0.##");
switch (item.TradeType)
{
case "香草期权":
newTrade.OptionType = OptionStructureTypeMap["香草"];
break;
case "二元期权":
newTrade.OptionType = OptionStructureTypeMap["二元"];
break;
case "价差期权":
newTrade.OptionType = OptionStructureTypeMap["价差"];
break;
case "障碍期权":
newTrade.OptionType = OptionStructureTypeMap["障碍"];
break;
case "双鲨期权":
newTrade.OptionType = OptionStructureTypeMap["双鲨"];
break;
default:
newTrade.OptionType = OptionStructureTypeMap["其他"];
break;
}
break;
}
newTrade.NotionalPrincipalAmountLNotionalPrincipalAmount = ((item.StockEqvNotional ?? 0) / 1e9).ToString("0.0000");
//newTrade.SNotionalPrincipalAmount = ((item.StockEqvNotional ?? 0) / 1e9).ToString("0.0000");//当前版本中不存在多空组合的交易
newTrade.StartDate = item.StartDate?.ToString("yyyy-MM-dd");
newTrade.DueDate = item.ExerciseDate?.ToString("yyyy-MM-dd");
newTrade.UndrlygAssetName = item.UnderlyingName;
newTrade.UndrlygAssetCode = item.UnderlyingCode;
newTrade.UndrlygAssetTradgPlc = string.IsNullOrWhiteSpace(item.MarketName) ? "其他" : item.MarketName;
switch (ConsGlobal.InstrumentType.GetDesc(item.UnderlyingInstrumentType))
{
case "股票":
newTrade.InvestmentTargetType = UndrlygAssetTypeMap["权益类"];
break;
case "股指期货":
case "商品期货":
case "商品现货":
newTrade.InvestmentTargetType = UndrlygAssetTypeMap["大宗商品"];
break;
default:
newTrade.InvestmentTargetType = UndrlygAssetTypeMap["其他"];
break;
}
model.IncreaseBusinessDetailsThisMonthTuple.Add(newTrade);
}
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple = new List<InventoryBusinessDetailsAtTheEndOfThisMonthModel>();
foreach (var item in latestTradeInfos)
{
var client = DataCacheProvider.GetClientDataSource().GetData(item.ClientId);
var newTrade = new InventoryBusinessDetailsAtTheEndOfThisMonthModel();
newTrade.NameOfSecuritiesCompany = config.SuperviseMainName;
newTrade.NameOfCounterparty = client.Name;
if (client.ClientType == "产品")
{
newTrade.NameOfCounterpartyProduct = client.Name;
}
newTrade.TransactionConfirmationNumber = item.ContractCode;
switch (item.TradeType)
{
case "收益互换":
newTrade.BusinessType = BusinessTypeMap["互换"];
newTrade.ExchangeSumInvestmentTargetType = GetSACUndrlygAssetDtldTypeMap(SwapUndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode);
break;
case "远期":
newTrade.BusinessType = BusinessTypeMap["远期"];
break;
default:
newTrade.BusinessType = BusinessTypeMap["期权"];
newTrade.OptionSumInvestmentTargetType = GetSACUndrlygAssetDtldTypeMap(UndrlygAssetDtldTypeMap, item.UnderlyingInstrumentType, item.CommodityCode);
newTrade.OptionFee = Math.Abs((item.PremiumRate ?? (item.TradePrice / item.OriginalStockEqvNotional) ?? 0) * 100).ToString("0.##");
switch (item.TradeType)
{
case "香草期权":
newTrade.OptionType = OptionStructureTypeMap["香草"];
break;
case "二元期权":
newTrade.OptionType = OptionStructureTypeMap["二元"];
break;
case "价差期权":
newTrade.OptionType = OptionStructureTypeMap["价差"];
break;
case "障碍期权":
newTrade.OptionType = OptionStructureTypeMap["障碍"];
break;
case "双鲨期权":
newTrade.OptionType = OptionStructureTypeMap["双鲨"];
break;
default:
newTrade.OptionType = OptionStructureTypeMap["其他"];
break;
}
break;
}
newTrade.NotionalPrincipalAmountLNotionalPrincipalAmount = (item.StockEqvNotional / 1e9).ToString("0.0000");
//newTrade.SNotionalPrincipalAmount = (item.StockEqvNotional / 1e9).ToString("0.0000");//当前版本中不存在多空组合的交易
newTrade.StartDay = item.StartDate?.ToString("yyyy-MM-dd");
newTrade.DueDate = item.ExerciseDate?.ToString("yyyy-MM-dd");
newTrade.UndrlygAssetName = item.UnderlyingName;
newTrade.UndrlygAssetCode = item.UnderlyingCode;
newTrade.MaitainMarginRation = (item.PositionMarginRate * 100).ToString("0.00");
var longShort = item.trade_swap?.GetLongShort ?? item.trade_swap?.PayLongShort;
if (longShort == "空头")
{
newTrade.ShortPositionContractValue = (item.Pv).ToString("0.00");
}
else
{
newTrade.LongPositionContractValue = (item.Pv).ToString("0.00");
}
newTrade.UndrlygAssetTradgPlc = string.IsNullOrWhiteSpace(item.MarketName) ? "其他" : item.MarketName;
switch (ConsGlobal.InstrumentType.GetDesc(item.UnderlyingInstrumentType))
{
case "股票":
newTrade.SumInvestmentTargetType = UndrlygAssetTypeMap["权益类"];
break;
case "股指期货":
case "商品期货":
case "商品现货":
newTrade.SumInvestmentTargetType = UndrlygAssetTypeMap["大宗商品"];
break;
default:
newTrade.SumInvestmentTargetType = UndrlygAssetTypeMap["其他"];
break;
}
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Add(newTrade);
}
model.TargetCaseAndHedgeTuple = new List<TargetCaseAndHedgeModel>();
var eodtradeposition =
(from ep in db.eod_trade_position
join um in db.underlying_manager on ep.UnderlyingCode equals um.UnderlyingCode
where ep.ValueDate == _reqInfo.SACReportDate.Value && ep.ClientId == 0
select new { ep, um })
.ToArray().GroupBy(O => O.ep.TradeType == "股票" ? O.ep.UnderlyingCode : O.um.CommodityCode)
.Select(O => new
{
O.Key,
Amount = O.Sum(B => B.ep.Amount * (B.ep.PositionType == "long" ? 1 : -1)),
Cost = O.Sum(B => B.ep.Cost * (B.ep.PositionType == "long" ? 1 : -1)),
O.FirstOrDefault()?.ep.TradeType,
O.FirstOrDefault()?.um.UnderlyingInstrumentType,
O.FirstOrDefault()?.um.CommodityCode,
O.FirstOrDefault()?.um.UnderlyingCode,
O.FirstOrDefault()?.um.MarketName,
}).ToArray();
foreach (var item in eodtradeposition)
{
var info = new TargetCaseAndHedgeModel();
info.NameOfSecuritiesCompany = config.SuperviseMainName;
switch (ConsGlobal.InstrumentType.GetDesc(item.UnderlyingInstrumentType))
{
case "股票":
info.SumInvestmentTargetType = HedgeSACUndrlygAssetDtldTypeMap["权益类"];
break;
case "股指期货":
case "商品期货":
case "商品现货":
info.SumInvestmentTargetType = HedgeSACUndrlygAssetDtldTypeMap["大宗商品"];
break;
default:
info.SumInvestmentTargetType = HedgeSACUndrlygAssetDtldTypeMap["其他"];
break;
}
switch (item.TradeType)
{
case "收益互换":
info.BusinessType = BusinessTypeMap["互换"];
break;
default:
info.BusinessType = BusinessTypeMap["期权"];
break;
}
info.SumInvestmentTargetName = item.Key;
info.UndrlygAssetCode = item.UnderlyingCode;
info.UndrlygAssetTradgPlc = item.MarketName;
info.BuyingImpulseVolume = "0";
info.SellingImpulseVolume = "0";
info.ImpulseVolume = "0";
info.PositionAtTheEndOfThisMonth = item.Cost.ToString();
info.TheNumberOfPositionsHeldAtTheEndOfThisMonth = item.Amount.ToString();
info.AveragePriceAtTheEndOfTheMonth = (item.Cost / item.Amount).ToString();
model.TargetCaseAndHedgeTuple.Add(info);
}
}
}
return model;
}
private PeriodicReportSACModel GetPeriodicReportSACFromExcelAndDb()
{
var dbInfo = GetPeriodicReportSACFromDb();
var excelInfo = GetPeriodicReportSACFromExcel();
var model = new PeriodicReportSACModel();
model.Year = _reqInfo.SACReportDate.Value.Year.ToString("0000");
model.Month = _reqInfo.SACReportDate.Value.Month.ToString("0");
model.MainAgreementAddedThisMonth = Sum(dbInfo.MainAgreementAddedThisMonth, excelInfo.MainAgreementAddedThisMonth);
model.MainAgreementAccumulatedThisYear = Sum(dbInfo.MainAgreementAccumulatedThisYear, excelInfo.MainAgreementAccumulatedThisYear);
model.MainAgreementValidedAtEndOfThisMonth = Sum(dbInfo.MainAgreementValidedAtEndOfThisMonth, excelInfo.MainAgreementValidedAtEndOfThisMonth);
model.SupplementalAgreementAddedThisMonth = Sum(dbInfo.SupplementalAgreementAddedThisMonth, excelInfo.SupplementalAgreementAddedThisMonth);
model.SupplementalAgreementAccumulatedThisYear = Sum(dbInfo.SupplementalAgreementAccumulatedThisYear, excelInfo.SupplementalAgreementAccumulatedThisYear);
model.SupplementalAgreementValidedAtTheEndOfThisMonth = Sum(dbInfo.SupplementalAgreementValidedAtTheEndOfThisMonth, excelInfo.SupplementalAgreementValidedAtTheEndOfThisMonth);
model.PerformanceGuaranteeAgreementAddedThisMonth = Sum(dbInfo.PerformanceGuaranteeAgreementAddedThisMonth, excelInfo.PerformanceGuaranteeAgreementAddedThisMonth);
model.PerformanceGuaranteeAgreementAccumulatedThisYear = Sum(dbInfo.PerformanceGuaranteeAgreementAccumulatedThisYear, excelInfo.PerformanceGuaranteeAgreementAccumulatedThisYear);
model.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth = Sum(dbInfo.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth, excelInfo.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth);
model.TransactionConfirmationAddedThisMonth = Sum(dbInfo.TransactionConfirmationAddedThisMonth, excelInfo.TransactionConfirmationAddedThisMonth);
model.TransactionConfirmationBookAccumulatedThisYear = Sum(dbInfo.TransactionConfirmationBookAccumulatedThisYear, excelInfo.TransactionConfirmationBookAccumulatedThisYear);
model.TransactionConfirmationValidedAtEndOfThisMonth = Sum(dbInfo.TransactionConfirmationValidedAtEndOfThisMonth, excelInfo.TransactionConfirmationValidedAtEndOfThisMonth);
model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence = Sum(dbInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence, excelInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence);
model.NetCapitalAtEndOfTheMonth = Sum(dbInfo.NetCapitalAtEndOfTheMonth, excelInfo.NetCapitalAtEndOfTheMonth);
model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital = Sum(dbInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital, excelInfo.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital);
model.OTCOptionHasSignedByLegalPerson = Sum(dbInfo.OTCOptionHasSignedByLegalPerson, excelInfo.OTCOptionHasSignedByLegalPerson);
model.OTCOptionsHaveContractedProducts = Sum(dbInfo.OTCOptionsHaveContractedProducts, excelInfo.OTCOptionsHaveContractedProducts);
model.OTCOptionsForTheMonthOfTheNewAddLegalPerson = Sum(dbInfo.OTCOptionsForTheMonthOfTheNewAddLegalPerson, excelInfo.OTCOptionsForTheMonthOfTheNewAddLegalPerson);
model.OTCOptionsForTheMonthOfTheNewAddProduct = Sum(dbInfo.OTCOptionsForTheMonthOfTheNewAddProduct, excelInfo.OTCOptionsForTheMonthOfTheNewAddProduct);
model.OTCOptionsLegalPersonInDurationForThisMouth = Sum(dbInfo.OTCOptionsLegalPersonInDurationForThisMouth, excelInfo.OTCOptionsLegalPersonInDurationForThisMouth);
model.OTCOptionsProductsInDurationForThisMouth = Sum(dbInfo.OTCOptionsProductsInDurationForThisMouth, excelInfo.OTCOptionsProductsInDurationForThisMouth);
model.IncomeSwapHasSignedLegalPersonNumber = Sum(dbInfo.IncomeSwapHasSignedLegalPersonNumber, excelInfo.IncomeSwapHasSignedLegalPersonNumber);
model.IncomeSwapHasSignedProductNumber = Sum(dbInfo.IncomeSwapHasSignedProductNumber, excelInfo.IncomeSwapHasSignedProductNumber);
model.IncomeSwapForTheMonthOfTheNewAddLegalPerson = Sum(dbInfo.IncomeSwapForTheMonthOfTheNewAddLegalPerson, excelInfo.IncomeSwapForTheMonthOfTheNewAddLegalPerson);
model.IncomeSwapForTheMonthOfTheNewAddProduct = Sum(dbInfo.IncomeSwapForTheMonthOfTheNewAddProduct, excelInfo.IncomeSwapForTheMonthOfTheNewAddProduct);
model.IncomeSwapLegalPersonInDurationForThisMouth = Sum(dbInfo.IncomeSwapLegalPersonInDurationForThisMouth, excelInfo.IncomeSwapLegalPersonInDurationForThisMouth);
model.IncomeSwapProductsInDurationForThisMouth = Sum(dbInfo.IncomeSwapProductsInDurationForThisMouth, excelInfo.IncomeSwapProductsInDurationForThisMouth);
model.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale = Sum(dbInfo.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale, excelInfo.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale);
model.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale = Sum(dbInfo.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale, excelInfo.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale);
model.OTCOptionsCommoditiesLastMonthDurationScale = Sum(dbInfo.OTCOptionsCommoditiesLastMonthDurationScale, excelInfo.OTCOptionsCommoditiesLastMonthDurationScale);
model.OTCOptionsOtherSubjectLastMonthDurationScale = Sum(dbInfo.OTCOptionsOtherSubjectLastMonthDurationScale, excelInfo.OTCOptionsOtherSubjectLastMonthDurationScale);
model.RevenueExchangeDomesticStockIndexLastMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticStockIndexLastMonthDurationScale, excelInfo.RevenueExchangeDomesticStockIndexLastMonthDurationScale);
model.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale, excelInfo.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale);
model.RevenueExchangeCommoditiesLastMonthDurationScale = Sum(dbInfo.RevenueExchangeCommoditiesLastMonthDurationScale, excelInfo.RevenueExchangeCommoditiesLastMonthDurationScale);
model.RevenueExchangeOtherSubjectLastMonthDurationScale = Sum(dbInfo.RevenueExchangeOtherSubjectLastMonthDurationScale, excelInfo.RevenueExchangeOtherSubjectLastMonthDurationScale);
model.TotalOfLastMonthDurationScale = Sum(dbInfo.TotalOfLastMonthDurationScale, excelInfo.TotalOfLastMonthDurationScale);
model.OTCOptionsWithinTheIndexThisMonthOfTheNewScale = Sum(dbInfo.OTCOptionsWithinTheIndexThisMonthOfTheNewScale, excelInfo.OTCOptionsWithinTheIndexThisMonthOfTheNewScale);
model.OTCOptionsToAddScaleDomesticStocksInThisMonth = Sum(dbInfo.OTCOptionsToAddScaleDomesticStocksInThisMonth, excelInfo.OTCOptionsToAddScaleDomesticStocksInThisMonth);
model.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth, excelInfo.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth);
model.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth, excelInfo.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth);
model.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth);
model.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth);
model.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth);
model.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth, excelInfo.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth);
model.TotalOfTheNewSizeOfTheIncreaseInThisMonth = Sum(dbInfo.TotalOfTheNewSizeOfTheIncreaseInThisMonth, excelInfo.TotalOfTheNewSizeOfTheIncreaseInThisMonth);
model.OTCOptionsTerminateScaleDomesticStockIndexThisMonth = Sum(dbInfo.OTCOptionsTerminateScaleDomesticStockIndexThisMonth, excelInfo.OTCOptionsTerminateScaleDomesticStockIndexThisMonth);
model.OTCOptionsTerminateScaleDomesticStocksInThisMonth = Sum(dbInfo.OTCOptionsTerminateScaleDomesticStocksInThisMonth, excelInfo.OTCOptionsTerminateScaleDomesticStocksInThisMonth);
model.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth = Sum(dbInfo.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth, excelInfo.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth);
model.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth = Sum(dbInfo.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth, excelInfo.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth);
model.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth);
model.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth);
model.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth);
model.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth = Sum(dbInfo.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth, excelInfo.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth);
model.TotalOfTerminationOfTheScaleOfThisMonth = Sum(dbInfo.TotalOfTerminationOfTheScaleOfThisMonth, excelInfo.TotalOfTerminationOfTheScaleOfThisMonth);
model.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale = Sum(dbInfo.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale, excelInfo.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale);
model.OTCOptionsWithinIndividualStocksInThisMonthDurationScale = Sum(dbInfo.OTCOptionsWithinIndividualStocksInThisMonthDurationScale, excelInfo.OTCOptionsWithinIndividualStocksInThisMonthDurationScale);
model.OTCOptionsCommoditiesInThisMonthDurationScale = Sum(dbInfo.OTCOptionsCommoditiesInThisMonthDurationScale, excelInfo.OTCOptionsCommoditiesInThisMonthDurationScale);
model.OTCOptionsOtherSubjectThisMonthDurationScale = Sum(dbInfo.OTCOptionsOtherSubjectThisMonthDurationScale, excelInfo.OTCOptionsOtherSubjectThisMonthDurationScale);
model.RevenueExchangeDomesticStockIndexThisMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticStockIndexThisMonthDurationScale, excelInfo.RevenueExchangeDomesticStockIndexThisMonthDurationScale);
model.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale = Sum(dbInfo.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale, excelInfo.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale);
model.RevenueExchangeCommoditiesThisMonthDurationScale = Sum(dbInfo.RevenueExchangeCommoditiesThisMonthDurationScale, excelInfo.RevenueExchangeCommoditiesThisMonthDurationScale);
model.RevenueExchangeOtherSubjectThisMonthDurationScale = Sum(dbInfo.RevenueExchangeOtherSubjectThisMonthDurationScale, excelInfo.RevenueExchangeOtherSubjectThisMonthDurationScale);
model.TotalOfThisMonthDurationScale = Sum(dbInfo.TotalOfThisMonthDurationScale, excelInfo.TotalOfThisMonthDurationScale);
model.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory);
model.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory);
model.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory);
model.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory = Sum(dbInfo.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory, excelInfo.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory);
model.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear, excelInfo.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear);
model.IncomeSwapDomesticStockHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapDomesticStockHasAddedNewScaleInThisYear, excelInfo.IncomeSwapDomesticStockHasAddedNewScaleInThisYear);
model.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear, excelInfo.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear);
model.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear = Sum(dbInfo.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear, excelInfo.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear);
model.TotalNewScaleInThisYear = Sum(dbInfo.TotalNewScaleInThisYear, excelInfo.TotalNewScaleInThisYear);
model.OTCOptionsStockIndexAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsStockIndexAtTheEndOfLastMonth, excelInfo.OTCOptionsStockIndexAtTheEndOfLastMonth);
model.OTCOptionsStockAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsStockAtTheEndOfLastMonth, excelInfo.OTCOptionsStockAtTheEndOfLastMonth);
model.OTCOptionsCommoditiesAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsCommoditiesAtTheEndOfLastMonth, excelInfo.OTCOptionsCommoditiesAtTheEndOfLastMonth);
model.OTCOptionsOtherSubjectAtTheEndOfLastMonth = Sum(dbInfo.OTCOptionsOtherSubjectAtTheEndOfLastMonth, excelInfo.OTCOptionsOtherSubjectAtTheEndOfLastMonth);
model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth);
model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth);
model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth);
model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth = Sum(dbInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth, excelInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth);
model.TotalNumberOfContractsAtTheEndOfLastMonth = Sum(dbInfo.TotalNumberOfContractsAtTheEndOfLastMonth, excelInfo.TotalNumberOfContractsAtTheEndOfLastMonth);
model.OTCOptionsStockIndexThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsStockIndexThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsStockIndexThisMonthNewDomesticContractNumber);
model.OTCOptionsStockThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsStockThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsStockThisMonthNewDomesticContractNumber);
model.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber);
model.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber = Sum(dbInfo.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber, excelInfo.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber);
model.IncomeSwapDomesticStockIndexNewContractInThisMonth = Sum(dbInfo.IncomeSwapDomesticStockIndexNewContractInThisMonth, excelInfo.IncomeSwapDomesticStockIndexNewContractInThisMonth);
model.IncomeSwapDomesticStockNewContractInThisMonth = Sum(dbInfo.IncomeSwapDomesticStockNewContractInThisMonth, excelInfo.IncomeSwapDomesticStockNewContractInThisMonth);
model.IncomeSwapCommoditiesNewContractInThisMonth = Sum(dbInfo.IncomeSwapCommoditiesNewContractInThisMonth, excelInfo.IncomeSwapCommoditiesNewContractInThisMonth);
model.IncomeSwapOtherSubjectNewContractInThisMonth = Sum(dbInfo.IncomeSwapOtherSubjectNewContractInThisMonth, excelInfo.IncomeSwapOtherSubjectNewContractInThisMonth);
model.TotalNumberOfNewContractsInThisMonth = Sum(dbInfo.TotalNumberOfNewContractsInThisMonth, excelInfo.TotalNumberOfNewContractsInThisMonth);
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber);
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber);
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber);
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber = Sum(dbInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber, excelInfo.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber);
model.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth);
model.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth);
model.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth);
model.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth = Sum(dbInfo.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth, excelInfo.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth);
model.TotalNumberOfContractsTerminatedThisMonth = Sum(dbInfo.TotalNumberOfContractsTerminatedThisMonth, excelInfo.TotalNumberOfContractsTerminatedThisMonth);
model.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth);
model.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth);
model.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth);
model.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth);
model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth);
model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth);
model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth);
model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = Sum(dbInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth, excelInfo.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth);
model.TotalNumberOfContractsAtTheEndOfThisMonth = Sum(dbInfo.TotalNumberOfContractsAtTheEndOfThisMonth, excelInfo.TotalNumberOfContractsAtTheEndOfThisMonth);
model.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear);
model.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear);
model.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear);
model.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear = Sum(dbInfo.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear, excelInfo.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear);
model.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear);
model.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear);
model.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear);
model.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear = Sum(dbInfo.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear, excelInfo.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear);
model.TotalNumberOfNewContractsInThisYear = Sum(dbInfo.TotalNumberOfNewContractsInThisYear, excelInfo.TotalNumberOfNewContractsInThisYear);
model.MarginOfSubsistSwap = Sum(dbInfo.MarginOfSubsistSwap, excelInfo.MarginOfSubsistSwap);
model.HedgedMarketValueOfSwap = Sum(dbInfo.HedgedMarketValueOfSwap, excelInfo.HedgedMarketValueOfSwap);
model.LeverageRatiOfSwap = Sum(dbInfo.LeverageRatiOfSwap, excelInfo.LeverageRatiOfSwap);
model.MarginOfSubsistStockIndexSwap = Sum(dbInfo.MarginOfSubsistStockIndexSwap, excelInfo.MarginOfSubsistStockIndexSwap);
model.HedgedMarketValueOfStockIndexSwap = Sum(dbInfo.HedgedMarketValueOfStockIndexSwap, excelInfo.HedgedMarketValueOfStockIndexSwap);
model.LeverageRatioOfStockIndexSwap = Sum(dbInfo.LeverageRatioOfStockIndexSwap, excelInfo.LeverageRatioOfStockIndexSwap);
model.MarginOfSubsistStockSwap = Sum(dbInfo.MarginOfSubsistStockSwap, excelInfo.MarginOfSubsistStockSwap);
model.HedgedMarketValueOfStockSwap = Sum(dbInfo.HedgedMarketValueOfStockSwap, excelInfo.HedgedMarketValueOfStockSwap);
model.LeverageRatioOfStockSwap = Sum(dbInfo.LeverageRatioOfStockSwap, excelInfo.LeverageRatioOfStockSwap);
model.MarginandPremiumOfSubsistOption = Sum(dbInfo.MarginandPremiumOfSubsistOption, excelInfo.MarginandPremiumOfSubsistOption);
model.HedgedMarketValueOfOption = Sum(dbInfo.HedgedMarketValueOfOption, excelInfo.HedgedMarketValueOfOption);
model.LeverageRatioOfOption = Sum(dbInfo.LeverageRatioOfOption, excelInfo.LeverageRatioOfOption);
model.MarginandPremiumOfSubsistStockIndexOption = Sum(dbInfo.MarginandPremiumOfSubsistStockIndexOption, excelInfo.MarginandPremiumOfSubsistStockIndexOption);
model.HedgedMarketValueOfStockIndexOption = Sum(dbInfo.HedgedMarketValueOfStockIndexOption, excelInfo.HedgedMarketValueOfStockIndexOption);
model.LeverageRatioOfStockIndexOption = Sum(dbInfo.LeverageRatioOfStockIndexOption, excelInfo.LeverageRatioOfStockIndexOption);
model.MarginandPremiumOfSubsistStockOption = Sum(dbInfo.MarginandPremiumOfSubsistStockOption, excelInfo.MarginandPremiumOfSubsistStockOption);
model.HedgedMarketValueOfStockOption = Sum(dbInfo.HedgedMarketValueOfStockOption, excelInfo.HedgedMarketValueOfStockOption);
model.LeverageRatioOfStockOption = Sum(dbInfo.LeverageRatioOfStockOption, excelInfo.LeverageRatioOfStockOption);
model.TotalNominalPrincipalAmountOfSwapThisMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfSwapThisMonth, excelInfo.TotalNominalPrincipalAmountOfSwapThisMonth);
model.TotalNominalPrincipalAmountOfSwapLastMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfSwapLastMonth, excelInfo.TotalNominalPrincipalAmountOfSwapLastMonth);
model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = Sum(dbInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth, excelInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth);
model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = Sum(dbInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth, excelInfo.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth);
model.SwapCashCollateralValueThisMonth = Sum(dbInfo.SwapCashCollateralValueThisMonth, excelInfo.SwapCashCollateralValueThisMonth);
model.SwapCashCollateralValueLastMonth = Sum(dbInfo.SwapCashCollateralValueLastMonth, excelInfo.SwapCashCollateralValueLastMonth);
model.SwapSecuritiesCollateralValueThisMonth = Sum(dbInfo.SwapSecuritiesCollateralValueThisMonth, excelInfo.SwapSecuritiesCollateralValueThisMonth);
model.SwapSecuritiesCollateralValueLastMonthThisMonth = Sum(dbInfo.SwapSecuritiesCollateralValueLastMonthThisMonth, excelInfo.SwapSecuritiesCollateralValueLastMonthThisMonth);
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull);
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull);
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet);
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet);
model.SwapNumberOfDefaultCustomersAtThisMonthThisMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersAtThisMonthThisMonth, excelInfo.SwapNumberOfDefaultCustomersAtThisMonthThisMonth);
model.SwapNumberOfDefaultCustomersAtThisMonthLastMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersAtThisMonthLastMonth, excelInfo.SwapNumberOfDefaultCustomersAtThisMonthLastMonth);
model.SwapDefaultTransactionNumberAtThisMonthThisMonth = Sum(dbInfo.SwapDefaultTransactionNumberAtThisMonthThisMonth, excelInfo.SwapDefaultTransactionNumberAtThisMonthThisMonth);
model.SwapDefaultTransactionNumberAtThisMonthLastMonth = Sum(dbInfo.SwapDefaultTransactionNumberAtThisMonthLastMonth, excelInfo.SwapDefaultTransactionNumberAtThisMonthLastMonth);
model.TotalSwapDefaultCustomerNumberInThisYearThisMonth = Sum(dbInfo.TotalSwapDefaultCustomerNumberInThisYearThisMonth, excelInfo.TotalSwapDefaultCustomerNumberInThisYearThisMonth);
model.TotalSwapDefaultCustomerNumberInThisYearLastMonth = Sum(dbInfo.TotalSwapDefaultCustomerNumberInThisYearLastMonth, excelInfo.TotalSwapDefaultCustomerNumberInThisYearLastMonth);
model.SwapNumberOfDefaultCustomersInThisYearThisMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersInThisYearThisMonth, excelInfo.SwapNumberOfDefaultCustomersInThisYearThisMonth);
model.SwapNumberOfDefaultCustomersInThisYearLastMonth = Sum(dbInfo.SwapNumberOfDefaultCustomersInThisYearLastMonth, excelInfo.SwapNumberOfDefaultCustomersInThisYearLastMonth);
model.TotalNominalPrincipalAmountOfOptionThisMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfOptionThisMonth, excelInfo.TotalNominalPrincipalAmountOfOptionThisMonth);
model.TotalNominalPrincipalAmountOfOptionLastMonth = Sum(dbInfo.TotalNominalPrincipalAmountOfOptionLastMonth, excelInfo.TotalNominalPrincipalAmountOfOptionLastMonth);
model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = Sum(dbInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth, excelInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth);
model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = Sum(dbInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth, excelInfo.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth);
model.OptionCashCollateralValueThisMonth = Sum(dbInfo.OptionCashCollateralValueThisMonth, excelInfo.OptionCashCollateralValueThisMonth);
model.OptionCashCollateralValueLastMonth = Sum(dbInfo.OptionCashCollateralValueLastMonth, excelInfo.OptionCashCollateralValueLastMonth);
model.OptionSecuritiesCollateralValueThisMonth = Sum(dbInfo.OptionSecuritiesCollateralValueThisMonth, excelInfo.OptionSecuritiesCollateralValueThisMonth);
model.OptionSecuritiesCollateralValueLastMonth = Sum(dbInfo.OptionSecuritiesCollateralValueLastMonth, excelInfo.OptionSecuritiesCollateralValueLastMonth);
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull);
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull);
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet);
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet = Sum(dbInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet, excelInfo.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet);
model.OptionNumberOfDefaultCustomersAtThisMonthThisMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersAtThisMonthThisMonth, excelInfo.OptionNumberOfDefaultCustomersAtThisMonthThisMonth);
model.OptionNumberOfDefaultCustomersAtThisMonthLastMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersAtThisMonthLastMonth, excelInfo.OptionNumberOfDefaultCustomersAtThisMonthLastMonth);
model.OptionTransactionNumberAtThisMonthThisMonth = Sum(dbInfo.OptionTransactionNumberAtThisMonthThisMonth, excelInfo.OptionTransactionNumberAtThisMonthThisMonth);
model.OptionTransactionNumberAtThisMonthLastMonth = Sum(dbInfo.OptionTransactionNumberAtThisMonthLastMonth, excelInfo.OptionTransactionNumberAtThisMonthLastMonth);
model.TotalOptionDefaultCustomerNumberInThisYearThisMonth = Sum(dbInfo.TotalOptionDefaultCustomerNumberInThisYearThisMonth, excelInfo.TotalOptionDefaultCustomerNumberInThisYearThisMonth);
model.TotalOptionDefaultCustomerNumberInThisYearLastMonth = Sum(dbInfo.TotalOptionDefaultCustomerNumberInThisYearLastMonth, excelInfo.TotalOptionDefaultCustomerNumberInThisYearLastMonth);
model.OptionNumberOfDefaultCustomersInThisYearThisMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersInThisYearThisMonth, excelInfo.OptionNumberOfDefaultCustomersInThisYearThisMonth);
model.OptionNumberOfDefaultCustomersInThisYearLastMonth = Sum(dbInfo.OptionNumberOfDefaultCustomersInThisYearLastMonth, excelInfo.OptionNumberOfDefaultCustomersInThisYearLastMonth);
model.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth = Sum(dbInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth, excelInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth);
model.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth = Sum(dbInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth, excelInfo.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth);
model.CashBalanceAtEndOfThisMonth = Sum(dbInfo.CashBalanceAtEndOfThisMonth, excelInfo.CashBalanceAtEndOfThisMonth);
model.CashBalanceAtEndOfLastMonth = Sum(dbInfo.CashBalanceAtEndOfLastMonth, excelInfo.CashBalanceAtEndOfLastMonth);
model.HoldStockMarketValueAtEndOfThisMonth = Sum(dbInfo.HoldStockMarketValueAtEndOfThisMonth, excelInfo.HoldStockMarketValueAtEndOfThisMonth);
model.HoldStockMarketValueAtEndOfLastMonth = Sum(dbInfo.HoldStockMarketValueAtEndOfLastMonth, excelInfo.HoldStockMarketValueAtEndOfLastMonth);
model.HoldMarketValueOfBondsAtTheEndOfThisMonth = Sum(dbInfo.HoldMarketValueOfBondsAtTheEndOfThisMonth, excelInfo.HoldMarketValueOfBondsAtTheEndOfThisMonth);
model.HoldMarketValueOfBondsAtTheEndOfLastMonth = Sum(dbInfo.HoldMarketValueOfBondsAtTheEndOfLastMonth, excelInfo.HoldMarketValueOfBondsAtTheEndOfLastMonth);
model.OwnedAssetManagementProductsAtTheEndOfThisMonth = Sum(dbInfo.OwnedAssetManagementProductsAtTheEndOfThisMonth, excelInfo.OwnedAssetManagementProductsAtTheEndOfThisMonth);
model.OwnedAssetManagementProductsAtTheEndOfLastMonth = Sum(dbInfo.OwnedAssetManagementProductsAtTheEndOfLastMonth, excelInfo.OwnedAssetManagementProductsAtTheEndOfLastMonth);
model.OwnedBankFinanceAtTheEndOfThisMonth = Sum(dbInfo.OwnedBankFinanceAtTheEndOfThisMonth, excelInfo.OwnedBankFinanceAtTheEndOfThisMonth);
model.OwnedBankFinanceAtTheEndOfLastMonth = Sum(dbInfo.OwnedBankFinanceAtTheEndOfLastMonth, excelInfo.OwnedBankFinanceAtTheEndOfLastMonth);
model.HoldTrustProductAtTheEndOfThisMonth = Sum(dbInfo.HoldTrustProductAtTheEndOfThisMonth, excelInfo.HoldTrustProductAtTheEndOfThisMonth);
model.HoldTrustProductAtTheEndOfLastMonth = Sum(dbInfo.HoldTrustProductAtTheEndOfLastMonth, excelInfo.HoldTrustProductAtTheEndOfLastMonth);
model.InsuranceProductsAreHeldAtTheEndOfThisMonth = Sum(dbInfo.InsuranceProductsAreHeldAtTheEndOfThisMonth, excelInfo.InsuranceProductsAreHeldAtTheEndOfThisMonth);
model.InsuranceProductsAreHeldAtTheEndOfLastMonth = Sum(dbInfo.InsuranceProductsAreHeldAtTheEndOfLastMonth, excelInfo.InsuranceProductsAreHeldAtTheEndOfLastMonth);
model.HoldOtherProductsAtTheEndOfThisMonth = Sum(dbInfo.HoldOtherProductsAtTheEndOfThisMonth, excelInfo.HoldOtherProductsAtTheEndOfThisMonth);
model.HoldOtherProductsAtTheEndOfLastMonth = Sum(dbInfo.HoldOtherProductsAtTheEndOfLastMonth, excelInfo.HoldOtherProductsAtTheEndOfLastMonth);
model.SettledSwapItemsAtThisMonth = Sum(dbInfo.SettledSwapItemsAtThisMonth, excelInfo.SettledSwapItemsAtThisMonth);
model.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth = Sum(dbInfo.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth, excelInfo.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth);
model.SwapIncomeCashFlow = Sum(dbInfo.SwapIncomeCashFlow, excelInfo.SwapIncomeCashFlow);
model.SwapExpensesCashFlow = Sum(dbInfo.SwapExpensesCashFlow, excelInfo.SwapExpensesCashFlow);
model.CashFlowCorrespondingToNetIncomeOnSwapMargin = Sum(dbInfo.CashFlowCorrespondingToNetIncomeOnSwapMargin, excelInfo.CashFlowCorrespondingToNetIncomeOnSwapMargin);
model.SwapHedgeCost = Sum(dbInfo.SwapHedgeCost, excelInfo.SwapHedgeCost);
model.SettledOptionItemsAtThisMonth = Sum(dbInfo.SettledOptionItemsAtThisMonth, excelInfo.SettledOptionItemsAtThisMonth);
model.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth = Sum(dbInfo.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth, excelInfo.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth);
model.OptionPremiumIncome = Sum(dbInfo.OptionPremiumIncome, excelInfo.OptionPremiumIncome);
model.OptionHedgeCost = Sum(dbInfo.OptionHedgeCost, excelInfo.OptionHedgeCost);
model.BalanceOfSwapRealizedGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfSwapRealizedGainsAndLossesAtThisMonth, excelInfo.BalanceOfSwapRealizedGainsAndLossesAtThisMonth);
model.BalanceOfOptionRealizedGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfOptionRealizedGainsAndLossesAtThisMonth, excelInfo.BalanceOfOptionRealizedGainsAndLossesAtThisMonth);
model.BalanceOfSwapRealizedGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfSwapRealizedGainsAndLossesAtThisYear, excelInfo.BalanceOfSwapRealizedGainsAndLossesAtThisYear);
model.BalanceOfOptionRealizedGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfOptionRealizedGainsAndLossesAtThisYear, excelInfo.BalanceOfOptionRealizedGainsAndLossesAtThisYear);
model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = Sum(dbInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth, excelInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth);
model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = Sum(dbInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth, excelInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth);
model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = Sum(dbInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear, excelInfo.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear);
model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = Sum(dbInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear, excelInfo.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear);
model.BalanceOfSwapTotalGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfSwapTotalGainsAndLossesAtThisMonth, excelInfo.BalanceOfSwapTotalGainsAndLossesAtThisMonth);
model.BalanceOfOptionTotalGainsAndLossesAtThisMonth = Sum(dbInfo.BalanceOfOptionTotalGainsAndLossesAtThisMonth, excelInfo.BalanceOfOptionTotalGainsAndLossesAtThisMonth);
model.BalanceOfSwapTotalGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfSwapTotalGainsAndLossesAtThisYear, excelInfo.BalanceOfSwapTotalGainsAndLossesAtThisYear);
model.BalanceOfOptionTotalGainsAndLossesAtThisYear = Sum(dbInfo.BalanceOfOptionTotalGainsAndLossesAtThisYear, excelInfo.BalanceOfOptionTotalGainsAndLossesAtThisYear);
model.IncreaseBusinessDetailsThisMonthTuple = new List<IncreaseBusinessDetailsThisMonthModel>();
if (dbInfo.IncreaseBusinessDetailsThisMonthTuple != null)
{
model.IncreaseBusinessDetailsThisMonthTuple.AddRange(dbInfo.IncreaseBusinessDetailsThisMonthTuple);
}
if (excelInfo.IncreaseBusinessDetailsThisMonthTuple != null)
{
model.IncreaseBusinessDetailsThisMonthTuple.AddRange(excelInfo.IncreaseBusinessDetailsThisMonthTuple);
}
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple = new List<InventoryBusinessDetailsAtTheEndOfThisMonthModel>();
if (dbInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null)
{
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.AddRange(dbInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple);
}
if (excelInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null)
{
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.AddRange(excelInfo.InventoryBusinessDetailsAtTheEndOfThisMonthTuple);
}
model.TargetCaseAndHedgeTuple = new List<TargetCaseAndHedgeModel>();
if (dbInfo.TargetCaseAndHedgeTuple != null)
{
model.TargetCaseAndHedgeTuple.AddRange(dbInfo.TargetCaseAndHedgeTuple);
}
if (excelInfo.TargetCaseAndHedgeTuple != null)
{
model.TargetCaseAndHedgeTuple.AddRange(excelInfo.TargetCaseAndHedgeTuple);
}
return model;
}
private string Sum(string param1, string param2)
{
var status1 = double.TryParse(param1, out var v1);
var status2 = double.TryParse(param2, out var v2);
if (status1 || status2)
{
return (v1 + v2).ToString();
}
return "";
}
private PeriodicReportSACModel GetPeriodicReportSACFromExcel()
{
var model = new PeriodicReportSACModel();
if (_excelDataSource != null)
{
var dt = _excelDataSource.Tables["业务统计"];
if (string.IsNullOrWhiteSpace(GetDataSetValue(dt, 2, 1)))
{
return model;
}
model.Year = _reqInfo.SACReportDate.Value.Year.ToString("0000");
model.Month = _reqInfo.SACReportDate.Value.Month.ToString("0");
GetPotocolInfo(model, dt, 2, 1);
GetStockOptionBusinessInfo(model, dt, 12, 1);
GetClientInfo(model, dt, 19, 1);
GetExchangeInfo(model, dt, 28, 1);
GetLeverInfo(model, dt, 44, 2);
dt = _excelDataSource.Tables["履约担保情况"];
GetSwapPerformanceGuaranteeInfo(model, dt, 2, 1);
GetOptionPerformanceGuaranteeInfo(model, dt, 16, 1);
GetPerformanceGuaranteeInfo(model, dt, 30, 1);
dt = _excelDataSource.Tables["盈亏情况"];
GetSettleTradeWinlossInfo(model, dt, 2, 2);
GetWinlossInfo(model, dt, 17, 1);
model.IncreaseBusinessDetailsThisMonthTuple = new List<IncreaseBusinessDetailsThisMonthModel>();
model.IncreaseBusinessDetailsThisMonthTuple.AddRange(GetIncreaseBusinessDetailsThisMonthTuple());
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple = new List<InventoryBusinessDetailsAtTheEndOfThisMonthModel>();
model.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.AddRange(GetInventoryBusinessDetailsAtTheEndOfThisMonth());
model.TargetCaseAndHedgeTuple = new List<TargetCaseAndHedgeModel>();
model.TargetCaseAndHedgeTuple.AddRange(GetTargetCaseAndHedgeTuple());
}
return model;
}
/// <summary>
/// 获取本月了结交易盈亏情况统计
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetSettleTradeWinlossInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
model.SettledSwapItemsAtThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0).ToString();
model.SettledSwapTransactionInvolvesNotionalPrincipalAtThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0).ToString();
model.SwapIncomeCashFlow = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0).ToString();
model.SwapExpensesCashFlow = GetDataSetValueToDouble(dt, startRow + 3, startCol + 0).ToString();
model.CashFlowCorrespondingToNetIncomeOnSwapMargin = GetDataSetValueToDouble(dt, startRow + 4, startCol + 0).ToString();
model.SwapHedgeCost = GetDataSetValueToDouble(dt, startRow + 5, startCol + 0).ToString();
model.SettledOptionItemsAtThisMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 0).ToString();
model.SettledOptionTransactionInvolvesNotionalPrincipalAtThisMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 0).ToString();
model.OptionPremiumIncome = GetDataSetValueToDouble(dt, startRow + 8, startCol + 0).ToString();
model.OptionHedgeCost = GetDataSetValueToDouble(dt, startRow + 9, startCol + 0).ToString();
}
/// <summary>
/// 获取本月会计损益统计固定表格
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetWinlossInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
var balanceOfSwapRealizedGainsAndLossesAtThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0);
var balanceOfOptionRealizedGainsAndLossesAtThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1);
model.BalanceOfSwapRealizedGainsAndLossesAtThisMonth = balanceOfSwapRealizedGainsAndLossesAtThisMonth.ToString();
model.BalanceOfOptionRealizedGainsAndLossesAtThisMonth = balanceOfOptionRealizedGainsAndLossesAtThisMonth.ToString();
var balanceOfSwapRealizedGainsAndLossesAtThisYear = GetDataSetValueToDouble(dt, startRow + 0, startCol + 2);
var balanceOfOptionRealizedGainsAndLossesAtThisYear = GetDataSetValueToDouble(dt, startRow + 0, startCol + 3);
model.BalanceOfSwapRealizedGainsAndLossesAtThisYear = balanceOfSwapRealizedGainsAndLossesAtThisYear.ToString();
model.BalanceOfOptionRealizedGainsAndLossesAtThisYear = balanceOfOptionRealizedGainsAndLossesAtThisYear.ToString();
var balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0);
var balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 1);
model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth = balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth.ToString();
model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth = balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth.ToString();
var balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = GetDataSetValueToDouble(dt, startRow + 1, startCol + 2);
var balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = GetDataSetValueToDouble(dt, startRow + 1, startCol + 3);
model.BalanceOfSwapChangedGainsAndLossesInFairValueAtThisYear = balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear.ToString();
model.BalanceOfOptionChangedGainsAndLossesInFairValueAtThisYear = balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear.ToString();
var balanceOfSwapTotalGainsAndLossesAtThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0);
if (balanceOfSwapTotalGainsAndLossesAtThisMonth == 0)
{
balanceOfSwapTotalGainsAndLossesAtThisMonth = balanceOfSwapRealizedGainsAndLossesAtThisMonth + balanceOfSwapChangedGainsAndLossesInFairValueAtThisMonth;
}
var balanceOfOptionTotalGainsAndLossesAtThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 1);
if (balanceOfOptionTotalGainsAndLossesAtThisMonth == 0)
{
balanceOfOptionTotalGainsAndLossesAtThisMonth = balanceOfOptionRealizedGainsAndLossesAtThisMonth + balanceOfOptionChangedGainsAndLossesInFairValueAtThisMonth;
}
model.BalanceOfSwapTotalGainsAndLossesAtThisMonth = balanceOfSwapTotalGainsAndLossesAtThisMonth.ToString();
model.BalanceOfOptionTotalGainsAndLossesAtThisMonth = balanceOfOptionTotalGainsAndLossesAtThisMonth.ToString();
var balanceOfSwapTotalGainsAndLossesAtThisYear = GetDataSetValueToDouble(dt, startRow + 2, startCol + 2);
if (balanceOfSwapTotalGainsAndLossesAtThisYear == 0)
{
balanceOfSwapTotalGainsAndLossesAtThisYear = balanceOfSwapRealizedGainsAndLossesAtThisYear + balanceOfSwapChangedGainsAndLossesInFairValueAtThisYear;
}
var balanceOfOptionTotalGainsAndLossesAtThisYear = GetDataSetValueToDouble(dt, startRow + 2, startCol + 3);
if (balanceOfOptionTotalGainsAndLossesAtThisYear == 0)
{
balanceOfOptionTotalGainsAndLossesAtThisYear = balanceOfOptionRealizedGainsAndLossesAtThisYear + balanceOfOptionChangedGainsAndLossesInFairValueAtThisYear;
}
model.BalanceOfSwapTotalGainsAndLossesAtThisYear = balanceOfSwapTotalGainsAndLossesAtThisYear.ToString();
model.BalanceOfOptionTotalGainsAndLossesAtThisYear = balanceOfOptionTotalGainsAndLossesAtThisYear.ToString();
}
/// <summary>
/// 获取签署协议统计
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetPotocolInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
model.MainAgreementAddedThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0).ToString();
model.MainAgreementAccumulatedThisYear = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1).ToString();
model.MainAgreementValidedAtEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 2).ToString();
model.SupplementalAgreementAddedThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0).ToString();
model.SupplementalAgreementAccumulatedThisYear = GetDataSetValueToDouble(dt, startRow + 1, startCol + 1).ToString();
model.SupplementalAgreementValidedAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 2).ToString();
model.PerformanceGuaranteeAgreementAddedThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0).ToString();
model.PerformanceGuaranteeAgreementAccumulatedThisYear = GetDataSetValueToDouble(dt, startRow + 2, startCol + 1).ToString();
model.PerformanceGuaranteeAgreementValidedAtEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 2).ToString();
model.TransactionConfirmationAddedThisMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 0).ToString();
model.TransactionConfirmationBookAccumulatedThisYear = GetDataSetValueToDouble(dt, startRow + 3, startCol + 1).ToString();
model.TransactionConfirmationValidedAtEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 2).ToString();
}
/// <summary>
/// 场外个股期权业务规模情况
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetStockOptionBusinessInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
var totleStockEqvNotional = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0);
var latestNetAssets = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1);
var capitalRate = GetDataSetValueToDouble(dt, startRow + 0, startCol + 2);
if (capitalRate == 0)
{
capitalRate = latestNetAssets == 0 ? latestNetAssets : (totleStockEqvNotional / latestNetAssets * 100);
}
model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionBusinessCorrespondence = totleStockEqvNotional.ToString();
model.NetCapitalAtEndOfTheMonth = latestNetAssets.ToString();
model.ToCarryOutSelfEquitySecuritiesAndOTCDerivativesScaleStockOptionsBusinessAccountedForTheProportionOfTheCorrespondingNetCapital = capitalRate.ToString("0.00");
}
/// <summary>
/// 获取交易对手情况表(交易确认书)
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetClientInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
int row = startRow + 0;
model.OTCOptionHasSignedByLegalPerson = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsHaveContractedProducts = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsForTheMonthOfTheNewAddLegalPerson = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsForTheMonthOfTheNewAddProduct = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.OTCOptionsLegalPersonInDurationForThisMouth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.OTCOptionsProductsInDurationForThisMouth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
row = startRow + 1;
model.IncomeSwapHasSignedLegalPersonNumber = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.IncomeSwapHasSignedProductNumber = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.IncomeSwapForTheMonthOfTheNewAddLegalPerson = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.IncomeSwapForTheMonthOfTheNewAddProduct = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeSwapLegalPersonInDurationForThisMouth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeSwapProductsInDurationForThisMouth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
}
/// <summary>
/// 获取场外衍生品规模及标的情况
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
private void GetExchangeInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
int row = startRow + 0;
model.OTCStockIndexOptionsWithinTheLastMonthTheExistenceOfScale = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsWithinIndividualStocksLateLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.RevenueExchangeDomesticStockIndexLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.RevenueExchangeDomesticIndividualStocksLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.RevenueExchangeCommoditiesLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.RevenueExchangeOtherSubjectLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalOfLastMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 1;
model.OTCOptionsWithinTheIndexThisMonthOfTheNewScale = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsToAddScaleDomesticStocksInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.RevenueExchangeDomesticStockIndexTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.RevenueExchangeDomesticIndividualStocksTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.RevenueExchangeCommoditiesTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.RevenueExchangeOtherSubjectTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalOfTheNewSizeOfTheIncreaseInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 2;
model.OTCOptionsTerminateScaleDomesticStockIndexThisMonth = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsTerminateScaleDomesticStocksInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.RevenueExchangeDomesticStockIndexTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.RevenueExchangeDomesticIndividualStocksTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.RevenueExchangeCommoditiesTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.RevenueExchangeOtherSubjectTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalOfTerminationOfTheScaleOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 3;
model.OTCStockIndexOptionsWithinThisMonthOfTheExistenceOfScale = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsWithinIndividualStocksInThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesInThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.RevenueExchangeDomesticStockIndexThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.RevenueExchangeDomesticIndividualStocksThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.RevenueExchangeCommoditiesThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.RevenueExchangeOtherSubjectThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalOfThisMonthDurationScale = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 4;
model.OTCOptionsStockIndexThisYearCumulativeScaleOfNewTerritory = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsStockThisYearCumulativeScaleOfNewTerritory = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesThisYearCumulativeScaleOfNewTerritory = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectThisYearCumulativeScaleOfNewTerritory = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeSwapDomesticStockIndexHasAddedNewScaleInThisYear = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeSwapDomesticStockHasAddedNewScaleInThisYear = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.IncomeSwapCommoditiesIndexHasAddedNewScaleInThisYear = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.IncomeSwapOtherSubjectIndexHasAddedNewScaleInThisYear = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalNewScaleInThisYear = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 5;
model.OTCOptionsStockIndexAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsStockAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalNumberOfContractsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 6;
model.OTCOptionsStockIndexThisMonthNewDomesticContractNumber = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsStockThisMonthNewDomesticContractNumber = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesThisMonthNewDomesticContractNumber = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectThisMonthNewDomesticContractNumber = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeSwapDomesticStockIndexNewContractInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeSwapDomesticStockNewContractInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.IncomeSwapCommoditiesNewContractInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.IncomeSwapOtherSubjectNewContractInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalNumberOfNewContractsInThisMonth = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 7;
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockIndexNumber = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheStockNumber = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheCommoditiesNumber = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsThisMonthToTerminateTheContractWithinTheTerritoryOfTheOtherSubjectNumber = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeSwapDomesticStockIndexTerminatesTheNumberOfContractsThisMonth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeSwapDomesticStockTerminatesTheNumberOfContractsThisMonth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.IncomeSwapCommoditiesTerminatesTheNumberOfContractsThisMonth = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.IncomeSwapOtherSubjectTerminatesTheNumberOfContractsThisMonth = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalNumberOfContractsTerminatedThisMonth = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 8;
model.OTCDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeExchangeDomesticStockIndexNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeExchangeDomesticStockNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.IncomeExchangeCommoditiesNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.IncomeExchangeOtherSubjectNumberOfRemainingContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalNumberOfContractsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
row = startRow + 9;
model.OTCOptionsStockIndexCumulativeDomesticNewContractNumberInThisYear = GetDataSetValueToDouble(dt, row, startCol + 0).ToString();
model.OTCOptionsStockCumulativeDomesticNewContractNumberInThisYear = GetDataSetValueToDouble(dt, row, startCol + 1).ToString();
model.OTCOptionsCommoditiesCumulativeDomesticNewContractNumberInThisYear = GetDataSetValueToDouble(dt, row, startCol + 2).ToString();
model.OTCOptionsOtherSubjectCumulativeDomesticNewContractNumberInThisYear = GetDataSetValueToDouble(dt, row, startCol + 3).ToString();
model.IncomeSwapDomesticStockIndexCumulativeNumberOfNewContractsInThisYear = GetDataSetValueToDouble(dt, row, startCol + 4).ToString();
model.IncomeSwapDomesticStockCumulativeNumberOfNewContractsInThisYear = GetDataSetValueToDouble(dt, row, startCol + 5).ToString();
model.IncomeSwapCommoditiesCumulativeNumberOfNewContractsInThisYear = GetDataSetValueToDouble(dt, row, startCol + 6).ToString();
model.IncomeSwapOtherSubjectCumulativeNumberOfNewContractsInThisYear = GetDataSetValueToDouble(dt, row, startCol + 7).ToString();
model.TotalNumberOfNewContractsInThisYear = GetDataSetValueToDouble(dt, row, startCol + 8).ToString();
}
/// <summary>
/// 获取杠杆水平
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetLeverInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
model.MarginOfSubsistSwap = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0).ToString();
model.HedgedMarketValueOfSwap = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1).ToString();
model.LeverageRatiOfSwap = GetDataSetValueToDouble(dt, startRow + 0, startCol + 2).ToString();
model.MarginOfSubsistStockIndexSwap = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0).ToString();
model.HedgedMarketValueOfStockIndexSwap = GetDataSetValueToDouble(dt, startRow + 1, startCol + 1).ToString();
model.LeverageRatioOfStockIndexSwap = GetDataSetValueToDouble(dt, startRow + 1, startCol + 2).ToString();
model.MarginOfSubsistStockSwap = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0).ToString();
model.HedgedMarketValueOfStockSwap = GetDataSetValueToDouble(dt, startRow + 2, startCol + 1).ToString();
model.LeverageRatioOfStockSwap = GetDataSetValueToDouble(dt, startRow + 2, startCol + 2).ToString();
model.MarginandPremiumOfSubsistOption = GetDataSetValueToDouble(dt, startRow + 3, startCol + 0).ToString();
model.HedgedMarketValueOfOption = GetDataSetValueToDouble(dt, startRow + 3, startCol + 1).ToString();
model.LeverageRatioOfOption = GetDataSetValueToDouble(dt, startRow + 3, startCol + 2).ToString();
model.MarginandPremiumOfSubsistStockIndexOption = GetDataSetValueToDouble(dt, startRow + 4, startCol + 0).ToString();
model.HedgedMarketValueOfStockIndexOption = GetDataSetValueToDouble(dt, startRow + 4, startCol + 1).ToString();
model.LeverageRatioOfStockIndexOption = GetDataSetValueToDouble(dt, startRow + 4, startCol + 2).ToString();
model.MarginandPremiumOfSubsistStockOption = GetDataSetValueToDouble(dt, startRow + 5, startCol + 0).ToString();
model.HedgedMarketValueOfStockOption = GetDataSetValueToDouble(dt, startRow + 5, startCol + 1).ToString();
model.LeverageRatioOfStockOption = GetDataSetValueToDouble(dt, startRow + 5, startCol + 2).ToString();
}
/// <summary>
/// 获取收益互换类交易的履约担保品收取情况固定表格
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetSwapPerformanceGuaranteeInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
model.TotalNominalPrincipalAmountOfSwapThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0).ToString();
model.TotalNominalPrincipalAmountOfSwapLastMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1).ToString();
model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0).ToString();
model.TheValueOfTheStockSwapInTheCorrespondingPerformanceGuaranteeLastMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 1).ToString();
model.SwapCashCollateralValueThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0).ToString();
model.SwapCashCollateralValueLastMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 1).ToString();
model.SwapSecuritiesCollateralValueThisMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 0).ToString();
model.SwapSecuritiesCollateralValueLastMonthThisMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 1).ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthFull = GetDataSetValue(dt, startRow + 4, startCol + 0).ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthFull = GetDataSetValue(dt, startRow + 4, startCol + 1).ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessThisMonthNet = GetDataSetValue(dt, startRow + 5, startCol + 0).ToString();
model.ProportionOfTheOverallPerformanceOfTheSwapBusinessLastMonthNet = GetDataSetValue(dt, startRow + 5, startCol + 1).ToString();
model.SwapNumberOfDefaultCustomersAtThisMonthThisMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 0).ToString();
model.SwapNumberOfDefaultCustomersAtThisMonthLastMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 1).ToString();
model.SwapDefaultTransactionNumberAtThisMonthThisMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 0).ToString();
model.SwapDefaultTransactionNumberAtThisMonthLastMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 1).ToString();
model.TotalSwapDefaultCustomerNumberInThisYearThisMonth = GetDataSetValueToDouble(dt, startRow + 8, startCol + 0).ToString();
model.TotalSwapDefaultCustomerNumberInThisYearLastMonth = GetDataSetValueToDouble(dt, startRow + 8, startCol + 1).ToString();
model.SwapNumberOfDefaultCustomersInThisYearThisMonth = GetDataSetValueToDouble(dt, startRow + 9, startCol + 0).ToString();
model.SwapNumberOfDefaultCustomersInThisYearLastMonth = GetDataSetValueToDouble(dt, startRow + 9, startCol + 1).ToString();
}
/// <summary>
/// 获取场外期权类交易的履约担保品收取情况固定表格
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetOptionPerformanceGuaranteeInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
model.TotalNominalPrincipalAmountOfOptionThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0).ToString();
model.TotalNominalPrincipalAmountOfOptionLastMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1).ToString();
model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0).ToString();
model.TheValueOfTheStockOptionCorrespondingPerformanceGuaranteeLastMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 1).ToString();
model.OptionCashCollateralValueThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0).ToString();
model.OptionCashCollateralValueLastMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 1).ToString();
model.OptionSecuritiesCollateralValueThisMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 0).ToString();
model.OptionSecuritiesCollateralValueLastMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 1).ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthFull = GetDataSetValue(dt, startRow + 4, startCol + 0).ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthFull = GetDataSetValue(dt, startRow + 4, startCol + 1).ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessThisMonthNet = GetDataSetValue(dt, startRow + 5, startCol + 0).ToString();
model.ProportionOfTheOverallPerformanceOfTheOptionBusinessLastMonthNet = GetDataSetValue(dt, startRow + 5, startCol + 1).ToString();
model.OptionNumberOfDefaultCustomersAtThisMonthThisMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 0).ToString();
model.OptionNumberOfDefaultCustomersAtThisMonthLastMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 1).ToString();
model.OptionTransactionNumberAtThisMonthThisMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 0).ToString();
model.OptionTransactionNumberAtThisMonthLastMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 1).ToString();
model.TotalOptionDefaultCustomerNumberInThisYearThisMonth = GetDataSetValueToDouble(dt, startRow + 8, startCol + 0).ToString();
model.TotalOptionDefaultCustomerNumberInThisYearLastMonth = GetDataSetValueToDouble(dt, startRow + 8, startCol + 1).ToString();
model.OptionNumberOfDefaultCustomersInThisYearThisMonth = GetDataSetValueToDouble(dt, startRow + 9, startCol + 0).ToString();
model.OptionNumberOfDefaultCustomersInThisYearLastMonth = GetDataSetValueToDouble(dt, startRow + 9, startCol + 1).ToString();
}
/// <summary>
/// 获取收取履约担保品的使用情况固定表格
/// </summary>
/// <param name="model"></param>
/// <param name="dt"></param>
/// <param name="startRow"></param>
/// <param name="startCol"></param>
private void GetPerformanceGuaranteeInfo(PeriodicReportSACModel model, DataTable dt, int startRow, int startCol)
{
model.StockTradingCorrespondsToValueOfCollateralAtEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 0).ToString();
model.StockTradingCorrespondsToValueOfCollateralAtEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 0, startCol + 1).ToString();
model.CashBalanceAtEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 0).ToString("0.00");
model.CashBalanceAtEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 1, startCol + 1).ToString("0.00");
model.HoldStockMarketValueAtEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 0).ToString();
model.HoldStockMarketValueAtEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 2, startCol + 1).ToString();
model.HoldMarketValueOfBondsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 0).ToString();
model.HoldMarketValueOfBondsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 3, startCol + 1).ToString();
model.OwnedAssetManagementProductsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 4, startCol + 0).ToString();
model.OwnedAssetManagementProductsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 4, startCol + 1).ToString();
model.OwnedBankFinanceAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 5, startCol + 0).ToString();
model.OwnedBankFinanceAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 5, startCol + 1).ToString();
model.HoldTrustProductAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 0).ToString();
model.HoldTrustProductAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 6, startCol + 1).ToString();
model.InsuranceProductsAreHeldAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 0).ToString();
model.InsuranceProductsAreHeldAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 7, startCol + 1).ToString();
model.HoldOtherProductsAtTheEndOfThisMonth = GetDataSetValueToDouble(dt, startRow + 8, startCol + 0).ToString();
model.HoldOtherProductsAtTheEndOfLastMonth = GetDataSetValueToDouble(dt, startRow + 8, startCol + 1).ToString();
}
protected override List<SacInfo> CheckBodyValue(BodyModel model, out bool checkStatus)
{
List<SacInfo> result = new List<SacInfo>();
if (model?.PeriodicReportSAC != null)
{
List<SacInfo> listRoot = new List<SacInfo>();
var helper = new Common.CheckHelper<PeriodicReportSACModel>();
var detailHelper = new Common.CheckHelper<IncreaseBusinessDetailsThisMonthModel>();
var detailAtHelper = new Common.CheckHelper<InventoryBusinessDetailsAtTheEndOfThisMonthModel>();
var hedgeHelper = new Common.CheckHelper<TargetCaseAndHedgeModel>();
helper.ExecuteCheck(model.PeriodicReportSAC, (name, value, msg) =>
{
listRoot.Add(new SacInfo(name, value, msg));
});
if (model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple != null)
{
for (int i = 0; i < model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple.Count; i++)
{
var listItem = new List<SacInfo>();
var item = model.PeriodicReportSAC.IncreaseBusinessDetailsThisMonthTuple[i];
detailHelper.ExecuteCheck(item, (name, value, msg) =>
{
listItem.Add(new SacInfo(name, value, msg));
});
if (listItem.Count > 0)
{
var temp = new SacInfo("IncreaseBusinessDetailsThisMonthTuple", i);
temp.SubMaps = new List<SacInfo>(listItem);
listRoot.Add(temp);
}
}
}
if (model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple != null)
{
for (int i = 0; i < model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple.Count; i++)
{
var listItem = new List<SacInfo>();
var item = model.PeriodicReportSAC.InventoryBusinessDetailsAtTheEndOfThisMonthTuple[i];
detailAtHelper.ExecuteCheck(item, (name, value, msg) =>
{
listItem.Add(new SacInfo(name, value, msg));
});
if (listItem.Count > 0)
{
var temp = new SacInfo("InventoryBusinessDetailsAtTheEndOfThisMonthTuple", i);
temp.SubMaps = new List<SacInfo>(listItem);
listRoot.Add(temp);
}
}
}
if (model.PeriodicReportSAC.TargetCaseAndHedgeTuple != null)
{
for (int i = 0; i < model.PeriodicReportSAC.TargetCaseAndHedgeTuple.Count; i++)
{
var listItem = new List<SacInfo>();
var item = model.PeriodicReportSAC.TargetCaseAndHedgeTuple[i];
hedgeHelper.ExecuteCheck(item, (name, value, msg) =>
{
listItem.Add(new SacInfo(name, value, msg));
});
if (listItem.Count > 0)
{
var temp = new SacInfo("TargetCaseAndHedgeTuple", i);
temp.SubMaps = new List<SacInfo>(listItem);
listRoot.Add(temp);
}
}
}
if (listRoot.Count > 0)
{
var errMsg = new SacInfo("PeriodicReportSAC");
errMsg.SubMaps = new List<SacInfo>(listRoot);
result.Add(errMsg);
}
}
checkStatus = result.Count > 0;
return result;
}
/// <summary>
/// 获取已实现损益
/// </summary>
/// <param name="expression"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
private double GetRealizedPnl(Expression<Func<trade, bool>> expression, DateTime startDate, DateTime endDate)
{
var latestMonthIncomeQuery = from tc in DbContext.trade_cash join t in DbContext.trade.Where(expression) on tc.TradeId equals t.id where tc.ValueDate >= startDate && tc.ValueDate <= endDate && tc.ValidState != "InValid" && !tc.IsDeleted group tc by tc.TradeId into tcInfo select new { tcInfo.Key, Amount = tcInfo.Sum(O => (double?)O.Amount) };
var latestMonthIds = latestMonthIncomeQuery.Select(O => O.Key);
var latestMonthIncome = latestMonthIncomeQuery.Sum(O => O.Amount) ?? 0;
var lastMonthIncome = (from tc in DbContext.trade_cash where tc.ValueDate < startDate && latestMonthIds.Contains(tc.TradeId) && tc.ValidState != "InValid" && !tc.IsDeleted select tc.Amount).Sum(O => (double?)O) ?? 0;
return latestMonthIncome - lastMonthIncome;
}
/// <summary>
/// 获取已实现损益
/// </summary>
/// <param name="expression"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
private double GetPositionPnl(Expression<Func<trade, bool>> expression, DateTime lastEndDate, DateTime endDate)
{
var swapLatestMonthIncomeQuery = from ep in DbContext.eod_trade_position join t in DbContext.trade.Where(expression) on ep.TradeId equals t.id where ep.ValueDate == endDate && ep.TradeId > 0 && ep.ClientId > 0 select new { ep.TradeId, ep.PositionPnL };
var swapLatestMonthIds = swapLatestMonthIncomeQuery.Select(O => O.TradeId);
var swapLatestMonthIncome = swapLatestMonthIncomeQuery.Sum(O => (double?)O.PositionPnL) ?? 0;
var swapLastMonthIncome = (from ep in DbContext.eod_trade_position where ep.ValueDate == lastEndDate && swapLatestMonthIds.Contains(ep.TradeId) select ep.PositionPnL).Sum(O => (double?)O) ?? 0;
return (double)(swapLatestMonthIncome - swapLastMonthIncome);
}
/// <summary>
/// 获取excel中的本月新增业务明细
/// </summary>
/// <returns></returns>
private List<IncreaseBusinessDetailsThisMonthModel> GetIncreaseBusinessDetailsThisMonthTuple()
{
var result = new List<IncreaseBusinessDetailsThisMonthModel>();
if (_excelDataSource != null && _excelDataSource.Tables.Contains("本月新增业务明细"))
{
var dt = _excelDataSource.Tables["本月新增业务明细"];
for (var i = 1; i < dt.Rows.Count; i++)
{
if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString()))
{
//第一列空白说明数据结束了;
break;
}
var model = new IncreaseBusinessDetailsThisMonthModel();
model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1);
model.NameOfCounterparty = GetDataSetValue(dt, i, 2);
model.CounterpartyProductName = GetDataSetValue(dt, i, 3);
model.TradeConfirmationNumber = GetDataSetValue(dt, i, 4);
model.TransactionConfirmationNumber = GetDataSetValue(dt, i, 5);
if (model.TransactionConfirmationNumber.IsNullOrWhiteSpace())
{
model.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(model.TradeConfirmationNumber);
}
model.BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 6)];
model.NotionalPrincipalAmountLNotionalPrincipalAmount = GetDataSetValue(dt, i, 7);
model.SNotionalPrincipalAmount = GetDataSetValue(dt, i, 8);
model.StartDate = GetDataSetValue(dt, i, 9);
model.DueDate = GetDataSetValue(dt, i, 10);
model.InvestmentTargetType = UndrlygAssetTypeMap[GetDataSetValue(dt, i, 11)];
model.UndrlygAssetName = GetDataSetValue(dt, i, 12);
model.UndrlygAssetCode = GetDataSetValue(dt, i, 13);
model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 14);
model.OptionObjectSecondClass = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15)];
model.ReturnSwapObjectSecondClass = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 16)];
model.NonAnnualOptionFee = GetDataSetValue(dt, i, 17);
model.OptionType = ConsReport.OptionStructureTypeMap[GetDataSetValue(dt, i, 18)];
result.Add(model);
}
}
return result;
}
/// <summary>
/// 获取excel中的本月末存量业务明细
/// </summary>
/// <returns></returns>
private List<InventoryBusinessDetailsAtTheEndOfThisMonthModel> GetInventoryBusinessDetailsAtTheEndOfThisMonth()
{
var result = new List<InventoryBusinessDetailsAtTheEndOfThisMonthModel>();
if (_excelDataSource != null && _excelDataSource.Tables.Contains("本月末存量业务明细"))
{
var dt = _excelDataSource.Tables["本月末存量业务明细"];
for (var i = 1; i < dt.Rows.Count; i++)
{
if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString()))
{
//第一列空白说明数据结束了;
break;
}
var model = new InventoryBusinessDetailsAtTheEndOfThisMonthModel();
model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1);
model.NameOfCounterparty = GetDataSetValue(dt, i, 2);
model.NameOfCounterpartyProduct = GetDataSetValue(dt, i, 3);
model.TradeConfirmationNumber = GetDataSetValue(dt, i, 4);
model.TransactionConfirmationNumber = GetDataSetValue(dt, i, 5);
if (model.TransactionConfirmationNumber.IsNullOrWhiteSpace())
{
model.TransactionConfirmationNumber = base.GetBizIdFromInfoTag(model.TradeConfirmationNumber);
}
model.BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 6)];
model.NotionalPrincipalAmountLNotionalPrincipalAmount = GetDataSetValue(dt, i, 7);
model.SNotionalPrincipalAmount = GetDataSetValue(dt, i, 8);
model.StartDay = GetDataSetValue(dt, i, 9);
model.DueDate = GetDataSetValue(dt, i, 10);
model.SumInvestmentTargetType = UndrlygAssetTypeMap[GetDataSetValue(dt, i, 11)];
model.UndrlygAssetName = GetDataSetValue(dt, i, 12);
model.UndrlygAssetCode = GetDataSetValue(dt, i, 13);
model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 14);
model.OptionSumInvestmentTargetType = ConsReport.UndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 15)];
model.ExchangeSumInvestmentTargetType = ConsReport.SwapUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 16)];
model.OptionFee = GetDataSetValue(dt, i, 17);
model.OptionType = ConsReport.OptionStructureTypeMap[GetDataSetValue(dt, i, 18)];
model.MaitainMarginRation = GetDataSetValue(dt, i, 19);
model.CorrelationCoefficient = GetDataSetValue(dt, i, 20);
model.LongPositionContractValue = GetDataSetValue(dt, i, 21);
model.ShortPositionContractValue = GetDataSetValue(dt, i, 22);
result.Add(model);
}
}
return result;
}
/// <summary>
/// 获取excel中的标的情况与对冲
/// </summary>
/// <returns></returns>
private List<TargetCaseAndHedgeModel> GetTargetCaseAndHedgeTuple()
{
var result = new List<TargetCaseAndHedgeModel>();
if (_excelDataSource != null && _excelDataSource.Tables.Contains("标的情况与对冲"))
{
var dt = _excelDataSource.Tables["标的情况与对冲"];
for (var i = 1; i < dt.Rows.Count; i++)
{
if (string.IsNullOrWhiteSpace(dt.Rows[i][0]?.ToString()))
{
//第一列空白说明数据结束了;
break;
}
var model = new TargetCaseAndHedgeModel();
model.NameOfSecuritiesCompany = GetDataSetValue(dt, i, 1);
model.BusinessType = ConsReport.BusinessTypeMap[GetDataSetValue(dt, i, 2)];
model.SumInvestmentTargetType = ConsReport.HedgeSACUndrlygAssetDtldTypeMap[GetDataSetValue(dt, i, 3)];
model.SumInvestmentTargetName = GetDataSetValue(dt, i, 4);
model.UndrlygAssetCode = GetDataSetValue(dt, i, 5);
model.UndrlygAssetTradgPlc = GetDataSetValue(dt, i, 6);
model.BuyingImpulseVolume = GetDataSetValue(dt, i, 7);
model.SellingImpulseVolume = GetDataSetValue(dt, i, 8);
model.ImpulseVolume = GetDataSetValue(dt, i, 9);
model.PositionAtTheEndOfThisMonth = GetDataSetValue(dt, i, 10);
model.TheNumberOfPositionsHeldAtTheEndOfThisMonth = GetDataSetValue(dt, i, 11);
model.AveragePriceAtTheEndOfTheMonth = GetDataSetValue(dt, i, 12);
result.Add(model);
}
}
return result;
}
private string formatInfoTag(string tag, bool suffixType = false)
{
var result = $"{BusiDataType}_{tag}_";
if (suffixType)
{
result = $"{result}{_operationType}";
}
return result;
}
public override bool BeforeOfGenerated(out string errMsg)
{
errMsg = "";
for (var i = 0; i < noteList.Count; i++)
{
base.SaveReportNotes(noteList[i]);
}
return true;
}
}
}