@model TradeViewModel @{ ViewBag.Title = "远期交易|查看"; Layout = "~/Views/Shared/_InfoLayout.cshtml"; var generateAmendDoc = PS.Config.TradeElement.IsGenerateAmendDoc; var needSendChangeEmail = PS.Config.TradeElement.IsAmendableAfterConfirm && PS.Config.TradeElement.IsGenerateAmendDoc; var tradeModel = Model.Trade; var forwardModel = tradeModel.trade_forward; var canBackTrade = CurUser.交易管理_交易回退 && !Model.IsFromPositionReport && (tradeModel.TradeStatus == ConsTrade.确认成交 || ConsTrade.TradeCompleteStatus.Contains(tradeModel.TradeStatus)); var salesNames = String.Join(",", Model.SalesCommission.Select(n => n.SalesmanName).ToArray()); var pageObj = new { buttonStr = YLErp.PS.Config.Company == CompanyEnum.天风 ? "交易录入" : "交易特批", Trade = tradeModel, }; tradeModel.TradeUnit = PS.Config.IsUseDisplayNotional ? (tradeModel.QuoteUnit == "500千克" ? "半吨" : "吨") : tradeModel.TradeUnit; } @section CSS{ } @section JS{ }
@if (!Model.IsOnlyCloseButton) { if (tradeModel.ValidState != "InValid" && (tradeModel.TradeStatus == "新增待确认" || tradeModel.TradeStatus == "修改待确认") && CurUser.交易管理_交易新增) { @MyControls.Btn("确认交易", "confirmTrade('" + tradeModel.id + "')") } if ((tradeModel.CanEdit() && !Model.IsFromPositionReport && CurUser.交易管理_交易编辑) || (ConsTrade.已拒绝 == tradeModel.TradeStatus && !Model.IsFromPositionReport && tradeModel.TraderId == CurUser.UserId)) { @MyControls.Btn("修改", "editTrade('" + tradeModel.EncryptId + "');") } else if (tradeModel.TradeStatus == ConsTrade.已执行 || tradeModel.TradeStatus == ConsTrade.已平仓 || tradeModel.TradeStatus == ConsTrade.已到期 || (tradeModel.TradeStatus == ConsTrade.确认成交 && tradeModel.HasPartialUnWind == 1)) { @MyControls.Btn("修改备注", string.Format("editTradeRemarkInfo('{0}','{1}')", tradeModel.EncryptId, tradeModel.TradeType)) } if (tradeModel.CanDelete() && (!Model.IsFromPositionReport) && CurUser.交易管理_交易删除) { @MyControls.Btn("删除", "deletetrade('" + tradeModel.EncryptId + "');") } if (canBackTrade && CurUser.交易管理_交易回退) { @MyControls.Btn("交易回退", "backTrade('" + tradeModel.EncryptId + "')") } if (tradeModel.TradeStatus == ConsTrade.审批中 && CurUser.交易管理_交易新增) { @MyControls.Btn("撤回", string.Format("tradewithdraw({0})", tradeModel.id)) } else if (tradeModel.TradeStatus == ConsTrade.平仓待复核 && CurUser.交易管理_交易平仓) { @MyControls.Btn("撤回", string.Format("traderevoke({0},{1})", tradeModel.id, 0)) } else if (tradeModel.TradeStatus == ConsTrade.行权待复核 && CurUser.交易管理_交易行权) { @MyControls.Btn("撤回", string.Format("traderevoke({0},{1})", tradeModel.id, 1)) } } @if (CurUser.交易管理_交易操作历史) { @MyControls.Btn("操作历史", "tradeOperationHistory('" + tradeModel.EncryptId + "')") }
@if (!Model.IsOnlyCloseButton) { if (tradeModel.CanConfirm() && CurUser.交易管理_交易新增) { @MyControls.Btn("确认交易", "confirmTrade('" + tradeModel.id + "')") } if (tradeModel.TradeStatus == ConsTrade.提前终止拒绝 && CurUser.交易管理_交易平仓) { @MyControls.Btn("提前终止放弃", "terminationBackToConfirmed('" + tradeModel.EncryptId + "')") } if (tradeModel.CanUnwind() && CurUser.交易管理_交易平仓) { @MyControls.Btn("平仓", string.Format("unWind('{0}','{1}',{2})", tradeModel.EncryptId, tradeModel.TradeType, Model.IsShowReCheckClose.ToString().ToLower())) } if (CurUser.交易管理_交易资金维护) { @MyControls.Btn("预付金成本", "viewMarginCost('" + tradeModel.EncryptId + "','" + tradeModel.TradeNumber + "')") } }
@if (PS.Config.ErpElement.ForwardTradePriceModel == YLErp.Configuration.Enums.ForwardTradePriceModel.HOOK_PRICE) { if (!PS.Config.Is润和) { } } else { var spotInfo = tradeModel.MetaDic.ContainsKey("期初信息") ? JsonHelper.Deserialize(tradeModel.MetaDic["期初信息"]) : null; } @if (PS.Config.Is润和) { } else { if (PS.Config.Is浙期 && tradeModel.ActualExerciseDate != null) { } } @if (tradeModel.StructureType == "掉期") { } else { } @if (!PS.Config.Is润和) { } @if (Model.showInitialMargin) { } else { } @if (AppHelper.UseFutureVersion("销售提成", "V2")) { } @if (!PS.Config.Is润和) { } @if (!string.IsNullOrEmpty(tradeModel.QuoteCurrency) && tradeModel.QuoteCurrency != "CNY") { } @{ tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.ClearingAgency, out var clearingAgency); tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.TradingPlace, out var tradingPlace); tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.MainProtocolCode, out var mainProtocolCode); tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.SupProtocolCode, out var supProtocolCode); } @if (PS.Config.Company == CompanyEnum.国海) { tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.CCR_K, out var ccr_k); tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.ignoreRiskExposure, out var ignoreRiskExposure); } @if (PS.Config.ErpElement.SecuritiesEnvironment) { if (!PS.Config.Is润和) { } } @if (!PS.Config.Is润和 || !forwardModel.ObservationDates.IsNullOrWhiteSpace()) { if (!forwardModel.ObservationDates.IsNullOrWhiteSpace()) { @{ tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.kiObservationRate, out var kiObservationDate); } } @if (!PS.Config.Is润和) { } else { } } @if (!PS.Config.Is润和) { @if (!PS.Config.ErpElement.SecuritiesEnvironment) { } else { } } @if (!PS.Config.Is润和 && !PS.Config.ErpElement.SecuritiesEnvironment) { } @if (CurUser.交易管理_交易标签查看权限) { }
结构类型 @(tradeModel.StructureType != null ? tradeModel.StructureType : tradeModel.TradeType) 标的类型 @(tradeModel.UnderlyingAssetClass)
标的代码 @(tradeModel.UnderlyingCode) 标的名称 @(tradeModel.UnderlyingAssetName)
挂钩标的代码 @(tradeModel.BasisUnderlyingCode) 基差 @(string.IsNullOrWhiteSpace(tradeModel.BasisUnderlyingCode) ? "" : tradeModel.BasisGap.ToString())
标的1代码 @(tradeModel.UnderlyingCode) 标的2代码 @(tradeModel.BasisUnderlyingCode)
标的1名称 @(tradeModel.UnderlyingAssetName) 标的2名称 @(ViewBag.Underlying2Name)
标的1价格 @(spotInfo?.Length > 0 ? spotInfo[0] : "") 标的2价格 @(spotInfo?.Length > 1 ? spotInfo[1] : "")
交易编号 @(tradeModel.TradeNumber) 交易状态 @(tradeModel.TradeStatus)
客户名称 @(tradeModel.ClientName) 交易员 @(tradeModel.TraderName)
簿记账户 @(tradeModel.AssetBookName) 成交日期 @(tradeModel.TradeDate.OtcFormatDate())
到期日期 @(tradeModel.ExerciseDate.OtcFormatDate()) 买卖方向 @(tradeModel.BuySell)
到期日期 @(tradeModel.ExerciseDate.OtcFormatDate()) 结算日期 @(tradeModel.SettlementDate.OtcFormatDate())
实际到期日期 @(tradeModel.ActualExerciseDate.OtcFormatDate())
买卖方向 @(tradeModel.BuySell) 多空方向 @tradeModel.OptionType
持仓数量 @(tradeModel.TradeAmount.OtcFormatNotional(tradeModel.CountRatio, PS.Config.IsUseDisplayNotional)) 手数 @(tradeModel.Lots.OtcFormatNotional())
交割价格 @(tradeModel.Strike.OtcFormatUmPrice()) 开仓费用 @(forwardModel.OpenCommission.OtcFormatMoney())
期初标的价格 @(tradeModel.SpotPrice.OtcFormatUmPrice())掉期价值远期价值 @(forwardModel.ForwardValue.OtcFormatMoney())
开仓总费用 @((tradeModel.TradePrice).OtcFormatMoney()) 年化预付金成本 @(forwardModel.AnnualMarginRate.OtcFormatPercent())
年化仓储成本 @(forwardModel.AnnualStoragePrice.OtcFormatMoney()) 无风险利率 @(tradeModel.NoRiskRate.OtcFormatPercent())
是否有效 @ConsGlobal.GetValidDesc(tradeModel.ValidState)初始预付金 @(tradeModel.InitialMargin.OtcFormatMoney())
@(PS.Config.ErpElement.SaleMode == YLErp.Configuration.Enums.SaleMode.SaleMen ? "销售员" : "客户经理") @(salesNames) 销售提成 @(Model.SalesCommission.FirstOrDefault()?.CommissionString())
预付金模板 @tradeModel.MarginTemplateName 预付金算法 @(YLErp.Helpers.EnumHelper.GetDescriptionByName(tradeModel.MarginType))
初始预付金率 @((tradeModel.MarginType <= MarginTypeEnum.NONE && PS.Config.Company != CompanyEnum.华安) ? "" : tradeModel.MarginRate.OtcFormat(OtcFormatFlag.marginRateP)) 持仓预付金率 @((tradeModel.MarginType == MarginTypeEnum.FIXED || tradeModel.MarginType == MarginTypeEnum.FLOATP || tradeModel.MarginType == MarginTypeEnum.FLOAT) ? tradeModel.PositionMarginRate.OtcFormat(OtcFormatFlag.marginRateP) : "")
计价币种 @tradeModel.QuoteCurrency 汇率 @(tradeModel.MetaDic.ContainsKey("ExchangeRate") ? tradeModel.MetaDic["ExchangeRate"] : "")
CCR指标k值 @ccr_k 信用风险敞口 @(ignoreRiskExposure != "1" ? "参与计算" : "忽略")
交易场所 @(tradingPlace) 清算机构 @(clearingAgency)
主协议编号 @(mainProtocolCode) 补充协议编号 @(supProtocolCode)
观察信息 @{ var colInfos = "['日期']"; @MyControls.Btn("查看", string.Format("showObservationInfos('{0}',{1},'{2}')", "观察信息", colInfos, forwardModel.ObservationDates)) } 观察频率@(!string.IsNullOrEmpty(kiObservationDate) ? "每" + kiObservationDate.Replace('D', '天').Replace('W', '周').Replace('M', '月').Replace('Y', '年') : "")
交易对手方 @(tradeModel.OpponentRole ?? "乙方")
是否补偿远期价值 @{ var supplyValue = ""; if (tradeModel.MetaDic.ContainsKey("IsSupplyForwardValue")) { if (tradeModel.MetaDic["IsSupplyForwardValue"] == "1") { supplyValue = "补偿"; } else if (tradeModel.MetaDic["IsSupplyForwardValue"] == "-1") { supplyValue = "支付"; } else { supplyValue = "否"; } } else { supplyValue = "补偿"; } } @supplyValue 中央对手方清算 @{ tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.IsCentralClearing, out var isCentralClearing); } @(isCentralClearing == "Y" ? "是" : "否")
中央清算平台 @{ tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.CentralClearingPaltform, out var centralClearingPaltform); } @centralClearingPaltform 交易平台 @{ tradeModel.MetaDic.TryGetValue(YLErp.DBModels.Consts.ConsTradeMetaKey.TradingPaltform, out var tradingPaltform); } @tradingPaltform
备注 @if (Model != null) { if (tradeModel.RemarkInfo != null && tradeModel.RemarkInfo.StartsWith("http://")) { @(tradeModel.RemarkInfo) } else { @(tradeModel.RemarkInfo) } }
标签
@if (Model.Tags != null && Model.Tags.Any()) { foreach (var tag in Model.Tags) { @tag.Name @if (CurUser.交易管理_交易标签调整权限) { x } } } @if (CurUser.交易管理_交易标签调整权限) { + }
@{ var sulist = YLErp.DBModels.Helpers.TradeHelper.GetSyntheticPriceModel(tradeModel)?.SuList; if (sulist != null) { var suItems = sulist.Select(n => n.UnderlyingCode + "," + n.Price.ToString("F3")).Concat(new string[] { null, null }).ToArray(); @for (var i = 0; i < suItems.Length; i += 2) { if ((suItems[i]) == null) { break; } if ((suItems[i + 1]) == null) { break; } }
标的@(i + 1) @(suItems[i]) 标的@(i + 2) @(suItems[i + 1])
} }
@if (Model.unWindTradeCashList != null && Model.unWindTradeCashList.Any()) { var index = 1;
@foreach (var tradeCash in Model.unWindTradeCashList) { if (tradeCash.Action == "系统操作-行权费") {
提前终止序号 @(index++) 行权数量 @(tradeCash.TradeAmount.OtcFormatNotional(tradeModel.CountRatio, PS.Config.IsUseDisplayNotional))
行权日期 @(tradeCash.ValueDate.OtcFormatDate()) 收益总额 @(tradeCash.Amount.OtcFormatUmPrice())
行权标的价格 @(tradeCash.FinalPrice.OtcFormatUmPrice()) 实现盈亏 @(tradeCash.WinLoss)
行权收益 @(tradeCash.SingleWinPrice.OtcFormatMoney())
} else {
提前终止序号 @(index++) 每手平仓费用 @(tradeCash.UnwindPrice.OtcFormatUmPrice())
平仓日期 @(tradeCash.ValueDate.OtcFormatDate()) 平仓数量 @(tradeCash.UnwindTradeAmount.OtcFormatNotional(tradeModel.CountRatio, PS.Config.IsUseDisplayNotional))
平仓标的价格 @(tradeCash.FinalPrice.OtcFormatUmPrice()) 平仓总费用 @(tradeCash.Amount.OtcFormatMoney())
实现盈亏 @(tradeCash.WinLoss)
} }
} @if (Model.maturityTradeCash != null) { var maturityTradeCash = Model.maturityTradeCash;
到期日期 @(tradeModel.ExerciseDate.OtcFormatDate()) 到期数量 @(maturityTradeCash.TradeAmount.OtcFormatNotional(tradeModel.CountRatio, PS.Config.IsUseDisplayNotional))
到期标的价格 @(maturityTradeCash.FinalPrice.OtcFormatUmPrice()) 收益总额 @(maturityTradeCash.Amount.OtcFormatMoney())
到期收益 @(maturityTradeCash.SingleWinPrice.OtcFormatMoney()) 实现盈亏 @(maturityTradeCash.WinLoss)
} @if (Model.tradeMarginTemplates != null && Model.tradeMarginTemplates.Any()) {
@foreach (var tradeMarginTemplate in Model.tradeMarginTemplates) { }
模板名称 预付金规则 规则类型 生效日期 操作时间 规则说明
@(tradeMarginTemplate.MarginTemplateName) @(tradeMarginTemplate.MarginRuleTypeName) @(tradeMarginTemplate.MarginTypeName) @(tradeMarginTemplate.ValueDate.ToString("yyyy-MM-dd")) @(tradeMarginTemplate.OptDate) @(tradeMarginTemplate.Comments)
}
@if (!string.IsNullOrWhiteSpace(Context.Request.Query["abstract"])) { @await Html.PartialAsync("/Views/trade/_part/TradeAbstractInfo.cshtml", Model.Trade) }