ИСЭбд-21.Васильева.С.В. 4 лабораторная работа #4
@ -25,8 +25,11 @@ public class Order
|
||||
[Browsable(false)]
|
||||
public IEnumerable<OrderProduct> 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> orderProduct, int idClient, DateTime dateTime)
|
||||
{
|
||||
|
@ -34,8 +34,9 @@ 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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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<int, List<OrderProduct>>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user