v.2.28
This commit is contained in:
@@ -1368,8 +1368,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
$average_sum_one_guest = round($clients_sum / $one_client_count, 2);
|
||||
//Pay methods
|
||||
$pay_cash_sum = ExchangeOrders::where('who_open', '>', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->where('cash', '>', 0)
|
||||
//->where('order_sum', '>', 0)
|
||||
//->where('cash', '>', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('shift_id', $shift_id)
|
||||
->sum('cash');
|
||||
@@ -1455,42 +1455,42 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
->count();
|
||||
|
||||
if ($settings > 0) {
|
||||
$pay_echeck_orders = ExchangeOrders::where('who_open', '>', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('check_number', 0)
|
||||
->where('cash', 0)
|
||||
->where('credit', 0)
|
||||
->where('clearing', 0)
|
||||
->where('presale', 0)
|
||||
->where('self', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('table_name', '<>', '0')
|
||||
->where('shift_id', $shift_id)
|
||||
->get();
|
||||
foreach ($pay_echeck_orders as $pay_echeck_order) {
|
||||
$count_echeck_open = ExchangeActions::where('shift_id', $shift_id)
|
||||
->where('order_code', $pay_echeck_order['code'])
|
||||
->where('action_type', 6)
|
||||
->count();
|
||||
if ($count_echeck_open == 0 && $pay_echeck_order['is_closed'] == 1) {
|
||||
$pay_echeck_sum += $pay_echeck_order['order_sum'];
|
||||
$pay_echeck_orders = ExchangeOrders::where('who_open', '>', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('check_number', 0)
|
||||
->where('cash', 0)
|
||||
->where('credit', 0)
|
||||
->where('clearing', 0)
|
||||
->where('presale', 0)
|
||||
->where('self', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('table_name', '<>', '0')
|
||||
->where('shift_id', $shift_id)
|
||||
->get();
|
||||
foreach ($pay_echeck_orders as $pay_echeck_order) {
|
||||
$count_echeck_open = ExchangeActions::where('shift_id', $shift_id)
|
||||
->where('order_code', $pay_echeck_order['code'])
|
||||
->where('action_type', 6)
|
||||
->count();
|
||||
if ($count_echeck_open == 0 && $pay_echeck_order['is_closed'] == 1) {
|
||||
$pay_echeck_sum += $pay_echeck_order['order_sum'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pay_delivery_sum = ExchangeOrders::where('who_open', '>', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('check_number', 0)
|
||||
->where('cash', 0)
|
||||
->where('credit', 0)
|
||||
->where('clearing', 0)
|
||||
->where('presale', 0)
|
||||
->where('self', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('table_name', '0')
|
||||
->where('shift_id', $shift_id)
|
||||
->sum('order_sum');
|
||||
$pay_delivery_sum = ExchangeOrders::where('who_open', '>', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('check_number', 0)
|
||||
->where('cash', 0)
|
||||
->where('credit', 0)
|
||||
->where('clearing', 0)
|
||||
->where('presale', 0)
|
||||
->where('self', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_returned', 0)
|
||||
->where('table_name', '0')
|
||||
->where('shift_id', $shift_id)
|
||||
->sum('order_sum');
|
||||
}
|
||||
return [
|
||||
'status' => 'success',
|
||||
@@ -1545,6 +1545,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($input['start_date']) && isset($input['end_date'])) {
|
||||
$end_date = date('Y-m-d H:i:s', strtotime($input['end_date'] . ' 23:59:59'));
|
||||
$start_date = date('Y-m-d H:i:s', strtotime($input['start_date'] . ' 00:00:01'));
|
||||
@@ -1702,8 +1703,8 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
$average_sum_one_guest = round($clients_sum / $one_client_count, 2);
|
||||
//Pay methods
|
||||
$pay_cash_sum += ExchangeOrders::where('who_open', '>', 0)
|
||||
->where('order_sum', '>', 0)
|
||||
->where('cash', '>', 0)
|
||||
//->where('order_sum', '>', 0)
|
||||
//->where('cash', '>', 0)
|
||||
->where('is_deleted', 0)
|
||||
->where('shift_id', $shift_id)
|
||||
->sum('cash');
|
||||
@@ -1827,6 +1828,17 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
->sum('order_sum');
|
||||
}
|
||||
}
|
||||
if (Report::where('start_date', $start_date)->where('end_date', $end_date)->where('report_type', 'statistics')->count() < 1) {
|
||||
$report = new Report;
|
||||
$report->user_id = intval($input['admin_user_id']);
|
||||
$report->name = 'Отчет по статистике';
|
||||
$report->shift_id = 0;
|
||||
$report->start_date = $start_date;
|
||||
$report->end_date = $end_date;
|
||||
$report->report_type = 'statistics';
|
||||
$report->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'fiscal' => [
|
||||
@@ -1882,6 +1894,200 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($reportType == 'payment') {
|
||||
if (isset($input['shift_id'])) {
|
||||
$shift_id = $input['shift_id'];
|
||||
$shift_time = ExchangeShifts::where('id', $shift_id)->first();
|
||||
$shift_start_time = $shift_time['opened'];
|
||||
$shift_end_time = $shift_time['closed'];
|
||||
$printers = Printer::get();
|
||||
foreach ($printers as $printer) {
|
||||
$report[$printer['code']]['cash'] = $report[$printer['code']]['credit'] = 0;
|
||||
$report[$printer['code']]['presale'] = $report[$printer['code']]['self'] = 0;
|
||||
$report[$printer['code']]['clearing'] = $report[$printer['code']]['emoney'] = 0;
|
||||
$report[$printer['code']]['online'] = 0;
|
||||
}
|
||||
$report[0]['cash'] = $report[0]['credit'] = 0;
|
||||
$report[0]['presale'] = $report[0]['self'] = 0;
|
||||
$report[0]['clearing'] = $report[0]['emoney'] = 0;
|
||||
$report[0]['online'] = 0;
|
||||
$orders = ExchangeOrders::where('shift_id', $shift_id)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('order_sum', '>=', 0)
|
||||
->get();
|
||||
foreach ($orders as $order) {
|
||||
$order_emoney = 0;
|
||||
$order_online = 0;
|
||||
$sum_payments = $order['cash'] + $order['credit'] + $order['presale'] + $order['self'] + $order['clearing'] + $order_emoney + $order_online;
|
||||
if ($sum_payments == 0) {
|
||||
$count_online_open = ExchangeActions::where('shift_id', $shift_id)
|
||||
->where('order_code', $order['code'])
|
||||
->where('action_type', 45)
|
||||
->where('more', '<>', '0')
|
||||
->count();
|
||||
$count_online_close = ExchangeActions::where('shift_id', $shift_id)
|
||||
->where('order_code', $order['code'])
|
||||
->where('action_type', 6)
|
||||
->count();
|
||||
if ($count_online_open > 0 && $count_online_close > 0) {
|
||||
$order_online = $order['order_sum'];
|
||||
}
|
||||
$count_another = ExchangeActions::where('order_code', $order['code'])
|
||||
->where('action_type', 51)
|
||||
->where('shift_id', $shift_id)
|
||||
->count();
|
||||
if ($count_another > 0) {
|
||||
$order_emoney = $order['order_sum'];
|
||||
}
|
||||
}
|
||||
$sum_payments = $order['cash'] + $order['credit'] + $order['presale'] + $order['self'] + $order['clearing'] + $order_emoney + $order_online;
|
||||
if ($sum_payments == 0) {
|
||||
continue;
|
||||
}
|
||||
$cash_cof = round($order['cash'] / $sum_payments, 2);
|
||||
$credit_cof = round($order['credit'] / $sum_payments, 2);
|
||||
$presale_cof = round($order['presale'] / $sum_payments, 2);
|
||||
$self_cof = round($order['self'] / $sum_payments, 2);
|
||||
$clearing_cof = round($order['clearing'] / $sum_payments, 2);
|
||||
$online_cof = round($order_online / $sum_payments, 2);
|
||||
$emoney_cof = round($order_emoney / $sum_payments, 2);
|
||||
$items = ExchangeItems::where('shift_id', $shift_id)
|
||||
->where('order_code', $order['code'])
|
||||
->get();
|
||||
foreach ($items as $item) {
|
||||
$sum = round(($item['count'] - $item['count_return']) * $item['sale_price'], 2);
|
||||
$printer_code = Dishes::GetPrinterCode($item['dishes_code']);
|
||||
$report[$printer_code]['cash'] += round($sum * $cash_cof, 2);
|
||||
$report[$printer_code]['credit'] += round($sum * $credit_cof, 2);
|
||||
$report[$printer_code]['presale'] += round($sum * $presale_cof, 2);
|
||||
$report[$printer_code]['self'] += round($sum * $self_cof, 2);
|
||||
$report[$printer_code]['clearing'] += round($sum * $clearing_cof, 2);
|
||||
$report[$printer_code]['emoney'] += round($sum * $emoney_cof, 2);
|
||||
$report[$printer_code]['online'] += round($sum * $online_cof, 2);
|
||||
}
|
||||
}
|
||||
foreach ($report as $key => $item) {
|
||||
$item['cash'] = round($item['cash'], 2);
|
||||
$item['credit'] = round($item['credit'], 2);
|
||||
$item['presale'] = round($item['presale'], 2);
|
||||
$item['self'] = round($item['self'], 2);
|
||||
$item['clearing'] = round($item['clearing'], 2);
|
||||
$item['emoney'] = round($item['emoney'], 2);
|
||||
$item['online'] = round($item['online'], 2);
|
||||
$out[] = array(
|
||||
'printer_name' => Printer::getName($key),
|
||||
'full_sum' => round($item['cash'] + $item['credit'] + $item['presale'] + $item['self'] + $item['clearing'] + $item['emoney'] + $item['online'], 2),
|
||||
'payments' => $item
|
||||
);
|
||||
}
|
||||
$return = [
|
||||
'status' => 'success',
|
||||
'items' => $out
|
||||
];
|
||||
return $return;
|
||||
|
||||
}
|
||||
if (isset($input['start_date']) && isset($input['end_date'])) {
|
||||
$end_date = date('Y-m-d H:i:s', strtotime($input['end_date'] . ' 23:59:59'));
|
||||
$start_date = date('Y-m-d H:i:s', strtotime($input['start_date'] . ' 00:00:01'));
|
||||
$printers = Printer::get();
|
||||
foreach ($printers as $printer) {
|
||||
$report[$printer['code']]['cash'] = $report[$printer['code']]['credit'] = 0;
|
||||
$report[$printer['code']]['presale'] = $report[$printer['code']]['self'] = 0;
|
||||
$report[$printer['code']]['clearing'] = $report[$printer['code']]['emoney'] = 0;
|
||||
$report[$printer['code']]['online'] = 0;
|
||||
}
|
||||
$report[0]['cash'] = $report[0]['credit'] = 0;
|
||||
$report[0]['presale'] = $report[0]['self'] = 0;
|
||||
$report[0]['clearing'] = $report[0]['emoney'] = 0;
|
||||
$report[0]['online'] = 0;
|
||||
$shifts = ExchangeShifts::select('id')
|
||||
->where('opened', '>', $start_date)
|
||||
->where('closed', '<', $end_date)
|
||||
->get();
|
||||
foreach ($shifts as $shift) {
|
||||
$shift_id = $shift['id'];
|
||||
$orders = ExchangeOrders::where('shift_id', $shift_id)
|
||||
->where('is_deleted', 0)
|
||||
->where('is_closed', 1)
|
||||
->where('order_sum', '>=', 0)
|
||||
->get();
|
||||
foreach ($orders as $order) {
|
||||
$order_emoney = 0;
|
||||
$order_online = 0;
|
||||
$sum_payments = $order['cash'] + $order['credit'] + $order['presale'] + $order['self'] + $order['clearing'] + $order_emoney + $order_online;
|
||||
if ($sum_payments == 0) {
|
||||
$count_online_open = ExchangeActions::where('shift_id', $shift_id)
|
||||
->where('order_code', $order['code'])
|
||||
->where('action_type', 45)
|
||||
->where('more', '<>', '0')
|
||||
->count();
|
||||
$count_online_close = ExchangeActions::where('shift_id', $shift_id)
|
||||
->where('order_code', $order['code'])
|
||||
->where('action_type', 6)
|
||||
->count();
|
||||
if ($count_online_open > 0 && $count_online_close > 0) {
|
||||
$order_online = $order['order_sum'];
|
||||
}
|
||||
$count_another = ExchangeActions::where('order_code', $order['code'])
|
||||
->where('action_type', 51)
|
||||
->where('shift_id', $shift_id)
|
||||
->count();
|
||||
if ($count_another > 0) {
|
||||
$order_emoney = $order['order_sum'];
|
||||
}
|
||||
}
|
||||
$sum_payments = $order['cash'] + $order['credit'] + $order['presale'] + $order['self'] + $order['clearing'] + $order_emoney + $order_online;
|
||||
if ($sum_payments == 0) {
|
||||
continue;
|
||||
}
|
||||
$cash_cof = round($order['cash'] / $sum_payments, 2);
|
||||
$credit_cof = round($order['credit'] / $sum_payments, 2);
|
||||
$presale_cof = round($order['presale'] / $sum_payments, 2);
|
||||
$self_cof = round($order['self'] / $sum_payments, 2);
|
||||
$clearing_cof = round($order['clearing'] / $sum_payments, 2);
|
||||
$online_cof = round($order_online / $sum_payments, 2);
|
||||
$emoney_cof = round($order_emoney / $sum_payments, 2);
|
||||
$items = ExchangeItems::where('shift_id', $shift_id)
|
||||
->where('order_code', $order['code'])
|
||||
->get();
|
||||
foreach ($items as $item) {
|
||||
$sum = round(($item['count'] - $item['count_return']) * $item['sale_price'], 2);
|
||||
$printer_code = Dishes::GetPrinterCode($item['dishes_code']);
|
||||
Log::debug($printer_code);
|
||||
$report[$printer_code]['cash'] += round($sum * $cash_cof, 2);
|
||||
$report[$printer_code]['credit'] += round($sum * $credit_cof, 2);
|
||||
$report[$printer_code]['presale'] += round($sum * $presale_cof, 2);
|
||||
$report[$printer_code]['self'] += round($sum * $self_cof, 2);
|
||||
$report[$printer_code]['clearing'] += round($sum * $clearing_cof, 2);
|
||||
$report[$printer_code]['emoney'] += round($sum * $emoney_cof, 2);
|
||||
$report[$printer_code]['online'] += round($sum * $online_cof, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($report as $key => $item) {
|
||||
$item['cash'] = round($item['cash'], 2);
|
||||
$item['credit'] = round($item['credit'], 2);
|
||||
$item['presale'] = round($item['presale'], 2);
|
||||
$item['self'] = round($item['self'], 2);
|
||||
$item['clearing'] = round($item['clearing'], 2);
|
||||
$item['emoney'] = round($item['emoney'], 2);
|
||||
$item['online'] = round($item['online'], 2);
|
||||
$out[] = array(
|
||||
'printer_name' => Printer::getName($key),
|
||||
'full_sum' => round($item['cash'] + $item['credit'] + $item['presale'] + $item['self'] + $item['clearing'] + $item['emoney'] + $item['online'], 2),
|
||||
'payments' => $item
|
||||
);
|
||||
}
|
||||
$return = [
|
||||
'status' => 'success',
|
||||
'items' => $out
|
||||
];
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
'status' => 'success',
|
||||
|
||||
@@ -39,23 +39,11 @@ class GETTopDishes extends HRCCommand implements HRCCommandInterface {
|
||||
$out[] = $value;
|
||||
}
|
||||
foreach ($out as $key => $item) {
|
||||
$dishInfo = Dishes::where('code', '=', $item['menu_code'])
|
||||
->where('legacy_code', '=', $item['dish_code'])
|
||||
->where('is_history', '=', 0)
|
||||
->first();
|
||||
$onlineDishInfo = ShiftOnlineItems::where('menu_code', '=', $item['menu_code'])
|
||||
->where('dish_code', '=', $item['dish_code'])
|
||||
->whereIn('order_code', $orders)
|
||||
->first();
|
||||
if ($dishInfo['name'] == '') {
|
||||
$dishHistInfo = Dishes::where('code', '=', $item['menu_code'])
|
||||
->where('legacy_code', '=', $item['dish_code'])
|
||||
->whereIn('order_code', $orders)
|
||||
->first();
|
||||
$dishName = $dishHistInfo['name'];
|
||||
} else {
|
||||
$dishName = $dishInfo['name'];
|
||||
}
|
||||
$dishName = Dishes::getName($item['dish_code']);
|
||||
$dishCount = ShiftOnlineItems::where('menu_code', '=', $item['menu_code'])
|
||||
->whereIn('order_code', $orders)
|
||||
->sum('count');
|
||||
|
||||
@@ -12,38 +12,44 @@ 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';
|
||||
class POSTRestoreShift extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postrestoreshift';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
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\\";
|
||||
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;
|
||||
$nowTime = time();
|
||||
$update = true;
|
||||
|
||||
function decode_text($data) {
|
||||
function decode_text($data)
|
||||
{
|
||||
$alph = [
|
||||
"А", "Б", "В", "Г", "Д",
|
||||
"Е", "Ё", "Ж", "З", "И",
|
||||
@@ -97,168 +103,173 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface {
|
||||
return $retval;
|
||||
}
|
||||
|
||||
$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', $exchange_shifts['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();
|
||||
}
|
||||
$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();
|
||||
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();
|
||||
Log::debug('ShiftOnlineOrders cleaned');
|
||||
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');
|
||||
log::debug(decode_text($exchange_order["place_name"]));
|
||||
$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();
|
||||
}
|
||||
//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();
|
||||
Log::debug('ShiftOnlineItems cleaned');
|
||||
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();
|
||||
}
|
||||
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();
|
||||
Log::debug('ShiftOnlineActions cleaned');
|
||||
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();
|
||||
}
|
||||
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();
|
||||
Log::debug('ShiftOnlineDeleted cleaned');
|
||||
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();
|
||||
}
|
||||
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();
|
||||
$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',
|
||||
];
|
||||
}
|
||||
}
|
||||
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',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hrc-admin/hello-world",
|
||||
"version": "2.27",
|
||||
"version": "2.28",
|
||||
"require": {
|
||||
"horeca/admin-php-module-core": "dev-master",
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use App\Component\Models\Filesystem;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIndexesForTables extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('exchange_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_actions');
|
||||
|
||||
if (! array_key_exists('action_type_index', $indexesFound)) {
|
||||
$table->index('action_type', 'action_type_index');
|
||||
}
|
||||
});
|
||||
Schema::table('exchange_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_actions');
|
||||
|
||||
if (! array_key_exists('order_code_index', $indexesFound)) {
|
||||
$table->index('order_code', 'order_code_index');
|
||||
}
|
||||
});
|
||||
Schema::table('exchange_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_actions');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
use App\Component\Models\Filesystem;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIndexesForTablesV2 extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up() {
|
||||
Schema::table('dishes', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('dishes');
|
||||
|
||||
if (! array_key_exists('code_index', $indexesFound)) {
|
||||
$table->index('code', 'code_index');
|
||||
}
|
||||
if (! array_key_exists('legacy_code_index', $indexesFound)) {
|
||||
$table->index('legacy_code', 'legacy_code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('exchange_deleted', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_deleted');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
if (! array_key_exists('menu_code_index', $indexesFound)) {
|
||||
$table->index('menu_code', 'menu_code_index');
|
||||
}
|
||||
if (! array_key_exists('dishes_code_index', $indexesFound)) {
|
||||
$table->index('dishes_code', 'dishes_code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('exchange_items', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_items');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
if (! array_key_exists('menu_code_index', $indexesFound)) {
|
||||
$table->index('menu_code', 'menu_code_index');
|
||||
}
|
||||
if (! array_key_exists('dishes_code_index', $indexesFound)) {
|
||||
$table->index('dishes_code', 'dishes_code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('exchange_orders', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('exchange_orders');
|
||||
|
||||
if (! array_key_exists('shift_id_index', $indexesFound)) {
|
||||
$table->index('shift_id', 'shift_id_index');
|
||||
}
|
||||
if (! array_key_exists('code_index', $indexesFound)) {
|
||||
$table->index('code', 'code_index');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('shift_online_actions', static function (Blueprint $table) {
|
||||
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $schemaManager->listTableIndexes('shift_online_actions');
|
||||
|
||||
if (! array_key_exists('order_code_index', $indexesFound)) {
|
||||
$table->index('order_code', 'order_code_index');
|
||||
}
|
||||
if (! array_key_exists('type_action_index', $indexesFound)) {
|
||||
$table->index('type_action', 'type_action_index');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down() {
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class Client extends Model
|
||||
if (isset($client_name)) {
|
||||
$client_name = $client_name['name'];
|
||||
} else {
|
||||
$client_name = 'Связанный персонал не найден';
|
||||
$client_name = 'Связанный гость не найден';
|
||||
}
|
||||
return $client_name;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,19 @@ class Dishes extends Model {
|
||||
$printer_code = 0;
|
||||
}
|
||||
}
|
||||
if ($printer_code == 0) {
|
||||
$dish = Dishes::where('code', $data)->where('is_history', 0)->first();
|
||||
if ($dish) {
|
||||
$printer_code = $dish['printer_code'];
|
||||
} else {
|
||||
$dish = Dishes::where('code', $data)->where('is_history', 1)->first();
|
||||
if ($dish) {
|
||||
$printer_code = $dish['printer_code'];
|
||||
} else {
|
||||
$printer_code = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $printer_code;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
[info]
|
||||
name=V1
|
||||
version=2.27
|
||||
version=2.28
|
||||
[build]
|
||||
version=2.27
|
||||
version=2.28
|
||||
|
||||
@@ -182,8 +182,8 @@
|
||||
};
|
||||
|
||||
$scope.reportPay = function () {
|
||||
smartRequest.get('report/payment?start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
|
||||
$scope.printers = data.printers;
|
||||
smartRequest.get('v1/datareport?type=payment&start_date=' + encodeURIComponent($scope.start_date) + '&end_date=' + encodeURIComponent($scope.end_date), function (data) {
|
||||
$scope.printers = data.items;
|
||||
$('#report-payment').modal();
|
||||
$scope.update();
|
||||
});
|
||||
|
||||
@@ -263,8 +263,8 @@
|
||||
};
|
||||
|
||||
$scope.reportPay = function (shift) {
|
||||
smartRequest.get('report/payment?shift_id=' + shift.id, function (data) {
|
||||
$scope.printers = data.printers;
|
||||
smartRequest.get('v1/datareport?type=payment&shift_id=' + shift.id, function (data) {
|
||||
$scope.printers = data.items;
|
||||
$scope.start_date = shift.opened;
|
||||
$scope.end_date = shift.closed;
|
||||
|
||||
|
||||
@@ -11,32 +11,45 @@
|
||||
</div>
|
||||
<div class="modal-body p-lg">
|
||||
<div class="col-md-6" ng-repeat="printer in printers">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive" ng-if="printer.full_sum > 0">
|
||||
<table class="table table-border">
|
||||
<thead>
|
||||
<th colspan="2">{{printer.name}}</th>
|
||||
<th colspan="2">{{printer.printer_name}}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-if="printer.cash > 0">
|
||||
<tr ng-if="printer.payments.cash > 0">
|
||||
<td>Наличный расчет:</td>
|
||||
<td class="text-right">{{printer.cash | curr}}</td>
|
||||
<td class="text-right">{{printer.payments.cash | curr}}</td>
|
||||
</tr>
|
||||
<tr ng-if="printer.credit > 0">
|
||||
<tr ng-if="printer.payments.credit > 0">
|
||||
<td>Кредитными картами:</td>
|
||||
<td class="text-right">{{printer.credit | curr}}</td>
|
||||
<td class="text-right">{{printer.payments.credit | curr}}</td>
|
||||
</tr>
|
||||
<tr ng-if="printer.clearing > 0">
|
||||
<tr ng-if="printer.payments.clearing > 0">
|
||||
<td>Безналичный расчет: </td>
|
||||
<td class="text-right">{{printer.clearing | curr}}</td>
|
||||
<td class="text-right">{{printer.payments.clearing | curr}}</td>
|
||||
</tr>
|
||||
<tr ng-if="printer.self_pay > 0">
|
||||
<tr ng-if="printer.payments.self > 0">
|
||||
<td>Питание штата: </td>
|
||||
<td class="text-right"> {{printer.payments.self | curr}}</td>
|
||||
</tr>
|
||||
<tr ng-if="printer.payments.emoney > 0">
|
||||
<td>Иными способами оплаты: </td>
|
||||
<td class="text-right"> {{printer.payments.emoney | curr}}</td>
|
||||
</tr>
|
||||
<tr ng-if="printer.payments.online > 0">
|
||||
<td>Онлайн: </td>
|
||||
<td class="text-right"> {{printer.payments.online | curr}}</td>
|
||||
</tr>
|
||||
<tr ng-if="printer.payments.presale > 0">
|
||||
<td>По ранее полученному авансу: </td>
|
||||
<td class="text-right"> {{printer.self_pay | curr}}</td>
|
||||
<td class="text-right"> {{printer.payments.presale | curr}}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
<thead>
|
||||
<th colspan="2">Итого: {{printer.total | curr}} BYN</th>
|
||||
<th colspan="2">Итого: {{printer.payments.cash + printer.payments.credit + printer.payments.clearing + printer.payments.self + printer.payments.emoney + printer.payments.online + printer.payments.presale | curr}} BYN</th>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -170,11 +170,11 @@
|
||||
<td>Иные способы оплаты</td>
|
||||
<td style="text-align: right">{{ payments.pay_another | curr}} BYN</td>
|
||||
</tr>
|
||||
<tr ng-if="pay_delivery > 0">
|
||||
<tr ng-if="payments.pay_delivery > 0">
|
||||
<td>Доставка</td>
|
||||
<td style="text-align: right">{{ payments.pay_delivery | curr}} BYN</td>
|
||||
</tr>
|
||||
<tr ng-if="pay_echeck > 0">
|
||||
<tr ng-if="payments.pay_echeck > 0">
|
||||
<td>Электронный чек</td>
|
||||
<td style="text-align: right">{{ payments.pay_echeck | curr}} BYN</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user