diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs index b4bc8dc..8642322 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs @@ -29,9 +29,11 @@ namespace BankYouBankruptBusinessLogic.OfficePackage ParagraphAlignment = PdfParagraphAlignmentType.Center }); + CreateTable(new List { "5cm", "5cm", "5cm"}); + CreateRow(new PdfRowParameters { - Texts = new List { "Номер карты", "Сумма операции", "Дата операции" }, + Texts = new List { "Номер карты", "Сумма", "Дата операции" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToExcel.cs index db80012..960108d 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToExcel.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToExcel.cs @@ -14,7 +14,7 @@ using System.Threading.Tasks; namespace BankYouBankruptBusinessLogic.OfficePackage.Implements { - public class SaveToExcel : AbstractSaveToExcelCashier + public class SaveToExcel : AbstractSaveToExcelClient { private SpreadsheetDocument? _spreadsheetDocument; diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToWord.cs index bce0ce5..3da7708 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToWord.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -8,7 +8,7 @@ using DocumentFormat.OpenXml.Wordprocessing; namespace BankYouBankruptBusinessLogic.OfficePackage.Implements { //реализация абстрактного класса сохранения в word - public class SaveToWord : AbstractSaveToWordCashier + public class SaveToWord : AbstractSaveToWordClient { private WordprocessingDocument? _wordDocument; diff --git a/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs b/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs index 71b9c51..44a90a5 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/APIClient.cs @@ -32,8 +32,6 @@ namespace BankYouBankruptСlientApp { throw new Exception(result); } - - return JsonConvert.DeserializeObject(""); } //Post-запрос diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs index 7824189..f0b5485 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs +++ b/BankYouBankrupt/BankYouBankruptClientApp/Controllers/HomeController.cs @@ -260,7 +260,7 @@ namespace BankYouBankruptClientApp.Controllers throw new Exception("Не авторизованы"); } - APIClient.PostRequest("/api/Report/CreateClientReport", new ReportBindingModel() + APIClient.PostRequest("api/Report/CreateClientReport", new ReportSupportBindingModel() { DateFrom = dateFrom, DateTo = dateTo diff --git a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateReport.cshtml b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateReport.cshtml index 2351ed3..27f97d1 100644 --- a/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateReport.cshtml +++ b/BankYouBankrupt/BankYouBankruptClientApp/Views/Home/CreateReport.cshtml @@ -21,7 +21,7 @@
- +
\ No newline at end of file diff --git a/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs b/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs new file mode 100644 index 0000000..e013c81 --- /dev/null +++ b/BankYouBankrupt/BankYouBankruptContracts/BindingModels/ReportSupportBindingModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankYouBankruptContracts.BindingModels +{ + //вспомогательная модель для передачи DateTime при формировании отчёта + public class ReportSupportBindingModel + { + public DateTime DateFrom { get; set; } + + public DateTime DateTo { get; set; } + } +} diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs index e5b57a2..a79c398 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/CreditingStorage.cs @@ -43,6 +43,15 @@ namespace BankYouBankruptDatabaseImplement.Implements List cards = context.Cards.Where(x => x.ClientID == model.UserId).Select(x => x.Id).ToList(); return context.Creditings.Include(x => x.Card).Where(x => cards.Contains(x.CardId)).Select(x => x.GetViewModel).ToList(); } + + if(model.DateFrom.HasValue && model.DateTo.HasValue) + { + return context.Creditings + .Include(x => x.Card) + .Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo) + .Select(x => x.GetViewModel) + .ToList(); + } return context.Creditings .Include(x => x.Card) diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs index bd75e06..0dedc98 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs @@ -45,7 +45,16 @@ namespace BankYouBankruptDatabaseImplement.Implements return context.Debitings.Include(x => x.Card).Where(x => cards.Contains(x.CardId)).Select(x => x.GetViewModel).ToList(); } - return context.Debitings + if (model.DateFrom.HasValue && model.DateTo.HasValue) + { + return context.Debitings + .Include(x => x.Card) + .Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo) + .Select(x => x.GetViewModel) + .ToList(); + } + + return context.Debitings .Include(x => x.Card) .Select(x => x.GetViewModel) .ToList(); diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs index a47ac76..a8628b7 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs @@ -15,28 +15,28 @@ namespace BankYouBankruptRestAPI.Controllers { private readonly ILogger _logger; - private readonly IReportCashierLogic _reportCashierLogic; + //private readonly IReportCashierLogic _reportCashierLogic; private readonly IReportClientLogic _reportClientLogic; - public ReportController(ILogger logger, IReportClientLogic reportClientLogic, IReportCashierLogic reportCashierLogic) + public ReportController(ILogger logger, IReportClientLogic reportClientLogic) { _logger = logger; _reportClientLogic = reportClientLogic; - _reportCashierLogic = reportCashierLogic; + //_reportCashierLogic = reportCashierLogic; } //метод генерации отчёта за период по картам клиента - [HttpGet] - public void CreateClientReport(DateTime DateFrom, DateTime DateTo) + [HttpPost] + public void CreateClientReport(ReportSupportBindingModel model) { try { _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel { - FileName = "Отчёт по картам от " + DateTime.Now.ToShortDateString(), - DateFrom = DateFrom, - DateTo = DateTo + FileName = "Отчёт по картам", + DateFrom = model.DateFrom, + DateTo = model.DateTo }); } catch (Exception ex) diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Program.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Program.cs index 271549f..ebf2cd2 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Program.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Program.cs @@ -31,7 +31,10 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); //builder.Services.AddTransient(); builder.Services.AddControllers(); diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf new file mode 100644 index 0000000..8a3adf9 Binary files /dev/null and b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf differ diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf new file mode 100644 index 0000000..6671627 Binary files /dev/null and b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf differ