This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation. |
Difference between revisions of "Billing"
(→Creating a custom PDF script) |
(adding finance access rights info) |
||
(17 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
==Setting it up== | ==Setting it up== | ||
+ | |||
+ | Note: we're working on a new manual here: https://www.group-office.com/docs/admin/billing.html | ||
First you need to setup the books, statuses and templates. Three default books have been created for you. They are called: Invoices, Orders and Quotes. In these books you create items and they can be duplicated to other books. A copy of the original Quote or Order will always remain. | First you need to setup the books, statuses and templates. Three default books have been created for you. They are called: Invoices, Orders and Quotes. In these books you create items and they can be duplicated to other books. A copy of the original Quote or Order will always remain. | ||
Line 35: | Line 37: | ||
Billing -> Administration -> Double click the book -> Statuses | Billing -> Administration -> Double click the book -> Statuses | ||
− | In the e-mail template you can use a number of variables. You can find them at [[Billing E-mail template variables]]. | + | In the '''e-mail template''' and subject you can use a number of variables. You can find them at [[Billing E-mail template variables]]. |
Line 41: | Line 43: | ||
===Custom fields on the template=== | ===Custom fields on the template=== | ||
− | If you create custom fields for an invoice you can put them on the template left and right column using % | + | If you create custom fields for an invoice you can put them on the template left and right column using %col_1%. If you want to autofill the custom field in an order from the addressbook you must create the field for companies or contacts to with an identical name. It will automatically fill in the order when you select the customer. |
===Creating a custom PDF script=== | ===Creating a custom PDF script=== | ||
Line 51: | Line 53: | ||
The PDF class is an extended class of the TCPDF class. Read more about it at http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf | The PDF class is an extended class of the TCPDF class. Read more about it at http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf | ||
+ | |||
+ | ===Creating Open Office documents=== | ||
+ | You can also create odt templates so that you can edit invoices after creating them. You can use the same [[Billing E-mail template variables|variables]]. Here's an example document [[File:Sample invoice.odt]] | ||
==General usage== | ==General usage== | ||
Line 57: | Line 62: | ||
[[Image:Order_info_panel.png|right|thumb|View order information]] | [[Image:Order_info_panel.png|right|thumb|View order information]] | ||
===Creating an invoice=== | ===Creating an invoice=== | ||
− | Click on 'Add' to create a new invoice. Type in the company name. The system will search through the addressbook and autocomplete all fields it finds in your addressbook. Now continue to the items tab and fill in products / services. You can also add products from the catalog here. When you are finished you can set a status for it. You can select "Notify customer" and the e-mail and PDF associated with that status will be sent to the customer if an e-mail address is defined in the invoice. You can also | + | Click on 'Add' to create a new invoice. Type in the company name. The system will search through the addressbook and autocomplete all fields it finds in your addressbook. Now continue to the items tab and fill in products / services. You can also add products from the catalog here. If you want to invoice time entries from a project, then the project must be set to "post calculation" and you click on "Invoice" at the Project Module. |
+ | |||
+ | When you are finished you can set a status for it. You can select "Notify customer" and the e-mail and PDF associated with that status will be sent to the customer if an e-mail address is defined in the invoice. You can also send the mail manually by clicking the 'e-mail' button. | ||
====Creating recurring invoices==== | ====Creating recurring invoices==== | ||
It's easy to create recurring invoices. Just select the recurrence interval at the 'Properties' tab of an invoice. This will schedule a next invoice at the moment this invoice gets a status assigned. When the next recurrence is ready to be sent it will appear as scheduled in the list. You can send out all scheduled orders at once using the 'Batch jobs'. | It's easy to create recurring invoices. Just select the recurrence interval at the 'Properties' tab of an invoice. This will schedule a next invoice at the moment this invoice gets a status assigned. When the next recurrence is ready to be sent it will appear as scheduled in the list. You can send out all scheduled orders at once using the 'Batch jobs'. | ||
+ | |||
+ | =====Printing the period===== | ||
+ | If you have a recurring invoice it can be useful to print the period. You can do this with these tags in the items: | ||
+ | |||
+ | {date:d-m-Y} till {nextdate:d-m-Y} | ||
+ | |||
+ | or for billing afterwards (Since 4.1.55): | ||
+ | |||
+ | {prevdate:d-m-Y} till {date:d-m-Y} | ||
+ | |||
+ | The date format is identical to the [http://php.net/manual/en/function.date.php PHP date function] | ||
+ | |||
+ | ===Closing text=== | ||
+ | Among others, you can predefine the closing text for your invoices. You can do that in Billing module > Administration > Settings > (double-click on a book) > PDF templates > (double-click on a template) > Texts. You can even set the closing text for invoices that have not yet been paid, have been partially paid, and have been fully paid. Here is an example closing text that behaves differently depending on how much of the invoice has been paid for: | ||
+ | <pre> | ||
+ | Terms | ||
+ | Put your terms here. | ||
+ | <gotpl if="nothing_paid"> Nothing paid. Amount to be paid within two weeks: {to_be_paid}.</gotpl> | ||
+ | <gotpl if="partially_paid"> Partially paid. Already paid: {total_paid}. Amount to be paid within two weeks: {to_be_paid}.</gotpl> | ||
+ | <gotpl if="fully_paid"> Fully paid: {total}. Thank you very much.</gotpl> | ||
+ | </pre> | ||
+ | Try it! Copy-paste the above text to your invoice template's closing text, and then create different invoices with this template, having different values for how much of the invoice has been paid for. You will see different closing texts, depending on how much of the invoice has been paid for. | ||
===Duplicating orders, invoices or quotes=== | ===Duplicating orders, invoices or quotes=== | ||
Line 76: | Line 105: | ||
===Catalog=== | ===Catalog=== | ||
In the catalog you can organize all your products. You can quickly add those to quotes, orders and invoices in the items panel. | In the catalog you can organize all your products. You can quickly add those to quotes, orders and invoices in the items panel. | ||
+ | |||
+ | ===Creating invoices from projects === | ||
+ | On the Project tab, select Invoice. If you do not see this icon, the SuperAdmin has to add you to the group "Finance permissions" (in the administration tab of projects). | ||
+ | Choose the period and add a set of parameters which define what is being printed in each position line. Here is an example which should work for most invoices with time entries: | ||
+ | {project_name}: {registering_user_name}: {date}: {units} h: {comments} | ||
+ | Additional fields which are available: | ||
+ | {days}, {description} (= generic description text of the project) | ||
+ | |||
+ | ==Changing the VAT percentage== | ||
+ | When the VAT percentage changes in your country. You will need to update your catalog and scheduled orders. There's no function for this but you can easily change the values with some SQL queries using PHPMyAdmin: | ||
+ | |||
+ | <pre> | ||
+ | #change the catalog | ||
+ | update bs_products set vat=21; | ||
+ | update bs_products set total_price=list_price*((100+vat)/100); | ||
+ | |||
+ | #update orders from the 1st of october | ||
+ | update bs_items set vat=21 where order_id in (SELECT id FROM `bs_orders` WHERE btime>=unix_timestamp("2012-10-01")); | ||
+ | update bs_items set unit_price = unit_total/1.21 where vat=21; | ||
+ | </pre> | ||
+ | |||
+ | After these changes the order totals are out of sync. You can correct that by running the following URL in the browser: | ||
+ | |||
+ | http://YOURDOMAIN/groupoffice/?r=billing/order/syncOrdersWithItems | ||
+ | |||
+ | Note: You must be logged in and you need at least version 4.0.108. |
Latest revision as of 17:29, 18 January 2016
Setting it up
Note: we're working on a new manual here: https://www.group-office.com/docs/admin/billing.html
First you need to setup the books, statuses and templates. Three default books have been created for you. They are called: Invoices, Orders and Quotes. In these books you create items and they can be duplicated to other books. A copy of the original Quote or Order will always remain.
Languages
You can setup multiple languages at:
Administration -> Languages
You can enter multiple translations for templates and products in the catalog.
Changing the sequential numbers
By default GO creates a number like Q200900001 for a quote and I200900001 for an invoice. You can change this number at:
Administration -> Books -> Double click book
- %y will be replaced by the full 4 digit year.
- %m will be replaced by the 2 digit month number
- %r will be replaced by a random digit between 0 and 9. This variable can be used multiple times.
- {autoid} will be replaced by the automatic generated id in the database. When not used the ID is appended to the number.
Setting up templates and statuses
First you've got to setup PDF and e-mail templates. Templates are linked to order statuses. Each order status has a unique e-mail template and a linked PDF template. When you change an invoice to another status the PDF and outgoing e-mail will change as well to match that status.
When the billing module is installed it creates some default books and templates. To change a PDF template goto:
Billing -> Administration -> Double click the book -> Templates
When you change the logo you should use a logo that is about twice as big as the logo appears on screen. After you uploaded the logo you should divide the detected image size by 2. (Select the logo, click 'Apply', divide the detected values, click 'Ok' or 'Apply' again.
Download an example invoice PDF
To change an e-mail template or to link another PDF template to an order status goto:
Billing -> Administration -> Double click the book -> Statuses
In the e-mail template and subject you can use a number of variables. You can find them at Billing E-mail template variables.
Note: If you have problems with characters that don't appear correct please read this page: Installing PDF fonts
Custom fields on the template
If you create custom fields for an invoice you can put them on the template left and right column using %col_1%. If you want to autofill the custom field in an order from the addressbook you must create the field for companies or contacts to with an identical name. It will automatically fill in the order when you select the customer.
Creating a custom PDF script
Sometimes the default PDF does not suit your needs. In that case you can program your own PDF creator script. All you need to do is copy modules/billing/Pdf.php and put the path to the new file in config.php like this:
$config['billing_pdf_class']='/any/path/to/Pdf.php';
The PDF class is an extended class of the TCPDF class. Read more about it at http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf
Creating Open Office documents
You can also create odt templates so that you can edit invoices after creating them. You can use the same variables. Here's an example document File:Sample invoice.odt
General usage
Creating an invoice
Click on 'Add' to create a new invoice. Type in the company name. The system will search through the addressbook and autocomplete all fields it finds in your addressbook. Now continue to the items tab and fill in products / services. You can also add products from the catalog here. If you want to invoice time entries from a project, then the project must be set to "post calculation" and you click on "Invoice" at the Project Module.
When you are finished you can set a status for it. You can select "Notify customer" and the e-mail and PDF associated with that status will be sent to the customer if an e-mail address is defined in the invoice. You can also send the mail manually by clicking the 'e-mail' button.
Creating recurring invoices
It's easy to create recurring invoices. Just select the recurrence interval at the 'Properties' tab of an invoice. This will schedule a next invoice at the moment this invoice gets a status assigned. When the next recurrence is ready to be sent it will appear as scheduled in the list. You can send out all scheduled orders at once using the 'Batch jobs'.
Printing the period
If you have a recurring invoice it can be useful to print the period. You can do this with these tags in the items:
{date:d-m-Y} till {nextdate:d-m-Y}
or for billing afterwards (Since 4.1.55):
{prevdate:d-m-Y} till {date:d-m-Y}
The date format is identical to the PHP date function
Closing text
Among others, you can predefine the closing text for your invoices. You can do that in Billing module > Administration > Settings > (double-click on a book) > PDF templates > (double-click on a template) > Texts. You can even set the closing text for invoices that have not yet been paid, have been partially paid, and have been fully paid. Here is an example closing text that behaves differently depending on how much of the invoice has been paid for:
Terms Put your terms here. <gotpl if="nothing_paid"> Nothing paid. Amount to be paid within two weeks: {to_be_paid}.</gotpl> <gotpl if="partially_paid"> Partially paid. Already paid: {total_paid}. Amount to be paid within two weeks: {to_be_paid}.</gotpl> <gotpl if="fully_paid"> Fully paid: {total}. Thank you very much.</gotpl>
Try it! Copy-paste the above text to your invoice template's closing text, and then create different invoices with this template, having different values for how much of the invoice has been paid for. You will see different closing texts, depending on how much of the invoice has been paid for.
Duplicating orders, invoices or quotes
It's easy to duplicate items. It's very useful when you start off with a quote, when this quote is accepted you can duplicate it to an order and finally duplicate that order to an invoice. To do so just select a quote for example and click at Actions -> Duplicate at the right pane. A small dialog pops up that allows you to change the status of the selected item and you can select the book to duplicate the quote to. You can select the status "Quote accepted" for example and duplicate it to the orders book. When you work at this order some things might be added to the order and when the job is done you can repeat the duplication process to create your invoice.
Batch job
With a batch job you can change multiple order statuses at once. It's very useful to send out all scheduled orders or to remind all users about an invoice that hasn't been paid yet. Click on 'Batch jobs' and select a from status and a too status. For example from: None to: Waiting for payment to send out scheduled orders. Optionally you can select a time period. Click on notify customers to send out the PDF invoices and e-mails too. You can also export those batch jobs to CSV.
Reports
When you click the "Reports" button you can view all the income and expenses per month, quater or year. When you doubleclick a month or quarter you'll get more detailed information including intracommunity sales and export sales information.
Expenses
You can also record your companies expenses for reporting purposes. You can export those values too.
Catalog
In the catalog you can organize all your products. You can quickly add those to quotes, orders and invoices in the items panel.
Creating invoices from projects
On the Project tab, select Invoice. If you do not see this icon, the SuperAdmin has to add you to the group "Finance permissions" (in the administration tab of projects). Choose the period and add a set of parameters which define what is being printed in each position line. Here is an example which should work for most invoices with time entries: {project_name}: {registering_user_name}: {date}: {units} h: {comments} Additional fields which are available: {days}, {description} (= generic description text of the project)
Changing the VAT percentage
When the VAT percentage changes in your country. You will need to update your catalog and scheduled orders. There's no function for this but you can easily change the values with some SQL queries using PHPMyAdmin:
#change the catalog update bs_products set vat=21; update bs_products set total_price=list_price*((100+vat)/100); #update orders from the 1st of october update bs_items set vat=21 where order_id in (SELECT id FROM `bs_orders` WHERE btime>=unix_timestamp("2012-10-01")); update bs_items set unit_price = unit_total/1.21 where vat=21;
After these changes the order totals are out of sync. You can correct that by running the following URL in the browser:
http://YOURDOMAIN/groupoffice/?r=billing/order/syncOrdersWithItems
Note: You must be logged in and you need at least version 4.0.108.