function table_pay_pos($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_pos();
        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;
}
Example #2
0
if (empty($command) || $command == "none") {
    $command = table_suggest_command($_SESSION['sourceid']);
}
$table = new table($_SESSION['sourceid']);
if (!$table->exists() && $command != 'access_denied') {
    $tmp = 'table doesn\'t exist.<br/>' . "\n";
    $tpl->append('messages', $tmp);
    $tmp = navbar_menu_pos();
    $tpl->assign('navbar', $tmp);
    $command = 'none';
}
$tpl->set_waiter_template_file('orders_pos');
// command selection
switch ($command) {
    case 'access_denied':
        access_denied_waiter_pos();
        break;
    case 'create':
        $list = array();
        $dishid = trim($_REQUEST['dishid']);
        if (empty($start_data['quantity'])) {
            $start_data['quantity'] = get_conf(__FILE__, __LINE__, "default_quantity");
        }
        // autosearch
        // the user provided a text instead of a number,
        // we look for dish
        if ($dishid != '' && !is_numeric($dishid)) {
            $dish = new dish();
            $num = $dish->search_name_rows($dishid);
            // -1 means found many, go to dish list
            if ($num == -1) {