From: Maxime Bourget Date: Mon, 3 Jun 2013 20:12:46 +0000 (+0100) Subject: Add color on available quantity X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=7099417ed904d1b154cdd96e20cf70f6659bab01;p=order_line_extra.git Add color on available quantity --- diff --git a/includes/order_lines.inc b/includes/order_lines.inc index 5f8d922..92391f6 100644 --- a/includes/order_lines.inc +++ b/includes/order_lines.inc @@ -110,6 +110,15 @@ function aggregate_comment($row) { return ''; } +function available_quantity($row, $available) { + $quantity = $row['quantity']; + $class = ''; + if($available== 0) $class = 'limited'; + else if($quantity > $available) $class = 'partial'; + + return "$available"; +} + function input_date_details($row, $date) { $row_id = $row['id']; $name = compute_input_name($row, 'required_date'); @@ -137,7 +146,7 @@ function get_order_details_extra($customer_id, $location) { $sql = "SELECT sod.id , so.order_no , stk_code - , sod.quantity - qty_sent + , sod.quantity - qty_sent quantity , GREATEST(0, LEAST(qoh.quantity - quantity_before, sod.quantity - qty_sent)) , quantity_before , required_date diff --git a/order_lines_view.php b/order_lines_view.php index e136626..2f0a14a 100644 --- a/order_lines_view.php +++ b/order_lines_view.php @@ -74,7 +74,7 @@ if($customer_id) { , _("Order #") => array('fun'=>'view_link', 'ord' => '') ,_("Item Code") => array('ord' => '', 'fun' => 'item_link') ,_("Quantity") => array('type' => 'qty', 'dec' => 0) - ,_("Available") => array('type' => 'qty', 'dec' => 0, 'ord' => '') + ,_("Available") => array('fun' => 'available_quantity', 'dec' => 0, 'ord' => '') ,_("Required Date") => array('fun' => 'input_date_details', 'ord' => '') ,_("Comment") => array('fun' => 'input_comment_details', 'ord' => '') );