PHP
  Home arrow PHP arrow Page 3 - Invoice Management in a PHP Invoicing ...
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Invoice Management in a PHP Invoicing System
By: Leidago
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 22
    2006-09-13

    Table of Contents:
  • Invoice Management in a PHP Invoicing System
  • Finishing the Invoice Page
  • Generating a Table
  • Code for Creating an Invoice
  • Creating Unpaid.php
  • Creating a new invoice

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Invoice Management in a PHP Invoicing System - Generating a Table


    (Page 3 of 6 )

    The next part of the table is dynamically generated based on the retrieved data. First, PHP checks to see if the returned results are greater than zero. If they are, it then matches and lists the data from the database to the table headings:

    <?
                            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>
                            <? }

    The action column is in itself very dynamic, in that it compares the invoice due date with today’s date and based on the result, shows an email reminder link. An invoice becomes overdue if it is 30 days late, in which case a red flag is displayed alongside the reminder link.

    You will also notice another query. This query interrogates the clientinvoice table to get the invoice description and totals. This query is located where it is because it needs the invoice ID of the current invoice in the "while loop." Finally, if the value in the $num_invoices() is less than one, then no rows have been returned by the query, so an appropriate message is shown:

    <? }
                            }else{ ?>
                            <tr>
                            <td colspan="7"><p>No invoices available at present.</p></td>
                            </tr>
                            <? }?>

    Another feature of the "action’"column is that it displays a PDF logo. When you click on it, you automatically create a pdf invoice, that will have the name of the client and current date as its name, which you can then use to email to the client. I’ve not automated the process of emailing the PDF, as I’ve already dealt with emailing clients when an invoice is "unpaid" or overdue. Below is a screenshot of what our invoice is going to look like:

    More PHP Articles
    More By Leidago


       · As one can read in the comments on the first of this series, there is no data...
       · Minor Snark - 17.5% does equal x times 17.5 divided by 100, but it would be better...
       · Thanks for the observation. Will keep it in mind next time around!
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT