Changed design of Supplier Invoice/Credit. Everything is now done in one document form
! -> Note
$ -> Affected files
+------------------------------- Release 2.0.4 --------------------------------------------
+23.Oct-2008 Joe Hunt
+! Release 2.0.4
+$ config.php
+! Changed design of Supplier Invoice/Credit. Everything is now done in one document form.
+$ /purchasing/supplier_invoice.php
+ /purchasing/supplier_credit.php
+ /purchasing/includes/ui/invoice_ui.inc
+ /purchasing/supplier_invoice_grns.php (File removed)
+ /purchasing/supplier_credit_grns.php (File removed)
+ /purchasing/supplier_trans_gl.php (File removed)
+
22-Oct-2008 Joe Hunt
+ Added Ending Balance in trial balance (also in report)
$ /gl/inquiry/gl_trial_balance.php
// Main Title
$app_title = "FrontAccounting";
// application version
- $version = "2.0.3";
+ $version = "2.0.4";
// Build for development purposes
$build_version = date("d.m.Y", filemtime("$path_to_root/CHANGELOG.txt"));
else
{
$begin = begin_fiscalyear();
- if ($_POST['TransFromDate'] < $begin)
+ if (date1_greater_date2($begin, $_POST['TransFromDate']))
$begin = $_POST['TransFromDate'];
$begin = add_days($begin, -1);
}
}
//--------------------------------------------------------------------------------------------------
+function display_gl_controls(&$supp_trans)
+{
+ global $table_style, $Ajax;
+
+ div_start('gl_ctrls'); // 2008-10-18 Joe Hunt Moved up a bit to compute num-rows = 0
+
+ $accs = get_supplier_accounts($supp_trans->supplier_id);
+ $_POST['gl_code'] = $accs['purchase_account'];
+ $k = 0;
+ alt_table_row_color($k);
+ gl_all_accounts_list('gl_code', null, true, false, true);
+ $dim = get_company_pref('use_dimension');
+ if ($dim >= 1)
+ dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
+ if ($dim > 1)
+ dimensions_list_cells(null, 'dimension2_id', null, true, " ", false, 2);
+ if ($dim < 1)
+ hidden('dimension_id', 0);
+ if ($dim < 2)
+ hidden('dimension2_id', 0);
+ amount_cells(null, 'amount');
+ text_cells_ex(null, 'memo_', 35, 50);
+ submit_cells('AddGLCodeToTrans', _("Add"), "",
+ _('Add GL Line'), true);
+ submit_cells('ClearFields', _("Reset"), "",
+ _("Clear all GL entry fields"), true);
+
+ div_end();
+}
-// $mode = 0 display on invoice page
-// = 1 display on gl items edit page
+// $mode = 0 none at the moment
+// = 1 display on invoice/credit page
// = 2 display on view invoice
// = 3 display on view credit
{
global $table_style, $path_to_root;
- if ($mode == 0 && isset($_POST["InvGL"]))
- {
- copy_to_trans($supp_trans);
- meta_forward("$path_to_root/purchasing/supplier_trans_gl.php");
- exit;
- }
-
// if displaying in form, and no items, exit
if (($mode == 2 || $mode == 3) && count($supp_trans->gl_codes) == 0)
- return;
+ return 0;
echo "<br>";
echo "<table width=100%>";
echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
- if ($mode == 0)
- {
- submit_cells('InvGL', _("Edit"), "align=right",
- _('Moves to additional costs posting page'), true);
- }
echo "</tr></table>";
echo "</td></tr><tr><td>"; // ouer table
else
$th = array(_("Account"), _("Name"), _("Amount"), _("Memo"));
+ if ($mode == 1)
+ {
+ $th[] = "";
+ $th[] = "";
+ }
table_header($th);
$total_gl_value=0;
$i = $k = 0;
label_cell($entered_gl_code->memo_);
if ($mode == 1)
- edit_button_cell("Delete" . $entered_gl_code->Counter, _("Delete"),
+ {
+ edit_button_cell("Delete2" . $entered_gl_code->Counter, _("Delete"),
_('Remove line from document'));
-
+ label_cell("");
+ }
end_row();
$total_gl_value += $entered_gl_code->amount;
}
}
+ if ($mode == 1)
+ display_gl_controls(&$supp_trans);
$colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));
label_row(_("Total"), price_format($total_gl_value),
"colspan=".$colspan." align=right", "nowrap align=right");
return $total_gl_value;
}
-//--------------------------------------------------------------------------------------------------
-
-// $mode = 0 display on invoice page
-// = 1 display on grn items edit page
-// = 2 display on view invoice
-// = 3 display on view credit
+//--------------//-----------------------------------------------------------------------------------------
-function display_grn_items(&$supp_trans, $mode=0)
+function display_grn_items_for_selection(&$supp_trans)
{
- global $table_style, $path_to_root;
+ global $table_style;
- if ($mode == 0 && isset($_POST["InvGRN"]))
+ div_start('grn_table'); // 2008-10-18 Joe Hunt Moved up a bit to compute num-rows = 0
+ if ($supp_trans->is_invoice)
+ $result = get_grn_items(0, $supp_trans->supplier_id, true);
+ else
+ $result = get_grn_items(0, $supp_trans->supplier_id, false, true);
+
+ if (db_num_rows($result) == 0)
{
- copy_to_trans($supp_trans);
if ($supp_trans->is_invoice)
- meta_forward("$path_to_root/purchasing/supplier_invoice_grns.php");
+ display_note(_("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1);
else
- meta_forward("$path_to_root/purchasing/supplier_credit_grns.php");
- exit;
+ {
+ display_note(_("There are no received items for the selected supplier that have been invoiced."));
+ display_note(_("Credits can only be applied to invoiced items."), 0, 1);
+ }
+ div_end(); // Changed 2008-10-18 Joe Hunt
+ return;
}
+
+ /*Set up a table to show the outstanding GRN items for selection */
+
+ $k = 0;
+
+ while ($myrow = db_fetch($result))
+ {
+ $grn_already_on_invoice = false;
+
+ foreach ($supp_trans->grn_items as $entered_grn)
+ {
+ if ($entered_grn->id == $myrow["id"])
+ {
+ $grn_already_on_invoice = true;
+ }
+ }
+ if ($grn_already_on_invoice == false)
+ {
+
+ alt_table_row_color($k);
+
+ $n = $myrow["id"];
+ label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
+ label_cell($myrow["id"].
+ hidden('qty_recd'.$n, $myrow["qty_recd"], false).
+ hidden('item_code'.$n, $myrow["item_code"], false).
+ hidden('item_description'.$n, $myrow["description"], false).
+ hidden('prev_quantity_inv'.$n, $myrow['quantity_inv'], false).
+ hidden('order_price'.$n, $myrow['unit_price'], false).
+ hidden('std_cost_unit'.$n, $myrow['std_cost_unit'], false).
+ hidden('po_detail_item'.$n, $myrow['po_detail_item'], false));
+ label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
+ label_cell($myrow["item_code"]);
+ label_cell($myrow["description"]);
+ label_cell(sql2date($myrow["delivery_date"]));
+ $dec = get_qty_dec($myrow["item_code"]);
+ qty_cell($myrow["qty_recd"], false, $dec);
+ qty_cell($myrow["quantity_inv"], false, $dec);
+ if ($supp_trans->is_invoice)
+ qty_cells(null, 'this_quantity_inv'.$n, number_format2($myrow["qty_recd"] - $myrow["quantity_inv"], $dec),
+ null, null, $dec);
+ else
+ qty_cells(null, 'This_QuantityCredited'.$n, number_format2(max($myrow["quantity_inv"], 0), $dec),
+ null, null, $dec);
+ amount_cells(null, 'ChgPrice'.$n, price_format($myrow["unit_price"]));
+ if ($supp_trans->is_invoice)
+ amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]), user_price_dec()));
+ else
+ amount_cell(round($myrow["unit_price"] * max($myrow['quantity_inv'], 0), user_price_dec()));
+ if ($supp_trans->is_invoice)
+ submit_cells('grn_item_id'.$n, _("Add"), '', _("Add to Invoice"), true);
+ else
+ submit_cells('grn_item_id'.$n, _("Add"), '', _("Add to Credit Note"), true);
+ if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+ submit_cells('void_item_id'.$n, _("Remove"), '', _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!"), true);
+ end_row();
+ }
+ }
+
+ div_end();
+}
+
+//------------------------------------------------------------------------------------
+
+// $mode = 0 none at the moment
+// = 1 display on invoice/credit page
+// = 2 display on view invoice
+// = 3 display on view credit
+
+function display_grn_items(&$supp_trans, $mode=0)
+{
+ global $table_style, $path_to_root;
// if displaying in form, and no items, exit
if (($mode == 2 || $mode == 3) && count($supp_trans->grn_items) == 0)
- return;
+ return 0;
br(1);
start_table("width=95%");
echo "<tr><td>"; // outertable
-
- if ($supp_trans->is_invoice)
- $heading = _("Received Items Charged on this Invoice");
+ $heading2 = "";
+ if ($mode == 1)
+ {
+ if ($supp_trans->is_invoice)
+ {
+ $heading = _("Items Received Yet to be Invoiced");
+ if ($_SESSION["wa_current_user"]->access == 2) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+ $heading2 = _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!");
+ }
+ else
+ $heading = _("Delivery Item Selected For Adding To A Supplier Credit Note");
+ }
else
- $heading = _("Received Items Credited on this Note");
+ {
+ if ($supp_trans->is_invoice)
+ $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)
+ if ($mode == 1 && $heading2 != "")
{
- submit_cells('InvGRN', _("Edit"), "align=right",
- _('Moves to GRN selection page'), true);
- }
+ echo "</tr><td>";
+ display_note($heading2, 0, 0, "class='overduefg'");
+ echo "</td>\n";
+ }
echo "</tr></table>";
echo "</td></tr><tr><td>"; // outer table
- div_start('grn_items');
+ div_start('grn_items');
echo "<table width=100% $table_style>";
- $th = array(_("Delivery"), _("Item"), _("Description"),
- _("Quantity"), _("Price"), _("Line Value"));
+ if ($mode == 1)
+ {
+ $th = array(_("Delivery"), _("Sequence #"), _("P.O."), _("Item"), _("Description"),
+ _("Received On"), _("Quantity Received"), _("Quantity Invoiced"),
+ _("Qty Yet To Invoice"), _("Order Price"), _("Total"), "");
+ if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
+ $th[] = "";
+ if (!$supp_trans->is_invoice)
+ {
+ $th[8] = _("Qty Yet To Credit");
+ }
+ }
+ else
+ $th = array(_("Delivery"), _("Item"), _("Description"),
+ _("Quantity"), _("Price"), _("Line Value"));
table_header($th);
$total_grn_value = 0;
$grn_batch = get_grn_batch_from_item($entered_grn->id);
label_cell(get_trans_view_str(25,$grn_batch));
+ if ($mode == 1)
+ {
+ label_cell($entered_grn->id);
+ label_cell(""); // PO
+ }
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));
+ $dec = get_qty_dec($entered_grn->item_code);
+ if ($mode == 1)
+ {
+ label_cell("");
+ qty_cell($entered_grn->qty_recd, false, $dec);
+ qty_cell($entered_grn->prev_quantity_inv, false, $dec);
+ }
+ qty_cell(abs($entered_grn->this_quantity_inv), false, $dec);
amount_cell($entered_grn->chg_price);
amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv)), user_price_dec());
if ($mode == 1)
+ {
edit_button_cell("Delete" . $entered_grn->id, _("Delete"),
_('Remove item from document'));
-
+ if ($supp_trans->is_invoice && $_SESSION["wa_current_user"]->access == 2)
+ label_cell("");
+ }
end_row();
$total_grn_value += round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv),
}
}
}
-
+ if ($mode == 1)
+ {
+ display_grn_items_for_selection($supp_trans);
+ $colspan = 10;
+ }
+ else
+ $colspan = 5;
label_row(_("Total"), price_format($total_grn_value),
- "colspan=5 align=right", "nowrap align=right");
+ "colspan=$colspan align=right", "nowrap align=right");
echo "</table>";
div_end();
echo "</td></tr>";
$_SESSION['supp_trans']->is_invoice = false;
}
+function clear_fields()
+{
+ global $Ajax;
+
+ unset($_POST['gl_code']);
+ unset($_POST['dimension_id']);
+ unset($_POST['dimension2_id']);
+ unset($_POST['amount']);
+ unset($_POST['memo_']);
+ unset($_POST['AddGLCodeToTrans']);
+ $Ajax->activate('gl_ctrls');
+ set_focus('gl_code');
+}
+//------------------------------------------------------------------------------------------------
+// GL postings are often entered in the same form to two accounts
+// so fileds are cleared only on user demand.
+//
+if (isset($_POST['ClearFields']))
+{
+ clear_fields();
+}
+
+if (isset($_POST['AddGLCodeToTrans'])){
+
+ $Ajax->activate('gl_items');
+ $input_error = false;
+
+ $sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code='" . $_POST['gl_code'] . "'";
+ $result = db_query($sql,"get account information");
+ if (db_num_rows($result) == 0)
+ {
+ display_error(_("The account code entered is not a valid code, this line cannot be added to the transaction."));
+ set_focus('gl_code');
+ $input_error = true;
+ }
+ else
+ {
+ $myrow = db_fetch_row($result);
+ $gl_act_name = $myrow[1];
+ if (!check_num('amount'))
+ {
+ display_error(_("The amount entered is not numeric. This line cannot be added to the transaction."));
+ set_focus('amount');
+ $input_error = true;
+ }
+ }
+
+ if ($input_error == false)
+ {
+ $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name,
+ $_POST['dimension_id'], $_POST['dimension2_id'],
+ input_num('amount'), $_POST['memo_']);
+ set_focus('gl_code');
+ }
+}
+
+
//---------------------------------------------------------------------------------------------------
function check_data()
handle_commit_credit_note();
}
+function check_item_data($n)
+{
+ if (!check_num('This_QuantityCredited'.$n, 0))
+ {
+ display_error(_("The quantity to credit must be numeric and greater than zero."));
+ set_focus('This_QuantityCredited'.$n);
+ return false;
+ }
+
+ if (!check_num('ChgPrice'.$n, 0))
+ {
+ display_error(_("The price is either not numeric or negative."));
+ set_focus('ChgPrice'.$n);
+ return false;
+ }
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------------------
+
+$id = find_submit('grn_item_id');
+if ($id != -1)
+{
+ if (check_item_data($id))
+ {
+ $complete = False;
+
+ //$_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'],
+ // $_POST['po_detail_item'], $_POST['item_code'],
+ // $_POST['item_description'], $_POST['qty_recd'],
+ // $_POST['prev_quantity_inv'], $_POST['This_QuantityCredited'],
+ // $_POST['order_price'], $_POST['ChgPrice'], $complete,
+ // $_POST['std_cost_unit'], $_POST['gl_code']);
+ $_SESSION['supp_trans']->add_grn_to_trans($id,
+ $_POST['po_detail_item'.$id], $_POST['item_code'.$id],
+ $_POST['item_description'.$id], $_POST['qty_recd'.$id],
+ $_POST['prev_quantity_inv'.$id], input_num('This_QuantityCredited'.$id),
+ $_POST['order_price'.$id], input_num('ChgPrice'.$id), $complete,
+ $_POST['std_cost_unit'.$id], "");
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+$id = find_submit('Delete');
+if ($id != -1)
+{
+ $_SESSION['supp_trans']->remove_grn_from_trans($id);
+ $Ajax->activate('grn_items');
+ $Ajax->activate('grn_table');
+ $Ajax->activate('inv_tot');
+}
+
+$id = find_submit('Delete2');
+if ($id != -1)
+{
+ $_SESSION['supp_trans']->remove_gl_codes_from_trans($id);
+ clear_fields();
+ $Ajax->activate('gl_items');
+ $Ajax->activate('inv_tot');
+}
+
+
//--------------------------------------------------------------------------------------------------
start_form(false, true);
-start_table("$table_style width=80%", 8);
+start_table("$table_style width=98%", 8);
echo "<tr><td valign=center>"; // outer table
echo "<center>";
else {
echo "</td></tr><tr><td valign=center>"; // outer table
- $total_grn_value = display_grn_items($_SESSION['supp_trans']);
+ $total_grn_value = display_grn_items($_SESSION['supp_trans'], 1);
- $total_gl_value = display_gl_items($_SESSION['supp_trans']);
+ $total_gl_value = display_gl_items($_SESSION['supp_trans'], 1);
echo "</td></tr><tr><td align=center colspan=2>"; // outer table
-
+ div_start('inv_tot');
invoice_totals($_SESSION['supp_trans']);
+ div_end();
}
echo "</td></tr>";
end_table(1); // outer table
+$id = find_submit('grn_item_id');
+if ($id != -1)
+{
+ $Ajax->activate('grn_table');
+ $Ajax->activate('grn_items');
+ $Ajax->activate('inv_tot');
+}
+
+if (get_post('AddGLCodeToTrans'))
+ $Ajax->activate('inv_tot');
+
+
submit_center('PostCreditNote', _("Enter Credit Note"), true, '', true);
echo "<br><br>";
+++ /dev/null
-<?php
-
-$page_security = 5;
-$path_to_root="..";
-
-include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
-include_once($path_to_root . "/includes/session.inc");
-include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
-include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
-
-$js = "";
-if ($use_date_picker)
- $js .= get_js_date_picker();
-if ($use_popup_windows)
- $js .= get_js_open_window(900, 500);
-page(_("Select Received Items to Add"), false, false, "", $js);
-
-if (!isset($_SESSION['supp_trans']))
-{
- display_note(_("To enter supplier transactions the supplier must first be selected from the supplier selection screen, then the link to enter a supplier credit note must be clicked on."));
- exit;
- /*It all stops here if there aint no supplier selected and credit note initiated ie $_SESSION['supp_trans'] started off*/
-}
-
-//-----------------------------------------------------------------------------------------
-
-display_heading($_SESSION['supp_trans']->supplier_name);
-echo "<br>";
-
-//-----------------------------------------------------------------------------------------
-
-function check_data()
-{
- if (!check_num('This_QuantityCredited', 0))
- {
- display_error(_("The quantity to credit must be numeric and greater than zero."));
- set_focus('This_QuantityCredited');
- return false;
- }
-
- if (!check_num('ChgPrice', 0))
- {
- display_error(_("The price is either not numeric or negative."));
- set_focus('ChgPrice');
- return false;
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------------------------
-
-if (isset($_POST['AddGRNToTrans']))
-{
-
- if (check_data())
- {
- $complete = False;
-
- //$_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'],
- // $_POST['po_detail_item'], $_POST['item_code'],
- // $_POST['item_description'], $_POST['qty_recd'],
- // $_POST['prev_quantity_inv'], $_POST['This_QuantityCredited'],
- // $_POST['order_price'], $_POST['ChgPrice'], $complete,
- // $_POST['std_cost_unit'], $_POST['gl_code']);
- $_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'],
- $_POST['po_detail_item'], $_POST['item_code'],
- $_POST['item_description'], $_POST['qty_recd'],
- $_POST['prev_quantity_inv'], input_num('This_QuantityCredited'),
- $_POST['order_price'], input_num('ChgPrice'), $complete,
- $_POST['std_cost_unit'], "");
- }
-}
-
-//-----------------------------------------------------------------------------------------
-$id = find_submit('Delete');
-if ($id != -1)
-{
- $_SESSION['supp_trans']->remove_grn_from_trans($id);
- $Ajax->activate('grn_items');
- $Ajax->activate('grn_table');
-}
-
-//-----------------------------------------------------------------------------------------
-start_form(false,true);
-display_grn_items($_SESSION['supp_trans'], 1);
-end_form();
-echo "<br>";
-
-hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Return to Credit Note Entry"));
-echo "<hr>";
-
-//-----------------------------------------------------------------------------------------
-
-// get the supplier grns that have been invoiced
-$result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, false, true);
-
-if (db_num_rows($result) == 0)
-{
- display_note(_("There are no received items for the selected supplier that have been invoiced."));
- display_note(_("Credits can only be applied to invoiced items."));
-
- echo "<br>";
- end_page();
- exit;
-}
-
-/*Set up a table to show the GRN items outstanding for selection */
-start_form(false, true);
-
-div_start('grn_table');
-start_table("$table_style width=95%");
-$th = array(_("Delivery"), _("Sequence #"), _("Order"), _("Item Code"), _("Description"),
- _("Delivered"), _("Total Qty Received"), _("Qty Already Invoiced"),
- _("Qty Yet To Invoice"), _("Order Price"), _("Line Value"));
-table_header($th);
-$i = $k =0;
-while ($myrow = db_fetch($result))
-{
-
- $grn_already_on_credit = False;
-
- foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
- {
- if ($entered_grn->id == $myrow["id"])
- {
- $grn_already_on_credit = True;
- }
- }
- if ($grn_already_on_credit == False)
- {
-
- alt_table_row_color($k);
-
- label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
- submit_cells('grn_item_id'.$myrow["id"], $myrow["id"], '', '', true);
- label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
- label_cell($myrow["item_code"]);
- label_cell($myrow["description"]);
- label_cell(sql2date($myrow["delivery_date"]));
- $dec = get_qty_dec($myrow["item_code"]);
- qty_cell($myrow["qty_recd"], false, $dec);
- qty_cell($myrow["quantity_inv"], false, $dec);
- qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
- amount_cell($myrow["unit_price"]);
- amount_cell(round($myrow["unit_price"] * $myrow["quantity_inv"], user_price_dec()));
- end_row();
- $i++;
- if ($i > 15)
- {
- $i = 0;
- table_header($th);
- }
- }
-}
-
-end_table();
-div_end();
-
-//-----------------------------------------------------------------------------------------
-$id = find_submit('grn_item_id');
-if ($id || get_post('AddGRNToTrans'))
-{
- $Ajax->activate('grn_selector');
-}
-if (get_post('AddGRNToTrans'))
-{
- $Ajax->activate('grn_table');
- $Ajax->activate('grn_items');
-}
-
-
-div_start('grn_selector');
-$id = find_submit('grn_item_id');
-if ($id != -1)
-{
-
- $myrow = get_grn_item_detail($id);
-
- echo "<br>";
- display_heading2(_("Delivery Item Selected For Adding To A Supplier Credit Note"));
- start_table("$table_style width=80%");
- $th = array(_("Sequence #"), _("Item"), _("Qty Already Invoiced"),
- _("Quantity to Credit"), _("Order Price"), _("Credit Price"));
- table_header($th);
-
- start_row();
- label_cell($id);
- label_cell($myrow['item_code'] . " " . $myrow['description']);
- $dec = get_qty_dec($myrow['item_code']);
- qty_cell($myrow["quantity_inv"], false, $dec);
- qty_cells(null, 'This_QuantityCredited', number_format2(max($myrow['quantity_inv'],0), $dec), null, null, $dec);
- amount_cell($myrow['unit_price']);
- amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
- end_row();
- end_table(1);
-
- submit_center('AddGRNToTrans', _("Add to Credit Note"), true, '', true);
-
- hidden('GRNNumber', $id);
- hidden('item_code', $myrow['item_code']);;
- hidden('item_description', $myrow['description']);
- hidden('qty_recd', $myrow['qty_recd']);
- hidden('prev_quantity_inv', $myrow['quantity_inv']);
- hidden('order_price', $myrow['unit_price']);
- hidden('std_cost_unit', $myrow['std_cost_unit']);
-
- hidden('po_detail_item', $myrow['po_detail_item']);
-}
-div_end();
-
-end_form();
-echo '<br>';
-end_page(false, true);
-?>
}
//--------------------------------------------------------------------------------------------------
+function clear_fields()
+{
+ global $Ajax;
+
+ unset($_POST['gl_code']);
+ unset($_POST['dimension_id']);
+ unset($_POST['dimension2_id']);
+ unset($_POST['amount']);
+ unset($_POST['memo_']);
+ unset($_POST['AddGLCodeToTrans']);
+ $Ajax->activate('gl_ctrls');
+ set_focus('gl_code');
+}
+//------------------------------------------------------------------------------------------------
+// GL postings are often entered in the same form to two accounts
+// so fileds are cleared only on user demand.
+//
+if (isset($_POST['ClearFields']))
+{
+ clear_fields();
+}
+
+if (isset($_POST['AddGLCodeToTrans'])){
+
+ $Ajax->activate('gl_items');
+ $input_error = false;
+
+ $sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code='" . $_POST['gl_code'] . "'";
+ $result = db_query($sql,"get account information");
+ if (db_num_rows($result) == 0)
+ {
+ display_error(_("The account code entered is not a valid code, this line cannot be added to the transaction."));
+ set_focus('gl_code');
+ $input_error = true;
+ }
+ else
+ {
+ $myrow = db_fetch_row($result);
+ $gl_act_name = $myrow[1];
+ if (!check_num('amount'))
+ {
+ display_error(_("The amount entered is not numeric. This line cannot be added to the transaction."));
+ set_focus('amount');
+ $input_error = true;
+ }
+ }
+
+ if ($input_error == false)
+ {
+ $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name,
+ $_POST['dimension_id'], $_POST['dimension2_id'],
+ input_num('amount'), $_POST['memo_']);
+ set_focus('gl_code');
+ }
+}
+
+//------------------------------------------------------------------------------------------------
function check_data()
{
handle_commit_invoice();
}
+function check_item_data($n)
+{
+ global $check_price_charged_vs_order_price,
+ $check_qty_charged_vs_del_qty;
+ if (!check_num('this_quantity_inv'.$n, 0) || input_num('this_quantity_inv'.$n)==0)
+ {
+ display_error( _("The quantity to invoice must be numeric and greater than zero."));
+ set_focus('this_quantity_inv'.$n);
+ return false;
+ }
+
+ if (!check_num('ChgPrice'.$n))
+ {
+ display_error( _("The price is not numeric."));
+ set_focus('ChgPrice'.$n);
+ return false;
+ }
+
+ if ($check_price_charged_vs_order_price == True)
+ {
+ if ($_POST['order_price'.$n]!=input_num('ChgPrice'.$n)) {
+ if ($_POST['order_price'.$n]==0 ||
+ input_num('ChgPrice'.$n)/$_POST['order_price'.$n] >
+ (1 + (sys_prefs::over_charge_allowance() / 100)))
+ {
+ display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") .
+ _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
+ set_focus('ChgPrice'.$n);
+ return false;
+ }
+ }
+ }
+
+ if ($check_qty_charged_vs_del_qty == True)
+ {
+ if (input_num('this_quantity_inv'.$n) / ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]) >
+ (1+ (sys_prefs::over_charge_allowance() / 100)))
+ {
+ display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.")
+ . _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
+ set_focus('this_quantity_inv'.$n);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+$id = find_submit('grn_item_id');
+if ($id != -1)
+{
+ if (check_item_data($id))
+ {
+ if (input_num('this_quantity_inv'.$id) >= ($_POST['qty_recd'.$id] - $_POST['prev_quantity_inv'.$id]))
+ {
+ $complete = true;
+ }
+ else
+ {
+ $complete = false;
+ }
+
+ $_SESSION['supp_trans']->add_grn_to_trans($id, $_POST['po_detail_item'.$id],
+ $_POST['item_code'.$id], $_POST['item_description'.$id], $_POST['qty_recd'.$id],
+ $_POST['prev_quantity_inv'.$id], input_num('this_quantity_inv'.$id),
+ $_POST['order_price'.$id], input_num('ChgPrice'.$id), $complete,
+ $_POST['std_cost_unit'.$id], "");
+ }
+}
+
//--------------------------------------------------------------------------------------------------
+$id = find_submit('Delete');
+if ($id != -1)
+{
+ $_SESSION['supp_trans']->remove_grn_from_trans($id);
+ $Ajax->activate('grn_items');
+ $Ajax->activate('grn_table');
+ $Ajax->activate('inv_tot');
+}
+
+$id = find_submit('Delete2');
+if ($id != -1)
+{
+ $_SESSION['supp_trans']->remove_gl_codes_from_trans($id);
+ clear_fields();
+ $Ajax->activate('gl_items');
+ $Ajax->activate('inv_tot');
+}
start_form(false, true);
-start_table("$table_style2 width=80%", 8);
+start_table("$table_style2 width=98%", 8);
echo "<tr><td valign=center>"; // outer table
echo "<center>";
echo "<center>";
- display_grn_items($_SESSION['supp_trans']);
-
- display_gl_items($_SESSION['supp_trans']);
+ display_grn_items($_SESSION['supp_trans'], 1);
+ //display_grn_items_for_selection();
+ display_gl_items($_SESSION['supp_trans'], 1);
+ //display_gl_controls();
//echo "</td></tr><tr><td align=center colspan=2>"; // outer table
echo "<br>";
+ div_start('inv_tot');
invoice_totals($_SESSION['supp_trans']);
+ div_end();
}
echo "</td></tr>";
end_table(); // outer table
+//-----------------------------------------------------------------------------------------
+$id = find_submit('grn_item_id');
+$id2 = find_submit('void_item_id');
+if ($id != -1 || $id2 != -1)
+{
+ $Ajax->activate('grn_table');
+ $Ajax->activate('grn_items');
+ $Ajax->activate('inv_tot');
+}
+
+if (get_post('AddGLCodeToTrans'))
+ $Ajax->activate('inv_tot');
+
+if ($_SESSION["wa_current_user"]->access == 2)
+{
+ if ($id2 != -1) // Added section 2008-10-18 Joe Hunt for voiding delivery lines
+ {
+ begin_transaction();
+
+ $myrow = get_grn_item_detail($id2);
+
+ $grn = get_grn_batch($myrow['grn_batch_id']);
+
+ $sql = "UPDATE ".TB_PREF."purch_order_details
+ SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"];
+ db_query($sql, "The quantity invoiced of the purchase order line could not be updated");
+
+ $sql = "UPDATE ".TB_PREF."grn_items
+ SET qty_recd = quantity_inv WHERE id = ".$myrow["id"];
+ db_query($sql, "The quantity invoiced off the items received record could not be updated");
+
+ update_average_material_cost($grn["supplier_id"], $myrow["item_code"],
+ $myrow["unit_price"], -$myrow["QtyOstdg"], Today());
+
+ add_stock_move(25, $myrow["item_code"], $myrow['grn_batch_id'], $grn['loc_code'], sql2date($grn["delivery_date"]), "",
+ -$myrow["QtyOstdg"], $myrow['std_cost_unit'], $grn["supplier_id"], 1, $myrow['unit_price']);
+
+ commit_transaction();
+ }
+}
+
echo "<br>";
submit_center('PostInvoice', _("Enter Invoice"), true, '', true);
echo "<br>";
+++ /dev/null
-<?php
-
-$page_security = 5;
-$path_to_root="..";
-
-include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
-include_once($path_to_root . "/includes/session.inc");
-include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
-include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
-
-$js = "";
-if ($use_date_picker)
- $js .= get_js_date_picker();
-if ($use_popup_windows)
- $js .= get_js_open_window(900, 500);
-page(_("Select Received Items to Add"), false, false, "", $js);
-
-if (!isset($_SESSION['supp_trans']))
-{
- display_note("To enter supplier transactions the supplier must first be selected from the supplier selection screen, then the link to enter a supplier credit note must be clicked on.", 1, 0);;
- exit;
-}
-
-//-----------------------------------------------------------------------------------------
-
-display_heading($_SESSION['supp_trans']->supplier_name);
-
-echo "<br>";
-
-//-----------------------------------------------------------------------------------------
-
-function check_data()
-{
- global $check_price_charged_vs_order_price,
- $check_qty_charged_vs_del_qty;
- if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv')==0)
- {
- display_error( _("The quantity to invoice must be numeric and greater than zero."));
- set_focus('this_quantity_inv');
- return false;
- }
-
- if (!check_num('ChgPrice'))
- {
- display_error( _("The price is not numeric."));
- set_focus('ChgPrice');
- return false;
- }
-
- if ($check_price_charged_vs_order_price == True)
- {
- if ($_POST['order_price']!=input_num('ChgPrice')) {
- if ($_POST['order_price']==0 ||
- input_num('ChgPrice')/$_POST['order_price'] >
- (1 + (sys_prefs::over_charge_allowance() / 100)))
- {
- display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") .
- _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
- set_focus('ChgPrice');
- return false;
- }
- }
- }
-
- if ($check_qty_charged_vs_del_qty == True)
- {
- if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) >
- (1+ (sys_prefs::over_charge_allowance() / 100)))
- {
- display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.")
- . _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
- set_focus('this_quantity_inv');
- return false;
- }
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------------------------
-
-if (isset($_POST['AddGRNToTrans']))
-{
-
- if (check_data())
- {
- if (input_num('this_quantity_inv') >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv']))
- {
- $complete = true;
- }
- else
- {
- $complete = false;
- }
-
- $_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'], $_POST['po_detail_item'],
- $_POST['item_code'], $_POST['item_description'], $_POST['qty_recd'],
- $_POST['prev_quantity_inv'], input_num('this_quantity_inv'),
- $_POST['order_price'], input_num('ChgPrice'), $complete,
- $_POST['std_cost_unit'], "");
- }
-}
-
-//-----------------------------------------------------------------------------------------
-$id = find_submit('Delete');
-if ($id != -1)
-{
- $_SESSION['supp_trans']->remove_grn_from_trans($id);
- $Ajax->activate('grn_items');
- $Ajax->activate('grn_table');
-}
-
-//-----------------------------------------------------------------------------------------
-start_form(false,true);
-display_grn_items($_SESSION['supp_trans'], 1);
-end_form();
-echo "<br>";
-
-hyperlink_no_params("$path_to_root/purchasing/supplier_invoice.php", _("Back to Supplier Invoice Entry"));
-echo "<hr>";
-
-//-----------------------------------------------------------------------------------------
-start_form(false, true); // 2008-10-18 Joe Hunt. Moved form outside function
-
-function display_grn_items_for_selection()
-{
- global $table_style;
-
- div_start('grn_table'); // 2008-10-18 Joe Hunt Moved up a bit to compute num-rows = 0
- $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, true);
-
- if (db_num_rows($result) == 0)
- {
- display_note(_("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1);
- div_end(); // Changed 2008-10-18 Joe Hunt
- return;
- }
-
- /*Set up a table to show the outstanding GRN items for selection */
-
- display_heading2(_("Items Received Yet to be Invoiced"));
- if ($_SESSION["wa_current_user"]->access == 2) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
- display_note(_("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!"), 0, 0, "class='overduefg'");
- //function display_note($msg, $br=0, $br2=0, $extra="")
- //div_start('grn_table');
- start_table("$table_style colspan=7 width=95%");
- $th = array(_("Delivery"), _("Sequence #"), _("P.O."), _("Item"), _("Description"),
- _("Received On"), _("Quantity Received"), _("Quantity Invoiced"),
- _("Uninvoiced Quantity"), _("Order Price"), _("Total"));
- if ($_SESSION["wa_current_user"]->access == 2) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
- $th[] = "";
- table_header($th);
- $i = $k = 0;
-
- while ($myrow = db_fetch($result))
- {
- $grn_already_on_invoice = false;
-
- foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
- {
- if ($entered_grn->id == $myrow["id"])
- {
- $grn_already_on_invoice = true;
- }
- }
- if ($grn_already_on_invoice == false)
- {
-
- alt_table_row_color($k);
-
- label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
- //text_cells(null, 'grn_item_id', $myrow["id"]);
- submit_cells('grn_item_id'.$myrow["id"], $myrow["id"], '', '', true);
- label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
- label_cell($myrow["item_code"]);
- label_cell($myrow["description"]);
- label_cell(sql2date($myrow["delivery_date"]));
- $dec = get_qty_dec($myrow["item_code"]);
- qty_cell($myrow["qty_recd"], false, $dec);
- qty_cell($myrow["quantity_inv"], false, $dec);
- qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
- amount_cell($myrow["unit_price"]);
- amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]),
- user_price_dec()));
- if ($_SESSION["wa_current_user"]->access == 2) // Added 2008-10-18 by Joe Hunt. Only admins can remove GRNs
- submit_cells('void_item_id'.$myrow["id"], _("Remove"), '', '', true);
- end_row();
-
- $i++;
- if ($i > 15)
- {
- $i = 0;
- table_header($th);
- }
- }
- }
-
- end_table();
- div_end();
-}
-
-//-----------------------------------------------------------------------------------------
-$id = find_submit('grn_item_id');
-$id2 = find_submit('void_item_id');
-if ($id != -1 || id2 != -1 || get_post('AddGRNToTrans'))
-{
- $Ajax->activate('grn_selector');
-}
-if (get_post('AddGRNToTrans') || $id2 != -1)
-{
- $Ajax->activate('grn_table');
- $Ajax->activate('grn_items');
-}
-
-if ($_SESSION["wa_current_user"]->access == 2)
-{
- if ($id2 != -1) // Added section 2008-10-18 Joe Hunt for voiding delivery lines
- {
- begin_transaction();
-
- $myrow = get_grn_item_detail($id2);
-
- $grn = get_grn_batch($myrow['grn_batch_id']);
-
- $sql = "UPDATE ".TB_PREF."purch_order_details
- SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"];
- db_query($sql, "The quantity invoiced of the purchase order line could not be updated");
-
- $sql = "UPDATE ".TB_PREF."grn_items
- SET qty_recd = quantity_inv WHERE id = ".$myrow["id"];
- db_query($sql, "The quantity invoiced off the items received record could not be updated");
-
- update_average_material_cost($grn["supplier_id"], $myrow["item_code"],
- $myrow["unit_price"], -$myrow["QtyOstdg"], Today());
-
- add_stock_move(25, $myrow["item_code"], $myrow['grn_batch_id'], $grn['loc_code'], sql2date($grn["delivery_date"]), "",
- -$myrow["QtyOstdg"], $myrow['std_cost_unit'], $grn["supplier_id"], 1, $myrow['unit_price']);
-
- commit_transaction();
- }
-}
-
-display_grn_items_for_selection();
-
-//-----------------------------------------------------------------------------------------
-
-div_start('grn_selector');
-
-//$id = find_submit('grn_item_id');
-if ($id != -1)
-{
-
- $myrow = get_grn_item_detail($id);
-
- echo "<br>";
- display_heading2(_("Delivery Item Selected For Adding To A Supplier Invoice"));
- start_table("$table_style width=80%");
- $th = array(_("Sequence #"), _("Item"), _("Description"), _("Quantity Outstanding"),
- _("Quantity to Invoice"), _("Order Price"), _("Actual Price"));
- table_header($th);
-
- start_row();
- label_cell($id);
- label_cell($myrow['item_code']);
- label_cell($myrow['description']);
- $dec = get_qty_dec($myrow['item_code']);
- qty_cell($myrow['QtyOstdg'], false, $dec);
- qty_cells(null, 'this_quantity_inv', number_format2($myrow['QtyOstdg'], $dec), null, null, $dec);
- amount_cell($myrow['unit_price']);
- small_amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
- end_row();
- end_table(1);;
-
- submit_center('AddGRNToTrans', _("Add to Invoice"), true, '', true);
-
- hidden('GRNNumber', $id);
- hidden('item_code', $myrow['item_code']);
- hidden('item_description', $myrow['description']);;
- hidden('qty_recd', $myrow['qty_recd']);
- hidden('prev_quantity_inv', $myrow['quantity_inv']);
- hidden('order_price', $myrow['unit_price']);
- hidden('std_cost_unit', $myrow['std_cost_unit']);
-
- hidden('po_detail_item', $myrow['po_detail_item']);
-}
-div_end();
-
-//----------------------------------------------------------------------------------------
-
-end_form();
-echo '<br>';
-end_page(false, true);
-
-?>
+++ /dev/null
-<?php
-
-$page_security=5;
-$path_to_root="..";
-
-include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
-include_once($path_to_root . "/includes/session.inc");
-
-include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
-$js = "";
-if ($use_date_picker)
- $js .= get_js_date_picker();
-page(_("Add GL Items"), false, false, "", $js);
-
-
-if (!isset($_SESSION['supp_trans']))
-{
- display_note(_("To enter a supplier invoice or credit note the supplier must first be selected."));
- exit;
- /*It all stops here if there aint no supplier selected and transaction initiated ie $_SESSION['supp_trans'] started off*/
-}
-
-//------------------------------------------------------------------------------------------------
-function clear_fields()
-{
- global $Ajax;
-
- unset($_POST['gl_code']);
- unset($_POST['dimension_id']);
- unset($_POST['dimension2_id']);
- unset($_POST['amount']);
- unset($_POST['memo_']);
- unset($_POST['AddGLCodeToTrans']);
- $Ajax->activate('gl_ctrls');
- set_focus('gl_code');
-}
-//------------------------------------------------------------------------------------------------
-// GL postings are often entered in the same form to two accounts
-// so fileds are cleared only on user demand.
-//
-if (isset($_POST['ClearFields']))
-{
- clear_fields();
-}
-
-if (isset($_POST['AddGLCodeToTrans'])){
-
- $Ajax->activate('gl_items');
- $input_error = false;
-
- $sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code='" . $_POST['gl_code'] . "'";
- $result = db_query($sql,"get account information");
- if (db_num_rows($result) == 0)
- {
- display_error(_("The account code entered is not a valid code, this line cannot be added to the transaction."));
- set_focus('gl_code');
- $input_error = true;
- }
- else
- {
- $myrow = db_fetch_row($result);
- $gl_act_name = $myrow[1];
- if (!check_num('amount'))
- {
- display_error(_("The amount entered is not numeric. This line cannot be added to the transaction."));
- set_focus('amount');
- $input_error = true;
- }
- }
-
- if ($input_error == false)
- {
- $_SESSION['supp_trans']->add_gl_codes_to_trans($_POST['gl_code'], $gl_act_name,
- $_POST['dimension_id'], $_POST['dimension2_id'],
- input_num('amount'), $_POST['memo_']);
- set_focus('gl_code');
- }
-}
-
-//------------------------------------------------------------------------------------------------
-
-$id = find_submit('Delete');
-if ($id != -1)
-{
- $_SESSION['supp_trans']->remove_gl_codes_from_trans($id);
- clear_fields();
- $Ajax->activate('gl_items');
-}
-
-//------------------------------------------------------------------------------------------------
-
-display_heading($_SESSION['supp_trans']->supplier_name);
-
-start_form(false,true);
-display_gl_items($_SESSION['supp_trans'], 1);
-end_form();
-echo "<br>";
-
-if ($_SESSION['supp_trans']->is_invoice == true)
-{
- hyperlink_no_params("$path_to_root/purchasing/supplier_invoice.php", _("Back to Invoice Entry"));
-}
-else
-{
- hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Back to Credit Note Entry"));
-}
-
-echo "<hr>";
-
-//------------------------------------------------------------------------------------------------
-
-/*Set up a form to allow input of new GL entries */
-start_form(false, true);
-
-display_heading2(_("Enter a GL Line"));
-
-div_start('gl_ctrls');
-start_table($table_style2);
-
-$accs = get_supplier_accounts($_SESSION['supp_trans']->supplier_id);
-$_POST['gl_code'] = $accs['purchase_account'];
-gl_all_accounts_list_row(_("GL Account Selection:"), 'gl_code', null);
-$dim = get_company_pref('use_dimension');
-if ($dim >= 1)
- dimensions_list_row(_("Dimension")." 1", 'dimension_id', null, true, " ", false, 1);
-if ($dim > 1)
- dimensions_list_row(_("Dimension")." 2", 'dimension2_id', null, true, " ", false, 2);
-if ($dim < 1)
- hidden('dimension_id', 0);
-if ($dim < 2)
- hidden('dimension2_id', 0);
-amount_row( _("Amount:"), 'amount');
-
-textarea_row(_("Memo:"), "memo_", null, 40, 2);
-
-end_table();
-div_end();
-echo '<br>';
-submit_center_first('AddGLCodeToTrans', _("Add GL Line"), '', true);
-submit_center_last('ClearFields', _('Reset'), _("Clear all GL entry fields"), true);
-end_form();
-
-//------------------------------------------------------------------------------------------------
-echo '<br>';
-end_page(false, true);
-
-?>