From b47fccbd24e6a29ae5e6b8ea24082e18d39ef13d Mon Sep 17 00:00:00 2001 From: bekodeg Date: Wed, 24 Apr 2024 16:41:39 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D1=83=20word=20=D0=B8=20exel=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/FormReportOrders.Designer.cs | 10 ++++++++++ .../SushiBar/Forms/FormReportOrdersLogic.cs | 17 +++++++++++------ .../Forms/FormReportSushiComponentsLogic.cs | 16 +++++++++++----- SushiBar/SushiBar/Report/ReportOrders.rdlc | 18 +++++++++--------- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs b/SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs index 8b51318..4308d29 100644 --- a/SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs +++ b/SushiBar/SushiBar/Forms/FormReportOrders.Designer.cs @@ -35,6 +35,7 @@ dateTimePickerFrom = new DateTimePicker(); buttonToPdf = new Button(); buttonMake = new Button(); + panelBody = new Panel(); panel.SuspendLayout(); SuspendLayout(); // @@ -104,11 +105,19 @@ buttonMake.UseVisualStyleBackColor = true; buttonMake.Click += buttonMake_Click; // + // panelBody + // + panelBody.Location = new Point(0, 57); + panelBody.Name = "panelBody"; + panelBody.Size = new Size(800, 393); + panelBody.TabIndex = 1; + // // FormReportOrders // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(800, 450); + Controls.Add(panelBody); Controls.Add(panel); Name = "FormReportOrders"; Text = "FormReportOrders"; @@ -126,5 +135,6 @@ private DateTimePicker dateTimePickerFrom; private Label label1; private Label label2; + private Panel panelBody; } } \ No newline at end of file diff --git a/SushiBar/SushiBar/Forms/FormReportOrdersLogic.cs b/SushiBar/SushiBar/Forms/FormReportOrdersLogic.cs index 0f49af3..65f1693 100644 --- a/SushiBar/SushiBar/Forms/FormReportOrdersLogic.cs +++ b/SushiBar/SushiBar/Forms/FormReportOrdersLogic.cs @@ -20,10 +20,9 @@ namespace SushiBar.Forms { Dock = DockStyle.Fill }; - reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); - Controls.Clear(); - Controls.Add(reportViewer); - Controls.Add(panel); + reportViewer.LocalReport.LoadReportDefinition( + new FileStream("Report/ReportOrders.rdlc", FileMode.Open)); + panelBody.Controls.Add(reportViewer); } private void ButtonMake_Click(object sender, EventArgs e) { @@ -43,10 +42,15 @@ namespace SushiBar.Forms var source = new ReportDataSource("DataSetOrders", dataSource); reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(source); - var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c{dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") }; + var parameters = new[] { + new ReportParameter("ReportParameterPeriod", + $"c{dateTimePickerFrom.Value.ToShortDateString()} по" + + $" {dateTimePickerTo.Value.ToShortDateString()}") }; reportViewer.LocalReport.SetParameters(parameters); reportViewer.RefreshReport(); - _logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); + _logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", + dateTimePickerFrom.Value.ToShortDateString(), + dateTimePickerTo.Value.ToShortDateString()); } catch (Exception ex) { @@ -69,6 +73,7 @@ namespace SushiBar.Forms { try { + System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); _logic.SaveOrdersToPdfFile(new ReportBindingModel { FileName = dialog.FileName, diff --git a/SushiBar/SushiBar/Forms/FormReportSushiComponentsLogic.cs b/SushiBar/SushiBar/Forms/FormReportSushiComponentsLogic.cs index 16f3951..7ec0539 100644 --- a/SushiBar/SushiBar/Forms/FormReportSushiComponentsLogic.cs +++ b/SushiBar/SushiBar/Forms/FormReportSushiComponentsLogic.cs @@ -26,16 +26,22 @@ namespace SushiBar.Forms dataGridView.Rows.Clear(); foreach (var elem in dict) { - dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" }); - foreach (var listElem in elem.Sushis) + dataGridView.Rows.Add(new object[] { + elem.SushiName, "", "" + }); + foreach (var listElem in elem.Components) { - dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); + dataGridView.Rows.Add(new object[] { + "", listElem.Item1, listElem.Item2 + }); } - dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount }); + dataGridView.Rows.Add(new object[] { + "Итого", "", elem.TotalCount + }); dataGridView.Rows.Add(Array.Empty()); } } - _logger.LogInformation("Загрузка списка изделий по компонентам"); + _logger.LogInformation("Загрузка списка суши по компонентам"); } catch (Exception ex) { diff --git a/SushiBar/SushiBar/Report/ReportOrders.rdlc b/SushiBar/SushiBar/Report/ReportOrders.rdlc index 98fd84d..60f5afb 100644 --- a/SushiBar/SushiBar/Report/ReportOrders.rdlc +++ b/SushiBar/SushiBar/Report/ReportOrders.rdlc @@ -2,7 +2,7 @@ 0 - + System.Data.DataSet /* Local Connection */ @@ -13,7 +13,7 @@ - FishFactoryContractsViewModels + SushiBarContractsViewModels /* Local Query */ @@ -25,8 +25,8 @@ DateCreate System.DateTime - - CannedName + + SushiName System.String @@ -35,13 +35,13 @@ OrderStatus - FishFactoryDataModels.OrderStatus + SushiBarDataModels.OrderStatus - FishFactoryContracts.ViewModels + SushiBarContracts.ViewModels ReportOrderViewModel - FishFactoryContracts.ViewModels.ReportOrderViewModel, FishFactoryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + SushiBarContracts.ViewModels.ReportOrderViewModel, SushiBarContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null @@ -368,7 +368,7 @@ - + true true @@ -382,7 +382,7 @@