Custom fields
Settings > Site settings > Custom fields
Custom fields can be used for creating fields in the site that are necessary for you and also display them on the PDF files.
The list of custom fields has active and archived fields. If the field is active, it is displayed and usable.
In order to modify the status, click on it. Click on the name of the custom field to modify or delete it.
To create a custom field, click on Add.
For example, let's create a custom field "No. of products on quotes".
Add the input field caption, name will be created automatically.
For this example, we'll use the field type Number, but there are others in the list (complete list at the end of this article).
Set the width for the text box and choose modules (quotes), where you wish to have the field displayed.
If "Show as column in list" is checked, you can set the field as a separate column in the list of the chosen module.
If activating the choice "Filterable" there will be a separate filter among the main filters of the module's list view and the detailed work and financial report. To place the filter among the additional ones, activate "Display among additional filters".
If the field should not be visible in the editing view but only when adding a new quote select the check box "Is hidden in modify view".
With the options "Show in list infobar", "Sum" and "Average" you can determine if the information bar in the module list summarizes the information in the custom field, calculates the average, or displays both.
The "Width" setting determines whether, in case of more than 1 custom field, the fields are placed next to or below each other.
The custom field is now displayed when adding a quote.
If you add product count on quotes, it will be displayed on top of the list and in the column.
Added custom field "No. of products" is now displayed in the quote list in the columns drop down list.
You can change the order of the list by dragging.
You can sort the list by the added column.
The selectable types are:
- text - a text box with set height and width is displayed
- checkable textbox - a text box is displayed, the content can be edited
- selection - info is displayed on the PDF only when the checkbox is ticked
- drop-down list - a list of preset options is displayed
- date - enables the date picker
- duration - possibility to add information about duration in hours and minutes
- date and time - enables the date and time picker
- number - for entering numbers
- money - for monetary values
- numbering - for creating the automatic +1 numeration via the documents module
- formula - you can create formulas using simple mathematical functions (add, subtract, divide and multiply)
- image - possibility to add image files
- PHP code - you can use the PHP code, for example in order to create a reference number
- subheading - option to create subheading to divide a document into sections, for example
- relation - possibility to create relations, for example - add more than one user or contact to a quote
The information in duration, number and money type custom fields is summarized in the detailed work and financial report.
It is possible to add text in HTML format - enables bold, italic, underline, tables, bullets etc.
An example formula
If you have created fields Height and Width, you could add a field Area and use a formula.
Field caption is "Area".
Select the type "Formula". Formula line: [height]*[width]
Select the module(s) you wish to display it in.
More examples: sum [sum], VAT sum [vat_sum], discount percentage [discount] etc.
A reference number using PHP
$docNumber = $objectData['no'];
$number = '12345';
$number .= str_pad(substr($docNumber, -6), 6, '0', STR_PAD_LEFT);
$multipliers = array(7,3,1);
$length = strlen($number);
$sum = 0;
for ($i = $length - 1; $i >= 0; $i--) {
$sum += $number[$i] * $multipliers[($length - 1 - $i) % 3];
}
$number .= (10 - $sum % 10) % 10;
return $number;