This commit is contained in:
Дмитрий Блохин 2024-04-18 18:39:10 +04:00
parent 839353894d
commit ba374506a4

View File

@ -33,34 +33,28 @@ namespace FishFactoryBusinessLogic.BusinessLogics
_saveToWord = saveToWord; _saveToWord = saveToWord;
_saveToPdf = saveToPdf; _saveToPdf = saveToPdf;
} }
public List<ReportCannedComponentViewModel> GetCannedComponent() public List<ReportCannedComponentViewModel> GetCannedComponent()
{ {
var components = _componentStorage.GetFullList(); var canneds = _cannedStorage.GetFullList();
var canneds = _cannedStorage.GetFullList(); var list = new List<ReportCannedComponentViewModel>();
var list = new List<ReportCannedComponentViewModel>(); foreach (var canned in canneds)
foreach (var canned in canneds) {
{ var record = new ReportCannedComponentViewModel
var record = new ReportCannedComponentViewModel {
{ CannedName = canned.CannedName,
CannedName = canned.CannedName, Components = new List<Tuple<string, int>>(),
Components = new List<Tuple<string, int>>(), TotalCount = 0
TotalCount = 0 };
}; foreach (var component in canned.CannedComponents.Values)
foreach (var component in components) {
{ record.Components.Add(new Tuple<string, int>(component.Item1.ComponentName, component.Item2));
if (canned.CannedComponents.ContainsKey(component.Id)) record.TotalCount += component.Item2;
{ }
record.Components.Add(new Tuple<string, list.Add(record);
int>(component.ComponentName, canned.CannedComponents[component.Id].Item2)); }
record.TotalCount += return list;
canned.CannedComponents[component.Id].Item2; }
} public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
}
list.Add(record);
}
return list;
}
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model)
{ {
return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo }) return _orderStorage.GetFilteredList(new OrderSearchModel { DateFrom = model.DateFrom, DateTo = model.DateTo })
.Select(x => new ReportOrdersViewModel .Select(x => new ReportOrdersViewModel