Ejemplo n.º 1
0
function printing_choose_pos($from_bill_print = false)
{
    global $tpl;
    if (!takeaway_is_set($_SESSION['sourceid'])) {
        $tmp = '<font color="Red">' . ucfirst(phr('SET_TAKEAWAY_SURNAME_FIRST')) . '</font>';
        $tpl->append('messages', $tmp);
        orders_list();
        return 0;
    }
    $user = new user($_SESSION['userid']);
    if (table_is_closed($_SESSION['sourceid']) && (!$user->level[USER_BIT_CASHIER] || $from_bill_print)) {
        table_closed_interface_pos();
        return 0;
    }
    $tpl->set_waiter_template_file('printing');
    $tmp = printing_commands_pos();
    $tpl->append('commands', $tmp);
    $tmp = navbar_empty_pos();
    $tpl->assign('navbar', $tmp);
}
Ejemplo n.º 2
0
function orders_list()
{
    global $tpl;
    // use session to decide wether to show the orders list or not
    // TODO: add get_conf here
    if (!isset($_SESSION['show_orders_list'])) {
        $_SESSION['show_orders_list'] = false;
    }
    $show_orders = $_SESSION['show_orders_list'];
    unset($_SESSION['select_all']);
    $_SESSION['go_back_to_cat'] = 0;
    $user = new user($_SESSION['userid']);
    if (table_is_closed($_SESSION['sourceid']) && !$user->level[USER_BIT_CASHIER]) {
        table_closed_interface();
        return 0;
    }
    $_SESSION['order_added'] = 0;
    $tpl->set_waiter_template_file('orders');
    if (table_is_takeaway($_SESSION['sourceid'])) {
        $tpl->set_waiter_template_file('orders_takeaway');
        takeaway_form();
    }
    $table = new table($_SESSION['sourceid']);
    $table->fetch_data(true);
    if ($cust_id = $table->data['customer']) {
        $cust = new customer($cust_id);
        $tmp = ucphr('CUSTOMER') . ': ' . $cust->data['surname'];
        $tmp .= ' <a href="orders.php?command=customer_search">' . ucphr('EDIT') . '</a>/';
        $tmp .= '<a href="orders.php?command=set_customer&amp;data[customer]=0">' . ucphr('REMOVE') . '</a>';
        $tmp .= '<br/>';
    } else {
        $tmp = '<a href="orders.php?command=customer_search">' . ucfirst(phr('INSERT_CUSTOMER_DATA')) . '</a><br/>';
    }
    $tpl->append('commands', $tmp);
    if (!orders_service_fee_exists() && get_conf(__FILE__, __LINE__, 'service_fee_use')) {
        $tmp = '<a href="orders.php?command=create&amp;dishid=' . SERVICE_ID . '">' . ucfirst(phr('CREATE_SERVICE_FEE')) . '</a><br/>';
        $tpl->append('commands', $tmp);
    }
    $associated_waiter = table_is_associated();
    if (get_conf(__FILE__, __LINE__, "disassociation_allow") && $associated_waiter && ($associated_waiter == $_SESSION['userid'] || $user->level[USER_BIT_CASHIER])) {
        $tmp = '<a href="orders.php?command=dissociate">' . ucfirst(phr('DISSOCIATE')) . '</a><br/>';
        $tpl->append('commands', $tmp);
    }
    if ($user->level[USER_BIT_CASHIER]) {
        $tmp = '<a href="orders.php?command=ask_move">' . ucfirst(phr('MOVE_TABLE')) . '</a><br/>';
        $tpl->append('commands', $tmp);
    }
    if ($user->level[USER_BIT_CASHIER] && table_is_closed($_SESSION['sourceid'])) {
        $tmp = '<a href="orders.php?command=reopen_confirm">' . ucfirst(phr('REOPEN_TABLE')) . '</a><br/>';
        $tpl->append('commands', $tmp);
    }
    if ($_SESSION['show_orders_list'] == false) {
        $desc = ucfirst(phr('SHOW_ORDERS'));
    } else {
        $desc = ucfirst(phr('HIDE_ORDERS'));
    }
    $tmp = '<a href="orders.php?command=set_show_orders">' . $desc . '</a><br/>';
    $tpl->append('commands', $tmp);
    $tmp = categories_list();
    $tpl->assign('categories', $tmp);
    $tmp = letters_list();
    $tpl->assign('letters', $tmp);
    if (CONF_FAST_ORDER) {
        $tmp = order_fast_dishid_form();
        $tpl->assign('fast_order_id', $tmp);
    } else {
        $tmp = keys_orders();
        $tpl->append('scripts', $tmp);
    }
    // use session to decide wether to show the orders list or not
    if (!isset($_SESSION['show_toplist'])) {
        $_SESSION['show_toplist'] = get_conf(__FILE__, __LINE__, "top_list_show_top");
    }
    if ($_SESSION['show_toplist']) {
        toplist_show();
    } elseif (get_conf(__FILE__, __LINE__, "top_list_show_top")) {
        $tmp = '<a href="orders.php?command=set_show_toplist">' . ucphr('SHOW_TOPLIST') . '</a><br/>';
        $tpl->assign('toplist', $tmp);
    }
    $tmp = command_bar_table_vertical();
    $tpl->assign('vertical_navbar', $tmp);
    if ($show_orders) {
        $table->list_orders();
    }
    if (get_conf(__FILE__, __LINE__, "show_summary")) {
        $query = "SELECT * FROM `orders`WHERE `sourceid`='" . $_SESSION['sourceid'] . "' AND `id`=`associated_id` ORDER BY `timestamp` DESC LIMIT 1";
        $res = common_query($query, __FILE__, __LINE__);
        if (!$res) {
            return ERR_MYSQL;
        }
        $arr = mysql_fetch_array($res);
        $mods = get_conf(__FILE__, __LINE__, "show_mods_in_summary");
        $table->list_orders('last_order', $arr['id'], $mods);
    }
    return 0;
}
Ejemplo n.º 3
0
function table_ask_close_pos()
{
    global $tpl;
    if (!takeaway_is_set($_SESSION['sourceid'])) {
        $tmp = '<font color="Red">' . ucfirst(phr('SET_TAKEAWAY_SURNAME_FIRST')) . '</font>';
        $tpl->append('messages', $tmp);
        orders_list_pos();
        return 0;
    }
    if (table_is_closed($_SESSION['sourceid'])) {
        table_closed_interface_pos();
        return 0;
    }
    $tpl->set_waiter_template_file('question');
    $tmp = '
	<FORM ACTION="orders.php" METHOD=POST name="form1">
	<INPUT TYPE="HIDDEN" NAME="command" VALUE="close">
	' . ucfirst(phr('CLOSE_TABLE_ASK')) . '
	</FORM>
	';
    $tpl->assign('question', $tmp);
    $tmp = navbar_form_pos('form1', 'orders.php?command=list');
    $tpl->assign('navbar', $tmp);
    return 0;
}