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_pos($showOrdersOnly = false)
{
    global $tpl;
    $table = new table($_SESSION['sourceid']);
    $user = new user($_SESSION['userid']);
    // use session to decide wether to show the orders list or not
    // TODO: add get_conf here
    if (!isset($_SESSION['show_orders_list_pos'])) {
        $_SESSION['show_orders_list_pos'] = false;
    }
    $show_orders = true;
    unset($_SESSION['select_all']);
    $_SESSION['go_back_to_cat'] = 0;
    //ajax hack :(
    if ($showOrdersOnly == true) {
        echo $table->list_orders_only_pos();
        return 0;
    }
    if (table_is_closed($_SESSION['sourceid']) && !$user->level[USER_BIT_CASHIER]) {
        table_closed_interface_pos();
        return 0;
    }
    $_SESSION['order_added'] = 0;
    $tpl->set_waiter_template_file('orders_pos');
    if (table_is_takeaway($_SESSION['sourceid'])) {
        $tpl->set_waiter_template_file('orders_takeaway');
        takeaway_form();
    }
    $table->fetch_data(true);
    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 ($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_pos'] == false) {
        $image = '<img src="' . IMAGE_SHOW_ORDERS . '" height=48 width=48><br>';
        $desc = ucfirst(phr('SHOW_ORDERS'));
    } else {
        $image = '<img src="' . IMAGE_HIDE_ORDERS . '" height=48 width=48><br>';
        $desc = ucfirst(phr('HIDE_ORDERS'));
    }
    $tmp = '<a href="orders.php?command=set_show_orders">' . $image . $desc . '</a><br/>';
    $tpl->append('commands', $tmp);
    $tmp = categories_list_pos();
    $tpl->assign('categories', $tmp);
    $tmp = letters_list();
    $tpl->assign('letters', $tmp);
    if (CONF_FAST_ORDER) {
        $tmp = order_fast_dishid_form();
        $fast_order_id = '<span class="rounded">' . $tmp . '</span>';
        $tpl->assign('fast_order_id', $fast_order_id);
    } else {
        // activate scripts
        $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_pos();
    $tpl->assign('vertical_navbar', $tmp);
    if ($show_orders) {
        $table->list_orders_pos();
    }
    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_pos('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;
}
Ejemplo n.º 4
0
        break;
    case 'closed':
        table_closed_interface_pos();
        break;
    case 'pay':
        $err = table_pay_pos($start_data['paid']);
        status_report('PAYMENT', $err);
        $err = table_clear();
        status_report('CLEARING', $err);
        table_cleared_interface_pos();
        break;
    case 'clear':
        if (!$err) {
            table_cleared_interface_pos();
        } else {
            table_closed_interface_pos();
        }
        break;
    case 'none':
        break;
    default:
        orders_list_pos();
        break;
}
// this line is already in waiter_start, but it's here repeated because of possible modifications from waiter start till now
$tmp = table_people_number_line($_SESSION['sourceid']);
$tpl->assign("people_number", $tmp);
// html closing stuff and disconnect line
$tmp = disconnect_line_pos();
$tpl->assign('logout', $tmp);
// prints page generation time