$dont_get_session_sourceid = true;
$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));
 function list_query_all()
 {
     global $tpl;
     $tpl->assign('title', $this->title);
     if (access_allowed(USER_BIT_MENU)) {
         $obj = new dish();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (access_allowed(USER_BIT_MENU)) {
         $obj = new ingredient();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (access_allowed(USER_BIT_MENU)) {
         $obj = new category();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (access_allowed(USER_BIT_MENU)) {
         $obj = new table();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (access_allowed(USER_BIT_USERS)) {
         $obj = new user();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (access_allowed(USER_BIT_MENU)) {
         $obj = new vat_rate();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (access_allowed(USER_BIT_CONFIG)) {
         $obj = new printer();
         if (method_exists($obj, 'list_search')) {
             $query .= $obj->list_search($this->search);
             $query .= ' UNION ALL ';
         }
     }
     if (!empty($query)) {
         $query = substr($query, 0, -11);
     }
     // strips out last UNION ALL
     return $query;
 }
Exemple #3
0
* @package		MyHandyRestaurant
* @copyright		Copyright 2003-2005, Fabio De Pascale
* @copyright	Copyright 2006-2012, Gjergj Sheldija
*/
$inizio = microtime();
define('ROOTDIR', '..');
require ROOTDIR . "/include/manage/mgmt_funs.php";
require ROOTDIR . "/include/manage/mgmt_start.php";
$GLOBALS['end_require_time'] = microtime();
if (isset($_REQUEST['orderby'])) {
    $orderby = $_REQUEST['orderby'];
    $_SESSION['orderby'] = $orderby;
} elseif (isset($_SESSION['orderby'])) {
    $orderby = $_SESSION['orderby'];
}
if (!access_allowed(USER_BIT_ACCOUNTING)) {
    $command = 'access_denied';
}
switch ($command) {
    case 'access_denied':
        echo access_denied_admin();
        break;
    case "show_all":
        main_header();
        table_general($orderby, "show_all", 6);
        break;
    case "income_collapse":
        main_header();
        table_general($orderby, "income_collapse", 5);
        break;
    case "show_only":
function table_closed_interface_pos()
{
    global $tpl;
    date_default_timezone_set(get_conf(__FILE__, __LINE__, "default_timezone"));
    if (bill_orders_to_print($_SESSION['sourceid'])) {
        $_SESSION['select_all'] = 1;
        $err = bill_select_pos();
        if ($err) {
            error_display($err);
        }
        return 0;
    }
    $tpl->set_waiter_template_file('closed_table_pos');
    $paid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "paid", $_SESSION['sourceid']);
    $total = table_total($_SESSION['sourceid']);
    $discount = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', 'discount', $_SESSION['sourceid']);
    if ($total == 0 && $paid == 0) {
        $err = table_pay(1);
        status_report('PAYMENT', $err);
        $paid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "paid", $_SESSION['sourceid']);
    }
    $tmp = navbar_tables_only_pos();
    $user = new user($_SESSION['userid']);
    if ($user->level[USER_BIT_CASHIER]) {
        $tmp = navbar_empty_pos();
    }
    $tpl->assign('navbar', $tmp);
    $tmp = '
		' . ucfirst(phr('TABLE_TOTAL_DISCOUNTED')) . ': <b>' . country_conf_currency(true) . ' ' . $total . '</b>
	';
    if ($discount != 0) {
        $discount = sprintf("%01.2f", abs($discount));
        $tmp .= '
		 (' . ucfirst(phr('DISCOUNT')) . ': ' . country_conf_currency(true) . ' ' . $discount . ')';
    }
    $tmp .= '<br />' . "\n";
    $tpl->assign('total', $tmp);
    if ($paid) {
        $tmp = '
		<FORM ACTION="orders.php" METHOD=POST>
		<INPUT TYPE="HIDDEN" NAME="command" VALUE="clear">
		' . ucfirst(phr('PAID_ALREADY')) . '<br/>
		' . ucfirst(phr('EMPTY_TABLE_EXPLAIN')) . '
		<INPUT TYPE="submit" value="' . ucfirst(phr('EMPTY_TABLE_BUTTON')) . '">
		</FORM>
		';
        $tmp .= '<br />' . "\n";
        $tpl->assign('clear', $tmp);
    }
    // user is not allowed to pay, so don't display the button
    if (!access_allowed(USER_BIT_MONEY)) {
        return 0;
    }
    $tmp = '
		<FORM ACTION="orders.php" METHOD=POST>
		<INPUT TYPE="HIDDEN" NAME="command" VALUE="pay">
		' . ucfirst(phr('PAID_ASK')) . '<br/>
		';
    if ($paid) {
        $tmp .= '
		<INPUT TYPE="hidden" name="data[paid]" value="0">
		<INPUT TYPE="submit" value="' . ucfirst(phr('NOT_PAID_BUTTON')) . '">
		<br/><br/>';
    } else {
        $tmp .= '
		<INPUT TYPE="hidden" name="data[paid]" value="1">
		<INPUT TYPE="submit" value="' . ucfirst(phr('PAID_BUTTON')) . '">
		<br/><br/>';
    }
    $tmp .= '
		</FORM>';
    $tmp .= '<br />' . "\n";
    $tpl->assign('pay', $tmp);
    return 0;
}