diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj index faeeef0..eb9a45f 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj +++ b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj @@ -20,7 +20,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.Designer.cs index a788b8b..5516f67 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.Designer.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.Designer.cs @@ -28,93 +28,92 @@ /// private void InitializeComponent() { - this.panel = new System.Windows.Forms.Panel(); - this.ButtonToPdf = new System.Windows.Forms.Button(); - this.ButtonMake = new System.Windows.Forms.Button(); - this.dateTimePickerTo = new System.Windows.Forms.DateTimePicker(); - this.label2 = new System.Windows.Forms.Label(); - this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker(); - this.label1 = new System.Windows.Forms.Label(); - this.panel.SuspendLayout(); - this.SuspendLayout(); + panel = new Panel(); + ButtonToPdf = new Button(); + ButtonMake = new Button(); + dateTimePickerTo = new DateTimePicker(); + label2 = new Label(); + dateTimePickerFrom = new DateTimePicker(); + label1 = new Label(); + panel.SuspendLayout(); + SuspendLayout(); // // panel // - this.panel.Controls.Add(this.ButtonToPdf); - this.panel.Controls.Add(this.ButtonMake); - this.panel.Controls.Add(this.dateTimePickerTo); - this.panel.Controls.Add(this.label2); - this.panel.Controls.Add(this.dateTimePickerFrom); - this.panel.Controls.Add(this.label1); - this.panel.Location = new System.Drawing.Point(0, 2); - this.panel.Name = "panel"; - this.panel.Size = new System.Drawing.Size(932, 42); - this.panel.TabIndex = 0; + panel.Controls.Add(ButtonToPdf); + panel.Controls.Add(ButtonMake); + panel.Controls.Add(dateTimePickerTo); + panel.Controls.Add(label2); + panel.Controls.Add(dateTimePickerFrom); + panel.Controls.Add(label1); + panel.Location = new Point(-6, 2); + panel.Name = "panel"; + panel.Size = new Size(943, 42); + panel.TabIndex = 0; // // ButtonToPdf // - this.ButtonToPdf.Location = new System.Drawing.Point(829, 8); - this.ButtonToPdf.Name = "ButtonToPdf"; - this.ButtonToPdf.Size = new System.Drawing.Size(94, 29); - this.ButtonToPdf.TabIndex = 5; - this.ButtonToPdf.Text = "в PDF"; - this.ButtonToPdf.UseVisualStyleBackColor = true; - this.ButtonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click); + ButtonToPdf.Location = new Point(829, 8); + ButtonToPdf.Name = "ButtonToPdf"; + ButtonToPdf.Size = new Size(94, 29); + ButtonToPdf.TabIndex = 5; + ButtonToPdf.Text = "в PDF"; + ButtonToPdf.UseVisualStyleBackColor = true; + ButtonToPdf.Click += ButtonToPdf_Click; // // ButtonMake // - this.ButtonMake.Location = new System.Drawing.Point(550, 8); - this.ButtonMake.Name = "ButtonMake"; - this.ButtonMake.Size = new System.Drawing.Size(128, 29); - this.ButtonMake.TabIndex = 4; - this.ButtonMake.Text = "Сформировать"; - this.ButtonMake.UseVisualStyleBackColor = true; - this.ButtonMake.Click += new System.EventHandler(this.ButtonMake_Click); + ButtonMake.Location = new Point(550, 8); + ButtonMake.Name = "ButtonMake"; + ButtonMake.Size = new Size(128, 29); + ButtonMake.TabIndex = 4; + ButtonMake.Text = "Сформировать"; + ButtonMake.UseVisualStyleBackColor = true; + ButtonMake.Click += ButtonMake_Click; // // dateTimePickerTo // - this.dateTimePickerTo.Location = new System.Drawing.Point(269, 10); - this.dateTimePickerTo.Name = "dateTimePickerTo"; - this.dateTimePickerTo.Size = new System.Drawing.Size(250, 27); - this.dateTimePickerTo.TabIndex = 3; + dateTimePickerTo.Location = new Point(269, 10); + dateTimePickerTo.Name = "dateTimePickerTo"; + dateTimePickerTo.Size = new Size(250, 27); + dateTimePickerTo.TabIndex = 3; // // label2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(236, 12); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(27, 20); - this.label2.TabIndex = 2; - this.label2.Text = "по"; + label2.AutoSize = true; + label2.Location = new Point(236, 12); + label2.Name = "label2"; + label2.Size = new Size(27, 20); + label2.TabIndex = 2; + label2.Text = "по"; // // dateTimePickerFrom // - this.dateTimePickerFrom.Location = new System.Drawing.Point(42, 10); - this.dateTimePickerFrom.Name = "dateTimePickerFrom"; - this.dateTimePickerFrom.Size = new System.Drawing.Size(188, 27); - this.dateTimePickerFrom.TabIndex = 1; + dateTimePickerFrom.Location = new Point(42, 10); + dateTimePickerFrom.Name = "dateTimePickerFrom"; + dateTimePickerFrom.Size = new Size(188, 27); + dateTimePickerFrom.TabIndex = 1; // // label1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(20, 12); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(16, 20); - this.label1.TabIndex = 0; - this.label1.Text = "с"; + label1.AutoSize = true; + label1.Location = new Point(20, 12); + label1.Name = "label1"; + label1.Size = new Size(16, 20); + label1.TabIndex = 0; + label1.Text = "с"; // // FormReportOrders // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(935, 450); - this.Controls.Add(this.panel); - this.Name = "FormReportOrders"; - this.Text = "FormReportOrders"; - this.panel.ResumeLayout(false); - this.panel.PerformLayout(); - this.ResumeLayout(false); - + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(938, 450); + Controls.Add(panel); + Name = "FormReportOrders"; + Text = "FormReportOrders"; + panel.ResumeLayout(false); + panel.PerformLayout(); + ResumeLayout(false); } #endregion diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs index fd7ffda..5eff4a4 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportOrders.cs @@ -30,10 +30,11 @@ namespace BlacksmithWorkshop Dock = DockStyle.Fill }; reportViewer.LocalReport.LoadReportDefinition(new - FileStream("C:\\Users\\User\\source\\repos\\BlacksmithWorkshop\\BlacksmithWorkshop\\BlacksmithWorkshop\\ReportOrders.rdlc", FileMode.Open)); + FileStream("C:\\Users\\User\\source\\repos\\BlacksmithWorkshop\\BlacksmithWorkshop\\BlacksmithWorkshop\\ReportOrders.rdlc", FileMode.Open)); Controls.Clear(); - Controls.Add(reportViewer); Controls.Add(panel); + Controls.Add(reportViewer); + } private void ButtonMake_Click(object sender, EventArgs e) @@ -51,13 +52,16 @@ namespace BlacksmithWorkshop DateFrom = dateTimePickerFrom.Value, DateTo = dateTimePickerTo.Value }); + 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()}") }; reportViewer.LocalReport.SetParameters(parameters); + 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()); + } catch (Exception ex) { @@ -99,12 +103,12 @@ namespace BlacksmithWorkshop catch (Exception ex) { _logger.LogError(ex, "Ошибка сохранения списка заказов на период"); - + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - } + + } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc index 3093666..17dc45d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc @@ -1,6 +1,50 @@ 0 + + + + System.Data.DataSet + /* Local Connection */ + + 605c80d0-7d6c-4474-934b-337c1a3114c7 + + + + + + BlacksmithWorkshopContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + DateCreate + System.DateTime + + + ManufactureName + System.String + + + Sum + System.Decimal + + + OrderStatus + BlacksmithWorkshopDataModels.OrderStatus + + + + BlacksmithWorkshopContracts.ViewModels + ReportOrdersViewModel + BlacksmithWorkshopContracts.ViewModels.ReportOrdersViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + @@ -12,9 +56,8 @@ - Заказ + Заказы @@ -26,7 +69,8 @@ Textbox1 - 0.84553cm + 0.61383cm + 1.03603cm 16.51cm + + + + + + 1.73518cm + + + 3.66134cm + + + 3.87301cm + + + 2.5cm + + + 2.5cm + + + + + 0.76214cm + + + + + 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.76214cm + + + + + 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!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!OrderStatus.Value + + + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.86342cm + 2.26483cm + 1.52428cm + 14.26953cm + 2 + + + + + + true + true + + + + + Итого + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + 2pt + 2pt + 2pt + 2pt + + - 2in + 2.75in