Revert "Show picked item as available even if quantity override."
authorMaxime Bourget <bmx007@gmail.com>
Sun, 16 Jun 2013 11:30:29 +0000 (12:30 +0100)
committerMaxime Bourget <bmx007@gmail.com>
Sun, 16 Jun 2013 11:30:29 +0000 (12:30 +0100)
We don't want this feature. Available quantity shown should be
the quantity available according to priority and should not take
into account overriden picking quantity.
This quantity however needs to be deduced from the available quantity
for other order because even though they have priority , if something
has been picked and sent, they lose the priority de facto.

Showing the "theorical" availability and overrideng order allows the
user to see that it's an override and not an 'due' quantity.

The previous commit is still there in case we change our mind.

This reverts commit 8feb695afa47e4e2fa7aa5477be06551ae522432.

includes/order_lines.inc

index fbda0288ce0f2a73916ab2014b69aaa156bf3bc1..d961b8926fc955c4742b29b96097d336a3003d53 100644 (file)
@@ -245,9 +245,7 @@ function get_order_details_extra($customer_id, $location, $item_like, $order_id)
        , so.order_no
        , stk_code
        , sod.quantity - qty_sent quantity
-       , GREATEST(0
-                                               , LEAST(qoh.quantity  - quantity_before - COALESCE(tp.quantity,0) + COALESCE(p.quantity, 0) , sod.quantity - qty_sent)
-                                               , COALESCE(p.quantity, 0)) AS available
+       , GREATEST(0, LEAST(qoh.quantity  - quantity_before - COALESCE(tp.quantity,0) + COALESCE(p.quantity, 0) , sod.quantity - qty_sent)) AS available
        , quantity_before
        , qoh.quantity AS qoh
        , p.quantity AS quantity_to_pick
@@ -299,9 +297,7 @@ function get_order_summary($location) {
        , GROUP_CONCAT(distinct comments separator ';') AS order_comment
        , GROUP_CONCAT(distinct comment separator ';') AS detail_comment
        , MAX(quantity_before) AS quantity_before
-       , @available := GREATEST(LEAST(d.quantity, COALESCE(qoh.quantity,0) - COALESCE(tp.quantity,0) + COALESCE(p.quantity,0) - quantity_before)
-                                                                                                       , 0
-                                                                                                       , COALESCE(p.quantity, 0) )
+       , @available := GREATEST(LEAST(d.quantity, COALESCE(qoh.quantity,0) - COALESCE(tp.quantity,0) + COALESCE(p.quantity,0) - quantity_before), 0)
        , SUM(IF($held_condition, @available , 0)) AS quantity_held
        , SUM(IF($held_condition, 0,  @available)) AS available_quantity
        , SUM(IF($held_condition, 0,  @available*unit_price*(1-discount_percent/100))) AS available_amount