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.
- 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.
- 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.
- 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".
- The value of the elements is a math variable holding an array of BillDetailReferenceGUIDs.
- 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"
- Adding and removing bill detail records from an existing bill.
- 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.
- If the specified bill doesn't exist, no updates are made and a business error is displayed, "Bill not found. No changes made".
- 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.
- When linking to back to AsBillDetail from the BillDetailReferenceGUID, status of SHADOWED is ignored and considered not to exist.
- The system filter records with a SHADOWED status from all actions of this rule.
- 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.
- 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.
- If the record's current status is OVERRECON, RECONCILED or UNDERRECON the status will be unchanged by this rule.
- 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.
- Reversing the activity with the MaintainBill rule will conditionally revert the affected BillDetail records back to the status prior to the activity.
- 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.
- Records added to AsBillDetailGroup will be removed. As this table does not support statuses, this will be a physical delete.
- 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.
| Element/Tag | Attributes | Parent Element | Description | Element/Attribute Values |
|---|---|---|---|---|
|
<MaintainBill> |
|
The opening and closing tag of the Business Rule. |
||
| <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 |
|
| BILLGUID |
Required attribute: Specifies the target Bill record for the action. |
Math Variable containing a BillGUID. |
||
| <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 . |
|
| BILLGUID |
Required attribute: Specifies the target Bill record for the action. |
Math Variable containing a BillGUID. |
XML Schema
<MaintainBill>
<AddToBill BILLGUID="">BillDetailReferenceGUIDArray1</AddToBill>
<RemoveFromBill BILLGUID="">BillDetailReferenceGUIDArray2</RemoveFromBill>
<MaintainBill>
Example of the configuration needed in the activity transaction to create the array of Bill Detail ReferenceGUIDs
<Transaction>
<EffectiveDate STATUS="Enabled" TYPE="SYSTEM"/>
<Fields>
<Field>
<Name>RemoveBillGUID</Name>
<Display>Remove Bill</Display>
<DataType>Combo</DataType>
<Query TYPE="SQL">SELECT AsBill.BillGUID, AsBill.BillGUID FROM ASBill</Query>
</Field>
<Field>
<Name>RemoveBillDetailReferenceGUID</Name>
<Display>Remove Bill Detail Reference</Display>
<DataType>Combo</DataType>
<Query TYPE="SQL">SELECT AsBillDetail.BillDetailGUID,AsBillDetail.Amount ||'-'|| AsBillDetail.DueDate ||'-'|| AsCode.ShortDescription FROM AsBillDetail JOIN AsCode ON AsCode.CodeValue = AsBillDetail.BillEntityType WHERE AsBillDetail.Status NOT IN ('SHADOWED') AND AsCode.CodeName = 'AsCodeBillEntityType'</Query></Field>
<Field>
<Name>AddBillGUID</Name>
<Display>Add Bill</Display>
<DataType>Combo</DataType>
<Query TYPE="SQL">SELECT AsBill.BillGUID, AsBill.BillGUID FROM ASBill</Query>
</Field>
<Field>
<Name>AddBillDetailReferenceGUID</Name>
<Display>Add Bill Detail Reference</Display>
<DataType>Combo</DataType>
<Query TYPE="SQL">SELECT AsBillDetail.BillDetailGUID,AsBillDetail.Amount ||'-'|| AsBillDetail.DueDate ||'-'|| AsCode.ShortDescription FROM AsBillDetail JOIN AsCode ON AsCode.CodeValue = AsBillDetail.BillEntityType WHERE AsBillDetail.Status NOT IN ('SHADOWED') AND AsCode.CodeName = 'AsCodeBillEntityType'</Query></Field>
</Fields>
<Math>
<MathVariables>
<MathVariable VARIABLENAME="BillGUIDMV1" TYPE="EXPRESSION" DATATYPE="TEXT">Activity:RemoveBillGUID</MathVariable>
<MathVariable VARIABLENAME="BillGUIDMV2" TYPE="EXPRESSION" DATATYPE="TEXT">Activity:AddBillGUID</MathVariable>
<MathVariable VARIABLENAME="BillDetailReferenceGUIDArray1" TYPE="STRINGARRAY" DATATYPE="TEXT" OPERATION="FILLBY-SQL">SELECT BillDetailReferenceGUID FROM AsBillDetail WHERE BillDetailGuid = '[Activity:RemoveBillDetailReferenceGUID]'</MathVariable>
<MathVariable VARIABLENAME="BillDetailReferenceGUIDArray2" TYPE="STRINGARRAY" DATATYPE="TEXT" OPERATION="FILLBY-SQL">SELECT BillDetailReferenceGUID FROM AsBillDetail WHERE BillDetailGuid = '[Activity:AddBillDetailReferenceGUID]'</MathVariable>
</MathVariables>
</Math>
</Transaction>