diff --git a/LawFirm/LawFirm/FormMain.Designer.cs b/LawFirm/LawFirm/FormMain.Designer.cs
index e9caa6d..f9a969a 100644
--- a/LawFirm/LawFirm/FormMain.Designer.cs
+++ b/LawFirm/LawFirm/FormMain.Designer.cs
@@ -37,6 +37,7 @@
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.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonSetToWork = new System.Windows.Forms.Button();
@@ -45,7 +46,7 @@
this.buttonUpdate = new System.Windows.Forms.Button();
this.buttonSupplyShop = new System.Windows.Forms.Button();
this.buttonSellDocuments = new System.Windows.Forms.Button();
- this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.документыВМагазинахToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
@@ -99,7 +100,8 @@
this.списокДокументовToolStripMenuItem,
this.бланкиПоДокументамToolStripMenuItem,
this.списокЗаказовToolStripMenuItem,
- this.списокМагазиновToolStripMenuItem});
+ this.списокМагазиновToolStripMenuItem,
+ this.документыВМагазинахToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
this.отчетыToolStripMenuItem.Text = "Отчеты";
@@ -107,24 +109,31 @@
// списокДокументовToolStripMenuItem
//
this.списокДокументовToolStripMenuItem.Name = "списокДокументовToolStripMenuItem";
- this.списокДокументовToolStripMenuItem.Size = new System.Drawing.Size(252, 26);
+ this.списокДокументовToolStripMenuItem.Size = new System.Drawing.Size(259, 26);
this.списокДокументовToolStripMenuItem.Text = "Список документов";
this.списокДокументовToolStripMenuItem.Click += new System.EventHandler(this.списокДокументовToolStripMenuItem_Click);
//
// бланкиПоДокументамToolStripMenuItem
//
this.бланкиПоДокументамToolStripMenuItem.Name = "бланкиПоДокументамToolStripMenuItem";
- this.бланкиПоДокументамToolStripMenuItem.Size = new System.Drawing.Size(252, 26);
+ this.бланкиПоДокументамToolStripMenuItem.Size = new System.Drawing.Size(259, 26);
this.бланкиПоДокументамToolStripMenuItem.Text = "Бланки по документам";
this.бланкиПоДокументамToolStripMenuItem.Click += new System.EventHandler(this.бланкиПоДокументамToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
- this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(252, 26);
+ this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(259, 26);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click);
//
+ // списокМагазиновToolStripMenuItem
+ //
+ this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
+ this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(259, 26);
+ this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
+ this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.списокМагазиновToolStripMenuItem_Click);
+ //
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@@ -205,12 +214,12 @@
this.buttonSellDocuments.UseVisualStyleBackColor = true;
this.buttonSellDocuments.Click += new System.EventHandler(this.buttonSellDocuments_Click);
//
- // списокМагазиновToolStripMenuItem
+ // документыВМагазинахToolStripMenuItem
//
- this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
- this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(252, 26);
- this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
- this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.списокМагазиновToolStripMenuItem_Click);
+ this.документыВМагазинахToolStripMenuItem.Name = "документыВМагазинахToolStripMenuItem";
+ this.документыВМагазинахToolStripMenuItem.Size = new System.Drawing.Size(259, 26);
+ this.документыВМагазинахToolStripMenuItem.Text = "Документы в магазинах";
+ this.документыВМагазинахToolStripMenuItem.Click += new System.EventHandler(this.документыВМагазинахToolStripMenuItem_Click);
//
// FormMain
//
@@ -258,5 +267,6 @@
private Button buttonSupplyShop;
private Button buttonSellDocuments;
private ToolStripMenuItem списокМагазиновToolStripMenuItem;
+ private ToolStripMenuItem документыВМагазинахToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/LawFirm/LawFirm/FormMain.cs b/LawFirm/LawFirm/FormMain.cs
index 513b5d8..8b2f7bd 100644
--- a/LawFirm/LawFirm/FormMain.cs
+++ b/LawFirm/LawFirm/FormMain.cs
@@ -117,6 +117,15 @@ namespace LawFirmView
}
}
+ private void документыВМагазинахToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportShopDocuments));
+ if (service is FormReportShopDocuments form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
diff --git a/LawFirm/LawFirm/FormReportShopDocuments.Designer.cs b/LawFirm/LawFirm/FormReportShopDocuments.Designer.cs
new file mode 100644
index 0000000..4cf865e
--- /dev/null
+++ b/LawFirm/LawFirm/FormReportShopDocuments.Designer.cs
@@ -0,0 +1,107 @@
+namespace LawFirmView
+{
+ partial class FormReportShopDocuments
+ {
+ ///
+ /// 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.Shop = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Document = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 8);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(176, 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.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.Shop,
+ this.Document,
+ this.Count});
+ this.dataGridView.Location = new System.Drawing.Point(12, 43);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersWidth = 51;
+ this.dataGridView.RowTemplate.Height = 29;
+ this.dataGridView.Size = new System.Drawing.Size(776, 395);
+ this.dataGridView.TabIndex = 1;
+ //
+ // Shop
+ //
+ this.Shop.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Shop.HeaderText = "Магазин";
+ this.Shop.MinimumWidth = 6;
+ this.Shop.Name = "Shop";
+ //
+ // Document
+ //
+ this.Document.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Document.HeaderText = "Документ";
+ this.Document.MinimumWidth = 6;
+ this.Document.Name = "Document";
+ //
+ // Count
+ //
+ this.Count.HeaderText = "Количество";
+ this.Count.MinimumWidth = 6;
+ this.Count.Name = "Count";
+ this.Count.Width = 125;
+ //
+ // FormReportShopDocuments
+ //
+ 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 = "FormReportShopDocuments";
+ this.Text = "Документы в магазинах";
+ this.Load += new System.EventHandler(this.FormReportShopDocuments_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button buttonSaveToExcel;
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn Shop;
+ private DataGridViewTextBoxColumn Document;
+ private DataGridViewTextBoxColumn Count;
+ }
+}
\ No newline at end of file
diff --git a/LawFirm/LawFirm/FormReportShopDocuments.cs b/LawFirm/LawFirm/FormReportShopDocuments.cs
new file mode 100644
index 0000000..63bbb56
--- /dev/null
+++ b/LawFirm/LawFirm/FormReportShopDocuments.cs
@@ -0,0 +1,85 @@
+using LawFirmBusinessLogic.BusinessLogics;
+using LawFirmContracts.BindingModels;
+using LawFirmContracts.BusinessLogicContracts;
+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 LawFirmView
+{
+ public partial class FormReportShopDocuments : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public FormReportShopDocuments(ILogger logger, IReportLogic reportLogic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = reportLogic;
+ }
+
+ private void buttonSaveToExcel_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog
+ {
+ Filter = "xlsx|*.xlsx"
+ };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveShopDocumentsToExcelFile(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);
+ }
+ }
+ }
+
+ private void FormReportShopDocuments_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetShopDocuments();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
+ foreach (var listElem in elem.Documents)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Всего:", "", elem.Count });
+ dataGridView.Rows.Add(Array.Empty