This commit is contained in:
Zakharov_Rostislav 2024-05-26 16:52:51 +04:00
parent b4eb8cd606
commit cb7913100c
2 changed files with 49 additions and 9 deletions

View File

@ -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 = "Отчёт по счетам",

View File

@ -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);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
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<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Компьютер", "Сумма", "Статус" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var entry in info.OperationsRequests)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { 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);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreatePdf(PdfInfo info);
/// <summary>
/// Создание параграфа с текстом
/// </summary>