v.2.15
Discounts block update
This commit is contained in:
36
commands/GETMoreDiscount.php
Normal file
36
commands/GETMoreDiscount.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user