diff --git a/ComputersShop/ComputersShop/FormMain.Designer.cs b/ComputersShop/ComputersShop/FormMain.Designer.cs
index 71861a1..9a35958 100644
--- a/ComputersShop/ComputersShop/FormMain.Designer.cs
+++ b/ComputersShop/ComputersShop/FormMain.Designer.cs
@@ -34,17 +34,20 @@
компьютерыToolStripMenuItem = new ToolStripMenuItem();
магазиныToolStripMenuItem = new ToolStripMenuItem();
поставкиToolStripMenuItem = new ToolStripMenuItem();
+ SellsToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
списокКомпонентовToolStripMenuItem = new ToolStripMenuItem();
компонентыПоКомпьютерамToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
+ списокМагазиновToolStripMenuItem = new ToolStripMenuItem();
+ компьютерыПоМагазинамToolStripMenuItem = new ToolStripMenuItem();
+ заказыПоДатамToolStripMenuItem = new ToolStripMenuItem();
dataGridView = new DataGridView();
buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button();
buttonOrderReady = new Button();
buttonIssuedOrder = new Button();
buttonRefresh = new Button();
- SellsToolStripMenuItem = new ToolStripMenuItem();
menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@@ -80,9 +83,30 @@
компьютерыToolStripMenuItem.Text = "Компьютеры";
компьютерыToolStripMenuItem.Click += ComputersStripMenuItem_Click;
//
+ // магазиныToolStripMenuItem
+ //
+ магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
+ магазиныToolStripMenuItem.Size = new Size(184, 26);
+ магазиныToolStripMenuItem.Text = "Магазины";
+ магазиныToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
+ //
+ // поставкиToolStripMenuItem
+ //
+ поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem";
+ поставкиToolStripMenuItem.Size = new Size(184, 26);
+ поставкиToolStripMenuItem.Text = "Поставки";
+ поставкиToolStripMenuItem.Click += SupplyToolStripMenuItem_Click;
+ //
+ // SellsToolStripMenuItem
+ //
+ SellsToolStripMenuItem.Name = "SellsToolStripMenuItem";
+ SellsToolStripMenuItem.Size = new Size(184, 26);
+ SellsToolStripMenuItem.Text = "Продажи";
+ SellsToolStripMenuItem.Click += SellToolStripMenuItem_Click;
+ //
// отчетыToolStripMenuItem
//
- отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоКомпьютерамToolStripMenuItem, списокЗаказовToolStripMenuItem });
+ отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокКомпонентовToolStripMenuItem, компонентыПоКомпьютерамToolStripMenuItem, списокЗаказовToolStripMenuItem, списокМагазиновToolStripMenuItem, компьютерыПоМагазинамToolStripMenuItem, заказыПоДатамToolStripMenuItem });
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Text = "Отчеты";
@@ -108,19 +132,26 @@
списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
//
- // магазиныToolStripMenuItem
+ // списокМагазиновToolStripMenuItem
//
- магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
- магазиныToolStripMenuItem.Size = new Size(224, 26);
- магазиныToolStripMenuItem.Text = "Магазины";
- магазиныToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
+ списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
+ списокМагазиновToolStripMenuItem.Size = new Size(306, 26);
+ списокМагазиновToolStripMenuItem.Text = "Список магазинов";
+ списокМагазиновToolStripMenuItem.Click += списокМагазиновToolStripMenuItem_Click;
//
- // поставкиToolStripMenuItem
+ // компьютерыПоМагазинамToolStripMenuItem
//
- поставкиToolStripMenuItem.Name = "поставкиToolStripMenuItem";
- поставкиToolStripMenuItem.Size = new Size(224, 26);
- поставкиToolStripMenuItem.Text = "Поставки";
- поставкиToolStripMenuItem.Click += SupplyToolStripMenuItem_Click;
+ компьютерыПоМагазинамToolStripMenuItem.Name = "компьютерыПоМагазинамToolStripMenuItem";
+ компьютерыПоМагазинамToolStripMenuItem.Size = new Size(306, 26);
+ компьютерыПоМагазинамToolStripMenuItem.Text = "Компьютеры по магазинам";
+ компьютерыПоМагазинамToolStripMenuItem.Click += компьютерыПоМагазинамToolStripMenuItem_Click;
+ //
+ // заказыПоДатамToolStripMenuItem
+ //
+ заказыПоДатамToolStripMenuItem.Name = "заказыПоДатамToolStripMenuItem";
+ заказыПоДатамToolStripMenuItem.Size = new Size(306, 26);
+ заказыПоДатамToolStripMenuItem.Text = "Заказы по датам";
+ заказыПоДатамToolStripMenuItem.Click += заказыПоДатамToolStripMenuItem_Click;
//
// dataGridView
//
@@ -182,13 +213,6 @@
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += RefreshButton_Click;
//
- // SellsToolStripMenuItem
- //
- SellsToolStripMenuItem.Name = "SellsToolStripMenuItem";
- SellsToolStripMenuItem.Size = new Size(224, 26);
- SellsToolStripMenuItem.Text = "Продажи";
- SellsToolStripMenuItem.Click += SellToolStripMenuItem_Click;
- //
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
@@ -231,5 +255,8 @@
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
private ToolStripMenuItem компонентыПоКомпьютерамToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
+ private ToolStripMenuItem списокМагазиновToolStripMenuItem;
+ private ToolStripMenuItem компьютерыПоМагазинамToolStripMenuItem;
+ private ToolStripMenuItem заказыПоДатамToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/ComputersShop/ComputersShop/FormMain.cs b/ComputersShop/ComputersShop/FormMain.cs
index a166791..eaf8d34 100644
--- a/ComputersShop/ComputersShop/FormMain.cs
+++ b/ComputersShop/ComputersShop/FormMain.cs
@@ -145,6 +145,38 @@ Program.ServiceProvider?.GetService(typeof(FormReportComputerComponents));
}
+ private void списокМагазиновToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveShopsToWordFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ }
+ }
+
+ private void компьютерыПоМагазинамToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportShopsComputers));
+ if (service is FormReportShopsComputers form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void заказыПоДатамToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportDateOrders));
+ if (service is FormReportDateOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private OrderBindingModel CreateBindingModel(int id, bool isDone = false)
{
return new OrderBindingModel
diff --git a/ComputersShop/ComputersShop/FormReportDateOrders.Designer.cs b/ComputersShop/ComputersShop/FormReportDateOrders.Designer.cs
new file mode 100644
index 0000000..5766e27
--- /dev/null
+++ b/ComputersShop/ComputersShop/FormReportDateOrders.Designer.cs
@@ -0,0 +1,82 @@
+namespace ComputersShop
+{
+ partial class FormReportDateOrders
+ {
+ ///
+ /// 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();
+ MakeButton = new Button();
+ ToPdfButton = new Button();
+ SuspendLayout();
+ //
+ // panel
+ //
+ panel.Location = new Point(12, 71);
+ panel.Name = "panel";
+ panel.Size = new Size(776, 367);
+ panel.TabIndex = 0;
+ //
+ // MakeButton
+ //
+ MakeButton.Location = new Point(12, 36);
+ MakeButton.Name = "MakeButton";
+ MakeButton.Size = new Size(131, 29);
+ MakeButton.TabIndex = 1;
+ MakeButton.Text = "Сформировать";
+ MakeButton.UseVisualStyleBackColor = true;
+ MakeButton.Click += MakeButton_Click;
+ //
+ // ToPdfButton
+ //
+ ToPdfButton.Location = new Point(149, 36);
+ ToPdfButton.Name = "ToPdfButton";
+ ToPdfButton.Size = new Size(94, 29);
+ ToPdfButton.TabIndex = 2;
+ ToPdfButton.Text = "В PDF";
+ ToPdfButton.UseVisualStyleBackColor = true;
+ ToPdfButton.Click += ToPdfButton_Click;
+ //
+ // ReportDateOrdersForm
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(ToPdfButton);
+ Controls.Add(MakeButton);
+ Controls.Add(panel);
+ Name = "FormReportDateOrders";
+ Text = "Заказы по датам";
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel;
+ private Button MakeButton;
+ private Button ToPdfButton;
+ }
+}
\ No newline at end of file
diff --git a/ComputersShop/ComputersShop/FormReportDateOrders.cs b/ComputersShop/ComputersShop/FormReportDateOrders.cs
new file mode 100644
index 0000000..6c21482
--- /dev/null
+++ b/ComputersShop/ComputersShop/FormReportDateOrders.cs
@@ -0,0 +1,77 @@
+using ComputersShopContracts.BindingModels;
+using ComputersShopContracts.BisnessLogicsContracts;
+using Microsoft.Extensions.Logging;
+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;
+
+namespace ComputersShop
+{
+ public partial class FormReportDateOrders : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+ public FormReportDateOrders(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrdersByDate.rdlc", FileMode.Open));
+ panel.Controls.Add(reportViewer);
+ }
+
+ private void MakeButton_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var dataSource = _logic.GetDatesOrders();
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов на весь период по датам");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ToPdfButton_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveDatesOrdersToPdfFile(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);
+ }
+ }
+ }
+ }
+}
diff --git a/ComputersShop/ComputersShop/FormReportDateOrders.resx b/ComputersShop/ComputersShop/FormReportDateOrders.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ComputersShop/ComputersShop/FormReportDateOrders.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/ComputersShop/ComputersShop/FormReportShopsComputers.Designer.cs b/ComputersShop/ComputersShop/FormReportShopsComputers.Designer.cs
new file mode 100644
index 0000000..ab4455a
--- /dev/null
+++ b/ComputersShop/ComputersShop/FormReportShopsComputers.Designer.cs
@@ -0,0 +1,103 @@
+namespace ComputersShop
+{
+ partial class FormReportShopsComputers
+ {
+ ///
+ /// 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()
+ {
+ dataGridView = new DataGridView();
+ ShopColumn = new DataGridViewTextBoxColumn();
+ IceCreamColumn = new DataGridViewTextBoxColumn();
+ CountColumn = new DataGridViewTextBoxColumn();
+ SaveButton = new Button();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { ShopColumn, IceCreamColumn, CountColumn });
+ dataGridView.Location = new Point(12, 64);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 29;
+ dataGridView.Size = new Size(682, 374);
+ dataGridView.TabIndex = 0;
+ //
+ // ShopColumn
+ //
+ ShopColumn.HeaderText = "Магазин";
+ ShopColumn.MinimumWidth = 6;
+ ShopColumn.Name = "ShopColumn";
+ ShopColumn.Width = 250;
+ //
+ // IceCreamColumn
+ //
+ IceCreamColumn.HeaderText = "Компьютер";
+ IceCreamColumn.MinimumWidth = 6;
+ IceCreamColumn.Name = "ComputerColumn";
+ IceCreamColumn.Width = 250;
+ //
+ // CountColumn
+ //
+ CountColumn.HeaderText = "Количество";
+ CountColumn.MinimumWidth = 6;
+ CountColumn.Name = "CountColumn";
+ CountColumn.Width = 125;
+ //
+ // SaveButton
+ //
+ SaveButton.Location = new Point(12, 29);
+ SaveButton.Name = "SaveButton";
+ SaveButton.Size = new Size(122, 29);
+ SaveButton.TabIndex = 1;
+ SaveButton.Text = "Сохранить в";
+ SaveButton.UseVisualStyleBackColor = true;
+ SaveButton.Click += SaveButton_Click;
+ //
+ // FormReportShopsComputers
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(702, 450);
+ Controls.Add(SaveButton);
+ Controls.Add(dataGridView);
+ Name = "FormReportShopsComputers";
+ Text = "Компьютеры по магазинам";
+ Load += ReportShopsComputersForm_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button SaveButton;
+ private DataGridViewTextBoxColumn ShopColumn;
+ private DataGridViewTextBoxColumn IceCreamColumn;
+ private DataGridViewTextBoxColumn CountColumn;
+ }
+}
\ No newline at end of file
diff --git a/ComputersShop/ComputersShop/FormReportShopsComputers.cs b/ComputersShop/ComputersShop/FormReportShopsComputers.cs
new file mode 100644
index 0000000..9bc0f5c
--- /dev/null
+++ b/ComputersShop/ComputersShop/FormReportShopsComputers.cs
@@ -0,0 +1,88 @@
+using ComputersShopContracts.BindingModels;
+using ComputersShopContracts.BisnessLogicsContracts;
+using Microsoft.Extensions.Logging;
+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 ComputersShop
+{
+ public partial class FormReportShopsComputers : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public FormReportShopsComputers(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+
+ }
+
+ private void ReportShopsComputersForm_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetShopsComputers();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
+ foreach (var listElem in elem.Computers)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty