Fixed reports
This commit is contained in:
miroman-afk
2023-05-02 15:21:54 +03:00
parent 70120653f7
commit fb46c8e739
78 changed files with 21233 additions and 1892 deletions

View File

@@ -2,9 +2,11 @@
namespace App\Commands;
use App\Component\Models\Client;
use App\Component\Models\ClientsPresale;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
use Carbon\Carbon;
class POSTPresale extends HRCCommand implements HRCCommandInterface
{
@@ -12,18 +14,19 @@ class POSTPresale extends HRCCommand implements HRCCommandInterface
public function command($input, $output = null)
{
$client_guid = $input['client_id'];
$client_guid = $input['client_guid'];
$presale_amount = abs($input['amount']);
$staff_id = $input['who'];
$staff_id = $input['who_id'];
$presale_time = $input['date_transaction'];
$type = $input['type'];
$action_type = intval($input['action_type']);
$code_order = intval($input['code_order']);
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';
}
$message = ClientsPresale::presaleLog($client_guid, $presale_amount, $presale_time, $staff_id, $action_type, $code_order);
$client = Client::where('user_code', $client_guid)->first();
$client = Client::find($client['id']);
$client->updated_at = Carbon::createFromTimestampUTC($presale_time)->timezone('Europe/Minsk');
$client->save();
$presale_result = ClientsPresale::getPresale($client_guid);
return [
'status' => 'success',