Discounts block update
This commit is contained in:
miroman-afk
2022-04-28 23:55:53 +03:00
parent 53dfb77d7a
commit 2d148e3eb5
9 changed files with 169 additions and 22 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Commands;
use App\Component\Models\ShiftOnlineOrders;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETMoreDiscount extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getmorediscount';
public function command($input, $output = null) {
$amountWithoutDiscount = 0;
$totalSum = 0;
$orderInfo = [];
$orders = ShiftOnlineOrders::where('is_deleted', 0)
->where('is_returned', 0)
->where('sale_sum', '>', 0)
->get();
if ($orders) {
foreach ($orders as $key => $order) {
$orderInfo[] = array('number' => $order['code'], 'full_sum' => $order['full_sum'], 'sale_sum' => $order['sale_sum'], 'order_sum' => $order['order_sum']);
$amountWithoutDiscount = $amountWithoutDiscount + $order['full_sum'];
$totalSum = $totalSum + $order['order_sum'];
}
}
return [
'status' => 'success',
'title' => 'Подробнее о заказах со скидками',
'amount' => $amountWithoutDiscount,
'total_sum' => $totalSum,
'orders' => $orderInfo,
];
}
}