64 Commits

Author SHA1 Message Date
miroman-afk
40b2501c7a v.2.34
Update module version
2023-08-15 12:22:54 +03:00
miroman-afk
229ab8667e v.2.34
Обновлены округления
Добавлены миграции
2023-08-15 12:19:34 +03:00
miroman-afk
a7c1679d12 v.2.34
Исправлен пересчет весовых товаров в онлайн реализации
2023-08-15 10:54:39 +03:00
miroman-afk
468cb21e40 v.2.33
Fix migration
2023-08-11 12:08:55 +03:00
miroman-afk
0b5df57d08 v.2.32
Fix migration
2023-08-11 11:55:39 +03:00
miroman-afk
ee1ad42c38 v.2.31
Исправлено получение наименований блюд
2023-08-11 11:39:48 +03:00
miroman-afk
e9c99df7e3 v.2.31
fix
2023-08-10 13:17:29 +03:00
miroman-afk
94fef07bb2 v2.31
Fix migrations
2023-08-10 13:16:56 +03:00
miroman-afk
ed61e9627d v.2.30
Small fix
2023-08-10 11:01:48 +03:00
miroman-afk
c4dc6e02a0 v.2.30
Добавлен расширенный отчет по реализации
Добавлен монитор активности
2023-08-03 11:05:15 +03:00
miroman-afk
19ad7d1c8a v.2.29 2023-05-04 10:42:16 +03:00
miroman-afk
5c3a8a464b v.2.28 2023-05-04 10:41:36 +03:00
miroman-afk
fb46c8e739 v.2.27
Fixed reports
2023-05-02 15:21:54 +03:00
miroman-afk
70120653f7 v.2.26
Small fix
2022-12-22 13:15:54 +03:00
miroman-afk
723e9a8768 v.2.25
Small fix
2022-12-22 12:52:42 +03:00
miroman-afk
d24bba305f v.2.24
1. POSTBonus in/out
2. POSTPresale in/out
3. Переработана форма гостя
2022-12-14 12:42:39 +03:00
miroman-afk
4d3ad7727d v.2.24
1. Редактор карты зала.
2022-10-27 15:48:02 +03:00
miroman-afk
0e5f2002b1 v.2.23
Fix update
2022-09-23 11:07:02 +03:00
miroman-afk
dcd0e72d1f v.2.22
Редактор карты зала
Электронные заказы
Отчет по удалениям
2022-09-22 16:34:02 +03:00
miroman-afk
1af2b267f5 v.2.21
Обновлен перенос клиента из группы в группу
Обновлен метод восстановления смены
Добавлен метод загрузки меню 1с из облака
2022-07-25 23:26:44 +03:00
miroman-afk
9c3b633098 v.2.19
Обновлены миграции
Разработка парсера меню из 1с
2022-06-22 23:05:26 +03:00
miroman-afk
46cf6ff8e4 v.2.18 2022-06-16 12:51:25 +03:00
miroman-afk
415b291785 v.2.18 2022-06-16 12:50:50 +03:00
miroman-afk
cb33be6001 v.2.16 2022-06-14 16:48:10 +03:00
miroman-afk
8e4073ffe3 v.2.16
Исправление типов действий
2022-06-14 16:47:00 +03:00
miroman-afk
7fdcbcc9e8 v.2.15
Обновление отчета по персоналу
2022-06-14 12:22:42 +03:00
miroman-afk
ebd1180d89 v.2.15
Добавлен журнал заказов
Добавлены отчеты: по переносам, по объединениям, по разбиениям
2022-06-13 13:16:50 +03:00
miroman-afk
2d148e3eb5 v.2.15
Discounts block update
2022-04-28 23:55:53 +03:00
miroman-afk
53dfb77d7a v.2.15
Order history
Small fixes
2022-04-12 01:43:05 +03:00
miroman-afk
85fd6af04f v.2.15
Order history
2022-03-25 00:03:43 +03:00
miroman-afk
4ad154c65a v.2.15
Update dashboard blocks
2022-03-24 21:48:31 +03:00
miroman-afk
d79e61c6a4 v.2.15
Update "more" column in exchange_actions and shift_online_actions
2022-03-24 21:48:04 +03:00
miroman-afk
506636d35c v.2.14
Update migrations
2022-02-05 15:26:43 +03:00
miroman-afk
5b1c774259 v.2.13
-Add delete reports
2022-02-01 02:47:25 +03:00
miroman-afk
5497b611ef v.2.12
-Add new setting "Delete shift"
-Move "Shift" frontend to V1 module
2022-02-01 01:55:15 +03:00
miroman-afk
57949aa89a v.2.11 2022-01-29 02:43:30 +03:00
miroman-afk
70f5640505 v.2.11
-Force update button on dashboard
2022-01-29 02:42:54 +03:00
miroman-afk
da51b6ca63 v.2.10 2022-01-29 02:11:18 +03:00
miroman-afk
de0e951ca1 v.2.10
-Fix cp1251 to utf-8 decode
2022-01-29 02:10:47 +03:00
miroman-afk
fb3a28e74e v.2.9
-Fix modifiers in orders
2022-01-27 13:29:12 +03:00
miroman-afk
284d2bcb60 v.2.8
-Redused time for online sync
-Fix dish name for TopDishes
2022-01-26 20:56:40 +03:00
miroman-afk
3894932e4c v.2.7
Time fix
2022-01-20 12:09:01 +03:00
miroman-afk
cf997da7ec v.2.6
Small fix
2022-01-20 12:03:19 +03:00
miroman-afk
104017ed96 v.2.5
Update migrations
2022-01-14 14:24:19 +03:00
miroman-afk
61d8b4e1d2 v2.5
Update RestoreShift frontend
2022-01-13 15:43:04 +03:00
miroman-afk
f964aca7a9 v2.5
Update response in "delete client"
2022-01-13 01:43:50 +03:00
miroman-afk
def1ac1986 v.2.5
Update clients module
2022-01-13 01:22:59 +03:00
miroman-afk
51a27b005e v.2.5
Migration: Add column 'legacy_code' to 'units_list'
2022-01-12 23:53:36 +03:00
miroman-afk
cf1e228f26 v.2.4
Restore shifts
2022-01-10 14:42:35 +03:00
miroman-afk
0209970fe1 v.2.4 RestoreShift 2022-01-10 02:28:28 +03:00
miroman-afk
7438ebef78 v.2.3
front fix
2021-12-31 00:07:28 +03:00
miroman-afk
944dff2163 v.2.3
front fix
2021-12-29 23:31:48 +03:00
miroman-afk
b702888540 v.2.3
front fix
2021-12-29 14:46:58 +03:00
miroman-afk
f8c4060a82 v.2.3
front fix
2021-12-29 14:05:32 +03:00
miroman-afk
2702c4b6e9 v.2.3
Happy New Year!
2021-12-29 13:17:03 +03:00
miroman-afk
1a7808f75b v.2.2 Update
Top dishes block update
2021-11-18 10:59:38 +03:00
miroman-afk
276576f007 v.2.1
Client file update
2021-11-16 15:58:20 +03:00
miroman-afk
3da3e3a6e1 v.2.0
Clients file update
2021-11-16 15:44:04 +03:00
miroman-afk
3c8a6b2736 v.2.0
Clients file update
2021-11-16 15:43:14 +03:00
miroman-afk
13a115ba0d v.1.9 update
Clients download update
2021-11-11 10:32:31 +03:00
miroman-afk
151704b637 v.1.8 update 2021-11-01 15:21:58 +03:00
miroman-afk
a54a91263a v.1.8 update 2021-11-01 15:19:27 +03:00
miroman-afk
87cf29a443 v.1.7 update 2021-11-01 14:35:53 +03:00
miroman-afk
3b61b27200 Update api requests 2021-05-31 16:11:03 +03:00
266 changed files with 48335 additions and 404 deletions

