! -> Note
$ -> Affected files
+21-Jun-2008 Janusz Dobrowolski
++ Ajax additions to sales and purchasing modules
+$ /purchasing/po_entry_items.php
+ /purchasing/supplier_payment.php
+ /purchasing/allocations/supplier_allocate.php
+ /purchasing/includes/ui/po_ui.inc
+ /purchasing/inquiry/po_search.php
+ /purchasing/inquiry/po_search_completed.php
+ /purchasing/inquiry/supplier_allocation_inquiry.php
+ /purchasing/inquiry/supplier_inquiry.php
+ /purchasing/manage/suppliers.php
+ /sales/manage/customers.php
+
21-Jun-2008 Joe Hunt
+ Added upload functionality to company logo. Better names on lists search.
$ /admin/company_preferences.php
handle_process();
$_POST['Cancel'] = 1;
}
+ $Ajax->update('_page_body');
}
//--------------------------------------------------------------------------------
{
clear_allocations();
meta_forward($path_to_root . "/purchasing/allocations/supplier_allocation_main.php");
- exit;
}
-
+if (isset($_POST['UpdateDisplay']))
+{
+ $Ajax->update('_page_body');
+}
//--------------------------------------------------------------------------------
function get_allocations_for_transaction($type, $trans_no)
hidden('TotalNumberOfAllocs', $counter);
// hidden('left_to_allocate', $left_to_allocate);
echo "<br><center>";
- submit('UpdateDisplay', _("Update"));
+ submit('UpdateDisplay', _("Update"), true, '', true);
echo " ";
- submit('Process', _("Process"));
+ submit('Process', _("Process"), true, '', true);
echo " ";
}
else
echo "<center>";
}
- submit('Cancel', _("Back to Allocations"));
+ submit('Cancel', _("Back to Allocations"), true, '', true);
echo "</center><br><br>";
end_form();
function display_po_header(&$order)
{
- global $table_style2;
+ global $table_style2, $Ajax;
$editable = ($order->order_no == 0);
// delete all the order items - drastic but necessary because of
// change of currency, etc
$order->clear_items();
+ // FIX
}
}
else
label_row(_("Supplier:"), $order->supplier_name);
}
- //if ($editable || ($order->supplier_id != $_POST['supplier_id']))
- get_supplier_details_to_order($order, $_POST['supplier_id']);
-
+ if ($order->supplier_id != get_post('supplier_id',-1)) {
+ get_supplier_details_to_order($order, $_POST['supplier_id']);
+ // supplier default price update
+ foreach ($order->line_items as $line_no=>$item) {
+ $line = &$order->line_items[$line_no];
+ $line->price = get_purchase_price ($order->supplier_id, $_POST['stock_id']);
+ }
+ $Ajax->activate('items_table');
+ }
set_global_supplier($_POST['supplier_id']);
if (!is_company_currency($order->curr_code))
{
+//FIX div currency ?
label_row(_("Supplier Currency:"), $order->curr_code);
exchange_rate_display($order->curr_code, get_company_currency(),
$_POST['OrderDate']);
+
}
if ($editable)
echo "<tr><td>" . _("Receive Into:") . "</td>";
echo "<td>";
- locations_list('StkLocation', null);
- echo " ";
- submit('GetAddress', _("Get Address"));
+ locations_list('StkLocation', null, false, true);
echo "</td></tr>";
if (!isset($_POST['StkLocation']) || $_POST['StkLocation'] == "" ||
- isset($_POST['GetAddress']) || !isset($_POST['delivery_address']) ||
+ isset($_POST['_StkLocation_update']) || !isset($_POST['delivery_address']) ||
$_POST['delivery_address'] == "")
{
/*If this is the first time the form loaded set up defaults */
{
$loc_row = db_fetch($result);
$_POST['delivery_address'] = $loc_row["delivery_address"];
+ $Ajax->activate('delivery_address');
$_SESSION['PO']->Location = $_POST['StkLocation'];
$_SESSION['PO']->delivery_address = $_POST['delivery_address'];
}
else
{ /*The default location of the user is crook */
- echo "<br>" . _("The default stock location set up for this user is not a currently defined stock location. Your system administrator needs to amend your user record.");
+ display_error(_("The default stock location set up for this user is not a currently defined stock location. Your system administrator needs to amend your user record."));
}
}
display_heading(_("Order Items"));
+ div_start('items_table');
start_table("$table_style width=80%");
$th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"),
if (count($order->line_items)) $th[] = '';
table_header($th);
+ $id = find_submit('Edit');
$total = 0;
$k = 0;
- foreach ($order->line_items as $po_line)
+ foreach ($order->line_items as $line_no => $po_line)
{
if ($po_line->Deleted == false)
{
$line_total = round($po_line->quantity * $po_line->price, user_price_dec());
- if (!$editable || !isset($_GET['Edit']) || $_GET['Edit'] != $po_line->line_no)
+// if (!$editable || ($id != $po_line->line_no))
+ if (!$editable || ($id != $line_no))
{
alt_table_row_color($k);
label_cell($po_line->stock_id);
if ($editable)
{
- edit_link_cell(SID."Edit=" . $po_line->line_no);
- delete_link_cell(SID."Delete=" . $po_line->line_no);
+ edit_button_cell("Edit$line_no", _("Edit"),
+ _('Edit document line'));
+ edit_button_cell("Delete$line_no", _("Delete"),
+ _('Remove line from document'));
+// edit_link_cell(SID."Edit=" . $po_line->line_no);
+// delete_link_cell(SID."Delete=" . $po_line->line_no);
}
end_row();
}
}
}
- if (!isset($_GET['Edit']) && $editable)
+ if ($id==-1 && $editable)
po_item_controls($order);
$display_total = price_format($total);
"nowrap align=right");
end_table(1);
+ div_end();
}
//---------------------------------------------------------------------------------------------------
function po_item_controls(&$order, $stock_id=null)
{
+ global $Ajax;
start_row();
- if (isset($_GET['Edit']) && $stock_id != null)
+ $id = find_submit('Edit');
+ if ($id && $stock_id != null)
{
- hidden('line_no', $_GET['Edit']);
+ hidden('line_no', $id);
if (!isset($_POST['stock_id']))
- $_POST['stock_id'] = $order->line_items[$_GET['Edit']]->stock_id;
+ $_POST['stock_id'] = $order->line_items[$id]->stock_id;
+ $dec = get_qty_dec($_POST['stock_id']);
if (!isset($_POST['qty']) || ($_POST['qty'] == ""))
- $_POST['qty'] = qty_format($order->line_items[$_GET['Edit']]->quantity, $_POST['stock_id'], $dec);
+ $_POST['qty'] = qty_format($order->line_items[$id]->quantity, $_POST['stock_id'], $dec);
if (!isset($_POST['price']) || ($_POST['price'] == ""))
- $_POST['price'] = price_format($order->line_items[$_GET['Edit']]->price);
+ $_POST['price'] = price_format($order->line_items[$id]->price);
if (!isset($_POST['req_del_date']) || ($_POST['req_del_date'] == ""))
- $_POST['req_del_date'] = $order->line_items[$_GET['Edit']]->req_del_date;
+ $_POST['req_del_date'] = $order->line_items[$id]->req_del_date;
- $_POST['units'] = $order->line_items[$_GET['Edit']]->units;
+ $_POST['units'] = $order->line_items[$id]->units;
hidden('stock_id', $_POST['stock_id']);
label_cell($_POST['stock_id']);
- label_cell($order->line_items[$_GET['Edit']]->item_description);
+ label_cell($order->line_items[$id]->item_description);
+ $Ajax->activate('items_table');
}
else
{
hidden('line_no', ($_SESSION['PO']->lines_on_order + 1));
stock_purchasable_items_list_cells(null, 'stock_id', null, false, true);
+ if(isset($_POST['_stock_id_update'])) {
+ $Ajax->activate('price');
+ $Ajax->activate('units');
+ $Ajax->activate('qty');
+ $Ajax->activate('req_del_date');
+ $Ajax->activate('line_total');
+ }
$item_info = get_item_edit_info($_POST['stock_id']);
$_POST['units'] = $item_info["units"];
+ $dec = get_qty_dec($_POST['stock_id']);
$_POST['qty'] = qty_format(1, $_POST['stock_id'], $dec);
$_POST['price'] = price_format(get_purchase_price ($order->supplier_id, $_POST['stock_id']));
$_POST['req_del_date'] = add_days(Today(), 10);
qty_cells(null, 'qty', null, null, null, $dec);
- label_cell($_POST['units']);
+ label_cell($_POST['units'], '', 'units');
date_cells(null, 'req_del_date', '', null, 0, 0, 0);
amount_cells(null, 'price', null);
//$line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100);
$line_total = round(input_num('qty') * input_num('price'), user_price_dec());
- amount_cell($line_total);
+ amount_cell($line_total, false, '','line_total');
- if (isset($_GET['Edit']))
+ if ($id!=-1)
{
- submit_cells('UpdateLine', _("Update"));
- submit_cells('CancelUpdate', _("Cancel"));
+ edit_button_cell('UpdateLine', _("Update"),
+ _('Confirm changes'));
+ edit_button_cell('CancelUpdate', _("Cancel"),
+ _('Cancel changes'));
+ set_focus('qty');
}
else
{
- submit_cells('EnterLine', _("Add Item"), "colspan=2");
+ submit_cells('EnterLine', _("Add Item"), "colspan=2",
+ _('Add new item to document'), true);
}
end_row();
{
$_POST['order_number'] = $_GET['order_number'];
}
+//-----------------------------------------------------------------------------------
+// Ajax updates
+//
+if (get_post('SearchOrders'))
+{
+ $Ajax->activate('orders_tbl');
+} elseif (get_post('_order_number_changed'))
+{
+ $disable = get_post('order_number') !== '';
+
+ $Ajax->addDisable(true, 'OrdersAfterDate', $disable);
+ $Ajax->addDisable(true, 'OrdersToDate', $disable);
+ $Ajax->addDisable(true, 'StockLocation', $disable);
+ $Ajax->addDisable(true, '_SelectStockFromList_edit', $disable);
+ $Ajax->addDisable(true, 'SelectStockFromList', $disable);
+
+ if ($disable) {
+ $Ajax->addFocus(true, 'order_number');
+ } else
+ $Ajax->addFocus(true, 'OrdersAfterDate');
+
+ $Ajax->activate('orders_tbl');
+}
+
//---------------------------------------------------------------------------------------------
start_table("class='tablestyle_noborder'");
start_row();
-ref_cells(_("#:"), 'order_number');
+ref_cells(_("#:"), 'order_number', '',null, '', true);
date_cells(_("from:"), 'OrdersAfterDate', '', null, -30);
date_cells(_("to:"), 'OrdersToDate');
stock_items_list_cells(_("Item:"), 'SelectStockFromList', null, true);
-submit_cells('SearchOrders', _("Search"));
+submit_cells('SearchOrders', _("Search"),'',_('Select documents'), true);
end_row();
end_table();
/*show a table of the orders returned by the sql */
+div_start('orders_tbl');
start_table("$table_style colspan=7 width=80%");
if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == $all_items)
if ($overdue_items)
display_note(_("Marked orders have overdue items."), 0, 1, "class='overduefg'");
-
+div_end();
end_page();
?>
$order_number = $_GET['order_number'];
}
+//-----------------------------------------------------------------------------------
+// Ajax updates
+//
+if (get_post('SearchOrders'))
+{
+ $Ajax->activate('orders_tbl');
+} elseif (get_post('_order_number_changed'))
+{
+ $disable = get_post('order_number') !== '';
+
+ $Ajax->addDisable(true, 'OrdersAfterDate', $disable);
+ $Ajax->addDisable(true, 'OrdersToDate', $disable);
+ $Ajax->addDisable(true, 'StockLocation', $disable);
+ $Ajax->addDisable(true, '_SelectStockFromList_edit', $disable);
+ $Ajax->addDisable(true, 'SelectStockFromList', $disable);
+
+ if ($disable) {
+ $Ajax->addFocus(true, 'order_number');
+ } else
+ $Ajax->addFocus(true, 'OrdersAfterDate');
+
+ $Ajax->activate('orders_tbl');
+}
//---------------------------------------------------------------------------------------------
start_form(false, true);
start_table("class='tablestyle_noborder'");
start_row();
-ref_cells(_("#:"), 'order_number');
+ref_cells(_("#:"), 'order_number', '',null, '', true);
date_cells(_("from:"), 'OrdersAfterDate', '', null, -30);
date_cells(_("to:"), 'OrdersToDate');
stock_items_list_cells(_("for item:"), 'SelectStockFromList', null, true);
-submit_cells('SearchOrders', _("Search"));
+submit_cells('SearchOrders', _("Search"),'',_('Select documents'), true);
end_row();
end_table();
print_hidden_script(18);
+div_start('orders_tbl');
start_table("$table_style colspan=7 width=80%");
if (isset($_POST['StockLocation']) && $_POST['StockLocation'] == reserved_words::get_all())
}
end_table(2);
-
+div_end();
//---------------------------------------------------------------------------------------------------
end_page();
check_cells(_("show settled:"), 'showSettled', null);
-submit_cells('Refresh Inquiry', _("Search"));
+submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), true);
set_global_supplier($_POST['supplier_id']);
//------------------------------------------------------------------------------------------------
$result = get_transactions();
-
-if (db_num_rows($result) == 0)
+//------------------------------------------------------------------------------------------------
+if(get_post('RefreshInquiry'))
{
- display_note(_("There are no transactions to display for the given dates."), 1, 1);
- end_page();
- exit;
+ $Ajax->activate('doc_tbl');
}
//------------------------------------------------------------------------------------------------
/*show a table of the transactions returned by the sql */
-start_table("$table_style width=90%");
-if ($_POST['supplier_id'] == reserved_words::get_all())
+div_start('doc_tbl');
+if (db_num_rows($result) == 0)
+{
+ display_note(_("There are no transactions to display for the given dates."), 1, 1);
+} else
+{
+ start_table("$table_style width=90%");
+ if ($_POST['supplier_id'] == reserved_words::get_all())
$th = array(_("Type"), _("Number"), _("Reference"), _("Supplier"),
_("Supp Reference"), _("Date"), _("Due Date"), _("Currency"),
_("Debit"), _("Credit"), _("Allocated"), _("Balance"), "");
-else
+ else
$th = array(_("Type"), _("Number"), _("Reference"), _("Supp Reference"), _("Date"), _("Due Date"),
_("Debit"), _("Credit"), _("Allocated"), _("Balance"), "");
-table_header($th);
+ table_header($th);
-$j = 1;
-$k = 0; //row colour counter
-$over_due = false;
-while ($myrow = db_fetch($result))
-{
+ $j = 1;
+ $k = 0; //row colour counter
+ $over_due = false;
+ while ($myrow = db_fetch($result))
+ {
if ($myrow['OverDue'] == 1)
{
$j = 1;
table_header($th);
}
-//end of page full new headings if
-}
-//end of while loop
+ //end of page full new headings if
+ }
+ //end of while loop
-end_table(1);
-if ($over_due)
+ end_table(1);
+ if ($over_due)
display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'");
-
+}
+div_end();
end_page();
?>
supp_allocations_list_cells("filterType", null);
-submit_cells('Refresh Inquiry', _("Search"));
+submit_cells('Refresh Inquiry', _("Search"),'',_('Refresh Inquiry'), true);
end_row();
end_table();
//------------------------------------------------------------------------------------------------
+div_start('totals_tbl');
if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != reserved_words::get_all()))
{
$supplier_record = get_supplier_details($_POST['supplier_id']);
display_supplier_summary($supplier_record);
}
+div_end();
//------------------------------------------------------------------------------------------------
$result = get_transactions();
-if (db_num_rows($result) == 0)
+if(get_post('Refresh Inquiry'))
{
- display_note(_("There are no transactions to display for the given dates."), 1, 1);
- end_page();
- exit;
+ $Ajax->activate('trans_tbl');
+ $Ajax->activate('totals_tbl');
}
//------------------------------------------------------------------------------------------------
/*show a table of the transactions returned by the sql */
-start_table("$table_style width=80%");
-if ($_POST['supplier_id'] == reserved_words::get_all())
+div_start('trans_tbl');
+if (db_num_rows($result) == 0)
+{
+ display_note(_("There are no transactions to display for the given dates."), 1, 1);
+} else
+{
+ start_table("$table_style width=80%");
+ if ($_POST['supplier_id'] == reserved_words::get_all())
$th = array(_("Type"), _("#"), _("Reference"), _("Supplier"),
_("Supplier's Reference"), _("Date"), _("Due Date"), _("Currency"),
_("Debit"), _("Credit"), "");
-else
+ else
$th = array(_("Type"), _("#"), _("Reference"),
_("Supplier's Reference"), _("Date"), _("Due Date"),
_("Debit"), _("Credit"), "");
-table_header($th);
+ table_header($th);
-$j = 1;
-$k = 0; //row colour counter
-$over_due = false;
-while ($myrow = db_fetch($result))
-{
+ $j = 1;
+ $k = 0; //row colour counter
+ $over_due = false;
+ while ($myrow = db_fetch($result))
+ {
if ($myrow['OverDue'] == 1)
{
$j=1;
table_header($th);
}
-//end of page full new headings if
-}
-//end of while loop
+ //end of page full new headings if
+ }
+ //end of while loop
-end_table(1);
-if ($over_due)
+ end_table(1);
+ if ($over_due)
display_note(_("Marked items are overdue."), 0, 1, "class='overduefg'");
-
-
+}
+div_end();
end_page();
?>
check_db_has_tax_groups(_("There are no tax groups defined in the system. At least one tax group is required before proceeding."));
-if (isset($_GET['New']) || !isset($_POST['supplier_id']))
-{
- $_POST['New'] = "1";
-}
-
-if (isset($_POST['SelectSupplier']))
-{
- unset($_POST['New']);
-}
+$new_supplier = get_post('supplier_id') == '';
if (isset($_POST['submit']))
{
if ($input_error !=1 )
{
- if (!isset($_POST['New']))
+ if (!$new_supplier)
{
$sql = "UPDATE ".TB_PREF."suppliers SET supp_name=".db_escape($_POST['supp_name']) . ",
tax_group_id=".db_escape($_POST['tax_group_id']) . " WHERE supplier_id = '" . $_POST['supplier_id'] . "'";
db_query($sql,"The supplier could not be updated");
-
+ display_notification(_("Supplier has been updated."));
}
else
- { //not a new supplier
+ {
$sql = "INSERT INTO ".TB_PREF."suppliers (supp_name, address, email, bank_account, dimension_id, dimension2_id, curr_code,
payment_terms, payable_account, purchase_account, payment_discount_account, tax_group_id)
.db_escape($_POST['tax_group_id']). ")";
db_query($sql,"The supplier could not be added");
+ $_POST['supplier_id'] = db_insert_id();
+ $new_supplier = false;
+ display_notification(_("A new supplier has been added."));
+ $Ajax->activate('supplier_id');
+ $Ajax->activate('controls');
}
-
- meta_forward($_SERVER['PHP_SELF']);
}
}
db_query($sql,"check failed");
unset($_SESSION['supplier_id']);
- meta_forward($_SERVER['PHP_SELF']);
+ $new_supplier = true;
+ $Ajax->activate('_page_body');
} //end if Delete supplier
}
if (db_has_suppliers())
{
start_table("", 3);
- start_row();
- supplier_list_cells(_("Select a supplier: "), 'supplier_id', null);
- submit_cells('SelectSupplier', _("Edit Supplier"));
- end_row();
+// start_table("class = 'tablestyle_noborder'");
+ supplier_list_row(_("Select a supplier: "), 'supplier_id', null,
+ _('New supplier'), true);
end_table();
}
else
hidden('supplier_id', $_POST['supplier_id']);
}
-hyperlink_params($_SERVER['PHP_SELF'], _("Enter a new supplier"), "New=1");
-echo "<br>";
-
//start_table("class='tablestyle2'", 0, 3);
start_table("class='tablestyle'", 3);
table_section_title(_("Supplier"));
-if (isset($_POST['supplier_id']) && !isset($_POST['New']))
+if (!$new_supplier)
{
//SupplierID exists - either passed when calling the form or from the form itself
$myrow = get_supplier($_POST['supplier_id']);
}
else
{
- // its a new supplier being added
- hidden('New', 'Yes');
+ $_POST['supp_name'] = $_POST['address'] = $_POST['tax_group_id'] = '';
+ $_POST['dimension_id'] = 0;
+ $_POST['dimension2_id'] = 0;
+ $_POST['sales_type'] = -1;
+ $_POST['email'] = $_POST['bank_account'] = '';
+ $_POST['payment_terms'] = '';
+ $_POST['credit_limit'] = price_format(sys_prefs::default_credit_limit());
$company_record = get_company_prefs();
-
+ $_POST['curr_code'] = $company_record["curr_default"];
$_POST['payable_account'] = $company_record["creditors_act"];
$_POST['purchase_account'] = $company_record["default_cogs_act"];
$_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
text_row(_("Bank Account:"), 'bank_account', null, 42, 40);
// Sherifoz 23.09.03 currency can't be changed if editing
-if (isset($_POST['supplier_id']) && !isset($_POST['New']))
+if (!$new_supplier)
{
label_row(_("Supplier's Currency:"), $_POST['curr_code']);
hidden('curr_code', $_POST['curr_code']);
hidden('dimension2_id', 0);
end_table(1);
-
-if (!isset($_POST['New']))
+div_start('controls');
+if (!$new_supplier)
{
- submit_center_first('submit', _("Update Supplier"));
- submit_center_last('delete', _("Delete Supplier"));
+ submit_center_first('submit', _("Update Supplier"),
+ _('Update supplier data'), true);
+ submit_center_last('delete', _("Delete Supplier"),
+ _('Delete supplier data if have been never used'), true);
}
else
{
- submit_center('submit', _("Add New Supplier Details"));
+ submit_center('submit', _("Add New Supplier Details"), true, '', true);
}
-
+div_end();
end_form();
end_page();
display_footer_exit();
}
+//--------------------------------------------------------------------------------------------------
+function line_start_focus() {
+ global $Ajax;
+
+ $Ajax->activate('items_table');
+ set_focus('_stock_id_edit');
+}
//--------------------------------------------------------------------------------------------------
function copy_to_po()
//---------------------------------------------------------------------------------------------------
-function handle_delete_item()
+function handle_delete_item($line_no)
{
- $line_no = $_GET['Delete'];
if($_SESSION['PO']->some_already_received($line_no) == 0)
{
$_SESSION['PO']->remove_from_order($line_no);
{
display_error(_("This item cannot be deleted because some of it has already been received."));
}
+ line_start_focus();
}
//---------------------------------------------------------------------------------------------------
exit;
}
-//---------------------------------------------------------------------------------------------------
-if (isset($_GET['Delete']) || isset($_GET['Edit']))
-{
- copy_from_po();
-}
-
-if (isset($_GET['Delete']))
-{
- handle_delete_item();
-}
-
//---------------------------------------------------------------------------------------------------
function check_data()
$_SESSION['PO']->update_order_item($_POST['line_no'], input_num('qty'), input_num('price'),
$_POST['req_del_date']);
unset_form_variables();
+ line_start_focus();
}
//---------------------------------------------------------------------------------------------------
{
if (count($_SESSION['PO']->line_items) > 0)
{
- foreach ($_SESSION['PO']->line_items AS $order_item)
+ foreach ($_SESSION['PO']->line_items as $order_item)
{
/* do a loop round the items on the order to see that the item
is not already on this order */
if (($order_item->stock_id == $_POST['stock_id']) &&
- ($order_item->Deleted==False))
+ ($order_item->Deleted == false))
{
- $allow_update = False;
+ $allow_update = false;
display_error(_("The selected item is already on this order."));
}
} /* end of the foreach loop to look for pre-existing items of the same code */
if (db_num_rows($result) == 0)
{
- $allow_update = False;
+ $allow_update = false;
}
if ($allow_update)
$_POST['req_del_date'], 0, 0);
unset_form_variables();
- $_POST['StockID2'] = $_POST['stock_id'] = "";
+ $_POST['stock_id'] = "";
}
else
{
} /* end of if not already on the order and allow input was true*/
}
+ line_start_focus();
}
//---------------------------------------------------------------------------------------------------
if (!references::is_valid($_SESSION['PO']->reference))
{
display_error(_("There is no reference entered for this purchase order."));
- set_focus('ref');
+ set_focus('ref');
return false;
}
if (!is_new_reference($_SESSION['PO']->reference, systypes::po()))
{
display_error(_("The entered reference is already in use."));
- set_focus('ref');
+ set_focus('ref');
return false;
}
}
}
}
}
-
//---------------------------------------------------------------------------------------------------
+$id = find_submit('Delete');
+if ($id != -1)
+ handle_delete_item($id);
+if (isset($_POST['Delete']) || isset($_POST['Edit']))
+{
+ copy_from_po();
+}
+
if (isset($_POST['Commit']))
{
handle_commit_order();
}
-
-//---------------------------------------------------------------------------------------------------
-
if (isset($_POST['UpdateLine']))
{
copy_to_po();
handle_update_item();
}
-
-//---------------------------------------------------------------------------------------------------
-
-If (isset($_POST['EnterLine']))
+if (isset($_POST['EnterLine']))
{
copy_to_po();
handle_add_new_item();
}
-
-//---------------------------------------------------------------------------------------------------
-
if (isset($_POST['CancelOrder']))
{
handle_cancel_po();
}
-
-//---------------------------------------------------------------------------------------------------
-
if (isset($_POST['CancelUpdate']))
{
copy_to_po();
unset_form_variables();
}
-
-//---------------------------------------------------------------------------------------------------
-
if (isset($_GET['ModifyOrderNumber']) && $_GET['ModifyOrderNumber'] != "")
{
create_new_po();
read_po($_SESSION['PO']->order_no, $_SESSION['PO']);
copy_from_po();
}
+if (isset($_POST['CancelUpdate']) || isset($_POST['UpdateLine'])) {
+ line_start_focus();
+}
//--------------------------------------------------------------------------------
textarea_row(_("Memo:"), 'Comments', null, 70, 4);
end_table(1);
+
+div_start('controls', 'items_table');
if ($_SESSION['PO']->order_has_items())
{
if ($_SESSION['PO']->order_no)
}
else
submit_center('CancelOrder', _("Cancel Order"));
-
+div_end();
//---------------------------------------------------------------------------------------------------
end_form();
echo "</td></tr>";
end_table(1); // outer table
- submit_center('ProcessSuppPayment',_("Enter Payment"));
+ submit_center('ProcessSuppPayment',_("Enter Payment"), true, '', true);
if ($bank_currency != $supplier_currency)
{
db_query($sql,"The customer could not be updated");
display_notification(_("Customer has been updated."));
-
}
else
{ //it is a new customer
display_notification(_("A new customer has been added."));
- $Ajax->activate('_page_body');
+ $Ajax->activate('customer_id');
+ $Ajax->activate('controls');
}
}
end_table();
end_table(1); // outer table
-
+div_start('controls');
if ($new_customer)
{
submit_center('submit', _("Add New Customer"), true, '', true);
submit_center_first('submit', _("Update Customer"),
_('Update customer data'), true);
submit_center_last('delete', _("Delete Customer"),
- _('Delete user data if have been never used'), true);
+ _('Delete customer data if have been never used'), true);
}
-
+div_end();
end_form();
end_page();