ауауа
This commit is contained in:
parent
858ab6b996
commit
abb18b87a2
@ -8,6 +8,7 @@ using CarCenterBusinessLogic.OfficePackage;
|
||||
using CarCenterDatabaseImplement.Models;
|
||||
using System.Linq;
|
||||
using CarCenterDataModels.Models;
|
||||
using CarCenterBusinessLogic.BusinessLogics;
|
||||
|
||||
namespace StorekeeperApp
|
||||
{
|
||||
@ -131,7 +132,147 @@ namespace StorekeeperApp
|
||||
{
|
||||
return _orderLogic.ReadList(null);
|
||||
}
|
||||
|
||||
public List<ReportServiceViewModel> GetTimeReport(DateTime? startDate, DateTime? endDate, int UserId)
|
||||
{
|
||||
var services = _serviceLogic.ReadList(new() { DateFrom = startDate, DateTo = endDate, StorekeeperId = UserId });
|
||||
if (services == null)
|
||||
return new();
|
||||
List<ReportServiceViewModel> serviceTimeReports = new List<ReportServiceViewModel>();
|
||||
foreach (var service in services)
|
||||
{
|
||||
var report = new ReportServiceViewModel();
|
||||
report.ServiceId = service.Id;
|
||||
|
||||
List<ProcedureViewModel> prs = new List<ProcedureViewModel>();
|
||||
HashSet<OrderViewModel> filteredOrders = new HashSet<OrderViewModel>();
|
||||
|
||||
var procedures = _procedureLogic.ReadList(null);//get all procedures
|
||||
var orders = _orderLogic.ReadList(null); //get all orders
|
||||
|
||||
foreach (var p in procedures)
|
||||
{
|
||||
foreach(var s in p.ProcedureServices)
|
||||
{
|
||||
if(s.Value.Id == service.Id)
|
||||
{
|
||||
prs.Add(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var o in orders)
|
||||
{
|
||||
foreach (var p in prs)
|
||||
{
|
||||
foreach (var op in o.OrderProcedures)
|
||||
{
|
||||
if(op.Value.Id == p.Id)
|
||||
{
|
||||
filteredOrders.Add(o); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<int> laborcosts = new HashSet<int>();
|
||||
var cosmetics = _cosmeticLogic.ReadList(null);
|
||||
|
||||
foreach(var c in cosmetics)
|
||||
{
|
||||
foreach(var s in c.CosmeticServices)
|
||||
{
|
||||
if(s.Value.Id == service.Id)
|
||||
{
|
||||
laborcosts.Add(c.LaborCostID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*var orders = _orderLogic.ReadList(null);
|
||||
|
||||
HashSet<OrderViewModel> filteredOrders = new HashSet<OrderViewModel>();
|
||||
List<ILaborCostModel> rmodels = new List<ILaborCostModel>();
|
||||
HashSet<ILaborCostModel> laborcosts = new HashSet<ILaborCostModel>();
|
||||
|
||||
if (order.OrderProcedures != null && services != null)
|
||||
{
|
||||
var proceduresO = new HashSet<IProcedureModel>(order.OrderProcedures.Values);//получаем процедуры,
|
||||
//фигурирующие в заказе
|
||||
|
||||
var procedures = _procedureLogic.ReadList(null);//все процедуры в формате ViewMode
|
||||
|
||||
|
||||
foreach (var procedure in proceduresO)
|
||||
{
|
||||
foreach (var pr in procedures)
|
||||
{
|
||||
if (procedure.Id == pr.Id)
|
||||
{
|
||||
foreach (var point in pr.Ratings)
|
||||
{
|
||||
rmodels.Add(point.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<IServiceModel> servs = new List<IServiceModel>();//заполняем услугами из процедур
|
||||
//(тут еще пока IServiceMOdel и повторы)
|
||||
|
||||
foreach (var p in procedures)
|
||||
{
|
||||
foreach (var pc in proceduresO)
|
||||
{
|
||||
if (p.Id == pc.Id)
|
||||
{
|
||||
foreach (var s in p.ProcedureServices)
|
||||
{
|
||||
servs.Add(s.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var sv in servs)
|
||||
{
|
||||
foreach (var s in services)
|
||||
{
|
||||
if (sv.Id == s.Id)
|
||||
{
|
||||
filteredServices.Add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var rats = _ratingLogic.ReadList(null);
|
||||
foreach (var rats1 in rats)
|
||||
{
|
||||
foreach (var r1 in rmodels)
|
||||
{
|
||||
if (rats1.Id == r1.Id)
|
||||
{
|
||||
ratings.Add(rats1.Points);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
report.Orders = filteredOrders.Select(w => w.Id.ToString()).ToList();
|
||||
foreach (int l in laborcosts)
|
||||
{
|
||||
report.LaborCosts.Add(l.ToString());
|
||||
}
|
||||
|
||||
serviceTimeReports.Add(report);
|
||||
}
|
||||
return serviceTimeReports;
|
||||
}
|
||||
|
||||
|
||||
/*public List<ReportServiceViewModel> GetTimeReport(DateTime? startDate, DateTime? endDate, int UserId)
|
||||
{
|
||||
var services = _serviceLogic.ReadList(new() { DateFrom = startDate, DateTo = endDate, StorekeeperId = UserId });
|
||||
if (services == null)
|
||||
@ -150,7 +291,7 @@ namespace StorekeeperApp
|
||||
serviceTimeReports.Add(report);
|
||||
}
|
||||
return serviceTimeReports;
|
||||
}
|
||||
}*/
|
||||
|
||||
public List<ReportCosmeticViewModel>? GetProcedureReports(List<int> cosmetics)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user