function bill_select_pos()
{
    /*
    name:
    bill_select_pos()
    returns:
    0 - no error
    1 - generic dish with no price found
    2 - internal error clearing prices
    3 - 
    other - mysql error number
    */
    global $tpl;
    if (!bill_orders_to_print($_SESSION['sourceid'])) {
        printing_choose_pos(true);
        return 0;
    }
    $tpl->set_waiter_template_file('bill_select_pos');
    $script = "<script language=\"JavaScript\" type=\"text/javascript\">\r\n\t\t\$(document).ready(function(){\r\n\t\t\t\$('#tabContent>li:gt(0)').hide();\r\n\t\t\t\$('#tabsNav li:first').addClass('active');\r\n\t\t\t\$('#tabsAndContent #tabsNav li').bind('click', function() {\r\n\t\t\t\t\$('li.active').removeClass('active');\r\n\t\t\t\t\$(this).addClass('active');\r\n\t\t\t\tvar target = \$('a', this).attr('href');\r\n\t\t\t\t\$(target).slideDown(\"fast\").siblings().slideUp(\"fast\");\r\n\t\t\t\treturn false;\r\n\t\t\t});\r\n\t\t});\t\r\n\t</script>";
    $tpl->assign('script', $script);
    $_SESSION['bill_printed'] = 0;
    if (order_found_generic_not_priced($_SESSION['sourceid'])) {
        return ERR_GENERIC_ORDER_NOT_PRICED_FOUND;
    }
    $keep_separated = bill_check_keep_separated();
    if ($keep_separated == 1) {
        $tmp = navbar_separatebills_pos('form_type', 'orders.php?command=printing_choose');
        $tpl->assign('navbar', $tmp);
    } else {
        $tmp = navbar_form_pos('form_type', 'orders.php?command=printing_choose');
        $tpl->assign('navbar', $tmp);
    }
    if ($err = bill_clear_prices($_SESSION['sourceid'])) {
        return $err;
    }
    if ($err = bill_save_session($_SESSION['sourceid'])) {
        return $err;
    }
    $tmp = bill_method_selector();
    $tpl->assign('method', $tmp);
    $tmp = bill_type_selection_pos($_SESSION['sourceid']);
    $tpl->assign('type', $tmp);
    $tmp = discount_form_javascript($_SESSION['sourceid']);
    $tpl->assign('discount', $tmp);
    $tmp = bill_show_list();
    $tpl->assign('orders', $tmp);
    return 0;
}
Beispiel #2
0
     $category = (int) $start_data['category'];
     $err = print_category($category);
     status_report('CATEGORY_PRINT', $err);
     if (!$err) {
         orders_list_pos();
     } else {
         printing_choose_pos();
     }
     break;
 case 'printing_choose':
     $err = print_orders($_SESSION['sourceid']);
     status_report('ORDERS_PRINT', $err);
     if (!$err) {
         orders_list_pos();
     } else {
         printing_choose_pos();
     }
     break;
 case 'reopen_confirm':
     table_reopen_confirm_pos();
     break;
 case 'reopen':
     $err = table_reopen($_SESSION['sourceid']);
     status_report('REOPEN', $err);
     orders_list_pos();
     break;
 case 'close_confirm':
 case 'close':
     $err = table_close($_SESSION['sourceid']);
     status_report('CLOSE', $err);
     if (!$err) {