We're trying to lock down the return pathway for the next deliverable portion, and you know that you're in for a good time when you've covered half of a whiteboard with functions and proofs to ensure that you're doing your work right.
Little things like:
If (ReturnTotal > LineItemTotal - LineItemShipped)...can become really nasty when you're trying to construct a SQL view due to the subqueries involved in any one of the terms in question.
WorkflowIterations = (Shipped - PreviouslyReturnedShippedLineItems) -
((LineItemTotal - ReturnedLineItems) - UnprocessedReturnedLineItems)
Else WorkflowIterations = 0
Side note: I deleted two posts made over the weekend. This blog has had enough drama associated with it over the last year...although at the request of some Shackers, expect to see some more angry dev posts in the near future.