Icons removed form form buttons for now.
[fa-stable.git] / sales / includes / ui / sales_credit_ui.inc
index a38c4aedc86731f20b4e088eb7c040283a765a65..24f3beb49a7554294da513cffadbfcbe6809675f 100644 (file)
@@ -16,9 +16,9 @@ include_once($path_to_root . "/includes/ui.inc");
 function display_credit_header(&$order)
 {
        global $table_style, $Ajax;
-       start_table("width=80% $table_style");
-       echo "<tr><td valign=top>"; // outer table
-       echo "<table>";
+
+       start_outer_table("width=80% $table_style");
+       table_section(1);
 
        $customer_error = "";
        $change_prices = 0;
@@ -81,30 +81,23 @@ function display_credit_header(&$order)
 
        if (!isset($_POST['ref']))
                $_POST['ref'] = references::get_next(11);
-       if ($_SESSION['Items']->trans_no==0)
+       if ($order->trans_no==0)
            ref_row(_("Reference").':', 'ref');
        else
            label_row(_("Reference").':', $_POST['ref'] );
 
 
-
-       echo "</table>";
-
-       echo "</td><td>"; // outer table
-
        if (!is_company_currency($order->customer_currency))
        {
+               table_section(2);
+               
            div_start('currency');
-               echo "<table height='5'>";
                label_row(_("Customer Currency:"), $order->customer_currency);
                exchange_rate_display($order->customer_currency, get_company_currency(),
                        $_POST['OrderDate']);
-               echo "</table>";
-               echo "</td><td>"; // outer table
            div_end();
        }
-
-       echo "<table height='5'>";
+       table_section(3);
 
     if (!isset($_POST['sales_type_id']))
        $_POST['sales_type_id'] = $order->sales_type;
@@ -121,18 +114,18 @@ function display_credit_header(&$order)
     shippers_list_row(_("Shipping Company:"), 'ShipperID', $order->ship_via);
 
        label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%");
-       echo "</table>";
 
-       echo "</td><td>"; // outer table
-
-       echo "<table height='5'>";
+       table_section(4);
 
        if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "")
                $_POST['OrderDate'] = $order->document_date;
 
        date_row(_("Date:"), 'OrderDate', '', null, 0, 0, 0, null, true);
        if (isset($_POST['_OrderDate_changed'])) {
-               $change_prices = 1;
+               if (!is_company_currency($order->customer_currency) 
+                       && (get_base_sales_type()>0)) {
+                               $change_prices = 1;
+               }
                $Ajax->activate('currency');
        }
        // 2008-11-12 Joe Hunt added dimensions
@@ -148,11 +141,7 @@ function display_credit_header(&$order)
        else
                hidden('dimension2_id', 0);
 
-       echo "</table>";
-
-       echo "</td></tr>";
-
-       end_table(1); // outer table
+       end_outer_table(1); // outer table
 
        if ($change_prices != 0) {
                foreach ($order->line_items as $line_no=>$item) {
@@ -236,7 +225,7 @@ function display_credit_items($title, &$order)
 
     $taxes = $order->get_taxes($_POST['ChargeFreightCost']);
 
-    $tax_total = display_edit_tax_items($taxes, 6, $_SESSION['Items']->tax_included);
+    $tax_total = display_edit_tax_items($taxes, 6, $order->tax_included);
 
     $display_total = price_format(($subtotal + $_POST['ChargeFreightCost'] + $tax_total));
 
@@ -316,7 +305,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
 
 //---------------------------------------------------------------------------------
 
-function credit_options_controls()
+function credit_options_controls($credit)
 {
        global $table_style2, $Ajax;
        echo "<br>";
@@ -334,7 +323,7 @@ if (isset($_POST['_CreditType_update']))
 
                /*if the credit note is a return of goods then need to know which location to receive them into */
                if (!isset($_POST['Location']))
-                       $_POST['Location'] = $_SESSION['Items']->Location;
+                       $_POST['Location'] = $credit->Location;
                locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']);
        }
        else