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 IPrintingHouseRepository _printingHouseRepository;
|
||||
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)
|
||||
{
|
||||
@ -28,9 +28,9 @@ public class TableReport
|
||||
try
|
||||
{
|
||||
new ExcelBuilder(filePath)
|
||||
.AddHeader("Сводка", 0, 4)
|
||||
.AddHeader("Сводка заказов", 0, 4)
|
||||
.AddParagraph("за период", 0)
|
||||
.AddTable([10, 15, 15], GetData(startDate, endDate))
|
||||
.AddTable([10, 10, 15, 15], GetData(startDate, endDate))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
@ -46,19 +46,19 @@ public class TableReport
|
||||
var data = _printingHouseRepository
|
||||
.ReadPrintingHouses()
|
||||
.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(
|
||||
_materialRepository
|
||||
.ReadMaterials()
|
||||
.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);
|
||||
return
|
||||
new List<string[]>() { item }
|
||||
.Union(
|
||||
data
|
||||
.Select(x => new string[] {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()]])
|
||||
.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()]])
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user