diff --git a/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs b/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs index 6078833..f0deebd 100644 --- a/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/Bank/BankBusinessLogic/BusinessLogic/ReportLogic.cs @@ -109,7 +109,7 @@ namespace BankBusinessLogic.BusinessLogic public void SaveOperationsRequestsToPdfFile(ReportBindingModel model) { - _saveToPdf.CreateDoc(new PdfInfo + _saveToPdf.CreateOperationsRequestsDoc(new PdfInfo { FileName = model.FileName, Title = "Отчет по картам", @@ -132,7 +132,7 @@ namespace BankBusinessLogic.BusinessLogic public void SaveTransfersWithdrawalsToPdfFile(ReportBindingModel model) { - _saveToPdf.CreateDoc(new PdfInfo + _saveToPdf.CreateCreateTransfersDocDoc(new PdfInfo { FileName = model.FileName, Title = "Отчёт по счетам", diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 1f2238d..021fee6 100644 --- a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -11,7 +11,7 @@ namespace BankBusinessLogic.OfficePackage { public abstract class AbstractSaveToPdf { - public void CreateDoc(PdfInfo info) + public void CreateCreateTransfersDocDoc(PdfInfo info) { CreatePdf(info); CreateParagraph(new PdfParagraph @@ -48,12 +48,52 @@ namespace BankBusinessLogic.OfficePackage PdfParagraphAlignmentType.Right }); SavePdf(info); - } - /// - /// Создание doc-файла - /// - /// - protected abstract void CreatePdf(PdfInfo info); + } + public void CreateOperationsRequestsDoc(PdfInfo info) + { + CreatePdf(info); + CreateParagraph(new PdfParagraph + { + Text = info.Title, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + CreateParagraph(new PdfParagraph + { + Text = $"с{info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "3cm" }); + CreateRow(new PdfRowParameters + { + Texts = new List { "Номер", "Дата заказа", "Компьютер", "Сумма", "Статус" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + foreach (var entry in info.OperationsRequests) + { + CreateRow(new PdfRowParameters + { + Texts = new List { entry.CardNumber.ToString(), entry.DateCreate.ToShortDateString(), entry.ComputerName, entry.Sum.ToString(), entry.OrderStatus.ToString() }, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + } + CreateParagraph(new PdfParagraph + { + Text = $"Итого: {info.OperationsRequests.Sum(x => x.Sum)}\t", + Style = "Normal", + ParagraphAlignment = + PdfParagraphAlignmentType.Right + }); + SavePdf(info); + } + /// + /// Создание doc-файла + /// + /// + protected abstract void CreatePdf(PdfInfo info); /// /// Создание параграфа с текстом ///