GenerateBillDetail

This rule is attached to a transaction and included in the TransactionBusinessRulesPacket. GenerateBillDetail will be the interface between the transaction and the AsBillDetail table records. When the activity executes, the rule will process and for each BillDetail element whose tests resolve to true (or no tests are present), a bill detail record will be created.

GenerateBillDetail allows to action and update a single or multiple bill details from one activity. It uses a collection wherever multiple bill details needs to be updated. An Object array of fields is used to pass multiple BillDetails in the <BillDetailAarray> configuration where each line in the array would correspond to one Bill Detail:

  • If the BILLDETAILARRAY is specified in the rule header then the data in the array is used to generate the bill details.
  • If the BILLDETAILARRAY is NOT specified then the existing rule configuration is used to generate the bill detail.
  • If the BILLDERAILARRAY is used the array must be defined and built within the main activity.
  • The use of a BILLDEATILARRAY and the existing configuration are mutually exclusive within the BR configuration.

The BILLDETAILARRAY requires the following information:

  • RECEIVABLEDUETYPE
  • BILLGROUPGUID
  • BILLGROUPTYPE
  • BILLENTITYGUID
  • BILLENTITYTYPE
  • DUEDATE
  • BILLAMOUNT

The array also contains any fields that are currently defined the <Field> configuration. If the array data is not populated correctly on any billing item then an error message, "Bill detail array error" gets displayed.

Note: Populating a record would be the same as loading the BillDetailScreen to get the default fields then using similar syntax as the ACTIVITY type, replace the values then put into an Object Array.

GenerateBillDetail: Elements and Attributes
Element/Tag Attributes Parent Element Description Element/Attribute Values

<GenerateBillDetail>

 

The opening element

 
<BillDetailArray>    

Optional:

Contains the details for the Bill receivable or due.

Multiple bill details can be passed using <BillDetailArray> <BillDetailArray> and <BillDetail> are mutually exclusive. This means a single bill details will be passed using <BillDetail> or multiple bill details can be passed using <BillDetailArray>

 

<BillDetail>

  <GenerateBillDetail>

Required & Repeatable Element:

Contains the detail for the Bill receivable or due

 
  RECEIVABLEDUETYPE  

Required Element:

Defines the code value of the money (receivable) due.

Examples could be premium, fees or loan repayments.

Literal Value of Math variable containing a code value from AsCodeReceivableDueType

  BILLGROUPGUID  

Required Element:

Defines the entity GUID that the bill detail is to be associated with such as a class, list bill, aggreement or group customer. Used by the FindBillDetail activity function when building a bill.

Literal Value of Math variable containing a bill group GUID

  BILLGROUPTYPE  

Required Element:

A user defined code that indicates what entity the BillGroupGUID comes from.

Literal Value of Math variable containing a code from AsCodeBillGroupType

<Tests>

 

<BillDetail>

Optional Element:

Standard tests section that indicates if the BillDetail element should process. All tests contains Billl to process

 

<Test>

 

<Tests>

Optional and Repeatable Element:

Standard test expression

 

<BillAmount>

 

<BillDetail>

Required Element:

Holds the currency amount of receivable/ due.

Math Variable containing a currency amount

 
 

BILLENTITYGUID

 

Required Element:

Defines the entity that the receivable due will credit. Usually a policy, client or segment.

Math Variable containing an entity GUID

  BILLENTITYTYPE  

Required Element:

A user defined code that indicates what entity the BillEntityGUID comes from.

Literal Value of Math variable containing a code from AsCodeBillEntityType.

 
  DUEDATE  

Required Element:

The date the receivable due is expected to be paid.

Value should be a Math Variable containing a date.

<Fields>

  <BillDetail>

Optional Element:

Specifies dynamic fields to insert from the BillDetailScreen definition

 

<Field>

  <Fields>

Required and Repeatable Element:

Standard create fields syntax

 
<From>   <Field>

Required Element:

Defines the field or math variable the value will come from

 
<To>   <Field>

