Fixed edition of purchase order (bug #0000001)
[fa-stable.git] / gl / includes / ui / gl_journal_ui.inc
index 1b3c232fb03a3c25709f46f7c0e037cc07a335a8..1b281e9d027ce7bf3d2029827c813e5606db3d44 100644 (file)
@@ -15,7 +15,7 @@ function display_order_header(&$Order)
        echo "<table>";
        start_row();
     date_cells(_("Date:"), 'date_');
-       ref_cells(_("Reference:"), 'ref', references::get_next(0));
+       ref_cells(_("Reference:"), 'ref', '', references::get_next(0));
        end_row();
 
        echo "</table>";
@@ -52,6 +52,9 @@ function display_gl_items($title, &$order)
        else
                $th = array(_("Account Code"), _("Account Description"),
                        _("Debit"), _("Credit"), _("Memo"));
+
+       if (count($order->gl_items)) $th[] = '';
+
        table_header($th);      
 
        $k = 0;
@@ -121,10 +124,10 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
                        $_POST['dimension2_id'] = $item->dimension2_id;
 
                if ((!isset($_POST['AmountDebit']) || ($_POST['AmountDebit']=="")) && $item->amount > 0)
-                       $_POST['AmountDebit'] = $item->amount;
+                       $_POST['AmountDebit'] = price_format($item->amount);
 
                if ((!isset($_POST['AmountCredit']) || ($_POST['AmountCredit']=="")) && $item->amount <= 0)
-                       $_POST['AmountCredit'] = abs($item->amount);
+                       $_POST['AmountCredit'] = price_format(abs($item->amount));
 
                if (!isset($_POST['description']) || ($_POST['description'] == ""))
                        $_POST['description'] = $item->description;
@@ -142,17 +145,16 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        }
        else
        {
-               $_POST['AmountDebit'] = 0;
-               $_POST['AmountCredit'] = 0;
+               $_POST['AmountDebit'] = '';  //price_format(0);
+               $_POST['AmountCredit'] = ''; //price_format(0);
                $_POST['dimension_id'] = 0;
                $_POST['dimension2_id'] = 0;
                $_POST['LineMemo'] = "";
-               $_POST['CodeID2'] = "";
+               $_POST['_code_id_edit'] = "";
                $_POST['code_id'] = "";
                
-               text_cells(null, "CodeID2", "", 12, 10, "", "", "onkeyup='recalcAccounts();' onKeyDown='if(event.keyCode==13) event.keyCode=9;' onblur='return setAccount(0, false)'");
                $skip_bank = ($_SESSION["wa_current_user"]->access != 2);
-               gl_all_accounts_list_cells(null, 'code_id', null, $skip_bank, false, "return setAccount(1, false)");
+               gl_all_accounts_list('code_id', null, $skip_bank, false, true);
                if ($dim >= 1)
                        dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
                if ($dim > 1)
@@ -163,8 +165,8 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        if ($dim < 2)
                hidden('dimension2_id', 0);
 
-       amount_cells(null, 'AmountDebit');
-       amount_cells(null, 'AmountCredit');
+       small_amount_cells(null, 'AmountDebit');
+       small_amount_cells(null, 'AmountCredit');
        text_cells_ex(null, 'LineMemo', 35, 50);
 
        if (isset($_GET['Edit']))