Compare commits

..

No commits in common. "b9f9b339ac076b8c6e8e8a5e40fea41734b9edbf" and "3508dc8751ece9f05d781624ef59ed75fbef93b4" have entirely different histories.

5 changed files with 4 additions and 111 deletions

View File

@ -12,11 +12,6 @@ namespace BankBusinessLogic.OfficePackage
{ {
public MemoryStream CreateOperatorDoc(PdfInfo info) public MemoryStream CreateOperatorDoc(PdfInfo info)
{ {
if (info.Transfers == null)
{
throw new ArgumentNullException("Данные для отчёта отсутсвуют!", nameof(info.Transfers));
}
CreatePdf(info); CreatePdf(info);
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });

View File

@ -17,6 +17,6 @@ namespace BankBusinessLogic.OfficePackage.HelperModels
public DateTime DateTo { get; set; } public DateTime DateTo { get; set; }
public List<ReportTransferCurrencyPurchaseViewModel>? Transfers { get; set; } = new(); public List<ReportTransferCurrencyPurchaseViewModel> Transfers { get; set; } = new();
} }
} }

View File

@ -101,14 +101,12 @@ namespace OperatorApp.Controllers
{ {
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
{ {
Response.WriteAsync($"<script language=\"javascript\">alert('Input login and password!');window.location.replace('/Home/Enter');</script>"); throw new Exception("Введите логин и пароль");
return;
} }
APIClient.Operator = _operatorLogic.ReadElement(new OperatorSearchModel { Login = login, Password = password }); APIClient.Operator = _operatorLogic.ReadElement(new OperatorSearchModel { Login = login, Password = password });
if (APIClient.Operator == null) if (APIClient.Operator == null)
{ {
Response.WriteAsync($"<script language=\"javascript\">alert('Wrong login or password!');window.location.replace('/Home/Enter');</script>"); throw new Exception("Неверный логин/пароль");
return;
} }
Response.Redirect("Index"); Response.Redirect("Index");
} }
@ -331,17 +329,5 @@ namespace OperatorApp.Controllers
Response.Redirect("/"); Response.Redirect("/");
} }
} }
public IActionResult ViewReport(DateTime dateFrom, DateTime dateTo)
{
if (APIClient.Operator == null)
{
Response.WriteAsync($"<script language=\"javascript\">alert('You need to login!');window.location.replace('/Home/Enter');</script>");
return Redirect("/Home/Enter");
}
ViewBag.DateFrom = dateFrom.ToShortDateString();
ViewBag.DateTo = dateTo.ToShortDateString();
return View(_reportLogic.GetTransferPurchase(new ReportBindingModel { DateFrom=dateFrom, DateTo = dateTo }));
}
} }
} }

View File

@ -7,7 +7,7 @@
<div class="text-center"> <div class="text-center">
<h2 class="display-4">Создание отчёта</h2> <h2 class="display-4">Создание отчёта</h2>
</div> </div>
<form asp-action="ViewReport" method="get"> <form method="post">
<div class="row"> <div class="row">
<div class="col-4">C:</div> <div class="col-4">C:</div>
<div class="col-8"> <div class="col-8">

View File

@ -1,88 +0,0 @@
@using BankContracts.ViewModels
@model List<ReportTransferCurrencyPurchaseViewModel>
@{
ViewData["Title"] = "View Report";
}
<div class="text-center">
<h1 class="display-4">Отчёт о зачислениях</h1>
<h1 class="display4">C @ViewBag.DateFrom по @ViewBag.DateTo</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table">
<thead>
<tr>
<th>
Номер зачисления
</th>
<th>
Дата зачисления
</th>
<th>
Номер закупки
</th>
<th>
Сумма
</th>
<th>
Валюта
</th>
<th>
Дата закупки
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
Зачисление №@item.TransferId
</td>
<td>
@Html.DisplayFor(modelItem => item.TransferDate)
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
@foreach (var purchase in item.Purchases){
<tr>
<td>
</td>
<td>
</td>
<td>
Закупка №@purchase.Id
</td>
<td>
@Html.DisplayFor(modelItem => purchase.Amount)
</td>
<td>
@Html.DisplayFor(modelItem => purchase.CurrencyName)
</td>
<td>
@Html.DisplayFor(modelItem => purchase.PurchaseDate)
</td>
</tr>
}
}
</tbody>
</table>
}
</div>