Merge branch 'LabWork3' into LabWork4
This commit is contained in:
commit
bc81a5f7bf
@ -14,7 +14,7 @@ public class TableReport
|
|||||||
private readonly IMaterialRepository _materialRepository;
|
private readonly IMaterialRepository _materialRepository;
|
||||||
private readonly IPrintingHouseRepository _printingHouseRepository;
|
private readonly IPrintingHouseRepository _printingHouseRepository;
|
||||||
private readonly ILogger<TableReport> _logger;
|
private readonly ILogger<TableReport> _logger;
|
||||||
internal static readonly string[] item = ["Дата", "Количество пришло", "Количество ушло"];
|
internal static readonly string[] item = ["Id","Дата", "Количество заказов пришло", "Количество заказов ушло"];
|
||||||
|
|
||||||
public TableReport(IPrintingHouseRepository printingHouseRepository, IMaterialRepository materialRepository, ILogger<TableReport> logger)
|
public TableReport(IPrintingHouseRepository printingHouseRepository, IMaterialRepository materialRepository, ILogger<TableReport> logger)
|
||||||
{
|
{
|
||||||
@ -28,9 +28,9 @@ public class TableReport
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
new ExcelBuilder(filePath)
|
new ExcelBuilder(filePath)
|
||||||
.AddHeader("Сводка", 0, 4)
|
.AddHeader("Сводка заказов", 0, 4)
|
||||||
.AddParagraph("за период", 0)
|
.AddParagraph("за период", 0)
|
||||||
.AddTable([10, 15, 15], GetData(startDate, endDate))
|
.AddTable([10, 10, 15, 15], GetData(startDate, endDate))
|
||||||
.Build();
|
.Build();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -46,19 +46,19 @@ public class TableReport
|
|||||||
var data = _printingHouseRepository
|
var data = _printingHouseRepository
|
||||||
.ReadPrintingHouses()
|
.ReadPrintingHouses()
|
||||||
.Where(x => x.Date >= startDate && x.Date <= endDate && x.printingHouseOrder.Any(y => y.PrintingHouseId == x.Id))
|
.Where(x => x.Date >= startDate && x.Date <= endDate && x.printingHouseOrder.Any(y => y.PrintingHouseId == x.Id))
|
||||||
.Select(x => new { x.Date, CountIn = (int?)null, CountOut = (int?)x.printingHouseOrder.First(y => y.PrintingHouseId == x.Id).Count })
|
.Select(x => new {x.Id, x.Date, CountIn = (int?)null, CountOut = (int?)x.printingHouseOrder.First(y => y.PrintingHouseId == x.Id).Count })
|
||||||
.Union(
|
.Union(
|
||||||
_materialRepository
|
_materialRepository
|
||||||
.ReadMaterials()
|
.ReadMaterials()
|
||||||
.Where(x => x.DateMaterials >= startDate && x.DateMaterials <= endDate)
|
.Where(x => x.DateMaterials >= startDate && x.DateMaterials <= endDate)
|
||||||
.Select(x => new {Date = x.DateMaterials, CountIn = (int?)x.Count, CountOut = (int?)null }))
|
.Select(x => new {x.Id, Date = x.DateMaterials, CountIn = (int?)x.Count, CountOut = (int?)null }))
|
||||||
.OrderBy(x => x.Date);
|
.OrderBy(x => x.Date);
|
||||||
return
|
return
|
||||||
new List<string[]>() { item }
|
new List<string[]>() { item }
|
||||||
.Union(
|
.Union(
|
||||||
data
|
data
|
||||||
.Select(x => new string[] {x.Date.ToString(), x.CountIn?.ToString() ?? string.Empty, x.CountOut?.ToString() ?? string.Empty }))
|
.Select(x => new string[] {x.Id.ToString(), x.Date.ToString(), x.CountIn?.ToString() ?? string.Empty, x.CountOut?.ToString() ?? string.Empty }))
|
||||||
.Union([["Всего", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]])
|
.Union([["", "Всего", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]])
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user