Completed report pdf for Client.

This commit is contained in:
Programmist73 2023-05-18 11:31:42 +04:00
parent 7aeb202e56
commit a0e644d9d1
8 changed files with 33 additions and 13 deletions

View File

@ -41,6 +41,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
DateTo = model.DateTo, DateTo = model.DateTo,
}).Select(x => new ReportClientViewModel }).Select(x => new ReportClientViewModel
{ {
OperationId = x.Id,
CardNumber = x.CardNumber, CardNumber = x.CardNumber,
SumOperation = x.Sum, SumOperation = x.Sum,
DateComplite = x.DateOpen DateComplite = x.DateOpen
@ -55,6 +56,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
DateFrom = model.DateTo, DateFrom = model.DateTo,
}).Select(x => new ReportClientViewModel }).Select(x => new ReportClientViewModel
{ {
OperationId = x.Id,
CardNumber = x.CardNumber, CardNumber = x.CardNumber,
SumOperation = x.Sum, SumOperation = x.Sum,
DateComplite = x.DateClose DateComplite = x.DateClose
@ -87,7 +89,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
_saveToPdf.CreateDoc(new PdfInfo _saveToPdf.CreateDoc(new PdfInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Отчёт по операциям с картой", Title = "Отчёт по операциям с картами",
DateFrom = model.DateFrom!.Value, DateFrom = model.DateFrom!.Value,
DateTo = model.DateTo!.Value, DateTo = model.DateTo!.Value,
ReportCrediting = GetCrediting(model), ReportCrediting = GetCrediting(model),

View File

@ -17,52 +17,68 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
CreateParagraph(new PdfParagraph CreateParagraph(new PdfParagraph
{ {
Text = info.Title, Text = info.Title + $"\nот { DateTime.Now.ToShortDateString() }",
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateParagraph(new PdfParagraph CreateParagraph(new PdfParagraph
{ {
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Text = $"Расчётный период: с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateTable(new List<string> { "5cm", "5cm", "5cm"}); //параграф с отчётом на пополнения
CreateParagraph(new PdfParagraph { Text = "Отчёт по пополнениям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm"});
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { "Номер карты", "Сумма", "Дата операции" }, Texts = new List<string> { "Номер операции", "Номер карты", "Сумма", "Дата операции" },
Style = "NormalTitle", Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateParagraph(new PdfParagraph { Text = "Отчёт по пополнениям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
foreach (var report in info.ReportCrediting) foreach (var report in info.ReportCrediting)
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() }, Texts = new List<string> { report.OperationId.ToString(), report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left 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 }); CreateParagraph(new PdfParagraph { Text = "Отчёт по снятиям", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateTable(new List<string> { "3cm", "3cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер операции", "Номер карты", "Сумма", "Дата операции" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var report in info.ReportDebiting) foreach (var report in info.ReportDebiting)
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() }, Texts = new List<string> { report.OperationId.ToString(), report.CardNumber, report.SumOperation.ToString(), report.DateComplite.ToString() },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left 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); SavePdf(info);
} }

View File

@ -8,6 +8,8 @@ namespace BankYouBankruptContracts.ViewModels
{ {
public class ReportClientViewModel public class ReportClientViewModel
{ {
public int OperationId { get; set; }
public string CardNumber { get; set; } public string CardNumber { get; set; }
public double SumOperation { get; set; } public double SumOperation { get; set; }

View File

@ -49,7 +49,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
{ {
return context.Debitings return context.Debitings
.Include(x => x.Card) .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) .Select(x => x.GetViewModel)
.ToList(); .ToList();
} }

View File

@ -34,7 +34,7 @@ namespace BankYouBankruptRestAPI.Controllers
{ {
_reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
{ {
FileName = "Отчёт по картам", FileName = "Отчёт по картам за " + DateTime.Now.ToShortDateString() + ".pdf",
DateFrom = model.DateFrom, DateFrom = model.DateFrom,
DateTo = model.DateTo DateTo = model.DateTo
}); });