Лаба4, готовая.
This commit is contained in:
parent
c9d4eb055c
commit
44f1466fa8
@ -29,7 +29,7 @@ internal class ChartReport
|
|||||||
{
|
{
|
||||||
new PdfBuilder(filePath)
|
new PdfBuilder(filePath)
|
||||||
.AddHeader("Передача товара агентам-реализаторам")
|
.AddHeader("Передача товара агентам-реализаторам")
|
||||||
.AddPieChart("Выдача товара", GetData(dateTime))
|
.AddPieChart($"Выданный товар на {dateTime:dd MMMM yyyy}", GetData(dateTime))
|
||||||
.Build();
|
.Build();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -43,14 +43,14 @@ internal class ChartReport
|
|||||||
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
||||||
{
|
{
|
||||||
return _delegateToAgentRepository
|
return _delegateToAgentRepository
|
||||||
.ReadDelegatesToAgent()
|
.ReadDelegatesToAgent(dateFrom: dateTime, dateTo: dateTime.Date.AddDays(1))
|
||||||
.Where(x => x.Date.Date == dateTime.Date)
|
.Where(x => x.Date.Date == dateTime.Date)
|
||||||
.GroupBy(x => x.ProductArticle, (key, group) => new
|
.GroupBy(x => x.ProductName, (key, group) => new
|
||||||
{
|
{
|
||||||
Id = key,
|
ProductName = key,
|
||||||
Quantity = group.Sum(x => x.Quantity)
|
Quantity = group.Sum(x => x.Quantity)
|
||||||
})
|
})
|
||||||
.Select(x => (x.Id.ToString(), (double)x.Quantity))
|
.Select(x => (x.ProductName, (double)x.Quantity))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ internal class TableReport
|
|||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
x.AgentsName,
|
x.AgentsName,
|
||||||
CurrentDate = x.SaleDate,
|
Date = x.SaleDate,
|
||||||
CountIn = (int?)null,
|
CountIn = (int?)null,
|
||||||
CountOut = x.ProductSales.FirstOrDefault(y => y.ProductArticle == productArticle)?.ProductQuantity
|
CountOut = x.ProductSales.FirstOrDefault(y => y.ProductArticle == productArticle)?.ProductQuantity
|
||||||
})
|
})
|
||||||
@ -66,17 +66,17 @@ internal class TableReport
|
|||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
x.AgentsName,
|
x.AgentsName,
|
||||||
CurrentDate = x.Date,
|
Date = x.Date,
|
||||||
CountIn = (int?)x.Quantity,
|
CountIn = (int?)x.Quantity,
|
||||||
CountOut = (int?)null
|
CountOut = (int?)null
|
||||||
}))
|
}))
|
||||||
.OrderBy(x => x.CurrentDate);
|
.OrderBy(x => x.Date);
|
||||||
|
|
||||||
return
|
return
|
||||||
new List<string[]>() { item }
|
new List<string[]>() { item }
|
||||||
.Union(
|
.Union(
|
||||||
data
|
data
|
||||||
.Select(x => new string[] { x.AgentsID.ToString(), x.CurrentDate.ToString(), x.CountIn?.ToString() ?? string.Empty, x.CountOut?.ToString() ?? string.Empty }))
|
.Select(x => new string[] { x.AgentsName.ToString(), x.Date.ToString(), x.CountIn?.ToString() ?? string.Empty, x.CountOut?.ToString() ?? string.Empty }))
|
||||||
.Union(
|
.Union(
|
||||||
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]])
|
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]])
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -66,7 +66,7 @@ VALUES (@ID, @ProductArticle, @ProductQuantity)";
|
|||||||
var builder = new QueryBuilder();
|
var builder = new QueryBuilder();
|
||||||
if (dateFrom.HasValue)
|
if (dateFrom.HasValue)
|
||||||
{
|
{
|
||||||
builder.AddCondition("c.SaleDate >= @dateForm");
|
builder.AddCondition("c.SaleDate >= @dateFrom");
|
||||||
}
|
}
|
||||||
if (dateTo.HasValue)
|
if (dateTo.HasValue)
|
||||||
{
|
{
|
||||||
@ -74,7 +74,7 @@ VALUES (@ID, @ProductArticle, @ProductQuantity)";
|
|||||||
}
|
}
|
||||||
if (productArticle.HasValue)
|
if (productArticle.HasValue)
|
||||||
{
|
{
|
||||||
builder.AddCondition("c.ProductArticle = @productArticle");
|
builder.AddCondition("ps.ProductArticle = @productArticle");
|
||||||
}
|
}
|
||||||
if (agentID.HasValue)
|
if (agentID.HasValue)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user