3
.gitignore vendored
View File

@@ -2,3 +2,6 @@
temp/
vendor/
build.zip
places.xml
*.log
*.log

View File

@@ -1,34 +0,0 @@
<?php
namespace App\Commands;
use App\Component\Models\Dishes;
use App\Component\Models\Folders;
use App\Component\Models\Orders;
use App\Component\Models\Settings;
use App\Component\Models\Tasks;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class Bot 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 = Dishes::where('is_bot_export', '=', 0)->update(['is_bot_export' => 1]);
$folders = Folders::where('is_bot_export', '=', 0)->update(['is_bot_export' => 1]);
}
$ordersinfo = Tasks::where('method', '=', 'orderinfo')->get();
$delete_params = ['closed', 'deleted'];
foreach ($ordersinfo as $more) {
$order = Orders::where('id', '=', $more['more'])->whereIn('status', $delete_params)->get();
foreach ($order as $value) {
$delete = Tasks::where('method', '=', 'orderinfo')->where('more', '=', $value['id'])->delete();
}
}
return [
'status' => 'success',
];
}
}

View File

@@ -1,74 +0,0 @@
<?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 ClientFile extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getclientfile';
public function command($input, $output = null) {
$terminal = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->where('work_code', '=', 1)->first();
$tmp_dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\tmp\\" . $terminal['key'] . "\\";
$dirname = __DIR__ . "\\..\\..\\..\\Exchange\\" . $terminal['key'] . "\\";
$filename = str_replace(' ', '_', date("d.m.Y H.i.s")) . '.csv';
$code = '';
if (isset($input['complete'])) {
foreach (glob($tmp_dirname . "*.tmp") as $tmp_filename) {
$code .= file_get_contents($tmp_filename);
file_put_contents($dirname . $filename, $code);
unlink($tmp_filename);
}
$baseCSV = file($dirname . $filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($baseCSV as $itemBaseCSV) {
$arrLineCsv = explode(";", $itemBaseCSV);
$arrUniqFinish[mb_convert_encoding($arrLineCsv[0], 'CP1251') . ";" . $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',
'filename' => $filename,
'terminalKey' => $terminal['key'],
];
} else {
$clientsCount = Client::count();
$urlThread = $input['th'];
$mainThreads = 4;
$countPerThread = ceil($clientsCount / $mainThreads);
$offset = ($urlThread - 1) * $countPerThread;
$clients = Client::with('clientPhone:client_guid,phone')->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 (($row['clientPhone']->phone !== '') && ($row['clientPhone']->phone !== '+375 ( ) - -')) {
$row = array($row['name'], $row['clientPhone']->phone);
fputcsv($handle, $row, ';');
}
}
fclose($handle);
return [
'status' => 'success',
'filename' => $filename,
];
}
}
}

