EDIT: Once the button is clicked right now it goes to:
404 Not Found
The server can not find the requested page:
http://www.bcplabs.com/system/invoice.php?o=20093890 (port 80)
The button code on the order_detail.php page:
Code: Select all
<a onClick="window.open('print_notes.php?order_id=<? echo $order_id; ?>','PrintNotes','width=420,height=480')" class="DropDownNavLink" href="javascript:void(0);">› Print Notes</a>
<hr style="margin-left: 5px; margin-right: 5px;">
<a onClick="window.open('http://www.bcplabs.com/system/invoice.php?o=<?= $order_id?>','Invoice','scrollbars=auto,status=yes,menubar=yes,toolbar=yes,resizable=yes,target=blank')" class="DropDownNavLink" href="javascript:void(0);">› Print Invoice</a>
<a onClick="window.open('print_label.php?order_id=<?=$row['order_id']; ?>','LABEL','width=600,height=600')" class="DropDownNavLink" href="javascript:void(0);">› Print Shipping Label</a>
Code: Select all
<?
require_once "sum_transactions.php";
require_once "code_128-c.inc.php";
require_once "get_item_options_html.php";
$id = trim($_GET['link']);
$order_id = $_GET['o'];
if ($id !== false)
{
if ($db->links->select("link_uniq_id = '".$id."'") == true)
{
$order_id = $db->links->resultRow['order_id'];
}
}
$amount_paid = sum_transactions($order_id);
// Query for invoice details.
#$db->adhoc->dieOnError = true;
$query = "SELECT * FROM orders AS o
LEFT JOIN accounts AS acct ON acct.acct_id = o.acct_id
LEFT JOIN ship_to AS st ON st.acct_id = acct.acct_id
LEFT JOIN bill_to AS bt ON bt.acct_id = acct.acct_id
WHERE o.order_id = $order_id";
if ($db->adhoc->query($query) == true)
{
$row = $db->adhoc->resultRow;
}
// Now query for items
$items_query = "SELECT * FROM items
LEFT JOIN products AS prod ON prod.prod_id = items.prod_id
WHERE items.order_id = $order_id";
if ($db->adhoc->query($items_query, false, false, true) == true)
{
$items_result = $db->adhoc->resultArray;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Brainchild Products Invoice</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body onLoad="window.print()">
<table width="625" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="left" valign="top">
<table style="padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid #CCCCCC;" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<strong style="font-size: 24px;"> BCP Imports, LLC. </strong>
</td>
<td align="right" valign="middle">
<span style="font-size: 24px; font-weight: bold;">INVOICE</span>
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="45%" align="left" valign="top">
<table style="font-size: 11px; line-height: 14px;" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr align="left" valign="middle">
<td>
<strong> Order Number: </strong>
</td>
<td width="0">
<strong style="font-size: 18px;"><? echo $row['order_id']; ?></strong>
</td>
</tr>
<tr valign="top">
<td>
<strong>Order Date:</strong>
</td>
<td>
<? if ($row['order_date']) echo date('m/d/Y', strtotime($row['order_date'])); ?>
</td>
</tr>
<tr valign="top">
<td>
<b>Due Date:</b>
</td>
<td>
<? if ($row['order_due_date'] != 0) echo date('m/d/Y', strtotime($row['order_due_date'])); ?>
</td>
</tr>
<tr valign="top">
<td>
</td>
<td width="0">
</td>
</tr>
<tr valign="top">
<td>
<strong> Account Info: </strong>
</td>
<td width="0">
<?=$row['acct_first']." ".$row['acct_last']; ?>
<br>
<? if ($row['acct_company']) echo $row['acct_company']."<br />"; ?>
<?=$row['acct_phone']; ?>
<br>
<? if ($row['acct_fax']) echo $row['acct_fax']."<br />"; ?>
</td>
</tr>
</table>
</td>
<td valign="top">
<table style="font-size: 11px; line-height: 14px;" width="100%" border="0" cellspacing="0" cellpadding="2">
<tr valign="top">
<td width="55">
<strong>Ship To:</strong>
</td>
<td>
<?=$row['ship_first']." ".$row['ship_last']; ?>
<br>
<?=$row['ship_company']; ?>
<br>
<?=$row['ship_address1']; ?>
<br>
<? if ($row['ship_address2']) echo $row['ship_address2']."<br>"; ?>
<?=$row['ship_city'].", ".$row['ship_state']." ".$row['ship_zip']; ?>
<br>
<?=$row['ship_country']; ?>
</td>
</tr>
<tr valign="top">
<td width="55">
</td>
<td>
</td>
</tr>
<tr valign="top">
<td width="55">
<strong>Bill To:</strong>
</td>
<td>
<?=$row['bill_first'];?>
<?=$row['bill_last']; ?>
<br />
<? if ($row['bill_company']) { echo $row['bill_company']; } ?>
<br />
<?=$row['bill_address1']; ?>
<br>
<? if ($row['bill_address2']) echo $row['bill_address2']."<br />"; ?>
<?=$row['bill_city'].", ".$row['bill_state']." ".$row['bill_zip']; ?>
<br>
<?=$row['bill_country']; ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table style="font-size: 11px; line-height: 14px; margin-bottom: 25px;" width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr style="height: 20px; color: #FFFFFF; font-weight: bold;">
<td align="left" bgcolor="#666666">
Description
</td>
<td width="75" align="center" bgcolor="#666666">
Quantity
</td>
<td width="75" align="right" bgcolor="#666666">
Unit Price
</td>
<td width="80" align="right" bgcolor="#666666">
Total Price
</td>
</tr>
<?
// loop how ever many times the number of products we have in our cart.
foreach ($items_result as $items_row)
{
echo "<tr>";
$item_id = $items_row['item_id'];
$prod_title = $items_row['prod_title'];
$prod_short_desc = $items_row['prod_short_desc'];
$prod_model = $items_row['prod_model'];
$item_qty = $items_row['item_qty'];
$item_price = $items_row['item_price'];
// for use with monetary related data
$line_total = $item_qty * $item_price;
$subtotal += $line_total;
$total = $subtotal + $row['order_ship_amount'];
?>
<td align="left" valign="top" bgcolor="#FFFFFF">
<?
echo "<strong>".stripslashes($prod_model)."</strong><br />";
if (strlen($prod_short_desc) > 0)
{
echo stripslashes($prod_short_desc);
}
echo get_item_options_html($item_id, "font-size: 11px; font-style: italic;");
?>
</td>
<td width="75" align="center" valign="top" bgcolor="#FFFFFF">
<? echo $item_qty; ?>
</td>
<td width="75" align="right" valign="top" bgcolor="#FFFFFF">
<? echo "$" . number_format($item_price, 2); ?>
</td>
<td width="80" align="right" valign="top" bgcolor="#FFFFFF">
<? echo "$" . number_format($line_total, 2); ?>
</td>
<?
// set "$first_option" for this item to true . . .
$first_option = true;
echo "</tr>";
}
?>
<tr>
<td colspan="4" align="right" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="64%">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="font-size: 11px;">
<tr>
<td>
<b>IMPORTANT:</b>
</td>
</tr>
<tr>
<td>
If you are using a credit card to process your order, your statement will read <strong>BCP Imports, LLC. </strong>
</td>
</tr>
</table>
</td>
<td align="right" valign="top" width="36%">
<table style="font-size: 11px; line-height: 14px;" border="0" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td width="80" align="left" valign="top">
Subtotal:
</td>
<td width="85" align="right" valign="top">
<? echo "$" . number_format($subtotal,2); ?>
</td>
</tr>
<tr valign="middle">
<td width="80" align="left" valign="top">
<?=$row['order_ship_type'];?>
:
</td>
<td width="85" align="right" valign="top">
<? echo "$" . number_format($row['order_ship_amount'], 2); ?>
</td>
</tr>
<tr valign="middle">
<td width="80" align="left" valign="top">
<strong>Total:</strong>
</td>
<td width="85" align="right" valign="top">
<?
echo "<strong>$" . number_format($total, 2)."</strong>";
?>
</td>
</tr>
<tr valign="middle">
<td width="80" align="left" valign="top" >
Amount Paid:
</td>
<td width="85" align="right" valign="top">
<?
echo number_format($amount_paid, 2) . "<br /><br />";
?>
</td>
</tr>
<tr valign="middle">
<?
if ($amount_due > 0)
{
$color = "#FF0000";
}
else
{
$color = "#000000";
}
?>
<td width="80" align="left" valign="top" style="font-size: 14px; font-weight: bold;">
<strong>Balance:</strong>
</td>
<td width="85" align="right" valign="top" style="font-size: 14px; font-weight: bold;">
<?
$balance = $total - $amount_paid;
echo "$" . number_format($balance, 2);
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="36" align="center" valign="bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<? display_barcode($order_id); ?>
<? echo $row['order_id']; ?>
</td>
</tr>
</table>
<br />
</td>
</tr>
</table>
</body>
</html>