правки

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>
public List<ReportDocumentComponentViewModel> GetDocumentComponent()
{
var components = _componentStorage.GetFullList();
var products = _documentStorage.GetFullList();
var documents = _documentStorage.GetFullList();
var list = new List<ReportDocumentComponentViewModel>();
foreach (var component in components)
foreach (var document in documents)
{
var record = new ReportDocumentComponentViewModel
{
ComponentName = component.ComponentName,
Documents = new List<Tuple<string, int>>(),
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<string,
int>(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);
}

View File

@ -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++;
}

View File

@ -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",

View File

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

View File

@ -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<Tuple<string, int>> Documents { get; set; } = new();
public List<(string Component, int Count)> Components { get; set; } = new();
}
}

View File

@ -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

View File

@ -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 });
}

View File

@ -66,13 +66,4 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</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>