From b45e74ca2180e83608af3c42cfbff19f38878e5b Mon Sep 17 00:00:00 2001 From: Maxime Bourget Date: Fri, 14 Jun 2013 11:19:57 +0100 Subject: [PATCH] Fix Available quantity and amount bug. --- includes/order_lines.inc | 5 +---- order_lines_view.php | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/includes/order_lines.inc b/includes/order_lines.inc index c59f89d..95085d9 100644 --- a/includes/order_lines.inc +++ b/includes/order_lines.inc @@ -284,8 +284,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 - , sum(if($held_condition, d.quantity, 0)) as quantity_held - , sum(if($held_condition, d.quantity, 0)*unit_price*(1-discount_percent/100)) as amount_held + , sum(if($held_condition, greatest(least(d.quantity, qoh.quantity - quantity_before), 0), 0)) as quantity_held , sum(if($held_condition, 0, greatest(least(d.quantity, qoh.quantity - quantity_before), 0))) as available_quantity , sum(if($held_condition, 0, greatest(least(d.quantity, qoh.quantity - quantity_before), 0)*unit_price*(1-discount_percent/100))) as available_amount , sum(p.quantity) as quantity_to_pick @@ -311,8 +310,6 @@ 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 -quantity_held, qoh.quantity - quantity_before), 0)) - , sum(sub.amount*greatest(least(sub.quantity -quantity_held, qoh.quantity - quantity_before), 0)/sub.quantity) , sum(sub.available_quantity) , sum(sub.available_amount) , sum(quantity_held) as quantity_help diff --git a/order_lines_view.php b/order_lines_view.php index c9e60db..00e0258 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -122,13 +122,11 @@ _("Quantity") => array('ord' => '', 'type' => 'qty', 'dec' => 0), _("Amount") => array('ord' => '', 'type' => 'amount'), _("Avail. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0), _("Avail. A") => array('ord' => '', 'type' => 'amount', 'dec' => 0), -_("Avai2. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0), -_("Avai2. A") => array('ord' => '', 'type' => 'amount', 'dec' => 0), _("Held. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0), _("required date") => array('ord' => '', 'type' => 'date'), _("Comments") => array('ord' => '', 'fun' => 'aggregate_comment'), _("comment 2 ") => 'skip', -_("Q to Pick") => array('ord' => '', 'type' => 'qty'), +_("Q to Pick") => array('ord' => '', 'type' => 'qty', 'dec' => 0), _("A to Pick") => array('ord' => '', 'type' => 'amount'), _("Pick")=> array('insert'=>true, 'fun'=>'pick_checkbox'), ); -- 2.30.2