This commit is contained in:
miroman-afk
2023-05-04 10:41:36 +03:00
parent fb46c8e739
commit 5c3a8a464b
13 changed files with 623 additions and 251 deletions

View File

@@ -39,23 +39,11 @@ class GETTopDishes extends HRCCommand implements HRCCommandInterface {
$out[] = $value;
}
foreach ($out as $key => $item) {
$dishInfo = Dishes::where('code', '=', $item['menu_code'])
->where('legacy_code', '=', $item['dish_code'])
->where('is_history', '=', 0)
->first();
$onlineDishInfo = ShiftOnlineItems::where('menu_code', '=', $item['menu_code'])
->where('dish_code', '=', $item['dish_code'])
->whereIn('order_code', $orders)
->first();
if ($dishInfo['name'] == '') {
$dishHistInfo = Dishes::where('code', '=', $item['menu_code'])
->where('legacy_code', '=', $item['dish_code'])
->whereIn('order_code', $orders)
->first();
$dishName = $dishHistInfo['name'];
} else {
$dishName = $dishInfo['name'];
}
$dishName = Dishes::getName($item['dish_code']);
$dishCount = ShiftOnlineItems::where('menu_code', '=', $item['menu_code'])
->whereIn('order_code', $orders)
->sum('count');