Small fix
This commit is contained in:
miroman-afk
2022-12-22 12:52:42 +03:00
parent d24bba305f
commit 723e9a8768
15 changed files with 213 additions and 117 deletions

View File

@@ -38,7 +38,7 @@ class GETClientInfo extends HRCCommand implements HRCCommandInterface
'email' => $email,
'address' => $address,
'order_count' => $orders_count,
'order_sum' => $orders_sum,
'order_sum' => round($orders_sum, 2),
'presale' => $presale,
'bonus' => intval($bonus),
)

View File

@@ -17,29 +17,21 @@ class GETClientOrders extends HRCCommand implements HRCCommandInterface
if (isset($input['id'])) {
$client = Client::where('id', $input['id'])->first();
$client_guid = $client['user_code'];
$exchange_orders = ExchangeOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->orderByDesc('closed')->get();
$online_orders = ShiftOnlineOrders::where('client_code', $client_guid)->where('is_returned', 0)->where('is_deleted', 0)->orderByDesc('closed')->get();
$orders = [];
foreach ($online_orders as $online_order) {
$orders[] = array(
'id' => $online_order['code'],
'opened' => $online_order['opened'],
'closed' => $online_order['closed'],
'sum' => $online_order['order_sum'],
'discount' => $online_order['sale_sum'],
'shift_id' => 0
);
}
foreach ($exchange_orders as $exchange_order) {
$orders[] = array(
'id' => $exchange_order['code'],
'opened' => $exchange_order['opened'],
'closed' => $exchange_order['closed'],
'sum' => $exchange_order['order_sum'],
'discount' => $exchange_order['sale_sum'],
'shift_id' => $exchange_order['shift_id']
);
}
$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,

View File

@@ -5,6 +5,7 @@ namespace App\Commands;
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\ExchangeShifts;
use App\Component\Models\Reasons;
@@ -739,6 +740,36 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
'deleted' => $deleted
];
}
if ($input['type'] == 'abc') {
if (isset($input['start_date']) && isset($input['end_date'])) {
$end_date = date('Y-m-d H:i:s', strtotime($input['end_date']));
$start_date = date('Y-m-d H:i:s', strtotime($input['start_date']));
$orders_shifts = ExchangeOrders::where('opened', '>=', $start_date)
->where('closed', '=<', $end_date)
->where('is_deleted', 0)
->where('is_returned', 0)
->where('is_closed', 1)
->groupBy('shift_id')
->get();
$orders = ExchangeOrders::where('opened', '>=', $start_date)
->where('closed', '=<', $end_date)
->where('is_deleted', 0)
->where('is_returned', 0)
->where('is_closed', 1)
->get();
$revenue = 0;
foreach ($orders_shifts as $orders_shift) {
$shift_revenue = ExchangeShifts::where('shift_id', $orders_shift['shift_id'])
->first();
$revenue += $shift_revenue['revenue'];
}
foreach ($orders as $order) {
$order_items = ExchangeItems::where('order_code', $order['code'])
->where('shift_id', $order['shift_id'])
->get();
}
}
}
} else {
return [
'status' => 'success',

View File

@@ -14,15 +14,16 @@ class POSTBonus extends HRCCommand implements HRCCommandInterface
public function command($input, $output = null)
{
$client_guid = $input['client_id'];
$bonus_amount = $input['amount'];
$bonus_amount = abs($input['amount']);
$staff_id = $input['who'];
$bonus_time = $input['date_transaction'];
ClientsBonus::bonusReg($client_guid, $bonus_amount);
$type = $input['type'];
ClientsBonus::bonusReg($client_guid, $bonus_amount, $type);
ClientsBonus::bonusLog($client_guid, $bonus_amount, $bonus_time, $staff_id);
if ($bonus_amount > 0) {
if ($type == 'in') {
$message = 'Начислено ' . $bonus_amount . ' бонусов';
} else {
$message = 'Списано ' . abs($bonus_amount) . ' бонусов';
} elseif ($type == 'out') {
$message = 'Списано ' . $bonus_amount . ' бонусов';
}
$bonus_result = ClientsBonus::getBonus($client_guid);
return [

View File

@@ -13,15 +13,16 @@ class POSTPresale extends HRCCommand implements HRCCommandInterface
public function command($input, $output = null)
{
$client_guid = $input['client_id'];
$presale_amount = $input['amount'];
$presale_amount = abs($input['amount']);
$staff_id = $input['who'];
$presale_time = $input['date_transaction'];
ClientsPresale::presaleReg($client_guid, $presale_amount);
$type = $input['type'];
ClientsPresale::presaleReg($client_guid, $presale_amount, $type);
ClientsPresale::presaleLog($client_guid, $presale_amount, $presale_time, $staff_id);
if ($presale_amount > 0) {
if ($type == 'in') {
$message = 'Внесен аванс на сумму ' . $presale_amount . ' BYN';
} else {
$message = 'Зачтен аванс на сумму ' . abs($presale_amount) . ' BYN';
} elseif ($type == 'out') {
$message = 'Зачтен аванс на сумму ' . $presale_amount . ' BYN';
}
$presale_result = ClientsPresale::getPresale($client_guid);
return [

View File

@@ -1,6 +1,6 @@
{
"name": "hrc-admin/hello-world",
"version": "2.24",
"version": "2.25",
"require": {
"horeca/admin-php-module-core": "dev-master",
"guzzlehttp/guzzle": "^7.4",

View File

@@ -4,7 +4,7 @@
.provider('adrConfig', function adrConfigProvider() {
//defaults
var defaultConfig = {
iconPosition: [0, 0],
iconPosition: [-1, 10],
mode: 'all',
modes: ['all', 'horizontal', 'vertical']
};
@@ -28,15 +28,18 @@
var doc = {};
var el = {};
//create button for resizing
var btn = document.createElement("span");
btn.style.width = '15px';
btn.style.height = '15px';
btn.innerHTML =
"<i class='fa fa-expand fa-rotate-90'></i>"
;
btn.style.bottom = iconPosition[0] + 6 + 'px';
btn.style.right = iconPosition[1] + 5 + 'px';
btn.style.position = 'absolute';
//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';
@@ -50,22 +53,21 @@
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;
console.log('doc.left: ' + doc.left);
console.log('doc.top: ' + doc.top);
console.log('doc.bottom: ' + doc.bottom);
console.log('doc.right: ' + doc.right);
position.x = $event.clientX;
position.y = $event.clientY;
dimension.width = element.prop('offsetWidth');
dimension.height = element.prop('offsetHeight');
console.log('dimension.width: ' + dimension.width);
console.log('dimension.height: ' + dimension.height);
btn.style.visibility = 'hidden';
$document.bind('mousemove', mousemove);
$document.bind('mouseup', mouseup);
return false;
@@ -77,18 +79,24 @@
switch ($event.which) {
case 1:
if ($event.clientX < doc.right && $event.clientY < doc.bottom) {
if ($event.clientX < doc.right) {
var deltaWidth = dimension.width - (position.x - $event.clientX);
var deltaHeight = dimension.height - (position.y - $event.clientY);
} else {
var deltaWidth = el.width;
var deltaHeight = el.height;
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;
}
/* console.log('deltaWidth: ' + deltaWidth);
console.log('deltaHeight: ' + deltaHeight);
console.log('position.x: ' + position.x);
console.log('position.y: ' + position.y);*/
var newDimensions = {};
if (mode == 'horizontal') {
newDimensions = {
@@ -105,6 +113,9 @@
};
}
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;
}
@@ -113,14 +124,20 @@
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';
});
}
@@ -160,17 +177,34 @@
var posdy = position.y + dy;
var posdx = position.x + dx;
if (posdy > doc.top && posdx > doc.left && (posdx + element[0].getBoundingClientRect().width) < doc.right && (posdy + element[0].getBoundingClientRect().height) < doc.bottom) {
element.css({
top: posdy + 'px',
left: posdx + 'px'
});
} else {
element.css({
top: position.y + 'px',
left: position.x + 'px'
});
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;

View File

@@ -27,15 +27,20 @@ class ClientsBonus extends Model
/**
* Save bonus value.
*/
public static function bonusReg($guid, $value)
public static function bonusReg($guid, $value, $type)
{
$bonus_value = ClientsBonus::where('client_guid', $guid)->first();
$bonus = ClientsBonus::updateOrCreate(
['client_guid' => $guid],
['value' => $bonus_value['value'] + $value]
);
return $bonus['value'];
if ($type == 'in') {
ClientsBonus::updateOrCreate(
['client_guid' => $guid],
['value' => $bonus_value['value'] + $value]
);
} elseif ($type == 'out') {
ClientsBonus::updateOrCreate(
['client_guid' => $guid],
['value' => $bonus_value['value'] - $value]
);
}
}
/**

View File

@@ -27,15 +27,20 @@ class ClientsPresale extends Model
/**
* Save presale value.
*/
public static function presaleReg($guid, $value)
public static function presaleReg($guid, $value, $type)
{
$presale_value = ClientsPresale::where('client_guid', $guid)->first();
$presale = ClientsPresale::updateOrCreate(
['client_guid' => $guid],
['value' => $presale_value['value'] + $value]
);
return $presale['value'];
if ($type == 'in') {
ClientsPresale::updateOrCreate(
['client_guid' => $guid],
['value' => $presale_value['value'] + $value]
);
} elseif ($type == 'out') {
ClientsPresale::updateOrCreate(
['client_guid' => $guid],
['value' => $presale_value['value'] - $value]
);
}
}
/**

View File

@@ -18,7 +18,7 @@ class ExchangeOrders extends Model
$close_time = $order['closed'];
$who_open = Staff::getName($order['who_open']);
$who_close = Staff::getName($order['who_close']);
$items = ExchangeItems::where('order_code', $order_id)->where('shift_id', $shift_id)->get();
$items = ExchangeItems::where('order_code', $order_id)->where('dishes_code', '<>', 0)->where('shift_id', $shift_id)->get();
$order_status = '';
if ($order['is_deleted'] > 0) {
$order_status = 'Удален';
@@ -47,7 +47,7 @@ class ExchangeOrders extends Model
}
$order_info[] = array(
'id' => $key + 1,
'name' => Dishes::getName($item['dish_code']),
'name' => Dishes::getName($item['menu_code']),
'count' => $item['count'],
'price' => $item['real_price'],
'sale_price' => $item['sale_price'],

View File

@@ -17,8 +17,13 @@ class ShiftOnlineOrders extends Model
$open_time = $order['opened'];
$close_time = $order['closed'];
$who_open = Staff::getName($order['who_open']);
$who_close = Staff::getName($order['who_close']);
$items = ShiftOnlineItems::where('order_code', $order_id)->get();
if ($order['who_close'] == 0) {
$who_close = '';
} else {
$who_close = Staff::getName($order['who_close']);
}
$items = ShiftOnlineItems::where('order_code', $order_id)->where('modificator_code', 0)->get();
$order_status = '';
if ($order['is_deleted'] > 0) {
$order_status = 'Удален';
@@ -54,7 +59,7 @@ class ShiftOnlineOrders extends Model
'cof' => $item['cof'],
'unit' => Units::getName($item['units_id']),
'amount' => round($item['sale_price'] * $item['count'], 2),
'discount' => round($discount, 2)
'discount' => round($discount, 0)
);
$amount += round($item['sale_price'] * $item['count'], 2);
$full_price += round($realPrice,2);

View File

@@ -1,5 +1,5 @@
[info]
name=V1
version=2.24
version=2.25
[build]
version=2.24
version=2.25

View File

@@ -123,7 +123,7 @@
<div class="p-y text-center text-sm-center col-sm-12">
<a href="" class="inline p-x text-center">
<span class="h5 block m-0">{{currentClient.info.order_sum}} BYN</span>
<span class="h5 block m-0">{{currentClient.info.order_sum | curr}} BYN</span>
<small class="text-xs text-muted">Сумма заказов</small>
</a>
<a href="" class="inline p-x b-l text-center">
@@ -132,7 +132,7 @@
</a>
<a href="" class="inline p-x b-l b-r text-center"
ng-if="currentClient.info.presale > 0">
<span class="h5 block m-0">{{currentClient.info.presale}} BYN</span>
<span class="h5 block m-0">{{currentClient.info.presale | curr}} BYN</span>
<small class="text-xs text-muted">Аванс</small>
</a>
<a href="" class="inline p-x text-center" ng-if="currentClient.info.bonus > 0">
@@ -201,14 +201,14 @@
<div class="row align-items-center" style="margin-right: 0px;">
<div class="sl-content">
<div class="col-lg-12 col-sm-6">
<a ng-click="getItems(order.id, order.opened, order.closed)">
<a ng-click="getItems(order.code, order.opened, order.closed)">
<div class="sl-date text-muted">Заказ открыт:
{{order.opened}}
</div>
<div class="sl-date text-muted">Заказ закрыт:
<div class="sl-date text-muted" ng-if="order.closed > '0000-00-00 00:00:00'">Заказ закрыт:
{{order.closed}}
</div>
<p>Сумма заказа: {{order.sum | curr}} BYN <span ng-if="order.discount > 0">(Скидка: {{order.discount | curr}} BYN)</span></p>
<p>Сумма заказа: {{order.order_sum | curr}} BYN <span ng-if="order.discount > 0">(Скидка: {{order.sale_sum | curr}} BYN)</span></p>
</a>
</div>

View File

@@ -402,7 +402,7 @@
</div>
<div class="row">
<div class="col-md-12 col-xl-8">
<div class="col-md-12 col-xl-8" style="max-height: 620px; overflow-y: hidden;">
<div class="box">
<div class="box-header">
<h3>Топ продаваемых товаров</h3>
@@ -470,7 +470,7 @@
<div class="box-body">
<p class="text-muted text-center" ng-if="tables.length == 0">Занятых столов нет</p>
<div class="table-responsive" ng-if="tables.length > 0">
<div class="table-responsive" ng-if="tables.length > 0" style="max-height: 510px;">
<table class="table table-striped table-hover">
<thead>
<tr>

View File

@@ -1,11 +1,21 @@
<div id="container-places" style="bottom: 20px; right: 20px; position: fixed;">
<div class="m-b">
<div class="btn-group">
<button id="create_place" type="button" class="btn info btn-outline b-info" ng-click="createPlace()">Добавить зал</button>
<button id="back" type="button" class="btn info p-x-md pull-left" data-toggle="modal" data-target="#back_places">Назад</button>
<button id="create_table" type="button" class="btn info btn-outline b-info" ng-click="createTable(place_id)">Добавить стол</button>
<button id="save_tables" type="button" class="btn info btn-outline b-info" ng-click="saveTables(place_id, tables)">Сохранить</button>
<button id="save_places" type="button" class="btn info btn-outline b-info" ng-click="savePlaces(roommap)">Сохранить</button>
<button id="create_place" type="button" class="btn info btn-outline b-info" ng-click="createPlace()">
Добавить зал
</button>
<button id="back" type="button" class="btn info p-x-md pull-left" data-toggle="modal"
data-target="#back_places">Назад
</button>
<button id="create_table" type="button" class="btn info btn-outline b-info"
ng-click="createTable(place_id)">Добавить стол
</button>
<button id="save_tables" type="button" class="btn info btn-outline b-info"
ng-click="saveTables(place_id, tables)">Сохранить
</button>
<button id="save_places" type="button" class="btn info btn-outline b-info" ng-click="savePlaces(roommap)">
Сохранить
</button>
</div>
</div>
@@ -19,7 +29,9 @@
<div class="confirm-box-footer">
<button type="button" class="btn dark-white p-x-md" data-dismiss="modal" ng-click="back()">Нет</button>
<button type="button" class="btn danger p-x-md" ng-model="tables" data-dismiss="modal" ng-click="saveTables(place_id, tables)">Да</button>
<button type="button" class="btn danger p-x-md" ng-model="tables" data-dismiss="modal"
ng-click="saveTables(place_id, tables)">Да
</button>
</div>
</div>
</div>
@@ -68,9 +80,10 @@
</div>
<div class="padding" id="background_1" ng-style="{'max-width':(maxWidth) + 'px', 'width':(screenWidth) + 'vw'}">
<div class="box">
<div class="padding" id="background" >
<div class="padding" id="background">
<!--<div id="tables" class="box" ng-style="{'height':(windowHeight) + 'px'}">-->
<div id="tables" class="box" ng-style="{'height':(windowHeight) + 'px'}" data-target="tables_editor" context-menu>
<div id="tables" class="box" ng-style="{'height':(windowHeight) + 'px'}" data-target="tables_editor"
context-menu>
<div class="dropdown" id="tables_editor" style="position: fixed; z-index: 2;">
<ul class="dropdown-menu" role="menu">
<li>
@@ -83,28 +96,38 @@
</div>
<div ng-repeat="table in tables" ng-model="tables" context-menu>
<div ng-if="table.type == 0" id="{{ 'table_' + $index }}" class="demo-div" draggable resize context-menu
<div ng-if="table.type == 0" id="{{ 'table_' + $index }}" class="demo-div" draggable resize
context-menu
data-target="table-{{ $index }}"
ng-mouseup="getCoords($event, $index, table.table_id, table.place_id)"
ng-style="{'width':'' + table.width * percentWidth + 'px', 'height':'' + table.height * percentHeight + 'px', 'top':'calc(' + top + 'px + ' + table.x * percentHeight + 'px)', 'left': 'calc(' + left + 'px + ' + table.y * percentWidth + 'px)'}"
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #183147; z-index: 1; border-radius: 5%">
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #2196f3; z-index: 1; border-radius: 5%">
<div class="box-header">
<small>{{table.name}}</small>
<small>{{table.table_id}}</small>
</div>
</div>
<div ng-if="table.type == 1" id="{{ 'table_' + $index }}" class="demo-div" draggable resize context-menu
<div ng-if="table.type == 1" id="{{ 'table_' + $index }}" class="demo-div" draggable resize
context-menu
data-target="table-{{ $index }}"
ng-mouseup="getCoords($event, $index, table.table_id, table.place_id)"
ng-style="{'width':'' + table.width * percentWidth + 'px', 'height':'' + table.height * percentHeight + 'px', 'top':'calc(' + top + 'px + ' + table.x * percentHeight + 'px)', 'left': 'calc(' + left + 'px + ' + table.y * percentWidth + 'px)'}"
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #183147; z-index: 1; border-radius: 50%">
<div class="box-header">
<small>{{table.name}}</small>
<small>{{table.table_id}}</small>
style="position: fixed;cursor: default;font-family: sans-serif;text-align: center;background-color: #FFFFFF;border: 2px solid #2196f3; z-index: 1; border-radius: 50%">
<div class="box"
ng-style="{'width':'' + table.width * percentWidth + 'px', 'height':'' + table.height * percentHeight + 'px'}"
style="background: transparent; box-shadow: 0 0px 0px transparent;">
<div class="box-header">
<small>{{table.name}}</small>
<small>{{table.table_id}}</small>
</div>
<div class="box-footer"></div>
</div>
</div>
<div class="dropdown" id="table-{{ $index }}" style="position: fixed; z-index: 2;">
<ul class="dropdown-menu" role="menu">
<li>
@@ -131,7 +154,6 @@
</div>
<div class="modal fade" id="table-edit" data-backdrop="true">
<div ui-include="'../views/roommap/items/edit-table.html'"></div>
</div>