пойдет

This commit is contained in:
Danil Markov 2023-05-03 00:49:14 +04:00
parent f8360162aa
commit 34b0c6502e
26 changed files with 1664 additions and 320 deletions

View File

@ -13,13 +13,18 @@ namespace LawFirmBusinessLogic.BusinessLogics
private readonly IBlankStorage _blankStorage;
private readonly IDocumentStorage _documentStorage;
private readonly IOrderStorage _orderStorage;
private readonly IShopStorage _shopStorage;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
public ReportLogic(IDocumentStorage documentStorage, IBlankStorage
blankStorage, IOrderStorage orderStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord,
AbstractSaveToPdf saveToPdf)
public ReportLogic(IDocumentStorage documentStorage,
IBlankStorage blankStorage,
IOrderStorage orderStorage,
IShopStorage shopStorage,
AbstractSaveToExcel saveToExcel,
AbstractSaveToWord saveToWord,
AbstractSaveToPdf saveToPdf)
{
_documentStorage = documentStorage;
_blankStorage = blankStorage;
@ -27,6 +32,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
_saveToPdf = saveToPdf;
_shopStorage = shopStorage;
}
/// <summary>
/// Получение списка компонент с указанием, в каких изделиях используются
@ -89,7 +95,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
{
FileName = model.FileName,
Title = "Список бланков",
Blanks = _blankStorage.GetFullList()
Documents = _documentStorage.GetFullList()
});
}
/// <summary>
@ -120,5 +126,72 @@ namespace LawFirmBusinessLogic.BusinessLogics
Orders = GetOrders(model)
});
}
}
public List<ReportShopDocumentViewModel> GetShopDocuments()
{
var shops = _shopStorage.GetFullList();
var list = new List<ReportShopDocumentViewModel>();
foreach (var shop in shops)
{
var record = new ReportShopDocumentViewModel
{
ShopName = shop.ShopName,
Documents = new List<(string, int)>(),
TotalCount = 0
};
foreach (var document in shop.ShopDocuments)
{
record.Documents.Add(new(document.Value.Item1.DocumentName, shop.ShopDocuments[document.Value.Item1.Id].Item2));
record.TotalCount += shop.ShopDocuments[document.Value.Item1.Id].Item2;
}
list.Add(record);
}
return list;
}
public void SaveShopDocumentToExcelFile(ReportBindingModel model)
{
_saveToExcel.CreateShopReport(new ExcelInfo
{
FileName = model.FileName,
Title = "Заполненность магазинов",
ShopDocuments = GetShopDocuments()
});
}
public List<ReportOrdersGroupedByDateViewModel> GetGroupedByDateOrders()
{
return _orderStorage.GetFullList().GroupBy(x => x.DateCreate.Date)
.Select(x => new ReportOrdersGroupedByDateViewModel
{
Date = x.Key,
Count = x.Count(),
Sum = x.Sum(y => y.Sum)
})
.ToList();
}
public void SaveGroupedByDateOrders(ReportBindingModel model)
{
_saveToPdf.CreateDocWithGroupedOrders(new PdfInfo
{
FileName = model.FileName,
Title = "Заказы по дате",
GroupedOrders = GetGroupedByDateOrders(),
});
}
public void SaveShopsToWordFile(ReportBindingModel model)
{
_saveToWord.CreateShopsTable(new WordInfo
{
FileName = model.FileName,
Title = "Список магазинов",
Shops = _shopStorage.GetFullList()
});
}
}
}

View File

@ -71,11 +71,81 @@ namespace LawFirmBusinessLogic.OfficePackage
}
SaveExcel(info);
}
/// <summary>
/// Создание excel-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateExcel(ExcelInfo info);
public void CreateShopReport(ExcelInfo info)
{
CreateExcel(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 ss in info.ShopDocuments)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "A",
RowIndex = rowIndex,
Text = ss.ShopName,
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
foreach (var (Document, Count) in ss.Documents)
{
InsertCellInWorksheet(new ExcelCellParameters
{
ColumnName = "B",
RowIndex = rowIndex,
Text = Document,
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 = ss.TotalCount.ToString(),
StyleInfo = ExcelStyleInfoType.Text
});
rowIndex++;
}
SaveExcel(info);
}
/// <summary>
/// Создание excel-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateExcel(ExcelInfo info);
/// <summary>
/// Добавляем новую ячейку в лист
/// </summary>

View File

