“PHP Invoice” Documentation by “Farjad Tahir” v1.3


“PHP Invoice”

Created: 01/19/2016
By: Farjad Tahir
Email: farjad_tahir@splashpk.com

Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!


Table of Contents

  1. Introduction
  2. Integration
  3. Available Options
  4. Examples
  5. Sources and Credits

A) Introduction - top

PHP Invoice is a simple object oriented PHP class to generate beautifully designed invoices, quotes or Sale/Purchase orders with just a few lines of code. Brand it with your own logo and theme color, add unlimited items and total rows with automatic paging. You can deliver the PDF output in the user's browser, save on the server or force a file download.

PHP Invoice is fully customizable and can be integrated into any well known CMS like wordpress, CodeIgniter, Laravel or custom CMS's.

Multi-languages support

PHP Invoice has built-in translations in English, Dutch, French, German, Spanish and Italian (you can easily add your own if needed).

Multi-currency support

PHP Invoice allows you to add add any currency needed per document.

Additional titles, paragraphs and badges

We made it easy to add extra content (titles and multi-line paragraphs) to the bottom of the document. You might use it for payment or shipping information or any other content needed.

Examples

Example codes are also included inside the packeage .

Path: php-invoice/examples

B) Integration - top

All you need is to include this single file "phpinvoice.php" on the top and where set.

include('file/path/to/phpinvoice.php');

C) Available Options - top

See and learn how every Php Invoice method works in detail

Create instance

Start a new instance of the PHP Invoice class.

$invoice = new phpinvoice(size,currency,language); // Default Param: Size: A4, Currency: $, Language: en

Number formatting

How do you want to show your numbers?

$invoice->setNumberFormat(decimalpoint,seperator);

Theme color

Set a custom color to personalize your invoices.

$invoice->setColor(color);

Logo

Add your company logo to the invoice.

$invoice->setLogo(image,maxwidth,maxheight);

Document type

Set the type of document you are creating.

$invoice->setType(type);

Reference

Add your document reference or number

$invoice->setReference(reference);

Date

Set your document date.

$invoice->setDate(date);

Due DateOptional

Set your invoice due date.

$invoice->setDue(duedate);

Company information

Set your company details.

$invoice->setFrom(company);

Client information

Set your client details.

$invoice->setTo(client);

FlipFlopOptional

Switch the horizontal positions of your company information and the client information. By default, your company details are on the left.

$invoice->flipflop();

Add item

Add a new product or service row to your document below the company and client information. PHP Invoice has automatic paging so there is absolutely no limit.

$invoice->addItem(name,description,amount,vat,price,discount);

Currency Direction

You can adjust currency direction as well. You can display currency symbol before or after the prices as well.

$invoice->setCurrenyDirection(direction);

Add Total

Add a row below the products and services for calculations and totals. You can add unlimited rows.

$invoice->addTotal(name,value,background,subtract);

Get Percentage from total amountOptional

This function allows you to get specified percentage of total amount. Like for calculating VAT 25% out of total amount.

$invoice->GetPercentage(value);

Get Grand Total

This function allows you to get grand total after completing all calculations.

$invoice->GetGrandTotal();

Add badgeOptional

Adds a badge to your invoice below the products and services. You can use this for example to display that the invoice has been payed.

$invoice->addBadge(badge);

Add title

You can add titles and paragraphs to display information on the bottom part of your document such as payment details or shipping information.

$invoice->addTitle(title);

Add paragraph

You can add titles and paragraphs to display information on the bottom part of your document such as payment details or shipping information.

$invoice->addParagraph(paragraph);

Footer

A small text you want to display on the bottom left corner of the document.

$invoice->setFooternote(note);

Render

Render the invoice.

$invoice->render(name,output);

D) Examples - top

Example codes are also included inside the packeage .

Path: php-invoice/examples

Sample Usage:

            <?php
             	include('../phpinvoice.php');
                  $invoice = new phpinvoice("A5","$","en");
                  /* Header Settings */
                  $invoice->setLogo("images/example3.jpg");
                  $invoice->setColor("#AA3939");
                  $invoice->setType("Vente Facture");
                  $invoice->setReference("INV-55033645");
                  $invoice->setDate(date('M dS ,Y',time()));
                  $invoice->setDue(date('M dS ,Y',strtotime('+3 months')));
                  $invoice->setFrom(array("Vendeur Nom","Citroën","128 AA Juanita Ave","Île-de-France , DE 91740","France"));
                  $invoice->setTo(array("Nom de l'acheteur","Sanofi-Synthélabo","128 AA Juanita Ave","Île-de-France , DE 91740","France"));
                  
                  /* Adding Items in table */
                  $invoice->addItem("AMD Athlon X2DC-7450","2.4GHz/1GB/160GB/SMP-DVD/VB",1,"50%",100,"50%");
                  $invoice->addItem("PDC-E5300","2.6GHz/1GB/320GB/SMP-DVD/FDD/VB",1,50,100,50);
                  $invoice->addItem('LG 18.5" WLCD',"Test multilingue soutenu dans cette section en ajoutant personnalisée description du produit ici",1,0,100,0);
                  $invoice->addItem("HP LaserJet (Citroën)","Ceci est une description de test pour le produit HP LaserJet 5200",1,0,100,20);
                  /* Add totals */
                  // Make sure to add  "$invoice->items_total" first before adding other "addTotal()"
                  $invoice->addTotal("Sub Total",		$invoice->items_total);
                  $invoice->addTotal("VAT 10%", 	 	$invoice->GetPercentage(10));
                  $invoice->addTotal("Discount 10%", 	$invoice->GetPercentage(10),false,true);
                  $invoice->addTotal("Shipment", 		"100");
                  $invoice->addTotal("Grand Total",	 	$invoice->GetGrandTotal(),true);
                  
                  /* Set badge */ 
                  $invoice->addBadge("Invoice Copy");
                  /* Add title */
                  $invoice->addTitle("Important Notice");
                  /* Add Paragraph */
                  $invoice->addParagraph("No item will be replaced or refunded if you don't have the invoice with you. You can refund within 2 days of purchase.");
                  /* Set footer note */
                  $invoice->setFooternote("Footer Note Goes Here....");
                  
                  /* Hide Discount Column */
                  //$invoice->hideDiscountCol();
                  /* Hide VAT Column */	
                  //$invoice->hideVATCol();
                  
                  /* Render */
                  $invoice->render('example2.pdf','I'); 
                  /* I => Display on browser, D => Force Download, F => local path save, S => return document path */
            ?>
		

E) Sources and Credits - top

We would like to thank the creators of FPDF to create such an amazing PHP library that makes our work a lot easier.
http://www.fpdf.org/


Once again, thank you so much for purchasing this script. As I said at the beginning, I'd be glad to help you if you have any questions relating to this script. No guarantees, but I'll do my best to assist. If you have a more general question relating to the script on CodeCanyon, you might consider visiting the forums and asking your question in the "Item Discussion" section.

Farjad Tahir

Go To Table of Contents