From b63ef37d04b447051f83a53baba4542c01b7089c Mon Sep 17 00:00:00 2001 From: dasha Date: Fri, 10 Mar 2023 18:23:51 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D1=83=20=D0=B2=D1=80=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?=20=D0=B2=D1=81=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SushiBar/SushiBar/FormMain.Designer.cs | 70 +++++++++--------- SushiBar/SushiBar/FormMain.cs | 6 +- .../SushiBar/FormReportSushiIngredients.cs | 4 +- .../FormReportSushiIngredients.designer.cs | 20 +++--- SushiBar/SushiBar/ReportOrders.rdlc | 72 ++++++++++++++++++- .../BusinessLogics/ReportLogic.cs | 32 +++++---- .../OfficePackage/AbstractSaveToExcel.cs | 6 +- .../OfficePackage/AbstractSaveToPdf.cs | 6 +- .../OfficePackage/AbstractSaveToWord.cs | 7 +- .../OfficePackage/HelperModels/WordInfo.cs | 2 +- .../BusinessLogicsContracts/IReportLogic.cs | 2 +- .../ViewModels/ReportOrdersViewModel.cs | 2 + .../ReportSushiIngredientViewModel.cs | 4 +- .../Implements/OrderStorage.cs | 10 ++- .../Implements/OrderStorage.cs | 7 ++ .../Implements/OrderStorage.cs | 10 +++ 16 files changed, 181 insertions(+), 79 deletions(-) diff --git a/SushiBar/SushiBar/FormMain.Designer.cs b/SushiBar/SushiBar/FormMain.Designer.cs index 547f98f..78f1d3c 100644 --- a/SushiBar/SushiBar/FormMain.Designer.cs +++ b/SushiBar/SushiBar/FormMain.Designer.cs @@ -32,16 +32,16 @@ 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.списокИнгредиентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ингредиентыПоСушиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.buttonUpdate = new System.Windows.Forms.Button(); this.buttonSetToFinish = new System.Windows.Forms.Button(); this.buttonSetToDone = new System.Windows.Forms.Button(); this.buttonSetToWork = new System.Windows.Forms.Button(); this.buttonCreateOrder = new System.Windows.Forms.Button(); this.dataGridView = new System.Windows.Forms.DataGridView(); - 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.menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.SuspendLayout(); @@ -80,6 +80,37 @@ this.сушиToolStripMenuItem.Text = "Суши"; this.сушиToolStripMenuItem.Click += new System.EventHandler(this.SushiToolStripMenuItem_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(60, 20); + this.отчетыToolStripMenuItem.Text = "Отчеты"; + // + // списокИнгредиентовToolStripMenuItem + // + this.списокИнгредиентовToolStripMenuItem.Name = "списокИнгредиентовToolStripMenuItem"; + this.списокИнгредиентовToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.списокИнгредиентовToolStripMenuItem.Text = "Список суши"; + this.списокИнгредиентовToolStripMenuItem.Click += new System.EventHandler(this.SushiListToolStripMenuItem_Click); + // + // ингредиентыПоСушиToolStripMenuItem + // + this.ингредиентыПоСушиToolStripMenuItem.Name = "ингредиентыПоСушиToolStripMenuItem"; + this.ингредиентыПоСушиToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.ингредиентыПоСушиToolStripMenuItem.Text = "Суши с ингредиентами"; + this.ингредиентыПоСушиToolStripMenuItem.Click += new System.EventHandler(this.SushiIngredientToolStripMenuItem_Click); + // + // списокЗаказовToolStripMenuItem + // + this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; + this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.списокЗаказовToolStripMenuItem.Text = "Список заказов"; + this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click); + // // buttonUpdate // this.buttonUpdate.Location = new System.Drawing.Point(780, 314); @@ -147,37 +178,6 @@ this.dataGridView.Size = new System.Drawing.Size(755, 426); this.dataGridView.TabIndex = 7; // - // отчеты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(60, 20); - this.отчетыToolStripMenuItem.Text = "Отчеты"; - // - // списокИнгредиентовToolStripMenuItem - // - this.списокИнгредиентовToolStripMenuItem.Name = "списокИнгредиентовToolStripMenuItem"; - this.списокИнгредиентовToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.списокИнгредиентовToolStripMenuItem.Text = "Список ингредиентов"; - this.списокИнгредиентовToolStripMenuItem.Click += new System.EventHandler(this.IngredientToolStripMenuItem_Click); - // - // ингредиентыПоСушиToolStripMenuItem - // - this.ингредиентыПоСушиToolStripMenuItem.Name = "ингредиентыПоСушиToolStripMenuItem"; - this.ингредиентыПоСушиToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.ингредиентыПоСушиToolStripMenuItem.Text = "Ингредиенты по суши"; - this.ингредиентыПоСушиToolStripMenuItem.Click += new System.EventHandler(this.IngredientSushiToolStripMenuItem_Click); - // - // списокЗаказовToolStripMenuItem - // - this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; - this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.списокЗаказовToolStripMenuItem.Text = "Список заказов"; - this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click); - // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); diff --git a/SushiBar/SushiBar/FormMain.cs b/SushiBar/SushiBar/FormMain.cs index cf8724e..7ae3cf1 100644 --- a/SushiBar/SushiBar/FormMain.cs +++ b/SushiBar/SushiBar/FormMain.cs @@ -145,17 +145,17 @@ namespace SushiBarView { LoadData(); } - private void IngredientToolStripMenuItem_Click(object sender, EventArgs e) + private void SushiListToolStripMenuItem_Click(object sender, EventArgs e) { using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; if (dialog.ShowDialog() == DialogResult.OK) { - _reportLogic.SaveIngredientsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + _reportLogic.SaveListSushiToWordFile(new ReportBindingModel { FileName = dialog.FileName }); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } } - private void IngredientSushiToolStripMenuItem_Click(object sender, EventArgs e) + private void SushiIngredientToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiIngredients)); if (service is FormReportSushiIngredients form) diff --git a/SushiBar/SushiBar/FormReportSushiIngredients.cs b/SushiBar/SushiBar/FormReportSushiIngredients.cs index 33940dd..253ba78 100644 --- a/SushiBar/SushiBar/FormReportSushiIngredients.cs +++ b/SushiBar/SushiBar/FormReportSushiIngredients.cs @@ -27,8 +27,8 @@ namespace SushiBarView dataGridView.Rows.Clear(); foreach (var elem in dict) { - dataGridView.Rows.Add(new object[] { elem.IngredientName, "", "" }); - foreach (var listElem in elem.ListSushi) + dataGridView.Rows.Add(new object[] { elem.SushiName, "", "" }); + foreach (var listElem in elem.Ingredients) { dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); } diff --git a/SushiBar/SushiBar/FormReportSushiIngredients.designer.cs b/SushiBar/SushiBar/FormReportSushiIngredients.designer.cs index 239b8f4..a44a6b1 100644 --- a/SushiBar/SushiBar/FormReportSushiIngredients.designer.cs +++ b/SushiBar/SushiBar/FormReportSushiIngredients.designer.cs @@ -30,8 +30,8 @@ { this.dataGridView = new System.Windows.Forms.DataGridView(); this.buttonSaveToExcel = new System.Windows.Forms.Button(); - this.ColumnIngredient = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnSushi = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnIngredient = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.SuspendLayout(); @@ -46,8 +46,8 @@ 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.ColumnIngredient, this.ColumnSushi, + this.ColumnIngredient, this.ColumnCount}); this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom; this.dataGridView.Location = new System.Drawing.Point(0, 47); @@ -70,13 +70,6 @@ this.buttonSaveToExcel.UseVisualStyleBackColor = true; this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click); // - // ColumnIngredient - // - this.ColumnIngredient.HeaderText = "Ингредиент"; - this.ColumnIngredient.Name = "ColumnIngredient"; - this.ColumnIngredient.ReadOnly = true; - this.ColumnIngredient.Width = 200; - // // ColumnSushi // this.ColumnSushi.HeaderText = "Суши"; @@ -84,6 +77,13 @@ this.ColumnSushi.ReadOnly = true; this.ColumnSushi.Width = 200; // + // ColumnIngredient + // + this.ColumnIngredient.HeaderText = "Ингредиент"; + this.ColumnIngredient.Name = "ColumnIngredient"; + this.ColumnIngredient.ReadOnly = true; + this.ColumnIngredient.Width = 200; + // // ColumnCount // this.ColumnCount.HeaderText = "Количество"; @@ -110,8 +110,8 @@ private System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.Button buttonSaveToExcel; - private DataGridViewTextBoxColumn ColumnIngredient; private DataGridViewTextBoxColumn ColumnSushi; + private DataGridViewTextBoxColumn ColumnIngredient; private DataGridViewTextBoxColumn ColumnCount; } } \ No newline at end of file diff --git a/SushiBar/SushiBar/ReportOrders.rdlc b/SushiBar/SushiBar/ReportOrders.rdlc index 4e8c4d8..4869f28 100644 --- a/SushiBar/SushiBar/ReportOrders.rdlc +++ b/SushiBar/SushiBar/ReportOrders.rdlc @@ -29,6 +29,10 @@ SushiName System.String + + OrderStatus + System.String + Sum System.Decimal @@ -127,6 +131,9 @@ 2.5cm + + 2.5cm + @@ -228,6 +235,38 @@ + + + + true + true + + + + + Статус + + + + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -357,6 +396,36 @@ + + + + true + true + + + + + =Fields!OrderStatus.Value + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -397,6 +466,7 @@ + @@ -413,7 +483,7 @@ 2.48391cm 0.55245cm 1.2cm - 16.44755cm + 18.94755cm 2