@ -3,6 +3,7 @@ using LawFirmBusinessLogic.OfficePackage.HelperEnums;
using LawFirmBusinessLogic.OfficePackage.HelperModels;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LawFirmBusinessLogic.OfficePackage
{
@ -48,11 +49,48 @@ namespace LawFirmBusinessLogic.OfficePackage
});
SavePdf(info);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreatePdf(PdfInfo info);
public void CreateDocWithGroupedOrders(PdfInfo info)
{
CreatePdf(info);
CreateParagraph(new PdfParagraph
{
Text = info.Title,
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "3cm", "3cm", "3cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Дата", "Количество", "Сумма" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var order in info.GroupedOrders)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { order.Date.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
CreateParagraph(new PdfParagraph
{
Text = $"Итого: {info.GroupedOrders.Sum(x => x.Sum)}\t",
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Rigth
});
SavePdf(info);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreatePdf(PdfInfo info);
/// <summary>
/// Создание параграфа с текстом
/// </summary>

View File

@ -18,12 +18,12 @@ namespace LawFirmBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center
}
});
foreach (var blank in info.Blanks)
foreach (var blank in info.Documents)
{
CreateParagraph(new WordParagraph
{
Texts = new List<(string, WordTextProperties)> {
(blank.BlankName + " - ", new WordTextProperties { Size = "24", Bold=true}),
(blank.DocumentName + " - ", new WordTextProperties { Size = "24", Bold=true}),
(blank.Price.ToString(), new WordTextProperties { Size = "24", })
},
TextProperties = new WordTextProperties
@ -35,17 +35,54 @@ namespace LawFirmBusinessLogic.OfficePackage
}
SaveWord(info);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateWord(WordInfo info);
/// <summary>
/// Создание абзаца с текстом
/// </summary>
/// <param name="paragraph"></param>
/// <returns></returns>
protected abstract void CreateParagraph(WordParagraph paragraph);
public void CreateShopsTable(WordInfo 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
}
});
List<(string, WordTextProperties)> shopsInfo = new()
{
{ ("Название", new WordTextProperties { Bold = true, Size = "24" }) },
{ ("Адрес", new WordTextProperties { Bold = true, Size = "24" }) },
{ ("Дата открытия", new WordTextProperties { Bold = true, Size = "24" }) }
};
foreach (var shop in info.Shops)
{
shopsInfo.Add((shop.ShopName, new WordTextProperties { Size = "20" }));
shopsInfo.Add((shop.Address, new WordTextProperties { Size = "20" }));
shopsInfo.Add((shop.DateOpen.ToString(), new WordTextProperties { Size = "20" }));
}
CreateTable(new WordParagraph
{
Texts = shopsInfo,
TextProperties = new WordTextProperties
{
Size = "24",
JustificationType = WordJustificationType.Center
}
}, 3);
SaveWord(info);
}
/// <summary>
/// Создание doc-файла
/// </summary>
/// <param name="info"></param>
protected abstract void CreateWord(WordInfo info);
protected abstract void CreateTable(WordParagraph paragraph, int columnCount);
/// <summary>
/// Создание абзаца с текстом
/// </summary>
/// <param name="paragraph"></param>
/// <returns></returns>
protected abstract void CreateParagraph(WordParagraph paragraph);
/// <summary>
/// Сохранение файла
/// </summary>

View File

@ -6,11 +6,9 @@ namespace LawFirmBusinessLogic.OfficePackage.HelperModels
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ReportDocumentBlankViewModel> DocumentBlanks
{
get;
set;
} = new();
}
public List<ReportDocumentBlankViewModel> DocumentBlanks { get; set; } = new();
public List<ReportShopDocumentViewModel> ShopDocuments { get; set; } = new();
}
}

View File

@ -9,5 +9,6 @@ namespace LawFirmBusinessLogic.OfficePackage.HelperModels
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
public List<ReportOrdersViewModel> Orders { get; set; } = new();
}
public List<ReportOrdersGroupedByDateViewModel> GroupedOrders { get; set; } = new();
}
}

View File

@ -6,6 +6,7 @@ namespace LawFirmBusinessLogic.OfficePackage.HelperModels
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<BlankViewModel> Blanks { get; set; } = new();
}
public List<DocumentViewModel> Documents { get; set; } = new();
public List<ShopViewModel> Shops { get; set; } = new();
}
}

View File

