diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs index e6e53d4..87b354b 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs @@ -31,10 +31,6 @@ 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.labelTo = new System.Windows.Forms.Label(); - this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker(); - this.labelFrom = new System.Windows.Forms.Label(); this.panel.SuspendLayout(); this.SuspendLayout(); // @@ -42,24 +38,20 @@ // this.panel.Controls.Add(this.buttonToPdf); this.panel.Controls.Add(this.buttonMake); - this.panel.Controls.Add(this.dateTimePickerTo); - this.panel.Controls.Add(this.labelTo); - this.panel.Controls.Add(this.dateTimePickerFrom); - this.panel.Controls.Add(this.labelFrom); this.panel.Dock = System.Windows.Forms.DockStyle.Top; this.panel.Location = new System.Drawing.Point(0, 0); - this.panel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.panel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.panel.Name = "panel"; - this.panel.Size = new System.Drawing.Size(1031, 40); + this.panel.Size = new System.Drawing.Size(1178, 53); this.panel.TabIndex = 0; // // buttonToPdf // this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonToPdf.Location = new System.Drawing.Point(878, 8); - this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.buttonToPdf.Location = new System.Drawing.Point(1003, 11); + this.buttonToPdf.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.buttonToPdf.Name = "buttonToPdf"; - this.buttonToPdf.Size = new System.Drawing.Size(139, 27); + this.buttonToPdf.Size = new System.Drawing.Size(159, 36); this.buttonToPdf.TabIndex = 5; this.buttonToPdf.Text = "В Pdf"; this.buttonToPdf.UseVisualStyleBackColor = true; @@ -67,63 +59,26 @@ // // buttonMake // - this.buttonMake.Location = new System.Drawing.Point(476, 8); - this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.buttonMake.Location = new System.Drawing.Point(544, 11); + this.buttonMake.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); this.buttonMake.Name = "buttonMake"; - this.buttonMake.Size = new System.Drawing.Size(139, 27); + this.buttonMake.Size = new System.Drawing.Size(159, 36); this.buttonMake.TabIndex = 4; this.buttonMake.Text = "Сформировать"; this.buttonMake.UseVisualStyleBackColor = true; this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click); // - // dateTimePickerTo + // FormReportGroupOrders // - this.dateTimePickerTo.Location = new System.Drawing.Point(237, 7); - this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.dateTimePickerTo.Name = "dateTimePickerTo"; - this.dateTimePickerTo.Size = new System.Drawing.Size(163, 23); - this.dateTimePickerTo.TabIndex = 3; - // - // labelTo - // - this.labelTo.AutoSize = true; - this.labelTo.Location = new System.Drawing.Point(208, 10); - this.labelTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.labelTo.Name = "labelTo"; - this.labelTo.Size = new System.Drawing.Size(21, 15); - this.labelTo.TabIndex = 2; - this.labelTo.Text = "по"; - // - // dateTimePickerFrom - // - this.dateTimePickerFrom.Location = new System.Drawing.Point(37, 7); - this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.dateTimePickerFrom.Name = "dateTimePickerFrom"; - this.dateTimePickerFrom.Size = new System.Drawing.Size(163, 23); - this.dateTimePickerFrom.TabIndex = 1; - // - // labelFrom - // - this.labelFrom.AutoSize = true; - this.labelFrom.Location = new System.Drawing.Point(14, 10); - this.labelFrom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.labelFrom.Name = "labelFrom"; - this.labelFrom.Size = new System.Drawing.Size(15, 15); - this.labelFrom.TabIndex = 0; - this.labelFrom.Text = "С"; - // - // FormReportOrders - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1031, 647); + this.ClientSize = new System.Drawing.Size(1178, 863); this.Controls.Add(this.panel); - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.Name = "FormReportOrders"; + this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4); + this.Name = "FormReportGroupOrders"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Заказы"; this.panel.ResumeLayout(false); - this.panel.PerformLayout(); this.ResumeLayout(false); } @@ -133,9 +88,5 @@ private System.Windows.Forms.Panel panel; private System.Windows.Forms.Button buttonToPdf; private System.Windows.Forms.Button buttonMake; - private System.Windows.Forms.DateTimePicker dateTimePickerTo; - private System.Windows.Forms.Label labelTo; - private System.Windows.Forms.DateTimePicker dateTimePickerFrom; - private System.Windows.Forms.Label labelFrom; } } \ No newline at end of file diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs index b79c648..69c2bac 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs @@ -30,27 +30,14 @@ namespace PrecastConcretePlant private void ButtonMake_Click(object sender, EventArgs e) { - if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) - { - MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } try { - var dataSource = _logic.GetGroupOrders(new ReportBindingModel - { - DateFrom = dateTimePickerFrom.Value, - DateTo = dateTimePickerTo.Value - }); + var dataSource = _logic.GetGroupOrders(); 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); - reportViewer.RefreshReport(); - _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); + _logger.LogInformation("Загрузка списка заказов на весь период по датам"); } catch (Exception ex) { @@ -61,23 +48,16 @@ namespace PrecastConcretePlant private void ButtonToPdf_Click(object sender, EventArgs e) { - if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) - { - MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; if (dialog.ShowDialog() == DialogResult.OK) { try { - _logic.SaveOrdersToPdfFile(new ReportBindingModel + _logic.SaveGroupOrdersToPdfFile(new ReportBindingModel { - FileName = dialog.FileName, - DateFrom = dateTimePickerFrom.Value, - DateTo = dateTimePickerTo.Value + FileName = dialog.FileName }); - _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); + _logger.LogInformation("Сохранение списка заказов на весь период по датам"); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx index 1af7de1..f298a7b 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx @@ -1,64 +1,4 @@ - - - + diff --git a/PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc b/PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc new file mode 100644 index 0000000..5977266 --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc @@ -0,0 +1,463 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 10791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + ConfectioneryContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + Date + System.DateTime + + + Count + System.Int32 + + + Sum + System.Double + + + + ConfectioneryContracts.ViewModels + ReportOrdersViewModel + ConfectioneryContracts.ViewModels.ReportOrdersViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + true + true + + + + + =Parameters!ReportParameterPeriod.Value + + + + + + + ReportParameterPeriod + 1cm + 1cm + 12.40104cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Заказы + + + + + + + 1cm + 12.40104cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 3.21438cm + + + 3.53188cm + + + 4.35209cm + + + + + 0.6cm + + + + + true + true + + + + + Дата создания + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Количество заказов + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Сумма + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!Date.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Count.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.2cm + 11.09835cm + 2 + + + + + + true + true + + + + + Итого: + + + + + + + 4cm + 6.6508cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4cm + 9.1508cm + 0.6cm + 2.5cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.72875cm +