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.
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).
tax value = (tax rate / 100) + 1
Example: tax rate is 22%
tax value = (22 / 100) + 1 = 1.22
unitary netto price = unitary brutto price / tax value
Example: unitary brutto price of 1 meter of cable is $2.56, tax rate is 22%
unitary netto price = $2.56 / 1,22 = $2.10
total brutto price = unitary brutto price * count
Example: unitary brutto price of 1 meter of cable is $2.56, number of meters is 1366, tax rate is 22%
total brutto price = $2.56 * 1366 m = $3496.96
total netto price = total brutto price / tax value
Example: unitary brutto price of 1 meter of cable is $2.56, number of meters is 1366, tax rate is 22%
total netto price = ($2.56 * 1366 m = $3496.96) / 1,22 = $2866.36
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]:
print_balance_history
If true on invoice (html) will be printed history of financial operations on customer account. Default: not set.
Example: print_balance_history = true
print_balance_history_limit
Records number on customer balance list on invoice. Specify last x records. Default: 10.
Example: print_balance_history_limit = 20000
When printing by default are displayed original and copy pages, it can be changed:
default_printpage
Coma-separated list of default invoice printout pages. You can use "original", "copy", "duplicate". Default: "original,copy".
Example: default_printpage = "original"
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
Almost every internet browser has printing configuration, where functions like header and footer or URL printing can be disabled. |
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.
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
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
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.
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
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.
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.