@ -72,7 +72,59 @@ namespace LawFirmBusinessLogic.OfficePackage.Implements
properties.AppendChild(paragraphMarkRunProperties);
return properties;
}
protected override void CreateWord(WordInfo info)
protected override void CreateTable(WordParagraph paragraph, int columnCount)
{
if (_docBody == null || paragraph == null)
{
return;
}
Table table = new();
TableProperties properties = new();
properties.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
properties.AppendChild(new TableBorders
(
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
));
properties.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
table.AppendChild(properties);
TableGrid tableGrid = new();
for (int j = 0; j < columnCount; ++j)
{
tableGrid.AppendChild(new GridColumn() { Width = "3400" });
}
table.AppendChild(tableGrid);
for (int i = 0; i < paragraph.Texts.Count; ++i)
{
TableRow tableRow = new();
for (int j = 0; j < columnCount; ++j)
{
var tableParagraph = new Paragraph();
tableParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
var tableRun = new Run();
var runProperties = new RunProperties();
runProperties.AppendChild(new FontSize { Val = paragraph.Texts[i + j].Item2.Size });
if (paragraph.Texts[i + j].Item2.Bold)
{
runProperties.AppendChild(new Bold());
}
tableRun.AppendChild(runProperties);
tableRun.AppendChild(new Text { Text = paragraph.Texts[i + j].Item1, Space = SpaceProcessingModeValues.Preserve });
tableParagraph.AppendChild(tableRun);
TableCell cell = new();
cell.AppendChild(tableParagraph);
tableRow.AppendChild(cell);
}
i += columnCount - 1;
table.AppendChild(tableRow);
}
_docBody.AppendChild(table);
}
protected override void CreateWord(WordInfo info)
{
_wordDocument = WordprocessingDocument.Create(info.FileName,
WordprocessingDocumentType.Document);

View File

@ -11,26 +11,31 @@ namespace LawFirmContracts.BusinessLogicsContracts
/// </summary>
/// <returns></returns>
List<ReportDocumentBlankViewModel> GetDocumentBlank();
/// <summary>
/// Получение списка заказов за определенный период
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
List<ReportShopDocumentViewModel> GetShopDocuments();
List<ReportOrdersGroupedByDateViewModel> GetGroupedByDateOrders();
/// <summary>
/// Получение списка заказов за определенный период
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
/// <summary>
/// Сохранение компонент в файл-Word
/// </summary>
/// <param name="model"></param>
void SaveBlanksToWordFile(ReportBindingModel model);
/// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel
/// </summary>
/// <param name="model"></param>
void SaveDocumentBlankToExcelFile(ReportBindingModel model);
/// <summary>
/// Сохранение заказов в файл-Pdf
/// </summary>
/// <param name="model"></param>
void SaveOrdersToPdfFile(ReportBindingModel model);
}
void SaveShopsToWordFile(ReportBindingModel model);
/// <summary>
/// Сохранение компонент с указаеним продуктов в файл-Excel
/// </summary>
/// <param name="model"></param>
void SaveDocumentBlankToExcelFile(ReportBindingModel model);
void SaveShopDocumentToExcelFile(ReportBindingModel model);
/// <summary>
/// Сохранение заказов в файл-Pdf
/// </summary>
/// <param name="model"></param>
void SaveOrdersToPdfFile(ReportBindingModel model);
void SaveGroupedByDateOrders(ReportBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LawFirmContracts.ViewModels
{
public class ReportOrdersGroupedByDateViewModel
{
public DateTime Date { get; set; }
public int Count { get; set; }
public double Sum { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LawFirmContracts.ViewModels
{
public class ReportShopDocumentViewModel
{
public string ShopName { get; set; } = string.Empty;
public int TotalCount { get; set; }
public List<(string Document, int Count)> Documents { get; set; } = new();
}
}

View File

@ -36,9 +36,10 @@ namespace LawFirmDatabaseImplement.Implements
using var context = new LawFirmDatabase();
return GetViewModel(context.Orders
return context.Orders
.Include(x => x.Document)
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id)));
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)
?.GetViewModel;
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
@ -49,8 +50,15 @@ namespace LawFirmDatabaseImplement.Implements
}
using var context = new LawFirmDatabase();
return context.Orders
if (model.DateFrom.HasValue)
{
return context.Orders
.Include(x => x.Document)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return context.Orders
.Include(x => x.Document)
.Where(x => x.Id == model.Id)
.Select(x => GetViewModel(x))

View File

@ -19,11 +19,22 @@ namespace LawFirmFileImplement.Implements
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{
if (!model.Id.HasValue)
{
if(!model.Id.HasValue && !model.DateFrom.HasValue)
{
return new();
}
return source.Orders.Where(x => x.Id.Equals(model.Id) || model.DateFrom <= model.DateFrom && model.DateFrom <= model.DateTo).Select(x => GetViewModel(x)).ToList();
if (model.DateFrom.HasValue)
{
return source.Orders
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return source.Orders
.Where(x => x.Id.Equals(model.Id))
.Select(x => GetViewModel(x))
.ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)
{

View File

@ -29,9 +29,20 @@ namespace LawFirmListImplement.Implements
{
return result;
}
foreach (var order in _source.Orders)
if (model.DateFrom.HasValue)
{
foreach (var order in _source.Orders)
{
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
{
result.Add(GetViewModel(order));
}
}
return result;
}
foreach (var order in _source.Orders)
{
if (order.Id == model.Id || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo)
if (order.Id == model.Id)
{
result.Add(GetViewModel(order));
}

View File

@ -4,7 +4,7 @@
{
/// <summary>
/// Required designer variable.
/// </summary>
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>

View File

@ -28,195 +28,271 @@
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.бланкиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.документыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
this.buttonOrderReady = new System.Windows.Forms.Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonUpdate = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.справочникиToolStripMenuItem,
this.ButtonCreateOrder = new System.Windows.Forms.Button();
this.ButtonTakeOrderInWork = new System.Windows.Forms.Button();
this.ButtonOrderReady = new System.Windows.Forms.Button();
this.ButtonIssuedOrder = new System.Windows.Forms.Button();
this.ButtonRef = new System.Windows.Forms.Button();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ДеталиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ДокументыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.магазинToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DocumentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.documentsBlanksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.загруженностьМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.заказыПоДатеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.ButtonAddDocument = new System.Windows.Forms.Button();
this.ButtonSellDocument = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// ButtonCreateOrder
//
this.ButtonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonCreateOrder.Location = new System.Drawing.Point(841, 44);
this.ButtonCreateOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonCreateOrder.Name = "ButtonCreateOrder";
this.ButtonCreateOrder.Size = new System.Drawing.Size(164, 22);
this.ButtonCreateOrder.TabIndex = 0;
this.ButtonCreateOrder.Text = "Создать заказ";
this.ButtonCreateOrder.UseVisualStyleBackColor = true;
this.ButtonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
//
// ButtonTakeOrderInWork
//
this.ButtonTakeOrderInWork.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonTakeOrderInWork.Location = new System.Drawing.Point(841, 94);
this.ButtonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork";
this.ButtonTakeOrderInWork.Size = new System.Drawing.Size(164, 22);
this.ButtonTakeOrderInWork.TabIndex = 1;
this.ButtonTakeOrderInWork.Text = "Отдать на выполнение";
this.ButtonTakeOrderInWork.UseVisualStyleBackColor = true;
this.ButtonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
//
// ButtonOrderReady
//
this.ButtonOrderReady.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonOrderReady.Location = new System.Drawing.Point(841, 146);
this.ButtonOrderReady.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonOrderReady.Name = "ButtonOrderReady";
this.ButtonOrderReady.Size = new System.Drawing.Size(164, 22);
this.ButtonOrderReady.TabIndex = 2;
this.ButtonOrderReady.Text = "Заказ готов";
this.ButtonOrderReady.UseVisualStyleBackColor = true;
this.ButtonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
//
// ButtonIssuedOrder
//
this.ButtonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonIssuedOrder.Location = new System.Drawing.Point(841, 192);
this.ButtonIssuedOrder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonIssuedOrder.Name = "ButtonIssuedOrder";
this.ButtonIssuedOrder.Size = new System.Drawing.Size(164, 22);
this.ButtonIssuedOrder.TabIndex = 3;
this.ButtonIssuedOrder.Text = "Заказ выдан";
this.ButtonIssuedOrder.UseVisualStyleBackColor = true;
this.ButtonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
//
// ButtonRef
//
this.ButtonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonRef.Location = new System.Drawing.Point(841, 243);
this.ButtonRef.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(164, 22);
this.ButtonRef.TabIndex = 4;
this.ButtonRef.Text = "Обновить список";
this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem,
this.отчетыToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(800, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.бланкиToolStripMenuItem,
this.документыToolStripMenuItem});
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.справочникиToolStripMenuItem.Text = "Справочники";
//
// бланкиToolStripMenuItem
//
this.бланкиToolStripMenuItem.Name = "бланкиToolStripMenuItem";
this.бланкиToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.бланкиToolStripMenuItem.Text = "Бланки";
this.бланкиToolStripMenuItem.Click += new System.EventHandler(this.BlanksToolStripMenuItem_Click);
//
// документыToolStripMenuItem
//
this.документыToolStripMenuItem.Name = окументыToolStripMenuItem";
this.документыToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.документыToolStripMenuItem.Text = "Документы";
this.документыToolStripMenuItem.Click += new System.EventHandler(this.DocumentsToolStripMenuItem_Click);
//
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокКомпонентовToolStripMenuItem,
this.компонентыПоИзделиямToolStripMenuItem,
this.списокЗаказовToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокКомпонентовToolStripMenuItem
//
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
this.списокКомпонентовToolStripMenuItem.Click += new System.EventHandler(this.DocumentsReportToolStripMenuItem_Click);
//
// компонентыПоИзделиямToolStripMenuItem
//
this.компонентыПоИзделиямToolStripMenuItem.Name = омпонентыПоИзделиямToolStripMenuItem";
this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
this.компонентыПоИзделиямToolStripMenuItem.Click += new System.EventHandler(this.DocumentBlanksReportToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersReportToolStripMenuItem_Click);
//
// dataGridView
//
this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(12, 27);
this.dataGridView.Name = "dataGridView";
this.dataGridView.ReadOnly = true;
this.dataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(566, 411);
this.dataGridView.TabIndex = 1;
//
// buttonCreateOrder
//
this.buttonCreateOrder.Location = new System.Drawing.Point(605, 27);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(168, 23);
this.buttonCreateOrder.TabIndex = 2;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
//
// buttonTakeOrderInWork
//
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(605, 56);
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(168, 23);
this.buttonTakeOrderInWork.TabIndex = 3;
this.buttonTakeOrderInWork.Text = "Отдать на выполнение";
this.buttonTakeOrderInWork.UseVisualStyleBackColor = true;
this.buttonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
//
// buttonOrderReady
//
this.buttonOrderReady.Location = new System.Drawing.Point(605, 85);
this.buttonOrderReady.Name = "buttonOrderReady";
this.buttonOrderReady.Size = new System.Drawing.Size(168, 23);
this.buttonOrderReady.TabIndex = 4;
this.buttonOrderReady.Text = "Заказ готов";
this.buttonOrderReady.UseVisualStyleBackColor = true;
this.buttonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
//
// buttonIssuedOrder
//
this.buttonIssuedOrder.Location = new System.Drawing.Point(605, 114);
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
this.buttonIssuedOrder.Size = new System.Drawing.Size(168, 23);
this.buttonIssuedOrder.TabIndex = 5;
this.buttonIssuedOrder.Text = "Заказ выдан";
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
this.buttonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
//
// buttonUpdate
//
this.buttonUpdate.Location = new System.Drawing.Point(605, 143);
this.buttonUpdate.Name = "buttonUpdate";
this.buttonUpdate.Size = new System.Drawing.Size(168, 23);
this.buttonUpdate.TabIndex = 6;
this.buttonUpdate.Text = "Обновить список";
this.buttonUpdate.UseVisualStyleBackColor = true;
this.buttonUpdate.Click += new System.EventHandler(this.ButtonRef_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.buttonUpdate);
this.Controls.Add(this.buttonIssuedOrder);
this.Controls.Add(this.buttonOrderReady);
this.Controls.Add(this.buttonTakeOrderInWork);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMain";
this.Text = "Юридическая фирма";
this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1015, 24);
this.menuStrip1.TabIndex = 5;
this.menuStrip1.Text = "menuStrip1";
//
// ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ДеталиToolStripMenuItem,
this.ДокументыToolStripMenuItem,
this.магазинToolStripMenuItem});
this.ToolStripMenuItem.Name = "ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.ToolStripMenuItem.Text = "Справочники";
//
// ДеталиToolStripMenuItem
//
this.ДеталиToolStripMenuItem.Name = еталиToolStripMenuItem";
this.ДеталиToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.ДеталиToolStripMenuItem.Text = "Детали";
this.ДеталиToolStripMenuItem.Click += new System.EventHandler(this.ДеталиToolStripMenuItem_Click);
//
// ДокументыToolStripMenuItem
//
this.ДокументыToolStripMenuItem.Name = окументыToolStripMenuItem";
this.ДокументыToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.ДокументыToolStripMenuItem.Text = "Документы";
this.ДокументыToolStripMenuItem.Click += new System.EventHandler(this.ДокументыToolStripMenuItem_Click);
//
// магазинToolStripMenuItem
//
this.магазинToolStripMenuItem.Name = агазинToolStripMenuItem";
this.магазинToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.магазинToolStripMenuItem.Text = "Магазины";
this.магазинToolStripMenuItem.Click += new System.EventHandler(this.МагазиныToolStripMenuItem_Click);
//
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.DocumentsToolStripMenuItem,
this.documentsBlanksToolStripMenuItem,
this.ordersToolStripMenuItem,
this.загруженностьМагазиновToolStripMenuItem,
this.заказыПоДатеToolStripMenuItem,
this.списокМагазиновToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчетыToolStripMenuItem.Text = "Отчеты";
//
// DocumentsToolStripMenuItem
//
this.DocumentsToolStripMenuItem.Name = "DocumentsToolStripMenuItem";
this.DocumentsToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.DocumentsToolStripMenuItem.Text = "Список документов";
this.DocumentsToolStripMenuItem.Click += new System.EventHandler(this.DocumentsToolStripMenuItem_Click);
//
// documentsBlanksToolStripMenuItem
//
this.documentsBlanksToolStripMenuItem.Name = "documentsBlanksToolStripMenuItem";
this.documentsBlanksToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.documentsBlanksToolStripMenuItem.Text = "Изделия по деталям";
this.documentsBlanksToolStripMenuItem.Click += new System.EventHandler(this.documentBlanksToolStripMenuItem_Click);
//
// ordersToolStripMenuItem
//
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.ordersToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.ordersToolStripMenuItem_Click);
//
// загруженностьМагазиновToolStripMenuItem
//
this.загруженностьМагазиновToolStripMenuItem.Name = агруженностьМагазиновToolStripMenuItem";
this.загруженностьМагазиновToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.загруженностьМагазиновToolStripMenuItem.Text = "Загруженность магазинов";
this.загруженностьМагазиновToolStripMenuItem.Click += new System.EventHandler(this.ShopLoadToolStripMenuItem_Click);
//
// заказыПоДатеToolStripMenuItem
//
this.заказыПоДатеToolStripMenuItem.Name = аказыПоДатеToolStripMenuItem";
this.заказыПоДатеToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.заказыПоДатеToolStripMenuItem.Text = "Заказы по дате";
this.заказыПоДатеToolStripMenuItem.Click += new System.EventHandler(this.OrdersByDateToolStripMenuItem_Click);
//
// списокМагазиновToolStripMenuItem
//
this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.ListOfShopsToolStripMenuItem_Click);
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Left;
this.dataGridView.Location = new System.Drawing.Point(0, 24);
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(816, 332);
this.dataGridView.TabIndex = 6;
//
// ButtonAddDocument
//
this.ButtonAddDocument.Location = new System.Drawing.Point(841, 284);
this.ButtonAddDocument.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonAddDocument.Name = "ButtonAddDocument";
this.ButtonAddDocument.Size = new System.Drawing.Size(164, 25);
this.ButtonAddDocument.TabIndex = 7;
this.ButtonAddDocument.Text = "Добавить документ";
this.ButtonAddDocument.UseVisualStyleBackColor = true;
this.ButtonAddDocument.Click += new System.EventHandler(this.ButtonAddDocument_Click);
//
// ButtonSellDocument
//
this.ButtonSellDocument.Location = new System.Drawing.Point(841, 325);
this.ButtonSellDocument.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ButtonSellDocument.Name = "ButtonSellDocument";
this.ButtonSellDocument.Size = new System.Drawing.Size(164, 22);
this.ButtonSellDocument.TabIndex = 8;
this.ButtonSellDocument.Text = "Продать документ";
this.ButtonSellDocument.UseVisualStyleBackColor = true;
this.ButtonSellDocument.Click += new System.EventHandler(this.ButtonSellDocument_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1015, 356);
this.Controls.Add(this.ButtonSellDocument);
this.Controls.Add(this.ButtonAddDocument);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.ButtonRef);
this.Controls.Add(this.ButtonIssuedOrder);
this.Controls.Add(this.ButtonOrderReady);
this.Controls.Add(this.ButtonTakeOrderInWork);
this.Controls.Add(this.ButtonCreateOrder);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "FormMain";
this.Text = "LawFirm";
this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Button ButtonCreateOrder;
private Button ButtonTakeOrderInWork;
private Button ButtonOrderReady;
private Button ButtonIssuedOrder;
private Button ButtonRef;
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem ToolStripMenuItem;
private ToolStripMenuItem ДеталиToolStripMenuItem;
private ToolStripMenuItem ДокументыToolStripMenuItem;
private DataGridView dataGridView;
private Button buttonCreateOrder;
private Button buttonTakeOrderInWork;
private Button buttonOrderReady;
private Button buttonIssuedOrder;
private Button buttonUpdate;
private ToolStripMenuItem бланкиToolStripMenuItem;
private ToolStripMenuItem документыToolStripMenuItem;
private ToolStripMenuItem магазиныToolStripMenuItem;
private Button buttonAddDocument;
private Button buttonSellDocument;
}
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem DocumentsToolStripMenuItem;
private ToolStripMenuItem documentsBlanksToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
private ToolStripMenuItem магазинToolStripMenuItem;
private Button ButtonAddDocument;
private Button ButtonSellDocument;
private ToolStripMenuItem загруженностьМагазиновToolStripMenuItem;
private ToolStripMenuItem заказыПоДатеToolStripMenuItem;
private ToolStripMenuItem списокМагазиновToolStripMenuItem;
}
}

