Placed Orders are typically placed in a "Shopping Cart" state (order.is_ready == false
), where they do not affect Customer balance and Product quantities until a subsequent Make Order Ready transaction is executed. So, we need to devise logic that, when an Order is "made ready" (PUT a purchase order, setting order.is_ready == true
)...
We solve this transaction by declaring the following logic:
Since the Customer has a Sum:
Derive customers.balance as sum(ordersList.amount_un_paid) where is_ready = true
The Balance is increased due to the Qualification Condition Change (is_ready
) now being met.
Similarly, we don't want to reduce Product
inventory, and set reorder flags, until Purchaseorders are marked as ready. So, we need to define logic to make this happen.
This is a bit more challenging, since the Product
is not directly related to Orders,
so that the qualification condition cannot reference orders.is_ready.
So, we introduce Lineitem.is_ready
, enabling us to define the following logic.
Implementation Notes:
Product.totalQtyOrdered
products.is_reorder_required