Required Element:

Names the bill detail field the value will go to.

 
<OptionText>   <Field>

Optional element:

Identifies the source of the data that will update the OptionText for the field defined in the <To> element.

Note: This element and the <OptionTextCollection> element are mutually exclusive.

MathVariable

XML Schema

<GenerateBillDetail>
<BillDetail RECEIVABLEDUETYPE="[AsCodeValue]" BILLGROUPGUID="[MathVariable GUID]" BILLGROUPTYPE="[AsCodeValue]">
<Tests>
<Test>[test expression]</Test>
</Tests>
<BillAmount BILLENTITYGUID="[MathVariable GUID]" BILLENTITYTYPE="[AsCodeValue]" DUEDATE="[MathVariable Date]">[MathVariable Currency Amount]</BillAmount>
<Fields>
<Field>
<From>[MathVariable or Field]</From>
<To>[Literal Field Name]</To>
<OptionText>[MathVariable]</OptionText>
</Field>
</Fields>
</BillDetail>
</GenerateBillDetail>

XML Example

GenerateBillDetail with Single Bill Detail

<GenerateBillDetail>
<BillDetail RECEIVABLEDUETYPE="ReceivableDueTypeMV" BILLGROUPGUID="BillGroupGUIDMV" BILLGROUPTYPE="BillGroupTypeMV">
<Tests>
<Test>1=1</Test>
</Tests>
<BillAmount BILLENTITYGUID="BillEntityGUIDMV" BILLENTITYTYPE="BillEntityTypeMV" DUEDATE="BillDueDateMV">BillDueAmountMV</BillAmount>
<Fields>
<Field>
<From>BillDetailCreationDateMV</From>
<To>BillDetailCreationDate</To>
<OptionText>BillDetailCreationDateOptionText</OptionText>
</Field>
</Fields>
</BillDetail>
</GenerateBillDetail>

GenerateBillDetail with Multiple Bill Details

<GenerateBillDetail>
<BillDetailArray>BillDetailRecordArray</BillDetailArray>
</GenerateBillDetail>

Activity Configuration to create the Bill Detail Array

