diff --git a/FishFactory/FishFactory/FishFactoryView.csproj b/FishFactory/FishFactory/FishFactoryView.csproj
index ee611b4..9bb19ab 100644
--- a/FishFactory/FishFactory/FishFactoryView.csproj
+++ b/FishFactory/FishFactory/FishFactoryView.csproj
@@ -17,11 +17,14 @@
+
+
+
diff --git a/FishFactory/FishFactory/FormMain.Designer.cs b/FishFactory/FishFactory/FormMain.Designer.cs
index 5579586..012a06c 100644
--- a/FishFactory/FishFactory/FormMain.Designer.cs
+++ b/FishFactory/FishFactory/FormMain.Designer.cs
@@ -32,6 +32,10 @@
reference_booksToolStripMenuItem = new ToolStripMenuItem();
ComponentsToolStripMenuItem = new ToolStripMenuItem();
cannedToolStripMenuItem = new ToolStripMenuItem();
+ отчётыToolStripMenuItem = new ToolStripMenuItem();
+ CannedListToolStripMenuItem = new ToolStripMenuItem();
+ CannedComponentToolStripMenuItem = new ToolStripMenuItem();
+ OrdersToolStripMenuItem = new ToolStripMenuItem();
dataGridView = new DataGridView();
buttonCreateOrder = new Button();
buttonSetToWork = new Button();
@@ -45,7 +49,7 @@
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
- menuStrip.Items.AddRange(new ToolStripItem[] { reference_booksToolStripMenuItem });
+ menuStrip.Items.AddRange(new ToolStripItem[] { reference_booksToolStripMenuItem, отчётыToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(1114, 28);
@@ -74,6 +78,35 @@
cannedToolStripMenuItem.Text = "Консервы";
cannedToolStripMenuItem.Click += cannedToolStripMenuItem_Click;
//
+ // отчётыToolStripMenuItem
+ //
+ отчётыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { CannedListToolStripMenuItem, CannedComponentToolStripMenuItem, OrdersToolStripMenuItem });
+ отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
+ отчётыToolStripMenuItem.Size = new Size(73, 24);
+ отчётыToolStripMenuItem.Text = "Отчёты";
+ отчётыToolStripMenuItem.Click += отчётыToolStripMenuItem_Click;
+ //
+ // CannedListToolStripMenuItem
+ //
+ CannedListToolStripMenuItem.Name = "CannedListToolStripMenuItem";
+ CannedListToolStripMenuItem.Size = new Size(286, 26);
+ CannedListToolStripMenuItem.Text = "Список консерв";
+ CannedListToolStripMenuItem.Click += CannedListToolStripMenuItem_Click;
+ //
+ // CannedComponentToolStripMenuItem
+ //
+ CannedComponentToolStripMenuItem.Name = "CannedComponentToolStripMenuItem";
+ CannedComponentToolStripMenuItem.Size = new Size(286, 26);
+ CannedComponentToolStripMenuItem.Text = "Консервы с ингредиентами";
+ CannedComponentToolStripMenuItem.Click += CannedComponentToolStripMenuItem_Click;
+ //
+ // OrdersToolStripMenuItem
+ //
+ OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
+ OrdersToolStripMenuItem.Size = new Size(286, 26);
+ OrdersToolStripMenuItem.Text = "Список заказов";
+ OrdersToolStripMenuItem.Click += OrdersToolStripMenuItem_Click;
+ //
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@@ -169,5 +202,9 @@
private Button buttonSetToDone;
private Button buttonSetToFinish;
private Button buttonUpdate;
+ private ToolStripMenuItem отчётыToolStripMenuItem;
+ private ToolStripMenuItem CannedListToolStripMenuItem;
+ private ToolStripMenuItem CannedComponentToolStripMenuItem;
+ private ToolStripMenuItem OrdersToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/FishFactory/FishFactory/FormMain.cs b/FishFactory/FishFactory/FormMain.cs
index 71304cb..65bae3e 100644
--- a/FishFactory/FishFactory/FormMain.cs
+++ b/FishFactory/FishFactory/FormMain.cs
@@ -19,11 +19,13 @@ namespace FishFactoryView
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic)
+ private readonly IReportLogic _reportLogic;
+ public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
+ _reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
@@ -184,5 +186,38 @@ namespace FishFactoryView
{
LoadData();
}
+
+
+ private void CannedListToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveListCannedToWordFile(new ReportBindingModel { FileName = dialog.FileName });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+ private void CannedComponentToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportCannedComponents));
+ if (service is FormReportCannedComponents 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();
+ }
+ }
+
+ private void отчётыToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+
+ }
}
}
diff --git a/FishFactory/FishFactory/FormMain.resx b/FishFactory/FishFactory/FormMain.resx
index 6c82d08..e527639 100644
--- a/FishFactory/FishFactory/FormMain.resx
+++ b/FishFactory/FishFactory/FormMain.resx
@@ -120,4 +120,7 @@
17, 17
+
+ 25
+
\ No newline at end of file
diff --git a/FishFactory/FishFactory/FormReportCannedComponents.Designer.cs b/FishFactory/FishFactory/FormReportCannedComponents.Designer.cs
new file mode 100644
index 0000000..30b8389
--- /dev/null
+++ b/FishFactory/FishFactory/FormReportCannedComponents.Designer.cs
@@ -0,0 +1,117 @@
+namespace FishFactoryView
+{
+ partial class FormReportCannedComponents
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonSaveToExcel = new System.Windows.Forms.Button();
+ this.ColumnCanned = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.AllowUserToAddRows = false;
+ this.dataGridView.AllowUserToDeleteRows = false;
+ this.dataGridView.AllowUserToOrderColumns = true;
+ this.dataGridView.AllowUserToResizeColumns = false;
+ this.dataGridView.AllowUserToResizeRows = false;
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ColumnCanned,
+ this.ColumnComponent,
+ this.ColumnCount});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.dataGridView.Location = new System.Drawing.Point(0, 47);
+ this.dataGridView.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.dataGridView.MultiSelect = false;
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.ReadOnly = true;
+ this.dataGridView.RowHeadersVisible = false;
+ this.dataGridView.Size = new System.Drawing.Size(616, 510);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(14, 14);
+ this.buttonSaveToExcel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(186, 27);
+ this.buttonSaveToExcel.TabIndex = 1;
+ this.buttonSaveToExcel.Text = "Сохранить в Excel";
+ this.buttonSaveToExcel.UseVisualStyleBackColor = true;
+ this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
+ //
+ // ColumnCaned
+ //
+ this.ColumnCanned.HeaderText = "Консерва";
+ this.ColumnCanned.Name = "ColumnCanned";
+ this.ColumnCanned.ReadOnly = true;
+ this.ColumnCanned.Width = 200;
+ //
+ // ColumnComponent
+ //
+ this.ColumnComponent.HeaderText = "Ингредиент";
+ this.ColumnComponent.Name = "ColumnComponent";
+ this.ColumnComponent.ReadOnly = true;
+ this.ColumnComponent.Width = 200;
+ //
+ // ColumnCount
+ //
+ this.ColumnCount.HeaderText = "Количество";
+ this.ColumnCount.Name = "ColumnCount";
+ this.ColumnCount.ReadOnly = true;
+ //
+ // FormReportCannedComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(616, 557);
+ this.Controls.Add(this.buttonSaveToExcel);
+ this.Controls.Add(this.dataGridView);
+ this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.Name = "FormReportCannedComponents";
+ this.Text = "Ингредиенты по консервам";
+ this.Load += new System.EventHandler(this.FormReportCannedComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DataGridView dataGridView;
+ private System.Windows.Forms.Button buttonSaveToExcel;
+ private DataGridViewTextBoxColumn ColumnCanned;
+ private DataGridViewTextBoxColumn ColumnComponent;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/FishFactory/FishFactory/FormReportCannedComponents.cs b/FishFactory/FishFactory/FormReportCannedComponents.cs
new file mode 100644
index 0000000..184a4c5
--- /dev/null
+++ b/FishFactory/FishFactory/FormReportCannedComponents.cs
@@ -0,0 +1,72 @@
+
+using FishFactoryContracts.BindingModels;
+using FishFactoryContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using System.Windows.Forms;
+
+namespace FishFactoryView
+{
+ public partial class FormReportCannedComponents : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportCannedComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportCannedComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetCannedComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.CannedName, "", "" });
+ 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