/** * Marks a table as paid * * @param integer $paid The value to be set to the paid field in sources table * @return integer error code */ function table_pay($paid) { $sourceid = $_SESSION['sourceid']; if (order_found_generic_not_priced($sourceid)) { return ERR_GENERIC_ORDER_NOT_PRICED_FOUND; } $total = table_total($_SESSION['sourceid']); if (!access_allowed(USER_BIT_MONEY) && $total != 0) { access_denied_waiter(); return ERR_ACCESS_DENIED; } $query = "UPDATE `sources` SET `paid` = '{$paid}' WHERE `id` = '{$sourceid}'"; $res = common_query($query, __FILE__, __LINE__); if (!$res) { return ERR_MYSQL; } return 0; }
$dont_redirect_to_menu = true; require_once ROOTDIR . "/includes.php"; require_once ROOTDIR . "/pos/waiter_start.php"; $GLOBALS['end_require_time'] = microtime(); unset_source_vars(); $time_refresh = 1000 * get_conf(__FILE__, __LINE__, 'refresh_automatic_on_menu'); $target = 'tables.php?rndm=' . rand(0, 100000); if ($time_refresh) { $tmp = redirect_timed($target, $time_refresh); } $tmp .= '<script src="../js/tabber.js" type="text/javascript"></script>'; $tpl->append('scripts', $tmp); $tpl->set_waiter_template_file('tables_pos'); $user = new user($_SESSION['userid']); if (!access_allowed(USER_BIT_WAITER) && !access_allowed(USER_BIT_CASHIER)) { access_denied_waiter(); } if ($user->level[USER_BIT_CASHIER]) { $tpl->append('tables', tables_list_all_pos(1, 1)); } $tpl->append('tables', tables_list_all_pos(1, 2)); $tpl->append('income', waiter_income_pos()); if ($user->level[USER_BIT_CASHIER]) { $cols = get_conf(__FILE__, __LINE__, 'menu_tables_per_row_cashier'); } else { $cols = get_conf(__FILE__, __LINE__, 'menu_tables_per_row_waiter'); } $tpl->append('tables', tables_list_all_pos($cols, 0, false)); if (!$user->level[USER_BIT_CASHIER]) { $tpl->append('tables', tables_list_all_pos(1, 1)); }