MaintainBill

This attached rule allows the user to administer the Bill Details within a Bill once the Bill record has been created without deleting and recreating the Bill. The user will be able to add and remove Bill Detail records from existing Bills.

  1. This rule is made up of two elements, AddToBill and RemoveFromBill, either may exist in the same instance of the rule and are not repeatable.
    1. It allows to update a single Bill's set of records at a time or move a set of Bill Details from one Bill to another.
    2. Within each element there is a required attribute called BILLGUID that will hold a single bill record to be adjusted. The value of the Bills in the removal and addition actions may be different or the same. If the attribute is missing a stack trace error occurs - "MaintainBill rule missing BillGUID".
    3. The value of the elements is a math variable holding an array of BillDetailReferenceGUIDs.
    4. At least one of these elements is required for the rule to process. If neither element is present a stack trace error occurs - "MaintainBill rule missing minimum elements"
  2. Adding and removing bill detail records from an existing bill.
    1. An array of BillDetailReferenceGUIDs can be either added or removed from AsBillDetailGroup for the specified BillGUID. Removing a BillDetail from AsBillDetailGroup will be a physical deletion.
    2. If the specified bill doesn't exist, no updates are made and a business error is displayed, "Bill not found. No changes made".
    3. If one or more of the specified records in the array is not found in AsBillDetail, those records are skipped and no error is displayed.
      1. When linking to back to AsBillDetail from the BillDetailReferenceGUID, status of SHADOWED is ignored and considered not to exist.
      2. The system filter records with a SHADOWED status from all actions of this rule.
    4. The reconciliation status of the Bill Detail records will not be considered a factor and will be left to configuration of the BillDetailReferenceGUIDArrays to control. The system will not attempt to validate or restrict Bill Detail records from inclusion in the arrays, but rather this will be left for configuration.
  3. Regardless of the order in the configuration, the rule will process removals before additions so that a bill detail may be removed from one Bill and added to another in the same activity. The status of the bill detail will be sequentially updated.
    1. If the record's current status is OVERRECON, RECONCILED or UNDERRECON the status will be unchanged by this rule.
    2. If the record's current status is BILLED or PENDING, it will be changed to PENDING if removed from a Bill and BILLED if added to a Bill.
  4. Reversing the activity with the MaintainBill rule will conditionally revert the affected BillDetail records back to the status prior to the activity.
    1. If the record's current status is SHADOWED, OVERRECON, RECONCILED or UNDERRECON, the status will be unchanged when reversing. In all other cases, the record's status will be changed to its status prior to the activity.
    2. Records added to AsBillDetailGroup will be removed. As this table does not support statuses, this will be a physical delete.
    3. Records removed from AsBillDetailGroup will be reinstated. It is not necessary to persist the prior primary key on this table - issuing a new BillDetailGroupGUID is expected.

MaintainBill: Elements and Attributes

Element/Tag Parent Attribute Definition Element/Attribute Values and Description/Value
<AddToBill> <MaintainBill>   Optional Element: Specifies the bill detail records to be inserted into the bill. Values must be in an array math variable Math Variable containing an array of BillDetailReferenceGUIDs
<CopyToBillFields> <MaintainBill>   Optional Element: Specifies the BillFields that needs to be updated

<Field> <Fields>   Required and Repeatable element: Parent tag for Field

<Fields> <CopyToBillFields>   Required element: Opening tag for Fields

<From> <Field>   Optional Element:

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

 Activity field name or math variable

<FromCollection> <Field>   Optional element:

Specifies a collection of key-value pairs, where the key is an BILLGUID and the value is a supported value for the field defined in the <To> element.

<MaintainBill>

 

 

The opening and closing tag of the Business Rule.

 

<RemoveFromBill> <MaintainBill>   Optional Element: Specifies the bill detail records to be removed from the bill. Values must be in an array math variable Math Variable containing an array of BillDetailReferenceGUIDs .
<To> <Field>  

Required element:

Identifies the field to be updated.

 Any Bill dynamic field

    BILLGUID  

Required attribute: Specifies the target Bill record for the action.

Math Variable containing a BillGUID.

    BILLGUID  

Required attribute: Specifies the target Bill record for the action.

Math Variable containing a BillGUID.

  <MaintainBill> BILLGUID Optional Element: Specifies BillGuid if single bill is being updated

Math Variable containing a BillGUID.

XML Schema

<MaintainBill>
  <AddToBill BILLGUID="">BillDetailReferenceGUIDArray1</AddToBill>
  <RemoveFromBill BILLGUID="">BillDetailReferenceGUIDArray2</RemoveFromBill>
  <CopyToBillFields BILLGUID="Guid">
     <Fields>
       <Field>
            <From></From>
            <To></To>
        </Field>
        <Field>...</Field>
    </Fields>
    <Fields>
    </CopyToBillFields>
<MaintainBill>

(Or)
<MaintainBill>
    <AddToBill BILLGUID="">BillDetailReferenceGUIDArray1</AddToBill>
      <RemoveFromBill BILLGUID="">BillDetailReferenceGUIDArray2</RemoveFromBill>
      <CopyToBillFields>
     <Fields>
       <Field>
            <FromCollection></FromCollection>
            <To></To>
        </Field>
    </Fields>
    </CopyToBillFields>
</MaintainBill>
Example of the configuration needed in the activity transaction to create the array of Bill Detail ReferenceGUIDs
<MaintainBill>
<AddToBill BILLGUID="">BillDetailReferenceGUIDArray1</AddToBill>
<RemoveFromBill BILLGUID="">BillDetailReferenceGUIDArray2</RemoveFromBill>
<CopyToBillFields BILLGUID="Guid">
     <Fields>
       <Field>
            <From>InvoiceAmountMv</From>
            <To>InvoiceAmount</To>
        </Field>
            <From>BillTotalMv</From>
            <To>BillTotal</To>
        <Field>
        </Field>
    </Fields>
    <Fields>
    </CopyToBillFields>
<MaintainBill>