437 lines
20 KiB
Plaintext
437 lines
20 KiB
Plaintext
@{
|
||
ViewBag.Title = "每日估值报告";
|
||
ViewBag.Menu = "结算财务-每日估值报告";
|
||
Layout = "~/Views/Shared/_MainLayout.cshtml";
|
||
}
|
||
@section CSS{
|
||
<link href="~/Style/Css/TradeMarketReport.css" rel="stylesheet" />
|
||
|
||
<style>
|
||
.layui-layer { width: 1080px !important; height: 667px !important; border: 2px solid #09bbbc; }
|
||
.layui-layer-title { background: #09bbbc; color: #fff; }
|
||
.chosen-container { width: 250px !important; }
|
||
.chosen-container .chosen-drop { width: 250px !important; }
|
||
#ValueDateFrom, #ValueDate { width: 152px !important; font-size: 1rem !important; }
|
||
|
||
.ui-jqgrid {
|
||
margin: 0 !important;
|
||
}
|
||
</style>
|
||
}
|
||
@section JS{
|
||
<script>
|
||
const calcDate = "@valuedateBLL.ValueDate.ToString("yyyy-MM-dd")";
|
||
var EndTime = "@ViewBag.EndTime";
|
||
var StartTime = "@ViewBag.StartTime";
|
||
</script>
|
||
<script type="text/javascript">
|
||
var isShenWan = "@YLErp.PS.Config.Is申万" == "True";
|
||
var g_grid = {};
|
||
$(function () {
|
||
var PostData = {};
|
||
//控件选择时的触发事件
|
||
main.setTradeDatePicker("", "#ValueDate", calcDate, function (selectedDate) {
|
||
if (selectedDate != null && selectedDate != undefined) {
|
||
$("#ValueDateFrom").datepicker("option", "maxDate", selectedDate);
|
||
}
|
||
});
|
||
main.setTradeDatePicker("", "#ValueDateFrom", calcDate, function (selectedDate) {
|
||
if (selectedDate != null && selectedDate != undefined) {
|
||
$("#ValueDate").datepicker("option", "minDate", selectedDate);
|
||
}
|
||
});
|
||
//手动修改时的触发事件
|
||
$("#ValueDate").change(function () {
|
||
$("#ValueDateFrom").datepicker("option", "maxDate", $("#ValueDate").val());
|
||
});
|
||
$("#ValueDateFrom").change(function () {
|
||
$("#ValueDate").datepicker("option", "minDate", $("#ValueDateFrom").val());
|
||
});
|
||
|
||
//默认初始值赋值逻辑
|
||
if (EndTime == "" || EndTime == "undefined") {
|
||
$("#ValueDate").val(calcDate);
|
||
} else {
|
||
$("#ValueDate").val(EndTime);
|
||
}
|
||
if ((StartTime == "" || StartTime == "undefined") && (EndTime == "" || EndTime == "undefined")) {
|
||
//
|
||
} else {
|
||
$("#ValueDateFrom").val(StartTime);
|
||
}
|
||
if ("@ViewBag.ParentFlag" == "True")
|
||
$("#ParentFlag").attr("checked", true);
|
||
else
|
||
$("#ParentFlag").attr("checked", false);
|
||
var PostData = {};
|
||
PostData.ValueDate = $("#ValueDate").val();
|
||
PostData.ClientId = $("#ClientId").val();
|
||
if ($("#ParentFlag").prop("checked"))
|
||
PostData.ParentFlag = true;
|
||
else
|
||
PostData.ParentFlag = false;
|
||
var grid = jQuery('#listGrid').jqGrid({
|
||
url: '/clientcashincashout_product/clientcashincashout_productQueryForMarketReport',
|
||
datatype: 'json',
|
||
height: 'auto',
|
||
width: '96%',
|
||
autowidth: false,
|
||
shrinkToFit: false,
|
||
viewrecords: true,
|
||
jsonReader: { repeatitems: false },
|
||
caption: '',
|
||
mtype: 'POST',
|
||
postData: PostData,
|
||
afterInsertRow: AfterInsertRow,
|
||
onSelectRow: rowclick,
|
||
ondblClickRow: rowdblclick,
|
||
colModel: colModelGrid,
|
||
pager: jQuery('#pagerGrid'),
|
||
pagerpos: 'left',
|
||
rowNum: 20,
|
||
rowList: [20, 30, 50, 200, 10000],
|
||
footerrow: false,
|
||
loadComplete: gridComplete,
|
||
onPaging: onJqgridPaging,
|
||
grouping: true
|
||
});
|
||
g_grid = jQuery('#listGrid');
|
||
|
||
main.post("/trade_span/GetPositionAndHistoryTotalNumber", { clientId: $("#ClientId").val(), ValueDateFrom: $("#ValueDateFrom").val(), ValueDateTo: $("#ValueDate").val() }).done(function (data) {
|
||
$("#positionTab").attr("title", data.PostionListNumber);
|
||
$("#historyTab").attr("title", data.HistoryListNumber);
|
||
$("#positionSwapTab").attr("title", data.PositionSwapListNumber);
|
||
$("#historySwapTab").attr("title", data.HistorySwapListNumber);
|
||
});
|
||
|
||
function keyEnter(event) {
|
||
try {
|
||
var e = event ? event : (window.event ? window.event : null);
|
||
if (e.keyCode == 13) {
|
||
SearchClick(true);
|
||
}
|
||
} catch (e) {
|
||
|
||
}
|
||
}
|
||
|
||
document.onkeydown = keyEnter;
|
||
try {
|
||
SetAceDropDown();
|
||
|
||
} catch (e) {
|
||
|
||
}
|
||
|
||
function AfterInsertRow(rowid, aData) {
|
||
}
|
||
});
|
||
|
||
function showTradeNumber(cellValue, options, rowObject) {
|
||
if (cellValue == "合计:") {
|
||
return cellValue;
|
||
}
|
||
//console.log(cellValue+";");
|
||
var url = "/trade/tradeFileManagement?tradeNumber=" + cellValue;
|
||
var showNumber = "<a href=\"javascript:void(0)\" title=\"查看客户文件\" onclick='main.open(\"客户文件\",\"{1}\")'>{0}</a>".template(cellValue, url);
|
||
return showNumber;
|
||
}
|
||
|
||
var colModelGrid = [{
|
||
name: 'id', label: 'id', index: 'id', width: 1, align: 'center', sortable: false, hidden: true
|
||
}, {
|
||
name: 'EncryptId', label: 'EncryptId', index: 'EncryptId', width: 0, align: 'center', sortable: false, hidden: true
|
||
}, {
|
||
name: 'HappenDate', label: '质押时间', index: 'HappenDate', width: 155, align: 'center', sortable: false, formatter: 'datetime'
|
||
}, {
|
||
name: 'Status', label: '质押状态', index: 'Status', width: 90, align: 'center', sortable: false
|
||
}, {
|
||
name: 'BackDate', label: '赎回时间', index: 'BackDate', width: 155, align: 'center', sortable: false, formatter: 'datetime'
|
||
}, {
|
||
name: 'VarietyShortName', label: '质押品名', index: 'VarietyShortName', width: 135, sortable: false, align: 'center'
|
||
}, {
|
||
name: 'Rate', label: '质押率', index: 'Rate', width: 90, align: 'right', sortable: false, formatter: percentFormat
|
||
}, {
|
||
name: 'ProductAmount', label: '质押数量', index: 'ProductAmount', width: 90, sortable: false, align: 'right', formatter: threeFormat
|
||
}, {
|
||
name: 'SpotPrice', label: '盯市价格', index: 'SpotPrice', width: 90, align: 'right', sortable: false, formatter: doubleFormat
|
||
}, {
|
||
name: 'ProductTotalPrice', label: '质押市值', index: 'ProductTotalPrice', width: 90, align: 'right', sortable: false, formatter: doubleFormat
|
||
}, {
|
||
name: 'Comments', label: '备注', index: 'Comments', width: 90, sortable: false, align: 'center'
|
||
}]
|
||
|
||
function gridComplete() {
|
||
$(window).off('resize.jqGrid');
|
||
}
|
||
|
||
function showExerciseMode(cellValue, options, rowObject) {
|
||
if ("American" == rowObject.ExerciseMode || "American" == rowObject.trade.ExerciseMode) {
|
||
return "美式";
|
||
} else if ("European" == rowObject.ExerciseMode || "European" == rowObject.trade.ExerciseMode) {
|
||
return "欧式";
|
||
}
|
||
}
|
||
|
||
function percentFormat(cellValue, options, rowObject) {
|
||
return cellValue == null || cellValue == undefined ? "0.00%" : (cellValue * 100).toFixed(2) + "%"
|
||
}
|
||
|
||
function doubleFormat(cellValue, options, rowObject) {
|
||
return cellValue == null || cellValue == undefined ? "0.00" : cellValue.toFixed(2);
|
||
}
|
||
|
||
function threeFormat(cellValue, options, rowObject) {
|
||
return cellValue == null || cellValue == undefined ? "0.000" : cellValue.toFixed(3);
|
||
}
|
||
|
||
function unwindNotionalFormat(cellValue, options, rowObject) {
|
||
return rowObject.trade_cash.Action == "系统操作-行权费" ? (rowObject.trade_cash.Notional == null || rowObject.trade_cash.Notional == undefined ? 0 : rowObject.trade_cash.Notional) : rowObject.trade_cash.UnwindNotional
|
||
}
|
||
|
||
function tradeStatusFormat(cellValue, options, rowObject) {
|
||
return rowObject.trade_cash.Action == "系统操作-行权费" ? rowObject.trade.TradeStatus : "已平仓"
|
||
}
|
||
|
||
function strikeFormat(cellValue, options, rowObject) {
|
||
return rowObject.trade.IsMoneynessOptionData ? numeral(rowObject.trade.InitialSpotPrice * (rowObject.trade.Strike == undefined || rowObject.trade.Strike == null ? 0 : rowObject.trade.Strike)).format("0,0.00") : numeral(rowObject.trade.Strike == undefined || rowObject.trade.Strike == null ? 0 : rowObject.trade.Strike).format("0,0.0");
|
||
}
|
||
|
||
//实现盈亏包含 了结数量的权利金,需要将其计算进去
|
||
function amountFormat(cellValue, options, rowObject) {
|
||
return numeral(rowObject.trade_cash.Action == "系统操作-行权费" ? -rowObject.trade_cash.Amount + rowObject.trade.TradePrice * rowObject.trade_cash.UnwindPercentRate * ((rowObject.trade.BuySell == "卖出") ? -1 : 1) : -rowObject.trade_cash.Amount + rowObject.trade.TradePrice * rowObject.trade_cash.UnwindPercentRate * ((rowObject.trade.BuySell == "卖出") ? -1 : 1)).format("0,0.00");
|
||
}
|
||
|
||
function rowclick(id) {
|
||
}
|
||
|
||
function reloadTradeMarketReport() {
|
||
//重新加载
|
||
SearchClick(true);
|
||
}
|
||
|
||
function SearchTable(isSearchclick) {
|
||
//搜索抵押品
|
||
searchClientCashInCashOutProduct(isSearchclick)
|
||
}
|
||
|
||
//搜索抵押品
|
||
function searchClientCashInCashOutProduct(isSearchclick) {
|
||
var listGrid = $('#listGrid');
|
||
|
||
listGrid.appendPostData({ ValueDate: $("#ValueDate").val() });
|
||
listGrid.appendPostData({ ClientId: $("#ClientId").val() });
|
||
if ($("#ParentFlag").prop("checked"))
|
||
listGrid.appendPostData({ ParentFlag: true });
|
||
else
|
||
listGrid.appendPostData({ ParentFlag: false });
|
||
|
||
if ($("#ValueDate").val() == "" ||
|
||
$("#ValueDate").val() == undefined ||
|
||
$("#ValueDate").val() == null) {
|
||
main.message("请选择要查看报告的结束日期!");
|
||
return;
|
||
}
|
||
|
||
if ($("#ValueDate").val() > calcDate) {
|
||
main.message("结束日期不能大于当前系统日期!");
|
||
return;
|
||
}
|
||
if ($("#ValueDate").val() < $("#ValueDateFrom").val()) {
|
||
main.message("起始日期不能大于结束日期!");
|
||
return;
|
||
}
|
||
|
||
if (typeof (isSearchclick) != "undefined" && isSearchclick) {
|
||
//点击搜索时默认第一页
|
||
listGrid.jqGrid('setGridParam',
|
||
{
|
||
page: 1
|
||
});
|
||
}
|
||
listGrid.trigger('reloadGrid');
|
||
|
||
main.post("/trade_span/GetPositionAndHistoryTotalNumber", { clientId: $("#ClientId").val(), ValueDateFrom: $("#ValueDateFrom").val(), ValueDateTo: $("#ValueDate").val() }).done(function (data) {
|
||
$("#positionTab").attr("title", data.PostionListNumber);
|
||
$("#historyTab").attr("title", data.HistoryListNumber);
|
||
$("#positionSwapTab").attr("title", data.PositionSwapListNumber);
|
||
$("#historySwapTab").attr("title", data.HistorySwapListNumber);
|
||
});
|
||
}
|
||
|
||
function SearchClick(isSearchclick) {
|
||
SearchTable(isSearchclick);
|
||
}
|
||
|
||
function numFormart(num) {
|
||
if (num == undefined || num == null) {
|
||
num = "0.00"
|
||
}
|
||
return numeral(num).format("0,0.00");
|
||
}
|
||
|
||
function PopDesc() {
|
||
main.open("配置报告", "/clientbalance/TradeMarketDescSet");
|
||
}
|
||
|
||
function SendReport() {
|
||
var param = {};
|
||
var clientName = $("#ClientId :selected").text();
|
||
param.ClientId = $("#ClientId").val();
|
||
param.ValueDate = $("#ValueDate").val();
|
||
if (param.ClientId === "" ||
|
||
param.ClientId == undefined ||
|
||
param.ClientId == null ||
|
||
param.ClientId === 'null') {
|
||
main.message("请选择要查看报告的客户名称!");
|
||
return;
|
||
}
|
||
if (param.ValueDate === "" ||
|
||
param.ValueDate == undefined ||
|
||
param.ValueDate == null ||
|
||
param.ValueDate === 'null') {
|
||
main.message("请选择要查看报告的结束日期!");
|
||
return;
|
||
}
|
||
|
||
if ($("#ParentFlag").prop("checked"))
|
||
param.ParentFlag = true;
|
||
else
|
||
param.ParentFlag = false;
|
||
|
||
if ($("#ValueDate").val() > calcDate) {
|
||
main.message("结束日期不能大于当前系统日期!");
|
||
return;
|
||
}
|
||
if ($("#ValueDate").val() < $("#ValueDateFrom").val()) {
|
||
main.message("起始日期不能大于结束日期!");
|
||
return;
|
||
}
|
||
|
||
if (isShenWan) {
|
||
main.post("/clientbalance/GenerateTradeMarketBill2", screenData());
|
||
}
|
||
else {
|
||
main.open("向{0}发送报告".template(clientName), "/clientbalance/TradeMarketClientSend?clientid=" + param.ClientId + "&ParentFlag=" + param.ParentFlag);
|
||
}
|
||
}
|
||
function DownLoadReport() {
|
||
var param = {};
|
||
var clientName = $("#ClientId :selected").text();
|
||
param.ClientId = $("#ClientId").val();
|
||
param.ValueDate = $("#ValueDate").val();
|
||
if (!param.ClientId || param.ClientId === 'null') {
|
||
main.message("请选择要查看报告的客户名称!");
|
||
return;
|
||
}
|
||
if (!param.ValueDate || param.ValueDate === 'null') {
|
||
main.message("请选择要查看报告的结束日期!");
|
||
return;
|
||
}
|
||
|
||
if ($("#ValueDate").val() > calcDate) {
|
||
main.message("结束日期不能大于当前系统日期!");
|
||
return;
|
||
}
|
||
if ($("#ValueDate").val() < $("#ValueDateFrom").val()) {
|
||
main.message("起始日期不能大于结束日期!");
|
||
return;
|
||
}
|
||
|
||
main.post("/clientbalance/ViewTradeMarketFile", screenData()).done(function (res) {
|
||
window.open(res.obj);
|
||
});
|
||
}
|
||
function screenData() {
|
||
var data = { From: $("#ValueDateFrom").val(), To: $("#ValueDate").val() };
|
||
data.ClientId = $("#ClientId").val();
|
||
if ($("#ParentFlag").prop("checked"))
|
||
data.ParentFlag = true;
|
||
else
|
||
data.ParentFlag = false;
|
||
return data;
|
||
}
|
||
function locationChange(tab) {
|
||
if ($("#ValueDate").val() > calcDate) {
|
||
main.message("结束日期不能大于当前系统日期!");
|
||
return;
|
||
}
|
||
if ($("#ValueDate").val() < $("#ValueDateFrom").val()) {
|
||
main.message("起始日期不能大于结束日期!");
|
||
return;
|
||
}
|
||
if ($("#ParentFlag").prop("checked"))
|
||
ParentFlag = true;
|
||
else
|
||
ParentFlag = false;
|
||
window.location.href = tab + "?clientId=" + $("#ClientId").val() + "&startTime=" + $("#ValueDateFrom").val() + "&endTime=" + $("#ValueDate").val() + "&ParentFlag=" + ParentFlag;
|
||
return;
|
||
}
|
||
|
||
</script>
|
||
}
|
||
|
||
<div class="searchdiv">
|
||
@Html.MyAceDropdownInput("ClientId", "客户名称", ClientDataModel.GetAllClient(), false, true, null, false)
|
||
@Html.CheckBox("ParentFlag", false) @Html.Label(null,"包含子级", new { @style = "font-size:12px;" })
|
||
@Html.ShortInput("ValueDateFrom", "起始日期:")
|
||
@Html.ShortInput("ValueDate", "结束日期:")
|
||
@MyControls.SearchBtn()
|
||
@if (CurUser.结算管理_每日估值报告邮件发送)
|
||
{
|
||
@MyControls.Btn("配置报告", "PopDesc()")
|
||
@MyControls.Btn("发送报告", "SendReport()")
|
||
}
|
||
</div>
|
||
<br />
|
||
<fieldset id="fieldsetgbox_listGrid" style="margin-bottom: 20px;">
|
||
<div class="tabbable">
|
||
<ul id="myTab" class="nav nav-tabs nav-main">
|
||
<li class="nav-item">
|
||
<a class="nav-link" onclick='locationChange("/clientbalance/TradeMarketReport")'>账户状况</a>
|
||
<li class="nav-item">
|
||
<a class="nav-link" onclick='locationChange("/swaptrade2/TradeMarketReport_EodPosition")' id="positionTab">互换估值</a>
|
||
</li>
|
||
|
||
<li class="nav-item">
|
||
<a class="nav-link" onclick='locationChange("/clientbalance/TradeMarketReport_HistoricalPositionSwapFlow")' id="historySwapTab">互换交易流水</a>
|
||
</li>
|
||
<li class="nav-item">
|
||
<a class="nav-link" onclick='locationChange("/clientbalance/TradeMarketReport_BalanceStatement")'>资金明细</a>
|
||
</li>
|
||
<li class="nav-item">
|
||
<a class="nav-link active" href="#">质押记录</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div id="tableContent" class="yc-panel my-0 p-0">
|
||
@Html.Raw(JqGridSimple.OutTable())
|
||
</div>
|
||
</fieldset>
|
||
|
||
<fieldset id="fieldsetgbox_listGrid" class="ml-3">
|
||
@if (PS.Config.Company == CompanyEnum.浙商)
|
||
{
|
||
<span style="color:gray">
|
||
<p><span style="font-size: 12px;">1.【期初结存】:观察期初即上期期末的结存;</span></p>
|
||
<p><span style="font-size: 12px;">2.【出金入金】:观察区间内的入金(正)和出金(负)的净额;</span></p>
|
||
<p><span style="font-size: 12px;">3.【其他收支】:观察区间内的调整项;</span></p>
|
||
<p><span style="font-size: 12px;">4.【期末结存】:期末结存 = 期初结存+出金入金+已实现盈亏+其他收支;</span></p>
|
||
<p><span style="font-size: 12px;">5.【保证金占用】:根据观察期末的持仓交易按特定算法计算的盯市保证金额,即观察期末不可使用需要暂时冻结的资金;</span></p>
|
||
<p><span style="font-size: 12px;">6.【可用资金】:观察期末可用于达成新交易的资金规模,可用资金=期末结存-保证金占用;</span></p>
|
||
<p><span style="font-size: 12px;">7.【追保金额】:期末结存抵扣保证金占用后不足以抵扣的部分,追保金额=Max(0-可用资金,0); </span></p>
|
||
<p><span style="font-size: 12px;">8.【可取资金】:扣掉持仓亏损后(持仓盈利则不计算在内),观察期末被占用的可出金取出的资金,可取资金=期末结存-持仓亏损-保证金占用;</span></p>
|
||
<p><span style="font-size: 12px;">9.【已实现盈亏】:观察区间内平仓了结交易的盈亏;</span></p>
|
||
<p><span style="font-size: 12px;">10.【持仓盈亏】:观察期末存续交易的浮动盈亏;</span></p>
|
||
<p><span style="font-size: 12px;">11.【持仓市值】:观察期末存续交易的估值;</span></p>
|
||
<p><span style="font-size: 12px;">12.【总 资 产】:观察期末归属交易对手方的资产总额,总资产=期末结存+持仓市值 ;</span></p>
|
||
</span>
|
||
}
|
||
else
|
||
{
|
||
<span style="color:gray">
|
||
@Html.Raw(DBCacheManager.Single.GetStr(CacheTable.DingShiDesc))
|
||
</span>
|
||
}
|
||
</fieldset>
|