Merged bugfixes upto [0000072] (version 2.0.3).
[fa-stable.git] / purchasing / includes / ui / invoice_ui.inc
index b583553f10ec3e66dc4704b03fa340a3fffb1cd9..2b60ae37386a6048156a610d3788a3981048bfeb 100644 (file)
@@ -44,6 +44,8 @@ function copy_to_trans(&$supp_trans)
 
 function invoice_header(&$supp_trans)
 {
+       global $Ajax;
+       
        // if vars have been lost, recopy
        if (!isset($_POST['tran_date']))
                copy_from_trans($supp_trans);
@@ -83,6 +85,13 @@ function invoice_header(&$supp_trans)
        echo "<table width=100%>";
 
        date_row(_("Date") . ":", 'tran_date', '', null, 0, 0, 0, "", true);
+       if (isset($_POST['_tran_date_changed'])) {
+               $Ajax->activate('_ex_rate');
+               $supp_trans->tran_date = $_POST['tran_date'];
+               get_duedate_from_terms($supp_trans);
+               $_POST['due_date'] = $supp_trans->due_date;
+               $Ajax->activate('due_date');
+       }
 
     date_row(_("Due Date") . ":", 'due_date');
 
@@ -178,12 +187,14 @@ function display_gl_items(&$supp_trans, $mode=0)
        echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
        if ($mode == 0)
        {
-       submit_cells('InvGL', _("Edit"), "align=right");
+       submit_cells('InvGL', _("Edit"), "align=right",
+                       _('Moves to additional costs posting page'), true);
        }
        echo "</tr></table>";
 
        echo "</td></tr><tr><td>"; // ouer table
 
+       div_start('gl_items');
        echo "<table width=100% $table_style>";
 
        $dim = get_company_pref('use_dimension');
@@ -221,7 +232,8 @@ function display_gl_items(&$supp_trans, $mode=0)
                        label_cell($entered_gl_code->memo_);
 
                        if ($mode == 1)
-                               delete_link_cell(SID . "Delete=" . $entered_gl_code->Counter);
+                               edit_button_cell("Delete" . $entered_gl_code->Counter, _("Delete"),
+                                         _('Remove line from document'));
 
                        end_row();
 
@@ -241,11 +253,11 @@ function display_gl_items(&$supp_trans, $mode=0)
                "colspan=".$colspan." align=right", "nowrap align=right");
 
        echo "</table>";
+       div_end();
 
     echo "</td></tr>";
 
     end_table(); // outertable
-
        return $total_gl_value;
 }
 
@@ -281,19 +293,20 @@ function display_grn_items(&$supp_trans, $mode=0)
                $heading = _("Received Items Charged on this Invoice");
        else
                $heading = _("Received Items Credited on this Note");
-
        echo "<table width=100% >";
        echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
        if ($mode == 0)
        {
-               submit_cells('InvGRN', _("Edit"), "align=right");
+               submit_cells('InvGRN', _("Edit"), "align=right",
+                       _('Moves to GRN selection page'), true);
        }
        echo "</tr></table>";
 
        echo "</td></tr><tr><td>"; // outer table
 
+  div_start('grn_items');
        echo "<table width=100% $table_style>";
-       $th = array(_("Delivery Sequence #"), _("Item"), _("Description"),
+       $th = array(_("Delivery"), _("Item"), _("Description"),
                _("Quantity"), _("Price"), _("Line Value"));
 
        table_header($th);
@@ -308,7 +321,8 @@ function display_grn_items(&$supp_trans, $mode=0)
 
                alt_table_row_color($k);
 
-               label_cell(get_trans_view_str(25,$entered_grn->id));
+                       $grn_batch = get_grn_batch_from_item($entered_grn->id);
+               label_cell(get_trans_view_str(25,$grn_batch));
                        label_cell($entered_grn->item_code);
                        label_cell($entered_grn->item_description);
                        qty_cell(abs($entered_grn->this_quantity_inv), false, get_qty_dec($entered_grn->item_code));
@@ -316,7 +330,8 @@ function display_grn_items(&$supp_trans, $mode=0)
                        amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv)), user_price_dec());
 
                        if ($mode == 1)
-                               delete_link_cell(SID . "Delete=" . $entered_grn->id);
+                               edit_button_cell("Delete" . $entered_grn->id, _("Delete"),
+                                         _('Remove item from document'));
 
                        end_row();
 
@@ -335,11 +350,10 @@ function display_grn_items(&$supp_trans, $mode=0)
        label_row(_("Total"), price_format($total_grn_value),
                "colspan=5 align=right", "nowrap align=right");
     echo "</table>";
-
+    div_end();
     echo "</td></tr>";
 
     end_table(); // outertable
-
        return $total_grn_value;
 }