Fixed edition of purchase order (bug #0000001)
[fa-stable.git] / gl / includes / ui / gl_payment_ui.inc
index 13fc5c6b701e52b9c2c6d9fca02eb206699e079f..0f3b0aa457d1fa466459fc9ff6bbf87829b42d68 100644 (file)
@@ -84,7 +84,7 @@ function display_order_header(&$order)
 
        bank_trans_types_list_row(_("Payment Type:"), 'type', null);
 
-    ref_row(_("Reference:"), 'ref', references::get_next(systypes::bank_payment()));
+    ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment()));
 
        echo "</table>"; // inner table
 
@@ -114,6 +114,9 @@ function display_gl_items($title, &$order)
        else
                $th = array(_("Account Code"), _("Account Description"),
                        _("Amount"), _("Memo"));
+
+       if (count($order->gl_items)) $th[] = '';
+
        table_header($th);
        $k = 0;  //row colour counter
 
@@ -166,7 +169,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                if (!isset($_POST['dimension2_id']))
                        $_POST['dimension2_id'] = $order->gl_items[$Index]->dimension2_id;
                if (!isset($_POST['amount']) || ($_POST['amount'] == ""))
-                       $_POST['amount'] = $order->gl_items[$Index]->amount;
+                       $_POST['amount'] = price_format($order->gl_items[$Index]->amount);
                if (!isset($_POST['description']) || ($_POST['description'] == ""))
                        $_POST['description'] = $order->gl_items[$Index]->description;
                if (!isset($_POST['LineMemo']) || ($_POST['LineMemo'] == ""))
@@ -183,7 +186,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        }
        else
        {
-               $_POST['amount'] = 0;
+               $_POST['amount'] = price_format(0);
                $_POST['dimension_id'] = 0;
                $_POST['dimension2_id'] = 0;
                $_POST['LineMemo'] = "";
@@ -202,8 +205,7 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                        $_POST['code_id'] = get_company_pref('default_assembly_act');
                else
                        $_POST['code_id'] = get_company_pref('default_cogs_act');
-               text_cells(null, "CodeID2", $_POST['code_id'], 12, 10, "", "", "onkeyup='recalcAccounts()' onblur='return setAccount(0, false)'");
-               gl_all_accounts_list_cells(null, 'code_id', $_POST['code_id'], true, false, "return setAccount(1, false)");
+               gl_all_accounts_list('code_id', null, true, false, true);
                if ($dim >= 1)
                        dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
                if ($dim > 1)