<Transaction>
    <EffectiveDate STATUS="Enabled" TYPE="SYSTEM"/>
    <Fields>
        <Field>
            <Name>BillDueDate</Name>
            <Display>Bill Due Date</Display>
            <DataType>Date</DataType>
            <Required>Yes</Required>
        </Field>
        <Field>
            <Name>BillDueAmount</Name>
            <Display>Bill Due Amount</Display>
            <DataType>Money</DataType>
            <Required>Yes</Required>
        </Field>
        <Field>
            <Name>Amount1</Name>
            <Display>Bill Due Amount1</Display>
            <DataType>Money</DataType>
            <Required>Yes</Required>
        </Field>
        <Field>
            <Name>Amount2</Name>
            <Display>Bill Due Amount2</Display>
            <DataType>Money</DataType>
            <Required>Yes</Required>
        </Field>
        <Field>
            <Name>PolicyGUID</Name>
            <Display>Policy GUID</Display>
            <DataType>Text</DataType>
            <Required>Yes</Required>
        </Field>
        <Field>
            <Name>BillGroupType</Name>
            <Display>Bill Group Type</Display>
            <DataType>Combo</DataType>
            <Query TYPE="SQL">SELECT CodeValue,ShortDescription FROM AsCode WHERE CodeName = 'AsCodeBillGroupType' AND CodeValue IN ('CLASS','GROUP')</Query>
            <DefaultValue>GROUP</DefaultValue>
        </Field>
        <Field>
            <Name>GroupCustomerGUID</Name>
            <Display>Group Customer</Display>
            <DataType>Combo</DataType>
            <Query TYPE="SQL">SELECT AsGroupcustomer.GroupcustomerGUID, AsClient.Companyname FROM AsClient JOIN AsGroupcustomer ON AsClient.ClientGUID = AsGroupCustomer.ClientGUID JOIN AsAgreement ON AsGroupCustomer.ClientGUID = AsAgreement.GroupCustomerClientGUID JOIN AsPlanAgreement ON AsAgreement.AgreementGUID = AsPlanAgreement.AgreementGUID JOIN AsPlan ON AsPlanAgreement.PlanGUID = AsPlan.PlanGUID JOIN AsPolicy ON AsPlan.PlanGUID = AsPolicy.PlanGUID WHERE AsPolicy.PolicyGUID ='[PolicyGUID]'</Query>
            <Disabled>Yes</Disabled>
            <Expanded>Yes</Expanded>
        </Field>
        <Field>
            <Name>Class</Name>
            <Display>Class</Display>
            <DataType>Combo</DataType>
            <Hidden>Yes</Hidden>
        </Field>
        <Field>
            <Name>BillEntityType</Name>
            <Display>Bill Entity Type</Display>
            <DataType>Combo</DataType>
            <Query TYPE="SQL">SELECT CodeValue,ShortDescription FROM AsCode WHERE CodeName = 'AsCodeBillEntityType' AND CodeValue IN ('CLIENT','POLICY','SEGMENT')</Query>
            <DefaultValue>POLICY</DefaultValue>
        </Field>
        <Field>
            <Name>Client</Name>
            <Display>Client</Display>
            <DataType>Combo</DataType>
            <Query TYPE="SQL">SELECT DISTINCT AsClient.ClientGUID,AsClient.FirstName ||' '|| AsClient.LastName ||' - '|| AsCode.ShortDescription FROM AsRole JOIN AsClient ON AsClient.ClientGUID = AsRole.ClientGUID JOIN AsCode ON AsCode.CodeValue = AsRole.RoleCode WHERE AsRole.StatusCode = '01' AND AsRole.PolicyGUID='[PolicyGUID]' AND AsCode.CodeName = 'AsCodeRole'</Query>
            <Hidden>Yes</Hidden>
        </Field>
        <Field>
            <Name>Policy</Name>
            <Display>Policy</Display>
            <DataType>Combo</DataType>
            <Query TYPE="SQL">SELECT PolicyGUID, PolicyNumber || ',' || Policyname FROM AsPolicy WHERE PolicyGUID ='[PolicyGUID]'</Query>
        </Field>
        <Field>
            <Name>Segment</Name>
            <Display>Segment</Display>
            <DataType>Combo</DataType>
            <Query TYPE="SQL">SELECT AsSegment.SegmentGUID, AsSegmentName.SegmentName FROM AsSegmentName JOIN AsSegment ON AsSegmentName.SegmentNameGUID = AsSegment.SegmentNameGUID WHERE AsSegment.PolicyGUID ='[PolicyGUID]'</Query>
            <Hidden>Yes</Hidden>
        </Field>
    </Fields>
    <Events>
        <Event TYPE="ONCHANGE" FIELD="BillGroupType">
            <Math ID="LocalScreenMath"/>
            <QuerySet ID="ClassComboList" FIELD="Class"/>
            <ActionSet ID="ActionsBasedOnBillGroupType" FIELD="Class"/>
        </Event>
        <Event TYPE="ONCHANGE" FIELD="BillEntityType">
            <Math ID="LocalScreenMath"/>
            <ActionSet ID="ActionsBasedOnBillEntityType"/>
        </Event>
    </Events>
    <ScreenMath>
        <Math ID="LocalScreenMath" GLOBAL="No">
            <MathVariables>
                <MathVariable VARIABLENAME="GroupCustomerClientGUIDLSMV" TYPE="SQL" DATATYPE="TEXT">SELECT AsGroupCustomer.ClientGUID FROM AsGroupCustomer JOIN AsClient ON AsGroupCustomer.ClientGUID = AsClient.ClientGUID JOIN AsAgreement ON AsGroupCustomer.ClientGUID = AsAgreement.GroupCustomerClientGUID JOIN AsPlanAgreement ON AsAgreement.AgreementGUID = AsPlanAgreement.AgreementGUID JOIN AsPlan ON AsPlanAgreement.PlanGUID = AsPlan.PlanGUID JOIN AsPolicy ON AsPlan.PlanGUID = AsPolicy.PlanGUID WHERE AsPolicy.PolicyGUID ='[PolicyGUID]'</MathVariable>
                <MathVariable VARIABLENAME="BillEntityTypeLSMV" TYPE="EXPRESSION" DATATYPE="TEXT">BillEntityType</MathVariable>
                <MathVariable VARIABLENAME="BillGroupTypeLSMV" TYPE="EXPRESSION" DATATYPE="TEXT">BillGroupType</MathVariable>
            </MathVariables>
        </Math>
    </ScreenMath>
    <Actions>
        <QuerySet ID="ClassComboList">
            <Condition IF="LocalScreenMath:BillGroupTypeLSMV = 'CLASS'">
                <Action ACTIONTYPE="SQLQUERY">SELECT ClassGroupGUID, ClassGroupName FROM AsClassGroup WHERE GroupCustomerClientGUID = '[LocalScreenMath:GroupCustomerClientGUIDLSMV]'</Action>
            </Condition>
        </QuerySet>
        <ActionSet ID="ActionsBasedOnBillGroupType">
            <Condition IF="LocalScreenMath:BillGroupTypeLSMV = 'GROUP'">
                <Action ACTIONTYPE="HIDE" FIELD="Class"/>
                <Action ACTIONTYPE="SHOW" FIELD="GroupCustomerGUID"/>
            </Condition>
            <Condition IF="LocalScreenMath:BillGroupTypeLSMV = 'CLASS'">
                <Action ACTIONTYPE="SHOW" FIELD="Class"/>
                <Action ACTIONTYPE="SHOW" FIELD="GroupCustomerGUID"/>
            </Condition>
        </ActionSet>
        <ActionSet ID="ActionsBasedOnBillEntityType">
            <Condition IF="LocalScreenMath:BillEntityTypeLSMV = 'CLIENT'">
                <Action ACTIONTYPE="HIDE" FIELD="Segment"/>
                <Action ACTIONTYPE="HIDE" FIELD="Policy"/>
                <Action ACTIONTYPE="SHOW" FIELD="Client"/>
            </Condition>
            <Condition IF="LocalScreenMath:BillEntityTypeLSMV = 'SEGMENT'">
                <Action ACTIONTYPE="HIDE" FIELD="Client"/>
                <Action ACTIONTYPE="HIDE" FIELD="Policy"/>
                <Action ACTIONTYPE="SHOW" FIELD="Segment"/>
            </Condition>
            <Condition IF="LocalScreenMath:BillEntityTypeLSMV = 'POLICY'">
                <Action ACTIONTYPE="HIDE" FIELD="Segment"/>
                <Action ACTIONTYPE="HIDE" FIELD="Client"/>
                <Action ACTIONTYPE="SHOW" FIELD="Policy"/>
            </Condition>
        </ActionSet>
    </Actions>
    <Math>
        <MathVariables>
            <MathVariable VARIABLENAME="EffectiveDateMV" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
            <MathVariable VARIABLENAME="CurrencyCodeMV" TYPE="VALUE" DATATYPE="TEXT">USD</MathVariable>
            <MathVariable VARIABLENAME="BillDetailMV" TYPE="VALUE" DATATYPE="TEXT">BILLDETAIL</MathVariable>
            <MathVariable VARIABLENAME="DynamicFieldMV" TYPE="FUNCTION" DATATYPE="CURRENCY">Activity:BillDueAmount</MathVariable>
            <MathVariable VARIABLENAME="BillEntityListArray" TYPE="STRINGARRAY" DATATYPE="TEXT" OPERATION="FILLBY-SQL">SELECT SegmentGUID From AsSegment Where AsSegment.PolicyGUID = '[PolicyGUID]'</MathVariable>
            <MathVariable VARIABLENAME="BillEntityListCount" TYPE="AGGREGATEFUNCTION" METHOD="COUNT" DATATYPE="INTEGER">BillEntityListArray</MathVariable>
            <MathVariable VARIABLENAME="ReceivableDueTypeMV" TYPE="VALUE" DATATYPE="TEXT">Premium</MathVariable>
            <MathVariable VARIABLENAME="BillGroupGUIDMV" TYPE="EXPRESSION" DATATYPE="TEXT">Activity:PolicyGUID</MathVariable>
            <MathVariable VARIABLENAME="BillGroupTypeMV" TYPE="VALUE" DATATYPE="TEXT">POLICY</MathVariable>
            <MathVariable VARIABLENAME="BillDetailRecordArray" TYPE="OBJECTARRAY" OPERATION="CREATE" DATATYPE="OBJECT">0</MathVariable>
            <MathLoop VARIABLENAME="BillDetailLoop" TYPE="FOR" ITERATIONS="BillEntityListCount">
                <MathVariable VARIABLENAME="BillEntityIndex" TYPE="LOOPINDEX" SOURCEARRAY="BillDetailLoop" DATATYPE="INTEGER"/>
                <MathVariable VARIABLENAME="BillEntityGUIDMV" TYPE="AGGREGATEFUNCTION" METHOD="INDEX" INDEX="BillEntityIndex" DATATYPE="TEXT">BillEntityListArray</MathVariable>
                <MathVariable VARIABLENAME="BillEntityTypeMV" TYPE="VALUE" DATATYPE="TEXT">SEGMENT</MathVariable>
                <MathVariable VARIABLENAME="BillDetailAmountUSD" TYPE="FIELD" DATATYPE="CURRENCY">Activity:BillDueAmount</MathVariable>
                <MathVariable VARIABLENAME="BillDetailAmountMV" TYPE="FUNCTION" DATATYPE="DECIMAL">ToDecimal(BillDetailAmountUSD)</MathVariable>
                <MathVariable VARIABLENAME="BillDueDateMV" TYPE="EXPRESSION" DATATYPE="DATE">Activity:BillDueDate</MathVariable>
                <MathVariable VARIABLENAME="BillDetailCreationDateMV" TYPE="EXPRESSION" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OBJECTNAME="BillDetailMV" OPERATION="CREATE" DATATYPE="OBJECT">BillDetailActivty</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="ReceivableDueType" DATATYPE="TEXT">ReceivableDueTypeMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="BillGroupGUID" DATATYPE="TEXT">BillGroupGUIDMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="BillGroupType" DATATYPE="TEXT">BillGroupTypeMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="CurrencyCode" DATATYPE="TEXT">CurrencyCodeMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="BillEntityGUID" DATATYPE="TEXT">BillEntityGUIDMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="BillEntityType" DATATYPE="TEXT">BillEntityTypeMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="DueDate" DATATYPE="DATE">BillDueDateMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="BillDetailCreationDate" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="BillDetailChangeDate" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="DynamicField1" DATATYPE="CURRENCY">DynamicFieldMV</MathVariable>
                <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="DynamicField2" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
                <MathIF IF="BillEntityIndex = 0 ">
                    <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="Amount" DATATYPE="DECIMAL">Activity:Amount1</MathVariable>
                </MathIF>
                <MathIF IF="BillEntityIndex = 1 ">
                    <MathVariable VARIABLENAME="BillDetailRecord" TYPE="OBJECT" OPERATION="SETVALUE" FIELDNAME="Amount" DATATYPE="DECIMAL">Activity:Amount2</MathVariable>
                </MathIF>
                <MathVariable VARIABLENAME="BillDetailRecordArray" TYPE="OBJECTARRAY" OPERATION="APPEND" SOURCEARRAY="BillDetailRecordArray" DATATYPE="OBJECT">BillDetailRecord</MathVariable>
            </MathLoop>
        </MathVariables>
    </Math>
</Transaction>