Amount or Percent Value

XML Forms Guide

Version
R2024.1.1
Amount or Percent Value

You can configure payroll election request forms to include the Amount/Percent selection field and Value field. Users can select the Percent or Amount option from the Amount/Percent selection field and then enter a respective percentage or flat amount for the deduction in the Value field.

An error is returned when users submit the form if the deduction selected doesn't support the Percent or Amount option based on the settings defined in the Deductions tab of Payroll Setup > Earnings and Deductions. For example, a user selects Percent from the Amount/Percent field but the deduction only allows flat amounts to be entered.

The following is an example of code for the Amount/Percent field. When the <Binding Property> tag is set to EmployeeDeduction.ValueType, users can select Percent or Amount from the field:

Copy
<Field>
    <Style>VComboBox</Style>
    <Block>1</Block>
    <Row>6</Row>
    <Column>0</Column>
    <BindingProperty>EmployeeDeduction.ValueType</BindingProperty>
    <DataProvider>AmountPercents</DataProvider>
    <DisplayMemberPath>ShortName</DisplayMemberPath>
    <SelectedValuePath>XRefCode</SelectedValuePath>
    <IsReadOnly>False</IsReadOnly>
    <Visible>True</Visible>
    <IsRequired>False</IsRequired>
</Field>

The following is an example of the code for the Value field. When the <Binding Property> tag is set to EmployeeDeduction.Value, the value users enter corresponds to the option selected from the Amount/Percent field:

Copy
<Field>
    <Style>IVTextBox</Style>
    <Row>6</Row>
    <Column>1</Column>
    <BindingProperty>EmployeeDeduction.Value</BindingProperty>
    <IsRequired>False</IsRequired>
    <Visible>True</Visible>
</Field>

You can also configure the form to offer only one method by specifying that method in the Amount/Percent field and hiding the field from editing. If you do this, you should also change the text label of the Value field to "Percent" or "Amount" so that users know what value they need to enter.

You can configure this in the Amount/Percent field as follows:

  • Set the <Visible> tag to False so that the field isn't visible to users filling out the form.
  • Set <InitialValue> tag to either AMOUNT or PCT so that it’s the default selection. In the example below, it’s set to PCT for percentage.
Copy
<Field>
    <Style>VComboBox</Style>
    <Block>1</Block>
    <Row>6</Row>
    <Column>0</Column>
    <BindingProperty>EmployeeDeduction.ValueType</BindingProperty>
    <DataProvider>AmountPercents</DataProvider>
    <DisplayMemberPath>ShortName</DisplayMemberPath>
    <SelectedValuePath>XRefCode</SelectedValuePath>
    <IsReadOnly>False</IsReadOnly>
    <Visible>False</Visible>
    <InitialValue>PCT</InitialValue>
    <IsRequired>False</IsRequired>
</Field>