Files
admin-php-module/commands/GETMoreDiscount.php
miroman-afk 2d148e3eb5 v.2.15
Discounts block update
2022-04-28 23:55:53 +03:00

36 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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,
];
}
}