diff --git a/JewelryStore/FormMain.cs b/JewelryStore/FormMain.cs
index da639f0..200acb5 100644
--- a/JewelryStore/FormMain.cs
+++ b/JewelryStore/FormMain.cs
@@ -198,7 +198,7 @@ namespace JewelryStore
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
- _reportLogic.SaveComponentsToWordFile(new ReportBindingModel
+ _reportLogic.SaveJewelsToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
diff --git a/JewelryStore/FormReportJewelComponents.Designer.cs b/JewelryStore/FormReportJewelComponents.Designer.cs
index 595acff..86e5b71 100644
--- a/JewelryStore/FormReportJewelComponents.Designer.cs
+++ b/JewelryStore/FormReportJewelComponents.Designer.cs
@@ -70,14 +70,14 @@
//
// ColumnComponent
//
- this.ColumnComponent.HeaderText = "Компонент";
+ this.ColumnComponent.HeaderText = "Изделие";
this.ColumnComponent.Name = "ColumnComponent";
this.ColumnComponent.ReadOnly = true;
this.ColumnComponent.Width = 200;
//
// ColumnJewel
//
- this.ColumnJewel.HeaderText = "Изделие";
+ this.ColumnJewel.HeaderText = "Компонент";
this.ColumnJewel.Name = "ColumnJewel";
this.ColumnJewel.ReadOnly = true;
this.ColumnJewel.Width = 200;
diff --git a/JewelryStore/FormReportJewelComponents.cs b/JewelryStore/FormReportJewelComponents.cs
index 839bd5f..10f6be7 100644
--- a/JewelryStore/FormReportJewelComponents.cs
+++ b/JewelryStore/FormReportJewelComponents.cs
@@ -36,8 +36,8 @@ namespace JewelryStore
dataGridView.Rows.Clear();
foreach (var elem in dict)
{
- dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
- foreach (var listElem in elem.Jewels)
+ dataGridView.Rows.Add(new object[] { elem.JewelName, "", "" });
+ foreach (var listElem in elem.Components)
{
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
}
diff --git a/JewelryStore/ReportOrders.rdlc b/JewelryStore/ReportOrders.rdlc
index c4bed36..08ff623 100644
--- a/JewelryStore/ReportOrders.rdlc
+++ b/JewelryStore/ReportOrders.rdlc
@@ -33,6 +33,10 @@
Sum
System.Decimal
+
+ Status
+ System.String
+
JewelryStoreContracts.ViewModels
@@ -40,23 +44,20 @@
JewelryStoreContracts.ViewModels.ReportOrdersViewModel, JewelryStoreContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
-
+
-
+
true
true
- =Parameters!ReportParameterPeriod.Value
-
+ Заказы
+
- ReportParameterPeriod
- 1cm
- 1cm
- 21cm
+ 0.6cm
+ 16.51cm
@@ -79,18 +78,15 @@
2pt
-
+
true
true
- Заказы
-
+ =Parameters!ReportParameterPeriod.Value
+
- 1cm
- 21cm
+ ReportParameterPeriod
+ 0.6cm
+ 0.6cm
+ 16.51cm
1
-
+
+
+ 2.60583cm
+
+
+ 3.262cm
+
+
+ 4.8495cm
+
2.5cm
-
- 3.21438cm
-
-
- 8.23317cm
-
2.5cm
@@ -134,7 +135,7 @@
-
+
true
true
@@ -142,15 +143,12 @@
Номер
-
+
- Textbox5
+
- Textbox1
+
- Textbox3
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
true
true
@@ -238,15 +260,12 @@
Сумма
-
+
- Textbox7
+
@@ -357,6 +374,36 @@
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Status.Value
+
+
+
+
+
+
+ Status1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
@@ -385,7 +432,6 @@
2pt
- true
@@ -398,6 +444,7 @@
+
@@ -411,18 +458,18 @@
DataSetOrders
- 2.48391cm
- 0.55245cm
+ 1.9177cm
+ 0.79267cm
1.2cm
- 16.44755cm
+ 15.71733cm
2
+
-
+
true
true
@@ -430,9 +477,7 @@
Итого:
-
+
- 4cm
- 12cm
+ 3.46287cm
+ 11.51cm
0.6cm
2.5cm
3
@@ -455,7 +500,7 @@
2pt
-
+
true
true
@@ -463,18 +508,15 @@
=Sum(Fields!Sum.Value, "DataSetOrders")
-
+
-
+
- 4cm
- 14.5cm
+ Textbox10
+ 3.46287cm
+ 14.01cm
0.6cm
2.5cm
4
@@ -489,10 +531,10 @@
- 5.72875cm
+ 2in
- 21cm
+ 7.48425in
29.7cm
21cm
@@ -526,5 +568,5 @@
Cm
- 2de0031a-4d17-449d-922d-d9fc54572312
+ 0c9e94bc-df40-42bd-a526-01713dd3057f
\ No newline at end of file
diff --git a/JewelryStoreBusinessLogic/BusinessLogics/ReportLogic.cs b/JewelryStoreBusinessLogic/BusinessLogics/ReportLogic.cs
index 1b93b41..d402b03 100644
--- a/JewelryStoreBusinessLogic/BusinessLogics/ReportLogic.cs
+++ b/JewelryStoreBusinessLogic/BusinessLogics/ReportLogic.cs
@@ -29,6 +29,7 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
_jewelStorage = jewelStorage;
_componentStorage = componentStorage;
_orderStorage = orderStorage;
+
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
_saveToPdf = saveToPdf;
@@ -39,30 +40,12 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
///
public List GetJewelComponent()
{
- var components = _componentStorage.GetFullList();
- var jewels = _jewelStorage.GetFullList();
- var list = new List();
- foreach (var component in components)
+ return _jewelStorage.GetFullList().Select(x => new ReportJewelComponentViewModel
{
- var record = new ReportJewelComponentViewModel
- {
- ComponentName = component.ComponentName,
- Jewels = new List>(),
- TotalCount = 0
- };
- foreach (var jewel in jewels)
- {
- if (jewel.JewelComponents.ContainsKey(component.Id))
- {
- record.Jewels.Add(new Tuple(jewel.JewelName, jewel.JewelComponents[component.Id].Item2));
- record.TotalCount +=
- jewel.JewelComponents[component.Id].Item2;
- }
- }
- list.Add(record);
- }
- return list;
+ JewelName = x.JewelName,
+ Components = x.JewelComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(),
+ TotalCount = x.JewelComponents.Select(x => x.Value.Item2).Sum()
+ }).ToList();
}
///
/// Получение списка заказов за определенный период
@@ -82,7 +65,8 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
Id = x.Id,
DateCreate = x.DateCreate,
JewelName = x.JewelName,
- Sum = x.Sum
+ Sum = x.Sum,
+ Status = x.Status.ToString()
})
.ToList();
}
@@ -90,13 +74,13 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
/// Сохранение компонент в файл-Word
///
///
- public void SaveComponentsToWordFile(ReportBindingModel model)
+ public void SaveJewelsToWordFile(ReportBindingModel model)
{
_saveToWord.CreateDoc(new WordInfo
{
FileName = model.FileName,
- Title = "Список компонент",
- Components = _componentStorage.GetFullList()
+ Title = "Список изделий",
+ Jewels = _jewelStorage.GetFullList()
});
}
///
@@ -108,7 +92,7 @@ namespace JewelryStoreBusinessLogic.BusinessLogics
_saveToExcel.CreateReport(new ExcelInfo
{
FileName = model.FileName,
- Title = "Список компонент",
+ Title = "Список изделий",
JewelComponents = GetJewelComponent()
});
}
diff --git a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
index d10703e..0d7ea98 100644
--- a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
+++ b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToExcel.cs
@@ -36,25 +36,24 @@ namespace JewelryStoreBusinessLogic.OfficePackage
{
ColumnName = "A",
RowIndex = rowIndex,
- Text = pc.ComponentName,
+ Text = pc.JewelName,
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
- foreach (var product in pc.Jewels)
+ foreach (var (Component, Count) in pc.Components)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
- Text = product.Item1,
- StyleInfo =
- ExcelStyleInfoType.TextWithBroder
+ Text = Component,
+ StyleInfo = ExcelStyleInfoType.TextWithBroder
});
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "C",
RowIndex = rowIndex,
- Text = product.Item2.ToString(),
+ Text = Count.ToString(),
StyleInfo =
ExcelStyleInfoType.TextWithBroder
});
diff --git a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
index 4a4beba..5b070d3 100644
--- a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
+++ b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
@@ -25,10 +25,10 @@ namespace JewelryStoreBusinessLogic.OfficePackage
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
- CreateTable(new List { "2cm", "3cm", "6cm", "3cm" });
+ CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
- Texts = new List { "Номер", "Дата заказа", "Изделие", "Сумма" },
+ Texts = new List { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@@ -37,7 +37,7 @@ namespace JewelryStoreBusinessLogic.OfficePackage
CreateRow(new PdfRowParameters
{
Texts = new List { order.Id.ToString(),
-order.DateCreate.ToShortDateString(), order.JewelName, order.Sum.ToString() },
+order.DateCreate.ToShortDateString(), order.JewelName, order.Status.ToString(), order.Sum.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
diff --git a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs
index cfd4b89..e924ef8 100644
--- a/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs
+++ b/JewelryStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs
@@ -26,12 +26,14 @@ WordTextProperties { Bold = true, Size = "24", }) },
JustificationType = WordJustificationType.Center
}
});
- foreach (var component in info.Components)
+ foreach (var jewel in info.Jewels)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> {
-(component.ComponentName, new WordTextProperties { Size = "24", }) },
+ (jewel.JewelName, new WordTextProperties { Size = "24", Bold = true}),
+ ("\t"+jewel.Price.ToString(), new WordTextProperties{Size = "24"})
+ },
TextProperties = new WordTextProperties
{
Size = "24",
diff --git a/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
index 28a45b5..20a42ae 100644
--- a/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
+++ b/JewelryStoreBusinessLogic/OfficePackage/HelperModels/WordInfo.cs
@@ -11,7 +11,7 @@ namespace JewelryStoreBusinessLogic.OfficePackage.HelperModels
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
- public List Components { get; set; } = new();
+ public List Jewels { get; set; } = new();
}
}
diff --git a/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs b/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs
index 995fa24..0551350 100644
--- a/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs
+++ b/JewelryStoreContracts/BusinessLogicsContracts/IReportLogic.cs
@@ -25,7 +25,7 @@ namespace JewelryStoreContracts.BusinessLogicsContracts
/// Сохранение компонент в файл-Word
///
///
- void SaveComponentsToWordFile(ReportBindingModel model);
+ void SaveJewelsToWordFile(ReportBindingModel model);
///
/// Сохранение компонент с указаеним продуктов в файл-Excel
///
diff --git a/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs b/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs
index cff6bef..4ec6c09 100644
--- a/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs
+++ b/JewelryStoreContracts/ViewModels/ReportJewelComponentViewModel.cs
@@ -8,8 +8,8 @@ namespace JewelryStoreContracts.ViewModels
{
public class ReportJewelComponentViewModel
{
- public string ComponentName { get; set; } = string.Empty;
+ public string JewelName { get; set; } = string.Empty;
public int TotalCount { get; set; }
- public List> Jewels { get; set; } = new();
+ public List<(string, int)> Components { get; set; } = new();
}
}
diff --git a/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs b/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs
index 8f927c0..dba76c0 100644
--- a/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs
+++ b/JewelryStoreContracts/ViewModels/ReportOrdersViewModel.cs
@@ -12,6 +12,7 @@ namespace JewelryStoreContracts.ViewModels
public DateTime DateCreate { get; set; }
public string JewelName { get; set; } = string.Empty;
public double Sum { get; set; }
+ public string Status { get; set; } = string.Empty;
}
}