diff --git a/Typography/TypographyBusinessLogic/BusinessLogics/ReportLogic.cs b/Typography/TypographyBusinessLogic/BusinessLogics/ReportLogic.cs new file mode 100644 index 0000000..56265fd --- /dev/null +++ b/Typography/TypographyBusinessLogic/BusinessLogics/ReportLogic.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TypographyBusinessLogic.OfficePackage.HelperModels; +using TypographyBusinessLogic.OfficePackage; +using TypographyContracts.BindingModels; +using TypographyContracts.SearchModels; +using TypographyContracts.StoragesContracts; +using TypographyContracts.ViewModels; +using TypographyContracts.BusinessLogicsContracts; + +namespace TypographyBusinessLogic.BusinessLogics +{ + public class ReportLogic : IReportLogic + { + private readonly IComponentStorage _componentStorage; + private readonly IPrintedStorage _printedStorage; + private readonly IOrderStorage _orderStorage; + + private readonly AbstractSaveToExcel _saveToExcel; + private readonly AbstractSaveToWord _saveToWord; + private readonly AbstractSaveToPdf _saveToPdf; + + public ReportLogic(IPrintedStorage printedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, + AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) + { + _printedStorage = printedStorage; + _componentStorage = componentStorage; + _orderStorage = orderStorage; + + _saveToExcel = saveToExcel; + _saveToWord = saveToWord; + _saveToPdf = saveToPdf; + } + + public List GetPrintedComponent() + { + return _printedStorage.GetFullList().Select(x => new ReportPrintedComponentViewModel + { + PrintedName = x.PrintedName, + Components = x.PrintedComponents.Select(x => (x.Value.Item1.ComponentName, x.Value.Item2)).ToList(), + TotalCount = x.PrintedComponents.Select(x => x.Value.Item2).Sum() + } + ).ToList(); + } + + public List GetOrders(ReportBindingModel model) + { + return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo }) + .Select(x => new ReportOrdersViewModel + { + Id = x.Id, + DateCreate = x.DateCreate, + PrintedName = x.PrintedName, + Sum = x.Sum, + Status = x.Status.ToString() + }) + .ToList(); + } + + public void SavePrintedsToWordFile(ReportBindingModel model) + { + _saveToWord.CreateDoc(new WordInfo + { + FileName = model.FileName, + Title = "Список печатной продукции", + Printeds = _printedStorage.GetFullList() + }); + } + + public void SavePrintedComponentToExcelFile(ReportBindingModel model) + { + _saveToExcel.CreateReport(new ExcelInfo + { + FileName = model.FileName, + Title = "Список компонент", + PrintedComponents = GetPrintedComponent() + }); + } + + public void SaveOrdersToPdfFile(ReportBindingModel model) + { + _saveToPdf.CreateDoc(new PdfInfo + { + FileName = model.FileName, + Title = "Список заказов", + DateFrom = model.DateFrom!.Value, + DateTo = model.DateTo!.Value, + Orders = GetOrders(model) + }); + } + } +} diff --git a/Typography/TypographyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/Typography/TypographyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs new file mode 100644 index 0000000..6ca982e --- /dev/null +++ b/Typography/TypographyBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TypographyBusinessLogic.OfficePackage.HelperEnums; +using TypographyBusinessLogic.OfficePackage.HelperModels; + +namespace TypographyBusinessLogic.OfficePackage +{ + public abstract class AbstractSaveToPdf + { + public void CreateDoc(PdfInfo info) + { + CreatePdf(info); + CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + + 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.PrintedName, order.Sum.ToString(), order.Status.ToString() }, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + } + CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth }); + + SavePdf(info); + } + + protected abstract void CreatePdf(PdfInfo info); + + protected abstract void CreateParagraph(PdfParagraph paragraph); + + protected abstract void CreateTable(List columns); + + protected abstract void CreateRow(PdfRowParameters rowParameters); + + protected abstract void SavePdf(PdfInfo info); + } +} diff --git a/Typography/TypographyBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs b/Typography/TypographyBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs new file mode 100644 index 0000000..a4168cb --- /dev/null +++ b/Typography/TypographyBusinessLogic/OfficePackage/HelperEnums/PdfParagraphAlignmentType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TypographyBusinessLogic.OfficePackage.HelperEnums +{ + public enum PdfParagraphAlignmentType + { + Center, + Left, + Rigth + } +} diff --git a/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs index 872735c..d42f8e5 100644 --- a/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs +++ b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/ExcelCellParameters.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TypographyBusinessLogic.OfficePackage.HelperEnums; namespace TypographyBusinessLogic.OfficePackage.HelperModels { diff --git a/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs new file mode 100644 index 0000000..14ee302 --- /dev/null +++ b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TypographyContracts.ViewModels; + +namespace TypographyBusinessLogic.OfficePackage.HelperModels +{ + public class PdfInfo + { + public string FileName { get; set; } = string.Empty; + + 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/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs new file mode 100644 index 0000000..ac4d66e --- /dev/null +++ b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfParagraph.cs @@ -0,0 +1,13 @@ +using TypographyBusinessLogic.OfficePackage.HelperEnums; + +namespace TypographyBusinessLogic.OfficePackage.HelperModels +{ + public class PdfParagraph + { + public string Text { get; set; } = string.Empty; + + public string Style { get; set; } = string.Empty; + + public PdfParagraphAlignmentType ParagraphAlignment { get; set; } + } +} \ No newline at end of file diff --git a/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs new file mode 100644 index 0000000..88b5109 --- /dev/null +++ b/Typography/TypographyBusinessLogic/OfficePackage/HelperModels/PdfRowParameters.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TypographyBusinessLogic.OfficePackage.HelperEnums; + +namespace TypographyBusinessLogic.OfficePackage.HelperModels +{ + public class PdfRowParameters + { + public List Texts { get; set; } = new(); + + public string Style { get; set; } = string.Empty; + + public PdfParagraphAlignmentType ParagraphAlignment { get; set; } + } +} diff --git a/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToExcel.cs index 4c81160..e8fd1c6 100644 --- a/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToExcel.cs +++ b/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToExcel.cs @@ -13,7 +13,7 @@ using TypographyBusinessLogic.OfficePackage.HelperModels; namespace TypographyBusinessLogic.OfficePackage.Implements { - internal class SaveToExcel : AbstractSaveToExcel + public class SaveToExcel : AbstractSaveToExcel { private SpreadsheetDocument? _spreadsheetDocument; private SharedStringTablePart? _shareStringPart; diff --git a/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToPdf.cs b/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToPdf.cs new file mode 100644 index 0000000..7484680 --- /dev/null +++ b/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToPdf.cs @@ -0,0 +1,108 @@ +using TypographyBusinessLogic.OfficePackage.HelperEnums; +using TypographyBusinessLogic.OfficePackage.HelperModels; +using MigraDoc.DocumentObjectModel; +using MigraDoc.DocumentObjectModel.Tables; +using MigraDoc.Rendering; + +namespace TypographyBusinessLogic.OfficePackage.Implements +{ + public class SaveToPdf : AbstractSaveToPdf + { + private Document? _document; + private Section? _section; + private Table? _table; + + private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type) + { + return type switch + { + PdfParagraphAlignmentType.Center => ParagraphAlignment.Center, + PdfParagraphAlignmentType.Left => ParagraphAlignment.Left, + PdfParagraphAlignmentType.Rigth => ParagraphAlignment.Right, + _ => ParagraphAlignment.Justify, + }; + } + + private static void DefineStyles(Document document) + { + var style = document.Styles["Normal"]; + style.Font.Name = "Times New Roman"; + style.Font.Size = 14; + + style = document.Styles.AddStyle("NormalTitle", "Normal"); + style.Font.Bold = true; + } + + protected override void CreatePdf(PdfInfo info) + { + _document = new Document(); + DefineStyles(_document); + + _section = _document.AddSection(); + } + + protected override void CreateParagraph(PdfParagraph pdfParagraph) + { + if (_section == null) + { + return; + } + var paragraph = _section.AddParagraph(pdfParagraph.Text); + paragraph.Format.SpaceAfter = "1cm"; + paragraph.Format.Alignment = GetParagraphAlignment(pdfParagraph.ParagraphAlignment); + paragraph.Style = pdfParagraph.Style; + } + + protected override void CreateTable(List columns) + { + if (_document == null) + { + return; + } + _table = _document.LastSection.AddTable(); + + foreach (var elem in columns) + { + _table.AddColumn(elem); + } + } + + protected override void CreateRow(PdfRowParameters rowParameters) + { + if (_table == null) + { + return; + } + var row = _table.AddRow(); + for (int i = 0; i < rowParameters.Texts.Count; ++i) + { + row.Cells[i].AddParagraph(rowParameters.Texts[i]); + + if (!string.IsNullOrEmpty(rowParameters.Style)) + { + row.Cells[i].Style = rowParameters.Style; + } + + Unit borderWidth = 0.5; + + row.Cells[i].Borders.Left.Width = borderWidth; + row.Cells[i].Borders.Right.Width = borderWidth; + row.Cells[i].Borders.Top.Width = borderWidth; + row.Cells[i].Borders.Bottom.Width = borderWidth; + + row.Cells[i].Format.Alignment = GetParagraphAlignment(rowParameters.ParagraphAlignment); + row.Cells[i].VerticalAlignment = VerticalAlignment.Center; + } + } + + protected override void SavePdf(PdfInfo info) + { + var renderer = new PdfDocumentRenderer(true) + { + Document = _document + }; + renderer.RenderDocument(); + renderer.PdfDocument.Save(info.FileName); + } + } +} diff --git a/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToWord.cs index 8f604c0..0b6a362 100644 --- a/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToWord.cs +++ b/Typography/TypographyBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection.Metadata; -using System.Text; -using System.Threading.Tasks; -using static System.Net.Mime.MediaTypeNames; -using TypographyBusinessLogic.OfficePackage.HelperEnums; +using TypographyBusinessLogic.OfficePackage.HelperEnums; using TypographyBusinessLogic.OfficePackage.HelperModels; using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Packaging; @@ -13,7 +6,7 @@ using DocumentFormat.OpenXml.Wordprocessing; namespace TypographyBusinessLogic.OfficePackage.Implements { - internal class SaveToWord : AbstractSaveToWord + public class SaveToWord : AbstractSaveToWord { private WordprocessingDocument? _wordDocument; private Body? _docBody; diff --git a/Typography/TypographyContracts/BusinessLogicsContracts/IReportLogic.cs b/Typography/TypographyContracts/BusinessLogicsContracts/IReportLogic.cs index e62df22..e772299 100644 --- a/Typography/TypographyContracts/BusinessLogicsContracts/IReportLogic.cs +++ b/Typography/TypographyContracts/BusinessLogicsContracts/IReportLogic.cs @@ -1,14 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TypographyContracts.BindingModels; +using TypographyContracts.BindingModels; using TypographyContracts.ViewModels; namespace TypographyContracts.BusinessLogicsContracts { - public interface IReportLogic + public interface IReportLogic { List GetPrintedComponent(); diff --git a/Typography/TypographyContracts/SearchModels/OrderSearchModel.cs b/Typography/TypographyContracts/SearchModels/OrderSearchModel.cs index e321ecf..c5494fb 100644 --- a/Typography/TypographyContracts/SearchModels/OrderSearchModel.cs +++ b/Typography/TypographyContracts/SearchModels/OrderSearchModel.cs @@ -6,8 +6,12 @@ using System.Threading.Tasks; namespace TypographyContracts.SearchModels { - public class OrderSearchModel + public class OrderSearchModel { public int? Id { get; set; } + + public DateTime? DateFrom { get; set; } + + public DateTime? DateTo { get; set; } } } diff --git a/Typography/TypographyView/FormMain.Designer.cs b/Typography/TypographyView/FormMain.Designer.cs index 696e4d3..dbd1fee 100644 --- a/Typography/TypographyView/FormMain.Designer.cs +++ b/Typography/TypographyView/FormMain.Designer.cs @@ -28,140 +28,168 @@ /// private void InitializeComponent() { - this.buttonCreateOrder = new System.Windows.Forms.Button(); - this.buttonTakeOrderInWork = new System.Windows.Forms.Button(); - this.buttonIssuedOrder = new System.Windows.Forms.Button(); - this.dataGridViewOrders = new System.Windows.Forms.DataGridView(); - this.buttonRef = new System.Windows.Forms.Button(); - this.buttonOrderReady = new System.Windows.Forms.Button(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.directoriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.componentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.printedsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridViewOrders)).BeginInit(); - this.menuStrip.SuspendLayout(); - this.SuspendLayout(); + buttonCreateOrder = new Button(); + buttonTakeOrderInWork = new Button(); + buttonIssuedOrder = new Button(); + dataGridViewOrders = new DataGridView(); + buttonRef = new Button(); + buttonOrderReady = new Button(); + menuStrip = new MenuStrip(); + directoriesToolStripMenuItem = new ToolStripMenuItem(); + componentsToolStripMenuItem = new ToolStripMenuItem(); + printedsToolStripMenuItem = new ToolStripMenuItem(); + reportsToolStripMenuItem = new ToolStripMenuItem(); + printedsListToolStripMenuItem = new ToolStripMenuItem(); + componentPrintedsToolStripMenuItem = new ToolStripMenuItem(); + ordersListToolStripMenuItem = new ToolStripMenuItem(); + ((System.ComponentModel.ISupportInitialize)dataGridViewOrders).BeginInit(); + menuStrip.SuspendLayout(); + SuspendLayout(); // // buttonCreateOrder // - this.buttonCreateOrder.Location = new System.Drawing.Point(1100, 31); - this.buttonCreateOrder.Name = "buttonCreateOrder"; - this.buttonCreateOrder.Size = new System.Drawing.Size(203, 29); - this.buttonCreateOrder.TabIndex = 0; - this.buttonCreateOrder.Text = "Создать заказ"; - this.buttonCreateOrder.UseVisualStyleBackColor = true; - this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click); + buttonCreateOrder.Location = new Point(1100, 31); + buttonCreateOrder.Name = "buttonCreateOrder"; + buttonCreateOrder.Size = new Size(203, 29); + buttonCreateOrder.TabIndex = 0; + buttonCreateOrder.Text = "Создать заказ"; + buttonCreateOrder.UseVisualStyleBackColor = true; + buttonCreateOrder.Click += ButtonCreateOrder_Click; // // buttonTakeOrderInWork // - this.buttonTakeOrderInWork.Location = new System.Drawing.Point(1100, 66); - this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; - this.buttonTakeOrderInWork.Size = new System.Drawing.Size(203, 29); - this.buttonTakeOrderInWork.TabIndex = 1; - this.buttonTakeOrderInWork.Text = "Отдать на выполнение"; - this.buttonTakeOrderInWork.UseVisualStyleBackColor = true; - this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click); + buttonTakeOrderInWork.Location = new Point(1100, 66); + buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; + buttonTakeOrderInWork.Size = new Size(203, 29); + buttonTakeOrderInWork.TabIndex = 1; + buttonTakeOrderInWork.Text = "Отдать на выполнение"; + buttonTakeOrderInWork.UseVisualStyleBackColor = true; + buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click; // // buttonIssuedOrder // - this.buttonIssuedOrder.Location = new System.Drawing.Point(1100, 136); - this.buttonIssuedOrder.Name = "buttonIssuedOrder"; - this.buttonIssuedOrder.Size = new System.Drawing.Size(203, 29); - this.buttonIssuedOrder.TabIndex = 2; - this.buttonIssuedOrder.Text = "Заказ выдан"; - this.buttonIssuedOrder.UseVisualStyleBackColor = true; - this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click); + buttonIssuedOrder.Location = new Point(1100, 136); + buttonIssuedOrder.Name = "buttonIssuedOrder"; + buttonIssuedOrder.Size = new Size(203, 29); + buttonIssuedOrder.TabIndex = 2; + buttonIssuedOrder.Text = "Заказ выдан"; + buttonIssuedOrder.UseVisualStyleBackColor = true; + buttonIssuedOrder.Click += ButtonIssuedOrder_Click; // // dataGridViewOrders // - this.dataGridViewOrders.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; - this.dataGridViewOrders.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridViewOrders.Location = new System.Drawing.Point(0, 31); - this.dataGridViewOrders.Name = "dataGridViewOrders"; - this.dataGridViewOrders.RowHeadersVisible = false; - this.dataGridViewOrders.RowHeadersWidth = 51; - this.dataGridViewOrders.RowTemplate.Height = 29; - this.dataGridViewOrders.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridViewOrders.Size = new System.Drawing.Size(1078, 402); - this.dataGridViewOrders.TabIndex = 3; + dataGridViewOrders.BackgroundColor = SystemColors.ControlLightLight; + dataGridViewOrders.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewOrders.Location = new Point(0, 31); + dataGridViewOrders.Name = "dataGridViewOrders"; + dataGridViewOrders.RowHeadersVisible = false; + dataGridViewOrders.RowHeadersWidth = 51; + dataGridViewOrders.RowTemplate.Height = 29; + dataGridViewOrders.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridViewOrders.Size = new Size(1078, 402); + dataGridViewOrders.TabIndex = 3; // // buttonRef // - this.buttonRef.Location = new System.Drawing.Point(1100, 171); - this.buttonRef.Name = "buttonRef"; - this.buttonRef.Size = new System.Drawing.Size(203, 29); - this.buttonRef.TabIndex = 4; - this.buttonRef.Text = "Обновить список"; - this.buttonRef.UseVisualStyleBackColor = true; - this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click); + buttonRef.Location = new Point(1100, 171); + buttonRef.Name = "buttonRef"; + buttonRef.Size = new Size(203, 29); + buttonRef.TabIndex = 4; + buttonRef.Text = "Обновить список"; + buttonRef.UseVisualStyleBackColor = true; + buttonRef.Click += ButtonRef_Click; // // buttonOrderReady // - this.buttonOrderReady.Location = new System.Drawing.Point(1100, 101); - this.buttonOrderReady.Name = "buttonOrderReady"; - this.buttonOrderReady.Size = new System.Drawing.Size(203, 29); - this.buttonOrderReady.TabIndex = 5; - this.buttonOrderReady.Text = "Заказ готов"; - this.buttonOrderReady.UseVisualStyleBackColor = true; - this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click); + buttonOrderReady.Location = new Point(1100, 101); + buttonOrderReady.Name = "buttonOrderReady"; + buttonOrderReady.Size = new Size(203, 29); + buttonOrderReady.TabIndex = 5; + buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.UseVisualStyleBackColor = true; + buttonOrderReady.Click += ButtonOrderReady_Click; // // menuStrip // - this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.directoriesToolStripMenuItem}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(1315, 28); - this.menuStrip.TabIndex = 6; - this.menuStrip.Text = "menuStrip1"; + menuStrip.ImageScalingSize = new Size(20, 20); + menuStrip.Items.AddRange(new ToolStripItem[] { directoriesToolStripMenuItem, reportsToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(1315, 28); + menuStrip.TabIndex = 6; + menuStrip.Text = "menuStrip1"; // // directoriesToolStripMenuItem // - this.directoriesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.componentsToolStripMenuItem, - this.printedsToolStripMenuItem}); - this.directoriesToolStripMenuItem.Name = "directoriesToolStripMenuItem"; - this.directoriesToolStripMenuItem.Size = new System.Drawing.Size(117, 24); - this.directoriesToolStripMenuItem.Text = "Справочники"; + directoriesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, printedsToolStripMenuItem }); + directoriesToolStripMenuItem.Name = "directoriesToolStripMenuItem"; + directoriesToolStripMenuItem.Size = new Size(117, 24); + directoriesToolStripMenuItem.Text = "Справочники"; // // componentsToolStripMenuItem // - this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; - this.componentsToolStripMenuItem.Size = new System.Drawing.Size(237, 26); - this.componentsToolStripMenuItem.Text = "Компоненты"; - this.componentsToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click); + componentsToolStripMenuItem.Name = "componentsToolStripMenuItem"; + componentsToolStripMenuItem.Size = new Size(237, 26); + componentsToolStripMenuItem.Text = "Компоненты"; + componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; // // printedsToolStripMenuItem // - this.printedsToolStripMenuItem.Name = "printedsToolStripMenuItem"; - this.printedsToolStripMenuItem.Size = new System.Drawing.Size(237, 26); - this.printedsToolStripMenuItem.Text = "Печатная продукция"; - this.printedsToolStripMenuItem.Click += new System.EventHandler(this.PrintedsToolStripMenuItem_Click); + printedsToolStripMenuItem.Name = "printedsToolStripMenuItem"; + printedsToolStripMenuItem.Size = new Size(237, 26); + printedsToolStripMenuItem.Text = "Печатная продукция"; + printedsToolStripMenuItem.Click += PrintedsToolStripMenuItem_Click; + // + // reportsToolStripMenuItem + // + reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { printedsListToolStripMenuItem, componentPrintedsToolStripMenuItem, ordersListToolStripMenuItem }); + reportsToolStripMenuItem.Name = "reportsToolStripMenuItem"; + reportsToolStripMenuItem.Size = new Size(73, 24); + reportsToolStripMenuItem.Text = "Отчеты"; + // + // printedsListToolStripMenuItem + // + printedsListToolStripMenuItem.Name = "printedsListToolStripMenuItem"; + printedsListToolStripMenuItem.Size = new Size(354, 26); + printedsListToolStripMenuItem.Text = "Список печатной продукции"; + printedsListToolStripMenuItem.Click += PrintedsListToolStripMenuItem_Click; + // + // componentPrintedsToolStripMenuItem + // + componentPrintedsToolStripMenuItem.Name = "componentPrintedsToolStripMenuItem"; + componentPrintedsToolStripMenuItem.Size = new Size(332, 26); + componentPrintedsToolStripMenuItem.Text = "Компоненты печатной продукции"; + componentPrintedsToolStripMenuItem.Click += ComponentPrintedsToolStripMenuItem_Click; + // + // ordersListToolStripMenuItem + // + ordersListToolStripMenuItem.Name = "ordersListToolStripMenuItem"; + ordersListToolStripMenuItem.Size = new Size(354, 26); + ordersListToolStripMenuItem.Text = "Список заказов"; + ordersListToolStripMenuItem.Click += OrdersListToolStripMenuItem_Click; // // FormMain // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1315, 433); - this.Controls.Add(this.buttonOrderReady); - this.Controls.Add(this.buttonRef); - this.Controls.Add(this.dataGridViewOrders); - this.Controls.Add(this.buttonIssuedOrder); - this.Controls.Add(this.buttonTakeOrderInWork); - this.Controls.Add(this.buttonCreateOrder); - this.Controls.Add(this.menuStrip); - this.MainMenuStrip = this.menuStrip; - this.Name = "FormMain"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Типография"; - this.Load += new System.EventHandler(this.FormMain_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridViewOrders)).EndInit(); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1315, 433); + Controls.Add(buttonOrderReady); + Controls.Add(buttonRef); + Controls.Add(dataGridViewOrders); + Controls.Add(buttonIssuedOrder); + Controls.Add(buttonTakeOrderInWork); + Controls.Add(buttonCreateOrder); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormMain"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Типография"; + Load += FormMain_Load; + ((System.ComponentModel.ISupportInitialize)dataGridViewOrders).EndInit(); + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); } #endregion @@ -176,5 +204,9 @@ private ToolStripMenuItem directoriesToolStripMenuItem; private ToolStripMenuItem componentsToolStripMenuItem; private ToolStripMenuItem printedsToolStripMenuItem; + private ToolStripMenuItem reportsToolStripMenuItem; + private ToolStripMenuItem printedsListToolStripMenuItem; + private ToolStripMenuItem componentPrintedsToolStripMenuItem; + private ToolStripMenuItem ordersListToolStripMenuItem; } } \ No newline at end of file diff --git a/Typography/TypographyView/FormMain.cs b/Typography/TypographyView/FormMain.cs index 67b11cd..220bcd3 100644 --- a/Typography/TypographyView/FormMain.cs +++ b/Typography/TypographyView/FormMain.cs @@ -2,6 +2,8 @@ using TypographyContracts.BindingModels; using TypographyContracts.BusinessLogicsContracts; using Microsoft.Extensions.Logging; +using TypographyBusinessLogic.BusinessLogics; + namespace TypographyView { @@ -9,12 +11,14 @@ namespace TypographyView { private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; + private readonly IReportLogic _reportLogic; - public FormMain(ILogger logger, IOrderLogic orderLogic) + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; + _reportLogic = reportLogic; } private void FormMain_Load(object sender, EventArgs e) @@ -60,6 +64,34 @@ namespace TypographyView } } + private void PrintedsListToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SavePrintedsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + private void ComponentPrintedsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportPrintedComponents)); + if (service is FormReportPrintedComponents form) + { + form.ShowDialog(); + } + } + + private void OrdersListToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); + if (service is FormReportOrders form) + { + form.ShowDialog(); + } + } + private void ButtonCreateOrder_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); diff --git a/Typography/TypographyView/FormMain.resx b/Typography/TypographyView/FormMain.resx index 81a9e3d..5380aec 100644 --- a/Typography/TypographyView/FormMain.resx +++ b/Typography/TypographyView/FormMain.resx @@ -1,4 +1,64 @@ - + + + @@ -57,7 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + 17, 17 - + \ No newline at end of file diff --git a/Typography/TypographyView/FormReportOrders.Designer.cs b/Typography/TypographyView/FormReportOrders.Designer.cs new file mode 100644 index 0000000..0c63f42 --- /dev/null +++ b/Typography/TypographyView/FormReportOrders.Designer.cs @@ -0,0 +1,131 @@ +namespace TypographyView +{ + partial class FormReportOrders + { + /// + /// 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() + { + panelControl = new Panel(); + buttonToPdf = new Button(); + dateTimePickerTo = new DateTimePicker(); + buttonMake = new Button(); + labelFrom = new Label(); + dateTimePickerFrom = new DateTimePicker(); + labelTo = new Label(); + panelControl.SuspendLayout(); + SuspendLayout(); + // + // panelControl + // + panelControl.Controls.Add(buttonToPdf); + panelControl.Controls.Add(dateTimePickerTo); + panelControl.Controls.Add(buttonMake); + panelControl.Controls.Add(labelFrom); + panelControl.Controls.Add(dateTimePickerFrom); + panelControl.Controls.Add(labelTo); + panelControl.Dock = DockStyle.Top; + panelControl.Location = new Point(0, 0); + panelControl.Name = "panelControl"; + panelControl.Size = new Size(982, 49); + panelControl.TabIndex = 0; + // + // buttonToPdf + // + buttonToPdf.Location = new Point(817, 10); + buttonToPdf.Name = "buttonToPdf"; + buttonToPdf.Size = new Size(153, 29); + buttonToPdf.TabIndex = 4; + buttonToPdf.Text = "В Pdf"; + buttonToPdf.UseVisualStyleBackColor = true; + buttonToPdf.Click += ButtonToPdf_Click; + // + // dateTimePickerTo + // + dateTimePickerTo.Location = new Point(254, 10); + dateTimePickerTo.Name = "dateTimePickerTo"; + dateTimePickerTo.Size = new Size(179, 27); + dateTimePickerTo.TabIndex = 6; + // + // buttonMake + // + buttonMake.Location = new Point(439, 10); + buttonMake.Name = "buttonMake"; + buttonMake.Size = new Size(153, 29); + buttonMake.TabIndex = 3; + buttonMake.Text = "Сформировать"; + buttonMake.UseVisualStyleBackColor = true; + buttonMake.Click += ButtonMake_Click; + // + // labelFrom + // + labelFrom.AutoSize = true; + labelFrom.Location = new Point(12, 15); + labelFrom.Name = "labelFrom"; + labelFrom.Size = new Size(18, 20); + labelFrom.TabIndex = 1; + labelFrom.Text = "С"; + // + // dateTimePickerFrom + // + dateTimePickerFrom.Location = new Point(36, 10); + dateTimePickerFrom.Name = "dateTimePickerFrom"; + dateTimePickerFrom.Size = new Size(179, 27); + dateTimePickerFrom.TabIndex = 5; + // + // labelTo + // + labelTo.AutoSize = true; + labelTo.Location = new Point(221, 15); + labelTo.Name = "labelTo"; + labelTo.Size = new Size(27, 20); + labelTo.TabIndex = 2; + labelTo.Text = "по"; + // + // FormReportOrders + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(982, 753); + Controls.Add(panelControl); + Name = "FormReportOrders"; + StartPosition = FormStartPosition.CenterParent; + Text = "Заказы"; + panelControl.ResumeLayout(false); + panelControl.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private Panel panelControl; + private Label labelFrom; + private Label labelTo; + private Button buttonMake; + private Button buttonToPdf; + private DateTimePicker dateTimePickerFrom; + private DateTimePicker dateTimePickerTo; + } +} \ No newline at end of file diff --git a/Typography/TypographyView/FormReportOrders.cs b/Typography/TypographyView/FormReportOrders.cs new file mode 100644 index 0000000..4f18cd7 --- /dev/null +++ b/Typography/TypographyView/FormReportOrders.cs @@ -0,0 +1,90 @@ +using TypographyContracts.BindingModels; +using TypographyContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; +using Microsoft.Reporting.WinForms; +using System.Windows.Forms; + +namespace TypographyView +{ + public partial class FormReportOrders : Form + { + private readonly ReportViewer reportViewer; + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportOrders(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + reportViewer = new ReportViewer + { + Dock = DockStyle.Fill + }; + reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrder.rdlc", FileMode.Open)); + Controls.Clear(); + Controls.Add(reportViewer); + Controls.Add(panelControl); + } + + 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.GetOrders(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.SaveOrdersToPdfFile(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); + } + } + } + } +} \ No newline at end of file diff --git a/Typography/TypographyView/FormReportOrders.resx b/Typography/TypographyView/FormReportOrders.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/Typography/TypographyView/FormReportOrders.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/Typography/TypographyView/FormReportPrintedComponents.cs b/Typography/TypographyView/FormReportPrintedComponents.cs new file mode 100644 index 0000000..7cc6f22 --- /dev/null +++ b/Typography/TypographyView/FormReportPrintedComponents.cs @@ -0,0 +1,69 @@ +using TypographyContracts.BindingModels; +using TypographyContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; + +namespace TypographyView +{ + public partial class FormReportPrintedComponents : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportPrintedComponents(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormReportPrintedComponents_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetPrintedComponent(); + if (dict != null) + { + dataGridView.Rows.Clear(); + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.PrintedName, "", "" }); + foreach (var listElem in elem.Components) + { + dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); + } + dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount }); + dataGridView.Rows.Add(Array.Empty()); + } + } + _logger.LogInformation("Загрузка списка печатной продукции по компонентам"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка печатной продукции по компонентам"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonSaveToExcel_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SavePrintedComponentToExcelFile(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); + } + } + } + } +} \ No newline at end of file diff --git a/Typography/TypographyView/FormReportPrintedComponents.designer.cs b/Typography/TypographyView/FormReportPrintedComponents.designer.cs new file mode 100644 index 0000000..e50e958 --- /dev/null +++ b/Typography/TypographyView/FormReportPrintedComponents.designer.cs @@ -0,0 +1,119 @@ +namespace TypographyView +{ + partial class FormReportPrintedComponents + { + /// + /// 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() + { + dataGridView = new DataGridView(); + buttonSaveToExcel = new Button(); + ColumnPrinted = new DataGridViewTextBoxColumn(); + ColumnComponent = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToOrderColumns = true; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.BackgroundColor = SystemColors.ControlLightLight; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnPrinted, ColumnComponent, ColumnCount }); + dataGridView.Dock = DockStyle.Bottom; + dataGridView.Location = new Point(0, 53); + dataGridView.Margin = new Padding(4, 5, 4, 5); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.Size = new Size(782, 350); + dataGridView.TabIndex = 0; + // + // buttonSaveToExcel + // + buttonSaveToExcel.Location = new Point(13, 14); + buttonSaveToExcel.Margin = new Padding(4, 5, 4, 5); + buttonSaveToExcel.Name = "buttonSaveToExcel"; + buttonSaveToExcel.Size = new Size(203, 29); + buttonSaveToExcel.TabIndex = 1; + buttonSaveToExcel.Text = "Сохранить в Excel"; + buttonSaveToExcel.UseVisualStyleBackColor = true; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; + // + // ColumnPrinted + // + ColumnPrinted.HeaderText = "Печатная продукция"; + ColumnPrinted.MinimumWidth = 6; + ColumnPrinted.Name = "ColumnPrinted"; + ColumnPrinted.ReadOnly = true; + ColumnPrinted.Width = 200; + // + // ColumnComponent + // + ColumnComponent.HeaderText = "Компонент"; + ColumnComponent.MinimumWidth = 6; + ColumnComponent.Name = "ColumnComponent"; + ColumnComponent.ReadOnly = true; + ColumnComponent.Width = 200; + // + // ColumnCount + // + ColumnCount.HeaderText = "Количество"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + ColumnCount.ReadOnly = true; + ColumnCount.Width = 125; + // + // FormReportPrintedComponents + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(782, 403); + Controls.Add(buttonSaveToExcel); + Controls.Add(dataGridView); + Margin = new Padding(4, 5, 4, 5); + Name = "FormReportPrintedComponents"; + StartPosition = FormStartPosition.CenterParent; + Text = "Компоненты по печатной продукции"; + Load += FormReportPrintedComponents_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView; + private System.Windows.Forms.Button buttonSaveToExcel; + private DataGridViewTextBoxColumn ColumnPrinted; + private DataGridViewTextBoxColumn ColumnComponent; + private DataGridViewTextBoxColumn ColumnCount; + } +} \ No newline at end of file diff --git a/Typography/TypographyView/FormReportPrintedComponents.resx b/Typography/TypographyView/FormReportPrintedComponents.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/Typography/TypographyView/FormReportPrintedComponents.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/Typography/TypographyView/Program.cs b/Typography/TypographyView/Program.cs index 8416c5a..d43bd97 100644 --- a/Typography/TypographyView/Program.cs +++ b/Typography/TypographyView/Program.cs @@ -1,11 +1,14 @@ -using TypographyBusinessLogic.BusinessLogics; -using TypographyContracts.BusinessLogicsContracts; using TypographyContracts.StoragesContracts; using TypographyDatabaseImplement.Implements; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; -using System; +using TypographyBusinessLogic.OfficePackage.Implements; +using TypographyBusinessLogic.BusinessLogics; +using TypographyBusinessLogic.OfficePackage; +using TypographyContracts.BusinessLogicsContracts; +using TypographyView; + namespace TypographyView { @@ -13,7 +16,6 @@ namespace TypographyView { private static ServiceProvider? _serviceProvider; public static ServiceProvider? ServiceProvider => _serviceProvider; - /// /// The main entry point for the application. /// @@ -38,9 +40,16 @@ namespace TypographyView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -48,6 +57,8 @@ namespace TypographyView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/Typography/TypographyView/ReportOrder.rdlc b/Typography/TypographyView/ReportOrder.rdlc new file mode 100644 index 0000000..3596fca --- /dev/null +++ b/Typography/TypographyView/ReportOrder.rdlc @@ -0,0 +1,603 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 10791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + TypographyContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + DateCreate + System.DateTime + + + PrintedName + System.String + + + Sum + System.Decimal + + + Status + System.String + + + + TypographyContracts.ViewModels + ReportOrdersViewModel + TypographyContracts.ViewModels.ReportOrdersViewModel, TypographyContracts, 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 + + + + + + + 2.5cm + + + 3.21438cm + + + 8.23317cm + + + 2.5cm + + + 2.5cm + + + + + 0.6cm + + + + + 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.6cm + + + + + true + true + + + + + =Fields!Id.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!DateCreate.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PrintedName.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Status.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.2cm + 18.94755cm + 2 + + + + + + true + true + + + + + Итого: + + + + + + + 4cm + 12cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4cm + 14.5cm + 0.6cm + 2.5cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.72875cm + + + + + 21cm + + 29.7cm + 21cm + 2cm + 2cm + 2cm + 2cm + 0.13cm +