View File

@@ -1,28 +0,0 @@
<?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,
];
}
}

View File

@@ -1,71 +0,0 @@
<?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 Clients 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 = ClientsPhone::where('client_guid', '=', $client['user_code'])->first();
$email = ClientsEmail::where('client_guid', '=', $client['user_code'])->first();
$address = ClientsAddress::where('client_guid', '=', $client['user_code'])->first();
$barcode = ClientsBarcode::where('client_guid', '=', $client['user_code'])->first();
$group = ClientsGroup::where('code', '=', $client['group_id'])->first();
$out[] = array(
'id' => $client['id'],
'client_group' => $group['id'],
'name' => $client['name'],
'phone' => $phone['phone'],
'email' => $email['email'],
'address' => $address['address'],
'barcode' => $barcode['code_id'],
);
}
return [
'status' => 'success',
'clients' => $out,
'total' => $total,
'size' => $countPerPage,
'pages' => ceil($total / $countPerPage),
'currentGroup' => $group['id'],
];
}
}
}

45
commands/GETBot.php Normal file
View 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',
];
}
}

View 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
View 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,
];
}
}

View 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
View 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' => 'Проверьте введенные данные',
];
}
}
}

View 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
View 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'],
];
}
}
}

View 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
View 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

File diff suppressed because it is too large Load Diff

View 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,
];
}
}

View File

@@ -8,7 +8,7 @@ use App\Component\Models\Terminal;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class Equipment extends HRCCommand implements HRCCommandInterface {
class GETEquipment extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getequipment';
public function command($input, $output = null) {

View File

@@ -6,13 +6,13 @@ use App\Component\Models\Terminal;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class Import extends HRCCommand implements 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)->where('work_code', '=', 1)->get();
$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) {
@@ -31,6 +31,7 @@ class Import extends HRCCommand implements HRCCommandInterface {
$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']);
@@ -47,7 +48,9 @@ class Import extends HRCCommand implements HRCCommandInterface {
];
} else {
foreach ($out as $filename) {
$path = '/backup/' . $filename . '.xml';
$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();

1061
commands/GETImportMenu.php Normal file

File diff suppressed because it is too large Load Diff

39
commands/GETKeyInfo.php Normal file
View 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
];
}
}

View 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,
];
}
}

View 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
View 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
View 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' => 'Проверьте введенные данные',
];
}
}
}

View 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
View 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,
];
}
}

View File

@@ -2,24 +2,24 @@
namespace App\Commands;
use App\Component\Models\Orders;
use App\Component\Models\ExchangeShifts;
use App\Component\Models\OrderBotStorage;
use App\Component\Models\Report;
use App\Component\Models\Shifts;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class OutOrders extends HRCCommand implements 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 = Shifts::select('id', 'opened', 'closed')->where('id', '=', $input['shift_id'])->get();
$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 = Orders::select('id', 'order', 'created_at')->where('created_at', '>', $out['opened'])->where('created_at', '<=', $out['closed'])->get();
$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) {
@@ -73,7 +73,7 @@ class OutOrders extends HRCCommand implements HRCCommandInterface {
$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 = Orders::select('id', 'order', 'created_at')->where('created_at', '>', $start)->where('created_at', '<=', $end)->get();
$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) {

42
commands/GETReports.php Normal file
View 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
View 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
View 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
View 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
View 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,
];
}
}
}

View 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;
}
}
}

41
commands/POSTBonus.php Normal file
View 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
];
}
}

View File

