diff --git a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 021fee6..e83290c 100644 --- a/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/Bank/BankBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -35,14 +35,14 @@ namespace BankBusinessLogic.OfficePackage { CreateRow(new PdfRowParameters { - Texts = new List { entry.CardNumber.ToString(), entry.DateCreate.ToShortDateString(), entry.ComputerName, entry.Sum.ToString(), entry.OrderStatus.ToString() }, + Texts = new List { entry.CardNumber.ToString(), }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } CreateParagraph(new PdfParagraph { - Text = $"Итого: {info.OperationsRequests.Sum(x => x.Sum)}\t", + Text = "", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right @@ -75,14 +75,14 @@ namespace BankBusinessLogic.OfficePackage { CreateRow(new PdfRowParameters { - Texts = new List { entry.CardNumber.ToString(), entry.DateCreate.ToShortDateString(), entry.ComputerName, entry.Sum.ToString(), entry.OrderStatus.ToString() }, + Texts = new List { entry.CardNumber.ToString(), }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); } CreateParagraph(new PdfParagraph { - Text = $"Итого: {info.OperationsRequests.Sum(x => x.Sum)}\t", + Text = "", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right diff --git a/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs index 7ec95ac..ab9fc75 100644 --- a/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs +++ b/Bank/BankBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -16,13 +16,13 @@ namespace BankBusinessLogic.OfficePackage.Implements { private WordprocessingDocument? _wordDocument; private Body? _docBody; + /// /// Получение типа выравнивания /// /// /// - private static JustificationValues - GetJustificationValues(WordJustificationType type) + private static JustificationValues GetJustificationValues(WordJustificationType type) { return type switch { @@ -31,6 +31,7 @@ namespace BankBusinessLogic.OfficePackage.Implements _ => JustificationValues.Left, }; } + /// /// Настройки страницы /// @@ -45,13 +46,13 @@ namespace BankBusinessLogic.OfficePackage.Implements properties.AppendChild(pageSize); return properties; } + /// /// Задание форматирования для абзаца /// /// /// - private static ParagraphProperties? - CreateParagraphProperties(WordTextProperties? paragraphProperties) + private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties) { if (paragraphProperties == null) { @@ -80,6 +81,7 @@ namespace BankBusinessLogic.OfficePackage.Implements properties.AppendChild(paragraphMarkRunProperties); return properties; } + protected override void CreateWord(WordInfo info) { _wordDocument = WordprocessingDocument.Create(info.FileName, @@ -88,6 +90,7 @@ namespace BankBusinessLogic.OfficePackage.Implements mainPart.Document = new Document(); _docBody = mainPart.Document.AppendChild(new Body()); } + protected override void CreateParagraph(WordParagraph paragraph) { if (_docBody == null || paragraph == null) @@ -117,6 +120,7 @@ namespace BankBusinessLogic.OfficePackage.Implements } _docBody.AppendChild(docParagraph); } + protected override void SaveWord(WordInfo info) { if (_docBody == null || _wordDocument == null) @@ -126,6 +130,86 @@ namespace BankBusinessLogic.OfficePackage.Implements _docBody.AppendChild(CreateSectionProperties()); _wordDocument.MainDocumentPart!.Document.Save(); _wordDocument.Dispose(); - } - } + } + + protected override void CreateTable(WordTable table) + { + if (_docBody == null || table == null) + { + return; + } + Table docTable = new Table(); + TableProperties tableProps = new TableProperties( + new TableBorders( + new TopBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new BottomBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new LeftBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new RightBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new InsideHorizontalBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + }, + new InsideVerticalBorder + { + Val = new EnumValue(BorderValues.Single), + Size = 12 + } + ) + ); + docTable.AppendChild(tableProps); + TableGrid tableGrid = new TableGrid(); + for (int i = 0; i < table.Columns; i++) + { + tableGrid.AppendChild(new GridColumn()); + } + docTable.AppendChild(tableGrid); + TableRow tableRow = new TableRow(); + foreach (var text in table.Headers) + { + tableRow.AppendChild(CreateTableCell(text)); + } + int height = table.RowText.Count; + int width = table.Columns; + docTable.AppendChild(tableRow); + for (int i = 0; i < height; i++) + { + tableRow = new TableRow(); + for (int j = 0; j < width; j++) + { + var element = table.RowText[i][j]; + tableRow.AppendChild(CreateTableCell(element)); + } + docTable.AppendChild(tableRow); + } + _docBody.AppendChild(docTable); + } + + private TableCell CreateTableCell(string element) + { + var tableParagraph = new Paragraph(); + var run = new Run(); + run.AppendChild(new Text { Text = element }); + tableParagraph.AppendChild(run); + var tableCell = new TableCell(); + tableCell.AppendChild(tableParagraph); + return tableCell; + } + } } diff --git a/Bank/BankManagersClientApp/Controllers/HomeController.cs b/Bank/BankManagersClientApp/Controllers/HomeController.cs index 578d1e2..5902ee8 100644 --- a/Bank/BankManagersClientApp/Controllers/HomeController.cs +++ b/Bank/BankManagersClientApp/Controllers/HomeController.cs @@ -451,28 +451,32 @@ namespace BankManagersClientApp.Controllers { return Redirect("~/Home/Enter"); } - ViewBag.Withdrawals = APIClient.GetRequest>($"api/withdrawal/getwithdrawallist?managerid={APIClient.Client.Id}"); - ViewBag.Requests = APIClient.GetRequest>($"api/request/getrequestlist"); if (request != null && withdrawal != null) { APIClient.GetRequest($"api/withdrawal/linkwithdrawalrequest?withdrawalid={withdrawal}&requestid={request}"); return Redirect("Withdrawals"); } + ViewBag.Withdrawals = APIClient.GetRequest>($"api/withdrawal/getwithdrawallist?managerid={APIClient.Client.Id}"); + ViewBag.Requests = APIClient.GetRequest>($"api/request/getrequestlist"); return View(); } #endregion - #region//работа с отчётами + #region//Reports + [HttpGet] + public IActionResult RequestsListReport() { if (APIClient.Client == null) { return Redirect("~/Home/Enter"); } - return View(); + ViewBag.Accounts = APIClient.GetRequest>($"api/account/getaccountlist?managerid={APIClient.Client.Id}"); + return View(); } - public IActionResult TransfersWithdrawalsListReport() + [HttpGet] + public IActionResult TransfersWithdrawalsListReport() { if (APIClient.Client == null) { diff --git a/Bank/BankManagersClientApp/Views/Home/RequestsListReport.cshtml b/Bank/BankManagersClientApp/Views/Home/RequestsListReport.cshtml index 979252a..0abab9f 100644 --- a/Bank/BankManagersClientApp/Views/Home/RequestsListReport.cshtml +++ b/Bank/BankManagersClientApp/Views/Home/RequestsListReport.cshtml @@ -5,7 +5,7 @@ }
-

Список заяыок по счетам

+

Список заявок по счетам

@@ -18,10 +18,13 @@ }
+ + + +
-
-
-
+
+
\ No newline at end of file diff --git a/Bank/BankRestApi/Controllers/WithdrawalController.cs b/Bank/BankRestApi/Controllers/WithdrawalController.cs index 52480b4..53211e4 100644 --- a/Bank/BankRestApi/Controllers/WithdrawalController.cs +++ b/Bank/BankRestApi/Controllers/WithdrawalController.cs @@ -37,18 +37,18 @@ namespace BankRestApi.Controllers } [HttpGet] - public WithdrawalViewModel? GetWithdrawal(int WithdrawalId) + public WithdrawalViewModel? GetWithdrawal(int withdrawalId) { try { return _logic.ReadElement(new WithdrawalSearchModel { - Id = WithdrawalId + Id = withdrawalId }); } catch (Exception ex) { - _logger.LogError(ex, "Ошибка получения выдачи по Id={Id}", WithdrawalId); + _logger.LogError(ex, "Ошибка получения выдачи по Id={Id}", withdrawalId); throw; } }