diff --git a/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
index 849bbff..25c1e5c 100644
--- a/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
+++ b/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
@@ -214,6 +214,7 @@
this.OrderDateToolStripMenuItem.Name = "OrderDateToolStripMenuItem";
this.OrderDateToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
this.OrderDateToolStripMenuItem.Text = "Список заказов по датам";
+ this.OrderDateToolStripMenuItem.Click += new System.EventHandler(this.OrderDateToolStripMenuItem_Click);
//
// buttonSell
//
diff --git a/FurnitureAssembly/FurnitureAssembly/FormMain.cs b/FurnitureAssembly/FurnitureAssembly/FormMain.cs
index 14d6c1d..aff2407 100644
--- a/FurnitureAssembly/FurnitureAssembly/FormMain.cs
+++ b/FurnitureAssembly/FurnitureAssembly/FormMain.cs
@@ -243,5 +243,14 @@ namespace FurnitureAssembly
form.ShowDialog();
}
}
+
+ private void OrderDateToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportCountOrdersByPeriod));
+ if (service is FormReportCountOrdersByPeriod form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.Designer.cs
new file mode 100644
index 0000000..cf6cc18
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.Designer.cs
@@ -0,0 +1,167 @@
+namespace FurnitureAssembly
+{
+ partial class FormReportCountOrdersByPeriod
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.panel = new System.Windows.Forms.Panel();
+ this.buttonMake_Pdf = new System.Windows.Forms.Button();
+ this.button1 = new System.Windows.Forms.Button();
+ 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();
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.buttonMake_Pdf);
+ this.panel.Controls.Add(this.button1);
+ 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.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(987, 40);
+ this.panel.TabIndex = 2;
+ //
+ // buttonMake_Pdf
+ //
+ this.buttonMake_Pdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonMake_Pdf.Location = new System.Drawing.Point(826, 8);
+ this.buttonMake_Pdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonMake_Pdf.Name = "buttonMake_Pdf";
+ this.buttonMake_Pdf.Size = new System.Drawing.Size(139, 27);
+ this.buttonMake_Pdf.TabIndex = 7;
+ this.buttonMake_Pdf.Text = "В Pdf";
+ this.buttonMake_Pdf.UseVisualStyleBackColor = true;
+ this.buttonMake_Pdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
+ //
+ // button1
+ //
+ this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.button1.Location = new System.Drawing.Point(1564, 8);
+ this.button1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(139, 27);
+ this.button1.TabIndex = 6;
+ this.button1.Text = "В Pdf";
+ this.button1.UseVisualStyleBackColor = true;
+ //
+ // 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(2452, 8);
+ this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonToPdf.Name = "buttonToPdf";
+ this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
+ this.buttonToPdf.TabIndex = 5;
+ this.buttonToPdf.Text = "В Pdf";
+ this.buttonToPdf.UseVisualStyleBackColor = true;
+ //
+ // buttonMake
+ //
+ this.buttonMake.Location = new System.Drawing.Point(476, 8);
+ this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.buttonMake.Name = "buttonMake";
+ this.buttonMake.Size = new System.Drawing.Size(139, 27);
+ this.buttonMake.TabIndex = 4;
+ this.buttonMake.Text = "Сформировать";
+ this.buttonMake.UseVisualStyleBackColor = true;
+ this.buttonMake.Click += new System.EventHandler(this.buttonMake_Click);
+ //
+ // dateTimePickerTo
+ //
+ 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 = "С";
+ //
+ // FormReportCountOrdersByPeriod
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(987, 596);
+ this.Controls.Add(this.panel);
+ this.Name = "FormReportCountOrdersByPeriod";
+ this.Text = "Заказы по датам";
+ this.panel.ResumeLayout(false);
+ this.panel.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Panel panel;
+ private Button button1;
+ private Button buttonToPdf;
+ private Button buttonMake;
+ private DateTimePicker dateTimePickerTo;
+ private Label labelTo;
+ private DateTimePicker dateTimePickerFrom;
+ private Label labelFrom;
+ private Button buttonMake_Pdf;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.cs b/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.cs
new file mode 100644
index 0000000..b432798
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.cs
@@ -0,0 +1,100 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace FurnitureAssembly
+{
+ public partial class FormReportCountOrdersByPeriod : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportCountOrdersByPeriod(ILogger logger, IReportLogic reportLogic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = reportLogic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrdersCount.rdlc", FileMode.Open)); // другой файл
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ 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.GetCountOrders(new ReportBindingModel
+ {
+ 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);
+
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ 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.SaveCountOrdersToPdfFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName,
+ DateFrom = dateTimePickerFrom.Value,
+ DateTo = dateTimePickerTo.Value
+ });
+ _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.resx b/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormReportCountOrdersByPeriod.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj b/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj
index 7eb04fa..71f961d 100644
--- a/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj
+++ b/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj
@@ -11,6 +11,7 @@
+
@@ -20,6 +21,9 @@
Always
+
+ Always
+
diff --git a/FurnitureAssembly/FurnitureAssembly/Program.cs b/FurnitureAssembly/FurnitureAssembly/Program.cs
index 7044ee0..8382cfb 100644
--- a/FurnitureAssembly/FurnitureAssembly/Program.cs
+++ b/FurnitureAssembly/FurnitureAssembly/Program.cs
@@ -65,6 +65,7 @@ namespace FurnitureAssembly
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/ReportOrdersCount.rdlc b/FurnitureAssembly/FurnitureAssembly/ReportOrdersCount.rdlc
new file mode 100644
index 0000000..73d8265
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/ReportOrdersCount.rdlc
@@ -0,0 +1,459 @@
+
+
+ 0
+
+
+
+ System.Data.DataSet
+ /* Local Connection */
+
+ 10791c83-cee8-4a38-bbd0-245fc17cefb3
+
+
+
+
+
+ FurnitureAssemblyContractsViewModels
+ /* Local Query */
+
+
+
+ DateCreate
+ System.DateTime
+
+
+ CountOrders
+ System.Decimal
+
+
+ TotalSumOrders
+ System.Double
+
+
+
+ FurnitureAssemblyContracts.ViewModels
+ ReportCountOrdersViewModel
+ FurnitureAssemblyContracts.ViewModels.ReportCountOrdersViewModel, FurnitureAssemblyContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Parameters!ReportParameterPeriod.Value
+
+
+
+
+
+
+ ReportParameterPeriod
+ 1cm
+ 1cm
+ 21cm
+
+
+ Middle
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ Заказы
+
+
+
+
+
+
+ 1cm
+ 21cm
+ 1
+
+
+ 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!DateCreate.Value
+
+
+
+
+
+
+ DateCreate
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!CountOrders.Value
+
+
+
+
+
+
+ CountOrders
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+ =Fields!TotalSumOrders.Value
+
+
+
+
+
+
+ TotalSumOrders
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ After
+
+
+
+
+
+
+ DataSetOrders
+ 2.48391cm
+ 0.55245cm
+ 1.2cm
+ 19.84713cm
+ 2
+
+
+
+
+
+ true
+ true
+
+
+
+
+ Итого:
+
+
+
+
+
+
+ 4cm
+ 15.39958cm
+ 0.6cm
+ 2.5cm
+ 3
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ true
+ true
+
+
+
+
+ =Sum(Fields!TotalSumOrders.Value, "DataSetOrders")
+
+
+
+
+
+
+ 4cm
+ 17.89958cm
+ 0.6cm
+ 2.5cm
+ 4
+
+
+ 2pt
+ 2pt
+ 2pt
+ 2pt
+
+
+
+ 5.72875cm
+
+
+ 21cm
+
+ 29.7cm
+ 21cm
+ 2cm
+ 2cm
+ 2cm
+ 2cm
+ 0.13cm
+
+
+
+
+
+
+ String
+ true
+ ReportParameter1
+
+
+
+
+ 4
+ 2
+
+
+ 0
+ 0
+ ReportParameterPeriod
+
+
+
+
+ Cm
+ 2de0031a-4d17-449d-922d-d9fc54572312
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
index e1ae738..668dca4 100644
--- a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs
@@ -1,4 +1,5 @@
-using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
+using DocumentFormat.OpenXml.EMMA;
+using FurnitureAssemblyBusinessLogic.OfficePackage.HelperEnums;
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
using System;
using System.Collections.Generic;
@@ -24,6 +25,41 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
+ if (info is PdfInfoOrders infoOrders)
+ {
+ CreateDocOrders(infoOrders);
+ } else if (info is PdfInfoCountOrders countOrders)
+ {
+ CreateDocCountOrders(countOrders);
+ }
+ /* CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "3cm" });
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { "Номер", "Дата заказа", "Изделие", "Статус", "Сумма" },
+ Style = "NormalTitle",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+ foreach (var order in info.Orders)
+ {
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.FurnitureName, order.OrderStatus, order.Sum.ToString() },
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Left
+ });
+ }
+ CreateParagraph(new PdfParagraph
+ {
+ Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
+ Style = "Normal",
+ ParagraphAlignment =
+ PdfParagraphAlignmentType.Right
+ });*/
+ SavePdf(info);
+ }
+
+ private void CreateDocOrders(PdfInfoOrders info)
+ {
CreateTable(new List { "2cm", "3cm", "6cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
@@ -47,7 +83,33 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
ParagraphAlignment =
PdfParagraphAlignmentType.Right
});
- SavePdf(info);
+ }
+
+ private void CreateDocCountOrders(PdfInfoCountOrders info)
+ {
+ CreateTable(new List { "3cm", "3cm", "7cm"});
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { "Дата заказа", "Количество заказов", "Сумма" },
+ Style = "NormalTitle",
+ ParagraphAlignment = PdfParagraphAlignmentType.Center
+ });
+ foreach (var order in info.CountOrders)
+ {
+ CreateRow(new PdfRowParameters
+ {
+ Texts = new List { order.DateCreate.ToShortDateString(), order.CountOrders.ToString(), order.TotalSumOrders.ToString()},
+ Style = "Normal",
+ ParagraphAlignment = PdfParagraphAlignmentType.Left
+ });
+ }
+ CreateParagraph(new PdfParagraph
+ {
+ Text = $"Итого: {info.CountOrders.Sum(x => x.TotalSumOrders)}\t",
+ Style = "Normal",
+ ParagraphAlignment =
+ PdfParagraphAlignmentType.Right
+ });
}
///
/// Создание doc-файла
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
index 6a2b102..e62fd2f 100644
--- a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs
@@ -9,6 +9,5 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
public string Title { get; set; } = string.Empty;
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
- public List Orders { get; set; } = new();
}
}
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfoCountOrders.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfoCountOrders.cs
new file mode 100644
index 0000000..235c8d4
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfoCountOrders.cs
@@ -0,0 +1,14 @@
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
+{
+ public class PdfInfoCountOrders : PdfInfo
+ {
+ public List CountOrders { get; set; } = new();
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfoOrders.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfoOrders.cs
new file mode 100644
index 0000000..0853cfa
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OfficePackage/HelperModels/PdfInfoOrders.cs
@@ -0,0 +1,14 @@
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels
+{
+ public class PdfInfoOrders : PdfInfo
+ {
+ public List Orders { get; set; } = new();
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs
index 9f11769..d70e3f5 100644
--- a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs
@@ -110,7 +110,7 @@ namespace FurnitureAssemblyBusinessLogic
///
public void SaveOrdersToPdfFile(ReportBindingModel model)
{
- _saveToPdf.CreateDoc(new PdfInfo
+ _saveToPdf.CreateDoc(new PdfInfoOrders
{
FileName = model.FileName,
Title = "Список заказов",
@@ -164,5 +164,26 @@ namespace FurnitureAssemblyBusinessLogic
}
return list;
}
+
+ public List GetCountOrders(ReportBindingModel model)
+ {
+ return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportCountOrdersViewModel
+ {
+ DateCreate = x.Key,
+ CountOrders = x.Count(),
+ TotalSumOrders = x.Sum(y => y.Sum)
+ }).ToList();
+ }
+ public void SaveCountOrdersToPdfFile(ReportBindingModel model)
+ {
+ _saveToPdf.CreateDoc(new PdfInfoCountOrders
+ {
+ FileName = model.FileName,
+ Title = "Список объединенных по дате заказов",
+ DateFrom = model.DateFrom!.Value,
+ DateTo = model.DateTo!.Value,
+ CountOrders = GetCountOrders(model)
+ });
+ }
}
}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IReportLogic.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IReportLogic.cs
index d3b108f..ce04cc0 100644
--- a/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IReportLogic.cs
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IReportLogic.cs
@@ -33,7 +33,13 @@ namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
void SaveOrdersToPdfFile(ReportBindingModel model);
void SaveShopsToWordFile(ReportBindingModel model);
void SaveShopFurnituresToExcelFile(ReportBindingModel model);
-
List GetShopFurnitures();
+ ///
+ /// Получение объединенных по дате заказов за определенный период
+ ///
+ ///
+ ///
+ List GetCountOrders(ReportBindingModel model);
+ void SaveCountOrdersToPdfFile(ReportBindingModel model);
}
}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/ReportCountOrdersViewModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/ReportCountOrdersViewModel.cs
new file mode 100644
index 0000000..322824a
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/ReportCountOrdersViewModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.ViewModels
+{
+ public class ReportCountOrdersViewModel
+ {
+ public DateTime DateCreate { get; set; }
+ public int CountOrders { get; set; }
+ public double TotalSumOrders { get; set; }
+ }
+}