Automatic calculation of not set item prices from home currency and base price list...
[fa-stable.git] / sales / includes / ui / sales_credit_ui.inc
index 556ff8df5146d4b81dfa98ce7a1ff5fb996118fe..5acd6ac3d1bd8139ee0f53fe88ac12cda942bad5 100644 (file)
@@ -192,16 +192,15 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
        }
        else
        {
-               global $no_item_list; 
-               if ($no_item_list)
+               if (get_company_pref('no_item_list'))
                {
-                       echo "<td colspan=2>\n";
+                       echo "<td colspan=2 nowrap>\n";
                        stock_items_list('stock_id', null, false, true);
                        echo "</td>\n";
                }
                else
                {
-               text_cells(null, "StockID2", '', 12, 10, "", "", "class='combo' rel='stock_id' onblur='submit();'");
+               text_cells(null, "StockID2", '', 12, 10, "", "", "class='combo' rel='stock_id'"/* " onblur='submit();'"*/);
                stock_items_list_cells(null, 'stock_id', null, false, false, "class='combo' rel='StockID2'");
                }
                $item_info = get_item_edit_info($_POST['stock_id']);
@@ -209,8 +208,9 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
                $_POST['units'] = $item_info["units"];
 
                $_POST['qty'] = qty_format(0);
-               $_POST['price'] = get_price($_POST['stock_id'],
-                    $order->customer_currency, $order->sales_type);
+               $_POST['price'] = price_format(get_price($_POST['stock_id'], $order->customer_currency,
+                   $order->sales_type, $order->price_factor, $order->document_date));
+
                // default to the customer's discount %
                $_POST['Disc'] = percent_format($order->default_discount * 100);
        }
@@ -231,6 +231,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
                edit_button_cell('UpdateItem', _("Update"));
                edit_button_cell('CancelItemChanges', _("Cancel"));
                hidden('line_no', $line_no);
+               set_focus('qty');
        }
        else
        {