PHP
  Home arrow PHP arrow Page 5 - Invoice Management in a PHP Invoicing System
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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: starstarstarstarstar / 23
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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 - Creating Unpaid.php
    ( Page 5 of 6 )

    This page shows all the unpaid invoices. This is what it looks like:

    There is really nothing to it. All that it does is list all the unpaid invoices as well as what action you want to take. We follow the same method to display the needed headers and info. So create a new PHP document and save it as unpaid.php. Then at the very top of the page add the following code:

    Code5 Unpaid.php
    <?
    include "config.php";
    $query_invoice = "SELECT *,DATE_FORMAT(inv_date,'%D %M %Y') as
    idate FROM invoices INNER JOIN client ON cid=id WHERE status =
    'Unpaid'";
    $result_invoice = mysql_query($query_invoice);
    $num_invoice = mysql_num_rows($result_invoice);
    ?>

    As before, we run a query to retrieve all the invoices marked as unpaid in the database. We also include an inner join to include matching records from the client table:

    $query_invoice = "SELECT *,DATE_FORMAT(inv_date,'%D %M %Y') as
    idate FROM invoices INNER JOIN client ON cid=id WHERE status =
    'Unpaid'";

    We then store the number of rows returned in the $num_invoice variable. Next we create the table with the headers:

    <tr valign="top">
              <td width="13%"><strong>Invoice # </strong></td>
              <td width="24%"><strong>Client Name
    </strong></td>         

              <td width="20%"><strong>Date Issued
    </strong></td>         

              <td width="18%"><strong>Total(incl VAT)</strong></td>
              <td width="25%"><strong> Action </strong></td>
    </tr>

    Then we create the dynamic section of the table based on the returned rows:

    <?
                            if($num_invoice > 0){
                            while($invoice = mysql_fetch_assoc
    ($result_invoice)){
                            ?>
            <tr valign="top">
              <td><?=$invoice['invno'];?></td>
              <td><?=$invoice['name'];?></td>
              <td><?=$invoice['idate'];?></td>
                              <?  $query_invdetails = "SELECT totwVAT
    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['totwVAT'];?></td>
              <td><? if(!isset($_GET['act'])){?><a
    href="emailInv.php?iid=<?=$invoice['invno']?>">Email
    Reminder</a><? }else{?>Reminder sent!<? }?> </td>
            </tr>

    Finally if there are no results returned in the query, we print a message stating so:

    <? }
                            }else{?>
                            <tr>
                            <td colspan="5"><p>No unpaid
    invoices</p></td>
                            </tr>
                            <? }?>

    And that’s it for this page. Next we are going to look at how to create a new invoice.



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

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT