diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs index a372504..f1d0445 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs @@ -32,16 +32,16 @@ GuidesToolStripMenuItem = new ToolStripMenuItem(); ComponentsToolStripMenuItem = new ToolStripMenuItem(); ManufacturesToolStripMenuItem = new ToolStripMenuItem(); + ReportsToolStripMenuItem = new ToolStripMenuItem(); + ComponentsListToolStripMenuItem = new ToolStripMenuItem(); + ManufacturesListToolStripMenuItem = new ToolStripMenuItem(); + OrdersListToolStripMenuItem = new ToolStripMenuItem(); dataGridView = new DataGridView(); buttonCreateOrder = new Button(); buttonRefresh = new Button(); buttonIssued = new Button(); buttonReady = new Button(); buttonTakeInWork = new Button(); - ReportsToolStripMenuItem = new ToolStripMenuItem(); - ComponentsListToolStripMenuItem = new ToolStripMenuItem(); - ManufacturesListToolStripMenuItem = new ToolStripMenuItem(); - OrdersListToolStripMenuItem = new ToolStripMenuItem(); menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); @@ -76,6 +76,34 @@ ManufacturesToolStripMenuItem.Text = "Кузнечные изделия"; ManufacturesToolStripMenuItem.Click += ManufacturesStripMenuItem_Click; // + // ReportsToolStripMenuItem + // + ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentsListToolStripMenuItem, ManufacturesListToolStripMenuItem, OrdersListToolStripMenuItem }); + ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem"; + ReportsToolStripMenuItem.Size = new Size(60, 20); + ReportsToolStripMenuItem.Text = "Отчёты"; + // + // ComponentsListToolStripMenuItem + // + ComponentsListToolStripMenuItem.Name = "ComponentsListToolStripMenuItem"; + ComponentsListToolStripMenuItem.Size = new Size(218, 22); + ComponentsListToolStripMenuItem.Text = "Список компонентов"; + ComponentsListToolStripMenuItem.Click += ComponentsListToolStripMenuItem_Click; + // + // ManufacturesListToolStripMenuItem + // + ManufacturesListToolStripMenuItem.Name = "ManufacturesListToolStripMenuItem"; + ManufacturesListToolStripMenuItem.Size = new Size(218, 22); + ManufacturesListToolStripMenuItem.Text = "Компоненты по изделиям"; + ManufacturesListToolStripMenuItem.Click += ManufacturesListToolStripMenuItem_Click; + // + // OrdersListToolStripMenuItem + // + OrdersListToolStripMenuItem.Name = "OrdersListToolStripMenuItem"; + OrdersListToolStripMenuItem.Size = new Size(218, 22); + OrdersListToolStripMenuItem.Text = "Список заказов"; + OrdersListToolStripMenuItem.Click += OrdersListToolStripMenuItem_Click; + // // dataGridView // dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; @@ -135,31 +163,6 @@ buttonTakeInWork.UseVisualStyleBackColor = true; buttonTakeInWork.Click += TakeInWorkButton_Click; // - // ReportsToolStripMenuItem - // - ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentsListToolStripMenuItem, ManufacturesListToolStripMenuItem, OrdersListToolStripMenuItem }); - ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem"; - ReportsToolStripMenuItem.Size = new Size(60, 20); - ReportsToolStripMenuItem.Text = "Отчёты"; - // - // ComponentsListToolStripMenuItem - // - ComponentsListToolStripMenuItem.Name = "ComponentsListToolStripMenuItem"; - ComponentsListToolStripMenuItem.Size = new Size(218, 22); - ComponentsListToolStripMenuItem.Text = "Список компонентов"; - // - // ManufacturesListToolStripMenuItem - // - ManufacturesListToolStripMenuItem.Name = "ManufacturesListToolStripMenuItem"; - ManufacturesListToolStripMenuItem.Size = new Size(218, 22); - ManufacturesListToolStripMenuItem.Text = "Компоненты по изделиям"; - // - // OrdersListToolStripMenuItem - // - OrdersListToolStripMenuItem.Name = "OrdersListToolStripMenuItem"; - OrdersListToolStripMenuItem.Size = new Size(218, 22); - OrdersListToolStripMenuItem.Text = "Список заказов"; - // // FormMain // AutoScaleDimensions = new SizeF(7F, 15F); diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs index 7174015..50d4d32 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs @@ -18,11 +18,13 @@ namespace BlacksmithWorkshop { 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 ComponentsStripMenuItem_Click(object sender, EventArgs e) { @@ -163,5 +165,37 @@ namespace BlacksmithWorkshop { LoadData(); } + + private void ComponentsListToolStripMenuItem_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 ManufacturesListToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportManufactureComponents)); + if (service is FormReportManufactureComponents form) + { + form.ShowDialog(); + } + } + + private void OrdersListToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs index 78a7aa8..0ca1e1b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/Program.cs @@ -1,4 +1,6 @@ using BlacksmithWorkshopBusinessLogic.BusinessLogics; +using BlacksmithWorkshopBusinessLogic.OfficePackage.Implements; +using BlacksmithWorkshopBusinessLogic.OfficePackage; using BlacksmithWorkshopContracts.BusinessLogicsContracts; using BlacksmithWorkshopContracts.StoragesContracts; using BlacksmithWorkshopDatabaseImplement.Implements; @@ -40,6 +42,10 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -47,6 +53,8 @@ namespace BlacksmithWorkshop services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc new file mode 100644 index 0000000..fa8050b --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc @@ -0,0 +1,599 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 47cb53f0-7dde-4717-ba03-866a0bc4f4dd + + + + + + BlacksmithWorkshopContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + DateCreate + System.DateTime + + + ManufactureName + System.String + + + Sum + System.Decimal + + + OrderStatus + BlacksmithWorkshopDataModels.OrderStatus + + + + BlacksmithWorkshopContracts.ViewModels + ReportOrderViewModel + BlacksmithWorkshopContracts.ViewModels.ReportOrderViewModel, BlacksmithWorkshopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + true + true + + + + + =Parameters!ReportParameterPeriod.Value + + + + + + + ReportParameterPeriod + 1cm + 1cm + 21cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ������ + + + + + + + 1cm + 21cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.5cm + + + 3.21438cm + + + 8.23317cm + + + 2.5cm + + + 2.5cm + + + + + 0.6cm + + + + + true + true + + + + + ����� + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + ���� �������� + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + ��������� + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + ������ ������ + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + ����� + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!Id.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!DateCreate.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!ManufactureName.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!OrderStatus.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.2cm + 18.94755cm + 2 + + + + + + true + true + + + + + �����: + + + + + + + 4cm + 12cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4cm + 14.5cm + 0.6cm + 2.5cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.72875cm +