Example #1
0
<input type="button" value="New Invoice" onclick="window.location='package_report.php?new=1'">

<?php 
if ($_REQUEST['new'] != '') {
    //echo "<p>New Invoice";
    if ($_REQUEST['go'] != '') {
        if ($_REQUEST['employer_id'] == '') {
            $error = "<p>Error: Employer account not selected...</p>";
        }
        if ($_REQUEST['package_id'] == '') {
            $error = "<p>Error: Package not selected...</p>";
        }
        if ($error != '') {
            echo $error;
        } else {
            JB_place_package_invoice($_REQUEST['employer_id'], $_REQUEST['package_id']);
            $_REQUEST['new'] = '';
            $JBMarkup->ok_msg('New invoice added.');
        }
    }
    if ($_REQUEST['new'] != '') {
        ?>

	<form method="post" action="<?php 
        echo htmlentities($_SERVER['PHP_SELF']);
        ?>
?action=post" >
	<input type="hidden" name="new" value="<?php 
        echo jb_escape_html($_REQUEST['new']);
        ?>
">
Example #2
0
JB_render_box_top(80, $label['employer_credits_order_confirm']);
if ($_REQUEST['action'] == 'post' || $_REQUEST['action'] == 'premium_post') {
    ?>
	<table  width="100%" >
	<tr>
		<td>
		<?php 
    // check to see if there are in_cart orders of the same package_id
    $sql = "select * from package_invoices where employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND package_id='" . jb_escape_sql($_REQUEST['package_id']) . "' AND (status='in_cart' ) ";
    $result = JB_mysql_query($sql) or die(mysql_error());
    if (mysql_num_rows($result) > 0) {
        $row = mysql_fetch_array($result, MYSQL_ASSOC);
        $invoice_id = $row['invoice_id'];
    } else {
        // this is a new order, make a new invoice
        $invoice_id = JB_place_package_invoice($_SESSION['JB_ID'], $_REQUEST['package_id']);
    }
    if ($invoice_id !== false) {
        // delete other selected orders
        $sql = "DELETE FROM package_invoices WHERE  (`status`='in_cart' ) AND `invoice_id` != '{$invoice_id}' AND employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' ";
        //echo $sql;
        $result = JB_mysql_query($sql) or die($sql . mysql_error());
        $sql = "select * from packages WHERE package_id='" . jb_escape_sql($_REQUEST['package_id']) . "'   ";
        $result = JB_mysql_query($sql) or die(mysql_error());
        $row = mysql_fetch_array($result, MYSQL_ASSOC);
        JB_display_package_invoice($invoice_id);
        ?>

			</td>
			<td width="50%">
			<p>