Skip to content

Configuring expenses

With the expense process, employees record business expenses, either directly in invoiceR or with the mobile app. In addition to the photo or scan of the receipt, an expense form asks for further details about the expense. This form can be customized extensively and designed differently per role.

TableContent
conf.ExpenseFormsthe forms, for example “Standard” and “Management”. Each form belongs to a role.
conf.ExpenseCategoriesthe categories of an expense, for example lunch, car journey, train journey
conf.ExpenseFieldsthe form fields, for example cost center or number of people
conf.ExpenseFormFieldslinks forms, categories and fields

This is how recording works:

  1. The user gets the form they have access to through their roles.
  2. conf.ExpenseFormFields determines which categories the form offers.
  3. The user chooses a category.
  4. invoiceR shows the fields stored for this category.

You maintain the categories of an organization unit in the user interface:

  1. Open Administration > Organization Units.
  2. Click the purple credit card icon next to the organization unit (Spesen-Optionen bearbeiten, edit expense options). If there are no expense options yet, right-click and create them under Expense options.

For each category you define, among other things, the title, AI description, default account, cost center and project, and the related fields.

Expense options window of an organization unit with the list of categories and the edit area of a category

There can be one or more forms, for example a standard form and one for external staff. Which role may use a form is stored in conf.ExpenseForms.VisibleFilterRoleId.

Further columns in conf.ExpenseForms:

ColumnMeaning
Name, Descriptionname of the form
BackendUrladdress to which the mobile app sends the recorded data. Each form can have its own recipient, for example a gateway in the DMZ.
CustomerTokenGUID the recipient uses to recognize which customer the data belongs to
IrVersionversion of the data format (currently 0.1.0)

The field type is stored in conf.ExpenseFields.Type. Depending on the type, different parameters can be set as JSON in conf.ExpenseFields.Options.

TypeFieldOptions
1 Inputsingle-line text, for example “Lunch with customer”minLength, maxLength, default
2 Datedate, for example “Valid from”allowPast, allowToday, allowFuture (each true/false)
3 Radiochoice from fixed values, for example a cost centerthe choices as key and text
4 Numbernumber, for example number of peopleminValue, maxValue, default
5 Kmkilometres, with help for calculating the distanceminValue, maxValue, default
6 Textmulti-line text, for example a noteminLength, maxLength
7 Hiddenhidden field that is not displayeddepending on use

Examples for Options:

{ "minLength": 5, "maxLength": 30, "default": "Meal" }
{ "allowPast": true, "allowToday": true, "allowFuture": false }
{ "1000": "Cash", "1010": "Bank", "1020": "Third-party account" }
{ "minValue": 0, "maxValue": 500, "default": 20 }

Sometimes the choices should not be fixed in the form, for example because each user sees different cost centers. Instead of creating a separate form for each user, fill in conf.ExpenseFields.OptionsSource. invoiceR then loads further values in addition to Options.

OptionsSource has the form method://parameter. Currently there is the SQL method: the part after :// is a query on the invoiceR database. The first column becomes the key, the second the displayed text.

SQL://SELECT [Id], [EmailAddress] FROM [dbo].[AbpUsers] WHERE Id = @UserId

invoiceR replaces these placeholders before running the query:

PlaceholderValue
@UserIdId of the current user
@UserNameuser name of the current user
@ExpenseCategoryAdditionalStr1 to @ExpenseCategoryAdditionalStr5additional fields 1 to 5 of the selected category