Все работает, только ид клиентов не отображается в эксель таблице

This commit is contained in:
Tonb73 2024-12-05 20:10:39 +03:00
parent 09255cb1c5
commit 28d32ae5ba
3 changed files with 8 additions and 7 deletions

View File

@ -77,7 +77,8 @@ namespace ProjectTourAgency.Forms
list.Add(ClientTour.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnClient"].Value), 0, list.Add(ClientTour.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnClient"].Value), 0,
Convert.ToInt32(row.Cells["ColumnCost"].Value))); Convert.ToInt32(row.Cells["ColumnCost"].Value)));
} }
return list; return list.GroupBy(x => x.ClientId, x => x.Cost, (id, costs) =>
ClientTour.CreateEntity(0, id, 0, costs.Sum())).ToList();
} }
} }

View File

@ -84,7 +84,7 @@ namespace ProjectTourAgency.Forms
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false; return false;
} }
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["ID"].Value); id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true; return true;
} }
} }

View File

@ -16,7 +16,7 @@ internal class TableReport
private readonly ILogger<TableReport> _logger; private readonly ILogger<TableReport> _logger;
internal static readonly string[] item = ["Клиент","Дата","Списания","Пополнения"]; internal static readonly string[] item = ["Клиент","Дата","Пополнения","Списания"];
public TableReport(IAddMoneyRepository addMoneyRepository, public TableReport(IAddMoneyRepository addMoneyRepository,
ITourRepository tourRepository, ILogger<TableReport> logger) ITourRepository tourRepository, ILogger<TableReport> logger)
@ -52,16 +52,16 @@ internal class TableReport
endDate) endDate)
{ {
var data = _tourRepository.ReadTours().Select(x => new { var data = _tourRepository.ReadTours().Select(x => new {
ClientId = 73, ClientId = (int ?)x.ClientTours.Sum(x => x.ClientId),
Date = x.DepartureDate, Date = x.DepartureDate,
CountIn = (int?)null, CountIn = (int?)null,
CountOut = (int?)null CountOut = (int?)x.ClientTours.Sum(x => x.Cost)
}) })
.Union( .Union(
_addMoneyRepository.ReadAddMoneys().Select(x => new { _addMoneyRepository.ReadAddMoneys().Select(x => new {
ClientId = x.ClientId, ClientId = (int?)x.ClientId,
Date = x.Date, Date = x.Date,
CountIn = (int?)null, CountIn = (int?)x.MoneyAmount,
CountOut= (int?)null }) CountOut= (int?)null })
) )
.OrderBy(x => x.Date); .OrderBy(x => x.Date);