Code Example: Update Earnings Form (No Grid)

XML Forms Guide

Version
R2024.1.1
Code Example: Update Earnings Form (No Grid)

The following is an example of code for an update earnings form. The form can be used to request new earnings or change the scheduled amount of existing earnings.

Before You Begin: In this code, you need to define which specific earnings users can select. See Define Available Earnings.

Copy
<WF_DynamicForm>
    <DataClass>Employee</DataClass>
    <ValidationRule Event="OnSubmit" Type="PayrollEmployeeElectionValidationRule"/>
    <FormHeader>
        <Style>header</Style>
        <Title>Payroll Earning Election Request</Title>
    </FormHeader>
    <!-- Used Class for EmployeeEmploymentStatus-->
    <UsedClass>
        <Name>List_EmployeeEmploymentStatus</Name>
        <Mode>Current</Mode>
        <AddNewInstanceIfEmpty>true</AddNewInstanceIfEmpty>
        <DefaultStatus>Insert</DefaultStatus>
    </UsedClass>
    <UsedClass>
        <Name>List_EmployeeEarning</Name>
        <Mode>Current</Mode>
        <AddNewInstanceIfEmpty>true</AddNewInstanceIfEmpty>
        <DefaultStatus>Insert</DefaultStatus>
    </UsedClass>
    <EmployeeHeaderPanel>
        <Style />
    </EmployeeHeaderPanel>
    <FormBody>
        <Style>IVFormBody</Style>
        <Block>
            <Style />
            <NumberOfColumns>4</NumberOfColumns>
        </Block>
        <Field>
            <!-- Validation Control on Employee's Current Election Set-->
            <!-- Set InitialValue to True to only allow updates to existing elections set to False to allow new election requests-->
            <Style>IVCheckBox</Style>
            <BindingProperty>List_EmployeeEarning.DisableNewElection</BindingProperty>
            <IsRequired>False</IsRequired>
            <Visible>False</Visible>
            <InitialValue>False</InitialValue>
        </Field>
        <Panel>
            <Style>IVPanel</Style>
            <Caption>Payroll Election Request</Caption>
            <Row>1</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
        </Panel>
        <Label>
            <Style>IVLabel</Style>
            <Caption>lblEarning</Caption>
            <MarkAsRequired>True</MarkAsRequired>
            <Row>3</Row>
            <Column>0</Column>
        </Label>
        <Field>
            <Style>IVComboBoxDouble</Style>
            <Block>1</Block>
            <Row>4</Row>
            <Column>0</Column>
            <BindingProperty>List_EmployeeEarning.PREarningXrefCode</BindingProperty>
            <DataProvider>PREarnings</DataProvider>
            <DisplayMemberPath>Shortname</DisplayMemberPath>
            <SelectedValuePath>XRefCode</SelectedValuePath>
            <IsReadOnly>False</IsReadOnly>
            <Visible>True</Visible>
            <IsRequired>False</IsRequired>
            <InitialValue></InitialValue>
            <Filter>
                <FieldName>XRefCode</FieldName>
                <FieldValue>EarnXRef1;EarnXRef2</FieldValue>
            </Filter>
        </Field>
        <Label>
            <Style>IVLabel</Style>
            <Caption>lblStartDate</Caption>
            <MarkAsRequired>true</MarkAsRequired>
            <Row>3</Row>
            <Column>1</Column>
        </Label>
        <Field>
            <Style>IVDatePicker</Style>
            <Block>1</Block>
            <Row>4</Row>
            <Column>1</Column>
            <BindingProperty>List_EmployeeEarning.ElectEffectiveStart</BindingProperty>
            <IsRequired>False</IsRequired>
            <InitialValue>Function:now</InitialValue>
            <Visible>True</Visible>
        </Field>
        <Label>
            <Style>IVLabel</Style>
            <Caption>Calc Type</Caption>
            <MarkAsRequired>true</MarkAsRequired>
            <Row>5</Row>
            <Column>0</Column>
        </Label>
        <Label>
            <Style></Style>
            <Caption>Amount</Caption>
            <MarkAsRequired>True</MarkAsRequired>
            <Row>5</Row>
            <Column>1</Column>
        </Label>
        <Field>
            <Style>IVComboBoxDouble</Style>
            <Block>1</Block>
            <Row>6</Row>
            <Column>0</Column>
            <BindingProperty>List_EmployeeEarning.ValueType</BindingProperty>
            <DataProvider>AmountPercents</DataProvider>
            <DisplayMemberPath>ShortName</DisplayMemberPath>
            <SelectedValuePath>XRefCode</SelectedValuePath>
            <IsReadOnly>True</IsReadOnly>
            <Visible>True</Visible>
            <IsRequired>False</IsRequired>
            <InitialValue>AMOUNT</InitialValue>
        </Field>
        <Field>
            <Style>IVTextBox</Style>
            <Row>6</Row>
            <Column>1</Column>
            <BindingProperty>List_EmployeeEarning.Value</BindingProperty>
            <IsRequired>False</IsRequired>
            <Visible>True</Visible>
        </Field>
        <Label>
            <Style>IVLabel</Style>
            <Block>1</Block>
            <Row>7</Row>
            <Column>0</Column>
            <Caption>Schedule</Caption>
            <MarkAsRequired>false</MarkAsRequired>
        </Label>
        <Field>
            <Style>IVComboBoxDouble</Style>
            <Block>1</Block>
            <Row>8</Row>
            <Column>0</Column>
            <BindingProperty>List_EmployeeEarning.PREarnDeductScheduleCodeName</BindingProperty>
            <DataProvider>VisiblePREarnDeductSchedules</DataProvider>
            <DisplayMemberPath>Shortname</DisplayMemberPath>
            <SelectedValuePath>XRefCode</SelectedValuePath>
            <IsRequired>false</IsRequired>
            <Filter>
                <FieldName>XRefCode</FieldName>
                <FieldValue>EVERYPAY;EACHPAYPERIOD;1OFMTH;LASTOFMTH;1N2OFMTH;1N2N3N4OFMTH;1OFQTR;LASTOFQTR;1OFYEAR;LASTOFYEAR</FieldValue>
            </Filter>
        </Field>
        <Panel>
            <Style>IVPanel</Style>
            <Caption>Please Note</Caption>
            <Row>10</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
            <Visible>True</Visible>
        </Panel>
        <Label>
            <Style>InlineHelpLabel</Style>
            <Caption>Request for recurring payroll election will be routed for approval. Please contact your human resources department if you have any questions.</Caption>
            <MarkAsRequired>False</MarkAsRequired>
            <Row>11</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
        </Label>
        <SimpleComment>
            <Caption>Comment</Caption>
            <Row>12</Row>
            <Column>0</Column>
            <ColumnSpan>4</ColumnSpan>
            <BindingProperty>List_EmployeeEarning.EmployeeComment</BindingProperty>
        </SimpleComment>    
    </FormBody>
</WF_DynamicForm>