Лабораторная работа 4
This commit is contained in:
parent
8ff00e215b
commit
b92d13c0ee
@ -11,12 +11,12 @@ internal class ChartReport
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<ChartReport> _logger;
|
||||
|
||||
public ChartReport(IConnectionString connectionString, ICheckRepository checkRepository, IProductRepository productRepository, ILoggerFactory loggerFactory)
|
||||
public ChartReport(ICheckRepository checkRepository, IProductRepository productRepository, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_checkRepository = checkRepository ?? throw new ArgumentNullException(nameof(checkRepository));
|
||||
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
|
||||
_logger = loggerFactory.CreateLogger<ChartReport>();
|
||||
_connectionString = connectionString ?? throw new ArgumentNullException(nameof(checkRepository));
|
||||
|
||||
}
|
||||
|
||||
public bool CreateChart(string filePath, DateTime dateTime)
|
||||
@ -25,7 +25,7 @@ internal class ChartReport
|
||||
{
|
||||
new PdfBuilder(filePath)
|
||||
.AddHeader("Отчет по продажам товаров")
|
||||
.AddPieChart("Проданные товары за" + dateTime.ToLongDateString(), GetData(dateTime)) // Диаграмма с продуктами
|
||||
.AddPieChart("Проданные товары", GetData(dateTime))
|
||||
.Build();
|
||||
|
||||
return true;
|
||||
|
@ -12,11 +12,10 @@ internal class TableReport
|
||||
|
||||
internal static readonly string[] Headers = { "Клиент", "Дата", "Количество" };
|
||||
|
||||
public TableReport(IClientRepository clientRepository, ICheckRepository checkRepository, IProductRepository productRepository, ILoggerFactory loggerFactory)
|
||||
public TableReport(ICheckRepository checkRepository, IProductRepository productRepository, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_checkRepository = checkRepository ?? throw new ArgumentNullException(nameof(checkRepository));
|
||||
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
|
||||
_clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository));
|
||||
_logger = loggerFactory.CreateLogger<TableReport>();
|
||||
}
|
||||
|
||||
@ -25,7 +24,7 @@ internal class TableReport
|
||||
try
|
||||
{
|
||||
new ExcelBuilder(filePath)
|
||||
.AddHeader("Отчет по продажам товара " + _productRepository.Read(productId).Name, 0, 3)
|
||||
.AddHeader("Отчет по продажам товара ", 0, 3)
|
||||
.AddParagraph($"за период с {startDate.ToShortDateString()} по {endDate.ToShortDateString()}", 0)
|
||||
.AddTable(new[] { 20, 20, 15 }, GetData(productId, startDate, endDate))
|
||||
.Build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user