Delayed transactions
Delayed transactions
For some types of transactions, the sequence of the transactions is important to get the calculations done correctly. However, since some transactions might be delayed for a reason, the system needs to handle this when processing the transactions.
Example:
- 10:00, the system quantity is 12
- 11:00, business unit performs a stock count, counted quantity is 10
- System calculates a loss/gain based on whether the counted quantity deviates from the system quantity, in this case, it's a loss of 2 items
- System calculates new stock quantity = 12 - 2 (loss) = 10
- 11:05, receives a sale performed at 11:05, sales quantity is 1
- System calculates new stock quantity = 10 - 1 (sale) = 9
- 11:10, receives a sale performed at 10:30, sales quantity is 2
- The sales transaction is actually done prior to the stock count, so the transaction should not affect the current stock quantity.
- On the other hand, the stock count performed at 11:00 reported a loss of 2 items, so the system creates a gain of +2 items to adjust the previously reported loss. In addition, the sales transaction is stored, i.e. reducing the stock by -2 items, so the result for both transactions is no change in stock quantity:
- System calculates new stock quantity = 9 + 2 (adjust/nullify loss reported for stock count) - 2 (sale) = 9
Note: The transactions are immutable, so any adjustment of previously created transactions needs to be handled by creating a delta transaction.