Compare commits
64 Commits
master
...
dev-update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40b2501c7a | ||
|
|
229ab8667e | ||
|
|
a7c1679d12 | ||
|
|
468cb21e40 | ||
|
|
0b5df57d08 | ||
|
|
ee1ad42c38 | ||
|
|
e9c99df7e3 | ||
|
|
94fef07bb2 | ||
|
|
ed61e9627d | ||
|
|
c4dc6e02a0 | ||
|
|
19ad7d1c8a | ||
|
|
5c3a8a464b | ||
|
|
fb46c8e739 | ||
|
|
70120653f7 | ||
|
|
723e9a8768 | ||
|
|
d24bba305f | ||
|
|
4d3ad7727d | ||
|
|
0e5f2002b1 | ||
|
|
dcd0e72d1f | ||
|
|
1af2b267f5 | ||
|
|
9c3b633098 | ||
|
|
46cf6ff8e4 | ||
|
|
415b291785 | ||
|
|
cb33be6001 | ||
|
|
8e4073ffe3 | ||
|
|
7fdcbcc9e8 | ||
|
|
ebd1180d89 | ||
|
|
2d148e3eb5 | ||
|
|
53dfb77d7a | ||
|
|
85fd6af04f | ||
|
|
4ad154c65a | ||
|
|
d79e61c6a4 | ||
|
|
506636d35c | ||
|
|
5b1c774259 | ||
|
|
5497b611ef | ||
|
|
57949aa89a | ||
|
|
70f5640505 | ||
|
|
da51b6ca63 | ||
|
|
de0e951ca1 | ||
|
|
fb3a28e74e | ||
|
|
284d2bcb60 | ||
|
|
3894932e4c | ||
|
|
cf997da7ec | ||
|
|
104017ed96 | ||
|
|
61d8b4e1d2 | ||
|
|
f964aca7a9 | ||
|
|
def1ac1986 | ||
|
|
51a27b005e | ||
|
|
cf1e228f26 | ||
|
|
0209970fe1 | ||
|
|
7438ebef78 | ||
|
|
944dff2163 | ||
|
|
b702888540 | ||
|
|
f8c4060a82 | ||
|
|
2702c4b6e9 | ||
|
|
1a7808f75b | ||
|
|
276576f007 | ||
|
|
3da3e3a6e1 | ||
|
|
3c8a6b2736 | ||
|
|
13a115ba0d | ||
|
|
151704b637 | ||
|
|
a54a91263a | ||
|
|
87cf29a443 | ||
|
|
3b61b27200 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,3 +1,7 @@
|
||||
.idea/
|
||||
temp/
|
||||
vendor/
|
||||
vendor/
|
||||
build.zip
|
||||
places.xml
|
||||
*.log
|
||||
*.log
|
||||
|
||||
45
commands/GETBot.php
Normal file
45
commands/GETBot.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\Folders;
|
||||
use App\Component\Models\OrderBotStorage;
|
||||
use App\Component\Models\Settings;
|
||||
use App\Component\Models\Tasks;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETBot extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getbot';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$settings = Settings::where('code', 5)
|
||||
->where('value', 1)
|
||||
->get();
|
||||
if (isset($settings['0']['value'])) {
|
||||
Dishes::where('is_bot_export', '=', 0)
|
||||
->update(['is_bot_export' => 1]);
|
||||
Folders::where('is_bot_export', '=', 0)
|
||||
->update(['is_bot_export' => 1]);
|
||||
}
|
||||
$orders_info = Tasks::where('method', 'orderinfo')
|
||||
->get();
|
||||
$delete_params = ['closed', 'deleted'];
|
||||
foreach ($orders_info as $more) {
|
||||
$order = OrderBotStorage::where('id', intval($more['more']))
|
||||
->whereIn('status', $delete_params)
|
||||
->get();
|
||||
foreach ($order as $value) {
|
||||
Tasks::where('method', 'orderinfo')
|
||||
->where('more', $value['id'])
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
];
|
||||
}
|
||||
}
|
||||
30
commands/GETClearCache.php
Normal file
30
commands/GETClearCache.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Filesystem;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClearCache extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclearcache';
|
||||
const cacheFolder = CORE_PATH . '/../../Cache/';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$code = Filesystem::GetCode($input['token']);
|
||||
if (isset($input['folder'])) {
|
||||
Filesystem::ClearFolder(self::cacheFolder . $code . '/' . $input['folder']);
|
||||
return [
|
||||
'status' => 'success',
|
||||
];
|
||||
}
|
||||
if (!isset($input['folder'])) {
|
||||
Filesystem::ClearFolder(self::cacheFolder . $code . '/');
|
||||
return [
|
||||
'status' => 'success',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
101
commands/GETClientFile.php
Normal file
101
commands/GETClientFile.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientFile extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getclientfile';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
|
||||
$tmp_dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\tmp\\" . $terminal['key'] . "\\";
|
||||
$dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\";
|
||||
$code = '';
|
||||
if (isset($input['complete'])) {
|
||||
foreach (glob($tmp_dirname . "*.tmp") as $filename) {
|
||||
$code .= file_get_contents($filename);
|
||||
}
|
||||
$filename = str_replace(' ', '_', date("d.m.Y H.i.s")) . '.csv';
|
||||
file_put_contents($dirname . $filename, $code);
|
||||
$files = glob($tmp_dirname . "*");
|
||||
foreach ($files as $file) {
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
$files = glob($dirname . "*.*");
|
||||
usort($files, function ($a, $b) {
|
||||
return filemtime($a) < filemtime($b);
|
||||
});
|
||||
foreach ($files as $plk2) {
|
||||
$file_array[] = str_replace($dirname, '', $plk2);
|
||||
}
|
||||
if (array_key_exists(0, $file_array)) {
|
||||
$file = date("d.m.Y H:i:s", filemtime($dirname . $file_array['0']));
|
||||
} else {
|
||||
$file = '';
|
||||
}
|
||||
$baseCSV = file($dirname . $filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
|
||||
foreach ($baseCSV as $itemBaseCSV) {
|
||||
$arrLineCsv = explode(";", $itemBaseCSV);
|
||||
$arrUniqFinish[$arrLineCsv[0] . ";" . $arrLineCsv[1]] = $arrLineCsv[1];
|
||||
}
|
||||
$arrUniqFinish = array_unique($arrUniqFinish);
|
||||
|
||||
foreach ($arrUniqFinish as $keyArr => $valueArr) {
|
||||
$finishSavedCsv[] = $keyArr;
|
||||
}
|
||||
file_put_contents($dirname . $filename, implode("\n", $finishSavedCsv));
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminalKey' => $terminal['key'],
|
||||
'filename' => $filename,
|
||||
'filedate' => $file,
|
||||
];
|
||||
}
|
||||
|
||||
$clientsCount = Client::count();
|
||||
$urlThread = $input['th'];
|
||||
$mainThreads = 4;
|
||||
$countPerThread = ceil($clientsCount / $mainThreads);
|
||||
$offset = ($urlThread - 1) * $countPerThread;
|
||||
$clients = Client::with('clientPhone')->skip($offset)->take($countPerThread)->get();
|
||||
|
||||
if (!is_dir($tmp_dirname)) {
|
||||
mkdir($tmp_dirname, 0755, 'w+');
|
||||
}
|
||||
$filename = str_replace(' ', '_', date("d.m.Y H.i.s")) . '_' . $urlThread . '.tmp';
|
||||
$handle = fopen($tmp_dirname . $filename, 'w+');
|
||||
$filename = str_replace('_', ' ', $filename);
|
||||
foreach ($clients as $row) {
|
||||
if (isset($row['clientPhone']->phone) && ($row['clientPhone']->phone !== '') && ($row['clientPhone']->phone !== '+375 ( ) - -')) {
|
||||
$row = array($row['name'], $row['clientPhone']->phone);
|
||||
fputs($handle, chr(0xEF) . chr(0xBB) . chr(0xBF)); // BOM
|
||||
fputcsv($handle, $row, ';');
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
$files = glob($tmp_dirname . "*.*");
|
||||
usort($files, function ($a, $b) {
|
||||
return filemtime($a) < filemtime($b);
|
||||
});
|
||||
foreach ($files as $plk2) {
|
||||
$file_array[] = str_replace($tmp_dirname, '', $plk2);
|
||||
}
|
||||
if (array_key_exists(0, $file_array)) {
|
||||
$file = date("d.m.Y H:i:s", filemtime($tmp_dirname . $file_array['0']));
|
||||
} else {
|
||||
$file = '';
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'filename' => $filename,
|
||||
'filedate' => $file,
|
||||
];
|
||||
}
|
||||
}
|
||||
28
commands/GETClientGroup.php
Normal file
28
commands/GETClientGroup.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientGroup extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getclientgroup';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (ClientsGroup::where('code', '0')->count() == 0) {
|
||||
$group = new ClientsGroup;
|
||||
$group->code = '0';
|
||||
$group->name = 'Без группы';
|
||||
$group->save();
|
||||
}
|
||||
$client_groups = ClientsGroup::orderBy('code')->get();
|
||||
foreach ($client_groups as $client_group) {
|
||||
$out[] = array('id' => $client_group['id'], 'name' => $client_group['name']);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'groups' => $out,
|
||||
];
|
||||
}
|
||||
}
|
||||
78
commands/GETClientInfo.php
Normal file
78
commands/GETClientInfo.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsBonus;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientInfo extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientinfo';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$phone = Client::getPhone($client_guid);
|
||||
$address = Client::getAddress($client_guid);
|
||||
$email = Client::getEmail($client_guid);
|
||||
$presale = ClientsPresale::getPresale($client_guid);
|
||||
$bonus = ClientsBonus::getBonus($client_guid);
|
||||
$orders_count_exchange = ExchangeOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->count();
|
||||
$orders_count_current = ShiftOnlineOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->count();
|
||||
$orders_sum_exchange = ExchangeOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->sum('full_sum');
|
||||
$orders_sum_current = ShiftOnlineOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->sum('full_sum');
|
||||
$orders_count = $orders_count_exchange + $orders_count_current;
|
||||
$orders_sum = $orders_sum_exchange + $orders_sum_current;
|
||||
$barcode = Client::getBarcode($client_guid);
|
||||
if ($client['is_special_price'] == 0) {
|
||||
$special_price = false;
|
||||
} else {
|
||||
$special_price = true;
|
||||
}
|
||||
if ($client['is_employee'] == 0) {
|
||||
$employee = false;
|
||||
} else {
|
||||
$employee = true;
|
||||
}
|
||||
if ($client['is_block'] == 0) {
|
||||
$is_block = false;
|
||||
} else {
|
||||
$is_block = true;
|
||||
}
|
||||
$result = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'info' => array(
|
||||
'phone' => $phone,
|
||||
'email' => $email,
|
||||
'address' => $address,
|
||||
'order_count' => $orders_count,
|
||||
'order_sum' => round($orders_sum, 2),
|
||||
'presale' => $presale,
|
||||
'bonus' => intval($bonus),
|
||||
'barcode' => $barcode,
|
||||
'special_price' => $special_price,
|
||||
'employee' => $employee,
|
||||
'is_block' => $is_block,
|
||||
)
|
||||
);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'client' => $result,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
51
commands/GETClientLog.php
Normal file
51
commands/GETClientLog.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsActions;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientLog extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientlog';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$logs = ClientsActions::where('user_id', $client_guid)->orderByDesc('created')->get();
|
||||
$info = [];
|
||||
foreach ($logs as $log) {
|
||||
$info[] = array(
|
||||
'action' => $log['action'],
|
||||
'value' => round($log['action_value'], 2),
|
||||
'who' => Staff::getName($log['who']),
|
||||
'time' => $log['created'],
|
||||
'type' => $log['action_type']
|
||||
);
|
||||
}
|
||||
$result = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'info' => $info
|
||||
);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'client' => $result,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
47
commands/GETClientOrders.php
Normal file
47
commands/GETClientOrders.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClientOrders extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclientorders';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['id'])) {
|
||||
$client = Client::where('id', $input['id'])->first();
|
||||
$client_guid = $client['user_code'];
|
||||
$exchange_orders = ExchangeOrders::select('code', 'opened', 'closed', 'order_sum', 'sale_sum')
|
||||
->where('client_code', $client_guid)
|
||||
->where('is_returned', 0)
|
||||
->where('is_deleted', 0)
|
||||
->orderByDesc('closed')
|
||||
->get()
|
||||
->toArray();
|
||||
$online_orders = ShiftOnlineOrders::select('code', 'opened', 'closed', 'order_sum', 'sale_sum')
|
||||
->where('client_code', $client_guid)
|
||||
->where('is_returned', 0)
|
||||
->where('is_deleted', 0)
|
||||
->orderByDesc('closed')
|
||||
->get()
|
||||
->toArray();
|
||||
$orders = array_merge($online_orders, $exchange_orders);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'orders' => $orders,
|
||||
'count' => count($orders)
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
86
commands/GETClients.php
Normal file
86
commands/GETClients.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETClients extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getclients';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (ClientsGroup::where('code', '0')->count() == 0) {
|
||||
$group = new ClientsGroup([
|
||||
'code' => '0',
|
||||
'name' => 'Без группы',
|
||||
]);
|
||||
$group->save();
|
||||
}
|
||||
$countPerPage = 25;
|
||||
$offset = ($input['page'] - 1) * $countPerPage;
|
||||
if ($input['group_id'] == 0) {
|
||||
$group = ClientsGroup::where('code', '=', $input['group_id'])->first();
|
||||
} else {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
}
|
||||
$clients = Client::where('group_id', '=', $group['code'])->skip($offset)->take($countPerPage)->get();
|
||||
$total = Client::where('group_id', '=', $group['code'])->count();
|
||||
if ($total == NULL) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => array(),
|
||||
'total' => 0,
|
||||
'size' => $countPerPage,
|
||||
'pages' => 1,
|
||||
'currentGroup' => $group['id'],
|
||||
];
|
||||
} else {
|
||||
|
||||
foreach ($clients as $client) {
|
||||
$phone = Client::getPhone($client['user_code']);
|
||||
$email = Client::getEmail($client['user_code']);
|
||||
$address = Client::getAddress($client['user_code']);
|
||||
$barcode = Client::getBarcode($client['user_code']);
|
||||
if ($client['is_special_price'] == 0) {
|
||||
$special_price = false;
|
||||
} else {
|
||||
$special_price = true;
|
||||
}
|
||||
if ($client['is_employee'] == 0) {
|
||||
$employee = false;
|
||||
} else {
|
||||
$employee = true;
|
||||
}
|
||||
if ($client['is_block'] == 0) {
|
||||
$is_block = false;
|
||||
} else {
|
||||
$is_block = true;
|
||||
}
|
||||
$out[] = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'phone' => $phone,
|
||||
'email' => $email,
|
||||
'address' => $address,
|
||||
'barcode' => $barcode,
|
||||
'special_price' => $special_price,
|
||||
'employee' => $employee,
|
||||
'is_block' => $is_block,
|
||||
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => $out,
|
||||
'total' => $total,
|
||||
'size' => $countPerPage,
|
||||
'pages' => ceil($total / $countPerPage),
|
||||
'currentGroup' => $group['id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
95
commands/GETCompanyClients.php
Normal file
95
commands/GETCompanyClients.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsAddress;
|
||||
use App\Component\Models\ClientsBarcode;
|
||||
use App\Component\Models\ClientsBonus;
|
||||
use App\Component\Models\ClientsEmail;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Component\Models\ClientsPresale;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GETCompanyClients extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getcompanyclients';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$dt = Carbon::createFromTimestamp($input['last_update'])->subHours(3);
|
||||
$last_update = $dt->format('Y-m-d H:i:s');
|
||||
$clients = Client::select('id', 'name', 'user_code', 'group_id', 'last_change', 'updated_at')
|
||||
->where('updated_at', '>', $last_update)
|
||||
->get();
|
||||
if (count($clients) < 1) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => [],
|
||||
'groups' => [],
|
||||
];
|
||||
}
|
||||
foreach ($clients as $client) {
|
||||
$email_address = Client::getEmail($client['user_code']);
|
||||
$phone_number = Client::getPhone($client['user_code']);
|
||||
$email[] = array(
|
||||
'email' => $email_address
|
||||
);
|
||||
$phone[] = array(
|
||||
'phone' => $phone_number
|
||||
);
|
||||
$badge[] = array(
|
||||
'name' => 'Test',
|
||||
'code' => 1
|
||||
);
|
||||
$bonus_dishes[] = array(
|
||||
'code' => ''
|
||||
);
|
||||
if (ClientsBonus::getBonus($client['user_code']) > 0) {
|
||||
$bonus_info[] = array(
|
||||
'amount' => ClientsBonus::getBonus($client['user_code']),
|
||||
'dishes' => $bonus_dishes
|
||||
);
|
||||
} else {
|
||||
$bonus_info = array(
|
||||
'amount' => ClientsBonus::getBonus($client['user_code']),
|
||||
'dishes' => []
|
||||
);
|
||||
}
|
||||
$group_info = ClientsGroup::where('code', $client['group_id'])->first();
|
||||
$clients_info[] = array(
|
||||
'id' => $client['id'],
|
||||
'name' => $client['name'],
|
||||
'guid' => $client['user_code'],
|
||||
'presale' => ClientsPresale::getPresale($client['user_code']),
|
||||
'bonuses' => $bonus_info,
|
||||
'barcode' => Client::getBarcode($client['user_code']),
|
||||
'group_id' => ClientsGroup::getID($client['group_id']),
|
||||
'emails' => $email,
|
||||
'phones' => $phone,
|
||||
'badges' => []
|
||||
);
|
||||
$groups[] = $group_info['code'];
|
||||
$email = $phone = $badge = $bonus_dishes = $bonus_info = [];
|
||||
}
|
||||
$groups_guides = array_values(array_unique($groups));
|
||||
foreach ($groups_guides as $group) {
|
||||
$group_info = ClientsGroup::where('code', $group)->first();
|
||||
$groups_info[] = array(
|
||||
'id' => $group_info['id'],
|
||||
'name' => $group_info['name'],
|
||||
'guid' => $group_info['code'],
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'clients' => $clients_info,
|
||||
'groups' => $groups_info,
|
||||
];
|
||||
}
|
||||
}
|
||||
721
commands/GETDashboard.php
Normal file
721
commands/GETDashboard.php
Normal file
@@ -0,0 +1,721 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\Places;
|
||||
use App\Component\Models\Reasons;
|
||||
use App\Component\Models\Settings;
|
||||
use App\Component\Models\ShiftOnlineActions;
|
||||
use App\Component\Models\ShiftOnlineDeleted;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Shifts;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Component\Models\Tables;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GETDashboard extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getdashboard';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['method'])) {
|
||||
if (isset($input['more'])) {
|
||||
$more = $input['more'];
|
||||
} else {
|
||||
$more = false;
|
||||
}
|
||||
if (isset($input['items'])) {
|
||||
if (isset($input['order_id'])) {
|
||||
$order_id = $input['order_id'];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Проверьте введенные данные'
|
||||
];
|
||||
}
|
||||
$items = $input['items'];
|
||||
} else {
|
||||
$items = false;
|
||||
}
|
||||
if (isset($input['type'])) {
|
||||
$type = $input['type'];
|
||||
} else {
|
||||
$type = false;
|
||||
}
|
||||
$method = $input['method'];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Проверьте введенные данные'
|
||||
];
|
||||
}
|
||||
$setting = Settings::getValue(10);
|
||||
|
||||
if ($method == "profit") {
|
||||
if ($setting > 0) {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_close', '>', 0)
|
||||
->get();
|
||||
} else {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_close', '>', 0)
|
||||
->where('place_name', '<>', 'ДОСТАВКА')
|
||||
->get();
|
||||
}
|
||||
$profit = $middle = 0;
|
||||
$guests = $amount = 0;
|
||||
foreach ($orders as $order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
if ($setting > 0) {
|
||||
$order_info = ShiftOnlineOrders::getInfo($order['code']);
|
||||
$order_items = $order_info['items'];
|
||||
$guests += $order_info['client_count'];
|
||||
$amount += $order_info['amount'] - $order_info['returned_sum'];
|
||||
} elseif ($setting < 1 && $order_status != "Оплачен (*)") {
|
||||
$order_info = ShiftOnlineOrders::getInfo($order['code']);
|
||||
$order_items = $order_info['items'];
|
||||
$guests += $order_info['client_count'];
|
||||
$amount += $order_info['amount'] - $order_info['returned_sum'];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
foreach ($order_items as $order_item) {
|
||||
$profit += $order_item['profit'];
|
||||
}
|
||||
|
||||
}
|
||||
if ($guests > 0) {
|
||||
$middle = round($amount / $guests, 2);
|
||||
} else {
|
||||
$middle = 0;
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'profit' => round($profit, 2),
|
||||
'guests' => $guests,
|
||||
'amount' => $amount,
|
||||
'middle' => $middle
|
||||
];
|
||||
}
|
||||
|
||||
if ($method == "total") {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$waited_count = $waited_sum = 0;
|
||||
$closed_count = $closed_sum = 0;
|
||||
$returned_count = $returned_sum = 0;
|
||||
$cancellations_count = $cancellations_sum = 0;
|
||||
$deleted_count = $deleted_sum = 0;
|
||||
foreach ($orders as $order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
$returned_order_sum = 0;
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['is_deleted'] > 0
|
||||
&& $order['check_number'] > 0
|
||||
&& $order['who_open'] > 0) {
|
||||
$cancellations_count += 1;
|
||||
$cancellations_sum += $order['order_sum'];
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0) {
|
||||
$waited_count++;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$waited_count++;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$closed_count++;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА'
|
||||
&& $order_status != "Оплачен(*)") {
|
||||
$closed_count++;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1) {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
} else {
|
||||
if ($order['place_name'] != 'ДОСТАВКА') {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'total' => round($closed_sum + $waited_sum, 2),
|
||||
'closed_sum' => round($closed_sum, 2),
|
||||
'closed_count' => $closed_count,
|
||||
'waited_sum' => round($waited_sum, 2),
|
||||
'waited_count' => $waited_count,
|
||||
'cancellations_sum' => round($cancellations_sum, 2),
|
||||
'cancellations_count' => $cancellations_count,
|
||||
'returned_sum' => round($returned_sum, 2),
|
||||
'returned_count' => $returned_count,
|
||||
'deleted_sum' => round($deleted_sum, 2),
|
||||
'deleted_count' => $deleted_count,
|
||||
];
|
||||
}
|
||||
|
||||
if ($method == "deleted") {
|
||||
$deleted_count = $deleted_sum = 0;
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
foreach ($orders as $order) {
|
||||
if ($setting > 0) {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
} else {
|
||||
if ($order['place_name'] != 'ДОСТАВКА') {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($more) {
|
||||
$deleted_items = ShiftOnlineDeleted::select('order_code')
|
||||
->selectRaw('SUM(count * sale_price) as sum')
|
||||
->groupBy('order_code')
|
||||
->get();
|
||||
$orders = [];
|
||||
if ($deleted_count > 0) {
|
||||
foreach ($deleted_items as $deleted_item) {
|
||||
$order = ShiftOnlineOrders::select('opened', 'closed')
|
||||
->where('code', $deleted_item['order_code'])
|
||||
->first();
|
||||
$closed = $order['closed'];
|
||||
if ($closed == '0000-00-00 00:00:00') {
|
||||
$closed = '30.12.1899';
|
||||
}
|
||||
$orders[] = array(
|
||||
'number' => $deleted_item['order_code'],
|
||||
'opened' => $order['opened'],
|
||||
'closed' => $closed,
|
||||
'deleted_sum' => round($deleted_item['sum'], 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'title' => 'Подробнее об удаленных',
|
||||
'total_sum' => round($deleted_sum, 2),
|
||||
'total_count' => $deleted_count,
|
||||
'deleted_orders' => $orders
|
||||
];
|
||||
}
|
||||
if ($items) {
|
||||
$all_sum = $all_count = 0;
|
||||
$deleted_items = ShiftOnlineDeleted::where('order_code', $order_id)
|
||||
->get();
|
||||
if ($deleted_count > 0) {
|
||||
foreach ($deleted_items as $deleted_item) {
|
||||
$order = ShiftOnlineActions::where('order_code', $deleted_item['order_code'])
|
||||
->where('type_action', 5)
|
||||
->first();
|
||||
$out_items[] = array(
|
||||
'dish' => Dishes::getName($deleted_item['menu_code']),
|
||||
'time' => $order['time'],
|
||||
'reason' => Reasons::getName($order['reason']),
|
||||
'count' => $deleted_item['count'],
|
||||
'sale_price' => $deleted_item['count'] * $deleted_item['sale_price'],
|
||||
'who_deleted' => Staff::getName($order['who'])
|
||||
);
|
||||
$all_sum += $deleted_item['count'] * $deleted_item['sale_price'];
|
||||
$all_count += $deleted_item['count'];
|
||||
}
|
||||
} else {
|
||||
$out_items = [];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'code' => $order_id,
|
||||
'all_sum' => round($all_sum, 2),
|
||||
'all_count' => round($all_count, 3),
|
||||
'items' => $out_items
|
||||
];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'sum' => round($deleted_sum, 2),
|
||||
'count' => $deleted_count
|
||||
];
|
||||
}
|
||||
|
||||
if ($method == 'guests') {
|
||||
if ($type == 'median') {
|
||||
$data = [];
|
||||
$orders = ShiftOnlineOrders::where('is_waited', 1)
|
||||
->where('is_deleted', 0)
|
||||
->get();
|
||||
if (isset($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
$originalTime = $order['opened'];
|
||||
$newTime = Carbon::createFromFormat('Y-m-d H:i:s', $originalTime)->format('d.m.Y H:i:s');
|
||||
$data[] = array(
|
||||
'time' => $newTime,
|
||||
'count' => $order['client_count']
|
||||
);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'data' => $data
|
||||
];
|
||||
}
|
||||
if ($type == 'more') {
|
||||
$clientsIDS = ShiftOnlineOrders::select('client_code')
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('who_open', '<>', 0)
|
||||
->where('client_code', '<>', '')
|
||||
->groupBy('client_code')
|
||||
->get();
|
||||
$clientsOrdersCount = ShiftOnlineOrders::select('client_code')
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('who_open', '<>', 0)
|
||||
->where('client_code', '<>', '')
|
||||
->groupBy('client_code')
|
||||
->count();
|
||||
if ($clientsOrdersCount > 0) {
|
||||
foreach ($clientsIDS as $clientsID) {
|
||||
$orders_info = ShiftOnlineOrders::where('client_code', $clientsID['client_code'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('who_open', '<>', 0)
|
||||
->get();
|
||||
$clientName = Client::getName($clientsID['client_code']);
|
||||
$clientOrders[$clientName] = [];
|
||||
foreach ($orders_info as $order_info) {
|
||||
if ($order_info['closed'] == '0000-00-00 00:00:00') {
|
||||
$closed = false;
|
||||
} else {
|
||||
$closed = $order_info['closed'];
|
||||
}
|
||||
$order = array(
|
||||
'number' => $order_info['code'],
|
||||
'opened' => $order_info['opened'],
|
||||
'closed' => $closed,
|
||||
'sum' => $order_info['order_sum']
|
||||
);
|
||||
array_push($clientOrders[$clientName], $order);
|
||||
}
|
||||
}
|
||||
foreach ($clientOrders as $key => $ordersInfo) {
|
||||
if ($setting > 0) {
|
||||
$out[] = array(
|
||||
'name' => $key,
|
||||
'orders' => $ordersInfo
|
||||
);
|
||||
} else {
|
||||
$filtered_orders = [];
|
||||
foreach ($ordersInfo as $orderInfo) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($orderInfo['number']);
|
||||
if ($order_status != 'Доставка' && $order_status != 'Оплачен(*)') {
|
||||
$filtered_orders[] = array(
|
||||
'number' => $orderInfo['number'],
|
||||
'opened' => $orderInfo['opened'],
|
||||
'closed' => $orderInfo['closed'],
|
||||
'sum' => $orderInfo['sum']
|
||||
);
|
||||
}
|
||||
}
|
||||
$out[] = array(
|
||||
'name' => $key,
|
||||
'orders' => $filtered_orders
|
||||
);
|
||||
}
|
||||
}
|
||||
$clients_info = [];
|
||||
foreach ($out as $out_item) {
|
||||
if (count($out_item['orders']) > 0) {
|
||||
array_push($clients_info, $out_item);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'title' => 'Подробнее о заказах гостей',
|
||||
'clients' => $clients_info
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'title' => 'Подробнее о заказах гостей',
|
||||
'clients' => []
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
$guests = $namedGuests = $totalSum = 0;
|
||||
$orders = ShiftOnlineOrders::where('is_waited', 1)
|
||||
->where('is_deleted', 0)
|
||||
->get();
|
||||
if (isset($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
$returned_order_sum = 0;
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
if ($setting > 0) {
|
||||
$guests += $order['client_count'];
|
||||
if ($order['client_code'] != '') {
|
||||
if ($order_status == "Возвращен" || $order_status == "Возвращен частично") {
|
||||
$returned_order_id = ShiftOnlineOrders::getReturnedOrderId($order['code']);
|
||||
$returned_order_sum = ShiftOnlineOrders::where('code', $returned_order_id)->first();
|
||||
$returned_order_sum = $returned_order_sum['order_sum'];
|
||||
}
|
||||
$namedGuests += 1;
|
||||
$totalSum += $order['order_sum'] - abs($returned_order_sum);
|
||||
}
|
||||
} else {
|
||||
if ($order_status != 'Доставка' && $order_status != 'Оплачен(*)') {
|
||||
$guests += $order['client_count'];
|
||||
if ($order['client_code'] != '') {
|
||||
if ($order_status == "Возвращен" || $order_status == "Возвращен частично") {
|
||||
$returned_order_id = ShiftOnlineOrders::getReturnedOrderId($order['code']);
|
||||
$returned_order_sum = ShiftOnlineOrders::where('code', $returned_order_id)->first();
|
||||
$returned_order_sum = $returned_order_sum['order_sum'];
|
||||
}
|
||||
$namedGuests += 1;
|
||||
$totalSum += $order['order_sum'] - abs($returned_order_sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'namedGuests' => $namedGuests,
|
||||
'guestsCount' => $guests,
|
||||
'totalSum' => round($totalSum, 2)
|
||||
];
|
||||
}
|
||||
|
||||
if ($method == 'info') {
|
||||
$response['status'] = 'success';
|
||||
$response['exists'] = 'false';
|
||||
$shifts = Shifts::first();
|
||||
if (isset($shifts)) {
|
||||
$response['exists'] = true;
|
||||
$response['opened'] = $shifts['opened'];
|
||||
$response['open'] = Staff::getName($shifts['who_open']);
|
||||
$response['z_number'] = $shifts['z_number'];
|
||||
if ($shifts['who_close'] > 0) {
|
||||
$response['closed'] = $shifts['closed'];
|
||||
$response['close'] = Staff::getName($shifts['who_close']);
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
if ($method == 'online') {
|
||||
if ($type == 'items') {
|
||||
$response['status'] = 'success';
|
||||
$shifts = Shifts::first();
|
||||
if (isset($shifts)) {
|
||||
$response['shift_time'] = $shifts['opened'];
|
||||
$items = ShiftOnlineItems::select('menu_code')
|
||||
->selectRaw('SUM(count - IFNULL(`count_return`, 0)) as count')
|
||||
->where('menu_code', '>', 0)
|
||||
->where('dish_code', '>', 0)
|
||||
->where('real_price', '>=', 0)
|
||||
->where('sale_price', '>=', 0)
|
||||
->groupBy('menu_code')
|
||||
->get();
|
||||
foreach ($items as $item) {
|
||||
if ($item['count'] > 0) {
|
||||
$output_items[] = array(
|
||||
'code' => $item['menu_code'],
|
||||
'name' => Dishes::getName($item['menu_code']),
|
||||
'count' => round($item['count'], 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
$response['items'] = $output_items;
|
||||
}
|
||||
return $response;
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Проверьте введенные данные'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($method == 'staff') {
|
||||
if ($type == 'online') {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->count();
|
||||
$staff_data = [];
|
||||
$sum = 0;
|
||||
if ($orders_count > 0) {
|
||||
$staff = Staff::where('is_history', 0)->get();
|
||||
$staff_data[] = array(
|
||||
'code' => 0,
|
||||
'name' => 'Персонал не найден',
|
||||
'orders_count' => 0,
|
||||
'orders_sum' => 0
|
||||
);
|
||||
foreach ($staff as $staff_item) {
|
||||
$staff_data[] = array(
|
||||
'code' => $staff_item['code'],
|
||||
'name' => Staff::getName($staff_item['code']),
|
||||
'orders_count' => 0,
|
||||
'orders_sum' => 0
|
||||
);
|
||||
}
|
||||
foreach ($orders as $order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
$returned_order_sum = 0;
|
||||
if ($setting > 0) {
|
||||
if ($order_status == 'Возвращен' && $order_status != 'Возвращен частично') {
|
||||
$returned_order_id = ShiftOnlineOrders::getReturnedOrderId($order['code']);
|
||||
$returned_order = ShiftOnlineOrders::where('code', $returned_order_id)->first();
|
||||
$returned_order_sum = abs($returned_order['full_sum']);
|
||||
}
|
||||
$staff_name = Staff::getName($order['who_open']);
|
||||
$sum = $order['full_sum'] - $returned_order_sum;
|
||||
$res = array_filter($staff_data,
|
||||
function ($x) use ($staff_name) {
|
||||
return $x['name'] == $staff_name;
|
||||
});
|
||||
$key = key($res);
|
||||
$staff_data[$key]['orders_sum'] += $sum;
|
||||
$staff_data[$key]['orders_count']++;
|
||||
|
||||
} else {
|
||||
if ($order_status != 'Доставка' && $order_status != 'Оплачен(*)') {
|
||||
if ($order_status == 'Возвращен' && $order_status != 'Возвращен частично') {
|
||||
$returned_order_id = ShiftOnlineOrders::getReturnedOrderId($order['code']);
|
||||
$returned_order = ShiftOnlineOrders::where('code', $returned_order_id)->first();
|
||||
$returned_order_sum = abs($returned_order['full_sum']);
|
||||
}
|
||||
$staff_name = Staff::getName($order['who_open']);
|
||||
$sum = $order['full_sum'] - $returned_order_sum;
|
||||
$res = array_filter($staff_data,
|
||||
function ($x) use ($staff_name) {
|
||||
return $x['name'] == $staff_name;
|
||||
});
|
||||
$key = key($res);
|
||||
$staff_data[$key]['orders_sum'] += $sum;
|
||||
$staff_data[$key]['orders_count']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'staff' => $staff_data,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'staff' => $staff_data,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($method == 'tables') {
|
||||
if ($type == 'online') {
|
||||
if ($setting > 0) {
|
||||
$orders = ShiftOnlineOrders::selectRaw("COUNT(`id`) AS `orders_count`, SUM(`full_sum`) AS `orders_sum`, CONCAT(place_name, '_', `table_name`) AS `tables`")
|
||||
->where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_closed', 0)
|
||||
->where('is_waited', 1)
|
||||
->groupBy('tables')
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_closed', 0)
|
||||
->where('is_waited', 1)
|
||||
->count();
|
||||
} else {
|
||||
$orders = ShiftOnlineOrders::selectRaw("COUNT(`id`) AS `orders_count`, SUM(`full_sum`) AS `orders_sum`, CONCAT(place_name, '_', `table_name`) AS `tables`")
|
||||
->where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_closed', 0)
|
||||
->where('is_waited', 1)
|
||||
->where('place_name', '<>', 'ДОСТАВКА')
|
||||
->groupBy('tables')
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_closed', 0)
|
||||
->where('is_waited', 1)
|
||||
->where('place_name', '<>', 'ДОСТАВКА')
|
||||
->count();
|
||||
}
|
||||
$tables_data = [];
|
||||
if ($orders_count > 0) {
|
||||
foreach ($orders as $order) {
|
||||
$table_info = explode("_", $order['tables']);
|
||||
$tables_data[] = array(
|
||||
'place_name' => $table_info[0],
|
||||
'table_name' => $table_info[1],
|
||||
'orders_count' => $order['orders_count'],
|
||||
'orders_sum' => $order['orders_sum']
|
||||
);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'tables' => $tables_data,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($method == 'discounts') {
|
||||
if ($type == 'online') {
|
||||
$count = $discountSum = $totalSum = 0;
|
||||
$orders = ShiftOnlineOrders::where('sale_sum', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
foreach ($orders as $order) {
|
||||
if ($setting > 0) {
|
||||
$count++;
|
||||
} else {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
if ($order_status != 'Оплачен(*)' && $order_status != 'ДОСТАВКА') {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($count > 0) {
|
||||
foreach ($orders as $key => $order) {
|
||||
if ($setting > 0) {
|
||||
$totalSum += $order['order_sum'];
|
||||
$items = ShiftOnlineItems::where('order_code', $order['code'])->get();
|
||||
foreach ($items as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
$discountSum = round(($discountSum + abs($salePrice - $realPrice)), 2);
|
||||
}
|
||||
} else {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
if ($order_status != 'Оплачен(*)' && $order_status != 'ДОСТАВКА') {
|
||||
$totalSum += $order['order_sum'];
|
||||
$items = ShiftOnlineItems::where('order_code', $order['code'])->get();
|
||||
foreach ($items as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
$discountSum = round(($discountSum + abs($salePrice - $realPrice)), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'count' => $count,
|
||||
'sum' => $discountSum,
|
||||
'total_sum' => $totalSum
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2467
commands/GETDataReport.php
Normal file
2467
commands/GETDataReport.php
Normal file
File diff suppressed because it is too large
Load Diff
39
commands/GETDiscountItems.php
Normal file
39
commands/GETDiscountItems.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETDiscountItems extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getdiscountitems';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$orderId = $input['order'] + 0;
|
||||
$items = [];
|
||||
$order = ShiftOnlineOrders::where('code', $orderId)->first();
|
||||
$onlineItems = ShiftOnlineItems::where('order_code', $order['code'])->where('modificator_code', 0)->get();
|
||||
foreach ($onlineItems as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$dish = Dishes::getName($item['menu_code']);
|
||||
$items[] = array('name' => $dish, 'discount' => round($discount, 0), 'count' => $item['count'], 'sale_price' => $salePrice, 'sum' => round($realPrice, 2));
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'title' => $order['code'],
|
||||
'total' => $order['order_sum'],
|
||||
'items' => $items,
|
||||
];
|
||||
}
|
||||
}
|
||||
35
commands/GETEquipment.php
Normal file
35
commands/GETEquipment.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Printer;
|
||||
use App\Component\Models\PrinterSettings;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETEquipment extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getequipment';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminals = Terminal::select('work_code', 'work_group')
|
||||
->where('key', '=', $input['terminal'])
|
||||
->get();
|
||||
foreach ($terminals as $terminal) {
|
||||
$terminal_data = array('work_code' => $terminal['work_code'], 'work_group' => $terminal['work_group']);
|
||||
}
|
||||
$printer_groups = Printer::select('code', 'name')
|
||||
->where('is_history', '=', 0)
|
||||
->get();
|
||||
$printers = PrinterSettings::select('name', 'id', 'ip', 'com_port', 'type', 'speed', 'printer_group', 'template', 'size', 'driver', 'codepage', 'more')
|
||||
->where('workgroup', '=', $terminal_data['work_group'])
|
||||
->where('workcode', '=', $terminal_data['work_code'])
|
||||
->get();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminal_data' => $terminal_data,
|
||||
'printer_groups' => $printer_groups,
|
||||
'printers' => $printers,
|
||||
];
|
||||
}
|
||||
}
|
||||
90
commands/GETImport.php
Normal file
90
commands/GETImport.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETImport extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getimport';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$HRCPortalURL = 'https://portal.hrc.by/';
|
||||
$folder = 'backup';
|
||||
$terminals = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->get();
|
||||
$end_date = date('m/d/Y H:i:s', strtotime($input['end_date']) + 86399);
|
||||
$start_date = date('m/d/Y H:i:s', strtotime($input['start_date']));
|
||||
foreach ($terminals as $terminal) {
|
||||
$url = $HRCPortalURL . 'api/cloud/list?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&folder=' . $folder;
|
||||
$search = curl_init();
|
||||
|
||||
curl_setopt_array($search, array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
));
|
||||
$search_response = curl_exec($search);
|
||||
curl_close($search);
|
||||
$responses = json_decode($search_response, TRUE)['files'];
|
||||
|
||||
foreach ($responses as $key => $response) {
|
||||
if (array_key_exists('filename', $response)) {
|
||||
$fulldate = date_parse_from_format('d-m-Y-H-i-s', $response['filename']);
|
||||
$fulldate = mktime($fulldate['hour'], $fulldate['minute'], $fulldate['second'], $fulldate['month'], $fulldate['day'], $fulldate['year']);
|
||||
if ($fulldate >= strtotime($start_date) && $fulldate <= strtotime($end_date)) {
|
||||
$out[] = date('d-m-Y-H-i-s', $fulldate);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($out)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'shifts not found',
|
||||
];
|
||||
} else {
|
||||
foreach ($out as $filename) {
|
||||
$date_file = date('Y-m-d', $filename);
|
||||
//$path = '/backup/' . $filename . '.xml';
|
||||
$path = '/Резервная%20копия/' . $date_file . '/exchange/' . $date_file . '/exchange/' . $filename . '.xml';
|
||||
$download_url = $HRCPortalURL . 'api/cloud/download?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&path=' . $path;
|
||||
$download = curl_init();
|
||||
|
||||
curl_setopt_array($download, array(
|
||||
CURLOPT_URL => $download_url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
));
|
||||
$download_response = curl_exec($download);
|
||||
curl_close($download);
|
||||
$file = json_decode($download_response, TRUE)['content'];
|
||||
$params = array('code' => $terminal['key'], 'name' => $filename . '.xml', 'folder' => 'exchange', 'content' => $file, 'project_code' => 'hrc', 'api' => '2.0');
|
||||
$upload = curl_init();
|
||||
curl_setopt_array($upload, array(
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HEADER => true,
|
||||
CURLOPT_URL => $HRCPortalURL . 'api/cloud/upload',
|
||||
CURLOPT_SSL_VERIFYHOST => 0,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $params,
|
||||
));
|
||||
$upload_response = curl_exec($upload);
|
||||
curl_close($upload);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'start_date' => strtotime($start_date),
|
||||
'end_date' => strtotime($end_date),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1061
commands/GETImportMenu.php
Normal file
1061
commands/GETImportMenu.php
Normal file
File diff suppressed because it is too large
Load Diff
39
commands/GETKeyInfo.php
Normal file
39
commands/GETKeyInfo.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Cache;
|
||||
use App\Console\Commands\HRCEncryptor;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GETKeyInfo extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getkeyinfo';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$cache = Cache::get(245817422, 'v1', $input);
|
||||
if ($cache) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'info' => $cache,
|
||||
'input' => $input
|
||||
];
|
||||
}
|
||||
$info_file = __DIR__ . "\\..\\..\\..\\info.ini";
|
||||
$key_file = __DIR__ . "\\..\\..\\..\\Key.key";
|
||||
$unn = parse_ini_file($info_file);
|
||||
$unn = intval($unn['unn']);
|
||||
$info = json_decode(HRCEncryptor::decrypt(file_get_contents($key_file), $unn), true);
|
||||
if (!$cache) {
|
||||
$cache = Cache::store(245817422, 'v1', $input, $info);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'info' => $cache,
|
||||
'input' => $input
|
||||
];
|
||||
}
|
||||
}
|
||||
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,
|
||||
];
|
||||
}
|
||||
}
|
||||
43
commands/GETOnlineDiscount.php
Normal file
43
commands/GETOnlineDiscount.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETOnlineDiscount extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getonlinediscount';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$count = $totalSum = $discountSum = 0;
|
||||
$count = ShiftOnlineOrders::where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('sale_sum', '>', 0)
|
||||
->count();
|
||||
if ($count > 0) {
|
||||
$totalSum = ShiftOnlineOrders::where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('sale_sum', '>', 0)
|
||||
->sum('order_sum');
|
||||
$orders = ShiftOnlineOrders::where('is_deleted', 0)
|
||||
->where('is_returned', 0)->get();
|
||||
foreach ($orders as $key => $order) {
|
||||
$items = ShiftOnlineItems::where('order_code', $order['code'])->get();
|
||||
foreach ($items as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
$discountSum = round(($discountSum + abs($salePrice - $realPrice)), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'count' => $count,
|
||||
'sum' => $discountSum,
|
||||
'total_sum' => $totalSum,
|
||||
];
|
||||
}
|
||||
}
|
||||
100
commands/GETOnlineStaff.php
Normal file
100
commands/GETOnlineStaff.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETOnlineStaff extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getonlinestaff';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if ($input['method'] == 'dashboard') {
|
||||
$staff_data = [];
|
||||
$staffs = ShiftOnlineOrders::select('who_open')
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->groupBy('who_open')
|
||||
->get();
|
||||
foreach ($staffs as $staff) {
|
||||
$count = ShiftOnlineOrders::where('who_open', $staff['who_open'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->count();
|
||||
$name = Staff::getName($staff['who_open']);
|
||||
$code = $staff['who_open'];
|
||||
$sum = ShiftOnlineOrders::where('who_open', $staff['who_open'])
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->sum('order_sum');
|
||||
$staff_data[] = array(
|
||||
'name' => $name,
|
||||
'code' => $code + 0,
|
||||
'orders_count' => $count + 0,
|
||||
'orders_sum' => $sum + 0
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'staff' => $staff_data,
|
||||
];
|
||||
}
|
||||
if ($input['method'] == 'items') {
|
||||
if (isset($input['order'])) {
|
||||
$orderId = $input['order'] + 0;
|
||||
$items = [];
|
||||
$order = ShiftOnlineOrders::where('code', $orderId)->first();
|
||||
$who_open = Staff::getName($order['who_open']);
|
||||
if ($order['who_close'] == 0) {
|
||||
$who_close = '-';
|
||||
} else {
|
||||
$who_close = Staff::getName($order['who_close']);
|
||||
}
|
||||
|
||||
$onlineItems = ShiftOnlineItems::where('order_code', $order['code'])->where('modificator_code', 0)->get();
|
||||
foreach ($onlineItems as $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
} else {
|
||||
$discount = 0;
|
||||
}
|
||||
$dish_name = Dishes::getName($item['menu_code']);
|
||||
$items[] = array(
|
||||
'name' => $dish_name,
|
||||
'discount' => round($discount, 0),
|
||||
'count' => $item['count'],
|
||||
'sale_price' => $salePrice,
|
||||
'sum' => round($realPrice, 2)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'who_open' => $who_open,
|
||||
'who_close' => $who_close,
|
||||
'title' => 'Подробнее о заказе №' . $order['code'],
|
||||
'total' => $order['order_sum'],
|
||||
'items' => $items,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
148
commands/GETOrder.php
Normal file
148
commands/GETOrder.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsAddress;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\Modifier;
|
||||
use App\Component\Models\OrderItems;
|
||||
use App\Component\Models\Orders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETOrder extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getorder';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
|
||||
if (isset($input['task'])) {
|
||||
if ($input['task'] == 'single' && isset($input['order_id'])) {
|
||||
$order = Orders::where('id', intval($input['order_id']))->first();
|
||||
|
||||
if (isset($order['client_id']) && $order['client_id'] !== null && $order['client_id'] !== '') {
|
||||
$client = Client::where('user_code', $order['client_id'])->first();
|
||||
$client = $client['name'];
|
||||
$client_phone = ClientsPhone::where('client_guid', $order['client_id'])->first();
|
||||
$client_phone = $client_phone['phone'];
|
||||
$client_address = ClientsAddress::where('client_guid', $order['client_id'])->first();
|
||||
$client_address = $client_address['address'];
|
||||
} else {
|
||||
$client = '';
|
||||
$client_phone = '';
|
||||
$client_address = '';
|
||||
}
|
||||
|
||||
$orderItems = OrderItems::where('order_id', $order['id'])->whereNull('modifier_id')->get();
|
||||
if (isset($orderItems)) {
|
||||
foreach ($orderItems as $key => $item) {
|
||||
$itemName = Dishes::getName($item['item_id']);
|
||||
$is_serving = Dishes::isServing($item['item_id']);
|
||||
$itemModifiers = OrderItems::where('order_id', $order['id'])->where('parent_id', $item['id'])->whereNotNull('modifier_id')->get();
|
||||
if (isset($itemModifiers)) {
|
||||
foreach ($itemModifiers as $key => $itemModifier) {
|
||||
$modifier = Modifier::where('code', $itemModifier['modifier_id'])->first();
|
||||
if ($modifier['dish_code'] == 0 && $modifier['unit_id'] == 0) {
|
||||
$modOut[] = array('id' => $modifier['code'], 'name' => $modifier['name'], 'price' => '*');
|
||||
}
|
||||
}
|
||||
}
|
||||
$output[] = array('id' => $item['id'],
|
||||
'num' => $key + 1,
|
||||
'order_id' => $item['order_id'],
|
||||
'item_id' => $item['item_id'],
|
||||
'item_name' => $itemName,
|
||||
'item_count' => round($item['item_count'], 3),
|
||||
'item_price' => round($item['item_price'], 2),
|
||||
'is_serving' => $is_serving,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$output = [];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Заказ №' . $order['id'],
|
||||
'order' => $order,
|
||||
'orderItems' => $output,
|
||||
'client_name' => $client,
|
||||
'client_phone' => $client_phone,
|
||||
'client_address' => $client_address,
|
||||
'totalCount' => $order['total_count'],
|
||||
'totalPrice' => round($order['total_price'], 2),
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'list') {
|
||||
$orders = Orders::all();
|
||||
foreach ($orders as $key => $order) {
|
||||
$client = Client::where('user_code', $order['client_id'])->first();
|
||||
$client_phone = ClientsPhone::where('client_guid', $order['client_id'])->first();
|
||||
$client_address = ClientsAddress::where('client_guid', $order['client_id'])->first();
|
||||
if (isset($client)) {
|
||||
$output[] = array('id' => $order['id'],
|
||||
'client_name' => $client['name'],
|
||||
'client_phone' => $client_phone['phone'],
|
||||
'client_address' => $client_address['address'],
|
||||
'total_count' => $order['total_count'],
|
||||
'total_price' => $order['total_price'],
|
||||
'is_send' => $order['is_send']
|
||||
);
|
||||
} else {
|
||||
$output[] = array('id' => $order['id'],
|
||||
'client_name' => '',
|
||||
'client_phone' => '',
|
||||
'client_address' => '',
|
||||
'total_count' => $order['total_count'],
|
||||
'total_price' => $order['total_price'],
|
||||
'is_send' => $order['is_send']
|
||||
);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Список заказов',
|
||||
'orders' => $output,
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'clientsearch' && $input['search']) {
|
||||
$input['search'] = urldecode($input['search']);
|
||||
$phone = '+375 (' . substr($input['search'], 0, 2) . ') ' . substr($input['search'], 2, 3) . '-' . substr($input['search'], 5, 2) . '-' . substr($input['search'], 7, 2);
|
||||
$clients = ClientsPhone::where('phone', '=', $phone)->get();
|
||||
if (isset($clients)) {
|
||||
foreach ($clients as $key => $client) {
|
||||
$client_name = Client::where('user_code', $client['client_guid'])->first();
|
||||
$client_name = $client_name['name'];
|
||||
$client_address = ClientsAddress::where('client_guid', $client['client_guid'])->first();
|
||||
$client_phone = $client['phone'];
|
||||
$client_guid = $client['client_guid'];
|
||||
$output[] = array('guid' => $client_guid,
|
||||
'name' => $client_name,
|
||||
'phone' => $client_phone,
|
||||
'address' => $client_address['address']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($clients)) {
|
||||
$clients = [];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Список клиентов',
|
||||
'clients' => $output,
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
485
commands/GETOrderHistory.php
Normal file
485
commands/GETOrderHistory.php
Normal file
@@ -0,0 +1,485 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ActionTypes;
|
||||
use App\Component\Models\Base;
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\ExchangeActions;
|
||||
use App\Component\Models\ExchangeDeleted;
|
||||
use App\Component\Models\ExchangeItems;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineActions;
|
||||
use App\Component\Models\ShiftOnlineDeleted;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Component\Models\Units;
|
||||
use App\Component\Models\UnitsList;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getorderhistory';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
|
||||
if (isset($input['order_id'])) {
|
||||
|
||||
if (isset($input['opened']) && isset($input['closed'])) {
|
||||
$order_find = ExchangeOrders::where('opened', urldecode($input['opened']))
|
||||
->where('closed', urldecode($input['closed']))
|
||||
->where('code', $input['order_id'])
|
||||
->first();
|
||||
$shift_id = $order_find['shift_id'];
|
||||
$bill_count = 0;
|
||||
$slice_trigger = 0;
|
||||
$slice_order = 0;
|
||||
$merged_order_items = $sliced_order_items = $moved_order_data = [];
|
||||
$merge_trigger = 0;
|
||||
$move_trigger = 0;
|
||||
|
||||
$order_info = [];
|
||||
$order = ExchangeActions::where('order_code', $input['order_id'])
|
||||
->where('shift_id', $shift_id)
|
||||
->orderBy('time', 'asc')
|
||||
->get();
|
||||
foreach ($order as $key => $item) {
|
||||
$action_type = ActionTypes::where('type_id', $item['action_type'])->first();
|
||||
$action_name = $action_type['name'];
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
|
||||
if ($item['action_type'] == 1) {
|
||||
$action_name = 'Заказ создан';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 2) {
|
||||
$shiftOnlineItem = ExchangeItems::where('order_code', $item['order_code'])
|
||||
->where('shift_id', $shift_id)
|
||||
->where('dishes_code', $item['more'])
|
||||
->first();
|
||||
$unitsList = UnitsList::where('id', $shiftOnlineItem['units_code'])->first();
|
||||
$units = Units::where('id', $unitsList['unit_id'])->first();
|
||||
if ($units) {
|
||||
$unit_name = $units['name'];
|
||||
} else {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
$dish = Dishes::getName($item['more']);
|
||||
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 5) {
|
||||
$shiftOnlineDeletedItem = ExchangeDeleted::where('order_code', $item['order_code'])
|
||||
->where('shift_id', $shift_id)
|
||||
->where('item_id', $item['order_position'])
|
||||
->first();
|
||||
$unitsList = UnitsList::where('id', $shiftOnlineDeletedItem['units_id'])->first();
|
||||
$units = Units::where('id', $unitsList['unit_id'])->first();
|
||||
if ($units) {
|
||||
$unit_name = $units['name'];
|
||||
} else {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
|
||||
$dish = Dishes::getName($shiftOnlineDeletedItem['dishes_code']);
|
||||
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 11) {
|
||||
$action_name = 'Назначен гость: ' . Base::data_decode($item['value']);
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 12) {
|
||||
$action_name = 'Гость отменен: ' . Base::data_decode($item['value']);
|
||||
}
|
||||
if ($item['action_type'] == 21) {
|
||||
$item_more = Base::data_decode($item['more']);
|
||||
$item_value = Base::data_decode($item['value']);
|
||||
if ($item_more == 'предчек' && $item_value != 'HRC Pay Box') {
|
||||
$action_name = 'Распечатан предчек';
|
||||
$bill_count = $bill_count + 1;
|
||||
} elseif ($item_more == 'счет') {
|
||||
$action_name = 'Распечатан окончательный счет';
|
||||
} elseif ($item_value == 'HRC Pay Box') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 22) {
|
||||
$dish = Dishes::getName($item['order_position']);
|
||||
$action_name = 'Отменена позиции: ' . $dish . ' в количестве ' . $item['value'];
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 24) {
|
||||
$action_name = 'Оплачено наличными: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 25) {
|
||||
$action_name = 'Безналичный расчет: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 26) {
|
||||
$action_name = 'Оплачено кредитной картой: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 26) {
|
||||
$action_name = 'Оплачено кредитной картой: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 27) {
|
||||
$action_name = 'Питание штата: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 28) {
|
||||
$action_name = 'Зачтен аванс: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 29 && $item['value'] > 0) {
|
||||
$action_name = 'Сдача: ' . $item['value'] . ' BYN';
|
||||
} elseif ($item['action_type'] == 29 && $item['value'] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 35) {
|
||||
$action_name = $action_name . ': ' . $item['value'];
|
||||
$slice_items = [];
|
||||
if ($item['more']) {
|
||||
if (Base::validate_json($item['more'])) {
|
||||
$slice_order_items = json_decode(utf8_encode($item['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
} else {
|
||||
$slice_order_items = json_decode(utf8_encode(base64_decode($item['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
}
|
||||
$slice_order_items = $slice_order_items['items'];
|
||||
$slice_order = $item['value'];
|
||||
foreach ($slice_order_items as $key => $slice_order_item) {
|
||||
$slice_items[] = array('id' => $key + 1, 'name' => $slice_order_item['name'], 'count' => $slice_order_item['count']);
|
||||
}
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$sliced_order_items[] = array('order' => $slice_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $slice_items);
|
||||
$slice_trigger = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 31) {
|
||||
$action_name = $action_name . ' c заказом: ' . $item['value'];
|
||||
$merge_order = $item['value'];
|
||||
$item_actions = ExchangeActions::where('order_code', $item['value'] + 0)
|
||||
->where('shift_id', $shift_id)
|
||||
->where('action_type', 32)
|
||||
->get();
|
||||
foreach ($item_actions as $key => $item_action) {
|
||||
if ($item_action['more'] != '') {
|
||||
$merge_items_before = $merge_items_after = $merge_items = $merge_order_item_before = $merge_order_item_after = $merged_items = [];
|
||||
if (Base::validate_json($item_action['more'])) {
|
||||
$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
} else {
|
||||
$merge_order_items = json_decode(base64_decode($item_action['more']), true);
|
||||
}
|
||||
|
||||
$merge_order_items_before = $merge_order_items['before']['items'];
|
||||
$merge_order_items_after = $merge_order_items['after']['items'];
|
||||
|
||||
foreach ($merge_order_items_before as $key => $merge_order_item_before) {
|
||||
$merge_items_before[] = array('id' => $key + 1,
|
||||
'code' => $merge_order_item_before['id'],
|
||||
'name' => $merge_order_item_before['name'],
|
||||
'count' => $merge_order_item_before['count']);
|
||||
}
|
||||
foreach ($merge_order_items_after as $key => $merge_order_item_after) {
|
||||
$merge_items_after[] = array('id' => $key + 1,
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count']);
|
||||
}
|
||||
foreach ($merge_order_items_after as $key => $merge_order_item_after) {
|
||||
if (!in_array(array('id' => $key + 1,
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count']), $merge_items_before, true)) {
|
||||
$merged_items[] = array('code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count']);
|
||||
}
|
||||
}
|
||||
foreach ($merged_items as $key => $merged_item) {
|
||||
$merge_items[] = array('id' => $key + 1,
|
||||
'code' => $merged_item['code'],
|
||||
'name' => $merged_item['name'],
|
||||
'count' => $merged_item['count']);
|
||||
}
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$merged_order_items[] = array('order' => $merge_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $merge_items);
|
||||
$merge_trigger = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($item['action_type'] == 39) {
|
||||
$action_name = Base::data_decode($item['value']);
|
||||
$order_data = ExchangeActions::where('order_code', $item['order_code'] + 0)
|
||||
->where('shift_id', $shift_id)
|
||||
->where('action_type', 39)
|
||||
->get();
|
||||
foreach ($order_data as $key => $data) {
|
||||
$staff_name = Staff::getName($data['who']);
|
||||
$moved_order_data[] = array('staff_name' => $staff_name, 'time' => date('d.m.Y H:i:s', strtotime($data['time'])), 'data' => Base::data_decode($data['value']));
|
||||
$move_trigger = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 45) {
|
||||
$action_name = Base::data_decode($item['value']);
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 46) {
|
||||
$action_name = 'Изменено количество гостей: ' . $item['value'];
|
||||
}
|
||||
|
||||
if ($item['action_type'] == 47) {
|
||||
$items = ExchangeItems::where('code', $item['order_position'])
|
||||
->where('shift_id', $shift_id)
|
||||
->first();
|
||||
$dish = Dishes::getName($items['menu_code']);
|
||||
$course = $item['value'] + 1;
|
||||
$action_name = 'Установлен курс №' . $course . ' для позиции: ' . $dish;
|
||||
}
|
||||
|
||||
$order_info[] = array('id' => $key, 'action' => $action_name, 'who' => $staff_name, 'time' => $item['time'], 'workgroup' => $item['workgroup'], 'workcode' => $item['workcode']);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'actions' => $order_info,
|
||||
'bill' => $bill_count,
|
||||
'slice_trigger' => $slice_trigger,
|
||||
'merge_trigger' => $merge_trigger,
|
||||
'move_trigger' => $move_trigger,
|
||||
'sliced_order_items' => $sliced_order_items,
|
||||
'merged_order_items' => $merged_order_items,
|
||||
'moved_order_data' => $moved_order_data,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---*/
|
||||
$bill_count = 0;
|
||||
$slice_trigger = 0;
|
||||
$slice_order = 0;
|
||||
$merged_order_items = $sliced_order_items = $moved_order_data = [];
|
||||
$merge_trigger = 0;
|
||||
$move_trigger = 0;
|
||||
|
||||
|
||||
$order = ShiftOnlineActions::where('order_code', $input['order_id'])->orderBy('time', 'asc')->get();
|
||||
foreach ($order as $key => $item) {
|
||||
$action_type = ActionTypes::where('type_id', $item['type_action'])->first();
|
||||
$action_name = $action_type['name'];
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
|
||||
if ($item['type_action'] == 1) {
|
||||
$action_name = 'Заказ создан';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 2) {
|
||||
$shiftOnlineItem = ShiftOnlineItems::where('order_code', $item['order_code'])->where('dish_code', $item['more'])->first();
|
||||
$unitsList = UnitsList::where('id', $shiftOnlineItem['units_code'])->first();
|
||||
$units = Units::where('id', $unitsList['unit_id'])->first();
|
||||
if ($units) {
|
||||
$unit_name = $units['name'];
|
||||
} else {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
$dish = Dishes::getName($item['more']);
|
||||
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 5) {
|
||||
$shiftOnlineDeletedItem = ShiftOnlineDeleted::where('order_code', $item['order_code'])->where('item_id', $item['order_position'])->first();
|
||||
$unitsList = UnitsList::where('id', $shiftOnlineDeletedItem['units_id'])->first();
|
||||
$units = Units::where('id', $unitsList['unit_id'])->first();
|
||||
if ($units) {
|
||||
$unit_name = $units['name'];
|
||||
} else {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
|
||||
$dish = Dishes::getName($shiftOnlineDeletedItem['dishes_code']);
|
||||
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 11) {
|
||||
$action_name = 'Назначен гость: ' . Base::data_decode($item['value']);
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 12) {
|
||||
$action_name = 'Гость отменен: ' . Base::data_decode($item['value']);
|
||||
}
|
||||
if ($item['type_action'] == 21) {
|
||||
$item_more = Base::data_decode($item['more']);
|
||||
$item_value = Base::data_decode($item['value']);
|
||||
if ($item_more == 'предчек' && $item_value != 'HRC Pay Box') {
|
||||
$action_name = 'Распечатан предчек';
|
||||
$bill_count = $bill_count + 1;
|
||||
} elseif ($item_more == 'счет') {
|
||||
$action_name = 'Распечатан окончательный счет';
|
||||
} elseif ($item_value == 'HRC Pay Box') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 22) {
|
||||
$dish = Dishes::getName($item['order_position']);
|
||||
$action_name = 'Отменена позиции: ' . $dish . ' в количестве ' . $item['value'];
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 24) {
|
||||
$action_name = 'Оплачено наличными: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 25) {
|
||||
$action_name = 'Безналичный расчет: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 26) {
|
||||
$action_name = 'Оплачено кредитной картой: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 26) {
|
||||
$action_name = 'Оплачено кредитной картой: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 27) {
|
||||
$action_name = 'Питание штата: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 28) {
|
||||
$action_name = 'Зачтен аванс: ' . $item['value'] . ' BYN';
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 29 && $item['value'] > 0) {
|
||||
$action_name = 'Сдача: ' . $item['value'] . ' BYN';
|
||||
} elseif ($item['type_action'] == 29 && $item['value'] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 35) {
|
||||
$action_name = $action_name . ': ' . $item['value'];
|
||||
$slice_items = [];
|
||||
if ($item['more']) {
|
||||
if (Base::validate_json($item['more'])) {
|
||||
$slice_order_items = json_decode(utf8_encode($item['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
} else {
|
||||
$slice_order_items = json_decode(utf8_encode(base64_decode($item['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
}
|
||||
$slice_order_items = $slice_order_items['items'];
|
||||
$slice_order = $item['value'];
|
||||
foreach ($slice_order_items as $key => $slice_order_item) {
|
||||
$slice_items[] = array('id' => $key + 1, 'name' => $slice_order_item['name'], 'count' => $slice_order_item['count']);
|
||||
}
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$sliced_order_items[] = array('order' => $slice_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $slice_items);
|
||||
$slice_trigger = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 31) {
|
||||
$action_name = $action_name . ' c заказом: ' . $item['value'];
|
||||
$merge_order = $item['value'];
|
||||
$item_actions = ShiftOnlineActions::where('order_code', $item['value'] + 0)
|
||||
->where('type_action', 32)
|
||||
->get();
|
||||
foreach ($item_actions as $key => $item_action) {
|
||||
if ($item_action['more'] != '') {
|
||||
$merge_items_before = $merge_items_after = $merge_items = $merge_order_item_before = $merge_order_item_after = $merged_items = [];
|
||||
if (Base::validate_json($item_action['more'])) {
|
||||
$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
} else {
|
||||
$merge_order_items = json_decode(base64_decode($item_action['more']), true);
|
||||
}
|
||||
|
||||
$merge_order_items_before = $merge_order_items['before']['items'];
|
||||
$merge_order_items_after = $merge_order_items['after']['items'];
|
||||
|
||||
foreach ($merge_order_items_before as $key => $merge_order_item_before) {
|
||||
$merge_items_before[] = array('id' => $key + 1,
|
||||
'code' => $merge_order_item_before['id'],
|
||||
'name' => $merge_order_item_before['name'],
|
||||
'count' => $merge_order_item_before['count']);
|
||||
}
|
||||
foreach ($merge_order_items_after as $key => $merge_order_item_after) {
|
||||
$merge_items_after[] = array('id' => $key + 1,
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count']);
|
||||
}
|
||||
foreach ($merge_order_items_after as $key => $merge_order_item_after) {
|
||||
if (!in_array(array('id' => $key + 1,
|
||||
'code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count']), $merge_items_before, true)) {
|
||||
$merged_items[] = array('code' => $merge_order_item_after['id'],
|
||||
'name' => $merge_order_item_after['name'],
|
||||
'count' => $merge_order_item_after['count']);
|
||||
}
|
||||
}
|
||||
foreach ($merged_items as $key => $merged_item) {
|
||||
$merge_items[] = array('id' => $key + 1,
|
||||
'code' => $merged_item['code'],
|
||||
'name' => $merged_item['name'],
|
||||
'count' => $merged_item['count']);
|
||||
}
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$merged_order_items[] = array('order' => $merge_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $merge_items);
|
||||
$merge_trigger = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($item['type_action'] == 39) {
|
||||
$action_name = Base::data_decode($item['value']);
|
||||
$order_data = ShiftOnlineActions::where('order_code', $item['order_code'] + 0)
|
||||
->where('type_action', 39)
|
||||
->get();
|
||||
foreach ($order_data as $key => $data) {
|
||||
$staff_name = Staff::getName($data['who']);
|
||||
$moved_order_data[] = array('staff_name' => $staff_name, 'time' => date('d.m.Y H:i:s', strtotime($data['time'])), 'data' => Base::data_decode($data['value']));
|
||||
$move_trigger = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 45) {
|
||||
$action_name = Base::data_decode($item['value']);
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 46) {
|
||||
$action_name = 'Изменено количество гостей: ' . $item['value'];
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 47) {
|
||||
$items = ShiftOnlineItems::where('code', $item['order_position'])->first();
|
||||
$dish = Dishes::getName($items['menu_code']);
|
||||
$course = $item['value'] + 1;
|
||||
$action_name = 'Установлен курс №' . $course . ' для позиции: ' . $dish;
|
||||
}
|
||||
|
||||
$order_info[] = array('id' => $key, 'action' => $action_name, 'who' => $staff_name, 'time' => $item['time'], 'workgroup' => $item['workgroup'], 'workcode' => $item['workcode']);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'actions' => $order_info,
|
||||
'bill' => $bill_count,
|
||||
'slice_trigger' => $slice_trigger,
|
||||
'merge_trigger' => $merge_trigger,
|
||||
'move_trigger' => $move_trigger,
|
||||
'sliced_order_items' => $sliced_order_items,
|
||||
'merged_order_items' => $merged_order_items,
|
||||
'moved_order_data' => $moved_order_data,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
34
commands/GETOrderInfo.php
Normal file
34
commands/GETOrderInfo.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETOrderInfo extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getorderinfo';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$order_id = $input['order_id'];
|
||||
$opened = urldecode($input['opened']);
|
||||
$closed = urldecode($input['closed']);
|
||||
$shift = ShiftOnlineOrders::orderBy('opened', 'asc')->first();
|
||||
if ($shift['opened'] > $opened) {
|
||||
$order = ExchangeOrders::where('opened', $opened)->where('closed', $closed)->where('code', $order_id)->first();
|
||||
$shift_id = $order['shift_id'];
|
||||
$info = ExchangeOrders::getInfo($order_id, $shift_id);
|
||||
} else {
|
||||
$info = ShiftOnlineOrders::getInfo($order_id);
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'info' => $info,
|
||||
];
|
||||
}
|
||||
}
|
||||
138
commands/GETOutOrders.php
Normal file
138
commands/GETOutOrders.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ExchangeShifts;
|
||||
use App\Component\Models\OrderBotStorage;
|
||||
use App\Component\Models\Report;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETOutOrders extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getoutorders';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if ((array_key_exists('shift_id', $input)) === true) {
|
||||
$shifts = ExchangeShifts::select('id', 'opened', 'closed')->where('id', '=', $input['shift_id'])->get();
|
||||
if (is_array($shifts) || is_object($shifts)) {
|
||||
foreach ($shifts as $shift) {
|
||||
$out = array('id' => $shift['id'], 'opened' => $shift['opened'], 'closed' => $shift['closed']);
|
||||
}
|
||||
}
|
||||
$orders = OrderBotStorage::select('id', 'order', 'created_at')->where('created_at', '>', $out['opened'])->where('created_at', '<=', $out['closed'])->get();
|
||||
$count_items = 0;
|
||||
if (is_array($orders) || is_object($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
$order_id = $order['id'];
|
||||
$price = json_decode(base64_decode($order['order']), true)['price'];
|
||||
$items = json_decode(base64_decode($order['order']), true)['items'];
|
||||
$date = strtotime($order['created_at']);
|
||||
$newformat = date('Y-m-d H:i:s', $date);
|
||||
foreach ($items as $key => $item) {
|
||||
$out_item[$key] = array(
|
||||
'id' => $item['id'], 'name' => $item['name'], 'count' => $item['count'], 'price' => $item['price'],
|
||||
'full_price' => $item['full_price'],
|
||||
);
|
||||
$count_items += 1;
|
||||
}
|
||||
$remoteOrder[] = array(
|
||||
'id' => $order_id,
|
||||
'items_count' => $count_items,
|
||||
'items' => $out_item,
|
||||
'date' => $newformat,
|
||||
'price' => $price,
|
||||
);
|
||||
unset($out_item);
|
||||
$count_items = 0;
|
||||
}
|
||||
}
|
||||
if (isset($remoteOrder)) {
|
||||
$total_count = 0;
|
||||
$total_price = 0;
|
||||
foreach ($orders as $order) {
|
||||
$total_count += 1;
|
||||
$total_price += json_decode(base64_decode($order['order']), true)['price'];
|
||||
}
|
||||
$total = array('total_count' => $total_count, 'total_price' => $total_price);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'true',
|
||||
'shift' => $out,
|
||||
'orders' => $remoteOrder,
|
||||
'total' => $total,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'false',
|
||||
];
|
||||
}
|
||||
}
|
||||
if ((array_key_exists('start_date', $input)) === true) {
|
||||
$start_t = strtotime($input['start_date']) + 1;
|
||||
$end_t = strtotime($input['end_date']) - 1;
|
||||
$start = date('Y-m-d H:i:s', $start_t);
|
||||
$end = date('Y-m-d H:i:s', $end_t);
|
||||
$orders = OrderBotStorage::select('id', 'order', 'created_at')->where('created_at', '>', $start)->where('created_at', '<=', $end)->get();
|
||||
$count_items = 0;
|
||||
if (is_array($orders) || is_object($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
$order_id = $order['id'];
|
||||
$price = json_decode(base64_decode($order['order']), true)['price'];
|
||||
$items = json_decode(base64_decode($order['order']), true)['items'];
|
||||
$date = strtotime($order['created_at']);
|
||||
$newformat = date('Y-m-d H:i:s', $date);
|
||||
foreach ($items as $key => $item) {
|
||||
$out_item[$key] = array(
|
||||
'id' => $item['id'],
|
||||
'name' => $item['name'],
|
||||
'count' => $item['count'],
|
||||
'price' => $item['price'],
|
||||
'full_price' => $item['full_price'],
|
||||
);
|
||||
$count_items += 1;
|
||||
}
|
||||
$remoteOrder[] = array(
|
||||
'id' => $order_id,
|
||||
'items_count' => $count_items,
|
||||
'items' => $out_item,
|
||||
'date' => $newformat,
|
||||
'price' => $price,
|
||||
);
|
||||
unset($out_item);
|
||||
$count_items = 0;
|
||||
}
|
||||
}
|
||||
if (isset($remoteOrder)) {
|
||||
$total_count = 0;
|
||||
$total_price = 0;
|
||||
if (is_array($orders) || is_object($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
$total_count += 1;
|
||||
$total_price += json_decode(base64_decode($order['order']), true)['price'];
|
||||
}
|
||||
}
|
||||
$total = array('total_count' => $total_count, 'total_price' => $total_price);
|
||||
$report = new Report;
|
||||
$report->user_id = $input['admin_user_id'];
|
||||
$report->name = 'Отчет по внешним заказам';
|
||||
$report->shift_id = 0;
|
||||
$report->start_date = $start;
|
||||
$report->end_date = $end;
|
||||
$report->report_type = 'out';
|
||||
$report->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'true',
|
||||
'orders' => $remoteOrder,
|
||||
'total' => $total,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'false',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
commands/GETReports.php
Normal file
42
commands/GETReports.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Report;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETReports extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getreports';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$reports = Report::select('id', 'name', 'report_type', 'start_date', 'end_date')->orderBy('id', 'desc')->get();
|
||||
if ($reports) {
|
||||
foreach ($reports as $key => $report) {
|
||||
$data[] = array(
|
||||
'id' => $report['id'],
|
||||
'name' => $report['name'],
|
||||
'type' => $report['report_type'],
|
||||
'start_date' => date('d.m.Y', strtotime($report['start_date'])),
|
||||
'end_date' => date('d.m.Y', strtotime($report['end_date'])),
|
||||
);
|
||||
}
|
||||
if (isset($data)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'reports' => $data,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'reports' => [],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'reports' => [],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
822
commands/GETRoomMap.php
Normal file
822
commands/GETRoomMap.php
Normal file
@@ -0,0 +1,822 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\Places;
|
||||
use App\Component\Models\Settings;
|
||||
use App\Component\Models\ShiftOnlineActions;
|
||||
use App\Component\Models\ShiftOnlineDeleted;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Staff;
|
||||
use App\Component\Models\Tables;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GETRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getroommap';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
if (isset($input['method'])) {
|
||||
$method = $input['method'];
|
||||
if ($method == 'statistic') {
|
||||
if (isset($input['type'])) {
|
||||
$type = $input['type'];
|
||||
if ($type == 'place') {
|
||||
if (isset($input['place_id'])) {
|
||||
$place_id = $input['place_id'];
|
||||
$places = Places::find($place_id);
|
||||
$closed_orders_count = $closed_orders_sum = $closed_orders_client_count = 0;
|
||||
if (isset($input['table_id'])) {
|
||||
$table_id = $input['table_id'];
|
||||
$orders = ShiftOnlineOrders::where('place_name', $places->name)
|
||||
->where('table_name', strval($table_id))
|
||||
->where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$cancellations_count = $cancellations_sum = 0;
|
||||
$waited_count = $waited_sum = 0;
|
||||
$closed_count = $closed_sum = 0;
|
||||
$deleted_count = $deleted_sum = 0;
|
||||
$returned_count = $returned_sum = 0;
|
||||
$orders_info = [];
|
||||
$place_name = Places::getName($place_id);
|
||||
$setting = Settings::getValue(10);
|
||||
foreach ($orders as $order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
$returned_order_sum = 0;
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['is_deleted'] > 0
|
||||
&& $order['check_number'] > 0
|
||||
&& $order['who_open'] > 0) {
|
||||
$cancellations_count += 1;
|
||||
$cancellations_sum += $order['order_sum'];
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0) {
|
||||
$waited_count += 1;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$waited_count += 1;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$closed_count += 1;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА'
|
||||
&& $order_status != "Оплачен(*)") {
|
||||
$closed_count += 1;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
} else {
|
||||
if ($order['place_name'] != 'ДОСТАВКА') {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
}
|
||||
}
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
|
||||
if ($setting == 1) {
|
||||
$orders_info[] = array(
|
||||
'id' => $order['code'],
|
||||
'place' => $order['place_name'],
|
||||
'table' => $order['table_name'],
|
||||
'opened' => $order['opened'],
|
||||
'closed' => $order['closed'] != '0000-00-00 00:00:00' ? $order['closed'] : false,
|
||||
'who_open' => Staff::getName($order['who_open']),
|
||||
'who_close' => $order['who_close'] != 0 ? Staff::getName($order['who_close']) : false,
|
||||
'sum' => round($order['order_sum'], 2) - $returned_order_sum,
|
||||
'preCheck_count' => ShiftOnlineActions::getPreCheckCount($order['code']),
|
||||
'is_printed_before_edit' => ShiftOnlineActions::isPrintedBeforeEdit($order['code']),
|
||||
'hasMove' => ShiftOnlineActions::hasMove($order['code']),
|
||||
'hasMerge' => ShiftOnlineActions::hasMerge($order['code']),
|
||||
'hasSlice' => ShiftOnlineActions::hasSlice($order['code']),
|
||||
'hasDelete' => ShiftOnlineActions::hasDelete($order['code']),
|
||||
'status' => $order_status
|
||||
);
|
||||
} elseif ($setting == 0 && $order_status != "Доставка" && $order_status != "Оплачен(*)" && $order['place_name'] != "ДОСТАВКА") {
|
||||
$orders_info[] = array(
|
||||
'id' => $order['code'],
|
||||
'place' => $order['place_name'],
|
||||
'table' => $order['table_name'],
|
||||
'opened' => $order['opened'],
|
||||
'closed' => $order['closed'] != '0000-00-00 00:00:00' ? $order['closed'] : false,
|
||||
'who_open' => Staff::getName($order['who_open']),
|
||||
'who_close' => $order['who_close'] != 0 ? Staff::getName($order['who_close']) : false,
|
||||
'sum' => round($order['order_sum'], 2) - $returned_order_sum,
|
||||
'preCheck_count' => ShiftOnlineActions::getPreCheckCount($order['code']),
|
||||
'is_printed_before_edit' => ShiftOnlineActions::isPrintedBeforeEdit($order['code']),
|
||||
'hasMove' => ShiftOnlineActions::hasMove($order['code']),
|
||||
'hasMerge' => ShiftOnlineActions::hasMerge($order['code']),
|
||||
'hasSlice' => ShiftOnlineActions::hasSlice($order['code']),
|
||||
'hasDelete' => ShiftOnlineActions::hasDelete($order['code']),
|
||||
'status' => $order_status
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'place_name' => $place_name,
|
||||
'waited_count' => round($waited_count, 2),
|
||||
'waited_sum' => round($waited_sum, 2),
|
||||
'closed_count' => round($closed_count, 2),
|
||||
'closed_sum' => round($closed_sum, 2),
|
||||
'deleted_count' => round($deleted_count, 2),
|
||||
'deleted_sum' => round($deleted_sum, 2),
|
||||
'returned_count' => round($returned_count, 2),
|
||||
'returned_sum' => round($returned_sum, 2),
|
||||
'cancellations_count' => round($cancellations_count, 2),
|
||||
'cancellations_sum' => round($cancellations_sum, 2),
|
||||
'orders' => $orders_info
|
||||
];
|
||||
}
|
||||
$opened_orders_count = ShiftOnlineOrders::where('place_name', $places->name)
|
||||
->where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->count('id');
|
||||
$opened_orders_sum = ShiftOnlineOrders::where('place_name', $places->name)
|
||||
->where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->sum('order_sum');
|
||||
$opened_orders_client_count = ShiftOnlineOrders::where('place_name', $places->name)
|
||||
->where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->sum('client_count');
|
||||
|
||||
|
||||
$setting = Settings::getValue(10);
|
||||
$closed_orders = ShiftOnlineOrders::where('place_name', $places->name)
|
||||
->where('is_closed', 1)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('who_close', '>', 0)
|
||||
->get();
|
||||
foreach ($closed_orders as $closed_order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($closed_order['code']);
|
||||
if ($closed_order['order_sum'] >= 0
|
||||
&& $closed_order['who_open'] > 0
|
||||
&& $closed_order['who_close'] > 0
|
||||
&& $closed_order['is_closed'] == 1
|
||||
&& $closed_order['is_deleted'] == 0
|
||||
&& $closed_order['is_returned'] == 1
|
||||
&& $closed_order['place_name'] != 'ДОСТАВКА') {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($closed_order['code']);
|
||||
$returned_sum = $returned_order_sum = $returned_count = 0;
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_orders_count += 1;
|
||||
$closed_orders_sum += round($closed_order['order_sum'], 2) - $returned_order_sum;
|
||||
$closed_orders_client_count += $closed_order['client_count'];
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($closed_order['order_sum'] >= 0
|
||||
&& $closed_order['who_open'] > 0
|
||||
&& $closed_order['who_close'] > 0
|
||||
&& $closed_order['is_closed'] == 1
|
||||
&& $closed_order['is_deleted'] == 0
|
||||
&& $closed_order['is_returned'] == 0
|
||||
&& $closed_order['place_name'] != 'ДОСТАВКА') {
|
||||
$closed_orders_count += 1;
|
||||
$closed_orders_sum += $closed_order['order_sum'];
|
||||
$closed_orders_client_count += $closed_order['client_count'];
|
||||
}
|
||||
} else {
|
||||
if ($closed_order['order_sum'] >= 0
|
||||
&& $closed_order['who_open'] > 0
|
||||
&& $closed_order['who_close'] > 0
|
||||
&& $closed_order['is_closed'] == 1
|
||||
&& $closed_order['is_deleted'] == 0
|
||||
&& $closed_order['is_returned'] == 0
|
||||
&& $closed_order['place_name'] != 'ДОСТАВКА'
|
||||
&& $order_status != "Оплачен(*)") {
|
||||
$closed_orders_count += 1;
|
||||
$closed_orders_sum += $closed_order['order_sum'];
|
||||
$closed_orders_client_count += $closed_order['client_count'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'opened_orders_count' => round($opened_orders_count, 2),
|
||||
'opened_orders_sum' => round($opened_orders_sum, 2),
|
||||
'opened_orders_client_count' => round($opened_orders_client_count, 2),
|
||||
'closed_orders_count' => round($closed_orders_count, 2),
|
||||
'closed_orders_sum' => round($closed_orders_sum, 2),
|
||||
'closed_orders_client_count' => round($closed_orders_client_count, 2),
|
||||
];
|
||||
}
|
||||
}
|
||||
if ($type == 'places') {
|
||||
$setting = Settings::getValue(10);
|
||||
$opened_orders_count = $opened_orders_sum = $opened_orders_client_count = 0;
|
||||
if ($setting > 0) {
|
||||
$opened_orders_count = ShiftOnlineOrders::where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->count('id');
|
||||
$opened_orders_sum = ShiftOnlineOrders::where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->sum('order_sum');
|
||||
$opened_orders_client_count = ShiftOnlineOrders::where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->sum('client_count');
|
||||
} else {
|
||||
$opened_orders_count = ShiftOnlineOrders::where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('place_name', '<>', 'ДОСТАВКА')
|
||||
->count('id');
|
||||
$opened_orders_sum = ShiftOnlineOrders::where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('place_name', '<>', 'ДОСТАВКА')
|
||||
->sum('order_sum');
|
||||
$opened_orders_client_count = ShiftOnlineOrders::where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('place_name', '<>', 'ДОСТАВКА')
|
||||
->sum('client_count');
|
||||
}
|
||||
|
||||
$closed_orders = ShiftOnlineOrders::where('is_closed', 1)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('who_close', '>', 0)
|
||||
->get();
|
||||
$closed_orders_count = $closed_orders_sum = $closed_orders_client_count = 0;
|
||||
foreach ($closed_orders as $closed_order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($closed_order['code']);
|
||||
if ($closed_order['order_sum'] >= 0
|
||||
&& $closed_order['who_open'] > 0
|
||||
&& $closed_order['who_close'] > 0
|
||||
&& $closed_order['is_closed'] == 1
|
||||
&& $closed_order['is_deleted'] == 0
|
||||
&& $closed_order['is_returned'] == 1
|
||||
&& $closed_order['place_name'] != 'ДОСТАВКА') {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($closed_order['code']);
|
||||
$returned_sum = $returned_order_sum = $returned_count = 0;
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_orders_count += 1;
|
||||
$closed_orders_sum += round($closed_order['order_sum'], 2) - $returned_order_sum;
|
||||
$closed_orders_client_count += $closed_order['client_count'];
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($closed_order['order_sum'] >= 0
|
||||
&& $closed_order['who_open'] > 0
|
||||
&& $closed_order['who_close'] > 0
|
||||
&& $closed_order['is_closed'] == 1
|
||||
&& $closed_order['is_deleted'] == 0
|
||||
&& $closed_order['is_returned'] == 0
|
||||
&& $closed_order['place_name'] != 'ДОСТАВКА') {
|
||||
$closed_orders_count += 1;
|
||||
$closed_orders_sum += $closed_order['order_sum'];
|
||||
$closed_orders_client_count += $closed_order['client_count'];
|
||||
}
|
||||
} else {
|
||||
if ($closed_order['order_sum'] >= 0
|
||||
&& $closed_order['who_open'] > 0
|
||||
&& $closed_order['who_close'] > 0
|
||||
&& $closed_order['is_closed'] == 1
|
||||
&& $closed_order['is_deleted'] == 0
|
||||
&& $closed_order['is_returned'] == 0
|
||||
&& $closed_order['place_name'] != 'ДОСТАВКА'
|
||||
&& $order_status != "Оплачен(*)") {
|
||||
$closed_orders_count += 1;
|
||||
$closed_orders_sum += $closed_order['order_sum'];
|
||||
$closed_orders_client_count += $closed_order['client_count'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'opened_orders_count' => round($opened_orders_count, 2),
|
||||
'opened_orders_sum' => round($opened_orders_sum, 2),
|
||||
'opened_orders_client_count' => round($opened_orders_client_count, 2),
|
||||
'closed_orders_count' => round($closed_orders_count, 2),
|
||||
'closed_orders_sum' => round($closed_orders_sum, 2),
|
||||
'closed_orders_client_count' => round($closed_orders_client_count, 2),
|
||||
];
|
||||
}
|
||||
|
||||
if ($type == 'full') {
|
||||
if (isset($input['staff_id'])) {
|
||||
$staff_id = $input['staff_id'];
|
||||
$orders = ShiftOnlineOrders::where('who_open', $staff_id)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', $staff_id)
|
||||
->where('full_sum', '>=', 0)
|
||||
->count();
|
||||
} elseif (isset($input['guests']) && $input['guests'] == true) {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('client_code', '<>', '')
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->where('client_code', '<>', '')
|
||||
->count();
|
||||
} elseif (isset($input['deleted']) && $input['deleted'] == true) {
|
||||
$deleted_orders = ShiftOnlineDeleted::select('order_code')->groupBy('order_code')->get();
|
||||
$deleted_orders_count = ShiftOnlineDeleted::select('order_code')->count();
|
||||
$deleted_orders_id = [];
|
||||
if ($deleted_orders_count > 0) {
|
||||
foreach ($deleted_orders as $deleted_order) {
|
||||
$deleted_orders_id[] = $deleted_order['order_code'];
|
||||
}
|
||||
}
|
||||
|
||||
$orders = ShiftOnlineOrders::whereIn('code', $deleted_orders_id)
|
||||
->where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$orders_count = $deleted_orders_count;
|
||||
} elseif (isset($input['discounts']) && $input['discounts'] == true) {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('sale_sum', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('sale_sum', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->count();
|
||||
} else {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$orders_count = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->count();
|
||||
}
|
||||
$cancellations_count = $cancellations_sum = 0;
|
||||
$waited_count = $waited_sum = 0;
|
||||
$closed_count = $closed_sum = 0;
|
||||
$deleted_count = $deleted_sum = 0;
|
||||
$returned_count = $returned_sum = 0;
|
||||
$deleted_items_count = $deleted_items_sum = 0;
|
||||
$orders_info = [];
|
||||
|
||||
if ($orders_count > 0) {
|
||||
$setting = Settings::getValue(10);
|
||||
foreach ($orders as $order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
$returned_order_sum = 0;
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['is_deleted'] > 0
|
||||
&& $order['check_number'] > 0
|
||||
&& $order['who_open'] > 0) {
|
||||
$cancellations_count += 1;
|
||||
$cancellations_sum += $order['order_sum'];
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0) {
|
||||
$waited_count += 1;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$waited_count += 1;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$closed_count += 1;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА'
|
||||
&& $order_status != "Оплачен(*)") {
|
||||
$closed_count += 1;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
} else {
|
||||
if ($order['place_name'] != 'ДОСТАВКА') {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1) {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
}
|
||||
|
||||
if ($setting == 1) {
|
||||
$orders_info[] = array(
|
||||
'id' => $order['code'],
|
||||
'place' => $order['place_name'],
|
||||
'table' => $order['table_name'],
|
||||
'opened' => $order['opened'],
|
||||
'closed' => $order['closed'] != '0000-00-00 00:00:00' ? $order['closed'] : false,
|
||||
'who_open' => Staff::getName($order['who_open']),
|
||||
'who_close' => $order['who_close'] != 0 ? Staff::getName($order['who_close']) : false,
|
||||
'client_name' => $order['client_code'] != '' ? Client::getName($order['client_code']) : false,
|
||||
'sum' => round($order['order_sum'], 2) - $returned_order_sum,
|
||||
'sale_sum' => round($order['sale_sum'], 2),
|
||||
'full_sum' => round($order['full_sum'], 2) - $returned_order_sum,
|
||||
'preCheck_count' => ShiftOnlineActions::getPreCheckCount($order['code']),
|
||||
'is_printed_before_edit' => ShiftOnlineActions::isPrintedBeforeEdit($order['code']),
|
||||
'hasMove' => ShiftOnlineActions::hasMove($order['code']),
|
||||
'hasMerge' => ShiftOnlineActions::hasMerge($order['code']),
|
||||
'hasSlice' => ShiftOnlineActions::hasSlice($order['code']),
|
||||
'hasDelete' => ShiftOnlineActions::hasDelete($order['code']),
|
||||
'deleted_items_count' => $deleted_items_count,
|
||||
'deleted_items_sum' => $deleted_items_sum,
|
||||
'title' => '',
|
||||
'status' => $order_status
|
||||
);
|
||||
|
||||
|
||||
} elseif ($setting == 0 && $order_status != "Доставка" && $order_status != "Оплачен(*)" && $order['place_name'] != "ДОСТАВКА") {
|
||||
$orders_info[] = array(
|
||||
'id' => $order['code'],
|
||||
'place' => $order['place_name'],
|
||||
'table' => $order['table_name'],
|
||||
'opened' => $order['opened'],
|
||||
'closed' => $order['closed'] != '0000-00-00 00:00:00' ? $order['closed'] : false,
|
||||
'who_open' => Staff::getName($order['who_open']),
|
||||
'who_close' => $order['who_close'] != 0 ? Staff::getName($order['who_close']) : false,
|
||||
'client_name' => $order['client_code'] != '' ? Client::getName($order['client_code']) : false,
|
||||
'sum' => round($order['order_sum'], 2) - $returned_order_sum,
|
||||
'sale_sum' => round($order['sale_sum'], 2),
|
||||
'full_sum' => round($order['full_sum'], 2) - $returned_order_sum,
|
||||
'preCheck_count' => ShiftOnlineActions::getPreCheckCount($order['code']),
|
||||
'is_printed_before_edit' => ShiftOnlineActions::isPrintedBeforeEdit($order['code']),
|
||||
'hasMove' => ShiftOnlineActions::hasMove($order['code']),
|
||||
'hasMerge' => ShiftOnlineActions::hasMerge($order['code']),
|
||||
'hasSlice' => ShiftOnlineActions::hasSlice($order['code']),
|
||||
'hasDelete' => ShiftOnlineActions::hasDelete($order['code']),
|
||||
'deleted_items_count' => $deleted_items_count,
|
||||
'deleted_items_sum' => $deleted_items_sum,
|
||||
'title' => '',
|
||||
'status' => $order_status
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'waited_count' => round($waited_count, 2),
|
||||
'waited_sum' => round($waited_sum, 2),
|
||||
'closed_count' => round($closed_count, 2),
|
||||
'closed_sum' => round($closed_sum, 2),
|
||||
'deleted_count' => round($deleted_count, 2),
|
||||
'deleted_sum' => round($deleted_sum, 2),
|
||||
'returned_count' => round($returned_count, 2),
|
||||
'returned_sum' => round($returned_sum, 2),
|
||||
'cancellations_count' => round($cancellations_count, 2),
|
||||
'cancellations_sum' => round($cancellations_sum, 2),
|
||||
'orders' => $orders_info
|
||||
];
|
||||
}
|
||||
|
||||
if ($type == 'dashboard') {
|
||||
$orders = ShiftOnlineOrders::where('who_open', '>', 0)
|
||||
->where('full_sum', '>=', 0)
|
||||
->get();
|
||||
$cancellations_count = $cancellations_sum = 0;
|
||||
$waited_count = $waited_sum = 0;
|
||||
$closed_count = $closed_sum = 0;
|
||||
$deleted_count = $deleted_sum = 0;
|
||||
$returned_count = $returned_sum = 0;
|
||||
$setting = Settings::getValue(10);
|
||||
foreach ($orders as $order) {
|
||||
$order_status = ShiftOnlineOrders::getOrderStatus($order['code']);
|
||||
$returned_order_sum = 0;
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['is_deleted'] > 0
|
||||
&& $order['check_number'] > 0
|
||||
&& $order['who_open'] > 0) {
|
||||
$cancellations_count += 1;
|
||||
$cancellations_sum += $order['order_sum'];
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0) {
|
||||
$waited_count += 1;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$waited_count += 1;
|
||||
$waited_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$closed_count += 1;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 0
|
||||
&& $order['place_name'] != 'ДОСТАВКА'
|
||||
&& $order_status != "Оплачен(*)") {
|
||||
$closed_count += 1;
|
||||
$closed_sum += $order['order_sum'];
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
|
||||
} else {
|
||||
if ($order['place_name'] != 'ДОСТАВКА') {
|
||||
$deleted_items_count = ShiftOnlineDeleted::where('order_code', $order['code'])->sum('count');
|
||||
$deleted_items_sum = ShiftOnlineDeleted::selectRaw('sum(sale_price * count) as deleted_sum')
|
||||
->where('order_code', $order['code'])
|
||||
->first();
|
||||
$deleted_items_sum = $deleted_items_sum['deleted_sum'];
|
||||
$deleted_count += $deleted_items_count;
|
||||
$deleted_sum += $deleted_items_sum;
|
||||
}
|
||||
}
|
||||
if ($setting > 0) {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1
|
||||
&& $order['place_name'] != 'ДОСТАВКА') {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
} else {
|
||||
if ($order['order_sum'] >= 0
|
||||
&& $order['who_open'] > 0
|
||||
&& $order['who_close'] > 0
|
||||
&& $order['is_closed'] == 1
|
||||
&& $order['is_deleted'] == 0
|
||||
&& $order['is_returned'] == 1) {
|
||||
$returned_items = ShiftOnlineOrders::getReturnedItems($order['code']);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_order_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
}
|
||||
$closed_count += 1;
|
||||
$closed_sum += round($order['order_sum'], 2) - $returned_order_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'waited_count' => round($waited_count, 2),
|
||||
'waited_sum' => round($waited_sum, 2),
|
||||
'closed_count' => round($closed_count, 2),
|
||||
'closed_sum' => round($closed_sum, 2),
|
||||
'deleted_count' => round($deleted_count, 2),
|
||||
'deleted_sum' => round($deleted_sum, 2),
|
||||
'returned_count' => round($returned_count, 2),
|
||||
'returned_sum' => round($returned_sum, 2),
|
||||
'cancellations_count' => round($cancellations_count, 2),
|
||||
'cancellations_sum' => round($cancellations_sum, 2)
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($method == 'map') {
|
||||
$roommap = [];
|
||||
if (isset($input['type'])) {
|
||||
$type = $input['type'];
|
||||
if ($type == 'places') {
|
||||
$places = Places::all();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'places' => $places,
|
||||
];
|
||||
}
|
||||
if ($type == 'place' && isset($input['id'])) {
|
||||
$place = Places::find($input['id']);
|
||||
$place_name = $place->name;
|
||||
$place_image = $place->image;
|
||||
$tables = Tables::where('place_id', $input['id'])
|
||||
->get();
|
||||
foreach ($tables as $table) {
|
||||
$opened_order_sum = ShiftOnlineOrders::where('place_name', $place_name)
|
||||
->where('table_name', strval($table['table_id']))
|
||||
->where('is_closed', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('who_open', '>', 0)
|
||||
->where('is_returned', 0)
|
||||
->sum('order_sum');
|
||||
$orders_count = ShiftOnlineOrders::where('place_name', $place_name)
|
||||
->where('table_name', strval($table['table_id']))
|
||||
->where('who_open', '>', 0)
|
||||
->count();
|
||||
$tables_info[] = array(
|
||||
'id' => $table['id'],
|
||||
'name' => $table['name'],
|
||||
'place_id' => $table['place_id'],
|
||||
'table_id' => $table['table_id'],
|
||||
'type' => $table['type'],
|
||||
'width' => $table['width'],
|
||||
'height' => $table['height'],
|
||||
'x' => $table['x'],
|
||||
'y' => $table['y'],
|
||||
'sum' => floatval($opened_order_sum),
|
||||
'count' => $orders_count
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'place_id' => $input['id'],
|
||||
'place' => $place_name,
|
||||
'place_image' => $place_image,
|
||||
'tables' => $tables_info,
|
||||
];
|
||||
}
|
||||
if ($type == 'full') {
|
||||
$places = Places::all();
|
||||
foreach ($places as $place) {
|
||||
$tables = Tables::where('place_id', $place['id'])
|
||||
->get();
|
||||
$roommap[] = array(
|
||||
'place_id' => $place['id'],
|
||||
'place_name' => $place['name'],
|
||||
'tables' => $tables
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'roommap' => $roommap,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ['status' => 'success',
|
||||
'message' => 'Ошибка данных запроса',];
|
||||
}
|
||||
}
|
||||
191
commands/GETRoomMapFile.php
Normal file
191
commands/GETRoomMapFile.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Base;
|
||||
use App\Component\Models\Places;
|
||||
use App\Component\Models\Tables;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Mtownsend\XmlToArray\XmlToArray;
|
||||
|
||||
class GETRoomMapFile extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getroommapfile';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
|
||||
$files = [];
|
||||
$dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\places\\";
|
||||
Http::post('https://portal.hrc.by/api/cloud/folder', [
|
||||
'code' => $terminal['key'],
|
||||
'folder' => 'places',
|
||||
'project_code' => 'hrc',
|
||||
'api' => '2.0',
|
||||
]);
|
||||
$response_files = Http::get('https://portal.hrc.by/api/cloud/list?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&folder=places');
|
||||
if (count($response_files->json()['files']) > 0) {
|
||||
foreach ($response_files->json()['files'] as $response) {
|
||||
$filename = $response['filename'];
|
||||
$basename = $response['basename'];
|
||||
$files[$response['timestamp']] = array(
|
||||
'filename' => $filename,
|
||||
'basename' => $basename
|
||||
);
|
||||
}
|
||||
if (count($files) == 0) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Файлы не найдены'
|
||||
];
|
||||
}
|
||||
$iMaxArrayIndex = max(array_keys($files));
|
||||
$basename = $files[$iMaxArrayIndex]['basename'];
|
||||
$download_files = Http::get('https://portal.hrc.by/api/cloud/download?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&path=/places/' . $basename);
|
||||
$file = base64_decode($download_files->json()['content']);
|
||||
if (!is_dir($dirname)) {
|
||||
mkdir($dirname, 0755, 'w+');
|
||||
}
|
||||
if (file_exists($dirname . $basename)) {
|
||||
unlink($dirname . $basename);
|
||||
}
|
||||
$handle = fopen($dirname . $basename, 'w+');
|
||||
fputs($handle, chr(0xEF) . chr(0xBB) . chr(0xBF)); // BOM
|
||||
file_put_contents($dirname . $basename, $file);
|
||||
fclose($handle);
|
||||
foreach ($files as $file) {
|
||||
Http::delete('https://portal.hrc.by/api/cloud/file', [
|
||||
'code' => $terminal['key'],
|
||||
'name' => $file['basename'],
|
||||
'folder' => 'places',
|
||||
'project_code' => 'hrc',
|
||||
'api' => '2.0',
|
||||
]);
|
||||
}
|
||||
$places_file = $dirname . $basename;
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Файлы не найдены'
|
||||
];
|
||||
}
|
||||
|
||||
$xmlPlaces = XmlToArray::convert(file_get_contents($places_file));
|
||||
Schema::disableForeignKeyConstraints();
|
||||
DB::table('place_tables')->truncate();
|
||||
DB::table('places')->truncate();
|
||||
Schema::enableForeignKeyConstraints();
|
||||
if (count($xmlPlaces['Place']) > 1) {
|
||||
$places = $xmlPlaces['Place'];
|
||||
foreach ($places as $place) {
|
||||
$newPlace = new Places;
|
||||
$newPlace->name = $place['@attributes']['name'];
|
||||
if ($place['@attributes']['image'] != "false") {
|
||||
$newPlace->image = base64_encode(Base::customBase64Decode($place['@attributes']['image']));
|
||||
$newPlace->save();
|
||||
$image = $newPlace->image;
|
||||
$imageName = "place-" . $newPlace->id . ".png";
|
||||
file_put_contents($dirname . $imageName, base64_decode($image));
|
||||
} else {
|
||||
$newPlace->save();
|
||||
}
|
||||
$tables = $place['Table'];
|
||||
if (count($tables) > 1) {
|
||||
foreach ($tables as $table) {
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table['@attributes']['text'];
|
||||
$newTable->table_id = intval($table['@attributes']['number']);
|
||||
$newTable->place_id = $newPlace['id'];
|
||||
$newTable->width = $table['@attributes']['width'];
|
||||
$newTable->height = $table['@attributes']['height'];
|
||||
$newTable->x = $table['@attributes']['y'];
|
||||
$newTable->y = $table['@attributes']['x'];
|
||||
if (isset($table['@attributes']['type'])) {
|
||||
$newTable->type = intval($table['@attributes']['type']);
|
||||
} else {
|
||||
$newTable->type = 0;
|
||||
}
|
||||
$newTable->save();
|
||||
}
|
||||
} else {
|
||||
$table = $place['Table'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table['@attributes']['text'];
|
||||
$newTable->table_id = intval($table['@attributes']['number']);
|
||||
$newTable->place_id = $newPlace['id'];
|
||||
$newTable->width = $table['@attributes']['width'];
|
||||
$newTable->height = $table['@attributes']['height'];
|
||||
$newTable->x = $table['@attributes']['y'];
|
||||
$newTable->y = $table['@attributes']['x'];
|
||||
if (isset($table['@attributes']['type'])) {
|
||||
$newTable->type = intval($table['@attributes']['type']);
|
||||
} else {
|
||||
$newTable->type = 0;
|
||||
}
|
||||
$newTable->save();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$place = $xmlPlaces['Place'];
|
||||
$newPlace = new Places;
|
||||
$newPlace->name = $place['@attributes']['name'];
|
||||
if ($place['@attributes']['image'] != "false") {
|
||||
$newPlace->image = $place['@attributes']['image'];
|
||||
$newPlace->save();
|
||||
$image = $newPlace->image;
|
||||
$image = str_replace(array('\r\n', '\r', '\n'), '', $image);
|
||||
$image = str_replace(' ', '', $image);
|
||||
$imageName = "place-" . $newPlace->id . ".png";
|
||||
file_put_contents($dirname . $imageName, base64_decode($image));
|
||||
} else {
|
||||
$newPlace->save();
|
||||
}
|
||||
$tables = $place['Table'];
|
||||
if (count($tables) > 1) {
|
||||
foreach ($tables as $table) {
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table['@attributes']['text'];
|
||||
$newTable->table_id = intval($table['@attributes']['number']);
|
||||
$newTable->place_id = $newPlace['id'];
|
||||
$newTable->width = $table['@attributes']['width'];
|
||||
$newTable->height = $table['@attributes']['height'];
|
||||
$newTable->x = $table['@attributes']['y'];
|
||||
$newTable->y = $table['@attributes']['x'];
|
||||
if (isset($table['@attributes']['type'])) {
|
||||
$newTable->type = intval($table['@attributes']['type']);
|
||||
} else {
|
||||
$newTable->type = 0;
|
||||
}
|
||||
$newTable->save();
|
||||
}
|
||||
} else {
|
||||
$table = $place['Table'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table['@attributes']['text'];
|
||||
$newTable->table_id = intval($table['@attributes']['number']);
|
||||
$newTable->place_id = $newPlace['id'];
|
||||
$newTable->width = $table['@attributes']['width'];
|
||||
$newTable->height = $table['@attributes']['height'];
|
||||
$newTable->x = $table['@attributes']['y'];
|
||||
$newTable->y = $table['@attributes']['x'];
|
||||
if (isset($table['@attributes']['type'])) {
|
||||
$newTable->type = intval($table['@attributes']['type']);
|
||||
} else {
|
||||
$newTable->type = 0;
|
||||
}
|
||||
$newTable->save();
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'places' => $xmlPlaces
|
||||
];
|
||||
}
|
||||
}
|
||||
70
commands/GETSettings.php
Normal file
70
commands/GETSettings.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Settings;
|
||||
use App\Component\Commands\Methods\Cache;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETSettings extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'getsettings';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
if (isset($input['method'])) {
|
||||
$method = $input['method'];
|
||||
if ($method == 'terminals') {
|
||||
$out = [];
|
||||
$terminals = Terminal::get();
|
||||
foreach ($terminals as $terminal) {
|
||||
if ($terminal['is_active'] === 1) {
|
||||
$is_active = true;
|
||||
} else {
|
||||
$is_active = false;
|
||||
}
|
||||
|
||||
$out[] = array(
|
||||
'id' => $terminal['id'],
|
||||
'name' => $terminal['name'],
|
||||
'work_code' => $terminal['work_code'],
|
||||
'work_group' => $terminal['work_group'],
|
||||
'soft' => $terminal['soft'],
|
||||
'is_active' => $is_active,
|
||||
'key' => $terminal['key'],
|
||||
'last_activity' => $terminal['last_activity'],
|
||||
);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminals' => $out,
|
||||
];
|
||||
}
|
||||
}
|
||||
if (isset($input['code'])) {
|
||||
$setting = Settings::where('code', $input['code'])
|
||||
->first();
|
||||
if ($setting) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'code' => $setting['code'],
|
||||
'value' => $setting['value'],
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Setting not found',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$settings = Settings::all();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'settings' => $settings,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
84
commands/GETTopDishes.php
Normal file
84
commands/GETTopDishes.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETTopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'gettopdishes';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
|
||||
if ($terminal) {
|
||||
$terminalKey = $terminal['key'];
|
||||
} else {
|
||||
$terminalKey = 0;
|
||||
}
|
||||
$allOrders = ShiftOnlineOrders::select('code')
|
||||
->where('is_closed', 1)
|
||||
->where('is_returned', 0)
|
||||
->where('is_deleted', 0)
|
||||
->get();
|
||||
$orders = [];
|
||||
foreach ($allOrders as $order) {
|
||||
$orders[] = array($order['code']);
|
||||
}
|
||||
$info = ShiftOnlineItems::where('menu_code', '>', 0)
|
||||
->whereIn('order_code', $orders)
|
||||
->get()
|
||||
->unique('menu_code');
|
||||
$count = ShiftOnlineItems::where('menu_code', '>', 0)
|
||||
->whereIn('order_code', $orders)
|
||||
->count();
|
||||
if ($count > 0) {
|
||||
foreach ($info as $key => $value) {
|
||||
$out[] = $value;
|
||||
}
|
||||
foreach ($out as $key => $item) {
|
||||
$onlineDishInfo = ShiftOnlineItems::where('menu_code', '=', $item['menu_code'])
|
||||
->where('dish_code', '=', $item['dish_code'])
|
||||
->whereIn('order_code', $orders)
|
||||
->first();
|
||||
$dishName = Dishes::getName($item['dish_code']);
|
||||
$dishCount = ShiftOnlineItems::where('menu_code', '=', $item['menu_code'])
|
||||
->whereIn('order_code', $orders)
|
||||
->sum('count');
|
||||
$dishSum = $onlineDishInfo['real_price'] * $dishCount;
|
||||
if ($dishSum > 0) {
|
||||
$dishTotalCost = round(($onlineDishInfo['special_price'] * $dishCount), 2);
|
||||
$dishPercent = round((100 - ((($dishSum - $dishTotalCost) * 100) / $dishSum)), 2);
|
||||
$dishProfit = $dishSum - $dishTotalCost;
|
||||
} else {
|
||||
$dishTotalCost = 0;
|
||||
$dishPercent = 0;
|
||||
$dishProfit = 0;
|
||||
}
|
||||
$dishes[] = array('name' => $dishName, 'count' => $dishCount, 'sum' => $dishSum, 'totalCost' => $dishTotalCost, 'percentProffit' => $dishPercent, 'proffit' => $dishProfit);
|
||||
}
|
||||
for ($i = 0; $i < count($dishes); $i++) {
|
||||
$sortkey[$i] = $dishes[$i]['count'];
|
||||
}
|
||||
arsort($sortkey);
|
||||
foreach ($sortkey as $key => $key) {
|
||||
$sorted[] = $dishes[$key];
|
||||
}
|
||||
$sorted = array_slice($sorted, 0, 10);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'dishes' => $sorted,
|
||||
'terminal' => $terminalKey,
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'dishes' => [],
|
||||
'terminal' => $terminalKey,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
126
commands/GETTopDishesNewYear.php
Normal file
126
commands/GETTopDishesNewYear.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\ExchangeItems;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class GETTopDishesNewYear extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'gettopdishesnewyear';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->first();
|
||||
$dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\";
|
||||
$filename = "newyear.json";
|
||||
if (!is_dir($dirname)) {
|
||||
mkdir($dirname, 0777);
|
||||
}
|
||||
if (!file_exists($dirname . $filename)) {
|
||||
$info = ExchangeItems::where('menu_code', '>', 0)
|
||||
->where('real_price', '>', 1)
|
||||
->where('created_at', '>=', '2021-01-01 00:00:00')
|
||||
->where('created_at', '<', '2021-12-31 23:59:59')
|
||||
->get()
|
||||
->unique('menu_code');
|
||||
$count = ExchangeItems::where('menu_code', '>', 0)->where('created_at', '>=', '2021-01-01 00:00:00')->where('created_at', '<', '2021-12-31 23:59:59')->count();
|
||||
if ($count > 0) {
|
||||
foreach ($info as $key => $value) {
|
||||
$out[] = $value;
|
||||
}
|
||||
foreach ($out as $key => $item) {
|
||||
$dishInfo = Dishes::where('code', '=', $item['menu_code'])
|
||||
->where('legacy_code', '=', $item['dishes_code'])
|
||||
// ->where('is_history', '=', 0)
|
||||
->first();
|
||||
$onlineDishInfo = ExchangeItems::where('menu_code', '=', $item['menu_code'])
|
||||
->where('dishes_code', '=', $item['dishes_code'])
|
||||
->where('created_at', '>=', '2021-01-01 00:00:00')
|
||||
->where('created_at', '<', '2021-12-31 23:59:59')
|
||||
->first();
|
||||
$dishName = $dishInfo['name'];
|
||||
$dishCount = ExchangeItems::where('menu_code', '=', $item['menu_code'])
|
||||
->where('created_at', '>=', '2021-01-01 00:00:00')
|
||||
->where('created_at', '<', '2021-12-31 23:59:59')
|
||||
->sum('count');
|
||||
$dishSum = $onlineDishInfo['real_price'] * $dishCount;
|
||||
if ($dishSum > 0) {
|
||||
$dishTotalCost = round(($onlineDishInfo['special_price'] * $dishCount), 2);
|
||||
$dishPercent = round((100 - ((($dishSum - $dishTotalCost) * 100) / $dishSum)), 2);
|
||||
$dishProfit = $dishSum - $dishTotalCost;
|
||||
} else {
|
||||
$dishTotalCost = 0;
|
||||
$dishPercent = 0;
|
||||
$dishProfit = 0;
|
||||
}
|
||||
$dishes[] = array('name' => $dishName, 'count' => intval($dishCount), 'sum' => intval($dishSum), 'totalCost' => intval($dishTotalCost), 'percentProffit' => $dishPercent, 'proffit' => $dishProfit);
|
||||
}
|
||||
for ($i = 0; $i < count($dishes); $i++) {
|
||||
$sortkey[$i] = $dishes[$i]['count'];
|
||||
}
|
||||
arsort($sortkey);
|
||||
foreach ($sortkey as $key => $key) {
|
||||
$sorted[] = $dishes[$key];
|
||||
}
|
||||
$sorted = array_slice($sorted, 0, 3);
|
||||
//End top dishes counter
|
||||
|
||||
//Start top day
|
||||
//SELECT COUNT(`code`) AS `orders_counter`, `shift_id` FROM `exchange_orders` WHERE `is_closed` > 0 AND `opened` > '2021-01-01 00:00:00' GROUP BY `shift_id` ORDER BY `orders_counter` desc
|
||||
$shifts = ExchangeOrders::where('is_closed', '>', 0)
|
||||
->where('opened', '>', '2021-01-01 00:00:00')
|
||||
->get()
|
||||
->unique('shift_id');
|
||||
foreach ($shifts as $key => $shift) {
|
||||
$shift_id = $shift['shift_id'];
|
||||
$shift_order_count = ExchangeOrders::where('shift_id', '=', $shift_id)->count();
|
||||
$shift_order_sum = ExchangeOrders::where('shift_id', '=', $shift_id)->sum('order_sum');
|
||||
$shift_date = ExchangeOrders::where('shift_id', '=', $shift_id)->first();
|
||||
$tr_m = ['Нулябрь' /* для сдвига индекса на +1*/, 'Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'];
|
||||
$exp_date = getdate(strtotime($shift_date['opened']));
|
||||
$full_datedate = sprintf(
|
||||
'%d %s %d',
|
||||
$exp_date['mday'],
|
||||
$tr_m[$exp_date['mon']],
|
||||
$exp_date['year']
|
||||
);
|
||||
$shift_counter[] = array('shift_id' => $shift_id, 'count' => $shift_order_count, 'date' => $full_datedate, 'sum' => $shift_order_sum);
|
||||
}
|
||||
for ($i = 0; $i < count($shift_counter); $i++) {
|
||||
$shift_counter_sortkey[$i] = $shift_counter[$i]['count'];
|
||||
}
|
||||
arsort($shift_counter_sortkey);
|
||||
foreach ($shift_counter_sortkey as $key => $key) {
|
||||
$shift_counter_sorted[] = $shift_counter[$key];
|
||||
}
|
||||
$shift_counter_sorted = array_slice($shift_counter_sorted, 0, 1);
|
||||
//End top day
|
||||
|
||||
//Return data
|
||||
$data = [
|
||||
'status' => 'success',
|
||||
'count' => $count,
|
||||
'dishes' => $sorted,
|
||||
'top_shift' => $shift_counter_sorted,
|
||||
'in_file' => 1,
|
||||
];
|
||||
$handle = fopen($dirname . $filename, 'w+');
|
||||
fputs($handle, json_encode($data));
|
||||
fclose($handle);
|
||||
return $data;
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'count' => 0,
|
||||
'dishes' => [],
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$data = json_decode(file_get_contents($dirname . $filename), true);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use App\Models\User;
|
||||
|
||||
class HelloWorld extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'gethello';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$users = User::all();
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'users' => $users
|
||||
];
|
||||
}
|
||||
}
|
||||
41
commands/POSTBonus.php
Normal file
41
commands/POSTBonus.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsBonus;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class POSTBonus extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postbonus';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$client_guid = $input['client_guid'];
|
||||
$bonus_amount = abs($input['amount']);
|
||||
$staff_id = $input['who_id'];
|
||||
$bonus_time = $input['date_transaction'];
|
||||
$type = $input['type'];
|
||||
ClientsBonus::bonusReg($client_guid, $bonus_amount, $type);
|
||||
ClientsBonus::bonusLog($client_guid, $bonus_amount, $bonus_time, $staff_id);
|
||||
$client = Client::where('user_code', $client_guid)->first();
|
||||
$client = Client::find($client['id']);
|
||||
$client->updated_at = Carbon::createFromTimestampUTC($bonus_time)->timezone('Europe/Minsk');
|
||||
$client->save();
|
||||
if ($type == 'in') {
|
||||
$message = 'Начислено ' . $bonus_amount . ' бонусов';
|
||||
} elseif ($type == 'out') {
|
||||
$message = 'Списано ' . $bonus_amount . ' бонусов';
|
||||
}
|
||||
$bonus_result = ClientsBonus::getBonus($client_guid);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => $message,
|
||||
'result' => $bonus_result
|
||||
];
|
||||
}
|
||||
}
|
||||
306
commands/POSTClient.php
Normal file
306
commands/POSTClient.php
Normal file
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsAddress;
|
||||
use App\Component\Models\ClientsBarcode;
|
||||
use App\Component\Models\ClientsEmail;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class POSTClient extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postclient';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
if (isset($input['task'])) {
|
||||
if ($input['task'] == 'update') {
|
||||
log::debug($input);
|
||||
if (isset($input['id'])) {
|
||||
$id = $input['id'];
|
||||
} else if (isset($input['client_guid'])) {
|
||||
$fClient = Client::where('user_code', $input['client_guid'])->first();
|
||||
if (!isset($fClient)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Клиент не найден',
|
||||
];
|
||||
}
|
||||
$id = $fClient['id'];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
if (isset($input['group_id']) && !isset($input['group_guid'])) {
|
||||
$group_id = $input['group_id'];
|
||||
} else if (isset($input['group_guid']) && !isset($input['group_id'])) {
|
||||
$fGroup = ClientsGroup::where('code', $input['group_guid'])->first();
|
||||
if (!isset($fGroup)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Группа не найдена',
|
||||
];
|
||||
}
|
||||
$group_id = $fGroup['id'];
|
||||
} else if (isset($input['group_id']) && isset($input['group_guid'])) {
|
||||
$fGroup = ClientsGroup::where('code', $input['group_guid'])->first();
|
||||
if (!isset($fGroup)) {
|
||||
$fGroup = ClientsGroup::where('id', isset($input['group_id']))->first();
|
||||
if (!isset($fGroup)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Группа не найдена',
|
||||
];
|
||||
}
|
||||
}
|
||||
$group_id = $fGroup['id'];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
$client = Client::find($id);
|
||||
$client->name = urldecode($input['name']);
|
||||
$client->unloaded = 0;
|
||||
$clientGroup = ClientsGroup::where('id', $group_id)->first();
|
||||
$client->group_id = $clientGroup['code'];
|
||||
|
||||
if (isset($input['phone'])) {
|
||||
$phone = $input['phone'];
|
||||
Log::debug($phone);
|
||||
$clientPhone = ClientsPhone::where('client_guid', $client->user_code)->first();
|
||||
Log::debug($clientPhone);
|
||||
if (isset($clientPhone)) {
|
||||
$clientPhone = ClientsPhone::find($clientPhone['id']);
|
||||
if ($phone !== '' && $phone !== '+375 ( ) - -') {
|
||||
if (substr($phone, 0, 1) == '+') {
|
||||
$clientPhone->phone = '+375 (' . substr($phone, 4, 2) . ') ' . substr($phone, 6, 3) . '-' . substr($phone, 9, 2) . '-' . substr($phone, 11, 2);
|
||||
log::debug('UPD Substr true: ' . $phone);
|
||||
} else {
|
||||
log::debug('UPD Substr false: ' . $phone);
|
||||
$clientPhone->phone = '+375 (' . substr($phone, 0, 2) . ') ' . substr($phone, 2, 3) . '-' . substr($phone, 5, 2) . '-' . substr($phone, 7, 2);
|
||||
}
|
||||
} else {
|
||||
$clientPhone->phone = '+375 ( ) - -';
|
||||
}
|
||||
} else {
|
||||
$clientPhone = new ClientsPhone;
|
||||
if ($phone !== '' && $phone !== '+375 ( ) - -') {
|
||||
if (substr($phone, 0, 1) == '+') {
|
||||
$clientPhone->phone = '+375 (' . substr($phone, 4, 2) . ') ' . substr($phone, 6, 3) . '-' . substr($phone, 9, 2) . '-' . substr($phone, 11, 2);
|
||||
log::debug('CR Substr true: ' . $phone);
|
||||
} else {
|
||||
log::debug('CR Substr false: ' . $phone);
|
||||
$clientPhone->phone = '+375 (' . substr($phone, 0, 2) . ') ' . substr($phone, 2, 3) . '-' . substr($phone, 5, 2) . '-' . substr($phone, 7, 2);
|
||||
}
|
||||
} else {
|
||||
$clientPhone->phone = '+375 ( ) - -';
|
||||
}
|
||||
}
|
||||
$clientPhone->client_guid = $client->user_code;
|
||||
$clientPhone->save();
|
||||
}
|
||||
|
||||
if (isset($input['email'])) {
|
||||
$clientEmail = ClientsEmail::where('client_guid', $client->user_code)->first();
|
||||
if ($clientEmail) {
|
||||
$clientEmail = ClientsEmail::find($clientEmail['id']);
|
||||
if (isset($input['email']) && $input['email'] !== '') {
|
||||
$clientEmail->email = urldecode($input['email']);
|
||||
} else {
|
||||
$clientEmail->email = '';
|
||||
}
|
||||
} else {
|
||||
$clientEmail = new ClientsEmail;
|
||||
$clientEmail->email = urldecode($input['email']);
|
||||
}
|
||||
$clientEmail->client_guid = $client->user_code;
|
||||
$clientEmail->save();
|
||||
} else {
|
||||
$clientEmail = '';
|
||||
}
|
||||
|
||||
if (isset($input['address'])) {
|
||||
$clientAddress = ClientsAddress::where('client_guid', $client->user_code)->first();
|
||||
if ($clientAddress) {
|
||||
$clientAddress = ClientsAddress::find($clientAddress['id']);
|
||||
if ($input['address'] !== '') {
|
||||
$clientAddress->address = urldecode($input['address']);
|
||||
} else {
|
||||
$clientAddress->address = '';
|
||||
}
|
||||
} else {
|
||||
$clientAddress = new ClientsAddress;
|
||||
$clientAddress->address = urldecode($input['address']);
|
||||
}
|
||||
$clientAddress->client_guid = $client->user_code;
|
||||
$clientAddress->save();
|
||||
}
|
||||
|
||||
$clientBarcodeStart = 0;
|
||||
$clientBarcodeEnd = 0;
|
||||
|
||||
if (isset($input['barcode'])) {
|
||||
if ($input['barcode'] !== '') {
|
||||
$client->barcode_type = 2;
|
||||
$client->barcode_start = $clientBarcodeStart = urldecode($input['barcode']);
|
||||
$client->barcode_end = $clientBarcodeEnd = urldecode($input['barcode']);
|
||||
} else {
|
||||
$client->barcode_type = 1;
|
||||
$client->barcode_start = $clientBarcodeStart;
|
||||
$client->barcode_end = $clientBarcodeEnd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($input['is_special_price']) && $input['is_special_price'] == 'true') {
|
||||
$specialPrice = 1;
|
||||
} else {
|
||||
$specialPrice = 0;
|
||||
}
|
||||
if (isset($input['is_employee']) && $input['is_employee'] == 'true') {
|
||||
$employee = 1;
|
||||
} else {
|
||||
$employee = 0;
|
||||
}
|
||||
$client->is_special_price = $specialPrice;
|
||||
$client->is_employee = $employee;
|
||||
$client->save();
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'client' => $client,
|
||||
'phone' => $clientPhone,
|
||||
'email' => $clientEmail,
|
||||
'address' => $clientAddress,
|
||||
'barcode' => $clientBarcodeStart,
|
||||
'message' => 'Клиент обновлен',
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'delete') {
|
||||
$client = Client::find($input['id']);
|
||||
$clientGroup = ClientsGroup::where('code', $client->group_id)->first();
|
||||
$clientPhone = ClientsPhone::where('client_guid', $client->user_code)->first();
|
||||
$clientPhone = ClientsPhone::find($clientPhone['id']);
|
||||
$clientEmail = ClientsEmail::where('client_guid', $client->user_code)->first();
|
||||
$clientEmail = ClientsEmail::find($clientEmail['id']);
|
||||
$clientAddress = ClientsAddress::where('client_guid', $client->user_code)->first();
|
||||
$clientAddress = ClientsAddress::find($clientAddress['id']);
|
||||
$clientBarcode = ClientsBarcode::where('client_guid', $client->user_code)->first();
|
||||
$clientBarcode = ClientsBarcode::find($clientBarcode['id']);
|
||||
if ($clientPhone) {
|
||||
$clientPhone->delete();
|
||||
}
|
||||
if ($clientEmail) {
|
||||
$clientEmail->delete();
|
||||
}
|
||||
if ($clientAddress) {
|
||||
$clientAddress->delete();
|
||||
}
|
||||
if ($clientBarcode) {
|
||||
$clientBarcode->delete();
|
||||
}
|
||||
if ($client) {
|
||||
$client->delete();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Клиент удален',
|
||||
'currentGroup' => $clientGroup['id'],
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'lock') {
|
||||
if (isset($input['id'])) {
|
||||
$id = $input['id'];
|
||||
} else if (isset($input['client_guid'])) {
|
||||
$fClient = Client::where('user_code', $input['client_guid'])->first();
|
||||
if (!isset($fClient)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Клиент не найден',
|
||||
];
|
||||
}
|
||||
$id = $fClient['id'];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
$client = Client::find($id);
|
||||
$clientGroup = ClientsGroup::where('code', $client->group_id)->first();
|
||||
$client->is_block = 1;
|
||||
$client->save();
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Клиент заблокирован',
|
||||
'currentGroup' => $clientGroup['id'],
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'unlock') {
|
||||
if (isset($input['id'])) {
|
||||
$id = $input['id'];
|
||||
} else if (isset($input['client_guid'])) {
|
||||
$fClient = Client::where('user_code', $input['client_guid'])->first();
|
||||
if (!isset($fClient)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Клиент не найден',
|
||||
];
|
||||
}
|
||||
$id = $fClient['id'];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
$client = Client::find($id);
|
||||
$clientGroup = ClientsGroup::where('code', $client->group_id)->first();
|
||||
$client->is_block = 0;
|
||||
$client->save();
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Клиент разблокирован',
|
||||
'currentGroup' => $clientGroup['id'],
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'search' && isset($input['name'])) {
|
||||
$client = Client::where('name', 'like', '%' . urldecode($input['name']) . '%')->get();
|
||||
if (count($client) > 0) {
|
||||
$message = 'Клиенты найдены!';
|
||||
} else {
|
||||
$message = 'Клиенты с именем ' . urldecode($input['name']) . ' не найдены!';
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => $message,
|
||||
'clients' => $client
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
58
commands/POSTClientGroup.php
Normal file
58
commands/POSTClientGroup.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTClientGroup extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postclientgroup';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
|
||||
if (isset($input['task']) && isset($input['id'])) {
|
||||
if ($input['task'] == 'update') {
|
||||
$group = ClientsGroup::find($input['id']);
|
||||
$group->name = urldecode($input['name']);
|
||||
$group->save();
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'group' => $group,
|
||||
'message' => 'Группа обновлена',
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'delete') {
|
||||
$group = ClientsGroup::where('id', '=', $input['id'])->first();
|
||||
if ($group->code == '0') {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Запрещено удаление группы по умолчанию',
|
||||
];
|
||||
} else {
|
||||
$client_count = Client::where('group_id', '=', $group->code)->count();
|
||||
if ($client_count !== 0) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Разрешено удаление только пустых групп.',
|
||||
];
|
||||
} else {
|
||||
$group->delete();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Группа удалена',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
53
commands/POSTCreateBarcode.php
Normal file
53
commands/POSTCreateBarcode.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsBarcode;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTCreateBarcode extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postcreatebarcode';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
if (($input['start'] <= $input['end']) && (strlen($input['start']) == strlen($input['end']))) {
|
||||
for ($i = $input['start']; $i <= $input['end']; $i++) {
|
||||
$total = Client::where('name', '=', $i)->count();
|
||||
$client = new Client;
|
||||
if ($total >= 1) {
|
||||
$total = $total + 1;
|
||||
$client->name = '#' . $total . ' ' . urldecode($i);
|
||||
} else {
|
||||
$client->name = urldecode($i);
|
||||
}
|
||||
$client->user_code = strtoupper(md5(time() + $i));
|
||||
$client->group_id = $group['code'];
|
||||
$client->is_special_price = 0;
|
||||
|
||||
$barcode = new ClientsBarcode;
|
||||
$barcode->code_id = $i;
|
||||
$barcode->name = '';
|
||||
$barcode->client_guid = $client->user_code;
|
||||
$barcode->value = $i;
|
||||
$barcode->block = 0;
|
||||
$barcode->symptom_block = 0;
|
||||
|
||||
$barcode->save();
|
||||
$client->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Штрих коды созданы',
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'message' => 'Проверьте правильность введенных данных',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
119
commands/POSTCreateClient.php
Normal file
119
commands/POSTCreateClient.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Client;
|
||||
use App\Component\Models\ClientsAddress;
|
||||
use App\Component\Models\ClientsBarcode;
|
||||
use App\Component\Models\ClientsEmail;
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use App\Component\Models\ClientsPhone;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTCreateClient extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postcreateclient';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (isset($input['group_id'])) {
|
||||
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
|
||||
} else {
|
||||
$group['code'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($input['email'])) {
|
||||
$input['email'] = '';
|
||||
}
|
||||
|
||||
if (!isset($input['address'])) {
|
||||
$input['address'] = '';
|
||||
}
|
||||
|
||||
$total = Client::where('name', '=', $input['name'])->count();
|
||||
if (isset($input['client_guid'])) {
|
||||
$check_guid = Client::where('user_code', $input['client_guid'])->count();
|
||||
if ($check_guid > 0) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Клиент уже существует'
|
||||
];
|
||||
}
|
||||
}
|
||||
$client_code = Client::max('code') + 1;
|
||||
if (isset($input['is_special_price']) && $input['is_special_price'] == 'true') {
|
||||
$specialPrice = 1;
|
||||
} else {
|
||||
$specialPrice = 0;
|
||||
}
|
||||
if (isset($input['is_employee']) && $input['is_employee'] == 'true') {
|
||||
$employee = 1;
|
||||
} else {
|
||||
$employee = 0;
|
||||
}
|
||||
$client = new Client;
|
||||
if ($total >= 1) {
|
||||
$total = $total + 1;
|
||||
$client->name = '#' . $total . ' ' . urldecode($input['name']);
|
||||
} else {
|
||||
$client->name = urldecode($input['name']);
|
||||
}
|
||||
if (!isset($input['client_guid'])) {
|
||||
$client->user_code = strtoupper(md5(time()));
|
||||
} else {
|
||||
$client->user_code = $input['client_guid'];
|
||||
}
|
||||
|
||||
$client->code = $client_code;
|
||||
$client->group_id = $group['code'];
|
||||
$client->is_special_price = $specialPrice;
|
||||
$client->is_employee = $employee;
|
||||
$client->last_change = date("Ymd");
|
||||
$clientEmail = new ClientsEmail;
|
||||
$clientEmail->email = urldecode($input['email']);
|
||||
$clientEmail->client_guid = $client->user_code;
|
||||
|
||||
$clientAddress = new ClientsAddress;
|
||||
$clientAddress->address = urldecode($input['address']);
|
||||
$clientAddress->client_guid = $client->user_code;
|
||||
|
||||
$clientPhone = new ClientsPhone;
|
||||
if ($input['phone'] !== '' && isset($input['phone'])) {
|
||||
$phoneData = urldecode($input['phone']);
|
||||
$phone = '+375 (' . substr($phoneData, 0, 2) . ') ' . substr($phoneData, 2, 3) . '-' . substr($phoneData, 5, 2) . '-' . substr($phoneData, 7, 2);
|
||||
} else {
|
||||
$phone = '';
|
||||
}
|
||||
$clientPhone->phone = $phone;
|
||||
$clientPhone->client_guid = $client->user_code;
|
||||
|
||||
if (isset($input['barcode']) && $input['barcode'] > 0) {
|
||||
$client->barcode_type = 2;
|
||||
$clientBarcode = new ClientsBarcode;
|
||||
$clientBarcode->code_id = urldecode($input['barcode']);
|
||||
$clientBarcode->name = '';
|
||||
$clientBarcode->client_guid = $client->user_code;
|
||||
$clientBarcode->value = urldecode($input['barcode']);
|
||||
$clientBarcode->block = 0;
|
||||
$clientBarcode->symptom_block = 0;
|
||||
$client->barcode_start = urldecode($input['barcode']);
|
||||
$client->barcode_end = urldecode($input['barcode']);
|
||||
$client->save();
|
||||
$clientPhone->save();
|
||||
$clientEmail->save();
|
||||
$clientAddress->save();
|
||||
$clientBarcode->save();
|
||||
} else {
|
||||
$client->barcode_type = 1;
|
||||
$client->save();
|
||||
$clientPhone->save();
|
||||
$clientEmail->save();
|
||||
$clientAddress->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Клиент создан',
|
||||
'client' => $client,
|
||||
];
|
||||
}
|
||||
}
|
||||
96
commands/POSTDeleteData.php
Normal file
96
commands/POSTDeleteData.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ExchangeActions;
|
||||
use App\Component\Models\ExchangeDeleted;
|
||||
use App\Component\Models\ExchangeItems;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ExchangeShifts;
|
||||
use App\Component\Models\Report;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTDeleteData extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postdeletedata';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if ($input['value'] == 'delete_shift') {
|
||||
if ($input['shift_id']) {
|
||||
$exchange_shift = ExchangeShifts::where('id', $input['shift_id'])->first();
|
||||
$exchange_orders = ExchangeOrders::where('shift_id', '=', $input['shift_id'])->get();
|
||||
$exchange_items = ExchangeItems::where('shift_id', '=', $input['shift_id'])->get();
|
||||
$exchange_actions = ExchangeActions::where('shift_id', '=', $input['shift_id'])->get();
|
||||
$exchange_deleted = ExchangeDeleted::where('shift_id', '=', $input['shift_id'])->get();
|
||||
if ($exchange_shift) {
|
||||
$exchange_shift = ExchangeShifts::find($input['shift_id']);
|
||||
$exchange_shift->delete();
|
||||
}
|
||||
if ($exchange_orders) {
|
||||
$exchange_orders = ExchangeOrders::where('shift_id', '=', $input['shift_id'])->delete();
|
||||
}
|
||||
if ($exchange_items) {
|
||||
$exchange_items = ExchangeItems::where('shift_id', '=', $input['shift_id'])->delete();
|
||||
}
|
||||
if ($exchange_actions) {
|
||||
$exchange_actions = ExchangeActions::where('shift_id', '=', $input['shift_id'])->delete();
|
||||
}
|
||||
if ($exchange_deleted) {
|
||||
$exchange_deleted = ExchangeDeleted::where('shift_id', '=', $input['shift_id'])->delete();
|
||||
}
|
||||
function dirDel($dir) {
|
||||
$d = opendir($dir);
|
||||
while (($entry = readdir($d)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if (is_dir($dir . "/" . $entry)) {
|
||||
dirDel($dir . "/" . $entry);
|
||||
} else {
|
||||
unlink($dir . "/" . $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($d);
|
||||
rmdir($dir);
|
||||
}
|
||||
$cache_dir = __DIR__ . "\\..\\..\\..\\Cache\\";
|
||||
dirDel($cache_dir);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Данные удалены',
|
||||
];
|
||||
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'message' => 'Check input data',
|
||||
];
|
||||
}
|
||||
} elseif ($input['value'] == 'delete_report') {
|
||||
if ($input['report_id']) {
|
||||
$report = Report::where('id', $input['report_id'])->first();
|
||||
if ($report) {
|
||||
$report = Report::where('id', $input['report_id'])->delete();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Данные удалены',
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'message' => 'Report not found',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'message' => 'Check input data',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'message' => 'Check input data',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
22
commands/POSTFiscals.php
Normal file
22
commands/POSTFiscals.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTFiscals extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postfiscals';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminals = Terminal::select('work_code', 'work_group')->where('key', '=', $input['terminal'])->get();
|
||||
foreach ($terminals as $terminal) {
|
||||
$out = array('work_code' => $terminal['work_code'], 'work_group' => $terminal['work_group']);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminal_data' => $out,
|
||||
];
|
||||
}
|
||||
}
|
||||
238
commands/POSTOrder.php
Normal file
238
commands/POSTOrder.php
Normal file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Base;
|
||||
use App\Component\Models\Dishes;
|
||||
use App\Component\Models\OrderBot;
|
||||
use App\Component\Models\OrderBotStorage;
|
||||
use App\Component\Models\OrderItems;
|
||||
use App\Component\Models\Orders;
|
||||
use App\Component\Models\TerminalUpdate;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class POSTOrder extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postorder';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
|
||||
if (isset($input['task'])) {
|
||||
if ($input['task'] == 'create') {
|
||||
$order = new Orders;
|
||||
$order->staff_id = 1;
|
||||
$order->is_send = 0;
|
||||
$order->save();
|
||||
$order = Orders::where('id', '=', $order->id)->first();
|
||||
$orderItems = OrderItems::where('order_id', '=', $order->id)->get();
|
||||
if (!isset($orderItems)) {
|
||||
$orderItems = [];
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'order' => $order,
|
||||
'orderItems' => $orderItems,
|
||||
'message' => 'Заказ создан',
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'delete' && isset($input['id'])) {
|
||||
$order = Orders::where('id', '=', $input['id'])->first();
|
||||
if ($order->total_count > 0) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Разрешено удаление только пустых заказов.',
|
||||
];
|
||||
} else {
|
||||
$order->delete();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Заказ удален',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($input['task'] == 'update' && isset($input['order_id'])) {
|
||||
$order = Orders::find($input['order_id']);
|
||||
if (isset($input['item']) && $input['item'] == 'add') {
|
||||
$orderItem = new OrderItems;
|
||||
$orderItem->order_id = $input['order_id'];
|
||||
$orderItem->item_id = $input['item_id'];
|
||||
$orderItem->item_count = $input['item_count'];
|
||||
$item_price = Dishes::where('code', '=', $input['item_id'])->first();
|
||||
$orderItem->item_price = $item_price->cosht;
|
||||
$orderItem->staff_id = 1;
|
||||
$orderItem->save();
|
||||
}
|
||||
if (isset($input['client_id'])) {
|
||||
if ($input['client_id'] !== null) {
|
||||
$order->client_id = $input['client_id'];
|
||||
} else {
|
||||
$order->client_id = null;
|
||||
}
|
||||
|
||||
}
|
||||
if (isset($input['item_count'])) {
|
||||
$order->total_count = $order->total_count + $input['item_count'];
|
||||
$order->total_price = $order->total_price + ($item_price->cosht * $input['item_count']);
|
||||
}
|
||||
|
||||
$order->is_send = 0;
|
||||
$order->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Заказ обновлен',
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'complete' && isset($input['id'])) {
|
||||
$order = Orders::find($input['id']);
|
||||
$order->is_send = 1;
|
||||
if (isset($input['client_id'])) {
|
||||
$order->client_id = $input['client_id'];
|
||||
}
|
||||
$order->is_delivery = $input['is_delivery'];
|
||||
$order->is_pickup = $input['is_pickup'];
|
||||
$order->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Заказ отправлен',
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'pay' && isset($input['info'])) {
|
||||
$test_json = Base::validate_json(urldecode($input['info']));
|
||||
if (!$test_json) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Ошибка обработки JSON',
|
||||
];
|
||||
}
|
||||
$order_info = json_decode(urldecode($input['info']), true);
|
||||
|
||||
if (isset($order_info['order_id'])) {
|
||||
$order_id = intval($order_info['order_id']);
|
||||
$order = OrderBotStorage::where('id', $order_id)->first();
|
||||
if (!isset($order)) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Заказ с данным ID не найден',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Отсутствует ID заказа',
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($order_info['transaction_id'])) {
|
||||
$transaction_id = intval($order_info['transaction_id']);
|
||||
$order_data = json_decode(base64_decode($order['order']), true);
|
||||
if ($transaction_id != $order_data['id']) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'ID заказа не соответствует ID транзакции',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Отсутствует ID транзакции',
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($order_info['time'])) {
|
||||
$pay_time = $order_info['time'];
|
||||
if ($pay_time < $order['created_at']) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Время создания заказа больше чем время оплаты',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Отсутствует время оплаты заказа',
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($order_info['amount'])) {
|
||||
$amount = floatval($order_info['amount']);
|
||||
if ($amount != floatval($order_data['price'])) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Сумма оплаты не соответствует сумме заказа',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Отсутствует сумма оплаты',
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($order_info['is_print'])) {
|
||||
$is_print = $order_info['is_print'];
|
||||
} else {
|
||||
$is_print = false;
|
||||
}
|
||||
|
||||
if (isset($order_info['is_closed'])) {
|
||||
$is_closed = $order_info['is_closed'];
|
||||
} else {
|
||||
$is_closed = false;
|
||||
}
|
||||
|
||||
if ($order['is_send'] === 0) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Заказ ещё не отправлен',
|
||||
];
|
||||
} else {
|
||||
$pay_task = array(
|
||||
'order_id' => $order_id,
|
||||
'transaction_id' => $transaction_id,
|
||||
'time' => $pay_time,
|
||||
'amount' => $amount,
|
||||
'is_print' => $is_print,
|
||||
'is_closed' => $is_closed
|
||||
);
|
||||
$todayDate = Carbon::now('Europe/Minsk')->format('Y-m-d H:i:m');
|
||||
$bot_info = OrderBot::first();
|
||||
$terminal_id = $bot_info['terminal_id'];
|
||||
$check_order = TerminalUpdate::where('method', 'payorder')
|
||||
->where('more', base64_encode(json_encode($pay_task)))
|
||||
->count();
|
||||
if ($check_order > 0) {
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'message' => 'Задача оплаты в обработке',
|
||||
];
|
||||
}
|
||||
$task = new TerminalUpdate;
|
||||
$task->terminal_id = $terminal_id;
|
||||
$task->next_at = $todayDate;
|
||||
$task->method = 'payorder';
|
||||
$task->period = 1;
|
||||
$task->is_cycle = 0;
|
||||
$task->more = base64_encode(json_encode($pay_task));
|
||||
$task->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Информация об оплате отправлена',
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
88
commands/POSTOrderItem.php
Normal file
88
commands/POSTOrderItem.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\OrderItems;
|
||||
use App\Component\Models\Orders;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTOrderItem extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postorderitem';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
if (isset($input['task']) && isset($input['order_id'])) {
|
||||
if ($input['task'] == 'create' && isset($input['order_id'])) {
|
||||
$order_item = new OrderItems;
|
||||
$order_item->order_id = $input['order_id'];
|
||||
$order_item->item_id = $input['item_id'];
|
||||
$order_item->item_count = $input['item_count'];
|
||||
$order_item->item_price = $input['item_price'];
|
||||
$order_item->staff_id = 1;
|
||||
$order_item->save();
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'order' => $order_item,
|
||||
'message' => 'Товар добавлен в заказ №' . $input['order_id'],
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'delete' && isset($input['id'])) {
|
||||
$order_item = OrderItems::where('order_id', '=', $input['order_id'])->where('id', '=', $input['id'])->first();
|
||||
$order_item->delete();
|
||||
$order = Orders::where('id', '=', $input['order_id'])->first();
|
||||
$orderItems = OrderItems::where('order_id', '=', $input['order_id'])->get();
|
||||
$totalCount = 0;
|
||||
$totalPrice = 0;
|
||||
foreach ($orderItems as $key => $item) {
|
||||
$totalCount = $totalCount + $item->item_count;
|
||||
$totalPrice = $totalPrice + $item->item_count * $item->item_price;
|
||||
}
|
||||
$order->total_count = $totalCount;
|
||||
$order->total_price = $totalPrice;
|
||||
$order->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Позиция удалена',
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['task'] == 'update' && isset($input['id']) && isset($input['item_count'])) {
|
||||
$order_item = OrderItems::where('order_id', '=', $input['order_id'])->where('id', '=', $input['id'])->first();
|
||||
if ($input['item_count'] == 0) {
|
||||
$order_item->delete();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Позиция удалена',
|
||||
];
|
||||
} else {
|
||||
$order_item->item_count = $input['item_count'];
|
||||
$order_item->save();
|
||||
|
||||
$order = Orders::where('id', '=', $input['order_id'])->first();
|
||||
$orderItems = OrderItems::where('order_id', '=', $input['order_id'])->get();
|
||||
$totalCount = 0;
|
||||
$totalPrice = 0;
|
||||
foreach ($orderItems as $key => $item) {
|
||||
//$totalCount = $totalCount + $item->item_count;
|
||||
$totalPrice = $totalPrice + $item->item_count * $item->item_price;
|
||||
}
|
||||
$order->total_count = count($orderItems);
|
||||
$order->total_price = $totalPrice;
|
||||
$order->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Заказ обновлен',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
37
commands/POSTPresale.php
Normal file
37
commands/POSTPresale.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
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
|
||||
{
|
||||
protected $signature = 'postpresale';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
$client_guid = $input['client_guid'];
|
||||
$presale_amount = abs($input['amount']);
|
||||
$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);
|
||||
$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',
|
||||
'message' => $message,
|
||||
'result' => $presale_result
|
||||
];
|
||||
}
|
||||
}
|
||||
71
commands/POSTPrinters.php
Normal file
71
commands/POSTPrinters.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Printer;
|
||||
use App\Component\Models\PrinterSettings;
|
||||
use App\Component\Models\Tasks;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTPrinters extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'postprinters';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminals = Terminal::select('id', 'work_code', 'work_group')->where('key', '=', $input['terminal'])->get();
|
||||
foreach ($terminals as $terminal) {
|
||||
$terminal_data = array('id' => $terminal['id'], 'work_code' => $terminal['work_code'], 'work_group' => $terminal['work_group']);
|
||||
}
|
||||
$first_printer_data = PrinterSettings::where('id', '=', $input['id'])->get();
|
||||
foreach ($first_printer_data as $old_printer_data) {
|
||||
}
|
||||
$printer_name = Printer::where('code', '=', $input['group'])->get();
|
||||
foreach ($printer_name as $group_name) {
|
||||
}
|
||||
if ($input['group'] == 0) {
|
||||
$group_name['name'] = $input['name'];
|
||||
}
|
||||
if ($input['type'] == 'COM') {
|
||||
$task[] = "UPDATE main.printers SET `name`='" . urldecode($group_name['name']) . "', `IP`=NULL, `port`=NULL, `COMport`='" . $input['com_port'] . "', `type`='" . $input['type'] . "', `size`=" . $input['size'] . ", `speed`=" . $input['speed'] . ", `driver`=NULL, `workcode`=" . $terminal_data['work_code'] . ", `workgroup`=" . $terminal_data['work_group'] . ",`printer_group`=" . $input['group'] . ", `template`='" . $input['template'] . "', `more`='" . urldecode($input['more']) . "' WHERE `name`='" . $old_printer_data['name'] . "' AND `workcode`=" . $terminal_data['work_code'] . " AND `workgroup`=" . $terminal_data['work_group'] . ";";
|
||||
$task = base64_encode(json_encode(array('queries' => $task), TRUE));
|
||||
$add_task = new Tasks;
|
||||
$add_task->terminal_id = $terminal_data['id'];
|
||||
$add_task->next_at = date("Y-m-d H:i:s");
|
||||
$add_task->method = 'runquery';
|
||||
$add_task->period = 0;
|
||||
$add_task->is_cycle = 0;
|
||||
$add_task->more = $task;
|
||||
$add_task->save();
|
||||
}
|
||||
if ($input['type'] == 'LAN') {
|
||||
$task[] = "UPDATE main.printers SET `name`='" . urldecode($group_name['name']) . "', `IP`='" . $input['ip_address'] . "', `port`=9100, `COMport`=NULL, `type`='" . $input['type'] . "', `size`=" . $input['size'] . ", `speed`=NULL, `driver`=NULL, `workcode`=" . $terminal_data['work_code'] . ", `workgroup`=" . $terminal_data['work_group'] . ",`printer_group`=" . $input['group'] . ", `template`='" . $input['template'] . "', `more`='" . urldecode($input['more']) . "' WHERE `name`='" . $old_printer_data['name'] . "' AND `workcode`=" . $terminal_data['work_code'] . " AND `workgroup`=" . $terminal_data['work_group'] . ";";
|
||||
$task = base64_encode(json_encode(array('queries' => $task)));
|
||||
$add_task = new Tasks;
|
||||
$add_task->terminal_id = $terminal_data['id'];
|
||||
$add_task->next_at = date("Y-m-d H:i:s");
|
||||
$add_task->method = 'runquery';
|
||||
$add_task->period = 0;
|
||||
$add_task->is_cycle = 0;
|
||||
$add_task->more = $task;
|
||||
$add_task->save();
|
||||
}
|
||||
if ($input['type'] == 'Windows') {
|
||||
$task[] = "UPDATE main.printers SET `name`='" . urldecode($group_name['name']) . "', `IP`=NULL, `port`=NULL, `COMport`=NULL, `type`='" . $input['type'] . "', `size`=" . $input['size'] . ", `speed`=NULL, `driver`='" . urldecode($input['driver']) . "', `workcode`=" . $terminal_data['work_code'] . ", `workgroup`=" . $terminal_data['work_group'] . ",`printer_group`=" . $input['group'] . ", `template`='" . $input['template'] . "', `more`='" . urldecode($input['more']) . "' WHERE `name`='" . $old_printer_data['name'] . "' AND `workcode`=" . $terminal_data['work_code'] . " AND `workgroup`=" . $terminal_data['work_group'] . ";";
|
||||
$task = base64_encode(json_encode(array('queries' => $task)));
|
||||
$add_task = new Tasks;
|
||||
$add_task->terminal_id = $terminal_data['id'];
|
||||
$add_task->next_at = date("Y-m-d H:i:s");
|
||||
$add_task->method = 'runquery';
|
||||
$add_task->period = 0;
|
||||
$add_task->is_cycle = 0;
|
||||
$add_task->more = $task;
|
||||
$add_task->save();
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'input' => $input,
|
||||
'task' => $task,
|
||||
];
|
||||
}
|
||||
}
|
||||
275
commands/POSTRestoreShift.php
Normal file
275
commands/POSTRestoreShift.php
Normal file
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\ExchangeActions;
|
||||
use App\Component\Models\ExchangeDeleted;
|
||||
use App\Component\Models\ExchangeItems;
|
||||
use App\Component\Models\ExchangeOrders;
|
||||
use App\Component\Models\ExchangeShifts;
|
||||
use App\Component\Models\ShiftOnlineActions;
|
||||
use App\Component\Models\ShiftOnlineDeleted;
|
||||
use App\Component\Models\ShiftOnlineItems;
|
||||
use App\Component\Models\ShiftOnlineOrders;
|
||||
use App\Component\Models\Shifts;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Component\Models\TerminalUpdate;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class POSTRestoreShift extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postrestoreshift';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
function dirDel($dir)
|
||||
{
|
||||
$d = opendir($dir);
|
||||
while (($entry = readdir($d)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if (is_dir($dir . "/" . $entry)) {
|
||||
dirDel($dir . "/" . $entry);
|
||||
} else {
|
||||
unlink($dir . "/" . $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($d);
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
$shift_id = $input['shift_id'];
|
||||
$cache_dir = __DIR__ . "\\..\\..\\..\\Cache\\";
|
||||
|
||||
|
||||
$nowTime = time();
|
||||
$update = true;
|
||||
|
||||
function decode_text($data)
|
||||
{
|
||||
$alph = [
|
||||
"А", "Б", "В", "Г", "Д",
|
||||
"Е", "Ё", "Ж", "З", "И",
|
||||
"Й", "К", "Л", "М", "Н",
|
||||
"О", "П", "Р", "С", "Т",
|
||||
"У", "Ф", "Х", "Ц", "Ч",
|
||||
"Ш", "Щ", "Ъ", "Ы", "Ь",
|
||||
"Э", "Ю", "Я",
|
||||
"а", "б", "в", "г", "д",
|
||||
"е", "ё", "ж", "з", "и",
|
||||
"й", "к", "л", "м", "н",
|
||||
"о", "п", "р", "с", "т",
|
||||
"у", "ф", "х", "ц", "ч",
|
||||
"ш", "щ", "ъ", "ы", "ь",
|
||||
"э", "ю", "я",
|
||||
];
|
||||
|
||||
foreach ($alph as $key => $letter) {
|
||||
$haystack = mb_convert_encoding($data, "CP1251", "UTF-8");
|
||||
$needle = $letter;
|
||||
$pos = strripos($haystack, $needle);
|
||||
if ($pos === false) {
|
||||
$after_conv = false;
|
||||
} else {
|
||||
$after_conv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$after_conv) {
|
||||
foreach ($alph as $key => $letter) {
|
||||
$haystack = $data;
|
||||
$needle = $letter;
|
||||
$pos = strripos($haystack, $needle);
|
||||
if ($pos === false) {
|
||||
$before_conv = false;
|
||||
} else {
|
||||
$before_conv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($after_conv) {
|
||||
$retval = mb_convert_encoding($data, "CP1251", "UTF-8");
|
||||
} elseif ($before_conv) {
|
||||
$retval = $data;
|
||||
} else {
|
||||
$retval = $data;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
$terminal = Terminal::where('is_active', 1)
|
||||
->where('soft', '1')
|
||||
->first();
|
||||
$exchange_shifts = ExchangeShifts::where('id', '=', $shift_id)
|
||||
->first();
|
||||
$exchange_orders = ExchangeOrders::where('shift_id', '=', $shift_id)
|
||||
->get();
|
||||
$exchange_items = ExchangeItems::where('shift_id', '=', $shift_id)
|
||||
->get();
|
||||
$exchange_actions = ExchangeActions::where('shift_id', '=', $shift_id)
|
||||
->get();
|
||||
$exchange_deleted = ExchangeDeleted::where('shift_id', '=', $shift_id)
|
||||
->get();
|
||||
$terminal_online = TerminalUpdate::where('method', 'online')
|
||||
->where('terminal_id', $terminal['id'])
|
||||
->first();
|
||||
$baseTime = date_create($terminal_online['next_at']);
|
||||
$baseTime = date_format($baseTime, 'U');
|
||||
$old_date = date_create($terminal_online['next_at']);
|
||||
date_modify($old_date, '+30 minutes');
|
||||
$new_date = date_format($old_date, 'Y-m-d H:i:s');
|
||||
$newTime = $nowTime + ($terminal_online['period'] * 60);
|
||||
if ($newTime >= $baseTime) {
|
||||
$new_terminal_online = TerminalUpdate::find($terminal_online['id']);
|
||||
$new_terminal_online->next_at = $new_date;
|
||||
$new_terminal_online->save();
|
||||
}
|
||||
|
||||
if ($update) {
|
||||
$online_shift = Shifts::first();
|
||||
if ($online_shift['z_number'] != $shift_id) {
|
||||
//clear shifts
|
||||
Shifts::truncate();
|
||||
$shift = new Shifts;
|
||||
$shift->opened = $exchange_shifts['opened'];
|
||||
$shift->closed = $exchange_shifts['closed'];
|
||||
$shift->who_open = $exchange_shifts['who_open'];
|
||||
$shift->who_close = $exchange_shifts['who_close'];
|
||||
$shift->z_number = $exchange_shifts['id'];
|
||||
$shift->save();
|
||||
|
||||
//clear shift_online_orders
|
||||
ShiftOnlineOrders::truncate();
|
||||
foreach ($exchange_orders as $key => $exchange_order) {
|
||||
$shift_online_order = new ShiftOnlineOrders;
|
||||
$shift_online_order->cash = $exchange_order["cash"];
|
||||
$shift_online_order->check_number = $exchange_order["check_number"];
|
||||
$shift_online_order->clearing = $exchange_order["clearing"];
|
||||
$shift_online_order->client_code = $exchange_order["client_code"];
|
||||
$shift_online_order->client_count = $exchange_order["clients_count"];
|
||||
if ($exchange_order["closed"] == '0000-00-00 00:00:00') {
|
||||
$exchange_order["closed"] = '1970-01-01 00:00:00';
|
||||
}
|
||||
$shift_online_order->closed = $exchange_order["closed"];
|
||||
$shift_online_order->code = $exchange_order["code"];
|
||||
$shift_online_order->credit = $exchange_order["credit"];
|
||||
$shift_online_order->full_sum = $exchange_order["full_sum"];
|
||||
$shift_online_order->guid = $exchange_order["guid"];
|
||||
$shift_online_order->is_block = $exchange_order["is_block"];
|
||||
$shift_online_order->is_closed = $exchange_order["is_closed"];
|
||||
$shift_online_order->is_deleted = $exchange_order["is_deleted"];
|
||||
$shift_online_order->is_edit = $exchange_order["is_edit"];
|
||||
$shift_online_order->is_printed = $exchange_order["is_printed"];
|
||||
$shift_online_order->is_returned = $exchange_order["is_returned"];
|
||||
$shift_online_order->is_self = $exchange_order["is_self"];
|
||||
$shift_online_order->is_waited = $exchange_order["is_waited"];
|
||||
if ($exchange_order["manual_discount"] == '') {
|
||||
$exchange_order["manual_discount"] = 0;
|
||||
} else {
|
||||
$exchange_order["manual_discount"] = $exchange_order["manual_discount"] + 0;
|
||||
}
|
||||
$shift_online_order->manual_discount = $exchange_order["manual_discount"];
|
||||
$shift_online_order->opened = $exchange_order["opened"];
|
||||
$shift_online_order->order_sum = $exchange_order["order_sum"];
|
||||
$shift_online_order->params_code = $exchange_order["params_id"];
|
||||
$shift_online_order->place_name = mb_convert_encoding(decode_text($exchange_order["place_name"]), 'UTF-8', 'UTF-8');
|
||||
$shift_online_order->presale = $exchange_order["presale"];
|
||||
$shift_online_order->sale_sum = $exchange_order["sale_sum"];
|
||||
$shift_online_order->self = $exchange_order["self"];
|
||||
$shift_online_order->table_name = $exchange_order["table_name"];
|
||||
$shift_online_order->table_place = $exchange_order["table_place"];
|
||||
$shift_online_order->terminal_id = $exchange_order["terminal_id"];
|
||||
$shift_online_order->version_type = $exchange_order["version_type"];
|
||||
$shift_online_order->who_close = $exchange_order["who_close"];
|
||||
$shift_online_order->who_open = $exchange_order["who_open"];
|
||||
$shift_online_order->save();
|
||||
}
|
||||
|
||||
ShiftOnlineItems::truncate();
|
||||
foreach ($exchange_items as $key => $exchange_item) {
|
||||
$shift_online_item = new ShiftOnlineItems;
|
||||
$shift_online_item->code = $exchange_item["code"];
|
||||
$shift_online_item->cof = $exchange_item["cof"];
|
||||
$shift_online_item->count = $exchange_item["count"];
|
||||
$shift_online_item->count_real = $exchange_item["count_real"];
|
||||
$shift_online_item->count_return = $exchange_item["count_return"];
|
||||
$shift_online_item->dish_code = $exchange_item["dishes_code"];
|
||||
$shift_online_item->menu_code = $exchange_item["menu_code"];
|
||||
if ($exchange_item["menu_code"] == 0 && $exchange_item["menu_code"] == 0 && $exchange_item["units_id"] == 0) {
|
||||
$shift_online_item->modificator_code = 1;
|
||||
} else {
|
||||
$shift_online_item->modificator_code = 0;
|
||||
}
|
||||
$shift_online_item->order_code = $exchange_item["order_code"];
|
||||
$shift_online_item->parent_id = $exchange_item["parent_id"];
|
||||
$shift_online_item->real_price = $exchange_item["real_price"];
|
||||
$shift_online_item->sale_price = $exchange_item["sale_price"];
|
||||
$shift_online_item->special_price = $exchange_item["special_price"];
|
||||
$shift_online_item->terminal_id = $exchange_item["terminal_id"];
|
||||
$shift_online_item->units_code = $exchange_item["units_id"];
|
||||
$shift_online_item->save();
|
||||
}
|
||||
|
||||
ShiftOnlineActions::truncate();
|
||||
foreach ($exchange_actions as $key => $exchange_action) {
|
||||
$shift_online_action = new ShiftOnlineActions;
|
||||
$shift_online_action->type_action = $exchange_action["action_type"];
|
||||
$shift_online_action->more = $exchange_action["more"];
|
||||
$shift_online_action->order_code = $exchange_action["order_code"];
|
||||
$shift_online_action->order_position = $exchange_action["order_position"];
|
||||
$shift_online_action->reason = $exchange_action["reason"];
|
||||
$shift_online_action->terminal_id = $exchange_action["terminal_id"];
|
||||
$shift_online_action->time = $exchange_action["time"];
|
||||
$shift_online_action->value = $exchange_action["value"];
|
||||
$shift_online_action->who = $exchange_action["who"];
|
||||
$shift_online_action->workcode = $exchange_action["work_code"];
|
||||
$shift_online_action->workgroup = $exchange_action["work_group"];
|
||||
$shift_online_action->save();
|
||||
}
|
||||
|
||||
ShiftOnlineDeleted::truncate();
|
||||
foreach ($exchange_deleted as $key => $exchange_deleted_item) {
|
||||
$shift_online_deleted_item = new ShiftOnlineDeleted;
|
||||
$shift_online_deleted_item->code = $exchange_deleted_item["code"];
|
||||
$shift_online_deleted_item->count = $exchange_deleted_item["count"];
|
||||
$shift_online_deleted_item->dishes_code = $exchange_deleted_item["dishes_code"];
|
||||
$shift_online_deleted_item->item_id = $exchange_deleted_item["item_id"];
|
||||
$shift_online_deleted_item->menu_code = $exchange_deleted_item["menu_code"];
|
||||
$shift_online_deleted_item->order_code = $exchange_deleted_item["order_code"];
|
||||
$shift_online_deleted_item->real_price = $exchange_deleted_item["real_price"];
|
||||
$shift_online_deleted_item->sale_price = $exchange_deleted_item["sale_price"];
|
||||
$shift_online_deleted_item->terminal_id = $exchange_deleted_item["terminal_id"];
|
||||
$shift_online_deleted_item->units_id = $exchange_deleted_item["units_id"];
|
||||
$shift_online_deleted_item->save();
|
||||
}
|
||||
|
||||
$exc_time = time();
|
||||
$diff_time = $exc_time - $nowTime;
|
||||
$terminal_online = TerminalUpdate::where('method', 'online')->where('terminal_id', $exchange_shifts['terminal_id'])->first();
|
||||
dirDel($cache_dir);
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Данные автоматически синхронизируются с POS-системой ' . $terminal_online['next_at'],
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Смена уже восстановлена',
|
||||
'stop_at' => 'Stop at check z_number',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'error',
|
||||
'more' => 'Смена уже восстановлена',
|
||||
'stop_at' => 'Stop at check time',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
229
commands/POSTRoomMap.php
Normal file
229
commands/POSTRoomMap.php
Normal file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
|
||||
use App\Component\Models\Places;
|
||||
use App\Component\Models\Tables;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class POSTRoomMap extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postroommap';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
if (isset($input['type']) && $input['type'] == 'place') {
|
||||
if ($input['action'] == 'create' && isset($input['name'])) {
|
||||
$max_id = Places::max('id');
|
||||
$place = new Places;
|
||||
$place->id = $max_id + 1;
|
||||
$place->name = urldecode($input['name']);
|
||||
$place->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Зал успешно добавлен',
|
||||
'place' => $place
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['action'] == 'update' && isset($input['id']) && isset($input['name'])) {
|
||||
$place = Places::find($input['id']);
|
||||
$place->name = urldecode($input['name']);
|
||||
$place->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Зал успешно обновлен',
|
||||
'place' => $place
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['action'] == 'delete' && isset($input['id'])) {
|
||||
$place = Places::find($input['id']);
|
||||
$place->delete();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Зал успешно удален'
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['action'] == 'saveplaces' && isset($input['places'])) {
|
||||
DB::statement("SET foreign_key_checks=0");
|
||||
Tables::truncate();
|
||||
Places::truncate();
|
||||
DB::statement("SET foreign_key_checks=1");
|
||||
$input['places'] = json_decode(urldecode($input['places']), TRUE);
|
||||
|
||||
foreach ($input['places'] as $place_items) {
|
||||
$place_name = urldecode($place_items['place_name']);
|
||||
$newPlace = new Places;
|
||||
$newPlace->name = $place_name;
|
||||
$newPlace->save();
|
||||
foreach ($place_items['tables'] as $table_item) {
|
||||
$table_id = $table_item['table_id'];
|
||||
$table_place_id = $place_items['place_id'];
|
||||
$table_name = urldecode($table_item['name']);
|
||||
$table_width = $table_item['width'];
|
||||
$table_height = $table_item['height'];
|
||||
$table_x = $table_item['x'];
|
||||
$table_y = $table_item['y'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table_name;
|
||||
$newTable->table_id = $table_id;
|
||||
$newTable->place_id = $table_place_id;
|
||||
$newTable->width = $table_width;
|
||||
$newTable->height = $table_height;
|
||||
$newTable->x = $table_x;
|
||||
$newTable->y = $table_y;
|
||||
$newTable->save();
|
||||
}
|
||||
|
||||
}
|
||||
$places = Places::all();
|
||||
foreach ($places as $place) {
|
||||
$tables = Tables::where('place_id', $place['id'])->get();
|
||||
$roommap[] = array('place_id' => $place['id'], 'place_name' => $place['name'], 'tables' => $tables);
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Карта успешно обновлена',
|
||||
'roommap' => $roommap,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
if (isset($input['type']) && $input['type'] == 'table') {
|
||||
if ($input['action'] == 'create' &&
|
||||
isset($input['place_id']) &&
|
||||
isset($input['table_id']) &&
|
||||
isset($input['name']) &&
|
||||
isset($input['width']) &&
|
||||
isset($input['height']) &&
|
||||
isset($input['x']) &&
|
||||
isset($input['y']) &&
|
||||
isset($input['type'])) {
|
||||
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->where('name', $input['name'])->first();
|
||||
if (isset($table)) {
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Стол уже существует',
|
||||
];
|
||||
}
|
||||
$table_id = $input['table_id'];
|
||||
$table_place_id = $input['place_id'];
|
||||
$table_name = urldecode($input['name']);
|
||||
$table_width = $input['width'];
|
||||
$table_height = $input['height'];
|
||||
$table_x = $input['x'];
|
||||
$table_y = $input['y'];
|
||||
$table_type = $input['type'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table_name;
|
||||
$newTable->table_id = $table_id;
|
||||
$newTable->place_id = $table_place_id;
|
||||
$newTable->width = $table_width;
|
||||
$newTable->height = $table_height;
|
||||
$newTable->x = $table_x;
|
||||
$newTable->y = $table_y;
|
||||
$newTable->type = $table_type;
|
||||
$newTable->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Стол успешно добавлен',
|
||||
'table' => $newTable
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['action'] == 'update' &&
|
||||
isset($input['place_id']) &&
|
||||
isset($input['table_id']) &&
|
||||
isset($input['name']) &&
|
||||
isset($input['width']) &&
|
||||
isset($input['height']) &&
|
||||
isset($input['x']) &&
|
||||
isset($input['y']) &&
|
||||
isset($input['type'])) {
|
||||
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->first();
|
||||
$table_id = $input['table_id'];
|
||||
$table_place_id = $input['place_id'];
|
||||
$table_name = urldecode($input['name']);
|
||||
$table_width = $input['width'];
|
||||
$table_height = $input['height'];
|
||||
$table_x = $input['x'];
|
||||
$table_y = $input['y'];
|
||||
$table_type = $input['type'];
|
||||
$table = Tables::find($table['id']);
|
||||
$table->name = $table_name;
|
||||
$table->table_id = $table_id;
|
||||
$table->place_id = $table_place_id;
|
||||
$table->width = $table_width;
|
||||
$table->height = $table_height;
|
||||
$table->x = $table_x;
|
||||
$table->y = $table_y;
|
||||
$table->type = $table_type;
|
||||
$table->save();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Стол успешно обновлен',
|
||||
'table' => $table
|
||||
];
|
||||
}
|
||||
|
||||
if ($input['action'] == 'delete' &&
|
||||
isset($input['place_id']) &&
|
||||
isset($input['table_id'])) {
|
||||
$table = Tables::where('place_id', $input['place_id'])->where('table_id', $input['table_id'])->first();
|
||||
$table = Tables::find($table['id']);
|
||||
$table->delete();
|
||||
}
|
||||
|
||||
if ($input['action'] == 'savetables' && isset($input['tables']) && isset($input['place_id'])) {
|
||||
$input['tables'] = json_decode(urldecode($input['tables']), TRUE);
|
||||
$tables = Tables::where('place_id', intval($input['place_id']))->get();
|
||||
|
||||
foreach ($tables as $table) {
|
||||
$del_table = Tables::find($table['id']);
|
||||
$del_table->delete();
|
||||
}
|
||||
foreach ($input['tables'] as $item) {
|
||||
$table_id = $item['table_id'];
|
||||
$table_place_id = $item['place_id'];
|
||||
$table_name = urldecode($item['name']);
|
||||
$table_width = $item['width'];
|
||||
$table_height = $item['height'];
|
||||
$table_x = $item['x'];
|
||||
$table_y = $item['y'];
|
||||
$table_type = $item['type'];
|
||||
$newTable = new Tables;
|
||||
$newTable->name = $table_name;
|
||||
$newTable->table_id = $table_id;
|
||||
$newTable->place_id = $table_place_id;
|
||||
$newTable->width = $table_width;
|
||||
$newTable->height = $table_height;
|
||||
$newTable->x = $table_x;
|
||||
$newTable->y = $table_y;
|
||||
$newTable->type = $table_type;
|
||||
$newTable->save();
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'message' => 'Зал успешно обновлен'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
43
commands/POSTTerminals.php
Normal file
43
commands/POSTTerminals.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTTerminals extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postterminals';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
if (isset($input['method'])) {
|
||||
$method = $input['method'];
|
||||
if ($method == 'update') {
|
||||
if (isset($input['data'])) {
|
||||
$data = $input['data'];
|
||||
$data = json_decode(base64_decode(urldecode($data)), true);
|
||||
$terminals = Terminal::get();
|
||||
foreach ($terminals as $terminal) {
|
||||
if ($terminal['work_group'] == $data['work_group']) {
|
||||
$item = Terminal::find($terminal['id']);
|
||||
$item->name = $data['name'];
|
||||
$item->save();
|
||||
}
|
||||
}
|
||||
$terminals = Terminal::get();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminals' => $terminals
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "hrc-admin/hello-world",
|
||||
"version": "1.0",
|
||||
"version": "2.34",
|
||||
"require": {
|
||||
"horeca/admin-php-module-core": "dev-master"
|
||||
"horeca/admin-php-module-core": "dev-master",
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
"phpmailer/phpmailer": "^6.6",
|
||||
"ext-openssl": "*",
|
||||
"ext-json": "*",
|
||||
"mtownsend/xml-to-array": "^2.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
@@ -10,4 +15,4 @@
|
||||
"url": "https://git.hrc.by/horeca/admin-php-module-core"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
1411
composer.lock
generated
1411
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTestTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('test', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('test');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTableSubscribers extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('subscribers')) {
|
||||
Schema::create('subscribers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code')->nullable();
|
||||
$table->string('destination_module')->nullable();
|
||||
$table->string('destination_method')->nullable();
|
||||
$table->string('source_module')->nullable();
|
||||
$table->string('source_method')->nullable();
|
||||
$table->integer('weight')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('subscribers');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRevenueToExchangeShiftsTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasColumn('exchange_shifts', 'revenue')) {
|
||||
Schema::table('exchange_shifts', function (Blueprint $table) {
|
||||
$table->decimal('revenue', $precision = 16, $scale = 2)->nullable()->after('closed');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('exchange_shifts', function (Blueprint $table) {
|
||||
$table->dropColumn('revenue');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddValueToExchangeActionsTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('exchange_actions', function (Blueprint $table) {
|
||||
$table->string('value', 255)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('exchange_actions', function (Blueprint $table) {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddForeignKeyToClientsTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
|
||||
Schema::table('clients', function (Blueprint $table) {
|
||||
$table->string('user_code')->unique()->change();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('clients', function (Blueprint $table) {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddOrderToOrderbotStorageTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('orderbot_storage', function (Blueprint $table) {
|
||||
$table->text('order')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('orderbot_storage', function (Blueprint $table) {
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClientsBarcodesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('clients_barcodes')) {
|
||||
Schema::create('clients_barcodes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('client_guid');
|
||||
$table->string('code_id');
|
||||
$table->string('name');
|
||||
$table->string('block');
|
||||
$table->string('value');
|
||||
$table->string('symptom_block');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('clients_barcodes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateOrdersTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('orders')) {
|
||||
Schema::create('orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('total_count')->nullable();
|
||||
$table->integer('total_price')->nullable();
|
||||
$table->integer('staff_id');
|
||||
$table->string('client_id')->nullable();
|
||||
$table->integer('is_send');
|
||||
$table->integer('is_delivery')->nullable();
|
||||
$table->integer('is_pickup')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('orders');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateOrderItemsTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('order_items')) {
|
||||
Schema::create('order_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('order_id');
|
||||
$table->integer('item_id');
|
||||
$table->integer('modifier_id')->nullable();
|
||||
$table->integer('parent_id')->nullable();
|
||||
$table->integer('item_count');
|
||||
$table->integer('item_price');
|
||||
$table->integer('staff_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('order_items');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToShiftOnlineOrders extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('shift_online_orders', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('shift_online_orders', 'is_self')) {
|
||||
$table->integer('is_self')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('shift_online_orders', 'is_block')) {
|
||||
$table->integer('is_block')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('shift_online_orders', 'is_edit')) {
|
||||
$table->integer('is_edit')->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('shift_online_orders', 'guid')) {
|
||||
$table->string('guid')->nullable();
|
||||
}
|
||||
});
|
||||
Schema::table('shift_online_items', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('shift_online_items', 'count_real')) {
|
||||
$table->decimal('count_real', $precision = 16, $scale = 2)->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('shift_online_items', 'count_return')) {
|
||||
$table->decimal('count_return', $precision = 16, $scale = 2)->nullable();
|
||||
}
|
||||
if (!Schema::hasColumn('shift_online_items', 'parent_id')) {
|
||||
$table->integer('parent_id')->nullable();
|
||||
}
|
||||
});
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('shift_online_actions', 'terminal_id')) {
|
||||
$table->integer('terminal_id')->nullable();
|
||||
}
|
||||
});
|
||||
Schema::table('exchange_orders', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('exchange_orders', 'table_place')) {
|
||||
$table->string('table_place')->nullable();
|
||||
}
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('exchange_items', 'modificator_code')) {
|
||||
$table->integer('modificator_code')->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('shift_online_orders', function (Blueprint $table) {
|
||||
$table->dropColumn('is_self');
|
||||
$table->dropColumn('guid');
|
||||
$table->dropColumn('is_block');
|
||||
$table->dropColumn('is_edit');
|
||||
});
|
||||
Schema::table('shift_online_items', function (Blueprint $table) {
|
||||
$table->dropColumn('count_real');
|
||||
$table->dropColumn('count_return');
|
||||
$table->dropColumn('parent_id');
|
||||
});
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->dropColumn('terminal_id');
|
||||
});
|
||||
Schema::table('exchange_orders', function (Blueprint $table) {
|
||||
$table->dropColumn('table_place');
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->dropColumn('modificator_code');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToUnitsList extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasColumn('units_list', 'legacy_code')) {
|
||||
Schema::table('units_list', function (Blueprint $table) {
|
||||
$table->string('legacy_code')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('units_list', function (Blueprint $table) {
|
||||
$table->dropColumn('legacy_code');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeleteFrontendFolders extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
function Deldir($dir) {
|
||||
$d = opendir($dir);
|
||||
while (($entry = readdir($d)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if (is_dir($dir . "/" . $entry)) {
|
||||
Deldir($dir . "/" . $entry);
|
||||
} else {
|
||||
unlink($dir . "/" . $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($d);
|
||||
rmdir($dir);
|
||||
}
|
||||
if (file_exists(CORE_PATH . '/../Client/web/')) {
|
||||
Deldir(CORE_PATH . '/../Client/web/');
|
||||
} else {
|
||||
Log::debug('Client frontend already deleted!');
|
||||
}
|
||||
if (file_exists(CORE_PATH . '/../Shift/web/')) {
|
||||
Deldir(CORE_PATH . '/../Shift/web/');
|
||||
} else {
|
||||
Log::debug('Shift frontend already deleted!');
|
||||
}
|
||||
if (file_exists(CORE_PATH . '/../Report/web/')) {
|
||||
Deldir(CORE_PATH . '/../Report/web/');
|
||||
} else {
|
||||
Log::debug('Report frontend already deleted!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateValueInShiftOnlineActions extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->string('value', 255)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->string('value', 50)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateMoreInShiftOnlineActions extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->string('more', 255)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->string('more', 50)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateShiftOnlineModificatorsTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('shift_online_modificators')) {
|
||||
Schema::create('shift_online_modificators', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('code')->nullable();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->integer('item_id')->nullable();
|
||||
$table->integer('shift_id')->nullable();
|
||||
$table->integer('terminal_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('shift_online_modificators', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateActionTypesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('action_types')) {
|
||||
Schema::create('action_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->integer('type_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('action_types', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeleteSettingsFrontendFolder extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
function dirDel($dir) {
|
||||
$d = opendir($dir);
|
||||
while (($entry = readdir($d)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if (is_dir($dir . "/" . $entry)) {
|
||||
dirDel($dir . "/" . $entry);
|
||||
} else {
|
||||
unlink($dir . "/" . $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($d);
|
||||
rmdir($dir);
|
||||
}
|
||||
if (file_exists(CORE_PATH . '/../Settings/web/')) {
|
||||
dirDel(CORE_PATH . '/../Settings/web/');
|
||||
} else {
|
||||
Log::debug('Settings frontend already deleted!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateMoreInExchangeActions extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('exchange_actions', function (Blueprint $table) {
|
||||
$table->text('more')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('exchange_actions', function (Blueprint $table) {
|
||||
$table->string('more', 255)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateMoreInShiftOnlineActionsToText extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->text('more')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('shift_online_actions', function (Blueprint $table) {
|
||||
$table->string('more', 255)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateReportCategoriesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('report_categories')) {
|
||||
Schema::create('report_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255)->nullable();
|
||||
$table->integer('code')->nullable();
|
||||
$table->integer('is_history')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('report_categories', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToUnitsListAndUnits extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
|
||||
if (!Schema::hasColumn('units', 'is_history')) {
|
||||
Schema::table('units', function (Blueprint $table) {
|
||||
$table->tinyInteger('is_history')->nullable()->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('modifiers', 'is_history')) {
|
||||
Schema::table('modifiers', function (Blueprint $table) {
|
||||
$table->tinyInteger('is_history')->nullable()->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('units', function (Blueprint $table) {
|
||||
$table->dropColumn('is_history');
|
||||
});
|
||||
Schema::table('modifiers', function (Blueprint $table) {
|
||||
$table->dropColumn('is_history');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToOrderItem extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
|
||||
if (!Schema::hasColumn('order_items', 'is_deleted')) {
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->tinyInteger('is_deleted')->nullable()->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->dropColumn('is_deleted');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateItemCountAndItemPriceInOrderItemsToFloat extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasColumn('order_items', 'item_price')) {
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->decimal('item_price', $precision = 16, $scale = 3)->nullable();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('order_items', 'item_count')) {
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->decimal('item_count', $precision = 16, $scale = 2)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->integer('item_price')->nullable()->change();
|
||||
});
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->integer('item_count')->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateTotalPriceInOrdersToFloat extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasColumn('orders', 'total_price')) {
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->decimal('total_price', $precision = 16, $scale = 2)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->integer('total_price')->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePlacesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!Schema::hasTable('places')) {
|
||||
Schema::create('places', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->integer('place_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('places');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePlaceTablesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!Schema::hasTable('place_tables')) {
|
||||
Schema::create('place_tables', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->bigInteger('place_id')->unsigned();
|
||||
$table->foreign('place_id')->references('id')->on('places')->onDelete('cascade');
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('place_tables', 'table_id')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->integer('table_id')->nullable();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('place_tables', 'width')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->decimal('width', $precision = 10, $scale = 6)->nullable();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('place_tables', 'height')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->decimal('height', $precision = 10, $scale = 6)->nullable();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('place_tables', 'x')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->decimal('x', $precision = 10, $scale = 6)->nullable();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('place_tables', 'y')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->decimal('y', $precision = 10, $scale = 6)->nullable();
|
||||
});
|
||||
}
|
||||
if (!Schema::hasColumn('place_tables', 'type')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->integer('type')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('place_tables');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateCoreInterface extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
function deleteFolder($dir) {
|
||||
$d = opendir($dir);
|
||||
while (($entry = readdir($d)) !== false) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if (is_dir($dir . "/" . $entry)) {
|
||||
deleteFolder($dir . "/" . $entry);
|
||||
} else {
|
||||
unlink($dir . "/" . $entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($d);
|
||||
rmdir($dir);
|
||||
}
|
||||
$directivesUpd = CORE_PATH . '/../V1/forUpdate/toDirectives/';
|
||||
$indexUpd = CORE_PATH . '/../V1/forUpdate/toWebApp/';
|
||||
if (is_dir($directivesUpd)) {
|
||||
$files = array_diff(scandir($directivesUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/scripts/directives/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/scripts/directives/' . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file . '.bak');
|
||||
}
|
||||
copy($directivesUpd . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($indexUpd)) {
|
||||
$files = array_diff(scandir($indexUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/' . $file, CORE_PATH . '/../../web/app/' . $file . '.bak');
|
||||
}
|
||||
copy($indexUpd . $file, CORE_PATH . '/../../web/app/' . $file);
|
||||
}
|
||||
}
|
||||
/* if (file_exists(CORE_PATH . '/../V1/forUpdate/')) {
|
||||
deleteFolder(CORE_PATH . '/../V1/forUpdate/');
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTypeColumnInPlaceTables extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasColumn('place_tables', 'type')) {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->integer('type')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('place_tables', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClientsPresalesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('clients_presales')) {
|
||||
Schema::create('clients_presales', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('client_guid');
|
||||
$table->decimal('value', $precision = 16, $scale = 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('clients_presales');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateClientsBonusesTable extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasTable('clients_bonuses')) {
|
||||
Schema::create('clients_bonuses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('client_guid');
|
||||
$table->decimal('value', $precision = 16, $scale = 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::dropIfExists('clients_bonuses');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddOrderIdColumnInClientsActions extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (!Schema::hasColumn('clients_actions', 'order_id')) {
|
||||
Schema::table('clients_actions', function (Blueprint $table) {
|
||||
$table->integer('order_id')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('clients_actions', function (Blueprint $table) {
|
||||
$table->dropColumn('order_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateCoreInterface227 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$directivesUpd = CORE_PATH . '/../V1/forUpdate/toDirectives/';
|
||||
$indexUpd = CORE_PATH . '/../V1/forUpdate/toWebApp/';
|
||||
$servicesUpd = CORE_PATH . '/../V1/forUpdate/toServices/';
|
||||
$libsUpd = CORE_PATH . '/../V1/forUpdate/toLibs/datatables/';
|
||||
if (is_dir($directivesUpd)) {
|
||||
$files = array_diff(scandir($directivesUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/scripts/directives/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/scripts/directives/' . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file . '.bak');
|
||||
}
|
||||
copy($directivesUpd . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($indexUpd)) {
|
||||
$files = array_diff(scandir($indexUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/' . $file, CORE_PATH . '/../../web/app/' . $file . '.bak');
|
||||
}
|
||||
copy($indexUpd . $file, CORE_PATH . '/../../web/app/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($servicesUpd)) {
|
||||
$files = array_diff(scandir($servicesUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/scripts/services/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/scripts/services/' . $file, CORE_PATH . '/../../web/app/scripts/services/' . $file . '.bak');
|
||||
}
|
||||
copy($servicesUpd . $file, CORE_PATH . '/../../web/app/scripts/services/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($libsUpd)) {
|
||||
$files = array_diff(scandir($libsUpd), array('.', '..'));
|
||||
if (!is_dir(CORE_PATH . '/../../web/libs/datatables/')) {
|
||||
mkdir(CORE_PATH . '/../../web/libs/datatables/', 0777);
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/libs/datatables/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/libs/datatables/' . $file, CORE_PATH . '/../../web/libs/datatables//' . $file . '.bak');
|
||||
}
|
||||
copy($libsUpd . $file, CORE_PATH . '/../../web/libs/datatables/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use App\Component\Models\Filesystem;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DeleteFrontendFolders227 extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
if (file_exists(CORE_PATH . '/../Staff/web/')) {
|
||||
Filesystem::ClearFolder((CORE_PATH . '/../Staff/web/'));
|
||||
} else {
|
||||
Log::debug('Staff frontend already deleted!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use App\Component\Models\Filesystem;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIndexesForTables extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('exchange_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_actions');
|
||||
|
||||
if (! array_key_exists('action_type_index', $indexesFound)) {
|
||||
$table->index('action_type', 'action_type_index');
|
||||
}
|
||||
});
|
||||
Schema::table('exchange_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_actions');
|
||||
|
||||
if (! array_key_exists('order_code_index', $indexesFound)) {
|
||||
$table->index('order_code', 'order_code_index');
|
||||
}
|
||||
});
|
||||
Schema::table('exchange_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_actions');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
use App\Component\Models\Filesystem;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIndexesForTablesV2 extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('dishes', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('dishes');
|
||||
|
||||
if (! array_key_exists('code_index', $indexesFound)) {
|
||||
$table->index('code', 'code_index');
|
||||
}
|
||||
if (! array_key_exists('legacy_code_index', $indexesFound)) {
|
||||
$table->index('legacy_code', 'legacy_code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('exchange_deleted', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_deleted');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
if (! array_key_exists('menu_code_index', $indexesFound)) {
|
||||
$table->index('menu_code', 'menu_code_index');
|
||||
}
|
||||
if (! array_key_exists('dishes_code_index', $indexesFound)) {
|
||||
$table->index('dishes_code', 'dishes_code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('exchange_items', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_items');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
if (! array_key_exists('menu_code_index', $indexesFound)) {
|
||||
$table->index('menu_code', 'menu_code_index');
|
||||
}
|
||||
if (! array_key_exists('dishes_code_index', $indexesFound)) {
|
||||
$table->index('dishes_code', 'dishes_code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('exchange_orders', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_orders');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
if (! array_key_exists('code_index', $indexesFound)) {
|
||||
$table->index('code', 'code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('shift_online_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('shift_online_actions');
|
||||
|
||||
if (! array_key_exists('order_code_index', $indexesFound)) {
|
||||
$table->index('order_code', 'order_code_index');
|
||||
}
|
||||
if (! array_key_exists('type_action_index', $indexesFound)) {
|
||||
$table->index('type_action', 'type_action_index');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddNameColumnToTerminals extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
|
||||
if (!Schema::hasColumn('terminals', 'name')) {
|
||||
Schema::table('terminals', function (Blueprint $table) {
|
||||
$table->string('name')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('terminals', function (Blueprint $table) {
|
||||
$table->dropColumn('name');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddImageColumnToPlaces extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
|
||||
if (!Schema::hasColumn('places', 'image')) {
|
||||
Schema::table('places', function (Blueprint $table) {
|
||||
$table->text('image')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
Schema::table('places', function (Blueprint $table) {
|
||||
$table->dropColumn('image');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateCoreInterface230 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$directivesUpd = CORE_PATH . '/../V1/forUpdate/toDirectives/';
|
||||
$indexUpd = CORE_PATH . '/../V1/forUpdate/toWebApp/';
|
||||
$servicesUpd = CORE_PATH . '/../V1/forUpdate/toServices/';
|
||||
$libsUpd = CORE_PATH . '/../V1/forUpdate/toLibs/datatables_new/';
|
||||
$cssUpd = CORE_PATH . '/../V1/forUpdate/toCss/';
|
||||
$libsUpdXlsx = CORE_PATH . '/../V1/forUpdate/toXlsx/';
|
||||
if (is_dir($directivesUpd)) {
|
||||
$files = array_diff(scandir($directivesUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/scripts/directives/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/scripts/directives/' . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file . '.bak');
|
||||
}
|
||||
copy($directivesUpd . $file, CORE_PATH . '/../../web/app/scripts/directives/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($indexUpd)) {
|
||||
$files = array_diff(scandir($indexUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/' . $file, CORE_PATH . '/../../web/app/' . $file . '.bak');
|
||||
}
|
||||
copy($indexUpd . $file, CORE_PATH . '/../../web/app/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($servicesUpd)) {
|
||||
$files = array_diff(scandir($servicesUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/app/scripts/services/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/app/scripts/services/' . $file, CORE_PATH . '/../../web/app/scripts/services/' . $file . '.bak');
|
||||
}
|
||||
copy($servicesUpd . $file, CORE_PATH . '/../../web/app/scripts/services/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($libsUpd)) {
|
||||
$files = array_diff(scandir($libsUpd), array('.', '..'));
|
||||
if (!is_dir(CORE_PATH . '/../../web/libs/datatables/')) {
|
||||
mkdir(CORE_PATH . '/../../web/libs/datatables/', 0777);
|
||||
} else {
|
||||
if (!is_dir(CORE_PATH . '/../../web/libs/datatables/backup/')) {
|
||||
mkdir(CORE_PATH . '/../../web/libs/datatables/backup/', 0777);
|
||||
}
|
||||
$old_files = array_diff(scandir(CORE_PATH . '/../../web/libs/datatables/'), array('.', '..', 'backup'));
|
||||
foreach ($old_files as $old_file) {
|
||||
copy(CORE_PATH . '/../../web/libs/datatables/' . $old_file, CORE_PATH . '/../../web/libs/datatables/backup/' . $old_file);
|
||||
unlink(CORE_PATH . '/../../web/libs/datatables/' . $old_file);
|
||||
}
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/libs/datatables/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/libs/datatables/' . $file, CORE_PATH . '/../../web/libs/datatables/' . $file . '.bak');
|
||||
}
|
||||
copy($libsUpd . $file, CORE_PATH . '/../../web/libs/datatables/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($cssUpd)) {
|
||||
$files = array_diff(scandir($cssUpd), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/assets/styles/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/assets/styles/' . $file, CORE_PATH . '/../../web/assets/styles/' . $file . '.bak');
|
||||
}
|
||||
copy($cssUpd . $file, CORE_PATH . '/../../web/assets/styles/' . $file);
|
||||
}
|
||||
}
|
||||
if (is_dir($libsUpdXlsx)) {
|
||||
$files = array_diff(scandir($libsUpdXlsx), array('.', '..'));
|
||||
if (!is_dir(CORE_PATH . '/../../web/libs/xlsx/')) {
|
||||
mkdir(CORE_PATH . '/../../web/libs/xlsx/', 0777);
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
if (file_exists(CORE_PATH . '/../../web/libs/xlsx/' . $file)) {
|
||||
copy(CORE_PATH . '/../../web/libs/xlsx/' . $file, CORE_PATH . '/../../web/libs/xlsx/' . $file . '.bak');
|
||||
}
|
||||
copy($libsUpdXlsx . $file, CORE_PATH . '/../../web/libs/xlsx/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateItemCountAndItemPriceInOrderItemsToFloatV2 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->decimal('item_price', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->decimal('item_count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_items', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_deleted', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->decimal('count_return', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->decimal('count_real', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_deleted', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->integer('item_price')->nullable()->change();
|
||||
});
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->integer('item_count')->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_items', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_deleted', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->decimal('count_return', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_items', function (Blueprint $table) {
|
||||
$table->decimal('count_real', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('exchange_deleted', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
25
database/seeders/Add1cMenuUploadSetting.php
Normal file
25
database/seeders/Add1cMenuUploadSetting.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Component\Models\Settings;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class Add1cMenuUploadSetting extends Seeder {
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run() {
|
||||
$check_setting = Settings::where('name', 'Триггер загрузки меню 1с (НЕ ИЗМЕНЯТЬ!)')->where('code', 12)->first();
|
||||
if (!$check_setting) {
|
||||
$setting = new Settings;
|
||||
$setting->name = 'Триггер загрузки меню 1с (НЕ ИЗМЕНЯТЬ!)';
|
||||
$setting->value = '0';
|
||||
$setting->code = 12;
|
||||
$setting->is_common = 1;
|
||||
$setting->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
310
database/seeders/AddActionTypes.php
Normal file
310
database/seeders/AddActionTypes.php
Normal file
@@ -0,0 +1,310 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Component\Models\ActionTypes;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddActionTypes extends Seeder {
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run() {
|
||||
if (ActionTypes::where('type_id', 1)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ открыт', 'type_id' => 1],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 2)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Добавлена позиция', 'type_id' => 2],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 5)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Удалена позиция', 'type_id' => 5],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 6)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ закрыт', 'type_id' => 6],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 7)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ отложен', 'type_id' => 7],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 8)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ удален', 'type_id' => 8],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 11)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Клиент добавлен', 'type_id' => 11],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 12)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Клиент отменен', 'type_id' => 12],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 15)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Добавлен модификатор', 'type_id' => 15],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 16)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Удален модификатор', 'type_id' => 16],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 17)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Начат возврат заказа', 'type_id' => 17],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 18)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Отмена возврата заказа', 'type_id' => 18],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 19)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ возвращен', 'type_id' => 19],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 20)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Возврат заказа окончен', 'type_id' => 20],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 21)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Печать завершена', 'type_id' => 21],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 22)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Отмена позиции', 'type_id' => 22],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 23)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Ошибка печати', 'type_id' => 23],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 24)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Наличными', 'type_id' => 24],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 25)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Безналичными', 'type_id' => 25],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 26)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Кредитной картой', 'type_id' => 26],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 27)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Питание штата', 'type_id' => 27],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 28)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Аванс', 'type_id' => 28],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 29)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Остаток', 'type_id' => 29],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 30)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Удалены все позиции', 'type_id' => 30],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 31)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Начато объединение', 'type_id' => 31],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 32)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Объединение окончено', 'type_id' => 32],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 33)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Начато разбиение', 'type_id' => 33],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 34)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Разбиение окончено', 'type_id' => 34],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 35)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Конечный заказ разбиения', 'type_id' => 35],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 36)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ открыт администратором', 'type_id' => 36],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 37)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ заблокирован', 'type_id' => 37],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 38)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ разблокирован', 'type_id' => 38],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 39)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Перевод', 'type_id' => 39],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 40)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Custom', 'type_id' => 40],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 41)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ перенесен', 'type_id' => 41],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 42)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Здравница', 'type_id' => 42],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 43)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Аннулирование заказа', 'type_id' => 43],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 44)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Открыть с перезагрузки', 'type_id' => 44],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 45)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Место заказа', 'type_id' => 45],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 46)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Количество клиентов', 'type_id' => 46],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 47)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Изменить курс', 'type_id' => 47],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 48)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Бонус', 'type_id' => 48],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 49)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Внесение денежных средств', 'type_id' => 49],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 50)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Выплата денежных средств', 'type_id' => 50],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 51)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Электронными деньгами', 'type_id' => 51],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 52)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Заказ вызван', 'type_id' => 52],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 53)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Выход из заказа', 'type_id' => 53],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 54)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Автоматический выход из заказа', 'type_id' => 54],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
if (ActionTypes::where('type_id', 55)->count() == 0) {
|
||||
$types = ActionTypes::upsert([
|
||||
['name' => 'Вход в заказ', 'type_id' => 55],
|
||||
], ['name'], ['type_id']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Models\Subscriber;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddAfterMenuUploadSubscriber extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Subscriber::add('sync:postmenu', 'hello:gethello', 10);
|
||||
}
|
||||
}
|
||||
17
database/seeders/AddAfterSyncHelloSubscriber.php
Normal file
17
database/seeders/AddAfterSyncHelloSubscriber.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Models\Subscriber;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddAfterSyncHelloSubscriber extends Seeder {
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run() {
|
||||
Subscriber::add('sync:gethello', 'v1:getbot', 10);
|
||||
}
|
||||
}
|
||||
23
database/seeders/AddClientGroup.php
Normal file
23
database/seeders/AddClientGroup.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Component\Models\ClientsGroup;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddClientGroup extends Seeder {
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run() {
|
||||
if (ClientsGroup::where('code', '0')->count() == 0) {
|
||||
$group = new ClientsGroup([
|
||||
'code' => '0',
|
||||
'name' => 'Без группы',
|
||||
]);
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
25
database/seeders/AddDeleteShiftSetting.php
Normal file
25
database/seeders/AddDeleteShiftSetting.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Component\Models\Settings;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddDeleteShiftSetting extends Seeder {
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run() {
|
||||
$check_setting = Settings::where('name', 'Удаление смен')->where('code', 11)->first();
|
||||
if (!$check_setting) {
|
||||
$setting = new Settings;
|
||||
$setting->name = 'Удаление смен';
|
||||
$setting->value = '0';
|
||||
$setting->code = 11;
|
||||
$setting->is_common = 1;
|
||||
$setting->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
39
database/seeders/AddStaffRights.php
Normal file
39
database/seeders/AddStaffRights.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Component\Models\Right;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddStaffRights extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (Right::where('code', 'clean')->count() == 0) {
|
||||
Right::add('clean', 'Обрезка базы');
|
||||
}
|
||||
if (Right::where('code', 'marketplace')->count() == 0) {
|
||||
Right::add('marketplace', 'Маркетплейс');
|
||||
}
|
||||
if (Right::where('code', 'update')->count() == 0) {
|
||||
Right::add('update', 'Обновления');
|
||||
}
|
||||
if (Right::where('code', 'roommap')->count() == 0) {
|
||||
Right::add('roommap', 'Карта залов');
|
||||
}
|
||||
if (Right::where('code', 'eorders')->count() == 0) {
|
||||
Right::add('eorders', 'Онлайн заказы');
|
||||
}
|
||||
if (Right::where('code', 'loyalty')->count() == 0) {
|
||||
Right::add('loyalty', 'Loyalty');
|
||||
}
|
||||
if (Right::where('code', 'activitymonitor')->count() == 0) {
|
||||
Right::add('activitymonitor', 'Монитор активности');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Models\Right;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddTestRight extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Right::add('test', 'Тестовый раздел');
|
||||
}
|
||||
}
|
||||
36
database/seeders/AddUserRights.php
Normal file
36
database/seeders/AddUserRights.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Component\Seeders;
|
||||
|
||||
use App\Component\Models\StaffRights;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddUserRights extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if (StaffRights::where('code', 'RIGHT_57')->count() == 0) {
|
||||
StaffRights::add('RIGHT_57', 'Доставка');
|
||||
}
|
||||
if (StaffRights::where('code', 'RIGHT_58')->count() == 0) {
|
||||
StaffRights::add('RIGHT_58', 'Электронный чек');
|
||||
}
|
||||
if (StaffRights::where('code', 'RIGHT_59')->count() == 0) {
|
||||
StaffRights::add('RIGHT_59', 'Отображение заказов в журнале');
|
||||
}
|
||||
if (StaffRights::where('code', 'RIGHT_60')->count() == 0) {
|
||||
StaffRights::add('RIGHT_60', 'Отображение отчетов смены');
|
||||
}
|
||||
if (StaffRights::where('code', 'RIGHT_61')->count() == 0) {
|
||||
StaffRights::add('RIGHT_61', 'Печать копии чека из журнала заказов');
|
||||
}
|
||||
if (StaffRights::where('code', 'RIGHT_62')->count() == 0) {
|
||||
StaffRights::add('RIGHT_62', 'Отправка чека на email');
|
||||
}
|
||||
}
|
||||
}
|
||||
6243
forUpdate/toCSS/app.css
Normal file
6243
forUpdate/toCSS/app.css
Normal file
File diff suppressed because it is too large
Load Diff
1
forUpdate/toCSS/app.min.css
vendored
Normal file
1
forUpdate/toCSS/app.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
224
forUpdate/toCSS/app.rtl.css
Normal file
224
forUpdate/toCSS/app.rtl.css
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
|
||||
*/
|
||||
.app-aside {
|
||||
left: auto !important; }
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.app-aside.lg:not(.hide) ~ .app-content {
|
||||
margin-right: 13.75rem; }
|
||||
.app-aside.sm:not(.hide) ~ .app-content {
|
||||
margin-right: 11.25rem; }
|
||||
.app-aside.folded:not(.hide) ~ .app-content {
|
||||
margin-right: 4rem; }
|
||||
.app-aside.folded.md:not(.hide) ~ .app-content {
|
||||
margin-right: 5rem; }
|
||||
.app-aside:not(.hide) ~ .app-content {
|
||||
margin-right: 12.5rem; }
|
||||
.app-content {
|
||||
margin-left: auto !important; }
|
||||
.hide-scroll {
|
||||
margin-right: 0;
|
||||
margin-left: -17px; } }
|
||||
|
||||
@media (min-width: 992px) {
|
||||
body.container .app-header {
|
||||
margin-left: auto;
|
||||
margin-right: 0; } }
|
||||
|
||||
.navside .nav li li a {
|
||||
padding-left: 1rem;
|
||||
padding-right: 3.5rem; }
|
||||
|
||||
.navside .nav li li li a {
|
||||
padding-left: 1rem;
|
||||
padding-right: 4.5rem; }
|
||||
|
||||
.navside .nav li li li li a {
|
||||
padding-left: 1rem;
|
||||
padding-right: 5.5rem; }
|
||||
|
||||
.nav-icon {
|
||||
float: right;
|
||||
margin-left: 1rem;
|
||||
margin-right: inherit; }
|
||||
|
||||
.nav-caret,
|
||||
.nav-label {
|
||||
float: left;
|
||||
margin-right: 1rem;
|
||||
margin-left: inherit; }
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.folded.nav-expand:hover .nav > li > a, .folded.nav-expand:focus .nav > li > a, .folded.nav-expand.active .nav > li > a {
|
||||
text-align: right; }
|
||||
.folded.nav-expand:hover .nav > li > a .nav-icon, .folded.nav-expand:focus .nav > li > a .nav-icon, .folded.nav-expand.active .nav > li > a .nav-icon {
|
||||
float: right;
|
||||
margin-left: 16px;
|
||||
margin-right: 0; }
|
||||
.folded.nav-expand:hover .navbar, .folded.nav-expand:focus .navbar, .folded.nav-expand.active .navbar {
|
||||
text-align: right; }
|
||||
.folded.nav-dropdown .nav > li > ul {
|
||||
left: auto;
|
||||
right: 100%; } }
|
||||
|
||||
.navbar-brand > span {
|
||||
margin-left: 0;
|
||||
margin-right: 10px; }
|
||||
|
||||
.navbar-item {
|
||||
margin-right: inherit;
|
||||
margin-left: 1rem; }
|
||||
|
||||
.m-r {
|
||||
margin-left: 1rem !important;
|
||||
margin-right: auto !important; }
|
||||
|
||||
.m-l {
|
||||
margin-right: 1rem !important;
|
||||
margin-left: auto !important; }
|
||||
|
||||
.m-r-lg {
|
||||
margin-left: 3rem !important;
|
||||
margin-right: auto !important; }
|
||||
|
||||
.m-l-lg {
|
||||
margin-right: 3rem !important;
|
||||
margin-left: auto !important; }
|
||||
|
||||
.m-r-md {
|
||||
margin-left: 1.5rem !important;
|
||||
margin-right: auto !important; }
|
||||
|
||||
.m-l-md {
|
||||
margin-right: 1.5rem !important;
|
||||
margin-left: auto !important; }
|
||||
|
||||
.m-r-sm {
|
||||
margin-left: 0.5rem !important;
|
||||
margin-right: auto !important; }
|
||||
|
||||
.m-l-sm {
|
||||
margin-right: 0.5rem !important;
|
||||
margin-left: auto !important; }
|
||||
|
||||
.m-r-xs {
|
||||
margin-left: 0.25rem !important;
|
||||
margin-right: auto !important; }
|
||||
|
||||
.m-l-xs {
|
||||
margin-right: 0.25rem !important;
|
||||
margin-left: auto !important; }
|
||||
|
||||
.box-tool {
|
||||
left: 1rem;
|
||||
right: auto; }
|
||||
|
||||
.list-left {
|
||||
float: right;
|
||||
padding-left: 1rem;
|
||||
padding-right: 0; }
|
||||
.list-left + .list-body {
|
||||
margin-left: 0;
|
||||
margin-right: 56px; }
|
||||
|
||||
.streamline {
|
||||
border-left-width: 0;
|
||||
border-right-width: 1px;
|
||||
border-right-style: solid; }
|
||||
.streamline:after,
|
||||
.streamline .sl-item:before,
|
||||
.streamline .sl-icon:before {
|
||||
margin-left: 0;
|
||||
margin-right: -4px;
|
||||
top: 6px;
|
||||
left: auto;
|
||||
right: 0; }
|
||||
|
||||
.sl-icon {
|
||||
left: auto;
|
||||
right: -10px; }
|
||||
|
||||
.sl-left {
|
||||
float: right;
|
||||
margin-right: -20px;
|
||||
margin-left: 0; }
|
||||
.sl-left + .sl-content {
|
||||
margin-right: 36px;
|
||||
margin-left: auto; }
|
||||
|
||||
.sl-content {
|
||||
margin-left: 0;
|
||||
margin-right: 24px; }
|
||||
|
||||
.tl-wrap {
|
||||
margin-left: 0;
|
||||
margin-right: 6em;
|
||||
border-width: 0 2px 0 0;
|
||||
padding: 15px 20px 15px 0px; }
|
||||
.tl-wrap:before {
|
||||
float: right;
|
||||
margin-right: -26px; }
|
||||
|
||||
.timeline-center .tl-item {
|
||||
margin-right: 50%;
|
||||
margin-left: 0; }
|
||||
|
||||
.timeline-center .tl-wrap {
|
||||
margin-right: -2px !important; }
|
||||
|
||||
.tl-date {
|
||||
text-align: left;
|
||||
float: right;
|
||||
margin-right: -7.5em; }
|
||||
|
||||
.ui-check > i {
|
||||
margin-right: -20px;
|
||||
margin-left: 4px; }
|
||||
|
||||
.ui-switch input:checked + i:after {
|
||||
margin-right: 15px;
|
||||
margin-left: 0; }
|
||||
|
||||
.ui-switch-md input:checked + i:after {
|
||||
margin-right: 17px;
|
||||
margin-left: 0; }
|
||||
|
||||
.ui-switch-lg input:checked + i:after {
|
||||
margin-right: 21px;
|
||||
margin-left: 0; }
|
||||
|
||||
.md-check {
|
||||
padding-left: 0;
|
||||
padding-right: 20px; }
|
||||
.md-check input[type="checkbox"]:checked + i:after,
|
||||
.md-check input[type="radio"]:checked + i:after {
|
||||
left: auto;
|
||||
right: 6px; }
|
||||
.md-check > i {
|
||||
float: right;
|
||||
margin-left: 28px;
|
||||
margin-right: -20px; }
|
||||
|
||||
.md-switch {
|
||||
padding-left: 0;
|
||||
padding-right: 36px; }
|
||||
.md-switch > i {
|
||||
margin-right: 0;
|
||||
margin-left: 8px; }
|
||||
|
||||
.md-input ~ label {
|
||||
left: auto;
|
||||
right: 0; }
|
||||
|
||||
.switcher {
|
||||
left: -240px;
|
||||
right: auto; }
|
||||
.switcher .sw-btn {
|
||||
left: auto;
|
||||
right: -42px;
|
||||
border-right-width: 1px;
|
||||
border-left-width: 0; }
|
||||
.switcher.active {
|
||||
left: -1px;
|
||||
right: auto; }
|
||||
5
forUpdate/toCSS/font.css
Normal file
5
forUpdate/toCSS/font.css
Normal file
@@ -0,0 +1,5 @@
|
||||
/*custom*/
|
||||
@import url(../../assets/fonts/roboto/font.css);
|
||||
body{
|
||||
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
30
forUpdate/toCSS/my.css
Normal file
30
forUpdate/toCSS/my.css
Normal file
@@ -0,0 +1,30 @@
|
||||
table.dataTable tr.dtrg-group.dtrg-level-0 td {
|
||||
font-weight: bold;
|
||||
}
|
||||
table.dataTable tr.dtrg-group td {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
table.dataTable tr.dtrg-group.dtrg-level-1 td:first-child{
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
table.dataTable tr.dtrg-group.dtrg-level-1 td{
|
||||
background-color: #f0f0f0;
|
||||
padding-top: 0.25em;
|
||||
padding-bottom: 0.25em;
|
||||
}
|
||||
table.dataTable tr.dtrg-group.dtrg-level-2 td:first-child {
|
||||
padding-left: 1em;
|
||||
}
|
||||
table.dataTable tr.dtrg-group.dtrg-level-2 td {
|
||||
background-color: #fff0f0;
|
||||
}
|
||||
|
||||
table.dataTable tr.dtrg-group.dtrg-level-3 td:first-child {
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
table.dataTable tr.dtrg-group.dtrg-level-3 td {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
table.dataTable.compact tbody tr td.order_id {
|
||||
padding-left: 2em;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user