diff --git a/Bar/1.docx b/Bar/1.docx
new file mode 100644
index 0000000..6f15e9a
Binary files /dev/null and b/Bar/1.docx differ
diff --git a/Bar/1.pdf b/Bar/1.pdf
new file mode 100644
index 0000000..8a09275
Binary files /dev/null and b/Bar/1.pdf differ
diff --git a/Bar/1.xlsx b/Bar/1.xlsx
new file mode 100644
index 0000000..e180f89
Binary files /dev/null and b/Bar/1.xlsx differ
diff --git a/Bar/Bar/BarView.csproj b/Bar/Bar/BarView.csproj
index 8ba9294..8aa7ae5 100644
--- a/Bar/Bar/BarView.csproj
+++ b/Bar/Bar/BarView.csproj
@@ -11,14 +11,21 @@
-
+
+
+
+
+ Always
+
+
+
\ No newline at end of file
diff --git a/Bar/Bar/DataSources/BarContracts.BusinessLogicContracts.ICocktailLogic.datasource b/Bar/Bar/DataSources/BarContracts.BusinessLogicContracts.ICocktailLogic.datasource
new file mode 100644
index 0000000..70422a1
--- /dev/null
+++ b/Bar/Bar/DataSources/BarContracts.BusinessLogicContracts.ICocktailLogic.datasource
@@ -0,0 +1,10 @@
+
+
+
+ BarContracts.BusinessLogicContracts.ICocktailLogic, BarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/Bar/Bar/FormMain.Designer.cs b/Bar/Bar/FormMain.Designer.cs
index 59d2b32..a69ba79 100644
--- a/Bar/Bar/FormMain.Designer.cs
+++ b/Bar/Bar/FormMain.Designer.cs
@@ -38,6 +38,10 @@
this.ToolStripMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ComponentsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CocktailStripMenuItem = 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.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@@ -106,7 +110,8 @@
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.ToolStripMenu});
+ this.ToolStripMenu,
+ this.отчётыToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1279, 28);
@@ -136,6 +141,37 @@
this.CocktailStripMenuItem.Text = "Коктейль";
this.CocktailStripMenuItem.Click += new System.EventHandler(this.CocktailsStripMenuItem_Click);
//
+ // отчётыToolStripMenuItem
+ //
+ this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.списокКомпонентовToolStripMenuItem,
+ this.компонентыПоИзделиямToolStripMenuItem,
+ this.списокЗаказовToolStripMenuItem});
+ this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
+ this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
+ this.отчётыToolStripMenuItem.Text = "Отчёты";
+ //
+ // списокКомпонентовToolStripMenuItem
+ //
+ this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
+ this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
+ this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
+ this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
+ //
+ // компонентыПоИзделиямToolStripMenuItem
+ //
+ this.компонентыПоИзделиямToolStripMenuItem.Name = "компонентыПоИзделиямToolStripMenuItem";
+ this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
+ this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по коктейлям";
+ this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.ComponentCocktailToolStripMenuItem_Click);
+ //
+ // списокЗаказовToolStripMenuItem
+ //
+ this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
+ this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
+ this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
+ this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
+ //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
@@ -171,5 +207,9 @@
private ToolStripMenuItem ToolStripMenu;
private ToolStripMenuItem ComponentsStripMenuItem;
private ToolStripMenuItem CocktailStripMenuItem;
+ private ToolStripMenuItem отчётыToolStripMenuItem;
+ private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
+ private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/Bar/Bar/FormMain.cs b/Bar/Bar/FormMain.cs
index 7440c36..8413d32 100644
--- a/Bar/Bar/FormMain.cs
+++ b/Bar/Bar/FormMain.cs
@@ -9,12 +9,14 @@ namespace BarView
{
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)
@@ -164,5 +166,35 @@ namespace BarView
{
LoadData();
}
+ private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var Dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+
+ if (Dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveComponentsToWordFile(new ReportBindingModel { FileName = Dialog.FileName });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ private void ComponentCocktailToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var Service = Program.ServiceProvider?.GetService(typeof(FormReportCocktailComponents));
+
+ if (Service is FormReportCocktailComponents 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/Bar/Bar/Forms/FormReportCocktailComponents.Designer.cs b/Bar/Bar/Forms/FormReportCocktailComponents.Designer.cs
new file mode 100644
index 0000000..7dcd6a6
--- /dev/null
+++ b/Bar/Bar/Forms/FormReportCocktailComponents.Designer.cs
@@ -0,0 +1,107 @@
+namespace BarView.Forms
+{
+ partial class FormReportCocktailComponents
+ {
+ ///
+ /// 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.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // ButtonSaveToExcel
+ //
+ this.ButtonSaveToExcel.Location = new System.Drawing.Point(31, 12);
+ this.ButtonSaveToExcel.Name = "ButtonSaveToExcel";
+ this.ButtonSaveToExcel.Size = new System.Drawing.Size(162, 26);
+ this.ButtonSaveToExcel.TabIndex = 0;
+ this.ButtonSaveToExcel.Text = "Сохранить в Excel";
+ this.ButtonSaveToExcel.UseVisualStyleBackColor = true;
+ this.ButtonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
+ //
+ // DataGridView
+ //
+ this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.Column1,
+ this.Column2,
+ this.Column3});
+ this.DataGridView.Location = new System.Drawing.Point(12, 56);
+ this.DataGridView.Name = "DataGridView";
+ this.DataGridView.RowHeadersWidth = 51;
+ this.DataGridView.RowTemplate.Height = 29;
+ this.DataGridView.Size = new System.Drawing.Size(581, 368);
+ this.DataGridView.TabIndex = 1;
+ //
+ // Column1
+ //
+ this.Column1.HeaderText = "Коктейль";
+ this.Column1.MinimumWidth = 6;
+ this.Column1.Name = "Column1";
+ this.Column1.Width = 125;
+ //
+ // Column2
+ //
+ this.Column2.HeaderText = "Компонент";
+ this.Column2.MinimumWidth = 6;
+ this.Column2.Name = "Column2";
+ this.Column2.Width = 125;
+ //
+ // Column3
+ //
+ this.Column3.HeaderText = "Количество";
+ this.Column3.MinimumWidth = 6;
+ this.Column3.Name = "Column3";
+ this.Column3.Width = 125;
+ //
+ // FormReportCocktailComponents
+ //
+ 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 = "FormReportCocktailComponents";
+ this.Text = "FormReportCoctailComponents";
+ this.Load += new System.EventHandler(this.FormReportCoctailComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button ButtonSaveToExcel;
+ private DataGridView DataGridView;
+ private DataGridViewTextBoxColumn Column1;
+ private DataGridViewTextBoxColumn Column2;
+ private DataGridViewTextBoxColumn Column3;
+ }
+}
\ No newline at end of file
diff --git a/Bar/Bar/Forms/FormReportCocktailComponents.cs b/Bar/Bar/Forms/FormReportCocktailComponents.cs
new file mode 100644
index 0000000..0f84698
--- /dev/null
+++ b/Bar/Bar/Forms/FormReportCocktailComponents.cs
@@ -0,0 +1,75 @@
+using BarContracts.BindingModels;
+using BarContracts.BusinessLogicContracts;
+using Microsoft.Extensions.Logging;
+
+namespace BarView.Forms
+{
+ public partial class FormReportCocktailComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public FormReportCocktailComponents(ILogger Logger, IReportLogic Logic)
+ {
+ InitializeComponent();
+
+ _logger = Logger;
+ _logic = Logic;
+ }
+
+ private void FormReportCoctailComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var Dict = _logic.GetCocktailComponents();
+
+ if (Dict != null)
+ {
+ DataGridView.Rows.Clear();
+
+ foreach (var Elem in Dict)
+ {
+ DataGridView.Rows.Add(new object[] { Elem.CocktailName, "", "" });
+
+ 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