Controlling accounting fields
Each field in the accounting form is an entry in the conf.AccountingFields table (see
Configuring accounting). This page describes how you control whether a field is
visible and editable, and how fields depend on each other.
Field status from the database
Section titled “Field status from the database”Without further configuration, what is stored in conf.AccountingFields applies:
Visible: whether the field is shown.Disabled: whether the field is locked.
Allowed values are "true" and "false", including the quotation marks. Instead of a fixed value
you can also store a simple expression that the form evaluates in the browser, for example:
!this.disableVatControlling field status from the backend
Section titled “Controlling field status from the backend”A field’s status can also be changed by the backend while the form is being edited, for example
depending on the selected account. For this, each accounting line has status properties such as
AccountVisibility. So that the form knows which field belongs to which property, enter the name of the
property in the VisibilityTarget column of conf.AccountingFields, for example
accountVisibility for the account field.
These values are possible:
| Value | Effect |
|---|---|
default (or empty) | The configuration from Visible and Disabled applies. |
activated | The field is shown and editable. |
deactivated | The field is shown but locked. |
hidden | The field is invisible, but its space in the form remains. |
removed | The field is removed; the following fields move up. |
forceRequired | The field is shown and must be filled in. |
noValidation | The field is shown; all checks on the field are dropped. |
replacedBy:NAME | The field is replaced by a template defined in the frontend named NAME. |
Example from a customer-specific validation plugin (derived from IrValidationManager):
protected virtual void LinePropertyChangedCostcenterId(ref UpdateIrCase updateIrCase, ref UpdateIrCaseResponse updateIrCaseResp, IrItemLine itemLine){ itemLine.AccountVisibility = IsSpecialCostcenter(itemLine.CostcenterId) ? "activated" : "hidden"; updateIrCaseResp.ForceAccountingFormReload = true;}The method runs when the cost center changes. Depending on the cost center, the account field is shown or hidden, and then the form is rebuilt.
Hiding the cost center for balance sheet accounts
Section titled “Hiding the cost center for balance sheet accounts”A common request: if a balance sheet account is selected in the account field, the cost center field should disappear. This works without an additional form.
-
Master data: whether an account is a balance sheet account is stored in
Mstr.Accountsin theIsBalanceSheetAccountcolumn. The master data import usually fills this column through its mapping configuration. -
Cost center field: for the cost center field, enter in the
Visiblecolumn:!this.isBilanzkontoThe form sets
isBilanzkontoautomatically as soon as a balance sheet account is selected. -
Account field (optional): for the account field, enter in the
ColSpancolumn:getColumnSpanDependingOnIsBilanzkontoThe account field then becomes twice as wide for a balance sheet account (20 instead of 10) and fills the space of the hidden cost center.
Restricting the selection
Section titled “Restricting the selection”Which accounts and cost centers are available in the form can be restricted through master data tables:
| Table | Effect |
|---|---|
Mstr.AccountCostCenters | For a selected account, only the assigned cost centers are available. |
Mstr.AccountGroups | For a group (for example “Kitchen”), only the assigned accounts are available. |
Mstr.CostCenterAccountGroups | For a group, only the assigned cost centers are available. |
Width of selection lists
Section titled “Width of selection lists”In the DropDownOptions column of conf.AccountingFields you set the width of the drop-down list for a
selection field:
{ "minWidth": "15vw", "width": "300", "resizeEnabled": true}With resizeEnabled, users can drag the list larger themselves.