View File

@ -1,8 +1,15 @@
using LawFirmBusinessLogic.BusinessLogics;
using Microsoft.Extensions.Logging;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmDataModels.Enums;
using Microsoft.Extensions.Logging;
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 LawFirmView
@ -12,14 +19,15 @@ namespace LawFirmView
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic,IReportLogic reportlogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;
_reportLogic = reportlogic;
}
private void FormMain_Load(object sender, EventArgs e)
{
LoadData();
@ -35,7 +43,7 @@ namespace LawFirmView
dataGridView.DataSource = list;
dataGridView.Columns["DocumentId"].Visible = false;
}
_logger.LogInformation("Загрузка прошла успешно");
_logger.LogInformation("Загрузка заказов");
}
catch (Exception ex)
{
@ -43,6 +51,25 @@ namespace LawFirmView
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ДеталиToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormBlanks));
if (service is FormBlanks form)
{
form.ShowDialog();
}
}
private void ДокументыToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormDocuments));
if (service is FormDocuments form)
{
form.ShowDialog();
}
}
private void ButtonCreateOrder_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
@ -52,6 +79,7 @@ namespace LawFirmView
LoadData();
}
}
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
@ -60,9 +88,7 @@ namespace LawFirmView
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
try
{
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel{
Id = id,
});
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id});
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
@ -72,11 +98,12 @@ namespace LawFirmView
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка передачи заказа в работу");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void ButtonOrderReady_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
@ -85,13 +112,10 @@ namespace LawFirmView
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
try
{
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
{
Id = id
});
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
throw new Exception("Ошибка при сохранении.Дополнительная информация в логах.");
}
LoadData();
}
@ -102,20 +126,16 @@ namespace LawFirmView
}
}
}
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
int id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
try
{
var operationResult = _orderLogic.DeliveryOrder(new
OrderBindingModel
{
Id = id
});
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id});
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
@ -126,70 +146,46 @@ namespace LawFirmView
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
}
private void BlanksToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormBlanks));
if (service is FormBlanks form)
{
form.ShowDialog();
}
}
private void DocumentsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormDocuments));
if (service is FormDocuments form)
{
form.ShowDialog();
}
}
private void DocumentsReportToolStripMenuItem_Click(object sender, EventArgs
e)
private void DocumentsToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveBlanksToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information);
_reportLogic.SaveBlanksToWordFile(new ReportBindingModel { FileName = dialog.FileName });
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void DocumentBlanksReportToolStripMenuItem_Click(object sender,
EventArgs e)
private void documentBlanksToolStripMenuItem_Click(object sender, EventArgs e)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormReportDocumentBlanks));
var service = Program.ServiceProvider?.GetService(typeof(FormReportDocumentBlanks));
if (service is FormReportDocumentBlanks form)
{
form.ShowDialog();
}
}
private void OrdersReportToolStripMenuItem_Click(object sender, EventArgs e)
private void ordersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormReportOrders));
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
}
}
}
private void ShopToolStripMenuItem_Click(object sender, EventArgs e)
private void МагазиныToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
if (service is FormShops form)
@ -208,14 +204,42 @@ e)
}
}
private void ButtonSellDocument_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSellDocuments));
if (service is FormSellDocuments form)
{
form.ShowDialog();
LoadData();
}
}
}
private void ButtonSellDocument_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSellDocuments));
if (service is FormSellDocuments form)
{
form.ShowDialog();
LoadData();
}
}
private void ShopLoadToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopDocuments));
if (service is FormReportShopDocuments form)
{
form.ShowDialog();
}
}
private void OrdersByDateToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));
if (service is FormReportGroupedOrders form)
{
form.ShowDialog();
}
}
private void ListOfShopsToolStripMenuItem_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);
}
}
}
}

