From 639ae4eb659665905eb3fcc7b1757a4035e2d352 Mon Sep 17 00:00:00 2001 From: AnnaLioness Date: Mon, 25 Mar 2024 11:07:44 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/ReportLogic.cs | 20 +++++++------------ .../OfficePackage/AbstractSaveToExcel.cs | 14 ++++++------- .../OfficePackage/AbstractSaveToWord.cs | 5 ++++- .../OfficePackage/Implements/SaveToExcel.cs | 3 +-- .../ReportDocumentComponentViewModel.cs | 4 ++-- .../FormReportDocumentComponents.Designer.cs | 4 ++-- .../FormReportDocumentComponents.cs | 4 ++-- .../FormReportDocumentComponents.resx | 9 --------- 8 files changed, 24 insertions(+), 39 deletions(-) diff --git a/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs index ced4cf6..0f727d3 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/BusinessLogic/ReportLogic.cs @@ -39,26 +39,20 @@ namespace AbstractLawFirmBusinessLogic.BusinessLogic /// public List GetDocumentComponent() { - var components = _componentStorage.GetFullList(); - var products = _documentStorage.GetFullList(); + var documents = _documentStorage.GetFullList(); var list = new List(); - foreach (var component in components) + foreach (var document in documents) { var record = new ReportDocumentComponentViewModel { - ComponentName = component.ComponentName, - Documents = new List>(), + DocumentName = document.DocumentName, + Components = new List<(string Component, int Count)>(), TotalCount = 0 }; - foreach (var product in products) + foreach (var component in document.DocumentComponents.Values) { - if (product.DocumentComponents.ContainsKey(component.Id)) - { - record.Documents.Add(new Tuple(product.DocumentName, product.DocumentComponents[component.Id].Item2)); - record.TotalCount += - product.DocumentComponents[component.Id].Item2; - } + record.Components.Add((component.Item1.ComponentName, component.Item2)); + record.TotalCount += component.Item2; } list.Add(record); } diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 92658ad..44c6cbc 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -36,27 +36,25 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage { ColumnName = "A", RowIndex = rowIndex, - Text = pc.ComponentName, + Text = pc.DocumentName, StyleInfo = ExcelStyleInfoType.Text }); rowIndex++; - foreach (var document in pc.Documents) + foreach (var (Component, Count) in pc.Components) { InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "B", RowIndex = rowIndex, - Text = document.Item1, - StyleInfo = - ExcelStyleInfoType.TextWithBorder + Text = Component, + StyleInfo = ExcelStyleInfoType.TextWithBorder }); InsertCellInWorksheet(new ExcelCellParameters { ColumnName = "C", RowIndex = rowIndex, - Text = document.Item2.ToString(), - StyleInfo = - ExcelStyleInfoType.TextWithBorder + Text = Count.ToString(), + StyleInfo = ExcelStyleInfoType.TextWithBorder }); rowIndex++; } diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs index 3d681a7..65b5531 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -26,7 +26,10 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage { CreateParagraph(new WordParagraph { - Texts = new List<(string, WordTextProperties)> {(document.DocumentName, new WordTextProperties { Size = "24", }) }, + Texts = new List<(string, WordTextProperties)> { + (document.DocumentName + " - ", new WordTextProperties { Size = "24", Bold = true}), + (document.Price.ToString(), new WordTextProperties { Size = "24", }) + }, TextProperties = new WordTextProperties { Size = "24", diff --git a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExcel.cs index 26fce78..947a3ba 100644 --- a/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExcel.cs +++ b/LawFirm/AbstractLawFirmBusinessLogic/OfficePackage/Implements/SaveToExcel.cs @@ -105,8 +105,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements var cellFormatFont = new CellFormat() { NumberFormatId = 0U, - FontId = - 0U, + FontId = 0U, FillId = 0U, BorderId = 0U, FormatId = 0U, diff --git a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs index 4dae6fb..4835f9f 100644 --- a/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs +++ b/LawFirm/AbstractLawFirmContracts/AbstractLawFirmContracts/ViewModels/ReportDocumentComponentViewModel.cs @@ -8,8 +8,8 @@ namespace AbstractLawFirmContracts.ViewModels { public class ReportDocumentComponentViewModel { - public string ComponentName { get; set; } = string.Empty; + public string DocumentName { get; set; } = string.Empty; public int TotalCount { get; set; } - public List> Documents { get; set; } = new(); + public List<(string Component, int Count)> Components { get; set; } = new(); } } diff --git a/LawFirm/LawFirmView/FormReportDocumentComponents.Designer.cs b/LawFirm/LawFirmView/FormReportDocumentComponents.Designer.cs index 25363d3..a411e08 100644 --- a/LawFirm/LawFirmView/FormReportDocumentComponents.Designer.cs +++ b/LawFirm/LawFirmView/FormReportDocumentComponents.Designer.cs @@ -62,12 +62,12 @@ // // Column1 // - this.Column1.HeaderText = "Компонент"; + this.Column1.HeaderText = "Пакет документов"; this.Column1.Name = "Column1"; // // Column2 // - this.Column2.HeaderText = "Пакет документов"; + this.Column2.HeaderText = "Компонент"; this.Column2.Name = "Column2"; // // Column3 diff --git a/LawFirm/LawFirmView/FormReportDocumentComponents.cs b/LawFirm/LawFirmView/FormReportDocumentComponents.cs index 074f7cc..c7fa6da 100644 --- a/LawFirm/LawFirmView/FormReportDocumentComponents.cs +++ b/LawFirm/LawFirmView/FormReportDocumentComponents.cs @@ -34,8 +34,8 @@ namespace LawFirmView dataGridView.Rows.Clear(); foreach (var elem in dict) { - dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); - foreach (var listElem in elem.Documents) + dataGridView.Rows.Add(new object[] { elem.DocumentName, "", "" }); + foreach (var listElem in elem.Components) { dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); } diff --git a/LawFirm/LawFirmView/FormReportDocumentComponents.resx b/LawFirm/LawFirmView/FormReportDocumentComponents.resx index a9dc853..cdfa6a5 100644 --- a/LawFirm/LawFirmView/FormReportDocumentComponents.resx +++ b/LawFirm/LawFirmView/FormReportDocumentComponents.resx @@ -66,13 +66,4 @@ True - - True - - - True - - - True - \ No newline at end of file