@@ -10,80 +10,297 @@ 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';
class POSTClient extends HRCCommand implements HRCCommandInterface
{
protected $signature = 'postclient';
public function command($input, $output = null) {
public function command($input, $output = null)
{
if (isset($input['task']) && isset($input['id'])) {
if ($input['task'] == 'update') {
$client = Client::find($input['id']);
$client->name = urldecode($input['name']);
$client->unloaded = 0;
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'];
$clientGroup = ClientsGroup::where('id', $input['group_id'])->first();
$client->group_id = urldecode($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();
}
$clientPhone = ClientsPhone::where('client_guid', $client->user_code)->first();
if ($input['phone'] !== '') {
if (substr($input['phone'], 0, 1) == '+') {
$phoneData = urldecode($input['phone']);
} else {
$phoneData = urldecode($input['phone']);
$clientPhone->phone = '+375 (' . substr($phoneData, 0, 2) . ') ' . substr($phoneData, 2, 3) . '-' . substr($phoneData, 5, 2) . '-' . substr($phoneData, 7, 2);
}
} else {
$clientPhone->phone = '';
}
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 = '';
}
$clientEmail = ClientsEmail::where('client_guid', $client->user_code)->first();
$clientEmail->email = urldecode($input['email']);
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();
}
$clientAddress = ClientsAddress::where('client_guid', $client->user_code)->first();
$clientAddress->address = urldecode($input['address']);
$clientBarcodeStart = 0;
$clientBarcodeEnd = 0;
$clientBarcode = ClientsBarcode::where('client_guid', $client->user_code)->first();
$clientBarcode->code_id = urldecode($input['barcode']);
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;
}
}
$client->save();
$clientGroup->save();
$clientPhone->save();
$clientEmail->save();
$clientAddress->save();
$clientBarcode->save();
return [
'status' => 'success',
'client' => $client,
'phone' => $clientPhone,
'email' => $clientEmail,
'address' => $clientAddress,
'barcode' => $clientBarcode,
'message' => 'Клиент обновлен',
];
}
if ($input['task'] == 'delete') {
$client = Client::where('id', '=', $input['id'])->first();
$clientPhone = ClientsPhone::where('client_guid', $client->user_code)->first();
$clientEmail = ClientsEmail::where('client_guid', $client->user_code)->first();
$clientAddress = ClientsAddress::where('client_guid', $client->user_code)->first();
$clientBarcode = ClientsBarcode::where('client_guid', $client->user_code)->first();
$clientPhone->delete();
$clientEmail->delete();
$clientAddress->delete();
$clientBarcode->delete();
$client->delete();
return [
'status' => 'success',
'message' => 'Клиент удален',
];
}
} else {
return [
'status' => 'success',
'error_message' => 'Проверьте введенные данные',
];
}
}
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' => 'Проверьте введенные данные',
];
}
}
}

View File

@@ -15,7 +15,7 @@ class POSTClientGroup extends HRCCommand implements HRCCommandInterface {
if (isset($input['task']) && isset($input['id'])) {
if ($input['task'] == 'update') {
$group = ClientsGroup::find($input['id']);
$group->name = $input['name'];
$group->name = urldecode($input['name']);
$group->save();
return [

View File

@@ -8,12 +8,12 @@ use App\Component\Models\ClientsGroup;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class CreateBarcode extends HRCCommand implements 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']) && (srtlen($input['start']) == srtlen($input['end']))) {
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;
@@ -26,7 +26,6 @@ class CreateBarcode extends HRCCommand implements HRCCommandInterface {
$client->user_code = strtoupper(md5(time() + $i));
$client->group_id = $group['code'];
$client->is_special_price = 0;
$client->barcode_type = 1;
$barcode = new ClientsBarcode;
$barcode->code_id = $i;

View File

@@ -11,17 +11,45 @@ use App\Component\Models\ClientsPhone;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class CreateClient extends HRCCommand implements HRCCommandInterface {
class POSTCreateClient extends HRCCommand implements HRCCommandInterface {
protected $signature = 'postcreateclient';
public function command($input, $output = null) {
$group = ClientsGroup::where('id', '=', $input['group_id'])->first();
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 ($input['is_special_price'] == 'true') {
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;
@@ -29,14 +57,17 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
} else {
$client->name = urldecode($input['name']);
}
$client->user_code = strtoupper(md5(time()));
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->barcode_start = 0;
$client->barcode_end = 0;
$client->contractor = '';
$client->is_employee = $employee;
$client->last_change = date("Ymd");
$clientEmail = new ClientsEmail;
$clientEmail->email = urldecode($input['email']);
$clientEmail->client_guid = $client->user_code;
@@ -46,7 +77,7 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
$clientAddress->client_guid = $client->user_code;
$clientPhone = new ClientsPhone;
if ($input['phone'] !== '') {
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 {
@@ -55,8 +86,8 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
$clientPhone->phone = $phone;
$clientPhone->client_guid = $client->user_code;
if ($input['barcode'] > 0) {
$client->barcode_type = 1;
if (isset($input['barcode']) && $input['barcode'] > 0) {
$client->barcode_type = 2;
$clientBarcode = new ClientsBarcode;
$clientBarcode->code_id = urldecode($input['barcode']);
$clientBarcode->name = '';
@@ -64,13 +95,15 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
$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 = 0;
$client->barcode_type = 1;
$client->save();
$clientPhone->save();
$clientEmail->save();
@@ -80,6 +113,7 @@ class CreateClient extends HRCCommand implements HRCCommandInterface {
return [
'status' => 'success',
'message' => 'Клиент создан',
'client' => $client,
];
}
}

View 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',
];
}
}
}

View File

@@ -6,7 +6,7 @@ use App\Component\Models\Terminal;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class Fiscals extends HRCCommand implements HRCCommandInterface {
class POSTFiscals extends HRCCommand implements HRCCommandInterface {
protected $signature = 'postfiscals';
public function command($input, $output = null) {

238
commands/POSTOrder.php Normal file
View 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' => 'Проверьте введенные данные',
];
}
}
}

View 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
View 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
];
}
}

View File

@@ -9,7 +9,7 @@ use App\Component\Models\Terminal;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class Printers extends HRCCommand implements HRCCommandInterface {
class POSTPrinters extends HRCCommand implements HRCCommandInterface {
protected $signature = 'postprinters';
public function command($input, $output = null) {

View 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
View 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' => 'Проверьте введенные данные',
];
}
}

View 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' => 'Проверьте введенные данные',
];
}
}

