Configure invoices

1/ Invoice PDF A4

First, add you logo in 'Settings/Printing/Logo'.

You can configure your invoice layout in 'Settings/Printing/Invoice PDF A4'.
For your invoice header, you can select a template. Click on it to apply it.
You can modify the html content and add the required legal information about your company (address, registration number…).
The header and footer heights are limited. If it is too short you should use the advanced PDF documents application (see section II/).

In the sale content of the invoice, each product line is displayed with the product ID, the product name (with the variant if exists), the quantity, the unit price excl. tax, the total price excl. tax, the tax and the total price incl. tax.
Then taxes are broken down by tax rate.

In 'Settings/Users/Access management', you can enable rights to display on your PDF A4: the product supplier code, the product description or the notes on the product line.
If you enable the right 'Print sale notes', you can print specific information on your PDF A4 like sales terms or legal information (add them first in the Notes of the sale).

When you email a receipt/invoice to your customer, the PDF A4 will be attached to the email.


2/ Advanced invoices and PDF documents

In the Apps section of your account, install the PDF documents application.

This application enables to create templates (in .odt) for your printing documents (invoices, quotations...).
These templates can be created from your text editor (Libre office, Word…) and are using codes (available in the application documentation) to set up the content of your document.
You can download some standard templates.

You can create several different templates for your quotations, purchase orders, delivery notes, invoices…
You can completely customize the document with a specific size (A4, A5, 3-1/8”…) and add any other data like terms of sale.

To print your document in PDF from a sale, select the template in the Action drop down-menu (at the top right corner of the sale).
In 'Settings/Printing/Invoice PDF A4', you can select one of your templates as the default PDF A4 document to be printed when you click on the 'PDF A4' button in a sale.


3/ Generate automatically your PDF document

You can generate automatically your PDF document with a PHP script.

Here is an example of this script. You need to enter:

  • a Token: available in the PDF documents application on your account (Apps section),
  • a Template: name of the template used among templates created in the PDF documents application,
  • an Account: name of your account,
  • a Sale-no: the sale number for which you want to generate the document.
<?locale=en&php
/**
*
*
* @author: Hiboutik
* @email contact[at]hiboutik.com
*
***********************************************************************************************************************
* @licence GPLv3 as in "https://gnu.org/licenses/gpl.html"
***********************************************************************************************************************
*
* Ce script permet de récupérer une facture au format PDF
* Token : cf app "Documents PDF"
* Template : l'intitulé de votre modèle de facture
*
*/

$token = "IqKSpo8B2etlO6Pci829deg7ZPLFOCmfX4Jxigbd";
$template = "ticket";
$sale_no = 24349;
$account = "moncompte";

/// POST data
$data = [
'token' => $token,
'template' => $template,
'sale_no' => $sale_no,
];
// Setup cURL
$ch = curl_init("https://pdf.hiboutik.net/pdf/?locale=en&account=$account");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data,
]);
$response = curl_exec($ch);

// Check for errors
if (curl_errno($ch) === 0 && curl_getinfo($ch, CURLINFO_RESPONSE_CODE) === 200) {
// Stream file
header("Content-Description: File Transfer");
header("Content-Type: application/octet-stream");
header("Content-Disposition:attachment;filename=\"facture_$sale_no.pdf\"");
header("Expires: 0");
header("Cache-Control: must-revalidate");
header("Pragma: public");
header("Content-Length: '.strlen($response)");
print $response;
} else {
// Show errors
print 'CURL error: '.curl_error($ch)."\n";
print 'HTTP status '.curl_getinfo($ch, CURLINFO_RESPONSE_CODE)."\n";
print_r(json_decode($response, true));
}
curl_close($ch);