Exemplo n.º 1
0
/**
* My Handy Restaurant
*
* http://www.myhandyrestaurant.org
*
* My Handy Restaurant is a restaurant complete management tool.
* Visit {@link http://www.myhandyrestaurant.org} for more info.
* Copyright (C) 2003-2005 Fabio De Pascale
* 
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* @author		Fabio 'Kilyerd' De Pascale <*****@*****.**>
* @package		MyHandyRestaurant
* @copyright		Copyright 2003-2005, Fabio De Pascale
* @copyright	Copyright 2006-2012, Gjergj Sheldija
*/
function mods_set($start_data)
{
    global $tpl;
    $id = (int) $start_data['id'];
    $ord = new order($id);
    // if we're not modifying the entire order, we requantify the old one, and create a new one
    if ($start_data['quantity'] < $ord->data['quantity']) {
        $err = mods_create_order($start_data);
        status_report('CREATION', $err);
        $start_data['id'] = $GLOBALS['start_data']['id'];
    }
    if ($err = mods_apply_ingreds($start_data)) {
        return $err;
    }
    if ($err = $ord->price()) {
        return $err;
    }
    return 0;
}
function customer_recognize($term = '')
{
    global $tpl;
    $term = trim($term);
    if (empty($term)) {
        return 0;
    }
    $query = "SELECT * FROM `customers`";
    $query .= " WHERE `surname` LIKE '%{$term}%'";
    $query .= " OR `phone` LIKE '%{$term}%'";
    $query .= " OR `address` LIKE '%{$term}%'";
    $query .= " OR `email` LIKE '%{$term}%'";
    $query .= " OR `vat_account` LIKE '%{$term}%'";
    $query .= " ORDER BY `surname` ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return 0;
    }
    if (mysql_num_rows($res) == 1) {
        $arr = mysql_fetch_array($res);
        $data['takeaway_surname'] = $arr['surname'];
        $data['customer'] = $arr['id'];
        $err = takeaway_set_customer_data($_SESSION['sourceid'], $data);
        status_report('TAKEAWAY_DATA', $err);
        orders_list();
        return 1;
    }
    return 0;
}
Exemplo n.º 3
0
 function disconnect_waiter()
 {
     global $tpl;
     $tpl->set_waiter_template_file('disconnect');
     // has to be before session_unset, because of common_db session var need
     $redirect = redirect_waiter('index.php');
     $err = $this->disconnect();
     status_report('DISCONNECTION', $err);
     if ($err) {
         return $err;
     }
     $tpl->append('scripts', $redirect);
     $tmp = '<a href="index.php">' . ucfirst(phr('CONNECT')) . '</a>';
     $tpl->assign('logout', $tmp);
     return 0;
 }
Exemplo n.º 4
0
        $err = table_close($_SESSION['sourceid']);
        status_report('CLOSE', $err);
        if (!$err) {
            table_closed_interface();
        } else {
            orders_list();
        }
        break;
    case 'closed':
        table_closed_interface();
        break;
    case 'pay':
        $err = table_pay($start_data['paid']);
        status_report('PAYMENT', $err);
        $err = table_clear();
        status_report('CLEARING', $err);
        table_cleared_interface();
        break;
    case 'clear':
        if (!$err) {
            table_cleared_interface();
        } else {
            table_closed_interface();
        }
        break;
    case 'none':
        break;
    default:
        orders_list();
        break;
}
Exemplo n.º 5
0
function table_ask_association_pos()
{
    global $tpl;
    if (table_is_takeaway($_SESSION['sourceid'])) {
        $err = table_associate();
        status_report('ASSOCIATION', $err);
        orders_list();
        return 0;
    }
    $tpl->set_waiter_template_file('question');
    $tmp = '
	<table>
		<tr>
			<td width=35>
				<a href="tables.php"><img src="' . IMAGE_MENU . '" alt="' . ucfirst(phr('BACK_TO_TABLES')) . '" border=0></a>
			</td>
			<td width=35>
			</td>
			<td width=35>
			</td>
			<td width=35>
			</td>
			<td width=35>';
    if (get_conf(__FILE__, __LINE__, "service_fee_use")) {
        $tmp .= '
				<a href="orders.php?command=service_fee"><img src="' . IMAGE_NO . '" alt="' . ucfirst(phr('NO')) . '" border=0></a>';
    } else {
        $tmp .= '
				<a href="orders.php"><img src="' . IMAGE_NO . '" alt="' . ucfirst(phr('NO')) . '" border=0></a>';
    }
    $tmp .= '
			</td>
			<td width=35>
				<a href="orders.php?command=associate"><img src="' . IMAGE_OK . '" alt="' . ucfirst(phr('YES')) . '" border=0></a>
			</td>
		</tr>
	</table>
	';
    $tpl->assign('navbar', $tmp);
    $tmp = ucfirst(phr('ASSOCIATE_ASK')) . '<br/>' . "\n";
    $tpl->assign('question', $tmp);
    return 0;
}