View File

@@ -1,70 +0,0 @@
<?php
namespace App\Commands;
use App\Component\Models\Dishes;
use App\Component\Models\OnlineItems;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class TopDishes extends HRCCommand implements HRCCommandInterface {
protected $signature = 'gettopdishes';
public function command($input, $output = null) {
$info = OnlineItems::where('menu_code', '>', 0)->get()->unique('menu_code');
$count = OnlineItems::where('menu_code', '>', 0)->count();
if ($count > 0) {
foreach ($info as $key => $value) {
$out[] = $value;
}
foreach ($out as $key => $item) {
$dishInfo = Dishes::select('name')
->where('code', '=', $item['menu_code'])
->where('legacy_code', '=', $item['dish_code'])
->where('is_history', '=', 0)
->first();
$onlineDishInfo = OnlineItems::select('real_price', 'sale_price', 'special_price')
->where('menu_code', '=', $item['menu_code'])
->where('dish_code', '=', $item['dish_code'])
->first();
$dishName = $dishInfo['name'];
$dishCount = OnlineItems::where('menu_code', '=', $item['menu_code'])->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,
// 'info' => $info,
// 'test' => $dishes,
// 'count' => $dishCount,
];
} else {
return [
'status' => 'success',
'dishes' => [],
// 'info' => $info,
// 'test' => $dishes,
// 'count' => $dishCount,
];
}
}
}

View File

@@ -1,8 +1,13 @@
{
"name": "hrc-admin/hello-world",
"version": "1.6",
"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": [
{

665
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bc6a3225c331314f6774aa596a35b169",
"content-hash": "5dc828320e69a805a273cbd9b525e650",
"packages": [
{
"name": "brick/math",
@@ -810,6 +810,329 @@
],
"time": "2020-04-13T13:17:36+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "7.4.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/1dd98b0564cb3f6bd16ce683cb755f94c10fbd82",
"reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/promises": "^1.5",
"guzzlehttp/psr7": "^1.9 || ^2.4",
"php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
},
"provide": {
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"ext-curl": "*",
"php-http/client-integration-tests": "^3.0",
"phpunit/phpunit": "^8.5.5 || ^9.3.5",
"psr/log": "^1.1 || ^2.0 || ^3.0"
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.4-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle is a PHP HTTP client library",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"psr-18",
"psr-7",
"rest",
"web service"
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.4.5"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
"type": "tidelift"
}
],
"time": "2022-06-20T22:16:13+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da",
"reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4 || ^5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"support": {
"issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.5.1"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"time": "2021-10-22T20:56:57+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "13388f00956b1503577598873fffb5ae994b5737"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/13388f00956b1503577598873fffb5ae994b5737",
"reference": "13388f00956b1503577598873fffb5ae994b5737",
"shasum": ""
},
"require": {
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"http-interop/http-factory-tests": "^0.9",
"phpunit/phpunit": "^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.4.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
"type": "tidelift"
}
],
"time": "2022-06-20T21:43:11+00:00"
},
{
"name": "horeca/admin-php-module-core",
"version": "dev-master",
@@ -2489,6 +2812,59 @@
],
"time": "2020-12-14T13:15:25+00:00"
},
{
"name": "mtownsend/xml-to-array",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/mtownsend5512/xml-to-array.git",
"reference": "0734720a8462dba36d90fb8b2723bf46af0091f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mtownsend5512/xml-to-array/zipball/0734720a8462dba36d90fb8b2723bf46af0091f4",
"reference": "0734720a8462dba36d90fb8b2723bf46af0091f4",
"shasum": ""
},
"require": {
"php": "~7.0|~8.0"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
},
"type": "library",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Mtownsend\\XmlToArray\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Townsend",
"email": "mtownsend5512@gmail.com",
"role": "Developer"
}
],
"description": "Easily convert valid xml to a php array.",
"keywords": [
"array",
"convert",
"laravel",
"xml"
],
"support": {
"issues": "https://github.com/mtownsend5512/xml-to-array/issues",
"source": "https://github.com/mtownsend5512/xml-to-array/tree/2.0.0"
},
"time": "2021-02-27T22:39:18+00:00"
},
{
"name": "nesbot/carbon",
"version": "2.45.1",
@@ -2697,6 +3073,84 @@
},
"time": "2020-11-07T02:01:34+00:00"
},
{
"name": "phpmailer/phpmailer",
"version": "v6.6.4",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "a94fdebaea6bd17f51be0c2373ab80d3d681269b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a94fdebaea6bd17f51be0c2373ab80d3d681269b",
"reference": "a94fdebaea6bd17f51be0c2373ab80d3d681269b",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-filter": "*",
"ext-hash": "*",
"php": ">=5.5.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"doctrine/annotations": "^1.2",
"php-parallel-lint/php-console-highlighter": "^1.0.0",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"phpcompatibility/php-compatibility": "^9.3.5",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.6.2",
"yoast/phpunit-polyfills": "^1.0.0"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPMailer\\PHPMailer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-only"
],
"authors": [
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"support": {
"issues": "https://github.com/PHPMailer/PHPMailer/issues",
"source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.4"
},
"funding": [
{
"url": "https://github.com/Synchro",
"type": "github"
}
],
"time": "2022-08-22T09:22:00+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.7.5",
@@ -2869,6 +3323,166 @@
},
"time": "2019-01-08T18:20:26+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/master"
},
"time": "2020-06-29T06:28:15+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "1.1.3",
@@ -2970,6 +3584,50 @@
},
"time": "2017-10-23T01:57:42+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/ralouphie/getallheaders.git",
"reference": "120b605dfeb996808c31b6477290a714d356e822"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/getallheaders.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"description": "A polyfill for getallheaders.",
"support": {
"issues": "https://github.com/ralouphie/getallheaders/issues",
"source": "https://github.com/ralouphie/getallheaders/tree/develop"
},
"time": "2019-03-08T08:55:37+00:00"
},
{
"name": "ramsey/collection",
"version": "1.1.3",
@@ -5291,7 +5949,10 @@
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform": {
"ext-openssl": "*",
"ext-json": "*"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

View File

@@ -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');
}
}

