diff --git a/Pizzeria/Pizzeria/FormReportOrders.Designer.cs b/Pizzeria/Pizzeria/FormReportOrders.Designer.cs
new file mode 100644
index 0000000..9cb034b
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormReportOrders.Designer.cs
@@ -0,0 +1,152 @@
+namespace Pizzeria
+{
+ 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()
+ {
+ panel = new Panel();
+ buttonPdf = new Button();
+ buttonCreateReport = new Button();
+ buttonToPdf = new Button();
+ dateTimePickerTo = new DateTimePicker();
+ labelTo = new Label();
+ dateTimePickerFrom = new DateTimePicker();
+ labelFrom = new Label();
+ panel.SuspendLayout();
+ SuspendLayout();
+ //
+ // panel
+ //
+ panel.Controls.Add(buttonPdf);
+ panel.Controls.Add(buttonCreateReport);
+ panel.Controls.Add(buttonToPdf);
+ panel.Controls.Add(dateTimePickerTo);
+ panel.Controls.Add(labelTo);
+ panel.Controls.Add(dateTimePickerFrom);
+ panel.Controls.Add(labelFrom);
+ panel.Dock = DockStyle.Top;
+ panel.Location = new Point(0, 0);
+ panel.Margin = new Padding(4, 3, 4, 3);
+ panel.Name = "panel";
+ panel.Size = new Size(800, 40);
+ panel.TabIndex = 1;
+ //
+ // buttonPdf
+ //
+ buttonPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonPdf.Location = new Point(648, 6);
+ buttonPdf.Margin = new Padding(4, 3, 4, 3);
+ buttonPdf.Name = "buttonPdf";
+ buttonPdf.Size = new Size(139, 27);
+ buttonPdf.TabIndex = 7;
+ buttonPdf.Text = "В Pdf";
+ buttonPdf.UseVisualStyleBackColor = true;
+ buttonPdf.Click += ButtonPdf_Click;
+ //
+ // buttonCreateReport
+ //
+ buttonCreateReport.Location = new Point(501, 6);
+ buttonCreateReport.Margin = new Padding(4, 3, 4, 3);
+ buttonCreateReport.Name = "buttonCreateReport";
+ buttonCreateReport.Size = new Size(139, 27);
+ buttonCreateReport.TabIndex = 6;
+ buttonCreateReport.Text = "Сформировать";
+ buttonCreateReport.UseVisualStyleBackColor = true;
+ buttonCreateReport.Click += ButtonCreateReport_Click;
+ //
+ // buttonToPdf
+ //
+ buttonToPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ buttonToPdf.Location = new Point(1248, 8);
+ buttonToPdf.Margin = new Padding(4, 3, 4, 3);
+ buttonToPdf.Name = "buttonToPdf";
+ buttonToPdf.Size = new Size(139, 27);
+ buttonToPdf.TabIndex = 5;
+ buttonToPdf.Text = "В Pdf";
+ buttonToPdf.UseVisualStyleBackColor = true;
+ //
+ // dateTimePickerTo
+ //
+ dateTimePickerTo.Location = new Point(237, 10);
+ dateTimePickerTo.Margin = new Padding(4, 3, 4, 3);
+ dateTimePickerTo.Name = "dateTimePickerTo";
+ dateTimePickerTo.Size = new Size(163, 23);
+ dateTimePickerTo.TabIndex = 3;
+ //
+ // labelTo
+ //
+ labelTo.AutoSize = true;
+ labelTo.Location = new Point(208, 13);
+ labelTo.Margin = new Padding(4, 0, 4, 0);
+ labelTo.Name = "labelTo";
+ labelTo.Size = new Size(21, 15);
+ labelTo.TabIndex = 2;
+ labelTo.Text = "по";
+ //
+ // dateTimePickerFrom
+ //
+ dateTimePickerFrom.Location = new Point(37, 10);
+ dateTimePickerFrom.Margin = new Padding(4, 3, 4, 3);
+ dateTimePickerFrom.Name = "dateTimePickerFrom";
+ dateTimePickerFrom.Size = new Size(163, 23);
+ dateTimePickerFrom.TabIndex = 1;
+ //
+ // labelFrom
+ //
+ labelFrom.AutoSize = true;
+ labelFrom.Location = new Point(14, 13);
+ labelFrom.Margin = new Padding(4, 0, 4, 0);
+ labelFrom.Name = "labelFrom";
+ labelFrom.Size = new Size(15, 15);
+ labelFrom.TabIndex = 0;
+ labelFrom.Text = "С";
+ //
+ // FormReportOrders
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(panel);
+ Name = "FormReportOrders";
+ Text = "Заказы";
+ panel.ResumeLayout(false);
+ panel.PerformLayout();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel;
+ private Button buttonPdf;
+ private Button buttonCreateReport;
+ private Button buttonToPdf;
+ private DateTimePicker dateTimePickerTo;
+ private Label labelTo;
+ private DateTimePicker dateTimePickerFrom;
+ private Label labelFrom;
+ }
+}
\ No newline at end of file
diff --git a/Pizzeria/Pizzeria/FormReportOrders.cs b/Pizzeria/Pizzeria/FormReportOrders.cs
new file mode 100644
index 0000000..6f00812
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormReportOrders.cs
@@ -0,0 +1,100 @@
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+using PizzeriaContracts.BindingModels;
+using PizzeriaContracts.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;
+
+namespace Pizzeria
+{
+ 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 ButtonCreateReport_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("Loading list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Loading list of orders for period error");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonPdf_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("Saving list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Saving list of orders for period error");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/Pizzeria/Pizzeria/FormReportOrders.resx b/Pizzeria/Pizzeria/FormReportOrders.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormReportOrders.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/Pizzeria/Pizzeria/FormReportPizzaComponents.Designer.cs b/Pizzeria/Pizzeria/FormReportPizzaComponents.Designer.cs
new file mode 100644
index 0000000..91d10ef
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormReportPizzaComponents.Designer.cs
@@ -0,0 +1,102 @@
+namespace Pizzeria
+{
+ partial class FormReportPizzaComponents
+ {
+ ///
+ /// 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()
+ {
+ ButtonSaveToExcel = new Button();
+ dataGridView = new DataGridView();
+ ColumnPizza = new DataGridViewTextBoxColumn();
+ ColumnComponent = new DataGridViewTextBoxColumn();
+ ColumnCount = new DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // ButtonSaveToExcel
+ //
+ ButtonSaveToExcel.Location = new Point(12, 9);
+ ButtonSaveToExcel.Name = "ButtonSaveToExcel";
+ ButtonSaveToExcel.Size = new Size(143, 23);
+ ButtonSaveToExcel.TabIndex = 0;
+ ButtonSaveToExcel.Text = "Сохранить в Excel";
+ ButtonSaveToExcel.UseVisualStyleBackColor = true;
+ ButtonSaveToExcel.Click += ButtonSaveToExcel_Click;
+ //
+ // dataGridView
+ //
+ dataGridView.BackgroundColor = SystemColors.ControlLightLight;
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnPizza, ColumnComponent, ColumnCount });
+ dataGridView.Location = new Point(0, 38);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersVisible = false;
+ dataGridView.RowTemplate.Height = 25;
+ dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridView.Size = new Size(799, 412);
+ dataGridView.TabIndex = 1;
+ //
+ // ColumnPizza
+ //
+ ColumnPizza.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ ColumnPizza.HeaderText = "Изделие";
+ ColumnPizza.Name = "ColumnPizza";
+ //
+ // ColumnComponent
+ //
+ ColumnComponent.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ ColumnComponent.HeaderText = "Компонент";
+ ColumnComponent.Name = "ColumnComponent";
+ //
+ // ColumnCount
+ //
+ ColumnCount.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ ColumnCount.HeaderText = "Количество";
+ ColumnCount.Name = "ColumnCount";
+ //
+ // FormReportPizzaComponents
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridView);
+ Controls.Add(ButtonSaveToExcel);
+ Name = "FormReportPizzaComponents";
+ Text = "Компоненты по изделиям";
+ Load += FormReportPizzaComponents_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Button ButtonSaveToExcel;
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn ColumnPizza;
+ private DataGridViewTextBoxColumn ColumnComponent;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/Pizzeria/Pizzeria/FormReportPizzaComponents.cs b/Pizzeria/Pizzeria/FormReportPizzaComponents.cs
new file mode 100644
index 0000000..ebdfcab
--- /dev/null
+++ b/Pizzeria/Pizzeria/FormReportPizzaComponents.cs
@@ -0,0 +1,72 @@
+using Microsoft.Extensions.Logging;
+using PizzeriaContracts.BindingModels;
+using PizzeriaContracts.BusinessLogicsContracts;
+namespace Pizzeria
+{
+ public partial class FormReportPizzaComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+ public FormReportPizzaComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportPizzaComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetPizzaComponents();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.PizzaName,"", "" });
+ foreach (var listElem in elem.Components)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty