<?php require_once('../Connections/t77_connect.php'); ?>
<?
$colname_bills = "12";
if (isset($_GET['id'])) {
$colname_bills = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_t77_connect, $t77_connect);
$query_bills = sprintf("SELECT t77_bill_bills.bill_id, t77_bill_bills.order_number, t77_bill_bills.bill_name, t77_bill_bills.bill_date, t77_bill_bills.bill_status, t77_bill_bills.bill_contact FROM t77_bill_bills WHERE t77_bill_bills.bill_id = %s", $colname_bills);
$bills = mysql_query($query_bills, $t77_connect) or die(mysql_error());
$row_bills = mysql_fetch_assoc($bills);
$totalRows_bills = mysql_num_rows($bills);
$colname_items = "12";
if (isset($_GET['id'])) {
$colname_items = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_t77_connect, $t77_connect);
$query_items = sprintf("SELECT * FROM t77_bill_items WHERE t77_bill_items.bill_id = %s", $colname_items);
$items = mysql_query($query_items, $t77_connect) or die(mysql_error());
$row_items = mysql_fetch_assoc($items);
$totalRows_items = mysql_num_rows($items);
mysql_select_db($database_t77_connect, $t77_connect);
$query_settings = "SELECT * FROM t77_bill_settings";
$settings = mysql_query($query_settings, $t77_connect) or die(mysql_error());
$row_settings = mysql_fetch_assoc($settings);
$totalRows_settings = mysql_num_rows($settings);
$colname_contact = $row_bills['bill_contact'];
if (isset($row_bills['bill_contact'])) {
$colname_contact = (get_magic_quotes_gpc()) ? $row_bills['bill_contact'] : addslashes($row_bills['bill_contact']);
}
$contactSelect = $row_bills['bill_contact'];
$subtotal = 0;
$colname_contacts = "1";
if (isset($contactSelect)) {
$colname_contacts = (get_magic_quotes_gpc()) ? $contactSelect : addslashes($contactSelect);
}
mysql_select_db($database_t77_connect, $t77_connect);
$query_contacts = sprintf("SELECT * FROM t77_bill_contacts, t77_bill_companies WHERE t77_bill_contacts.contact_company_name = t77_bill_companies.company_id AND t77_bill_contacts.contact_id = %s", $colname_contacts);
$contacts = mysql_query($query_contacts, $t77_connect) or die(mysql_error());
$row_contacts = mysql_fetch_assoc($contacts);
$totalRows_contacts = mysql_num_rows($contacts);
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!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>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
p {
font-family: Arial, Helvetica, sans-serif;
font-size: 8pt;
color: #000000;
line-height: 14pt;
margin: 0px;
padding: 0px;
}
body {
margin: 0px;
padding: 0px;
}
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 8pt;
line-height: 14pt;
font-weight: bold;
color: #000000;
margin: 0px;
padding: 0px;
}
.tableBorder {
border: 1px solid #6FA2D0;
}
.tableTop {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #6FA2D0;
background-color: #D6E5F2;
}
.bodyHeader {
background-image: url(../images/bodyTop.gif);
background-repeat: repeat-x;
}
.lineleft {
border-left-width: 1px;
border-left-style: solid;
border-left-color: #003CA5;
}
textarea {
background-color: #ffffff;
border: 1px solid #003CA5;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
input {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
background-color: #ffffff;
border: 1px solid #003CA5;
}
a:link {
color: #003ca5;
text-decoration: none;
}
a:hover {
color: #003ca5;
text-decoration: underline;
}
.LineTotal {
border-top-width: 1px;
border-top-style: solid;
border-top-color: #003ca5;
}
-->
</style>
</head>
<body leftmargin="20" topmargin="20" marginwidth="20" marginheight="20">
<table width="100%" border="0" cellspacing="0" cellpadding="30">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td width="250"><div align="right"></div>
</td>
</tr>
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="20">
<tr>
<td><p><?php echo $row_contacts['company_name']; ?><br />
t.a.v. <?php echo $row_contacts['contact_title']; ?> <?php echo $row_contacts['contact_person']; ?><br />
<?php echo $row_contacts['contact_company_address']; ?><br />
<?php echo $row_contacts['contact_company_zip']; ?> <?php echo $row_contacts['contact_company_city']; ?><br />
</p>
</td>
</tr>
</table>
</td>
<td width="250" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="20">
<tr>
<td><div align="right">
<p align="left"><?php echo $row_settings['company_address']; ?><strong><br />
</strong><?php echo $row_settings['company_zip']; ?> <?php echo $row_settings['company_city']; ?><br />
Tel : <?php echo $row_settings['company_tel']; ?><br />
email: <?php echo $row_settings['company_email']; ?><br />
<?php echo $row_settings['company_bank']; ?></p>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td> </td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td height="20" valign="middle">
<?php
do {
$bgcolor = "#ffffff";
$subtotal = $subtotal + $row_items['item_price'];
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="<? echo $bgcolor; ?>">
<tr>
<td colspan="2" align="left" valign="top"><p><strong><?php echo $row_items['item_name']; ?></strong></p>
</td>
</tr>
<tr>
<td align="left" valign="top"><table width="85%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><p><?php echo $row_items['item_description']; ?></p></td>
</tr>
</table>
</td>
<td align="right" valign="bottom"><p><?php echo $row_settings['valuta_sign']; ?> <?php echo number_format($row_items['item_price'],2,',','.'); ?></p>
</td>
</tr>
<tr>
<td height="20" colspan="2" align="left" valign="middle"><img src="" alt="" name="line" width="100%" height="1" id="line" style="background-color: #CCCCCC" /></td>
</tr>
</table>
<?php } while ($row_items = mysql_fetch_assoc($items)); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right"><table width="100%" border="0" align="right" cellpadding="5" cellspacing="0">
<tr>
<td width="475" align="right" valign="top"><p><strong>Subtotaal</strong></p>
</td>
<td width="150" align="right" valign="top"><p><?php echo $row_settings['valuta_sign']; ?> <? echo number_format($subtotal,2,',','.'); ?></p>
</td>
</tr>
<tr>
<td align="right" valign="top"><p><strong>BTW: <?php echo number_format($row_settings['VAT'],2,',','.'); ?>%</strong></p>
</td>
<td width="150" align="right" valign="top"><p>
<?php echo $row_settings['valuta_sign'];
echo " ";
$VAT = (($subtotal/100)*$row_settings['VAT']);
echo $VAT; ?>
</p>
</td>
</tr>
<tr>
<td align="right" valign="top"><p><strong>Totaal</strong></p>
</td>
<td width="150" align="right" valign="top"><p><?php echo $row_settings['valuta_sign']; ?> <? echo ($subtotal+$VAT); ?></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($bills);
mysql_free_result($items);
mysql_free_result($settings);
mysql_free_result($contacts);
?>