资金监控改成字节流导出
This commit is contained in:
@@ -328,7 +328,7 @@ namespace YLErp.BLL.Eod
|
||||
select t;
|
||||
|
||||
ProcessAllTrades(tQuery);
|
||||
ProcessTodayFinishedTrades(startDate, tQuery);
|
||||
//ProcessTodayFinishedTrades(startDate, tQuery);
|
||||
ProcessTodayTradesAfterConfirmed();
|
||||
}
|
||||
|
||||
@@ -1197,6 +1197,7 @@ namespace YLErp.BLL.Eod
|
||||
else if (data.action == "应收^" + ClientCashInCashOut.系统操作_平仓费)
|
||||
{
|
||||
balance.SwapBalance += data.moneySum;
|
||||
balance.WinLoss += data.moneySum;
|
||||
}
|
||||
else if (data.action == "入金^")
|
||||
{
|
||||
@@ -1309,7 +1310,7 @@ namespace YLErp.BLL.Eod
|
||||
{
|
||||
balance.UpdateDate = balance.UpdateDate > lastEodSwap.OptTime ? balance.UpdateDate : lastEodSwap.OptTime;
|
||||
}
|
||||
balance.WinLoss += Convert.ToDouble(tdRealizedPnL) * -1;
|
||||
//balance.WinLoss += Convert.ToDouble(tdRealizedPnL) * -1;
|
||||
balance.PositionPnl += Convert.ToDouble(pnl) * -1;
|
||||
balance.RoundedPositionPnl += Math.Round(Convert.ToDouble(pnl), 2) * -1;
|
||||
//期权空头浮动盈利=∑max(期权空头持仓*(期权合约成本价-期权合约现价), 0) 从客户角度看的
|
||||
|
||||
@@ -611,11 +611,13 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
{
|
||||
CurrChangeAmount += clientEntryexit.Money ?? 0.0;
|
||||
SwapBalance += clientEntryexit.Money ?? 0.0;
|
||||
WinLoss += clientEntryexit.Money ?? 0.0;
|
||||
}
|
||||
else if (ClientCashInCashOut.系统操作_互换.Equals(clientEntryexit.Action))
|
||||
{
|
||||
CurrChangeAmount += clientEntryexit.Money ?? 0.0;
|
||||
SwapBalance += clientEntryexit.Money ?? 0.0;
|
||||
WinLoss += clientEntryexit.Money ?? 0.0;
|
||||
}
|
||||
|
||||
if (ClientCashInCashOut.已确认.Equals(clientEntryexit.State))
|
||||
@@ -804,11 +806,6 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
var todaySwapFinishedTradeIds = todaySwapFinishedTrades.Select(s => s.id).ToList();
|
||||
var todaySwapFinishedCash = clientEntryexits_swap.Where(x => todaySwapFinishedTradeIds.Contains(x.TradeId ?? 0)).ToList();
|
||||
var list = todayFinishedTradeCash.ToList();
|
||||
WinLoss = todayFinishedTrades.ToArray().Sum(t =>
|
||||
t.TradeType != "远期" ?
|
||||
-TradeCalcHelper.GetSign(t.BuySell) * (t.TradePrice ?? 0) * finishedTradeNotionalPercentDic[t.id] + (todayFinishedTradeCash.FirstOrDefault(x => x.tradeId == t.id)?.amountSum ?? 0)
|
||||
// 远期客户角度的实现盈亏 = 开仓总费用+平仓总费用
|
||||
: (t.TradePrice ?? 0) * finishedTradeNotionalPercentDic[t.id] + (todayFinishedTradeCash.FirstOrDefault(x => x.tradeId == t.id)?.amountSum ?? 0)) * -1;
|
||||
//了结开仓费用
|
||||
EndPremium = todayFinishedTrades.Sum(t => t.TradeType != "远期" ? -TradeCalcHelper.GetSign(t.BuySell) * (t.TradePrice ?? 0) * finishedTradeNotionalPercentDic[t.id] : (t.TradePrice ?? 0) * finishedTradeNotionalPercentDic[t.id]) * -1;
|
||||
EndPremium = EndPremium + todaySwapFinishedCash.Sum(s => s.Money ?? 0);
|
||||
@@ -850,7 +847,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
var lastEodSwapPosition = eodSwapPosis.FirstOrDefault(t => t.SwapTradeId == item.SwapTradeId && t.ValueDate == preBalanceDate&&t.PosiStartDate<= preBalanceDate);
|
||||
var eodSwapPosition = clientEodSwapPositionLast.FirstOrDefault(t => t.SwapTradeId == item.SwapTradeId && t.ValueDate == balanceDate && t.PosiStartDate <= balanceDate);
|
||||
PotentialSurpluses += Convert.ToDouble(item.PostionValue) * (-1);
|
||||
WinLoss += Convert.ToDouble(item.TdRealizedPnL) * (-1);
|
||||
// WinLoss += Convert.ToDouble(item.TdRealizedPnL) * (-1);
|
||||
var lastPv = lastEodSwap != null ? Convert.ToDouble(lastEodSwap.PostionValue- lastEodSwapPosition?.VTradingFee+lastEodSwapPosition?.PosiFeePending) * (-1) : 0;
|
||||
eodPnlSum.LastPvSum = eodPnlSum.LastPvSum.HasValue ? eodPnlSum.LastPvSum + lastPv : lastPv;
|
||||
var pnl = item.PostionValue- eodSwapPosition?.VTradingFee+ eodSwapPosition?.PosiFeePending;
|
||||
|
||||
@@ -924,7 +924,14 @@ namespace YLErp.Web.Controllers
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
new ExcelTemplateGenerator().SetTemplateFile(sourceFileName).SetTemplateData(modleDict).OutputToFile(result.PhysicalPath);
|
||||
|
||||
return JsonSuccess("导出资金监控成功", result.WebPath);
|
||||
// 读取字节流
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(result.PhysicalPath);
|
||||
|
||||
// 删除临时文件
|
||||
System.IO.File.Delete(result.PhysicalPath);
|
||||
|
||||
// 返回文件流
|
||||
return File(fileBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", targetFileName);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -448,9 +448,27 @@ function execExport() {
|
||||
postData.StartDate = $("#startDate").val();
|
||||
postData.ValueDate = $("#endDate").val();
|
||||
postData.MarginShownType = $("#ShownType").val();
|
||||
main.post("/client/ClientBanlanceExport", postData).done(function (res) {
|
||||
main.downloadFiles(res.obj);
|
||||
});
|
||||
// 构造并提交表单
|
||||
var $form = $('<form method="post" style="display:none"></form>');
|
||||
$form.attr('action', '/client/ClientBanlanceExport');
|
||||
for (var key in postData) {
|
||||
if (postData.hasOwnProperty(key)) {
|
||||
var value = postData[key];
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(function (v) {
|
||||
$form.append($('<input type="hidden" name="' + key + '" />').val(v));
|
||||
});
|
||||
} else {
|
||||
$form.append($('<input type="hidden" name="' + key + '" />').val(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
$('body').append($form);
|
||||
$form.submit();
|
||||
$form.remove();
|
||||
//main.post("/client/ClientBanlanceExport", postData).done(function (res) {
|
||||
// // main.downloadFiles(res.obj);
|
||||
//});
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user