доработка логики отчетов

This commit is contained in:
Мк Игорь 2023-04-08 14:02:29 +04:00
parent 168611ec1d
commit 7b63e421fc
2 changed files with 6 additions and 4 deletions

View File

@ -8,21 +8,23 @@ namespace CarServiceBusinessLogic.BusinessLogics
{ {
public class ReportLogic : IReportLogic public class ReportLogic : IReportLogic
{ {
//private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IWorkStorage _workStorage; private readonly IWorkStorage _workStorage;
private readonly IWorkPaymentStorage _workPaymentStorage; private readonly IWorkPaymentStorage _workPaymentStorage;
public ReportLogic(/*ILogger logger,*/ IWorkStorage workStorage, IWorkPaymentStorage workPaymentStorage) public ReportLogic(ILogger logger, IWorkStorage workStorage, IWorkPaymentStorage workPaymentStorage)
{ {
//_logger = logger; _logger = logger;
_workStorage = workStorage; _workStorage = workStorage;
_workPaymentStorage = workPaymentStorage; _workPaymentStorage = workPaymentStorage;
} }
public List<ReportWorkWithRequestsViewModel> GetRequestsByWorks(ReportBindingModel model) public List<ReportWorkWithRequestsViewModel> GetRequestsByWorks(ReportBindingModel model)
{ {
_logger.LogInformation("Reading requests by works");
return _workStorage.GetWorksWithRequest(new() { SelectedWorksIds = model.SelectedWorks }); return _workStorage.GetWorksWithRequest(new() { SelectedWorksIds = model.SelectedWorks });
} }
public List<ReportWorksWithPaymentsViewModel> GetPayments(ReportBindingModel model) public List<ReportWorksWithPaymentsViewModel> GetPayments(ReportBindingModel model)
{ {
_logger.LogInformation("Reading payments by works in requests");
return _workPaymentStorage.GetPaymentsByWorks(new() {DateFrom = model.DateFrom, DateTo = model.DateTo }); return _workPaymentStorage.GetPaymentsByWorks(new() {DateFrom = model.DateFrom, DateTo = model.DateTo });
} }
public void SaveComponentsToWordFile(ReportBindingModel model) public void SaveComponentsToWordFile(ReportBindingModel model)

View File

@ -47,7 +47,7 @@ namespace CarServiceDatabase.Implements
using var context = new CarServiceDbContext(); using var context = new CarServiceDbContext();
return context.WorkPayments return context.WorkPayments
.Include(wp => wp.WorkInRequest) .Include(wp => wp.WorkInRequest)
.ThenInclude(wir => wir.Work)//добираемся до названия работы .ThenInclude(wir => wir.Work)
.Include(wp => wp.WorkInRequest) .Include(wp => wp.WorkInRequest)
.ThenInclude(wir => wir.RepairRequest) .ThenInclude(wir => wir.RepairRequest)
.ThenInclude(rr => rr.Vehicle) .ThenInclude(rr => rr.Vehicle)