View File

@ -0,0 +1,86 @@
namespace LawFirmView
{
partial class FormReportGroupedOrders
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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(800, 44);
this.panel.TabIndex = 0;
//
// buttonToPdf
//
this.buttonToPdf.Location = new System.Drawing.Point(171, 12);
this.buttonToPdf.Name = "buttonToPdf";
this.buttonToPdf.Size = new System.Drawing.Size(160, 29);
this.buttonToPdf.TabIndex = 1;
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(12, 12);
this.buttonMake.Name = "buttonMake";
this.buttonMake.Size = new System.Drawing.Size(141, 29);
this.buttonMake.TabIndex = 0;
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(800, 450);
this.Controls.Add(this.panel);
this.Name = "FormReportGroupedOrders";
this.Text = "Заказы по дате";
this.panel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Panel panel;
private Button buttonMake;
private Button buttonToPdf;
}
}

View File

@ -0,0 +1,81 @@
using Microsoft.Extensions.Logging;
using Microsoft.Reporting.WinForms;
using LawFirmContracts.BindingModels;
using LawFirmContracts.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 LawFirmView
{
public partial class FormReportGroupedOrders : Form
{
private readonly ReportViewer reportViewer;
private readonly ILogger _logger;
private readonly IReportLogic _logic;
public FormReportGroupedOrders(ILogger<FormReportOrders> 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.GetGroupedByDateOrders();
var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
reportViewer.RefreshReport();
_logger.LogInformation("Загрузка списка заказов сгрупированных по дате");
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки списка заказов сгрупированных по дате");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonToPdf_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
_logic.SaveGroupedByDateOrders(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);
}
}
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,108 @@
namespace LawFirmView
{
partial class FormReportShopDocuments
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ButtonSaveToExcel = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.ShopColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DocumentColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CountColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// ButtonSaveToExcel
//
this.ButtonSaveToExcel.Location = new System.Drawing.Point(12, 12);
this.ButtonSaveToExcel.Name = "ButtonSaveToExcel";
this.ButtonSaveToExcel.Size = new System.Drawing.Size(145, 29);
this.ButtonSaveToExcel.TabIndex = 0;
this.ButtonSaveToExcel.Text = "Сохранить в excel";
this.ButtonSaveToExcel.UseVisualStyleBackColor = true;
this.ButtonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ShopColumn,
this.DocumentColumn,
this.CountColumn});
this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
this.dataGridView.Location = new System.Drawing.Point(0, 64);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersWidth = 51;
this.dataGridView.RowTemplate.Height = 29;
this.dataGridView.Size = new System.Drawing.Size(504, 417);
this.dataGridView.TabIndex = 1;
//
// ShopColumn
//
this.ShopColumn.HeaderText = "Магазин";
this.ShopColumn.MinimumWidth = 6;
this.ShopColumn.Name = "ShopColumn";
this.ShopColumn.Width = 125;
//
// DocumentColumn
//
this.DocumentColumn.HeaderText = "Документ";
this.DocumentColumn.MinimumWidth = 6;
this.DocumentColumn.Name = "DocumentColumn";
this.DocumentColumn.Width = 125;
//
// CountColumn
//
this.CountColumn.HeaderText = "Количество";
this.CountColumn.MinimumWidth = 6;
this.CountColumn.Name = "CountColumn";
this.CountColumn.Width = 125;
//
// FormReportShopDocuments
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(504, 481);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.ButtonSaveToExcel);
this.Name = "FormReportShopDocuments";
this.Text = "Магазины и документы";
this.Load += new System.EventHandler(this.FormReportShopDocuments_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Button ButtonSaveToExcel;
private DataGridView dataGridView;
private DataGridViewTextBoxColumn ShopColumn;
private DataGridViewTextBoxColumn DocumentColumn;
private DataGridViewTextBoxColumn CountColumn;
}
}

