Home arrow PHP arrow Page 2 - Invoice Management in a PHP Invoicing System

Finishing the Invoice Page - PHP

If you're running a business in which you're invoicing clients, you need some way to keep track of which invoices have gone out and which clients have paid. In this second article of a four-part series that covers the creation of a PHP invoicing system, we create the parts that deal with this kind of invoice management.

TABLE OF CONTENTS:
  1. Invoice Management in a PHP Invoicing System
  2. Finishing the Invoice Page
  3. Generating a Table
  4. Code for Creating an Invoice
  5. Creating Unpaid.php
  6. Creating a new invoice
By: Leidago
Rating: starstarstarstarstar / 31
September 13, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

The rest of the page looks like this:

<tr valign="top" class="tblheadings">
          <td width="9%"><strong>Invoice # </strong></td>
          <td width="14%"><strong>Client Name </strong></td>
          <td width="8%"><strong>Status</strong></td>
          <td width="11%"><strong>Date Issued </strong></td>
          <td width="11%"><strong>Total(excl VAT)</strong></td>
          <td width="13%"><strong>Total(incl VAT)</strong></td>
          <td width="20%"><strong> Action </strong></td>
        </tr>
<?
if($num_invoice > 0){
while($invoice = mysql_fetch_assoc($result_invoice)){
                        ?>
        <tr valign="top" class="tblinfo">
          <td><?=$invoice['invno'];?></td>
          <td><?=$invoice['name'];?></td>
          <td><? if($td > $invoice['duedate']){
                          echo "<font color=\"#FF0000\">Overdue</font>";
                          $email="yes"; 
                          }else{
                          echo $invoice['status'];}
                          ?></td>
          <td><?=$invoice['idate'];?></td>
                          <? $query_invdetails = "SELECT * FROM clientinv WHERE
finv='".$invoice['invno']."'";
if(!$result_invdetails= mysql_query($query_invdetails)){
echo mysql_error();
}else{
$num_invdetails = mysql_num_rows($result_invdetails);
$invdetails=mysql_fetch_assoc($result_invdetails);}
?>
          <td><?=$invdetails['totxVAT'];?></td>
          <td><?=$invdetails['totwVAT'];?></td>
          <td><a href="invView.php?iid=<?=$invoice['invno']?>">View </a> |<a
href="delinvoice.php?iid=<?=$invoice['invno']?>">Delete</a> <a href="edInv.php?
iid=<?=$invoice['invno']?>">Update</a> <? if($td > $invoice['duedate']){
                          echo "<img src=\"images/RedFlag.gif\" height = \"10\"/>"; 
                          }
                          ?>
                          <? if(isset($email)){?>
                          <a href="emailInv.php?iid=<?=$invoice['invno']?>">Email
Reminder</a>
                          <? }?>
                           <a href="pdf.php?cid=<?=$invoice['cid']?>"><img
src="images/pdf.gif" width="18" height="18" border="0"/></a></td>
        </tr>
                        <? }
                        }else{ ?>
                        <tr>
                        <td colspan="7"><p>No invoices available at present.</p></td>
                        </tr>
                        <? }?>
      </table>

So, what is happening here? Basically, we are creating a table that will list all the invoices based on the results from the query. In other words, part of the table will be dynamically generated. The first section of the table shows  the headings of the different columns. The columns that we want listed are:

  • Invoice number.
  • Client name.
  • Status Shows if a  invoice is paid or unpaid.
  • Date issued.
  • Total (excluding VAT).
  • Total (including VAT) .
  • Action - Actions that can be taken, which include viewing, updating or deleting a invoice.

The headings are created by the following HTML code:

<tr valign="top" class="tblheadings">
          <td width="9%"><strong>Invoice # </strong></td>
          <td width="14%"><strong>Client Name </strong></td>
          <td width="8%"><strong>Status</strong></td>
          <td width="11%"><strong>Date Issued </strong></td>
          <td width="11%"><strong>Total(excl VAT)</strong></td>
          <td width="13%"><strong>Total(incl VAT)</strong></td>
          <td width="20%"><strong> Action </strong></td>
        </tr>



 
 
>>> More PHP Articles          >>> More By Leidago
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: