v.2.25
Small fix
This commit is contained in:
@@ -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]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user