Exemplo n.º 1
0
         error_display($err);
     }
     break;
 case 'bill_print':
     if (isset($_REQUEST['type'])) {
         $type = $_REQUEST['type'];
     }
     if (!bill_type_set($type)) {
         $err = bill_print();
         status_report('BILL_PRINT', $err);
         if (!$err) {
             // this allows bill_select to forget precedent selection
             $_REQUEST['keep_separated'] = 0;
         }
     }
     bill_select();
     break;
 case 'bill_reset':
     if (isset($_REQUEST['reset'])) {
         $err = bill_reset($_SESSION['sourceid']);
         status_report('BILL_RESET', $err);
         if ($err) {
             printing_choose();
         } else {
             orders_list();
         }
     } else {
         bill_reset_confirm();
     }
     break;
 case 'print_orders':
Exemplo n.º 2
0
/**
* Interface for closed tables
*
* Template: closed_table.tpl
* Assigns: navbar, pay, clear, total.
*
* @return integer error code
*/
function table_closed_interface()
{
    global $tpl;
    if (bill_orders_to_print($_SESSION['sourceid'])) {
        $_SESSION['select_all'] = 1;
        $err = bill_select();
        if ($err) {
            error_display($err);
        }
        return 0;
    }
    $tpl->set_waiter_template_file('closed_table');
    $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();
    $user = new user($_SESSION['userid']);
    if ($user->level[USER_BIT_CASHIER]) {
        $tmp = navbar_empty();
    }
    $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;
}