diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs index 192548e..de204e4 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs @@ -164,7 +164,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics { FileName = model.FileName, Title = "Отчёт по снятиям денежных средств", - Crediting = GetExcelCrediting(model) + Debiting = GetExcelDebiting(model) }, operationEnum); } } diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 019b92d..77e765a 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -360,7 +360,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage { ColumnName = "C", RowIndex = rowIndex, - Text = info.Crediting.Sum(x => x.Sum).ToString(), + Text = info.Debiting.Sum(x => x.Sum).ToString(), StyleInfo = ExcelStyleInfoType.Text }); diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs index fc5fb2c..f49eeb3 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Controllers/HomeController.cs @@ -3,6 +3,7 @@ using BankYouBankruptContracts.BindingModels; using BankYouBankruptContracts.ViewModels; using BankYouBankruptContracts.ViewModels.Client.Default; using BankYouBankruptContracts.ViewModels.Client.Diagram; +using BankYouBankruptContracts.ViewModels.Client.Reports; using BankYouBankruptDataModels.Enums; using Microsoft.AspNetCore.Mvc; using System.Diagnostics; @@ -464,7 +465,24 @@ namespace BankYouBankruptCashierApp.Controllers return View(new List()); } - [HttpPost] + //создание excel отчёта у касира + [HttpPost] + public IActionResult CreateCashierExcelReport(string accountId) + { + if (APICashier.Cashier == null) + { + throw new Exception("Не авторизованы"); + } + + APICashier.PostRequest("api/Report/CreateExcelCashier", new ReportSupportBindingModel() + { + AccountId = int.Parse(accountId) + }); + + return Redirect("~/Home/Enter"); + } + + [HttpPost] public IActionResult ReportWithAccounts(string accountId) { if (APICashier.Cashier == null) diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml index d226875..3b54dbe 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/ReportWithAccounts.cshtml @@ -22,6 +22,9 @@
+
+ +
diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs index e452238..65b119d 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs @@ -311,6 +311,22 @@ namespace BankYouBankruptClientApp.Controllers return Redirect("~/Home/Enter"); } + [HttpPost] + public IActionResult CreateDebitingExcelReport(List cards) + { + if (APIClient.Client == null) + { + throw new Exception("Не авторизованы"); + } + + APIClient.PostRequest("api/Report/CreateExcelDebiting", new ReportSupportBindingModel() + { + CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList() + }); + + return Redirect("~/Home/Enter"); + } + #endregion #region Получение отчета по картам diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml index 33f0065..005d70a 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/ReportWithCards.cshtml @@ -28,12 +28,15 @@
-
+
-
+
+
+ +
diff --git a/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs b/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs index 82bf093..744c0f1 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs @@ -12,6 +12,8 @@ namespace BankYouBankruptContracts.BindingModels { public int ClientId { get; set; } + public int AccountId { get; set; } + public DateTime DateFrom { get; set; } public DateTime DateTo { get; set; } diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs index f6da290..adda4d6 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs @@ -132,5 +132,44 @@ namespace BankYouBankruptRestAPI.Controllers throw; } } + + //отчёт клиента Excel по выдаче денег + [HttpPost] + public void CreateExcelDebiting(ReportSupportBindingModel model) + { + try + { + _reportClientLogic.SaveToExcelFile(new ReportBindingModel + { + FileName = "Отчёт по снятиям.xls", + CardList = model.CardList + }, ExcelOperationEnum.Cнятие_с_карты); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка входа в систему"); + throw; + } + } + + //отчёт клиента Excel по переводу денег + [HttpPost] + public void CreateExcelCashier(ReportSupportBindingModel model) + { + try + { + _reportCashierLogic.SaveToExcelFile(new ReportBindingModel + { + FileName = "Отчёт по переводам.xls", + CardList = model.CardList + }, ExcelOperationEnum.Между_cчетами); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка входа в систему"); + throw; + } + } + } } diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по снятиям.xls b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по снятиям.xls new file mode 100644 index 0000000..47f5100 Binary files /dev/null and b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по снятиям.xls differ