diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj
index fe9d4c2..59d8696 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj
@@ -10,6 +10,7 @@
+
@@ -20,6 +21,9 @@
Always
+
+ Always
+
@@ -40,4 +44,10 @@
+
+
+ Form
+
+
+
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
index 60a9bae..8745b33 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
@@ -38,6 +38,7 @@
this.reportManufactureComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportStoresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportManufacturesInStoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
@@ -46,7 +47,7 @@
this.buttonRef = new System.Windows.Forms.Button();
this.buttonFillStore = new System.Windows.Forms.Button();
this.buttonSellManufacture = new System.Windows.Forms.Button();
- this.reportManufacturesInStoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportGroupOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
@@ -100,7 +101,8 @@
this.reportManufactureComponentsToolStripMenuItem,
this.reportOrdersToolStripMenuItem,
this.reportStoresToolStripMenuItem,
- this.reportManufacturesInStoreToolStripMenuItem});
+ this.reportManufacturesInStoreToolStripMenuItem,
+ this.reportGroupOrdersToolStripMenuItem});
this.reportToolStripMenuItem.Name = "reportToolStripMenuItem";
this.reportToolStripMenuItem.Size = new System.Drawing.Size(51, 20);
this.reportToolStripMenuItem.Text = "Отчет";
@@ -133,6 +135,13 @@
this.reportStoresToolStripMenuItem.Text = "Список магазинов";
this.reportStoresToolStripMenuItem.Click += new System.EventHandler(this.ReportStoresToolStripMenuItem_Click);
//
+ // reportManufacturesInStoreToolStripMenuItem
+ //
+ this.reportManufacturesInStoreToolStripMenuItem.Name = "reportManufacturesInStoreToolStripMenuItem";
+ this.reportManufacturesInStoreToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
+ this.reportManufacturesInStoreToolStripMenuItem.Text = "Изделия в магазинах";
+ this.reportManufacturesInStoreToolStripMenuItem.Click += new System.EventHandler(this.ReportManufacturesInStoreToolStripMenuItem_Click);
+ //
// dataGridView
//
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
@@ -219,12 +228,12 @@
this.buttonSellManufacture.UseVisualStyleBackColor = true;
this.buttonSellManufacture.Click += new System.EventHandler(this.ButtonSellManufacture_Click);
//
- // reportManufacturesInStoreToolStripMenuItem
+ // reportGroupOrdersToolStripMenuItem
//
- this.reportManufacturesInStoreToolStripMenuItem.Name = "reportManufacturesInStoreToolStripMenuItem";
- this.reportManufacturesInStoreToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
- this.reportManufacturesInStoreToolStripMenuItem.Text = "Изделия в магазинах";
- this.reportManufacturesInStoreToolStripMenuItem.Click += new System.EventHandler(this.ReportManufacturesInStoreToolStripMenuItem_Click);
+ this.reportGroupOrdersToolStripMenuItem.Name = "reportGroupOrdersToolStripMenuItem";
+ this.reportGroupOrdersToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
+ this.reportGroupOrdersToolStripMenuItem.Text = "Заказы по датам";
+ this.reportGroupOrdersToolStripMenuItem.Click += new System.EventHandler(this.ReportGroupOrdersToolStripMenuItem_Click);
//
// FormMain
//
@@ -273,5 +282,6 @@
private ToolStripMenuItem reportOrdersToolStripMenuItem;
private ToolStripMenuItem reportStoresToolStripMenuItem;
private ToolStripMenuItem reportManufacturesInStoreToolStripMenuItem;
+ private ToolStripMenuItem reportGroupOrdersToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
index a568a2a..6c14fe6 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
@@ -220,5 +220,15 @@ namespace BlacksmithWorkshopView
LoadData();
}
}
+
+ private void ReportGroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupOrders));
+ if (service is FormReportGroupOrders form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.cs
new file mode 100644
index 0000000..a4abc4f
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.cs
@@ -0,0 +1,71 @@
+using BlacksmithWorkshopContracts.BindingModels;
+using BlacksmithWorkshopContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+
+namespace BlacksmithWorkshopView
+{
+ public partial class FormReportGroupOrders : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportGroupOrders(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupOrders.rdlc", FileMode.Open));
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ private void ButtonMake_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var dataSource = _logic.GetGroupOrders();
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+
+ reportViewer.RefreshReport();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonToPdf_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveGroupOrdersToPdfFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ _logger.LogInformation("Сохранение списка заказов");
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.designer.cs
new file mode 100644
index 0000000..a1bb41b
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.designer.cs
@@ -0,0 +1,92 @@
+namespace BlacksmithWorkshopView
+{
+ partial class FormReportGroupOrders
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.panel = new System.Windows.Forms.Panel();
+ this.buttonToPdf = new System.Windows.Forms.Button();
+ this.buttonMake = new System.Windows.Forms.Button();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.buttonToPdf);
+ this.panel.Controls.Add(this.buttonMake);
+ this.panel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel.Location = new System.Drawing.Point(0, 0);
+ this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.panel.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(1031, 40);
+ this.panel.TabIndex = 0;
+ //
+ // buttonToPdf
+ //
+ this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonToPdf.Location = new System.Drawing.Point(878, 8);
+ this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonToPdf.Name = "buttonToPdf";
+ this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
+ this.buttonToPdf.TabIndex = 5;
+ this.buttonToPdf.Text = "В Pdf";
+ this.buttonToPdf.UseVisualStyleBackColor = true;
+ this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
+ //
+ // buttonMake
+ //
+ this.buttonMake.Location = new System.Drawing.Point(13, 8);
+ this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonMake.Name = "buttonMake";
+ this.buttonMake.Size = new System.Drawing.Size(139, 27);
+ this.buttonMake.TabIndex = 4;
+ this.buttonMake.Text = "Сформировать";
+ this.buttonMake.UseVisualStyleBackColor = true;
+ this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
+ //
+ // FormReportGroupOrders
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1031, 647);
+ this.Controls.Add(this.panel);
+ this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.Name = "FormReportGroupOrders";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Заказы";
+ this.panel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel panel;
+ private System.Windows.Forms.Button buttonToPdf;
+ private System.Windows.Forms.Button buttonMake;
+ }
+}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportGroupOrders.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs
index 0b4e84e..29d1343 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs
@@ -60,6 +60,7 @@ namespace BlacksmithWorkshopView
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupOrders.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupOrders.rdlc
new file mode 100644
index 0000000..ea2f7f7
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportGroupOrders.rdlc
@@ -0,0 +1,459 @@
+
+
+ 0
+
+
+
+ System.Data.DataSet
+ /* Local Connection */
+
+ 10791c83-cee8-4a38-bbd0-245fc17cefb3
+
+
+
+
+
+ BlacksmithWorkshopContractsViewModels
+ /* Local Query */
+
+
+
+ Date
+ System.DateTime
+
+
+ Count
+ System.Int32
+
+
+ Sum
+ System.Double
+
+
+
+ BlacksmithWorkshopContracts.ViewModels
+ ReportOrdersViewModel
+ BlacksmithWorkshopContracts.ViewModels.ReportOrdersViewModel, BlacksmithWorkshopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Parameters!ReportParameterPeriod.Value
+
+
+
+
+
+
+ ReportParameterPeriod
+ 1cm
+ 1cm
+ 12.40104cm
+
+
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Заказы
+
+
+
+
+
+
+ 1cm
+ 12.40104cm
+ 1
+
+
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+ 3.21438cm
+
+
+ 3.53188cm
+
+
+ 4.35209cm
+
+
+
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+ Дата создания
+
+
+
+
+
+
+ Textbox1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Количество заказов
+
+
+
+
+
+
+ Textbox3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Сумма
+
+
+
+
+
+
+ Textbox7
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Date.Value
+
+
+
+
+
+
+ Date
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Count.Value
+
+
+
+
+
+
+ Count
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Sum.Value
+
+
+
+
+
+
+ Sum
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ After
+
+
+
+
+
+
+ DataSetOrders
+ 2.48391cm
+ 0.55245cm
+ 1.2cm
+ 11.09835cm
+ 2
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Итого:
+
+
+
+
+
+
+ 4cm
+ 6.6508cm
+ 0.6cm
+ 2.5cm
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!Sum.Value, "DataSetOrders")
+
+
+
+
+
+
+ 4cm
+ 9.1508cm
+ 0.6cm
+ 2.5cm
+ 4
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 5.72875cm
+
+
+ 12.40104cm
+
+ 29.7cm
+ 21cm
+ 2cm
+ 2cm
+ 2cm
+ 2cm
+ 0.13cm
+
+
+
+
+
+
+ String
+ true
+ ReportParameter1
+
+
+
+
+ 4
+ 2
+
+
+ 0
+ 0
+ ReportParameterPeriod
+
+
+
+
+ Cm
+ 2de0031a-4d17-449d-922d-d9fc54572312
+
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs
index 47ac19b..97d34ca 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs
@@ -168,5 +168,30 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
Orders = GetOrders(model)
});
}
- }
+ ///
+ /// Сохранение заказов по группам в файл-Pdf
+ ///
+ ///
+ public void SaveGroupOrdersToPdfFile(ReportBindingModel model)
+ {
+ _saveToPdf.CreateDoc(new PdfInfo
+ {
+ FileName = model.FileName,
+ Title = "Список заказов по датам",
+ GroupOrders = GetGroupOrders()
+ });
+ }
+ public List GetGroupOrders()
+ {
+ return _orderStorage.GetFullList()
+ .GroupBy(x => x.DateCreate.Date)
+ .Select(x => new ReportGroupOrdersViewModel
+ {
+ Date = x.Key,
+ Count = x.Count(),
+ Sum = x.Sum(y => y.Sum)
+ }).ToList();
+
+ }
+ }
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
index d58b7f1..3014b29 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
@@ -3,72 +3,98 @@ using BlacksmithWorkshopBusinessLogic.OfficePackage.HelperModels;
namespace BlacksmithWorkshopBusinessLogic.OfficePackage
{
- public abstract class AbstractSaveToPdf
- {
- public void CreateDoc(PdfInfo info)
- {
- CreatePdf(info);
- CreateParagraph(new PdfParagraph
- {
- Text = info.Title,
- Style = "NormalTitle",
- ParagraphAlignment = PdfParagraphAlignmentType.Center
- });
- CreateParagraph(new PdfParagraph
- {
- Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
- ParagraphAlignment = PdfParagraphAlignmentType.Center
- });
- CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "3cm" });
- CreateRow(new PdfRowParameters
- {
- Texts = new List { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
- Style = "NormalTitle",
- ParagraphAlignment = PdfParagraphAlignmentType.Center
- });
- foreach (var order in info.Orders)
- {
- CreateRow(new PdfRowParameters
- {
- Texts = new List { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.ManufactureName, order.Sum.ToString(), order.Status },
- Style = "Normal",
- ParagraphAlignment = PdfParagraphAlignmentType.Left
- });
- }
- CreateParagraph(new PdfParagraph
- {
- Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
- Style = "Normal",
- ParagraphAlignment = PdfParagraphAlignmentType.Right
- });
- SavePdf(info);
- }
- ///
- /// Создание doc-файла
- ///
- ///
- protected abstract void CreatePdf(PdfInfo info);
- ///
- /// Создание параграфа с текстом
- ///
- ///
- ///
- protected abstract void CreateParagraph(PdfParagraph paragraph);
- ///
- /// Создание таблицы
- ///
- ///
- ///
- protected abstract void CreateTable(List columns);
- ///
- /// Создание и заполнение строки
- ///
- ///
- protected abstract void CreateRow(PdfRowParameters rowParameters);
- ///
- /// Сохранение файла
- ///
- ///
- protected abstract void SavePdf(PdfInfo info);
- }
+ public abstract class AbstractSaveToPdf
+ {
+ public void CreateDoc(PdfInfo info)
+ {
+ CreatePdf(info);
+ CreateParagraph(new PdfParagraph
+ {
+ Text = info.Title,
+ Style = "NormalTitle",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+
+ if (info.Orders.Count != 0)
+ {
+ CreateParagraph(new PdfParagraph
+ {
+ Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+ CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "3cm" });
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
+ Style = "NormalTitle",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+ foreach (var order in info.Orders)
+ {
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.ManufactureName, order.Sum.ToString(), order.Status },
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Left
+ });
+ }
+ CreateParagraph(new PdfParagraph
+ {
+ Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Right
+ });
+ }
+ else if (info.GroupOrders.Count != 0)
+ {
+ CreateTable(new List { "3cm", "4cm", "5cm" });
+
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { "Дата", "Количество", "Сумма" },
+ Style = "NormalTitle",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+ foreach (var order in info.GroupOrders)
+ {
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { order.Date.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Left
+ });
+ }
+ CreateParagraph(new PdfParagraph { Text = $"Итого: {info.GroupOrders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
+ }
+ SavePdf(info);
+ }
+ ///
+ /// Создание doc-файла
+ ///
+ ///
+ protected abstract void CreatePdf(PdfInfo info);
+ ///
+ /// Создание параграфа с текстом
+ ///
+ ///
+ ///
+ protected abstract void CreateParagraph(PdfParagraph paragraph);
+ ///
+ /// Создание таблицы
+ ///
+ ///
+ ///
+ protected abstract void CreateTable(List columns);
+ ///
+ /// Создание и заполнение строки
+ ///
+ ///
+ protected abstract void CreateRow(PdfRowParameters rowParameters);
+ ///
+ /// Сохранение файла
+ ///
+ ///
+ protected abstract void SavePdf(PdfInfo info);
+ }
}
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
index 3bb7723..342df81 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
@@ -9,5 +9,6 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage.HelperModels
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public List Orders { get; set; } = new();
+ public List GroupOrders { get; set; } = new();
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs
index 8978ef7..70894a3 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs
@@ -47,5 +47,11 @@ namespace BlacksmithWorkshopContracts.BusinessLogicsContracts
///
///
void SaveStoresToExcelFile(ReportBindingModel model);
+ ///
+ /// Получение группированного списка заказов
+ ///
+ ///
+ List GetGroupOrders();
+ void SaveGroupOrdersToPdfFile(ReportBindingModel model);
}
}
diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportGroupOrdersViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportGroupOrdersViewModel.cs
new file mode 100644
index 0000000..e6e93b3
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportGroupOrdersViewModel.cs
@@ -0,0 +1,9 @@
+namespace BlacksmithWorkshopContracts.ViewModels
+{
+ public class ReportGroupOrdersViewModel
+ {
+ public DateTime Date { get; set; }
+ public int Count { get; set; }
+ public double Sum { get; set; }
+ }
+}