2.9. Documents

LMS makes possible to generate and to store various documents i.e. invoices, receipts and non-financial documents i.e. contracts, protocols and others. Documents can be numbered with numbering plans (patterns) defined in menu Configuration - Numbering Plans.

2.9.1. Calculation of tax value

Below is presented method used by LMS to calculate tax value. Values of all calculations are rounded to hundredths.

Unitary price in LMS database is brutto value (including tax).

2.9.2. Invoices

It's possible to issue invoices in either automatic or manual way. Manual invoices creation is possible in 'New Invoice' module from 'Finances' menu. Automatic issue might be helpful while you have legal contracts with your users. In this case invoices are created by lms-payments script or lmsd daemon.

For proper work of printouts you need to define division's invoices data (e.g. header, footer, default expositor, place, bank account) and configure some options in configuration section [invoices]:

Generated invoices can be viewed in two ways: by clicking on printer icon, in balance sheet page or by clicking 'Invoices List' in 'Finances' menu. In second case, is also possible to filter invoices for printing.

When printing by default are displayed original and copy pages, it can be changed:

2.9.2.1. HTML

Invoices are printed in html format by default using provided template. In [invoices] section you can also configure:

  • template_file

    Invoice template, which should be placed in templates directory. Default: invoice.html.

    Example: template_file = invoice-mynet.html

  • content_type

    Invoice content-type. If you enter here 'application/octet-stream' then browser will ask to save file on disk, instead of displaying it. It's useful if you use your own template which generate eg. rtf or xls file. Default: 'text/html'

    Example: content_type = application/octet-stream

  • attachment_name

    File name for saving finished invoice printout. WARNING: Setting attachment_name with default content_type will (in case of MSIE) print invoice + prompt for save on disk + bonus browser crash (6.0SP1 on WInXP). Default: empty.

    Example: attachment_name = invoice.xls

Generated invoice in HTML format consist of originals and copies, which are separated by CSS page-break markups, so every modern browser that supports CSS should print many-page invoices correctly. This behavior was tested on Microsoft Internet Explorer 6.0, Opera 7.02 and Mozilla 1.3.

Note

Almost every internet browser has printing configuration, where functions like header and footer or URL printing can be disabled.

2.9.2.2. PDF

It's possible to create invoices as PDF files. Setting option type in [invoices] section to 'pdf' will force invoice being created in PDF instead of html. Option template_file has the same meaning, with one difference, that it might take predefined values: 'standard' - basic invoice (invoice.html equivalent) and 'FT-0100' - invoice adjusted for printing on FT-0100 paper including payment form. You can set template_file option for php file name, but this feature is meant for advanced users as it requires you to create more complicated php file than the one used with html invoices Smarty template.

2.9.2.3. Automatic iban account number generation

LMS allows for automatic IBAN number generation. As of now it supports fixed lenght of 26 digits and 2 letters (letters are set fixed to PL -- POLAND). You need to specify 8 to 20 digits, the rest is taken as as-many-leading-zeros-as-needed plus Customer-ID Be aware that for example Cyprus and Hungary also use 26 digits. More on: Wikipedia

2.9.2.4. Credit Notes

Credit notes uses invoices settings from [invoices] section. Default invoice template include also credit notes contents, but you have possibility to define different template for credit notes (the rest of options is common for both invoices and credit notes):

  • cnote_template_file

    Credit note template, which should be placed in templates directory. Default: invoice.html.

    Example: cnote_template_file = invoice-mynet.html

2.9.3. Transfer forms

Transfer forms it's Polish specific feature. Data for payment form printouts is get from customer's division info. The title of payment can be set using 'pay_title' option in [finances] section.

2.9.4. Cash Receipts

2.9.4.1. HTML

Receipts are printed in html format by default using provided template. We chave one printout template for cash-in and cash-out receipts. In [receipts] section you can also configure:

  • template_file

    Cash receipt template, which should be placed in templates directory. Default: receipt.html.

    Example: template_file = /mytemplates/receipt.html

  • content_type

    Printout content-type. If you enter here 'application/octet-stream' then browser will ask to save file on disk, instead of displaying it. It's useful if you use your own template which generate eg. rtf or xls file. Default: 'text/html'

    Example: content_type = application/octet-stream

  • attachment_name

    File name for saving receipt printout. WARNING: Setting attachment_name with default content_type will (in case of MSIE) print document + prompt for save on disk + bonus browser crash (6.0SP1 on WinXP). Default: empty.

    Example: attachment_name = receipt.xls

2.9.4.2. PDF

It's possible to create receipts as PDF files. Setting option type in [receipts] section to 'pdf' will force document being created in PDF instead of html. Option template_file has the same meaning, with one difference, that it might take predefined value: 'standard' - basic receipt (receipt.html equivalent). template_file option can be set to PHP file name, but this feature is meant for advanced users as it requires you to create more complicated PHP script than the one used with html receipts Smarty template.

2.9.5. Other documents

Documents support is not limited to invoices. You might store virtually any documents you want in LMS, such as contracts, protocols, annexes and others. You can assign any number of documents to each customer in 'Customer documents' tab in 'Customer information' panel. Each document should have defined title, type and additionally you might define it's time span (time until when it's valid) and description. Document files are being stored outside of database (which should be kept in mind while doing backups!) in directory defined with doc_dir in [directories] section of config file.

Documents can be uploaded to system as prepared files, but also generated from templates with use of defined wizards. Here system gives great configuration possibilities. In directory documents/templates/default you can find default document wizard (template and engine). You can create unlimited number of own documents wizards, which must be placed in documents/templates/ directory.

Each wizard must have file info.php with specified structure:

<?php
$engine = array(
    'name' => 'default', 	// wizard (directory) name, lower case letters and numbers
    'engine' => 'default', 	// engine directory (engine.php)
    'template' => 'template.html', 		// template file (in 'name' directory)
    'title' => trans('Default document'), 	// description for LMS-UI
    'content_type' => 'text/html', 		// output file type
    'output' => 'default.html', 			// output file name
    'plugin' => 'plugin',			// plugin file name (in 'name' directory)
    'post-action' => 'post-action',		// action file executed after document addition (in transaction)
)
?>
File info.php define wizard and is required. To generate document is needed engine (file with name engine.php). You can create own engine or use other by setting 'engine' variable to appropriate wizard name. So, there is no need to create engine for each new wizard. Is enough to make 'template' template and file info.php.

Member plugin specify name of php file used for printing additional fields on document creation form. Plugin can also consist errors handlers for those fields. After document creation will be executed PHP script which name (without extension) should be specified in post-action value.