правки

This commit is contained in:
AnnaLioness 2024-03-25 11:07:44 +04:00
parent d0f6d47893
commit 639ae4eb65
8 changed files with 24 additions and 39 deletions

View File

@ -39,26 +39,20 @@ namespace AbstractLawFirmBusinessLogic.BusinessLogic
/// <returns></returns> /// <returns></returns>
public List<ReportDocumentComponentViewModel> GetDocumentComponent() public List<ReportDocumentComponentViewModel> GetDocumentComponent()
{ {
var components = _componentStorage.GetFullList(); var documents = _documentStorage.GetFullList();
var products = _documentStorage.GetFullList();
var list = new List<ReportDocumentComponentViewModel>(); var list = new List<ReportDocumentComponentViewModel>();
foreach (var component in components) foreach (var document in documents)
{ {
var record = new ReportDocumentComponentViewModel var record = new ReportDocumentComponentViewModel
{ {
ComponentName = component.ComponentName, DocumentName = document.DocumentName,
Documents = new List<Tuple<string, int>>(), Components = new List<(string Component, int Count)>(),
TotalCount = 0 TotalCount = 0
}; };
foreach (var product in products) foreach (var component in document.DocumentComponents.Values)
{ {
if (product.DocumentComponents.ContainsKey(component.Id)) record.Components.Add((component.Item1.ComponentName, component.Item2));
{ record.TotalCount += component.Item2;
record.Documents.Add(new Tuple<string,
int>(product.DocumentName, product.DocumentComponents[component.Id].Item2));
record.TotalCount +=
product.DocumentComponents[component.Id].Item2;
}
} }
list.Add(record); list.Add(record);
} }

View File

@ -36,27 +36,25 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.ComponentName, Text = pc.DocumentName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;
foreach (var document in pc.Documents) foreach (var (Component, Count) in pc.Components)
{ {
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = document.Item1, Text = Component,
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBorder
ExcelStyleInfoType.TextWithBorder
}); });
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "C", ColumnName = "C",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = document.Item2.ToString(), Text = Count.ToString(),
StyleInfo = StyleInfo = ExcelStyleInfoType.TextWithBorder
ExcelStyleInfoType.TextWithBorder
}); });
rowIndex++; rowIndex++;
} }

View File

@ -26,7 +26,10 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage
{ {
CreateParagraph(new WordParagraph 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 TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",

View File

@ -105,8 +105,7 @@ namespace AbstractLawFirmBusinessLogic.OfficePackage.Implements
var cellFormatFont = new CellFormat() var cellFormatFont = new CellFormat()
{ {
NumberFormatId = 0U, NumberFormatId = 0U,
FontId = FontId = 0U,
0U,
FillId = 0U, FillId = 0U,
BorderId = 0U, BorderId = 0U,
FormatId = 0U, FormatId = 0U,

View File

@ -8,8 +8,8 @@ namespace AbstractLawFirmContracts.ViewModels
{ {
public class ReportDocumentComponentViewModel public class ReportDocumentComponentViewModel
{ {
public string ComponentName { get; set; } = string.Empty; public string DocumentName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<Tuple<string, int>> Documents { get; set; } = new(); public List<(string Component, int Count)> Components { get; set; } = new();
} }
} }

View File

@ -62,12 +62,12 @@
// //
// Column1 // Column1
// //
this.Column1.HeaderText = "Компонент"; this.Column1.HeaderText = "Пакет документов";
this.Column1.Name = "Column1"; this.Column1.Name = "Column1";
// //
// Column2 // Column2
// //
this.Column2.HeaderText = "Пакет документов"; this.Column2.HeaderText = "Компонент";
this.Column2.Name = "Column2"; this.Column2.Name = "Column2";
// //
// Column3 // Column3

View File

@ -34,8 +34,8 @@ namespace LawFirmView
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var elem in dict) foreach (var elem in dict)
{ {
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); dataGridView.Rows.Add(new object[] { elem.DocumentName, "", "" });
foreach (var listElem in elem.Documents) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
} }

View File

@ -66,13 +66,4 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>