diff --git a/Confectionery/Confectionery/Confectionery.csproj b/Confectionery/Confectionery/Confectionery.csproj
index b60ee41..8ced976 100644
--- a/Confectionery/Confectionery/Confectionery.csproj
+++ b/Confectionery/Confectionery/Confectionery.csproj
@@ -29,6 +29,7 @@
+
@@ -55,4 +56,10 @@
+
+
+ Always
+
+
+
\ No newline at end of file
diff --git a/Confectionery/Confectionery/FormMain.Designer.cs b/Confectionery/Confectionery/FormMain.Designer.cs
index 1b586a0..1d2ecce 100644
--- a/Confectionery/Confectionery/FormMain.Designer.cs
+++ b/Confectionery/Confectionery/FormMain.Designer.cs
@@ -32,6 +32,10 @@
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ингредиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.IngredientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.IngredientPastriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.OrdersToolStripMenuItem = 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 +50,8 @@
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.справочникиToolStripMenuItem});
+ this.справочникиToolStripMenuItem,
+ this.отчётыToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1238, 28);
@@ -76,6 +81,37 @@
this.изделияToolStripMenuItem.Text = "Кондитерские изделия";
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.изделияToolStripMenuItem_Click);
//
+ // отчётыToolStripMenuItem
+ //
+ this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.IngredientsToolStripMenuItem,
+ this.IngredientPastriesToolStripMenuItem,
+ this.OrdersToolStripMenuItem});
+ this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
+ this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
+ this.отчётыToolStripMenuItem.Text = "Отчёты";
+ //
+ // IngredientsToolStripMenuItem
+ //
+ this.IngredientsToolStripMenuItem.Name = "IngredientsToolStripMenuItem";
+ this.IngredientsToolStripMenuItem.Size = new System.Drawing.Size(280, 26);
+ this.IngredientsToolStripMenuItem.Text = "Список изделий";
+ this.IngredientsToolStripMenuItem.Click += new System.EventHandler(this.IngredientsToolStripMenuItem_Click);
+ //
+ // IngredientPastriesToolStripMenuItem
+ //
+ this.IngredientPastriesToolStripMenuItem.Name = "IngredientPastriesToolStripMenuItem";
+ this.IngredientPastriesToolStripMenuItem.Size = new System.Drawing.Size(280, 26);
+ this.IngredientPastriesToolStripMenuItem.Text = "Ингрединеты по изделиям";
+ this.IngredientPastriesToolStripMenuItem.Click += new System.EventHandler(this.IngredientPastriesToolStripMenuItem_Click);
+ //
+ // OrdersToolStripMenuItem
+ //
+ this.OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
+ this.OrdersToolStripMenuItem.Size = new System.Drawing.Size(280, 26);
+ this.OrdersToolStripMenuItem.Text = "Список заказов";
+ this.OrdersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
+ //
// dataGridView
//
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
@@ -175,5 +211,9 @@
private Button buttonOrderReady;
private Button buttonIssuedOrder;
private Button buttonRef;
+ private ToolStripMenuItem отчётыToolStripMenuItem;
+ private ToolStripMenuItem IngredientsToolStripMenuItem;
+ private ToolStripMenuItem IngredientPastriesToolStripMenuItem;
+ private ToolStripMenuItem OrdersToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/Confectionery/Confectionery/FormMain.cs b/Confectionery/Confectionery/FormMain.cs
index 5a41079..b361b36 100644
--- a/Confectionery/Confectionery/FormMain.cs
+++ b/Confectionery/Confectionery/FormMain.cs
@@ -1,4 +1,5 @@
-using ConfectioneryContracts.BindingModels;
+using ConfectioneryBusinessLogic.BusinessLogics;
+using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System;
@@ -17,12 +18,14 @@ namespace Confectionery
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
+ private readonly IReportLogic _reportLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic)
+ public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
+ _reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
@@ -152,5 +155,33 @@ namespace Confectionery
{
LoadData();
}
+
+ private void IngredientsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SavePastrysToWordFile(new ReportBindingModel { FileName = dialog.FileName });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ private void IngredientPastriesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryIngredients));
+ if (service is FormReportPastryIngredients form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
+ if (service is FormReportOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/Confectionery/Confectionery/FormReportOrders.Designer.cs b/Confectionery/Confectionery/FormReportOrders.Designer.cs
new file mode 100644
index 0000000..e8bbdef
--- /dev/null
+++ b/Confectionery/Confectionery/FormReportOrders.Designer.cs
@@ -0,0 +1,136 @@
+namespace Confectionery
+{
+ partial class FormReportOrders
+ {
+ ///
+ /// 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.label1 = new System.Windows.Forms.Label();
+ this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
+ this.buttonToPdf = new System.Windows.Forms.Button();
+ this.buttonMake = new System.Windows.Forms.Button();
+ this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
+ this.labelTo = new System.Windows.Forms.Label();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.buttonToPdf);
+ this.panel.Controls.Add(this.dateTimePickerFrom);
+ this.panel.Controls.Add(this.buttonMake);
+ this.panel.Controls.Add(this.dateTimePickerTo);
+ this.panel.Controls.Add(this.label1);
+ this.panel.Controls.Add(this.labelTo);
+ this.panel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel.Location = new System.Drawing.Point(0, 0);
+ this.panel.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(1181, 48);
+ this.panel.TabIndex = 0;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 14);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(18, 20);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "С";
+ //
+ // dateTimePickerFrom
+ //
+ this.dateTimePickerFrom.Location = new System.Drawing.Point(36, 9);
+ this.dateTimePickerFrom.Name = "dateTimePickerFrom";
+ this.dateTimePickerFrom.Size = new System.Drawing.Size(187, 27);
+ this.dateTimePickerFrom.TabIndex = 1;
+ //
+ // 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(1008, 7);
+ this.buttonToPdf.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.buttonToPdf.Name = "buttonToPdf";
+ this.buttonToPdf.Size = new System.Drawing.Size(159, 36);
+ this.buttonToPdf.TabIndex = 9;
+ 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(512, 6);
+ this.buttonMake.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.buttonMake.Name = "buttonMake";
+ this.buttonMake.Size = new System.Drawing.Size(159, 36);
+ this.buttonMake.TabIndex = 8;
+ this.buttonMake.Text = "Сформировать";
+ this.buttonMake.UseVisualStyleBackColor = true;
+ this.buttonMake.Click += new System.EventHandler(this.buttonMake_Click);
+ //
+ // dateTimePickerTo
+ //
+ this.dateTimePickerTo.Location = new System.Drawing.Point(265, 10);
+ this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.dateTimePickerTo.Name = "dateTimePickerTo";
+ this.dateTimePickerTo.Size = new System.Drawing.Size(186, 27);
+ this.dateTimePickerTo.TabIndex = 7;
+ //
+ // labelTo
+ //
+ this.labelTo.AutoSize = true;
+ this.labelTo.Location = new System.Drawing.Point(232, 14);
+ this.labelTo.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
+ this.labelTo.Name = "labelTo";
+ this.labelTo.Size = new System.Drawing.Size(27, 20);
+ this.labelTo.TabIndex = 6;
+ this.labelTo.Text = "по";
+ //
+ // FormReportOrders
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1181, 450);
+ this.Controls.Add(this.panel);
+ this.Name = "FormReportOrders";
+ this.Text = "FormReportOrders";
+ this.panel.ResumeLayout(false);
+ this.panel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Panel panel;
+ private DateTimePicker dateTimePickerFrom;
+ private Label label1;
+ private Button buttonToPdf;
+ private Button buttonMake;
+ private DateTimePicker dateTimePickerTo;
+ private Label labelTo;
+ }
+}
\ No newline at end of file
diff --git a/Confectionery/Confectionery/FormReportOrders.cs b/Confectionery/Confectionery/FormReportOrders.cs
new file mode 100644
index 0000000..3683155
--- /dev/null
+++ b/Confectionery/Confectionery/FormReportOrders.cs
@@ -0,0 +1,100 @@
+using ConfectioneryContracts.BusinessLogicsContracts;
+using Microsoft.Reporting.WinForms;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Microsoft.Extensions.Logging;
+using ConfectioneryContracts.BindingModels;
+
+namespace Confectionery
+{
+ public partial class FormReportOrders : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportOrders(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ private void buttonMake_Click(object sender, EventArgs e)
+ {
+ if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
+ {
+ MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ try
+ {
+ var dataSource = _logic.GetOrders(new ReportBindingModel
+ {
+ DateFrom = dateTimePickerFrom.Value,
+ DateTo = dateTimePickerTo.Value
+ });
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+ var parameters = new[] { new ReportParameter("ReportParameterPeriod",
+ $"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
+ reportViewer.LocalReport.SetParameters(parameters);
+
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonToPdf_Click(object sender, EventArgs e)
+ {
+ if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
+ {
+ MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveOrdersToPdfFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName,
+ DateFrom = dateTimePickerFrom.Value,
+ DateTo = dateTimePickerTo.Value
+ });
+ _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/Confectionery/Confectionery/FormReportOrders.resx b/Confectionery/Confectionery/FormReportOrders.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/Confectionery/Confectionery/FormReportOrders.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/Confectionery/Confectionery/FormReportPastryIngredients.Designer.cs b/Confectionery/Confectionery/FormReportPastryIngredients.Designer.cs
new file mode 100644
index 0000000..3109d7b
--- /dev/null
+++ b/Confectionery/Confectionery/FormReportPastryIngredients.Designer.cs
@@ -0,0 +1,113 @@
+namespace Confectionery
+{
+ partial class FormReportPastryIngredients
+ {
+ ///
+ /// 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.buttonSaveToExcel = new System.Windows.Forms.Button();
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.ColumnPastry = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnIngredient = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 12);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(164, 29);
+ this.buttonSaveToExcel.TabIndex = 0;
+ this.buttonSaveToExcel.Text = "Сохранить в Excel";
+ this.buttonSaveToExcel.UseVisualStyleBackColor = true;
+ this.buttonSaveToExcel.Click += new System.EventHandler(this.buttonSaveToExcel_Click);
+ //
+ // dataGridView
+ //
+ this.dataGridView.AllowUserToAddRows = false;
+ this.dataGridView.BackgroundColor = System.Drawing.Color.White;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ColumnPastry,
+ this.ColumnIngredient,
+ this.ColumnCount});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.dataGridView.Location = new System.Drawing.Point(0, 52);
+ this.dataGridView.MultiSelect = false;
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersVisible = false;
+ this.dataGridView.RowHeadersWidth = 51;
+ this.dataGridView.RowTemplate.Height = 29;
+ this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.dataGridView.Size = new System.Drawing.Size(800, 398);
+ this.dataGridView.TabIndex = 1;
+ //
+ // ColumnPastry
+ //
+ this.ColumnPastry.HeaderText = "Кондитерское изделие";
+ this.ColumnPastry.MinimumWidth = 6;
+ this.ColumnPastry.Name = "ColumnPastry";
+ this.ColumnPastry.Width = 125;
+ //
+ // ColumnIngredient
+ //
+ this.ColumnIngredient.HeaderText = "Ингредиент";
+ this.ColumnIngredient.MinimumWidth = 6;
+ this.ColumnIngredient.Name = "ColumnIngredient";
+ this.ColumnIngredient.Width = 125;
+ //
+ // ColumnCount
+ //
+ this.ColumnCount.HeaderText = "Количество";
+ this.ColumnCount.MinimumWidth = 6;
+ this.ColumnCount.Name = "ColumnCount";
+ this.ColumnCount.Width = 125;
+ //
+ // FormReportPastryIngredients
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.dataGridView);
+ this.Controls.Add(this.buttonSaveToExcel);
+ this.Name = "FormReportPastryIngredients";
+ this.Text = "FormReportPastryIngredients";
+ this.Load += new System.EventHandler(this.FormReportPastryIngredients_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button buttonSaveToExcel;
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn ColumnPastry;
+ private DataGridViewTextBoxColumn ColumnIngredient;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/Confectionery/Confectionery/FormReportPastryIngredients.cs b/Confectionery/Confectionery/FormReportPastryIngredients.cs
new file mode 100644
index 0000000..dd55679
--- /dev/null
+++ b/Confectionery/Confectionery/FormReportPastryIngredients.cs
@@ -0,0 +1,78 @@
+using ConfectioneryContracts.BusinessLogicsContracts;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Microsoft.Extensions.Logging;
+using ConfectioneryContracts.BindingModels;
+
+namespace Confectionery
+{
+ public partial class FormReportPastryIngredients : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public FormReportPastryIngredients(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportPastryIngredients_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetPastryIngredient();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.PastryName, "", "" });
+ foreach (var listElem in elem.Ingredients)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty