PHP
  Home arrow PHP arrow Page 3 - Creating a Login Script for 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? 
Google.com  
PHP

Creating a Login Script for a PHP Invoicing System
By: Leidago
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 30
    2006-09-06


    Table of Contents:
  • Creating a Login Script for a PHP Invoicing System
  • What if I don't see that page?
  • Database schema
  • Login program

  • 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


    Creating a Login Script for a PHP Invoicing System - Database schema
    ( Page 3 of 4 )

    Because we are starting the series off with invoice management, we are going to be building the invoices table, so

    CREATE TABLE `invoices` (
      `invno` int(4) unsigned zerofill NOT NULL auto_increment,
       `status` enum('Paid','Unpaid') NOT NULL default 'Unpaid',
      `VAT` decimal(9,2) NOT NULL default '0.00',
      `inv_date` date default NULL,
        `cid` int(11) NOT NULL default '0',
      `uID` int(4) NOT NULL default '0',
      PRIMARY KEY  (`invno`)
    )

    Let's run through the table fields:

    The invno field is the primary key generator which gives a unique number to every new invoice that is created. The invoice numbers will be in the format 0001, 0002, 0003, and so on. The status field is of enumerate type and contains the values Paid and Unpaid. These values will be used to show the status of an invoice.

    The Inv_date  field will show the date that the invoice was issued. VAT, by the way, will be calculated automatically. The cid is the foreign key that will help identify the client name associated with an invoice. The uID field identifies the user who created the invoice. This table is at the heart of the program; it will tell us everything we want to know about a particular invoice, such as how many invoices a particular user issued or how many invoices were made to a particular client etc.

    The next table we are going to create is called "clientinv." It is going to hold specific invoice and client details, such as the description of the invoice and the total cost of a invoice:

    CREATE TABLE `clientinv` (
      `invnum` int(4) unsigned zerofill NOT NULL auto_increment,
      `descr` text NOT NULL,
      `totxVAT` decimal(9,2) NOT NULL default '0.00',
      `totwVAT` decimal(9,2) NOT NULL default '0.00',
      `finv` int(11) NOT NULL default '0',
      PRIMARY KEY  (`invnum`)
    )

    Let's go through the table fields:

    The "descr" field will hold the description of the invoice. The totxVAT and totwVAT fields will store the total cost of the product with and without VAT. The "finv" field is the foreign key that will hold the invoice number. I created this table because it will give us flexibility in terms of how we store information. Remember, one client can have many invoices and one invoice can contain information on many different products, which I could not store in either the invoices or the (soon to be created)client table.



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

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek