34 lines
1.2 KiB
PHP
34 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Commands;
|
|
|
|
use App\Component\Models\ClientsPresale;
|
|
use App\Console\Commands\HRCCommand;
|
|
use App\Console\Commands\HRCCommandInterface;
|
|
|
|
class POSTPresale extends HRCCommand implements HRCCommandInterface
|
|
{
|
|
protected $signature = 'postpresale';
|
|
|
|
public function command($input, $output = null)
|
|
{
|
|
$client_guid = $input['client_id'];
|
|
$presale_amount = abs($input['amount']);
|
|
$staff_id = $input['who'];
|
|
$presale_time = $input['date_transaction'];
|
|
$type = $input['type'];
|
|
ClientsPresale::presaleReg($client_guid, $presale_amount, $type);
|
|
ClientsPresale::presaleLog($client_guid, $presale_amount, $presale_time, $staff_id);
|
|
if ($type == 'in') {
|
|
$message = 'Внесен аванс на сумму ' . $presale_amount . ' BYN';
|
|
} elseif ($type == 'out') {
|
|
$message = 'Зачтен аванс на сумму ' . $presale_amount . ' BYN';
|
|
}
|
|
$presale_result = ClientsPresale::getPresale($client_guid);
|
|
return [
|
|
'status' => 'success',
|
|
'message' => $message,
|
|
'result' => $presale_result
|
|
];
|
|
}
|
|
} |