View File

@@ -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) {
});
}
}

View File

@@ -11,16 +11,18 @@ class CreateClientsBarcodesTable extends Migration {
* @return void
*/
public function up() {
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();
});
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();
});
}
}
/**

View File

@@ -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');
}
}

View File

@@ -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');
}
}

View File

@@ -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');
});
}
}

View File

@@ -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');
});
}
}

View File

@@ -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() {
//
}
}

View File

@@ -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();
});
}
}

View File

@@ -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();
});
}
}

View File

@@ -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) {
//
});
}
}

View File

@@ -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) {
//
});
}
}

View File

@@ -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() {
//
}
}

View File

@@ -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();
});
}
}

View File

@@ -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();
});
}
}

View File

@@ -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) {
//
});
}
}

View File

@@ -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');
});
}
}

View File

@@ -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');
});
}
}

View File

@@ -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();
});
}
}

View File

@@ -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();
});
}
}

View File

@@ -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');
}
}

View File

@@ -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');
}
}

View File

@@ -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()
{
}
}

View File

@@ -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');
});
}
}

View File

@@ -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');
}
}

View File

@@ -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');
}
}

View File

@@ -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');
});
}
}

View File

@@ -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()
{
}
}

View File

@@ -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() {
//
}
}

View File

@@ -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() {
//
}
}

View File

@@ -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() {
//
}
}

View File

@@ -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');
});
}
}

View File

@@ -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');
});
}
}

View File

@@ -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()
{
}
}

View File

@@ -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();
});
}
}

View 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();
}
}
}

View 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']
);
}
}
}

View 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();
}
}
}

View 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', 'Монитор активности');
}
}
}

View 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

File diff suppressed because it is too large Load Diff

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
View 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
View 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
View 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;
}

View File

@@ -0,0 +1,221 @@
(function () {
'use strict';
angular.module('angular.drag.resize', [])
.provider('adrConfig', function adrConfigProvider() {
//defaults
var defaultConfig = {
iconPosition: [-1, 10],
mode: 'all',
modes: ['all', 'horizontal', 'vertical']
};
var config = angular.extend({}, defaultConfig);
this.$get = [function () {
return {
iconPosition: config.iconPosition,
mode: config.mode,
modes: config.modes
};
}];
})
.directive('resize', ['adrConfig', '$document', function (adrConfig, $document) {
return {
restrict: 'A',
link: function (scope, element, attr) {
var dimension = {};
var iconPosition = adrConfig.iconPosition;
var mode = attr.resize && adrConfig.modes.indexOf(attr.resize) > -1 ? attr.resize : adrConfig.mode;
var position = {};
var doc = {};
var el = {};
//create button for resizing
//var btn = document.createElement("span");
var btn = document.createElement("i");
btn.classList.add('fa');
btn.classList.add('fa-expand');
btn.classList.add('fa-rotate-90');
btn.style.border = '25px solid transparent';
/* btn.innerHTML =
"<i class='fa fa-expand fa-rotate-90' style='width: 25px;height: 25px; bottom: 10%; position: absolute;'></i>"
;*/
btn.style.position = 'fixed';
btn.style.visibility = 'hidden';
if (mode == 'horizontal') {
btn.style.cursor = 'ew-resize';
} else if (mode == 'vertical') {
btn.style.cursor = 'ns-resize';
} else {
btn.style.cursor = 'nwse-resize';
}
//bind resize function to button;
btn.onmousedown = function ($event) {
switch ($event.which) {
case 1:
$event.stopImmediatePropagation();
/* console.log(element.offsetParent().prevObject[0].parentNode.parentNode.getBoundingClientRect().bottom);
console.log(element[0].parentNode);
console.log(element[0].parentNode.parentNode);
console.log(element[0].parentNode.parentNode.parentNode);*/
doc.left = element[0].parentNode.parentNode.getBoundingClientRect().left;
doc.top = element[0].parentNode.parentNode.getBoundingClientRect().top;
doc.bottom = element[0].parentNode.parentNode.getBoundingClientRect().bottom;
doc.right = element[0].parentNode.parentNode.getBoundingClientRect().right;
el.width = element[0].getBoundingClientRect().width;
el.height = element[0].getBoundingClientRect().height;
position.x = $event.clientX;
position.y = $event.clientY;
dimension.width = element.prop('offsetWidth');
dimension.height = element.prop('offsetHeight');
btn.style.visibility = 'hidden';
$document.bind('mousemove', mousemove);
$document.bind('mouseup', mouseup);
return false;
break;
}
};
function mousemove($event) {
switch ($event.which) {
case 1:
if ($event.clientX < doc.right) {
var deltaWidth = dimension.width - (position.x - $event.clientX);
if (deltaWidth < 100) {
deltaWidth = 100;
}
}
if ($event.clientY < doc.bottom) {
var deltaHeight = dimension.height - (position.y - $event.clientY);
if (deltaHeight < 100) {
deltaHeight = 100;
}
}
if ($event.clientX > doc.right) {
deltaWidth = element[0].getBoundingClientRect().width;
}
if ($event.clientY > doc.bottom ) {
deltaHeight = element[0].getBoundingClientRect().height;
}
var newDimensions = {};
if (mode == 'horizontal') {
newDimensions = {
width: deltaWidth + 'px'
};
} else if (mode == 'vertical') {
newDimensions = {
height: deltaHeight + 'px'
};
} else {
newDimensions = {
width: deltaWidth + 'px',
height: deltaHeight + 'px'
};
}
element.css(newDimensions);
element[0].children[0].style.setProperty('width', deltaWidth + 'px');
element[0].children[0].style.setProperty('height', deltaHeight + 'px');
//console.log(element[0].children[0]);
return false;
break;
}
}
function mouseup() {
$document.unbind('mousemove', mousemove);
$document.unbind('mouseup', mouseup);
btn.style.visibility = 'hidden';
}
element.append(btn);
//show button on hover
element.bind('mouseover', function () {
/*console.log(element[0].children[1].children[0]);*/
btn.style.top = element[0].getBoundingClientRect().top + element[0].getBoundingClientRect().height - 50 + 'px';
btn.style.left = element[0].getBoundingClientRect().left + element[0].getBoundingClientRect().width - 50 + 'px';
btn.style.visibility = 'visible';
});
element.bind('mouseout', function () {
/* console.log(element);*/
btn.style.visibility = 'hidden';
});
}
};
}])
.directive('draggable', ['$document', function ($document) {
return {
restrict: 'A',
link: function (scope, element) {
var position = {};
var doc = {};
element.bind('mousedown', function ($event) {
switch ($event.which) {
case 1:
element.css({position: 'fixed'});
doc.left = element[0].parentNode.parentNode.getBoundingClientRect().left;
doc.top = element[0].parentNode.parentNode.getBoundingClientRect().top;
doc.bottom = element[0].parentNode.parentNode.getBoundingClientRect().bottom;
doc.right = element[0].parentNode.parentNode.getBoundingClientRect().right;
position.x = element[0].getBoundingClientRect().left;
position.y = element[0].getBoundingClientRect().top;
position.initialMouseX = $event.clientX;
position.initialMouseY = $event.clientY;
$document.bind('mousemove', mousemove);
$document.bind('mouseup', mouseup);
return false;
break;
}
});
function mousemove($event) {
switch ($event.which) {
case 1:
var dx = $event.clientX - position.initialMouseX;
var dy = $event.clientY - position.initialMouseY;
var posdy = position.y + dy;
var posdx = position.x + dx;
if (posdy > doc.top) {
var top = posdy;
}
if (posdx > doc.left){
var left = posdx;
}
if ((posdx + element[0].getBoundingClientRect().width) < doc.right) {
left = posdx;
}
if ((posdy + element[0].getBoundingClientRect().height) < doc.bottom){
top = posdy;
}
if (posdy < doc.top) {
top = doc.top;
}
if (posdx < doc.left) {
left = doc.left;
}
if ((posdx + element[0].getBoundingClientRect().width) > doc.right) {
left = doc.right - element[0].getBoundingClientRect().width;
}
if ((posdy + element[0].getBoundingClientRect().height) > doc.bottom) {
top = doc.bottom - element[0].getBoundingClientRect().height;
}
element.css({
top: top + 'px',
left: left + 'px'
});
return false;
break;
}
}
function mouseup() {
$document.unbind('mousemove', mousemove);
$document.unbind('mouseup', mouseup);
}
}
};
}]);
})();

