Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Custom Invoice


DigitalFodder

Recommended Posts

I need some help with my current invoice, im not happy with the current invoice the defualt osc provides, it lacks information. Anyway ive gotten so far on the information ive searched throughout this forum. The rest of the way i need help from people with php knowledge.

 

How would i display the "Description / qty / Each Price(ex) / VAT / Total" all seperatly? or at least so it :) ive tried copy and paste and that brakes the invoice. BTW when i say VAT i mean the amount of VAT paid on the single product and total is number of products + vat.

 

Here is a picture of the invoice

http://www.synet.eclipse.co.uk/invoice.jpg

 

and the code

 

<?php
/*
 $Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
 $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

 include(DIR_WS_CLASSES . 'order.php');
 $order = new order($oID);
 
$customer_query = tep_db_query("select customers_id, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
     $customer = tep_db_fetch_array($customer_query);
     $ship_date_query = tep_db_query("select date_added from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$oID . "'  and orders_status_id = '3'"); // 3 is the status id for me that represents shipped status your id may be different
     $ship_date = tep_db_fetch_array($ship_date_query);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<title><?php echo TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>

<body>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr> 
   <td width="33.3%" height="159" align="center" valign="top">
<div align="left"><img src="logo.gif" width="150" height="150"><br>
     </div></td>
   <td class="pageHeading" width="33.3%" align="center" valign="top"><h2 align="center">Sales Invoice</h2></td>
   <td class="pageHeading" width="33.3%" align="right" valign="top">
<h5><?php echo nl2br(STORE_NAME_ADDRESS); ?></h5></p>
   </td>
 </tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr> 
   <td class="main" width="50%"><b>Dispatch to:</b></td>
   <td class="main" width="50%"  border="1" bordercolor="#FFFFFF"><b>Invoice to:</b></td>
 </tr>
 <tr valign="top"> 
   <td class="main" bordercolor="#CCCCCC"> 
     <p><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></p></td>
   <td class="main" border="1" bordercolor="#CCCCCC"> 
     <p><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></p></td>
 </tr>
</table>
<br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr> 
   <td class="main" width="25%"><b>Order Number</b></td>
   <td class="main" width="25%"><b>Invoice Date</b></td>
   <td class="main" width="50%"><b>Payment Method</b></td>
 </tr>
 <tr> 
   <td class="main" bordercolor="#CCCCCC"> <?php echo tep_db_input($oID); ?> 
   </td>
   <td class="main" bordercolor="#CCCCCC"> <?php echo tep_datetime_short($customer['date_purchased']); ?> 
   </td>
   <td class="main" width="50%" bordercolor="#CCCCCC"><?php echo $order->info['payment_method']; ?></td>
 </tr>
</table>
<br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr class="dataTableHeadingRow"> 
   <td class="dataTableHeadingContent" width="50%"><div align="left">Description</div></td>
   <td class="dataTableHeadingContent" width="5%"><div align="left">Qty</div></td>
   <td class="dataTableHeadingContent" width="15%"><div align="left">Price</div></td>
   <td class="dataTableHeadingContent" width="15%"><div align="left">VAT (17.5%)</div></td>
   <td class="dataTableHeadingContent" width="15%"><div align="right">Total</div></td>
 </tr>
 <tr> 
   <td class="dataTableContent">Description</td>
   <td class="dataTableContent">qty</td>
   <td class="dataTableContent">single price(ex)</td>
   <td class="dataTableContent">single vat paid</td>
   <td class="dataTableContent" align="right">total</td>
 </tr>
 <tr> 
   <td colspan="3" rowspan="3"> </td>
   <td class="dataTableTotals" align="right"><b>Subtotal:</b></td>
   <td class="dataTableTotals" align="right">subtotal paid</td>
 </tr>
 <tr> 
   <td class="dataTableTotals" align="right"><b>VAT:</b></td>
   <td class="dataTableTotals" align="right">total vat paid</td>
 </tr>
 <tr> 
   <td class="dataTableTotals" align="right"><b>Total:</b></td>
   <td class="dataTableTotals" align="right">total paid</td>
 </tr>
</table>
<br>
<br>
<table width="50%" border="0" cellspacing="0" cellpadding="2">
        <tr class="dataTableHeadingRow"><td colspan="3" class="dataTableHeadingContent"><b>Order Comments</td></tr>
<?php
  $orders_history_query = tep_db_query("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added");
  if (tep_db_num_rows($orders_history_query)) {
    while ($orders_history = tep_db_fetch_array($orders_history_query)) {
      echo '          <tr valign=\"top\">' . "\n" .
           '            <td class="smallText" valign="top" align="left" width="140">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" .
           '            <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" .
           '          </tr>' . "\n";
    }
  }
?>
</table>
<br>
<br>
<p class="main"align="center">Thank you for shopping at XTC Computers<br>
 <font size="-10">All goods sold are subject to Terms and Conditions available 
 at www.xtccomputers.co.uk</font></p>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

To anyone that helps, Thank you!

Link to comment
Share on other sites

doesn't the current invoice display all of that information, that you need? i'd try to copy and paste that code. Here's what mine looks like now. http://www.conceptualnetworking.com/calvink/invoice.gif Could you just subtract the (in) price by the (ex) price? to get the tax(VAT)? The sun is coming out... and i really gotta goto bed. i'll take a look at it tomorrow.

Most likely your question has been answered, please do a search first.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...