Page 1 of 1

Recalcing Qty Available on SO lines

PostPosted: Thu May 05, 2022 2:13 pm
by DannyC
See attached plugin.
I want to change the calculation for the Qty Available column to also include backorders on unprocessed orders.

I'm confident my calculation is sound, but after I've added a line, the Qty Avail still gets displayed as the Jiwa default value - which is only backorders from processed orders, i.e. data in the IN_OnBackorder table.

I suspect I'm not hooking the correct event. I've tried both
salesOrderForm.SalesOrder.SalesOrderLines.Added
and
salesOrderForm.SalesOrder.SalesOrderLineAdded.

Suggestions?

Re: Recalcing Qty Available on SO lines  Topic is solved

PostPosted: Thu May 05, 2022 2:53 pm
by Mike.Sheen
The QuantitySOHAvailable property will be set whenever the QuantityThisDelivery property changes also - and that gets changed after the salesOrderForm.SalesOrder.SalesOrderLines.Added and salesOrderForm.SalesOrder.SalesOrderLineAdded events.

Try the AddInventoryItemEnd event instead - but note that if the user changes any of the quantity fields, then it will get reset - so you'd be better off with the Lines PropertyChanged handler where the property name is "QuantityThisDelivery".

Depending on what you need, you might find handling the LineDisplayed event of the form and poking the desired value into the grid instead might work better. I'd normally try to steer away from that - but if it's just to display a value and not to change decisions over how much to backorder or anything, then it's a fairly safe route to take.

Re: Recalcing Qty Available on SO lines

PostPosted: Thu May 05, 2022 3:18 pm
by DannyC
Cheers.
Thx for the info