View File

@ -0,0 +1,79 @@
using Microsoft.Extensions.Logging;
using LawFirmContracts.BindingModels;
using LawFirmContracts.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 LawFirmView
{
public partial class FormReportShopDocuments : Form
{
private readonly ILogger _logger;
private readonly IReportLogic _logic;
public FormReportShopDocuments(ILogger<FormReportDocumentBlanks> logger, IReportLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
private void FormReportShopDocuments_Load(object sender, EventArgs e)
{
try
{
var dict = _logic.GetShopDocuments();
if (dict != null)
{
dataGridView.Rows.Clear();
foreach (var elem in dict)
{
dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
foreach (var listElem in elem.Documents)
{
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
}
dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
dataGridView.Rows.Add(Array.Empty<object>());
}
}
_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.SaveShopDocumentToExcelFile(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);
}
}
}
}
}

View File

@ -0,0 +1,78 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ShopColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DocumentColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CountColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ShopColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DocumentColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CountColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -28,6 +28,9 @@
</ItemGroup>
<ItemGroup>
<None Update="ReportGroupedOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

View File

@ -60,10 +60,11 @@ namespace LawFirmView
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormAddDocument>();
services.AddTransient<FormSellDocuments>();
}
services.AddTransient<FormSellDocuments>();
services.AddTransient<FormReportDocumentBlanks>();
services.AddTransient<FormReportOrders>();
}
services.AddTransient<FormReportShopDocuments>();
services.AddTransient<FormReportGroupedOrders>();
}
}
}

