diff --git a/ProjectAtelier/Entities/Order.cs b/ProjectAtelier/Entities/Order.cs index 5caa556..f8f6e92 100644 --- a/ProjectAtelier/Entities/Order.cs +++ b/ProjectAtelier/Entities/Order.cs @@ -25,8 +25,11 @@ public class Order [Browsable(false)] public IEnumerable OrderProduct { get; private set; } = []; - [DisplayName("Номер(id) клиента")] + + [Browsable(false)] public int IdClient { get; private set; } + [DisplayName("Имя клиента")] + public string NameClient { get; private set; } = string.Empty; public static Order CreateOperation(int id, OrderStatus status, string characteristic, IEnumerable orderProduct, int idClient, DateTime dateTime) { diff --git a/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs b/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs index 6bf888c..5e66d89 100644 --- a/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs +++ b/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs @@ -66,10 +66,10 @@ public class MaterialReplenishmentRepository : IMaterialReplenishmentRepository } public IEnumerable ReadMaterialsSpent(DateTime? dateForm = null, DateTime? dateTo = null, string? materialName = null) { - var builder = new QueryBuilder(); - if (dateForm.HasValue) + var builder = new QueryBuilder(); + if (dateForm.HasValue) { - builder.AddCondition("DataTime >= @dateForm"); + builder.AddCondition("DataTime >= @dateForm"); } if (dateTo.HasValue) { diff --git a/ProjectAtelier/Reports/ExcelBuilder.cs b/ProjectAtelier/Reports/ExcelBuilder.cs index 30862d4..9274f57 100644 --- a/ProjectAtelier/Reports/ExcelBuilder.cs +++ b/ProjectAtelier/Reports/ExcelBuilder.cs @@ -34,14 +34,15 @@ internal class ExcelBuilder _rowIndex = 1; } - public ExcelBuilder AddHeader(string header, int startIndex, int count) + public ExcelBuilder AddHeader(string headerPrefix, string materialName, int startIndex, int count) { + string header = $"{headerPrefix}{materialName}"; CreateCell(startIndex, _rowIndex, header, StyleIndex.BoldTextWithoutBorder); for (int i = startIndex + 1; i < startIndex + count; ++i) { CreateCell(i, _rowIndex, "", StyleIndex.SimpleTextWithoutBorder); } - + _mergeCells.Append(new MergeCell() { Reference = new StringValue($"{GetExcelColumnName(startIndex)}{_rowIndex}:{GetExcelColumnName(startIndex + count - 1)}{_rowIndex}") diff --git a/ProjectAtelier/Reports/TableReport.cs b/ProjectAtelier/Reports/TableReport.cs index 520d41a..90bd4db 100644 --- a/ProjectAtelier/Reports/TableReport.cs +++ b/ProjectAtelier/Reports/TableReport.cs @@ -30,9 +30,10 @@ internal class TableReport { try { + var materialName = _materialRepository.ReadMaterialById(materialId).Name; new ExcelBuilder(filePath) - .AddHeader("Сводка по движению материала", 0, 3) - .AddParagraph($"за период c {startDate:dd.MM.yyyy} по {endDate:dd.MM.yyyy}", 0) + .AddHeader("Сводка по движению материала- ", materialName, 0, 3) + .AddParagraph($"за период c {startDate:dd.MM.yyyy} по {endDate:dd.MM.yyyy}", 0) .AddTable([10, 15, 15], GetData(materialId, startDate, endDate)) .Build(); return true; diff --git a/ProjectAtelier/Repositories/Implementations/OrderRepository.cs b/ProjectAtelier/Repositories/Implementations/OrderRepository.cs index 21ebbfe..bcf4288 100644 --- a/ProjectAtelier/Repositories/Implementations/OrderRepository.cs +++ b/ProjectAtelier/Repositories/Implementations/OrderRepository.cs @@ -1,4 +1,5 @@ using Dapper; +using DocumentFormat.OpenXml.Drawing; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Npgsql; @@ -82,10 +83,12 @@ public class OrderRepository : IOrderRepository { using var connection = new NpgsqlConnection(_connectionString.ConnectionString); var querySelect = @" - SELECT orders.*, products.id AS productid, products.name AS productname, op.count AS count + SELECT orders.*, clients.name AS NameClient, products.id AS productid, products.name AS productname, op.count AS count FROM orders INNER JOIN order_products AS op ON orders.id = op.orderid - INNER JOIN products ON op.productid = products.id"; + INNER JOIN products ON op.productid = products.id + + INNER JOIN clients ON orders.idclient = clients.id"; var productsDict = new Dictionary>();