TopDishes fix
This commit is contained in:
@@ -23,16 +23,16 @@ class TopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
->where('code', '=', $item['menu_code'])
|
||||
->where('legacy_code', '=', $item['dish_code'])
|
||||
->where('is_history', '=', 0)
|
||||
->get();
|
||||
->first();
|
||||
$onlineDishInfo = OnlineItems::select('real_price', 'sale_price', 'special_price')
|
||||
->where('menu_code', '=', $item['menu_code'])
|
||||
->where('dish_code', '=', $item['dish_code'])
|
||||
->get();
|
||||
$dishName = $dishInfo[0]->name;
|
||||
->first();
|
||||
$dishName = $dishInfo['name'];
|
||||
$dishCount = OnlineItems::where('menu_code', '=', $item['menu_code'])->sum('count');
|
||||
$dishSum = $onlineDishInfo[0]->real_price * $dishCount;
|
||||
$dishSum = $onlineDishInfo['real_price'] * $dishCount;
|
||||
if ($dishSum > 0) {
|
||||
$dishTotalCost = round(($onlineDishInfo[0]->special_price * $dishCount), 2);
|
||||
$dishTotalCost = round(($onlineDishInfo['special_price'] * $dishCount), 2);
|
||||
$dishPercent = round((100 - ((($dishSum - $dishTotalCost) * 100) / $dishSum)), 2);
|
||||
$dishProfit = $dishSum - $dishTotalCost;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user