Customer Credit Note didn't update units when shifting items.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 15 Oct 2010 07:38:27 +0000 (07:38 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 15 Oct 2010 07:38:27 +0000 (07:38 +0000)
CHANGELOG.txt
sales/includes/ui/sales_credit_ui.inc

index e2d512a7e4760f6c1d9b402eeb9a20d051223b7d..2d740ce8b7c2551a59a73460884e1cd98bdfd94e 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+15-Oct-2010 Joe Hunt
+# Customer Credit Note didn't update units when shifting items.
+$ /sales/includes/ui/sales_credit_ui.inc
+
 14-Oct-2010 Joe Hunt
 # Check for empty class ID and better test for type/account id/name.
 $ /gl/manage/gl_account_classes.php
index 7804072564152232b224ec0760ac31090a3b1b34..a246d50d33fa189b4fcc103ea6d10fe680e64a02 100644 (file)
@@ -247,10 +247,11 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
        if ($line_no!=-1 && $line_no == $id)
        {
                $_POST['stock_id'] = $order->line_items[$id]->stock_id;
+               $dec = get_qty_dec($_POST['stock_id']);
                $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched, $_POST['stock_id'], $dec);
                $_POST['price'] = price_format($order->line_items[$id]->price);
                $_POST['Disc'] = percent_format(($order->line_items[$id]->discount_percent)*100);
-               $_POST['units'] = $order->line_items[$id]->units;
+               $units = $order->line_items[$id]->units;
                hidden('stock_id', $_POST['stock_id']);
                label_cell($_POST['stock_id']);
                label_cell($order->line_items[$id]->item_description, "nowrap");
@@ -269,21 +270,23 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
 
                $dec = $item_info['decimals'];
                $_POST['qty'] = number_format2(0, $dec);
-               $_POST['units'] = $item_info["units"];
-               $_POST['price'] = price_format(get_price($_POST['stock_id'], $order->customer_currency,
-                   $order->sales_type, $order->price_factor, $order->document_date));
-
+               $units = $item_info["units"];
+               $price = get_price($_POST['stock_id'],
+                       $order->customer_currency, $order->sales_type,
+                       $order->price_factor, get_post('OrderDate'));
+               $_POST['price'] = price_format($price);
+               
                // default to the customer's discount %
                $_POST['Disc'] = percent_format($order->default_discount * 100);
        }
 
        qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
 
-       label_cell($_POST['units']);
-       amount_cells(null, 'price',  null);
-       small_amount_cells(null, 'Disc', percent_format(0), null, null, user_percent_dec());
+       label_cell($units, '', 'units');
+       amount_cells(null, 'price');
+       small_amount_cells(null, 'Disc', percent_format($_POST['Disc']), null, null, user_percent_dec());
 
-       amount_cell(input_num('qty') * input_num('price') * (1 - input_num('Disc')/100));
+       amount_cell(input_num('qty') * input_num('price') * (1 - input_num('Disc')/100), false, '', 'line_total');
 
        if ($id!=-1)
        {