diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs index 85a64d4..2495f23 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CashWithdrawalLogic.cs @@ -54,8 +54,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics public List? ReadList(CashWithdrawalSearchModel? model) { - _logger.LogInformation("ReadElement. AccountId:{AccountId}. Sum:{Sum}. DateOperation:{DateOperation}. Id:{Id}", - model.AccountId, model.Sum, model.DateTo, model?.Id); + _logger.LogInformation("ReadElement. AccountId:{AccountId}. Sum:{Sum}. DateOperation:{DateOperation}. Id:{Id}", + model?.AccountId, model?.Sum, model?.DateTo, model?.Id); //list хранит весь список в случае, если model пришло со значением null на вход метода var list = model == null ? _cashWithdrawalStorage.GetFullList() : _cashWithdrawalStorage.GetFilteredList(model); diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/MoneyTransferLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/MoneyTransferLogic.cs index 8493244..ed1d7c3 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/MoneyTransferLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/MoneyTransferLogic.cs @@ -55,7 +55,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics public List? ReadList(MoneyTransferSearchModel? model) { _logger.LogInformation("ReadElement. AccountSenderId:{AccountSenderId}. AccountPayeeId:{AccountPayeeId}. Sum:{Sum}. Id:{Id}", - model.AccountSenderId, model.AccountPayeeId, model.Sum, model?.Id); + model?.AccountSenderId, model?.AccountPayeeId, model?.Sum, model?.Id); //list хранит весь список в случае, если model пришло со значением null на вход метода var list = model == null ? _moneyTransferStorage.GetFullList() : _moneyTransferStorage.GetFilteredList(model); diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs index b216411..f4ce841 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs @@ -1,6 +1,7 @@ using BankYouBankruptCashierApp.Models; using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.ViewModels; +using BankYouBankruptDataModels.Enums; using Microsoft.AspNetCore.Mvc; using System.Diagnostics; using System.Xml.Linq; @@ -420,12 +421,44 @@ namespace BankYouBankruptCashierApp.Controllers ViewBag.Accounts = APICashier.GetRequest>("/api/Account/GetAllAccounts"); - return View(); + return View(new List()); } - #region Получение отчёта PDF + [HttpPost] + public IActionResult ReportWithAccounts(string accountId) + { + if (APICashier.Cashier == null) + { + return Redirect("~/Home/Enter"); + } - [HttpGet] + ViewBag.Accounts = APICashier.GetRequest>("/api/Account/GetAllAccounts"); + var cashWithdrawals = APICashier.GetRequest>("api/Account/FindAllCashWithdrawal").Where(x => x.AccountId == int.Parse(accountId)) + .Select(x => new ReportCashierAccountsViewModel + { + CashierSurname = x.SurmaneCashier, + Sum = x.Sum, + AccountSenderNumber = x.AccountNumber, + DateOperation = x.DateOperation, + typeOperation = TypeOperationEnum.Снятие + }); + + var moneyTransfers = APICashier.GetRequest>("/api/Account/FindAllMoneyTransfer").Where(x => (x.AccountPayeeId == int.Parse(accountId) || x.AccountSenderId == int.Parse(accountId))) + .Select(x => new ReportCashierAccountsViewModel + { + CashierSurname = x.CashierSurname, + Sum = x.Sum, + AccountPayeeNumber = x.AccountPayeeNumber, + AccountSenderNumber = x.AccountSenderNumber, + DateOperation = x.DateOperation, + typeOperation = x.AccountSenderId.HasValue ? TypeOperationEnum.Перевод : TypeOperationEnum.Пополнение + }); + return View(cashWithdrawals.Concat(moneyTransfers).OrderBy(x => x.DateOperation).ToList()); + } + + #region Получение отчёта PDF + + [HttpGet] public IActionResult CreateReport() { if (APICashier.Cashier == null) diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml index 23818d8..5a521ba 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml @@ -1,6 +1,6 @@ @using BankYouBankruptContracts.ViewModels -@model ReportClientCardsViewModel +@model List? @{ ViewData["Title"] = "Отчет по аккаунтам"; @@ -30,28 +30,50 @@ - + - + @foreach (var item in Model) + { + + + + + + + + + }
- Номер карты - Тип операции - Сумма + Кассир - Статус + 1 Счет - Дата открытия + 2 Счет - Дата закрытия + Сумма операции + + Дата
+ @Html.DisplayFor(modelItem => item.typeOperation) + + @Html.DisplayFor(modelItem => item.CashierSurname) + + @Html.DisplayFor(modelItem => item.AccountSenderNumber) + + @Html.DisplayFor(modelItem => item.AccountPayeeNumber) + + @Html.DisplayFor(modelItem => item.Sum) + + @Html.DisplayFor(modelItem => item.DateOperation) +
diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Shared/_Layout.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Shared/_Layout.cshtml index 1bc2a55..bf4b73a 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Shared/_Layout.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Shared/_Layout.cshtml @@ -43,12 +43,16 @@ + + } }