diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs index 63b20a2..4f8b094 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/BusinessLogics/ReportLogic.cs @@ -16,18 +16,21 @@ namespace CarpentryWorkshopBusinessLogic.BusinessLogics private readonly IOrderStorage _orderStorage; + private readonly IShopStorage _shopStorage; + private readonly AbstractSaveToExcel _saveToExcel; private readonly AbstractSaveToWord _saveToWord; private readonly AbstractSaveToPdf _saveToPdf; - public ReportLogic(IWoodStorage woodStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, + public ReportLogic(IWoodStorage woodStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, IShopStorage shopStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) { _woodStorage = woodStorage; _componentStorage = componentStorage; _orderStorage = orderStorage; + _shopStorage = shopStorage; _saveToExcel = saveToExcel; _saveToWord = saveToWord; @@ -127,5 +130,54 @@ namespace CarpentryWorkshopBusinessLogic.BusinessLogics Orders = GetOrders(model) }); } + public List GetShops() + { + return _shopStorage.GetFullList().Select(x => new ReportShopsViewModel + { + ShopName = x.ShopName, + Woods = x.ShopWoods.Select(x => (x.Value.Item1.WoodName, x.Value.Item2)).ToList(), + TotalCount = x.ShopWoods.Select(x => x.Value.Item2).Sum() + }).ToList(); + } + + public List GetGroupedOrders() + { + return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date).Select(x => new ReportGroupOrdersViewModel + { + Date = x.Key, + OrdersCount = x.Count(), + OrdersSum = x.Select(y => y.Sum).Sum() + }).ToList(); + } + + public void SaveShopsToWordFile(ReportBindingModel model) + { + _saveToWord.CreateShopsDoc(new WordShopInfo + { + FileName = model.FileName, + Title = "Список магазинов", + Shops = _shopStorage.GetFullList() + }); + } + + public void SaveShopsToExcelFile(ReportBindingModel model) + { + _saveToExcel.CreateShopWoodsReport(new ExcelShop + { + FileName = model.FileName, + Title = "Наполненость магазинов", + ShopWoods = GetShops() + }); + } + + public void SaveGroupedOrdersToPdfFile(ReportBindingModel model) + { + _saveToPdf.CreateGroupedOrdersDoc(new PdfGroupedOrdersInfo + { + FileName = model.FileName, + Title = "Список заказов сгруппированных по дате заказов", + GroupedOrders = GetGroupedOrders() + }); + } } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index 80b0b51..f5d39a4 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -79,12 +79,84 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage SaveExcel(info); } + public void CreateShopWoodsReport(ExcelShop info) + { + CreateExcel(info); - /// - /// Создание excel-файла - /// - /// - protected abstract void CreateExcel(ExcelInfo info); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = 1, + Text = info.Title, + StyleInfo = ExcelStyleInfoType.Title + }); + + MergeCells(new ExcelMergeParameters + { + CellFromName = "A1", + CellToName = "C1" + }); + + uint rowIndex = 2; + foreach (var sr in info.ShopWoods) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = sr.ShopName, + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + + foreach (var (Wood, Count) in sr.Woods) + { + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "B", + RowIndex = rowIndex, + Text = Wood, + StyleInfo = ExcelStyleInfoType.TextWithBroder + }); + + + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + Text = Count.ToString(), + StyleInfo = ExcelStyleInfoType.TextWithBroder + }); + + rowIndex++; + } + + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "A", + RowIndex = rowIndex, + Text = "Итого", + StyleInfo = ExcelStyleInfoType.Text + }); + InsertCellInWorksheet(new ExcelCellParameters + { + ColumnName = "C", + RowIndex = rowIndex, + Text = sr.TotalCount.ToString(), + StyleInfo = ExcelStyleInfoType.Text + }); + rowIndex++; + } + + SaveExcel(info); + } + + + /// + /// Создание excel-файла + /// + /// + protected abstract void CreateExcel(IDocument info); /// /// Добавляем новую ячейку в лист @@ -102,6 +174,6 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage /// Сохранение файла /// /// - protected abstract void SaveExcel(ExcelInfo info); + protected abstract void SaveExcel(IDocument info); } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 21f6c9e..812587b 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -33,12 +33,40 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage SavePdf(info); } + public void CreateGroupedOrdersDoc(PdfGroupedOrdersInfo info) + { + CreatePdf(info); + CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + + CreateTable(new List { "4cm", "3cm", "2cm" }); + CreateRow(new PdfRowParameters + { + Texts = new List { "Дата заказа", "Кол-во", "Сумма" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + + + foreach (var groupedOrder in info.GroupedOrders) + { + CreateRow(new PdfRowParameters + { + Texts = new List { groupedOrder.Date.ToShortDateString(), groupedOrder.OrdersCount.ToString(), groupedOrder.OrdersSum.ToString() }, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + } + + CreateParagraph(new PdfParagraph { Text = $"Итого: {info.GroupedOrders.Sum(x => x.OrdersSum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + + SavePdf(info); + } /// /// Создание doc-файла /// /// - protected abstract void CreatePdf(PdfInfo info); + protected abstract void CreatePdf(IDocument info); /// /// Создание параграфа с текстом @@ -64,6 +92,6 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage /// Сохранение файла /// /// - protected abstract void SavePdf(PdfInfo info); + protected abstract void SavePdf(IDocument info); } } diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToWord.cs index 15a0549..0fdcf02 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -36,12 +36,52 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage SaveWord(info); } + public void CreateShopsDoc(WordShopInfo info) + { + CreateWord(info); + CreateParagraph(new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) }, + TextProperties = new WordTextProperties + { + Size = "24", + JustificationType = WordJustificationType.Center + } + }); + + CreateTable(new List { "3000", "3000", "3000" }); + CreateRow(new WordRowParameters + { + Texts = new List { "Название", "Адрес", "Дата открытия" }, + TextProperties = new WordTextProperties + { + Size = "24", + Bold = true, + JustificationType = WordJustificationType.Center + } + }); + + foreach (var shop in info.Shops) + { + CreateRow(new WordRowParameters + { + Texts = new List { shop.ShopName, shop.Address, shop.DateOpen.ToString() }, + TextProperties = new WordTextProperties + { + Size = "22", + JustificationType = WordJustificationType.Both + } + }); + } + + SaveWord(info); + } /// /// Создание doc-файла /// /// - protected abstract void CreateWord(WordInfo info); + protected abstract void CreateWord(IDocument info); /// /// Создание абзаца с текстом @@ -54,6 +94,8 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage /// Сохранение файла /// /// - protected abstract void SaveWord(WordInfo info); + protected abstract void SaveWord(IDocument info); + protected abstract void CreateTable(List colums); + protected abstract void CreateRow(WordRowParameters rowParameters); } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs index d783376..8595f6e 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelInfo.cs @@ -2,7 +2,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels { - public class ExcelInfo + public class ExcelInfo : IDocument { public string FileName { get; set; } = string.Empty; diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelShop.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelShop.cs new file mode 100644 index 0000000..1c744d1 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/ExcelShop.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CarpentryWorkshopContracts.ViewModels; + +namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels +{ + public class ExcelShop : IDocument + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List ShopWoods { get; set; } = new(); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfGroupedOrdersInfo.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfGroupedOrdersInfo.cs new file mode 100644 index 0000000..b24087d --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfGroupedOrdersInfo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CarpentryWorkshopContracts.ViewModels; + +namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels +{ + public class PdfGroupedOrdersInfo : IDocument + { + 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 GroupedOrders { get; set; } = new(); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs index 1416fbe..0f7731c 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/PdfInfo.cs @@ -2,7 +2,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels { - public class PdfInfo + public class PdfInfo : IDocument { public string FileName { get; set; } = string.Empty; diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs index d123670..4da0cd8 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordInfo.cs @@ -2,7 +2,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels { - public class WordInfo + public class WordInfo : IDocument { public string FileName { get; set; } = string.Empty; diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordRowParameters.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordRowParameters.cs new file mode 100644 index 0000000..2425722 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordRowParameters.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels +{ + public class WordRowParameters + { + public List Texts { get; set; } = new(); + public WordTextProperties TextProperties { get; set; } = new(); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordShopInfo.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordShopInfo.cs new file mode 100644 index 0000000..1990e2e --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/HelperModels/WordShopInfo.cs @@ -0,0 +1,16 @@ +using CarpentryWorkshopContracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels +{ + public class WordShopInfo : IDocument + { + public string FileName { get; set; } = string.Empty; + public string Title { get; set; } = string.Empty; + public List Shops { get; set; } = new(); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/IDocument.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/IDocument.cs new file mode 100644 index 0000000..d17b78f --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/IDocument.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopBusinessLogic.OfficePackage +{ + public interface IDocument + { + public string FileName { get; set; } + public string Title { get; set; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs index bb1f4b6..80f37f3 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToExcel.cs @@ -152,7 +152,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements }; } - protected override void CreateExcel(ExcelInfo info) + protected override void CreateExcel(IDocument info) { _spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook); // Создаем книгу (в ней хранятся листы) @@ -281,7 +281,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements mergeCells.Append(mergeCell); } - protected override void SaveExcel(ExcelInfo info) + protected override void SaveExcel(IDocument info) { if (_spreadsheetDocument == null) { diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs index 2679e34..88be4a0 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToPdf.cs @@ -3,6 +3,7 @@ using CarpentryWorkshopBusinessLogic.OfficePackage.HelperModels; using MigraDoc.DocumentObjectModel; using MigraDoc.DocumentObjectModel.Tables; using MigraDoc.Rendering; +using System.Text; namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements { @@ -16,6 +17,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements private static ParagraphAlignment GetParagraphAlignment(PdfParagraphAlignmentType type) { + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); return type switch { PdfParagraphAlignmentType.Center => ParagraphAlignment.Center, @@ -39,7 +41,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements style.Font.Bold = true; } - protected override void CreatePdf(PdfInfo info) + protected override void CreatePdf(IDocument info) { _document = new Document(); DefineStyles(_document); @@ -101,7 +103,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements } } - protected override void SavePdf(PdfInfo info) + protected override void SavePdf(IDocument info) { var renderer = new PdfDocumentRenderer(true) { diff --git a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToWord.cs b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToWord.cs index 7b6ba28..09f8d57 100644 --- a/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToWord.cs +++ b/CarpentryWorkshop/CarpentryWorkshopBusinessLogic/OfficePackage/Implements/SaveToWord.cs @@ -81,7 +81,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements return properties; } - protected override void CreateWord(WordInfo info) + protected override void CreateWord(IDocument info) { _wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document); MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart(); @@ -119,7 +119,7 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements _docBody.AppendChild(docParagraph); } - protected override void SaveWord(WordInfo info) + protected override void SaveWord(IDocument info) { if (_docBody == null || _wordDocument == null) { @@ -131,5 +131,76 @@ namespace CarpentryWorkshopBusinessLogic.OfficePackage.Implements _wordDocument.Dispose(); } + private Table? _lastTable; + protected override void CreateTable(List columns) + { + if (_docBody == null) + return; + + _lastTable = new Table(); + + var tableProp = new TableProperties(); + tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed }); + tableProp.AppendChild(new TableBorders( + new TopBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 }, + new LeftBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 }, + new RightBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 }, + new BottomBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 }, + new InsideHorizontalBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 }, + new InsideVerticalBorder() { Val = new EnumValue(BorderValues.Single), Size = 4 } + )); + tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto }); + _lastTable.AppendChild(tableProp); + + TableGrid tableGrid = new TableGrid(); + foreach (var column in columns) + { + tableGrid.AppendChild(new GridColumn() { Width = column }); + } + _lastTable.AppendChild(tableGrid); + + _docBody.AppendChild(_lastTable); + } + + protected override void CreateRow(WordRowParameters rowParameters) + { + if (_docBody == null || _lastTable == null) + return; + + TableRow docRow = new TableRow(); + foreach (var column in rowParameters.Texts) + { + var docParagraph = new Paragraph(); + WordParagraph paragraph = new WordParagraph + { + Texts = new List<(string, WordTextProperties)> { (column, rowParameters.TextProperties) }, + TextProperties = rowParameters.TextProperties + }; + + docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties)); + + foreach (var run in paragraph.Texts) + { + var docRun = new Run(); + + var properties = new RunProperties(); + properties.AppendChild(new FontSize { Val = run.Item2.Size }); + if (run.Item2.Bold) + { + properties.AppendChild(new Bold()); + } + docRun.AppendChild(properties); + + docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve }); + + docParagraph.AppendChild(docRun); + } + + TableCell docCell = new TableCell(); + docCell.AppendChild(docParagraph); + docRow.AppendChild(docCell); + } + _lastTable.AppendChild(docRow); + } } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs index ee939f1..50d7e08 100644 --- a/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/BusinessLogicsContracts/IReportLogic.cs @@ -35,5 +35,11 @@ namespace CarpentryWorkshopContracts.BusinessLogicsContracts /// /// void SaveOrdersToPdfFile(ReportBindingModel model); + + List GetShops(); + List GetGroupedOrders(); + void SaveShopsToWordFile(ReportBindingModel model); + void SaveShopsToExcelFile(ReportBindingModel model); + void SaveGroupedOrdersToPdfFile(ReportBindingModel model); } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ReportGroupOrdersViewModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ReportGroupOrdersViewModel.cs new file mode 100644 index 0000000..c3e98b6 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ReportGroupOrdersViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.ViewModels +{ + public class ReportGroupOrdersViewModel + { + public DateTime Date { get; set; } = DateTime.Now; + public int OrdersCount { get; set; } + public double OrdersSum { get; set; } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ReportShopsViewModel.cs b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ReportShopsViewModel.cs new file mode 100644 index 0000000..805e833 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopContracts/ViewModels/ReportShopsViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CarpentryWorkshopContracts.ViewModels +{ + public class ReportShopsViewModel + { + public string ShopName { get; set; } = string.Empty; + public int TotalCount { get; set; } + public List<(string Wood, int count)> Woods { get; set; } = new(); + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/CarpentryWorkshopDatabaseImplement.csproj b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/CarpentryWorkshopDatabaseImplement.csproj index 39785eb..8882667 100644 --- a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/CarpentryWorkshopDatabaseImplement.csproj +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/CarpentryWorkshopDatabaseImplement.csproj @@ -7,13 +7,13 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240513151351_InitialCreate.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240513151351_InitialCreate.Designer.cs new file mode 100644 index 0000000..e35a9f0 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240513151351_InitialCreate.Designer.cs @@ -0,0 +1,252 @@ +// +using System; +using CarpentryWorkshopDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CarpentryWorkshopDatabaseImplement.Migrations +{ + [DbContext(typeof(CarpentryWorkshopDatabase))] + [Migration("20240513151351_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Component", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ComponentName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Cost") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.ToTable("Components"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("DateCreate") + .HasColumnType("timestamp without time zone"); + + b.Property("DateImplement") + .HasColumnType("timestamp without time zone"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("Sum") + .HasColumnType("double precision"); + + b.Property("WoodId") + .HasColumnType("integer"); + + b.Property("WoodName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WoodId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateOpen") + .HasColumnType("timestamp without time zone"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("text"); + + b.Property("WoodMaxCount") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.ShopWood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("ShopId") + .HasColumnType("integer"); + + b.Property("WoodId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ShopId"); + + b.HasIndex("WoodId"); + + b.ToTable("ShopWoods"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Wood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("double precision"); + + b.Property("WoodName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Woods"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.WoodComponent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ComponentId") + .HasColumnType("integer"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("WoodId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ComponentId"); + + b.HasIndex("WoodId"); + + b.ToTable("WoodComponents"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Order", b => + { + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Wood", null) + .WithMany("Orders") + .HasForeignKey("WoodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.ShopWood", b => + { + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Shop", "Shop") + .WithMany("Woods") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Wood", "Wood") + .WithMany("ShopWoods") + .HasForeignKey("WoodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Shop"); + + b.Navigation("Wood"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.WoodComponent", b => + { + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Component", "Component") + .WithMany("WoodComponents") + .HasForeignKey("ComponentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CarpentryWorkshopDatabaseImplement.Models.Wood", "Wood") + .WithMany("Components") + .HasForeignKey("WoodId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Component"); + + b.Navigation("Wood"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Component", b => + { + b.Navigation("WoodComponents"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Shop", b => + { + b.Navigation("Woods"); + }); + + modelBuilder.Entity("CarpentryWorkshopDatabaseImplement.Models.Wood", b => + { + b.Navigation("Components"); + + b.Navigation("Orders"); + + b.Navigation("ShopWoods"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240513151351_InitialCreate.cs b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240513151351_InitialCreate.cs new file mode 100644 index 0000000..6e43ce9 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/20240513151351_InitialCreate.cs @@ -0,0 +1,186 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace CarpentryWorkshopDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Components", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ComponentName = table.Column(type: "text", nullable: false), + Cost = table.Column(type: "double precision", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Components", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Shops", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ShopName = table.Column(type: "text", nullable: false), + Address = table.Column(type: "text", nullable: false), + DateOpen = table.Column(type: "timestamp without time zone", nullable: false), + WoodMaxCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shops", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Woods", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + WoodName = table.Column(type: "text", nullable: false), + Price = table.Column(type: "double precision", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Woods", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + WoodId = table.Column(type: "integer", nullable: false), + WoodName = table.Column(type: "text", nullable: false), + Count = table.Column(type: "integer", nullable: false), + Sum = table.Column(type: "double precision", nullable: false), + Status = table.Column(type: "integer", nullable: false), + DateCreate = table.Column(type: "timestamp without time zone", nullable: false), + DateImplement = table.Column(type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Woods_WoodId", + column: x => x.WoodId, + principalTable: "Woods", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ShopWoods", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + WoodId = table.Column(type: "integer", nullable: false), + ShopId = table.Column(type: "integer", nullable: false), + Count = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopWoods", x => x.Id); + table.ForeignKey( + name: "FK_ShopWoods_Shops_ShopId", + column: x => x.ShopId, + principalTable: "Shops", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShopWoods_Woods_WoodId", + column: x => x.WoodId, + principalTable: "Woods", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "WoodComponents", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + WoodId = table.Column(type: "integer", nullable: false), + ComponentId = table.Column(type: "integer", nullable: false), + Count = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WoodComponents", x => x.Id); + table.ForeignKey( + name: "FK_WoodComponents_Components_ComponentId", + column: x => x.ComponentId, + principalTable: "Components", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WoodComponents_Woods_WoodId", + column: x => x.WoodId, + principalTable: "Woods", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_WoodId", + table: "Orders", + column: "WoodId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopWoods_ShopId", + table: "ShopWoods", + column: "ShopId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopWoods_WoodId", + table: "ShopWoods", + column: "WoodId"); + + migrationBuilder.CreateIndex( + name: "IX_WoodComponents_ComponentId", + table: "WoodComponents", + column: "ComponentId"); + + migrationBuilder.CreateIndex( + name: "IX_WoodComponents_WoodId", + table: "WoodComponents", + column: "WoodId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "ShopWoods"); + + migrationBuilder.DropTable( + name: "WoodComponents"); + + migrationBuilder.DropTable( + name: "Shops"); + + migrationBuilder.DropTable( + name: "Components"); + + migrationBuilder.DropTable( + name: "Woods"); + } + } +} diff --git a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs index b756112..0d6255e 100644 --- a/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs +++ b/CarpentryWorkshop/CarpentryWorkshopDatabaseImplement/Migrations/CarpentryWorkshopDatabaseModelSnapshot.cs @@ -17,7 +17,7 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.3") + .HasAnnotation("ProductVersion", "7.0.3") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -54,10 +54,10 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations .HasColumnType("integer"); b.Property("DateCreate") - .HasColumnType("timestamp with time zone"); + .HasColumnType("timestamp without time zone"); b.Property("DateImplement") - .HasColumnType("timestamp with time zone"); + .HasColumnType("timestamp without time zone"); b.Property("Status") .HasColumnType("integer"); @@ -92,7 +92,7 @@ namespace CarpentryWorkshopDatabaseImplement.Migrations .HasColumnType("text"); b.Property("DateOpen") - .HasColumnType("timestamp with time zone"); + .HasColumnType("timestamp without time zone"); b.Property("ShopName") .IsRequired() diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs index ba1fd13..fb21c7a 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.Designer.cs @@ -32,6 +32,8 @@ справочникиToolStripMenuItem = new ToolStripMenuItem(); КомпонентыToolStripMenuItem = new ToolStripMenuItem(); ИзделияToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem1 = new ToolStripMenuItem(); + отчетыToolStripMenuItem2 = new ToolStripMenuItem(); отчетыToolStripMenuItem = new ToolStripMenuItem(); списокИзделийToolStripMenuItem = new ToolStripMenuItem(); списокКомпонентовПоИзделиямToolStripMenuItem = new ToolStripMenuItem(); @@ -42,34 +44,45 @@ ButtonOrderReady = new Button(); ButtonIssuedOrder = new Button(); ButtonRef = new Button(); - отчетыToolStripMenuItem1 = new ToolStripMenuItem(); + toolStripMenuItem1 = new ToolStripMenuItem(); + отчетыToolStripMenuItem3 = new ToolStripMenuItem(); + toolStripMenuItem3 = new ToolStripMenuItem(); + toolStripMenuItem4 = new ToolStripMenuItem(); + изделияToolStripMenuItem1 = new ToolStripMenuItem(); + магазинToolStripMenuItem = new ToolStripMenuItem(); + заказыToolStripMenuItem = new ToolStripMenuItem(); + списокИзделийToolStripMenuItem1 = new ToolStripMenuItem(); + изделияСКомпонентамиToolStripMenuItem = new ToolStripMenuItem(); + информацияToolStripMenuItem = new ToolStripMenuItem(); + загруженностьToolStripMenuItem = new ToolStripMenuItem(); + заказыToolStripMenuItem1 = new ToolStripMenuItem(); + заказыПоГруппамToolStripMenuItem = new ToolStripMenuItem(); menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); // // menuStrip1 // - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.справочникиToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(896, 24); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, toolStripMenuItem1, отчетыToolStripMenuItem3 }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(896, 24); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; // // справочникиToolStripMenuItem - справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыToolStripMenuItem, ИзделияToolStripMenuItem, отчетыToolStripMenuItem1 }); + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыToolStripMenuItem, ИзделияToolStripMenuItem, отчетыToolStripMenuItem1, отчетыToolStripMenuItem2 }); справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Size = new Size(94, 20); справочникиToolStripMenuItem.Text = "Справочники"; - this.справочникиToolStripMenuItem.Text = "Справочники"; // // КомпонентыToolStripMenuItem + // КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem"; КомпонентыToolStripMenuItem.Size = new Size(180, 22); КомпонентыToolStripMenuItem.Text = "Компоненты"; КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; - КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click; // // ИзделияToolStripMenuItem // @@ -77,6 +90,19 @@ ИзделияToolStripMenuItem.Size = new Size(180, 22); ИзделияToolStripMenuItem.Text = "Изделия"; ИзделияToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem1 + // + отчетыToolStripMenuItem1.Name = "отчетыToolStripMenuItem1"; + отчетыToolStripMenuItem1.Size = new Size(180, 22); + отчетыToolStripMenuItem1.Text = "Магазины"; + отчетыToolStripMenuItem1.Click += магазиныToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem2 + // + отчетыToolStripMenuItem2.Name = "отчетыToolStripMenuItem2"; + отчетыToolStripMenuItem2.Size = new Size(180, 22); + // // отчетыToolStripMenuItem // отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem, списокКомпонентовПоИзделиямToolStripMenuItem, списокЗаказовToolStripMenuItem }); @@ -105,36 +131,8 @@ списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click; // - // магазиныToolStripMenuItem - // - магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem"; - магазиныToolStripMenuItem.Size = new Size(180, 22); - магазиныToolStripMenuItem.Text = "Магазины"; - магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click; - // - // операцииToolStripMenuItem - // - операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { поставкаToolStripMenuItem, продажаToolStripMenuItem }); - операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; - операцииToolStripMenuItem.Size = new Size(75, 20); - операцииToolStripMenuItem.Text = "Операции"; - // - // поставкаToolStripMenuItem - // - поставкаToolStripMenuItem.Name = "поставкаToolStripMenuItem"; - поставкаToolStripMenuItem.Size = new Size(180, 22); - поставкаToolStripMenuItem.Text = "Поставка"; - поставкаToolStripMenuItem.Click += поставкиToolStripMenuItem_Click; - // - // продажаToolStripMenuItem - // - продажаToolStripMenuItem.Name = "продажаToolStripMenuItem"; - продажаToolStripMenuItem.Size = new Size(180, 22); - продажаToolStripMenuItem.Text = "Продажа"; - продажаToolStripMenuItem.Click += SellToolStripMenuItem_Click; - // - // // dataGridView + // dataGridView.BackgroundColor = SystemColors.ButtonHighlight; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridView.EnableHeadersVisualStyles = false; @@ -143,7 +141,6 @@ dataGridView.Name = "dataGridView"; dataGridView.Size = new Size(755, 243); dataGridView.TabIndex = 1; - this.dataGridView.TabIndex = 1; // // ButtonCreateOrder // @@ -186,6 +183,7 @@ ButtonIssuedOrder.Click += ButtonIssuedOrder_Click; // // ButtonRef + // ButtonRef.Location = new Point(762, 179); ButtonRef.Name = "ButtonRef"; ButtonRef.Size = new Size(122, 23); @@ -194,12 +192,96 @@ ButtonRef.UseVisualStyleBackColor = true; ButtonRef.Click += ButtonRef_Click; // - // отчетыToolStripMenuItem1 + // toolStripMenuItem1 // - отчетыToolStripMenuItem1.Name = "отчетыToolStripMenuItem1"; - отчетыToolStripMenuItem1.Size = new Size(180, 22); - отчетыToolStripMenuItem1.Text = "Отчеты"; - this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); + toolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItem3, toolStripMenuItem4 }); + toolStripMenuItem1.Name = "toolStripMenuItem1"; + toolStripMenuItem1.Size = new Size(75, 20); + toolStripMenuItem1.Text = "Операции"; + // + // отчетыToolStripMenuItem3 + // + отчетыToolStripMenuItem3.DropDownItems.AddRange(new ToolStripItem[] { изделияToolStripMenuItem1, магазинToolStripMenuItem, заказыToolStripMenuItem }); + отчетыToolStripMenuItem3.Name = "отчетыToolStripMenuItem3"; + отчетыToolStripMenuItem3.Size = new Size(60, 20); + отчетыToolStripMenuItem3.Text = "Отчеты"; + // + // toolStripMenuItem3 + // + toolStripMenuItem3.Name = "toolStripMenuItem3"; + toolStripMenuItem3.Size = new Size(180, 22); + toolStripMenuItem3.Text = "Поставка"; + toolStripMenuItem3.Click += поставкиToolStripMenuItem_Click; + // + // toolStripMenuItem4 + // + toolStripMenuItem4.Name = "toolStripMenuItem4"; + toolStripMenuItem4.Size = new Size(180, 22); + toolStripMenuItem4.Text = "Продажа"; + toolStripMenuItem4.DropDownClosed += SellToolStripMenuItem_Click; + // + // изделияToolStripMenuItem1 + // + изделияToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { списокИзделийToolStripMenuItem1, изделияСКомпонентамиToolStripMenuItem }); + изделияToolStripMenuItem1.Name = "изделияToolStripMenuItem1"; + изделияToolStripMenuItem1.Size = new Size(180, 22); + изделияToolStripMenuItem1.Text = "Изделия"; + // + // магазинToolStripMenuItem + // + магазинToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { информацияToolStripMenuItem, загруженностьToolStripMenuItem }); + магазинToolStripMenuItem.Name = "магазинToolStripMenuItem"; + магазинToolStripMenuItem.Size = new Size(180, 22); + магазинToolStripMenuItem.Text = "Магазин"; + // + // заказыToolStripMenuItem + // + заказыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { заказыToolStripMenuItem1, заказыПоГруппамToolStripMenuItem }); + заказыToolStripMenuItem.Name = "заказыToolStripMenuItem"; + заказыToolStripMenuItem.Size = new Size(180, 22); + заказыToolStripMenuItem.Text = "Заказы"; + // + // списокИзделийToolStripMenuItem1 + // + списокИзделийToolStripMenuItem1.Name = "списокИзделийToolStripMenuItem1"; + списокИзделийToolStripMenuItem1.Size = new Size(215, 22); + списокИзделийToolStripMenuItem1.Text = "Список изделий"; + списокИзделийToolStripMenuItem1.Click += списокИзделийToolStripMenuItem_Click; + // + // изделияСКомпонентамиToolStripMenuItem + // + изделияСКомпонентамиToolStripMenuItem.Name = "изделияСКомпонентамиToolStripMenuItem"; + изделияСКомпонентамиToolStripMenuItem.Size = new Size(215, 22); + изделияСКомпонентамиToolStripMenuItem.Text = "Изделия с компонентами"; + изделияСКомпонентамиToolStripMenuItem.Click += изделияПоКомпонентамToolStripMenuItem_Click; + // + // информацияToolStripMenuItem + // + информацияToolStripMenuItem.Name = "информацияToolStripMenuItem"; + информацияToolStripMenuItem.Size = new Size(180, 22); + информацияToolStripMenuItem.Text = "Информация"; + информацияToolStripMenuItem.Click += InfoToolStripMenuItem_Click; + // + // загруженностьToolStripMenuItem + // + загруженностьToolStripMenuItem.Name = "загруженностьToolStripMenuItem"; + загруженностьToolStripMenuItem.Size = new Size(180, 22); + загруженностьToolStripMenuItem.Text = "Загруженность"; + загруженностьToolStripMenuItem.Click += BusyShopsToolStripMenuItem_Click; + // + // заказыToolStripMenuItem1 + // + заказыToolStripMenuItem1.Name = "заказыToolStripMenuItem1"; + заказыToolStripMenuItem1.Size = new Size(180, 22); + заказыToolStripMenuItem1.Text = "Заказы"; + заказыToolStripMenuItem1.Click += списокЗаказовToolStripMenuItem_Click; + // + // заказыПоГруппамToolStripMenuItem + // + заказыПоГруппамToolStripMenuItem.Name = "заказыПоГруппамToolStripMenuItem"; + заказыПоГруппамToolStripMenuItem.Size = new Size(180, 22); + заказыПоГруппамToolStripMenuItem.Text = "Заказы по группам"; + заказыПоГруппамToolStripMenuItem.Click += GroupOrdersToolStripMenuItem_Click; // // FormMain // @@ -244,5 +326,19 @@ private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem отчетыToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem ИзделияToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem2; + private ToolStripMenuItem toolStripMenuItem1; + private ToolStripMenuItem toolStripMenuItem3; + private ToolStripMenuItem toolStripMenuItem4; + private ToolStripMenuItem отчетыToolStripMenuItem3; + private ToolStripMenuItem изделияToolStripMenuItem1; + private ToolStripMenuItem списокИзделийToolStripMenuItem1; + private ToolStripMenuItem изделияСКомпонентамиToolStripMenuItem; + private ToolStripMenuItem магазинToolStripMenuItem; + private ToolStripMenuItem информацияToolStripMenuItem; + private ToolStripMenuItem загруженностьToolStripMenuItem; + private ToolStripMenuItem заказыToolStripMenuItem; + private ToolStripMenuItem заказыToolStripMenuItem1; + private ToolStripMenuItem заказыПоГруппамToolStripMenuItem; } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs index bd3fc6a..090b9e0 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormMain.cs @@ -201,5 +201,42 @@ namespace CarpentryWorkshopView form.ShowDialog(); } } + private void InfoToolStripMenuItem_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + _reportLogic.SaveShopsToWordFile(new ReportBindingModel { FileName = dialog.FileName }); + MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + private void BusyShopsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportShop)); + if (service is FormReportShop form) + { + form.ShowDialog(); + } + } + + private void GroupOrdersToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders)); + if (service is FormReportGroupedOrders form) + { + form.ShowDialog(); + } + } + + private void отчетыToolStripMenuItem1_Click(object sender, EventArgs e) + { + + } + + private void отчетыToolStripMenuItem2_Click(object sender, EventArgs e) + { + + } } } diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.Designer.cs new file mode 100644 index 0000000..2a2ea61 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.Designer.cs @@ -0,0 +1,86 @@ +namespace CarpentryWorkshopView +{ + partial class FormReportGroupedOrders + { + /// + /// 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.buttonToPDF = new System.Windows.Forms.Button(); + this.buttonMake = new System.Windows.Forms.Button(); + this.panel.SuspendLayout(); + this.SuspendLayout(); + // + // panel + // + this.panel.Controls.Add(this.buttonToPDF); + this.panel.Controls.Add(this.buttonMake); + this.panel.Dock = System.Windows.Forms.DockStyle.Top; + this.panel.Location = new System.Drawing.Point(0, 0); + this.panel.Name = "panel"; + this.panel.Size = new System.Drawing.Size(970, 52); + this.panel.TabIndex = 1; + // + // buttonToPDF + // + this.buttonToPDF.Location = new System.Drawing.Point(486, 12); + this.buttonToPDF.Name = "buttonToPDF"; + this.buttonToPDF.Size = new System.Drawing.Size(411, 29); + this.buttonToPDF.TabIndex = 5; + this.buttonToPDF.Text = "В PDF"; + this.buttonToPDF.UseVisualStyleBackColor = true; + this.buttonToPDF.Click += new System.EventHandler(this.buttonToPDF_Click); + // + // buttonMake + // + this.buttonMake.Location = new System.Drawing.Point(49, 12); + this.buttonMake.Name = "buttonMake"; + this.buttonMake.Size = new System.Drawing.Size(377, 29); + this.buttonMake.TabIndex = 4; + this.buttonMake.Text = "Сформировать"; + this.buttonMake.UseVisualStyleBackColor = true; + this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click); + // + // FormReportGroupedOrders + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(970, 450); + this.Controls.Add(this.panel); + this.Name = "FormReportGroupedOrders"; + this.Text = "Отчёт по группированным заказам "; + this.panel.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private Panel panel; + private Button buttonToPDF; + private Button buttonMake; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.cs new file mode 100644 index 0000000..20ebb51 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.cs @@ -0,0 +1,80 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Reporting.WinForms; +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +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 CarpentryWorkshopView +{ + public partial class FormReportGroupedOrders : Form + { + private readonly ReportViewer reportViewer; + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportGroupedOrders(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + reportViewer = new ReportViewer + { + Dock = DockStyle.Fill + }; + reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupedOrders.rdlc", FileMode.Open)); + Controls.Clear(); + Controls.Add(reportViewer); + Controls.Add(panel); + } + + private void ButtonMake_Click(object sender, EventArgs e) + { + try + { + var dataSource = _logic.GetGroupedOrders(); + var source = new ReportDataSource("DataSetGroupedOrders", 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 buttonToPDF_Click(object sender, EventArgs e) + { + using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; + if (dialog.ShowDialog() == DialogResult.OK) + { + try + { + _logic.SaveGroupedOrdersToPdfFile(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/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormReportGroupedOrders.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.Designer.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.Designer.cs new file mode 100644 index 0000000..879fb0d --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.Designer.cs @@ -0,0 +1,115 @@ +namespace CarpentryWorkshopView +{ + partial class FormReportShop + { + /// + /// 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() + { + buttonSaveToExcel = new Button(); + dataGridView = new DataGridView(); + ColumnShop = new DataGridViewTextBoxColumn(); + ColumnWood = new DataGridViewTextBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // buttonSaveToExcel + // + buttonSaveToExcel.Location = new Point(0, 4); + buttonSaveToExcel.Margin = new Padding(3, 2, 3, 2); + buttonSaveToExcel.Name = "buttonSaveToExcel"; + buttonSaveToExcel.Size = new Size(195, 22); + buttonSaveToExcel.TabIndex = 3; + buttonSaveToExcel.Text = "Сохранить в Excel"; + buttonSaveToExcel.UseVisualStyleBackColor = true; + buttonSaveToExcel.Click += ButtonSaveToExcel_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToOrderColumns = true; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShop, ColumnWood, ColumnCount }); + dataGridView.Dock = DockStyle.Bottom; + dataGridView.Location = new Point(0, 36); + dataGridView.Margin = new Padding(3, 2, 3, 2); + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersWidth = 51; + dataGridView.RowTemplate.Height = 29; + dataGridView.Size = new Size(523, 302); + dataGridView.TabIndex = 2; + // + // ColumnShop + // + ColumnShop.FillWeight = 130F; + ColumnShop.HeaderText = "Магазин"; + ColumnShop.MinimumWidth = 6; + ColumnShop.Name = "ColumnShop"; + ColumnShop.ReadOnly = true; + // + // ColumnWood + // + ColumnWood.FillWeight = 140F; + ColumnWood.HeaderText = "Изделие"; + ColumnWood.MinimumWidth = 6; + ColumnWood.Name = "ColumnWood"; + ColumnWood.ReadOnly = true; + // + // ColumnCount + // + ColumnCount.FillWeight = 90F; + ColumnCount.HeaderText = "Количество"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + ColumnCount.ReadOnly = true; + // + // FormReportShop + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(523, 338); + Controls.Add(buttonSaveToExcel); + Controls.Add(dataGridView); + Margin = new Padding(3, 2, 3, 2); + Name = "FormReportShop"; + Text = "Наполненость магазинов"; + Load += FormReportShop_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Button buttonSaveToExcel; + private DataGridView dataGridView; + private DataGridViewTextBoxColumn ColumnShop; + private DataGridViewTextBoxColumn ColumnWood; + private DataGridViewTextBoxColumn ColumnCount; + } +} \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.cs b/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.cs new file mode 100644 index 0000000..add25dc --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.cs @@ -0,0 +1,78 @@ +using Microsoft.Extensions.Logging; +using CarpentryWorkshopContracts.BindingModels; +using CarpentryWorkshopContracts.BusinessLogicsContracts; +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 CarpentryWorkshopView +{ + public partial class FormReportShop : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportShop(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormReportShop_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetShops(); + if (dict != null) + { + dataGridView.Rows.Clear(); + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" }); + foreach (var listElem in elem.Woods) + { + 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.SaveShopsToExcelFile(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/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.resx b/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/FormReportShop.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/CarpentryWorkshop/CarpentryWorkshopView/Program.cs b/CarpentryWorkshop/CarpentryWorkshopView/Program.cs index e48adee..95de202 100644 --- a/CarpentryWorkshop/CarpentryWorkshopView/Program.cs +++ b/CarpentryWorkshop/CarpentryWorkshopView/Program.cs @@ -65,6 +65,8 @@ namespace CarpentryWorkshopView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/CarpentryWorkshop/CarpentryWorkshopView/ReportGroupedOrders.rdlc b/CarpentryWorkshop/CarpentryWorkshopView/ReportGroupedOrders.rdlc new file mode 100644 index 0000000..2ef2b88 --- /dev/null +++ b/CarpentryWorkshop/CarpentryWorkshopView/ReportGroupedOrders.rdlc @@ -0,0 +1,441 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 20791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + PrecastConcretePlantContractsViewModels + /* Local Query */ + + + + Date + System.DateTime + + + OrdersCount + System.Int32 + + + OrdersSum + System.Decimal + + + + PrecastConcretePlantContracts.ViewModels + ReportGroupOrdersViewModel + PrecastConcretePlantContracts.ViewModels.ReportGroupOrdersViewModel, PrecastConcretePlantContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + true + true + + + + + Отчёт по заказам + + + + 0.6cm + 16.51cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ReportParameterPeriod.Value + + + + + + + ReportParameterPeriod + 0.6cm + 0.6cm + 16.51cm + 1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 3.90406cm + + + 3.97461cm + + + 3.65711cm + + + + + 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!OrdersCount.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!OrdersSum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetGroupedOrders + 1.88242cm + 2.68676cm + 1.2cm + 11.53578cm + 2 + + + + + + true + true + + + + + Итого: + + + + 3.29409cm + 8.06542cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!OrdersSum.Value, "DataSetGroupedOrders") + + + + + + + 3.29409cm + 10.70653cm + 0.6cm + 3.48072cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 2in +