View File

@ -0,0 +1,411 @@
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="LawFirmContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>10791c83-cee8-4a38-bbd0-245fc17cefb3</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSetOrders">
<Query>
<DataSourceName>LawFirmContractsViewModels</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="Date">
<DataField>Date</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="Count">
<DataField>Count</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="Sum">
<DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>LawFirmContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrdersGroupedByDateViewModel</rd:TableName>
<rd:ObjectDataSourceType>LawFirmContracts.ViewModels.ReportOrdersGroupedByDateViewModel, LawFirmContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportSections>
<ReportSection>
<Body>
<ReportItems>
<Textbox Name="Textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Заказы</Value>
<Style>
<FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName>
<Height>0.70583cm</Height>
<Width>19.67885cm</Width>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="Tablix1">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>4.56494cm</Width>
</TablixColumn>
<TablixColumn>
<Width>4.56494cm</Width>
</TablixColumn>
<TablixColumn>
<Width>2.5cm</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.74083cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Date</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Count</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox4</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox8">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Sum</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox8</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.74083cm</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Date">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Date.Value</Value>
<Style>
<Format>d</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Date</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Count">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Count.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Count</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Sum">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Sum.Value</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="Подробности" />
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSetOrders</DataSetName>
<Top>1.87537cm</Top>
<Left>4.83399cm</Left>
<Height>1.48166cm</Height>
<Width>11.62988cm</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
<Textbox Name="TextboxTotal">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Итого:</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Top>4.0132cm</Top>
<Left>11.46387cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<ZIndex>2</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="TextboxTotalSum">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!Sum.Value, "DataSetOrders")</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<Top>4.0132cm</Top>
<Left>13.96387cm</Left>
<Height>0.6cm</Height>
<Width>2.5cm</Width>
<ZIndex>3</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<Height>2in</Height>
<Style />
</Body>
<Width>8.08183in</Width>
<Page>
<PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth>
<LeftMargin>2cm</LeftMargin>
<RightMargin>2cm</RightMargin>
<TopMargin>2cm</TopMargin>
<BottomMargin>2cm</BottomMargin>
<ColumnSpacing>0.13cm</ColumnSpacing>
<Style />
</Page>
</ReportSection>
</ReportSections>
<ReportParameters>
<ReportParameter Name="ReportParameterPeriod">
<DataType>String</DataType>
<Nullable>true</Nullable>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters>
<ReportParametersLayout>
<GridLayoutDefinition>
<NumberOfColumns>4</NumberOfColumns>
<NumberOfRows>2</NumberOfRows>
<CellDefinitions>
<CellDefinition>
<ColumnIndex>0</ColumnIndex>
<RowIndex>0</RowIndex>
<ParameterName>ReportParameterPeriod</ParameterName>
</CellDefinition>
</CellDefinitions>
</GridLayoutDefinition>
</ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>32707729-e749-46dd-a114-7c43e1a2a795</rd:ReportID>
</Report>