Rules
Rule
A "Rules Engine" allows various types of business rules to be written in a text format and easily applied to the system "on the fly" – without even logging out or shutting it down. USAS-R comes with its own set of required business rules, as well as a number of optional business rules that the district may enable or disable as they desire. Customized rules can also be written for each district, either by district personnel with the appropriate access to do so, or with help from their ITC or the SSDT. A few examples of using customized business rules are custom validations, sending email or Twitter notifications, or even updating fields based on certain criteria. These can also be used in conjunction with Custom Fields
Bundled means it comes with the USAS-R software; Mandatory means the rule can not be disabled.
Create
- From the System menu select 'Rules'
- Click on
Enter in required rule information
Check the enabled box if the user wants it to be in affect the next time the rulesets are activated- Click on to ensure rule is correct
- Click on to create the rule, click on to not create the rule.
Activate
Rules do not take affect as soon as they are saved. In order to make a new or changed rule take affect, the user would click on . This will reload all of the enabled rulesets and they will become effective immediately.
If Rules are not "Activated" from the grid they will be enabled/disabled (depending on current status) the next time the instance is restarted.
Search
The Rules grid allows the user to search for existing Rules on the system by clicking in the filter row in the grid columns and entering in the desired information. Click on any row of the search results to see a summary view of the record. The Advanced Search can be utilized by clicking on the in the upper right side of the grid.
Edit
The options listed will depend if the rule is bundled and/or mandatory. If the rule is bundled and mandatory a user will only be able to view it. If the rule is bundled and not mandatory the user will be able to view or disable it. If the rule is not bundled then the user will be able to edit, delete or disable it.
Click on the in the grid beside the Rule to edit the record.
Disable Rule
A rule may be disabled if it is not mandatory.
- From the System menu select 'Rules'
- Search for desired Rule
- Click on
- Uncheck the
- Click on and close the pop up window
- Click on in order for the change to go into affect
Enable Rule
A disabled rule may be enabled at any time.
- From the System menu select 'Rules'
- Search for desired Rule
- Click on
- Check the
- Click on and close the pop up window
- Click on in order for the change to go into affect
Delete
Click on the
in the grid beside the desired rule. A confirmation box will appear and you will be asked to confirm that you really do want to delete this rule. A rule may be deleted if it is not bundled.Mandatory Rules
The following rules come with the software (bundled) and are mandatory in order to use the software. They will be enabled automatically when the data is imported. Mandatory rules cannot be disabled.
Rule | Description |
---|---|
org.ssdt_ohio.modules.customfield.CustomFields | Custom Fields are enabled so that user (with the correct permissions) can create them |
org.ssdt_ohio.modules.rules.startup-events | Starts up the Rules Engine. |
org.ssdt_ohio.modules.rules.stream.startup-stream | Rules engine stream startup |
org.ssdt_ohio.usas.model.account.CashAccountRules | 'Include as General' flag is automatically set for funds included as part of the Five Year Forecast. |
org.ssdt_ohio.usas.model.accountChange.AccountChangeAppropriationRule | Warns the user if crossing appropriation boundaries in an account change request |
org.ssdt_ohio.usas.model.accountChange.AccountChangeRequestRules | Generate an Error if the user is trying to cross funds in an Account Change Request |
org.ssdt_ohio.usas.model.accountChange.AccountTransitionFiscalYear | The prior fiscal year must be closed in order to process requests for current fiscal year. |
org.ssdt_ohio.usas.model.account.ExpenditureAccountRules | Warning: Expenditure And Budget Codes don't match |
org.ssdt_ohio.usas.model.budget.BudgetExpenditureOneToOneRule | Error: Budget Expenditure relationship is 1 to 1 |
org.ssdt_ohio.usas.model.cashrec.CashReconciliationRules | Warning if the fund total and item total for the Cash Reconciliation being saved do not balance |
org.ssdt_ohio.usas.model.disbursement.DisbursementReconciledDate | Error if the Reconciled Date is not after the Disbursement date |
org.ssdt_ohio.usas.model.disbursement.DisbursementRules | Error if user is generating a Disbursement with a negative amount |
org.ssdt_ohio.usas.model.disbursement.VoidDisbursementRules | Error is generated if voiding a disbursement that is reconciled and/or in a previous FY and/or in a closed posting period and/or with a date prior to transaction date |
org.ssdt_ohio.usas.model.distribution.DistributionRules | Error is generated if Distribution amounts do not equal zero and/or accounts are not the same type (expenditure or revenue) |
org.ssdt_ohio.usas.model.interfundcash.InterFundCashTransaction | Error is generated if trying to edit an advance that has already been paid. |
org.ssdt_ohio.usas.model.invoice.InvoiceItemCancelFullRules | Only one full invoice item per PO item and an invoice item with a status of Cancel_Full must have an amount equal to the remaining encumbrance |
org.ssdt_ohio.usas.model.invoice.InvoiceitemsRules | Requires full invoice items to come after partial invoices for a po charge and prevents invoice from being saved with no items |
org.ssdt_ohio.usas.model.InvoiceFutureYearPOError | Prevents the invoice date from being in a fiscal year prior to the PO date. |
org.ssdt_ohio.usas.model.modelTransaction.ModelTransaction | Prevents requisition, purchase order or disbursement transaction from being posted when the date provided is in a closed posting period. |
org.ssdt_ohio.usas.model.po.AmendedPOItemsNotChanged | Prevents an item from being changed on an amended PO |
org.ssdt_ohio.usas.model.po.AmendedPOPreventModificationIfInvoiced | Prevents the purchase order's vendor from being updated if the PO has been invoiced. |
org.ssdt_ohio.usas.model.po.AmendedPOPreventUpdate | Prevents a PO from being updated if the PO is not Modifiable or Amendable |
org.ssdt_ohio.usas.model.po.POConversionRequireAccounts | Purchase Order charges must have a valid account |
org.ssdt_ohio.usas.model.po.POIssuedCancelledDateRules | Unable to modify a PO due to the PO date or item's issued or charged dates are in a closed period |
org.ssdt_ohio.usas.model.po.POItemChargeAmountValidation | Error: Purchase order item and charge amounts are not equal |
org.ssdt_ohio.usas.model.po.POItemChargeDates | Error: Issued and cancelled dates on PO items and charges cannot be prior to PO date |
org.ssdt_ohio.usas.model.po.POMultivendorValidation | Vendor may not be null if purchase order is not a multivendor PO |
org.ssdt_ohio.usas.model.po.POUpdateValidation | Cannot update purchase order if model indicates it is not modifiable. |
org.ssdt_ohio.usas.model.postingPeriod.PostingPeriod | Posting period may not be re-opened because it is more than one year prior to the current period |
org.ssdt_ohio.usas.model.postingPeriod.PostingPeriodClose | All other posting periods in this fiscal year must be closed prior to closing the current period |
org.ssdt_ohio.usas.model.refund.RefundCheckAmount | Error: Check Amount must not be zero |
org.ssdt_ohio.usas.model.requisition.ReqRestrictNumber | Error: User entered an invalid req number |
org.ssdt_ohio.usas.model.requisition.RequisitionDeletionRules | Error: Prevent deleting a Requisition in a closed posting period if the Requisition has been converted to a PO or if the PreEncumbranceModule is installed. |
org.ssdt_ohio.usas.model.requisition.RequisitionItemQuantity | Error: Item quantity must match sum of charge quantities |
org.ssdt_ohio.usas.model.requisition.RequisitionModifyRules | Error: Unable to update due to closed posting period. The rule prevents the Requisition number, date or vendor from being changed when requisition is dated in a closed posting period. |
org.ssdt_ohio.usas.model.user.RoleChangeRules | User Can Not Change, Create or Delete A Role With An Underscore (SSDT created Roles) |
org.ssdt_ohio.usas.model.user.UserDeleteRule | A username cannot be deleted in SYSTEM/User |
org.ssdt_ohio.usas.model.vendor.Vendor | Update Vendor last activity date when posting requisition, purchase order, invoice and disbursement |
org.ssdt_ohio.usas.model.vendor.VendorDefaultAddressCheck | Vendor must have a default PO address defined |
org.ssdt_ohio.usas.model.vendor.VendorDefaultAddresses | Error: Vendor has multiple default PO/check/1099 address defined |
org.ssdt_ohio.usas.model.vendor.VendorTaxIdConfiguration | Warn/Error: Vendor tax ID number configuration |
org.ssdt_ohio.usas.module.usascodes.CodeStopDateError | Error: Account with stop date prior to current posting period |
org.ssdt_ohio.usas.module.usascodes.CodeStopDateWarning | Warning: Account with defined stop date produces a warning |
org.ssdt_ohio.usas.module.usascodes.validation.AccountValidation | Account code validation (must be a valid account) |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.UserBasedBalanceCheckingBootstrap | Bootstrap rules for user-based balance checking |
org.ssdt_ohio.usas.rules.opu.Opu | Error: OPU code and/or IRN are invalid |
Bundled Rules that are not Mandatory
The following rules come with the software but are not mandatory in order to use the software.
Rule | Description |
---|---|
org.ssdt_ohio.authnz.authnz-default-password | Must meet the required default password rules |
org.ssdt_ohio.authnz.authnz-stream-rules | Authentication: Default Break in Detection and Evasion |
org.ssdt_ohio.usas.model.account.AppropriationCreationRulesError | Warning issued stating Appropriation account already exists |
org.ssdt_ohio.usas.model.account.AppropriationCreationRulesWarning | Warning issued stating Appropriation did not previously exists so appropriation account automatically created |
org.ssdt_ohio.usas.model.account.CashAccountCreationRulesError | Cash Account - Prevent Automatic Creation |
org.ssdt_ohio.usas.model.account.CashAccountCreationRulesWarning | Warning issued stating cash account did not previously exists so it will be created |
org.ssdt_ohio.usas.model.accountChange.AccountChangeRequestFiscalYear | Prior fiscal year must be closed to process an account change request in current fiscal year |
org.ssdt_ohio.usas.model.anticipatedRevenueTransaction.AnticipatedRevenueTransactionRequireActiveAccounts | Error: Inactive account - AnticipatedRevenue: The cash and revenue accounts need to be active. Check the active flags and start/stop dates on related accounts. |
org.ssdt_ohio.usas.model.budget.AppropMappingSample | Budget to appropriation mapping sample |
org.ssdt_ohio.usas.model.budgetTransaction.BudgetTransactionRequireActiveAccounts | Error: Inactive account - Budget: The budget's related cash appropriation and expenditure accounts need to be active. Check the active flags and start/stop dates on related accounts. |
org.ssdt_ohio.usas.model.disbursement.DisbursementNegativeCashBalanceError | Error generated if Disbursement cash account contains a negative balance |
org.ssdt_ohio.usas.model.disbursement.DisbursementNegativeCashBalanceWarning | Warning is generated if Disbursement cash account contains a negative balance |
org.ssdt_ohio.usas.model.disbursement.DisbursementRequireActiveAccounts | Error: Inactive account - disbursement Enabled by default. Error for payroll related Disbursements created from Pending Transactions when accounts used are inactive. |
org.ssdt_ohio.usas.model.distribution.DistributionNegativeCashBalanceError | Error generated if Distribution cash account contains a negative balance |
org.ssdt_ohio.usas.model.distribution.DistributionNegativeCashBalanceWarning | Warning generated if Distribution cash account contains a negative balance |
org.ssdt_ohio.usas.model.distribution.DistributionRequireActiveAccounts | Error generated when accounts are inactive or have start/stop dates. |
org.ssdt_ohio.usas.model.interfundcash.InterFundNegativeCashBalanceError | Error generated if fund-to-fund transfer or advance cash account contains a negative balance |
org.ssdt_ohio.usas.model.interfundcash.InterFundNegativeCashBalanceWarning | Warning generated if fund-to-fund transfer or advance cash account contains a negative balance |
org.ssdt_ohio.usas.model.interfundcash.InterFundCashTransactionRequireActiveAccount | Error generated when accounts are inactive or have start/stop dates. |
org.ssdt_ohio.usas.model.invoice.InvoiceDatePriorToPODateWarning | Warning: Invoice Date is prior to Purchase Order Date |
org.ssdt_ohio.usas.model.invoice.InvoiceItemAmountExceedsEncumbranceRule | Warning: Invoice amount exceeds remaining encumbrance Disabled by default. Warning will show when the user saves an invoice that that exceeds the remaining encumbrance account. |
org.ssdt_ohio.usas.model.invoice.InvoiceNegativeBudgetBalanceWarning | Warning: Invoice budget negative balance Enabled by default. Warning message will show when the user attempts to save an invoice and will indicate the FYTD Unencumbered balance, any Future Encumbered amounts in same fiscal year and any Pre Encumbered amounts (if module is enabled) that exceeds the remaining balance of account. |
org.ssdt_ohio.usas.model.invoice.InvoiceNegativeBudgetBalanceError | Error: Invoice Budget negative balance Disabled by default. Error message will show when the user attempts to save an invoice and will indicate the FYTD Unencumbered balance, any Future Encumbered amounts in same fiscal year and any Pre Encumbered amounts (if module is enabled) that exceeds the remaining balance of account. |
org.ssdt_ohio.usas.model.invoice.InvoiceNegativeCashBalanceWarning | Warning: Invoice cash account negative balance Enabled by default. Warning message will show when user attempts to save an invoice and will indicate the current Fund Balance less the current payables for the cash account. |
org.ssdt_ohio.usas.model.invoice.InvoiceNegativeCashBalanceError | Error: Invoice cash account negative balance Disabled by default. Error message will show when user attempts to save an invoice and will indicate the current Fund Balance less the current payables for the cash account. |
org.ssdt_ohio.usas.model.invoice.InvoiceReceivedItemDate | Modifies Received date to Vendor Invoice Date Disabled by default. If the Received date is left blank when an invoice is created, then the received date will automatically populate to the date that is entered as the Vendor Invoice Date when the invoice is saved. |
org.ssdt_ohio.usas.model.invoice.InvoiceVendorActive | Error generated if the invoice's vendor in Inactive |
org.ssdt_ohio.usas.model.invoice.InvoiceVendorDefaultCheckAddress | Warning: Vendor does not have a default Check address defined - invoice |
org.ssdt_ohio.usas.model.invoice.InvoiceItemAmountExceedsEncumbranceRule | Warning: Invoice amount exceeds remaining encumbrance |
org.ssdt_ohio.usas.model.invoice.InvoiceZeroAmountStatus | Warning: Invoice item amount is 0.00 but an invoice status is entered |
org.ssdt_ohio.usas.model.invoice.InvoiceRequireActiveAccounts | Error generated when accounts are inactive or have start/stop dates. |
org.ssdt_ohio.usas.model.po.POPreventDelete | Error: Purchase orders cannot be deleted |
org.ssdt_ohio.usas.model.po.PORequireActiveAccounts | Requires active accounts on purchase orders |
org.ssdt_ohio.usas.model.po.PORestrictedFunctionCodes | Prevents Posting purchase order expenditures with function codes 7100-7499 |
org.ssdt_ohio.usas.model.po.POVendorActive | Requires active vendors on purchase orders |
org.ssdt_ohio.usas.model.po.PoVendorDefaultPOAddress | Warning: Vendor does not have a default PO address defined on the purchase order |
org.ssdt_ohio.usas.model.postingPeriod.PostingPeriodReOpen | Error: Prevent opening a previously closed posting period Disabled by default. Prevents user from re-opening a posting period that has already been closed. |
org.ssdt_ohio.usas.model.receipt.ReceiptAccountRules | Requires active accounts on receipts |
org.ssdt_ohio.usas.model.receipt.ReceiptNegativeCashBalanceError | Prevents posting Receipt to a cash account with negative balance |
org.ssdt_ohio.usas.model.receipt.ReceiptNegativeCashBalanceWarning | Warning when posting a Receipt to a cash account with negative balance |
org.ssdt_ohio.usas.model.receipt.ReceiptNumberChanged | Prevent the Receipt number from being modified |
org.ssdt_ohio.usas.model.receipt.ReceiptRestrictedCodes | Prevent an invalid revenue account from being posted to a receipt item |
org.ssdt_ohio.usas.model.refund.RefundAccountRules | Prevent an Inactive account from being posted to a refund |
org.ssdt_ohio.usas.model.refund.RefundNegativeCashBalanceError | Prevent a Refund from being posted to a negative cash account balance |
org.ssdt_ohio.usas.model.refund.RefundNegativeCashBalanceWarning | Warning will be issued is the refund posts to a negative cash balance |
org.ssdt_ohio.usas.model.refund.RefundVendorActive | Prevent inactive vendors from being posted to a refund |
org.ssdt_ohio.usas.model.requisition.ReqPreventBackdating | Prevent backdating requisition prior to the current date. |
org.ssdt_ohio.usas.model.requisition.ReqRequireActiveAccounts | Prevent an inactive account to be posted to a requisition |
org.ssdt_ohio.usas.model.requisition.ReqRestrictedFunctionCodes | Prevent posting requisitions with expenditure account containing function codes 7100-7499 |
org.ssdt_ohio.usas.model.requisition.RequisitionClosedPeriod | Prevent requisition is in a closed period from being deleted |
org.ssdt_ohio.usas.model.requisition.RequisitionVendorActive | Prevent an inactive vendor from being posted to a requisition |
org.ssdt_ohio.usas.model.requisition.ReqVendorDefaultPOAddress | Warning will be issued if a vendor does not have a default PO address defined when posting a requisition |
org.ssdt_ohio.usas.model.vendor.VendorNumberChanged | Prevent a Vendor number from being modified |
org.ssdt_ohio.usas.model.vendor.VendorTaxIdRules | Enforces that the tax Id Type must be set if the Id # and Type 1099 are set. |
org.ssdt_ohio.usas.module.usascodes.AccountDescriptionRule | Set the account description to the default account descriptions when left blank |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.DistributionAppropriationBalanceCheckWarning | Warning will be issued if Appropriation account balance is negative when posting a distribution |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.DistributionBudgetBalanceCheckWarning | Warning will be issued if Budget account balance is negative when posting a distribution |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FuturePOAppropriationBalanceCheckWarningExcludePreEncumbrance | Warning: Negative appropriation unencumbered balance check - future purchase order Warning will show when user with configuration to Warn on Negative Amounts enters a purchase order for the future fiscal year that exceeds Next Year Proposed unencumbered balance on the appropriation account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FuturePOBudgetBalanceCheckWarningExcludePreEncumbrance | Warning/Error: Negative budget unencumbered balance check - future purchase order Warning or Error will show when user with configuration to Warn on Negative Amounts or not Allow Negative Budgets enters a purchase order for the future fiscal year that exceeds Next Year Proposed unencumbered balance. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FuturePurchaseOrderAppropriationBalanceCheckWarning | Warning: Negative appropriation balance check - future purchase order Warning will show when user with configuration to Warn on Negative Amounts enters a purchase order for the future fiscal year that exceeds Next Year Proposed balance on the appropriation account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FuturePurchaseOrderBudgetBalanceCheckWarning | Warning: Negative budget balance check - future purchase order Warning will show when user with configuration to Warn on Negative Amounts enters a purchase order for the future fiscal year that exceeds Next Year Proposed balance on the expenditure account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FutureReqAppropriationBalanceCheckWarningExcludePreEncumbrance | Warning: Negative appropriation unencumbered balance check - future requisition Warning will show when user with configuration to Warn on Negative Amounts enters a requisition for the future fiscal year that exceeds Next Year Proposed unencumbered balance on the appropriation account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FutureReqBudgetBalanceCheckWarningExcludePreEncumbrance | Warning: Negative budget unencumbered balance check - future requisition Warning will show when user with configuration to Warn on Negative Amounts enters a requisition for the future fiscal year that exceeds Next Year Proposed unencumbered balance on the budget account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FutureRequisitionAppropriationBalanceCheckWarning | Warning: Negative balance check - future requisition Warning will show when user with configuration to Warn on Negative Amounts enters a requisition for the future fiscal year that exceeds Next Year Proposed balance on the appropriation account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.FutureRequisitionBudgetBalanceCheckWarning | Warning: Negative balance check - future requisition Warning will show when user with configuration to Warn on Negative Amounts enters a requisition for the future fiscal year that exceeds Next Year Proposed balance on the expenditure account. |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.PendingTransactionAppropriationBalanceCheck | Warning will be issued if Appropriation account balance is negative when posting a pending transaction |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.PendingTransactionBudgetBalanceCheck | Warning will be issued if Budget account balance is negative when posting a pending transaction |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.POAppropriationBalanceCheckWarningExcludePreEncumbrance | Warning will be issued if appropriation account unencumbered balance is negative when posting a purchase order |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.POBudgetBalanceCheckWarningExcludePreEncumbrance | Warning/Error: Negative budget unencumbered balance check - purchase order |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.PurchaseOrderAppropriationBalanceCheckWarning | Warning will be issued if Negative appropriation balance when posting a purchase order |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.PurchaseOrderBudgetBalanceCheckWarning | Warning will be issued if Negative budget balance when posting a purchase order |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.ReqAppropriationBalanceCheckWarningExcludePreEncumbrance | Warning will be issued if Negative appropriation unencumbered balance when posting a requisition |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.ReqBudgetBalanceCheckWarningExcludePreEncumbrance | Warning will be issued if Negative budget unencumbered balance when posting a requisition |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.RequisitionAppropriationBalanceCheckWarning | Warning will be issued if Negative appropriation balance when posting a requisition |
org.ssdt_ohio.usas.module.userbasedbalancechecking.rules.RequisitionBudgetBalanceCheckWarning | Warning will be issued if Negative budget balance when posting a requisition |
Custom Rules
Customized rules can also be written for each district, either by district personnel with the appropriate access to do so, or with help from their ITC or the SSDT. A few examples of using customized business rules are custom validations, sending email or Twitter notifications, or even updating fields based on certain criteria. These can also be used in conjunction with Custom Fields.
A few things worth mentioning with regards to rules.
- You need to make sure the name of the rule is unique.
- You'll also want to validate the rule to make sure there are no errors.
- Finally, once you've successfully saved your rule, you need to make sure to click the Activate button from the rule grid for the rule to take effect.
The following are custom rules that can be created:
Require a deliver to address when creating a requisition
Name: org.districtname.RequisitionDeliveryAddressRequired
Description: Prevent posting Requisition without a Delivery Address
package org.districtName.Requistion.DeliveryAddressRequired; dialect "mvel" import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.ModelInformation; import org.ssdt_ohio.model.ModelState; import org.ssdt_ohio.model.events.*; import org.ssdt_ohio.usas.model.requisition.Requisition; import org.ssdt_ohio.usas.model.vendor.Vendor; rule "requisition delivery address is required" when CreateObjectEvent() or UpdateObjectEvent() ModelInformation(state != ModelState.IMPORTING, primary) $requisition : Requisition(deliveryAddress.isEmpty()) then error(kcontext, "Requisition cannot be saved without a delivery address") end
Require a vendor when creating a requisition
Name: org.districtname.RequisitionVendorRequired
Description: Prevent posting Requisition without a Vendor
package org.districtName.Requisition.VendorRequired; dialect "mvel" import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.ModelInformation; import org.ssdt_ohio.model.ModelState; import org.ssdt_ohio.model.events.*; import org.ssdt_ohio.usas.model.requisition.Requisition; import org.ssdt_ohio.usas.model.vendor.Vendor; rule "requisition vendor is required" when CreateObjectEvent() or UpdateObjectEvent() ModelInformation(state != ModelState.IMPORTING, primary) $requisition : Requisition(getVendor() == null) then error(kcontext, "Requisition cannot be saved without a vendor") end
Require that an account code be entered for each requisition line item when creating requisition
Name: org.districtname.RequisitionWithoutAccount
Description: Prevent requisition from being created without account code
package org.ssdt_ohio.usas.model.requisition; dialect "mvel" import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.events.* import org.ssdt_ohio.model.ModelInformation import org.ssdt_ohio.model.ModelState import org.ssdt_ohio.usas.model.requisition.* import org.ssdt_ohio.usas.model.accountChange.AccountChangeUpdateRules rule "require accounts on requisitions" when CreateObjectEvent() or UpdateObjectEvent() ModelInformation(state != ModelState.IMPORTING, primary) not AccountChangeUpdateRules() $req : Requisition() RequisitionCharge(account == null) from $req.charges then error(kcontext, "Expenditure Account is required") end
Prevent Requisition from being created when the attention to field is blank
Name: org.districtname.RequisitionWithoutAttentionTo
Description: Prevent requisition from being created when attention to is blank
package org.districtName.RequisitionAttentionTo; dialect "mvel" import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.ModelInformation; import org.ssdt_ohio.model.ModelState; import org.ssdt_ohio.model.events.*; import org.ssdt_ohio.usas.model.requisition.Requisition; import org.ssdt_ohio.usas.model.vendor.Vendor; rule "requisition vendor is required" when CreateObjectEvent() or UpdateObjectEvent() ModelInformation(state != ModelState.IMPORTING, primary) $requisition : Requisition(attention == null) then error(kcontext, "Requisition must have valid attention field") end
Prevent Requisition from being saved or updated when any of the item descriptions are null or are an empty string
Name: org.districtname.RequisitionItemsWithNoDescription
Description: Prevent requisition from being saved or updated when any of the item descriptions are null or are an empty string
package org.districtName.Requisition dialect "mvel" import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.events.* import org.ssdt_ohio.model.ModelInformation import org.ssdt_ohio.model.ModelState import org.ssdt_ohio.usas.model.requisition.* rule "Requisition Items Must Have A Description" when $event : RepositoryModificationEvent(isCreate() || isUpdate()) ModelInformation(state != ModelState.IMPORTING, primary) $requisition : Requisition() from $event.target $item : RequisitionItem(description == null || description.trim().length() == 0) from $requisition.getItems() then error(kcontext, "Requitistion item number: " + $item.lineNumber + ", units: " + $item.units + ", quantity: " + $item.quantity + ", unit price: " + $item.unitPrice + " has no description from requisition: " + $requisition.description) end
Require an amount on a requisition line item.
Name: Requisition Items must have an Amount
Description: Prevent requisition from being saved or updated when any of the items are null or are empty
package org.ssdt_ohio.usas.model.requisition; dialect "mvel" //ssdt: mandatory=false, enabled=true, description=Error: requisition item amount must be specified import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.ModelInformation import org.ssdt_ohio.model.ModelState import org.ssdt_ohio.model.events.* import org.ssdt_ohio.usas.model.account.ExpenditureAccount import org.ssdt_ohio.usas.model.account.ExpenditureCode rule "RequisitionItemAmounts" when ModelInformation(state != ModelState.IMPORTING, primary) CreateObjectEvent() or UpdateObjectEvent() $requisition: Requisition() $item : RequisitionItem(amount == null || amount == 0) from $requisition.items then error(kcontext, "Item amount required for item: " + $item.lineNumber) end
Require an amount on a Receipt item
Name: org.districtname.ReceiptItemsWithoutAmount
Description: Prevent receipt from being saved or updated when a receipt item amount is empty
package org.ssdt_ohio.usas.model.receipt; dialect "mvel" //ssdt: mandatory=false, enabled=true, description=Error: receipt item amount must be specified import function org.ssdt_ohio.modules.rules.RulesHelper.* import org.ssdt_ohio.model.ModelInformation import org.ssdt_ohio.model.ModelState import org.ssdt_ohio.model.events.* import org.ssdt_ohio.usas.model.account.RevenueAccount import org.ssdt_ohio.usas.model.account.RevenueCode rule "ReceiptItemAmounts" when ModelInformation(state != ModelState.IMPORTING, primary) CreateObjectEvent() or UpdateObjectEvent() $receipt : Receipt() $item : ReceiptItem(amount == null || amount == 0) from $receipt.items then error(kcontext, "Item amount required for item: " + $item.lineNumber) end