diff --git a/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/ChartReport.cs b/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/ChartReport.cs index 08af5c1..20044ac 100644 --- a/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/ChartReport.cs +++ b/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/ChartReport.cs @@ -29,7 +29,7 @@ internal class ChartReport { new PdfBuilder(filePath) .AddHeader("Передача товара агентам-реализаторам") - .AddPieChart("Выдача товара", GetData(dateTime)) + .AddPieChart($"Выданный товар на {dateTime:dd MMMM yyyy}", GetData(dateTime)) .Build(); return true; } @@ -43,14 +43,14 @@ internal class ChartReport private List<(string Caption, double Value)> GetData(DateTime dateTime) { return _delegateToAgentRepository - .ReadDelegatesToAgent() + .ReadDelegatesToAgent(dateFrom: dateTime, dateTo: dateTime.Date.AddDays(1)) .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) }) - .Select(x => (x.Id.ToString(), (double)x.Quantity)) + .Select(x => (x.ProductName, (double)x.Quantity)) .ToList(); } } diff --git a/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/TableReport.cs b/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/TableReport.cs index e113a57..7736d47 100644 --- a/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/TableReport.cs +++ b/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Reports/TableReport.cs @@ -55,7 +55,7 @@ internal class TableReport .Select(x => new { x.AgentsName, - CurrentDate = x.SaleDate, + Date = x.SaleDate, CountIn = (int?)null, CountOut = x.ProductSales.FirstOrDefault(y => y.ProductArticle == productArticle)?.ProductQuantity }) @@ -66,17 +66,17 @@ internal class TableReport .Select(x => new { x.AgentsName, - CurrentDate = x.Date, + Date = x.Date, CountIn = (int?)x.Quantity, CountOut = (int?)null })) - .OrderBy(x => x.CurrentDate); + .OrderBy(x => x.Date); return new List() { item } .Union( 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( [["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]]) .ToList(); diff --git a/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Repositories/Implementations/ContractRepository.cs b/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Repositories/Implementations/ContractRepository.cs index 7ab264a..0f57157 100644 --- a/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Repositories/Implementations/ContractRepository.cs +++ b/TradeAndProcurementEnterprice/TradeAndProcurementEnterprice/Repositories/Implementations/ContractRepository.cs @@ -66,7 +66,7 @@ VALUES (@ID, @ProductArticle, @ProductQuantity)"; var builder = new QueryBuilder(); if (dateFrom.HasValue) { - builder.AddCondition("c.SaleDate >= @dateForm"); + builder.AddCondition("c.SaleDate >= @dateFrom"); } if (dateTo.HasValue) { @@ -74,7 +74,7 @@ VALUES (@ID, @ProductArticle, @ProductQuantity)"; } if (productArticle.HasValue) { - builder.AddCondition("c.ProductArticle = @productArticle"); + builder.AddCondition("ps.ProductArticle = @productArticle"); } if (agentID.HasValue) {