Fix Available quantity and help quantity in summary.
authorMaxime Bourget <bmx007@gmail.com>
Tue, 11 Jun 2013 21:33:57 +0000 (22:33 +0100)
committerMaxime Bourget <bmx007@gmail.com>
Tue, 11 Jun 2013 21:33:57 +0000 (22:33 +0100)
includes/order_lines.inc

index 6ab910c0fec4f10c27798631e9f4dd7cd0226bb6..0e5a83f769304e2672467663687ac768022bc7a4 100644 (file)
@@ -283,8 +283,8 @@ function get_order_summary($location) {
        , `min(delivery_date)` as delivery_date
        , sum(sub.quantity) as quantity
        , sum(sub.amount) as amount
-       , sum(greatest(least(sub.quantity, qoh.quantity - quantity_before - quantity_held), 0))
-       , sum(sub.amount*greatest(least(sub.quantity, qoh.quantity - quantity_before - quantity_held), 0)/sub.quantity)
+       , sum(greatest(least(sub.quantity -quantity_held, qoh.quantity - quantity_before), 0))
+       , sum(sub.amount*greatest(least(sub.quantity -quantity_held, qoh.quantity - quantity_before), 0)/sub.quantity)
        , sum(quantity_held) as quantity_help
        ,  min(`min(required_date)`) as required_date
        , group_concat(distinct order_comment separator ';') as order_comment