From dd98a1a7498b9faaaff9df63f22661dbd9894ff8 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Thu, 4 Apr 2024 12:22:03 +0400
Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=81=D1=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FormReportDateOrders.Designer.cs | 2 +
ProjectFlowerShop/FormReportDateOrders.cs | 40 ++
.../FormReportShopsFlowers.Designer.cs | 32 +-
ProjectFlowerShop/FormReportShopsFlowers.resx | 9 +
ProjectFlowerShop/Program.cs | 2 +
ProjectFlowerShop/ReportOrdersByDate.rdlc | 400 ++++++++++++++++++
6 files changed, 483 insertions(+), 2 deletions(-)
create mode 100644 ProjectFlowerShop/ReportOrdersByDate.rdlc
diff --git a/ProjectFlowerShop/FormReportDateOrders.Designer.cs b/ProjectFlowerShop/FormReportDateOrders.Designer.cs
index 4880986..855a554 100644
--- a/ProjectFlowerShop/FormReportDateOrders.Designer.cs
+++ b/ProjectFlowerShop/FormReportDateOrders.Designer.cs
@@ -41,6 +41,7 @@
buttonCreate.TabIndex = 0;
buttonCreate.Text = "Сформировать";
buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += buttonCreate_Click;
//
// buttonSaveToPdf
//
@@ -50,6 +51,7 @@
buttonSaveToPdf.TabIndex = 1;
buttonSaveToPdf.Text = "В Pdf";
buttonSaveToPdf.UseVisualStyleBackColor = true;
+ buttonSaveToPdf.Click += buttonSaveToPdf_Click;
//
// panel
//
diff --git a/ProjectFlowerShop/FormReportDateOrders.cs b/ProjectFlowerShop/FormReportDateOrders.cs
index fc01280..0a92bc5 100644
--- a/ProjectFlowerShop/FormReportDateOrders.cs
+++ b/ProjectFlowerShop/FormReportDateOrders.cs
@@ -1,6 +1,8 @@
using FlowerShopContracts.BusinessLogicsContracts;
using Microsoft.Reporting.WinForms;
using Microsoft.Extensions.Logging;
+using FlowerShopContracts.BindingModels;
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -34,6 +36,44 @@ namespace ProjectFlowerShop
panel.Controls.Add(reportViewer);
}
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var dataSource = _logic.GetDatesOrders();
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов на весь период по датам");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ private void buttonSaveToPdf_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveDatesOrdersToPdfFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ _logger.LogInformation("Сохранение списка заказов на весь период по датам");
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
}
}
diff --git a/ProjectFlowerShop/FormReportShopsFlowers.Designer.cs b/ProjectFlowerShop/FormReportShopsFlowers.Designer.cs
index 176581a..32ca074 100644
--- a/ProjectFlowerShop/FormReportShopsFlowers.Designer.cs
+++ b/ProjectFlowerShop/FormReportShopsFlowers.Designer.cs
@@ -30,6 +30,9 @@
{
buttonSaveToExcel = new Button();
dataGridView = new DataGridView();
+ Shop = new DataGridViewTextBoxColumn();
+ Flower = new DataGridViewTextBoxColumn();
+ Count = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
@@ -46,18 +49,40 @@
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { Shop, Flower, Count });
dataGridView.Location = new Point(12, 67);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
- dataGridView.Size = new Size(742, 327);
+ dataGridView.Size = new Size(808, 327);
dataGridView.TabIndex = 1;
//
+ // Shop
+ //
+ Shop.HeaderText = "Магазин";
+ Shop.MinimumWidth = 6;
+ Shop.Name = "Shop";
+ Shop.Width = 250;
+ //
+ // Flower
+ //
+ Flower.HeaderText = "Цветок";
+ Flower.MinimumWidth = 6;
+ Flower.Name = "Flower";
+ Flower.Width = 250;
+ //
+ // Count
+ //
+ Count.HeaderText = "Количество";
+ Count.MinimumWidth = 6;
+ Count.Name = "Count";
+ Count.Width = 250;
+ //
// FormReportShopsFlowers
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(766, 406);
+ ClientSize = new Size(832, 406);
Controls.Add(dataGridView);
Controls.Add(buttonSaveToExcel);
Name = "FormReportShopsFlowers";
@@ -71,5 +96,8 @@
private Button buttonSaveToExcel;
private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn Shop;
+ private DataGridViewTextBoxColumn Flower;
+ private DataGridViewTextBoxColumn Count;
}
}
\ No newline at end of file
diff --git a/ProjectFlowerShop/FormReportShopsFlowers.resx b/ProjectFlowerShop/FormReportShopsFlowers.resx
index af32865..f2dfbb2 100644
--- a/ProjectFlowerShop/FormReportShopsFlowers.resx
+++ b/ProjectFlowerShop/FormReportShopsFlowers.resx
@@ -117,4 +117,13 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ True
+
+
+ True
+
+
+ True
+
\ No newline at end of file
diff --git a/ProjectFlowerShop/Program.cs b/ProjectFlowerShop/Program.cs
index 055b0e3..25b9309 100644
--- a/ProjectFlowerShop/Program.cs
+++ b/ProjectFlowerShop/Program.cs
@@ -58,6 +58,8 @@ namespace ProjectFlowerShop
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/ProjectFlowerShop/ReportOrdersByDate.rdlc b/ProjectFlowerShop/ReportOrdersByDate.rdlc
new file mode 100644
index 0000000..e405faf
--- /dev/null
+++ b/ProjectFlowerShop/ReportOrdersByDate.rdlc
@@ -0,0 +1,400 @@
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Заказы
+
+
+
+
+
+
+ 0.24cm
+ 1cm
+ 21cm
+
+
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+ 3cm
+
+
+ 3cm
+
+
+ 7cm
+
+
+
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+ Дата
+
+
+
+
+
+
+ Textbox1
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Количество
+
+
+
+
+
+
+ Textbox3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Сумма
+
+
+
+
+
+
+ Textbox2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ 0.6cm
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!DateOfOrders.Value
+
+
+
+
+
+
+ DateOfOrders
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Count.Value
+
+
+
+
+
+
+ Count
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!Sum.Value
+
+
+
+
+
+
+ Sum
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ After
+
+
+
+
+
+
+ DataSetOrders
+ 2.72391cm
+ 0.55245cm
+ 1.2cm
+ 13cm
+ 1
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Всего:
+
+
+
+
+
+
+ 4.24cm
+ 8.55245cm
+ 0.6cm
+ 2.5cm
+ 2
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!Sum.Value, "DataSetOrders")
+
+
+
+
+
+
+ 4.24cm
+ 11.05245cm
+ 0.6cm
+ 2.5cm
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 2in
+
+
+ 8.26772in
+
+ 29.7cm
+ 21cm
+ 2cm
+ 2cm
+ 2cm
+ 2cm
+ 0.13cm
+
+
+ 0
+
+
+
+ System.Data.DataSet
+ /* Local Connection */
+
+
+
+
+
+
+ FlowerShopContractsViewModels
+ /* Local Query */
+
+
+
+ DateOfOrders
+ System.DateTime
+
+
+ Count
+ System.Decimal
+
+
+ Sum
+ System.Double
+
+
+
+ FlowerShopContracts.ViewModels
+ ReportDateOrdersViewModel
+ FlowerShopContracts.ViewModels.ReportDateOrdersViewModel, FlowerShopContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
+
+
+ Cm
+ cd561cee-f04c-45db-850e-4c793555accd
+