diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj
index ae37a5d..fe9d4c2 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshopView.csproj
@@ -10,12 +10,16 @@
+
Always
+
+ Always
+
@@ -25,6 +29,7 @@
+
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
index 747545a..47781ff 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
@@ -32,6 +32,10 @@
this.refbooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.manufacturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportManufactureComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
@@ -41,12 +45,12 @@
this.menuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
- this.Load += new System.EventHandler(this.FormMain_Load);
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.refbooksToolStripMenuItem});
+ this.refbooksToolStripMenuItem,
+ this.reportsToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1108, 24);
@@ -76,6 +80,37 @@
this.manufacturesToolStripMenuItem.Text = "Изделия";
this.manufacturesToolStripMenuItem.Click += new System.EventHandler(this.ManufacturesToolStripMenuItem_Click);
//
+ // reportsToolStripMenuItem
+ //
+ this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.reportComponentsToolStripMenuItem,
+ this.reportManufactureComponentsToolStripMenuItem,
+ this.reportOrdersToolStripMenuItem});
+ this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
+ this.reportsToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
+ this.reportsToolStripMenuItem.Text = "Отчеты";
+ //
+ // reportComponentsToolStripMenuItem
+ //
+ this.reportComponentsToolStripMenuItem.Name = "reportComponentsToolStripMenuItem";
+ this.reportComponentsToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
+ this.reportComponentsToolStripMenuItem.Text = "Список компонентов";
+ this.reportComponentsToolStripMenuItem.Click += new System.EventHandler(this.ReportComponentsToolStripMenuItem_Click);
+ //
+ // reportManufactureComponentsToolStripMenuItem
+ //
+ this.reportManufactureComponentsToolStripMenuItem.Name = "reportManufactureComponentsToolStripMenuItem";
+ this.reportManufactureComponentsToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
+ this.reportManufactureComponentsToolStripMenuItem.Text = "Компоненты по изделиям";
+ this.reportManufactureComponentsToolStripMenuItem.Click += new System.EventHandler(this.ReportManufactureComponentsToolStripMenuItem_Click);
+ //
+ // reportOrdersToolStripMenuItem
+ //
+ this.reportOrdersToolStripMenuItem.Name = "reportOrdersToolStripMenuItem";
+ this.reportOrdersToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
+ this.reportOrdersToolStripMenuItem.Text = "Список заказов";
+ this.reportOrdersToolStripMenuItem.Click += new System.EventHandler(this.ReportOrdersToolStripMenuItem_Click);
+ //
// dataGridView
//
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
@@ -156,6 +191,7 @@
this.MainMenuStrip = this.menuStrip;
this.Name = "FormMain";
this.Text = "Кузнечная мастерская";
+ this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
@@ -176,5 +212,9 @@
private Button buttonOrderReady;
private Button buttonIssuedOrder;
private Button buttonRef;
+ private ToolStripMenuItem reportsToolStripMenuItem;
+ private ToolStripMenuItem reportComponentsToolStripMenuItem;
+ private ToolStripMenuItem reportManufactureComponentsToolStripMenuItem;
+ private ToolStripMenuItem reportOrdersToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
index ad836a4..d7c5f4d 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
@@ -1,5 +1,6 @@
using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.BusinessLogicContracts;
+using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
namespace BlacksmithWorkshopView
@@ -9,11 +10,13 @@ namespace BlacksmithWorkshopView
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)
{
@@ -146,5 +149,32 @@ namespace BlacksmithWorkshopView
{
LoadData();
}
+ private void ReportComponentsToolStripMenuItem_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 ReportManufactureComponentsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportManufactureComponents));
+ if (service is FormReportManufactureComponents form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
+ private void ReportOrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
+ if (service is FormReportOrders form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.Designer.cs
new file mode 100644
index 0000000..47d93aa
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.Designer.cs
@@ -0,0 +1,111 @@
+namespace BlacksmithWorkshopView
+{
+ partial class FormReportManufactureComponents
+ {
+ ///
+ /// 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.ColumnManufacture = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnComponent = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnSum = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.AllowUserToAddRows = 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.ColumnManufacture,
+ this.ColumnComponent,
+ this.ColumnCount,
+ this.ColumnSum});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.dataGridView.Location = new System.Drawing.Point(0, 45);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(610, 405);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 12);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(188, 23);
+ this.buttonSaveToExcel.TabIndex = 1;
+ this.buttonSaveToExcel.Text = "Сохранить в Excel";
+ this.buttonSaveToExcel.UseVisualStyleBackColor = true;
+ this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
+ //
+ // ColumnManufacture
+ //
+ this.ColumnManufacture.HeaderText = "Изделие";
+ this.ColumnManufacture.Name = "ColumnManufacture";
+ //
+ // ColumnComponent
+ //
+ this.ColumnComponent.HeaderText = "Компонент";
+ this.ColumnComponent.Name = "ColumnComponent";
+ //
+ // ColumnCount
+ //
+ this.ColumnCount.HeaderText = "Количество";
+ this.ColumnCount.Name = "ColumnCount";
+ //
+ // ColumnSum
+ //
+ this.ColumnSum.HeaderText = "Сумма";
+ this.ColumnSum.Name = "ColumnSum";
+ //
+ // FormReportManufactureComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(610, 450);
+ this.Controls.Add(this.buttonSaveToExcel);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormReportManufactureComponents";
+ this.Text = "FormReportManufactureComponents";
+ this.Load += new System.EventHandler(this.FormReportManufactureComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonSaveToExcel;
+ private DataGridViewTextBoxColumn ColumnManufacture;
+ private DataGridViewTextBoxColumn ColumnComponent;
+ private DataGridViewTextBoxColumn ColumnCount;
+ private DataGridViewTextBoxColumn ColumnSum;
+ }
+}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.cs
new file mode 100644
index 0000000..9eeda51
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.cs
@@ -0,0 +1,71 @@
+using BlacksmithWorkshopContracts.BindingModels;
+using BlacksmithWorkshopContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+
+namespace BlacksmithWorkshopView
+{
+ public partial class FormReportManufactureComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+ public FormReportManufactureComponents(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+ private void FormReportManufactureComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetManufactureComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ManufactureName, "", "" });
+ foreach (var listElem in elem.Components)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2, listElem.Item3 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount, elem.TotalSum });
+ dataGridView.Rows.Add(Array.Empty