<?php
$path_to_root="../..";
-include($path_to_root . "/includes/ui/allocation_cart.inc");
$page_security = 3;
+include($path_to_root . "/includes/ui/allocation_cart.inc");
include_once($path_to_root . "/includes/session.inc");
-
include_once($path_to_root . "/includes/date_functions.inc");
-
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/banking.inc");
-
include_once($path_to_root . "/sales/includes/sales_db.inc");
+
$js = "";
if ($use_popup_windows)
$js .= get_js_open_window(900, 500);
page(_("Allocate Supplier Payment or Credit Note"), false, false, "", $js);
-
//--------------------------------------------------------------------------------
function clear_allocations()
unset($_SESSION['alloc']->allocs);
unset($_SESSION['alloc']);
}
-
session_register("alloc");
}
-
//--------------------------------------------------------------------------------
function check_data()
{
$total_allocated = 0;
- for ($counter=0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++)
+ for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++)
{
-
if (!check_num('amount' . $counter, 0))
{
display_error(_("The entry for one or more amounts is invalid or negative."));
- set_focus('amount');
+ set_focus('amount'.$counter);
return false;
}
handle_process();
$_POST['Cancel'] = 1;
}
- $Ajax->update('_page_body');
}
//--------------------------------------------------------------------------------
clear_allocations();
meta_forward($path_to_root . "/purchasing/allocations/supplier_allocation_main.php");
}
-if (isset($_POST['UpdateDisplay']))
-{
- $Ajax->update('_page_body');
-}
//--------------------------------------------------------------------------------
function get_allocations_for_transaction($type, $trans_no)
echo "<br>";
+ div_start('alloc_tbl');
if (count($_SESSION['alloc']->allocs) > 0)
{
start_table($table_style);
amount_cell($alloc_item->amount);
amount_cell($alloc_item->amount_allocated);
- if (!isset($_POST['amount' . $counter]) || $_POST['amount' . $counter] == "")
- $_POST['amount' . $counter] = price_format($alloc_item->current_allocated);
+ $_POST['amount' . $counter] = price_format($alloc_item->current_allocated);
amount_cells(null, "amount" . $counter, price_format('amount' . $counter));
$un_allocated = round($alloc_item->amount - $alloc_item->amount_allocated, 6);
- //hidden("un_allocated" . $counter, $un_allocated);
amount_cell($un_allocated);
label_cell("<a href='#' name=Alloc$counter onclick='allocate_all(this.name.substr(5));return true;'>"
. _("All") . "</a>");
label_cell("<a href='#' name=DeAll$counter onclick='allocate_none(this.name.substr(5));return true;'>"
. _("None") . "</a>".hidden("un_allocated" . $counter, $un_allocated, false));
-
-// label_cell("<a href='#' onclick='forms[0].amount$counter.value=forms[0].un_allocated$counter.value; return true;'>" . _("All") . "</a>");
-// label_cell("<a href='#' onclick='forms[0].amount$counter.value=0; return true;'>" . _("None") . "</a>");
end_row();
$total_allocated += input_num('amount' . $counter);
end_table();
hidden('TotalNumberOfAllocs', $counter);
-// hidden('left_to_allocate', $left_to_allocate);
- echo "<br><center>";
- submit('UpdateDisplay', _("Update"), true, '', true);
- echo " ";
- submit('Process', _("Process"), true, '', true);
- echo " ";
+
+ submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
+ submit('Process', _("Process"), true, _('Process allocations'), true);
+ submit_center_last('Cancel', _("Back to Allocations"),
+ _('Abandon allocations and return to selection of allocatable amounts'), true);
}
else
{
display_note(_("There are no unsettled transactions to allocate."), 0, 1);
- echo "<center>";
+ submit_center('Cancel', _("Back to Allocations"), true,
+ _('Abandon allocations and return to selection of allocatable amounts'), true);
}
- submit('Cancel', _("Back to Allocations"), true, '', true);
- echo "</center><br><br>";
-
+ div_end();
end_form();
}
{
get_allocations_for_transaction($_GET['trans_type'], $_GET['trans_no']);
}
+if(get_post('UpdateDisplay'))
+{
+ $trans_no = $_SESSION['alloc']->trans_no;
+ $type = $_SESSION['alloc']->type;
+ clear_allocations();
+ get_allocations_for_transaction($type, $trans_no);
+ $Ajax->activate('alloc_tbl');
+}
if (isset($_SESSION['alloc']))
{
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
+ start_form();
+ div_start('gl_items');
echo "<table width=100% $table_style>";
$dim = get_company_pref('use_dimension');
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();
echo "</td></tr>";
end_table(); // outertable
-
+ end_form();
+ div_end();
return $total_gl_value;
}
$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');
+ start_form();
echo "<table width=100% $table_style>";
$th = array(_("Delivery Sequence #"), _("Item"), _("Description"),
_("Quantity"), _("Price"), _("Line Value"));
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();
label_row(_("Total"), price_format($total_grn_value),
"colspan=5 align=right", "nowrap align=right");
echo "</table>";
-
+ end_form();
+ div_end();
echo "</td></tr>";
end_table(); // outertable
-
return $total_grn_value;
}
function display_po_receive_items()
{
global $table_style;
+
+ div_start('grn_items');
start_table("colspan=7 $table_style width=90%");
$th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"),
_("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
label_row(_("Total value of items received"), $display_total, "colspan=8 align=right",
"nowrap align=right");
end_table();
+ div_end();
}
//--------------------------------------------------------------------------------------------------
function process_receive_po()
{
- global $path_to_root;
+ global $path_to_root, $Ajax;
if (!can_process())
return;
unset($_SESSION['PO']->line_items);
unset($_SESSION['PO']);
unset($_POST['ProcessGoodsReceived']);
+ $Ajax->activate('_page_body');
exit;
}
$_SESSION['PO']->line_items[$line->line_no]->item_description = $_POST[$line->stock_id . "Desc"];
}
}
+ $Ajax->activate('grn_items');
}
//--------------------------------------------------------------------------------------------------
display_heading(_("Items to Receive"));
display_po_receive_items();
-echo "<br><center>";
-submit('Update', _("Update"));
-echo " ";
-submit('ProcessGoodsReceived', _("Process Receive Items"));
-echo "</center>";
+echo '<br>';
+submit_center_first('Update', _("Update"), '', true);
+submit_center_last('ProcessGoodsReceived', _("Process Receive Items"), _("Clear all GL entry fields"), true);
end_form();
end_table(1); // outer table
-submit_center('PostCreditNote', _("Enter Credit Note"));
+submit_center('PostCreditNote', _("Enter Credit Note"), true, '', true);
echo "<br><br>";
end_form();
<?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 (isset($_GET['Delete']))
+$id = find_submit('Delete');
+if ($id != -1)
{
- $_SESSION['supp_trans']->remove_grn_from_trans($_GET['Delete']);
+ $_SESSION['supp_trans']->remove_grn_from_trans($id);
+ $Ajax->activate('grn_items');
+ $Ajax->activate('grn_table');
}
//-----------------------------------------------------------------------------------------
display_grn_items($_SESSION['supp_trans'], 1);
-
echo "<br>";
hyperlink_no_params("$path_to_root/purchasing/supplier_credit.php", _("Return to Credit Note Entry"));
/*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"),
alt_table_row_color($k);
label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
- submit_cells('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"]);
}
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');
+}
+
-if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "")
+div_start('grn_selector');
+$id = find_submit('grn_item_id');
+if ($id != -1)
{
- $myrow = get_grn_item_detail($_POST['grn_item_id']);
+ $myrow = get_grn_item_detail($id);
echo "<br>";
display_heading2(_("Delivery Item Selected For Adding To A Supplier Credit Note"));
table_header($th);
start_row();
- label_cell($_POST['grn_item_id']);
+ label_cell($id);
label_cell($myrow['item_code'] . " " . $myrow['description']);
$dec = get_qty_dec($myrow['item_code']);
qty_cell($myrow["quantity_inv"], false, $dec);
end_row();
end_table(1);
- submit_center('AddGRNToTrans', _("Add to Credit Note"));
+ submit_center('AddGRNToTrans', _("Add to Credit Note"), true, '', true);
- hidden('GRNNumber', $_POST['grn_item_id']);
+ hidden('GRNNumber', $id);
hidden('item_code', $myrow['item_code']);;
hidden('item_description', $myrow['description']);
hidden('qty_recd', $myrow['qty_recd']);
hidden('po_detail_item', $myrow['po_detail_item']);
}
+div_end();
end_form();
-end_page();
+echo '<br>';
+end_page(false, true);
?>
end_table(); // outer table
echo "<br>";
-submit_center('PostInvoice', _("Enter Invoice"));
+submit_center('PostInvoice', _("Enter Invoice"), true, '', true);
echo "<br>";
end_form();
$page_security = 5;
$path_to_root="..";
-include_once($path_to_root . "/purchasing/includes/supp_trans_class.inc");
+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 .= get_js_date_picker();
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);;
{
if (input_num('this_quantity_inv') >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv']))
{
- $complete = True;
+ $complete = true;
}
else
{
- $complete = False;
+ $complete = false;
}
$_SESSION['supp_trans']->add_grn_to_trans($_POST['GRNNumber'], $_POST['po_detail_item'],
}
//-----------------------------------------------------------------------------------------
-
-if (isset($_GET['Delete']))
+$id = find_submit('Delete');
+if ($id != -1)
{
- $_SESSION['supp_trans']->remove_grn_from_trans($_GET['Delete']);
+ $_SESSION['supp_trans']->remove_grn_from_trans($id);
+ $Ajax->activate('grn_items');
+ $Ajax->activate('grn_table');
}
//-----------------------------------------------------------------------------------------
-
display_grn_items($_SESSION['supp_trans'], 1);
-
echo "<br>";
+
hyperlink_no_params("$path_to_root/purchasing/supplier_invoice.php", _("Back to Supplier Invoice Entry"));
echo "<hr>";
start_form(false, true);
display_heading2(_("Items Received Yet to be Invoiced"));
-
+ 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"),
while ($myrow = db_fetch($result))
{
-
- $grn_already_on_invoice = False;
+ $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;
+ $grn_already_on_invoice = true;
}
}
- if ($grn_already_on_invoice == False)
+ 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"]);
+ 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"]);
}
end_table();
+ div_end();
}
//-----------------------------------------------------------------------------------------
+if (find_submit('grn_item_id') || get_post('AddGRNToTrans'))
+{
+ $Ajax->activate('grn_selector');
+}
+if (get_post('AddGRNToTrans'))
+{
+ $Ajax->activate('grn_table');
+ $Ajax->activate('grn_items');
+}
display_grn_items_for_selection();
//-----------------------------------------------------------------------------------------
-if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "")
+div_start('grn_selector');
+
+$id = find_submit('grn_item_id');
+if ($id != -1)
{
- $myrow = get_grn_item_detail($_POST['grn_item_id']);
+ $myrow = get_grn_item_detail($id);
echo "<br>";
display_heading2(_("Delivery Item Selected For Adding To A Supplier Invoice"));
table_header($th);
start_row();
- label_cell($_POST['grn_item_id']);
+ label_cell($id);
label_cell($myrow['item_code']);
label_cell($myrow['description']);
$dec = get_qty_dec($myrow['item_code']);
end_row();
end_table(1);;
- submit_center('AddGRNToTrans', _("Add to Invoice"));
+ submit_center('AddGRNToTrans', _("Add to Invoice"), true, '', true);
- hidden('GRNNumber', $_POST['grn_item_id']);
+ hidden('GRNNumber', $id);
hidden('item_code', $myrow['item_code']);
hidden('item_description', $myrow['description']);;
hidden('qty_recd', $myrow['qty_recd']);
hidden('po_detail_item', $myrow['po_detail_item']);
}
+div_end();
//----------------------------------------------------------------------------------------
end_form();
-end_page();
+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['AcctSelection']);
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;
- if (!isset($_POST['gl_code']))
- {
- $_POST['gl_code'] = $_POST['AcctSelection'];
- }
$sql = "SELECT account_code, account_name FROM ".TB_PREF."chart_master WHERE account_code='" . $_POST['gl_code'] . "'";
$result = db_query($sql,"get account information");
$_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_']);
- clear_fields();
+ set_focus('gl_code');
}
}
//------------------------------------------------------------------------------------------------
-if (isset($_GET['Delete']))
+$id = find_submit('Delete');
+if ($id != -1)
{
- $_SESSION['supp_trans']->remove_gl_codes_from_trans($_GET['Delete']);
+ $_SESSION['supp_trans']->remove_gl_codes_from_trans($id);
clear_fields();
+ $Ajax->activate('gl_items');
}
//------------------------------------------------------------------------------------------------
display_heading2(_("Enter a GL Line"));
+div_start('gl_ctrls');
start_table($table_style2);
$accs = get_supplier_accounts($_SESSION['supp_trans']->supplier_id);
-$_POST['AcctSelection'] = $accs['purchase_account'];
-gl_all_accounts_list_row(_("GL Account Selection:"), 'AcctSelection', $_POST['AcctSelection']);
+$_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);
textarea_row(_("Memo:"), "memo_", null, 40, 2);
-end_table();;
-
-submit_center('AddGLCodeToTrans', _("Add GL Line"));
-
+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);
-end_page();
?>
for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++)
{
- if (!check_num('amount' . $counter))
+ if (!check_num('amount' . $counter, 0))
{
- display_error(_("The entry for one or more amounts is invalid."));
+ display_error(_("The entry for one or more amounts is invalid or negative."));
set_focus('amount'.$counter);
return false;
}
clear_allocations();
}
-
//--------------------------------------------------------------------------------
if (isset($_POST['Process']))
$_POST['Cancel'] = 1;
}
}
-
//--------------------------------------------------------------------------------
if (isset($_POST['Cancel']))
{
clear_allocations();
meta_forward($path_to_root . "/sales/allocations/customer_allocation_main.php");
- exit;
}
-
//--------------------------------------------------------------------------------
function get_allocations_for_transaction($type, $trans_no)
0); // this allocation
}
-
/* Now get trans that might have previously been allocated to by this trans
NB existing entries where still some of the trans outstanding entered from
above logic will be overwritten with the prev alloc detail below */
sql2date($myrow["tran_date"]), sql2date($myrow["due_date"]),
$myrow["Total"], $myrow["alloc"] - $myrow["amt"], $myrow["amt"]);
}
-
}
-
//--------------------------------------------------------------------------------
function edit_allocations_for_transaction($type, $trans_no)
echo "<br>";
start_form(false, true);
-
+ div_start('alloc_tbl');
if (count($_SESSION['alloc']->allocs) > 0)
{
start_table($table_style);
amount_cell($allocn_item->amount);
amount_cell($allocn_item->amount_allocated);
- if (!check_num('amount' . $counter))
- $_POST['amount' . $counter] = price_format($allocn_item->current_allocated);
- amount_cells(null, 'amount' . $counter, $_POST['amount' . $counter]);
+ $_POST['amount' . $counter] = price_format($allocn_item->current_allocated);
+ amount_cells(null, 'amount' . $counter, price_format('amount' . $counter));
$un_allocated = round($allocn_item->amount - $allocn_item->amount_allocated, 6);
- //hidden("un_allocated" . $counter, $un_allocated);
amount_cell($un_allocated);
label_cell("<a href='#' name='Alloc$counter' onclick='allocate_all(this.name.substr(5));return true;'>"
. _("All") . "</a>");
- //label_cell("<a href='#' name='DeAll$counter' onclick='allocate_none(this.name.substr(5));return true;'>"
- // . _("None") . "</a>");
label_cell("<a href='#' name='DeAll$counter' onclick='allocate_none(this.name.substr(5));return true;'>"
. _("None") . "</a>".hidden("un_allocated" . $counter, $un_allocated, false));
end_row();
end_table(1);
hidden('TotalNumberOfAllocs', $counter);
-// hidden('left_to_allocate', $left_to_allocate);
- submit_center_first('UpdateDisplay', _("Update"));
- submit('Process', _("Process"));
- submit_center_last('Cancel', _("Back to Allocations"));
+ submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
+ submit('Process', _("Process"), true, _('Process allocations'), true);
+ submit_center_last('Cancel', _("Back to Allocations"),_('Abandon allocations and return to selection of allocatable amounts'), true);
}
else
{
display_note(_("There are no unsettled transactions to allocate."), 0, 1);
- submit_center('Cancel', _("Back to Allocations"));
+
+ submit_center('Cancel', _("Back to Allocations"), true,
+ _('Abandon allocations and return to selection of allocatable amounts'), true);
}
-
+ div_end();
end_form();
}
{
get_allocations_for_transaction($_GET['trans_type'], $_GET['trans_no']);
}
+if(get_post('UpdateDisplay'))
+{
+ $trans_no = $_SESSION['alloc']->trans_no;
+ $type = $_SESSION['alloc']->type;
+ clear_allocations();
+ get_allocations_for_transaction($type, $trans_no);
+ $Ajax->activate('alloc_tbl');
+}
if (isset($_SESSION['alloc']))
{
end_table(1); // outer table
+ div_start('credit_items');
start_table("$table_style width=80%");
$th = array(_("Item Code"), _("Item Description"), _("Invoiced Quantity"), _("Units"),
_("Credit Quantity"), _("Price"), _("Discount %"), _("Total"));
$dec = get_qty_dec($ln_itm->stock_id);
qty_cell($ln_itm->quantity, false, $dec);
label_cell($ln_itm->units);
-
- amount_cells(null, 'Line'.$line_no, number_format2($ln_itm->qty_dispatched, $dec));
-
+ amount_cells(null, 'Line'.$line_no, number_format2($ln_itm->qty_dispatched, $dec),
+ null, null, $dec);
$line_total =($ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent));
amount_cell($ln_itm->price);
label_row(_("Credit Note Total"), $display_total, "colspan=7 align=right", "align=right");
end_table();
+ div_end();
}
//-----------------------------------------------------------------------------
-
function display_credit_options()
{
- global $table_style2;
-
- echo "<br>";
- start_table($table_style2);
-
- echo "<tr><td>" . _("Credit Note Type") . "</td>";
- echo "<td><select name='CreditType' onchange='this.form.submit();'>";
- if (!isset($_POST['CreditType']) || $_POST['CreditType'] == "Return") {
- echo "<option value='WriteOff'>" . _("Items Written Off") . "</option>";
- echo "<option selected value='Return'>" . _("Items Returned to Inventory Location") . "</option>";
- } else {
- echo "<option selected value='WriteOff'>" . _("Items Written Off") . "</option>";
- echo "<option value='Return'>" . _("Items Returned to Inventory Location") . "</option>";
- }
- echo "</select>";
- echo"</td></tr>";
+ global $table_style2, $Ajax;
+ echo "<br>";
- if (!isset($_POST['CreditType']) || $_POST['CreditType'] == "Return") {
+if (isset($_POST['_CreditType_update']))
+ $Ajax->activate('options');
- /*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;
- }
+ div_start('options');
+ start_table("$table_style2");
- locations_list_row(_("Items Returned to Inventory Location"), 'Location', $_POST['Location']);
- } else { /* the goods are to be written off to somewhere */
- gl_all_accounts_list_row(_("Write Off the Cost of the Items to"), 'WriteOffGLCode', $_POST['WriteOffGLCode']);
- }
- textarea_row(_("Memo"), "CreditText", null, 45, 3);
- end_table();
+ credit_type_list_row(_("Credit Note Type"), 'CreditType', null, true);
+
+ if ($_POST['CreditType'] == "Return")
+ {
+
+ /*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;
+ locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']);
+ }
+ else
+ {
+ /* the goods are to be written off to somewhere */
+ gl_all_accounts_list_row(_("Write off the cost of the items to"), 'WriteOffGLCode', null);
+ }
+
+ textarea_row(_("Memo"), "CreditText", null, 51, 3);
+ echo "</table>";
+ div_end();
}
+//-----------------------------------------------------------------------------
+if (get_post('Update'))
+{
+ $Ajax->activate('credit_items');
+}
//-----------------------------------------------------------------------------
display_credit_items();
display_credit_options();
echo "<br><center>";
-submit('Update', _("Update"));
+submit('Update', _("Update"), true, _('Update credit value for quantities entered'), true);
echo " ";
-submit('ProcessCredit', _("Process Credit Note"));
+submit('ProcessCredit', _("Process Credit Note"), true, '', true);
echo "</center>";
end_form();