View File

@@ -0,0 +1,144 @@
/**
* ng-context-menu - v1.1.0 - An AngularJS directive to display a context menu
* when a right-click event is triggered
*
* @author Ian Kennington Walter (http://ianvonwalter.com)
*/
(function(angular) {
'use strict';
angular
.module('ng-context-menu', [])
.factory('ContextMenuService', function() {
return {
element: null,
menuElement: null
};
})
.directive('contextMenu', [
'$document',
'ContextMenuService',
function($document, ContextMenuService) {
return {
restrict: 'A',
scope: {
'callback': '&contextMenu',
'disabled': '&contextMenuDisabled',
'closeCallback': '&contextMenuClose',
'marginBottom': '@contextMenuMarginBottom',
'marginLeft': '@contextMenuMarginLeft'
},
link: function($scope, $element, $attrs) {
var opened = false;
function open(event, menuElement) {
menuElement.addClass('open');
var doc = $document[0].documentElement;
var docLeft = (window.pageXOffset || doc.scrollLeft) -
(doc.clientLeft || 0),
docTop = (window.pageYOffset || doc.scrollTop) -
(doc.clientTop || 0),
elementWidth = menuElement[0].scrollWidth,
elementHeight = menuElement[0].scrollHeight;
var pageX;
var pageY;
// browser compatibility fix for the click location
if (event.pageX || event.pageY) {
// use pageX and pageY when available (modern browsers)
pageX = event.pageX;
pageY = event.pageY;
} else {
// calculate pageX and pageY when they do not exist
// (IE8 and generated events in later versions of IE)
var docBody = $document[0].body;
pageX = event.clientX + docBody.scrollLeft + doc.scrollLeft;
pageY = event.clientY + docBody.scrollTop + doc.scrollTop;
}
var docWidth = doc.clientWidth + docLeft,
docHeight = doc.clientHeight + docTop,
totalWidth = elementWidth + pageX,
totalHeight = elementHeight + pageY,
left = Math.max(pageX - docLeft, 0),
top = Math.max(pageY - docTop, 0);
if (totalWidth > docWidth) {
var marginLeft = $scope.marginLeft || 0;
left = left - (totalWidth - docWidth) - marginLeft;
}
if (totalHeight > docHeight) {
var marginBottom = $scope.marginBottom || 0;
top = top - (totalHeight - docHeight) - marginBottom;
}
menuElement.css('top', top + 'px');
menuElement.css('left', left + 'px');
opened = true;
}
function close(menuElement) {
menuElement.removeClass('open');
if (opened) {
$scope.closeCallback();
}
opened = false;
}
$element.bind('contextmenu', function(event) {
if (!$scope.disabled()) {
if (ContextMenuService.menuElement !== null) {
close(ContextMenuService.menuElement);
}
ContextMenuService.menuElement = angular.element(
document.getElementById($attrs.target)
);
ContextMenuService.element = event.target;
event.preventDefault();
event.stopPropagation();
$scope.$apply(function() {
$scope.callback({ $event: event });
});
$scope.$apply(function() {
open(event, ContextMenuService.menuElement);
});
}
});
function handleKeyUpEvent(event) {
if (opened && event.keyCode === 27) {
$scope.$apply(function() {
close(ContextMenuService.menuElement);
});
}
}
function handleClickEvent(event) {
if (opened &&
(event.button !== 2 ||
event.target !== ContextMenuService.element)) {
$scope.$apply(function() {
close(ContextMenuService.menuElement);
});
}
}
$document.bind('keyup', handleKeyUpEvent);
// Firefox treats a right-click as a click and a contextmenu event
// while other browsers just treat it as a contextmenu event
$document.bind('click', handleClickEvent);
$document.bind('contextmenu', handleClickEvent);
$scope.$on('$destroy', function() {
$document.unbind('keyup', handleKeyUpEvent);
$document.unbind('click', handleClickEvent);
$document.unbind('contextmenu', handleClickEvent);
});
}
};
}
]);
})(angular);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More