diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs index 30eef2d..39e2fc9 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/ReportClientLogic.cs @@ -41,6 +41,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics DateTo = model.DateTo, }).Select(x => new ReportClientViewModel { + OperationId = x.Id, CardNumber = x.CardNumber, SumOperation = x.Sum, DateComplite = x.DateOpen @@ -55,6 +56,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics DateFrom = model.DateTo, }).Select(x => new ReportClientViewModel { + OperationId = x.Id, CardNumber = x.CardNumber, SumOperation = x.Sum, DateComplite = x.DateClose @@ -87,7 +89,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics _saveToPdf.CreateDoc(new PdfInfo { FileName = model.FileName, - Title = "Отчёт по операциям с картой", + Title = "Отчёт по операциям с картами", DateFrom = model.DateFrom!.Value, DateTo = model.DateTo!.Value, ReportCrediting = GetCrediting(model), diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs index 8642322..433c6cc 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/OfficePackage/AbstractSaveToPdfClient.cs @@ -17,52 +17,68 @@ namespace BankYouBankruptBusinessLogic.OfficePackage CreateParagraph(new PdfParagraph { - Text = info.Title, - Style = "NormalTitle", + Text = info.Title + $"\nот { DateTime.Now.ToShortDateString() }", + + Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { - Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", + Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateTable(new List { "5cm", "5cm", "5cm"}); + //параграф с отчётом на пополнения + CreateParagraph(new PdfParagraph { Text = "Отчёт по пополнениям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + + CreateTable(new List { "3cm", "3cm", "5cm", "5cm"}); CreateRow(new PdfRowParameters { - Texts = new List { "Номер карты", "Сумма", "Дата операции" }, + Texts = new List { "Номер операции", "Номер карты", "Сумма", "Дата операции" }, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateParagraph(new PdfParagraph { Text = "Отчёт по пополнениям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); - foreach (var report in info.ReportCrediting) { CreateRow(new PdfRowParameters { - Texts = new List { report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() }, + Texts = new List { report.OperationId.ToString(), report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } + //подсчёт суммы операций на пополнение + CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма поступлений за период: {info.ReportCrediting.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right }); + + //отчёт с отчётом на снятие CreateParagraph(new PdfParagraph { Text = "Отчёт по снятиям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + CreateTable(new List { "3cm", "3cm", "5cm", "5cm" }); + + CreateRow(new PdfRowParameters + { + Texts = new List { "Номер операции", "Номер карты", "Сумма", "Дата операции" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + foreach (var report in info.ReportDebiting) { CreateRow(new PdfRowParameters { - Texts = new List { report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() }, + Texts = new List { report.OperationId.ToString(), report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } - //CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right }); + //подсчёт суммы операций на пополнение + CreateParagraph(new PdfParagraph { Text = $"Итоговая сумма снятий за период: {info.ReportDebiting.Sum(x => x.SumOperation)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right }); SavePdf(info); } diff --git a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs index b174270..82cc9cd 100644 --- a/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs +++ b/BankYouBankrupt/BankYouBankruptContracts/ViewModels/ReportClientViewModel.cs @@ -8,6 +8,8 @@ namespace BankYouBankruptContracts.ViewModels { public class ReportClientViewModel { + public int OperationId { get; set; } + public string CardNumber { get; set; } public double SumOperation { get; set; } diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs index 0dedc98..6b7a6fb 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Implements/DebitingStorage.cs @@ -49,7 +49,7 @@ namespace BankYouBankruptDatabaseImplement.Implements { return context.Debitings .Include(x => x.Card) - .Where(x => x.DateOpen >= model.DateFrom && x.DateClose <= model.DateTo) + .Where(x => x.DateOpen <= model.DateFrom && x.DateClose >= model.DateTo) .Select(x => x.GetViewModel) .ToList(); } diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs index a8628b7..daae94b 100644 --- a/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs +++ b/BankYouBankrupt/BankYouBankruptRestAPI/Controllers/ReportController.cs @@ -34,7 +34,7 @@ namespace BankYouBankruptRestAPI.Controllers { _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel { - FileName = "Отчёт по картам", + FileName = "Отчёт по картам за " + DateTime.Now.ToShortDateString() + ".pdf", DateFrom = model.DateFrom, DateTo = model.DateTo }); diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf deleted file mode 100644 index 8a3adf9..0000000 Binary files a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам (2).pdf and /dev/null differ diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам за 18.05.2023.pdf b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам за 18.05.2023.pdf new file mode 100644 index 0000000..97b5aee Binary files /dev/null and b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам за 18.05.2023.pdf differ diff --git a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf b/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf deleted file mode 100644 index 6671627..0000000 Binary files a/BankYouBankrupt/BankYouBankruptRestAPI/Отчёт по картам.pdf and /dev/null differ