page(_("Customer Allocations"), false, false, "", $js);
//--------------------------------------------------------------------------------
+if ($ret = context_restore()) {
+ if(isset($ret['customer_id']))
+ $_POST['customer_id'] = $ret['customer_id'];
+}
+if (isset($_POST['_customer_id_editor'])) {
+ context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'] );
+}
function display_allocatable_transactions()
{
check_db_has_customer_branches(_("There are no customers, or there are no customers with branches. Please define customers and customer branches."));
//-----------------------------------------------------------------------------
+if ($ret = context_restore()) {
+ // return from new customer add
+ copy_from_cn();
+ if(isset($ret['customer_id']))
+ $_POST['customer_id'] = $ret['customer_id'];
+ if(isset($ret['branch_id']))
+ $_POST['branch_id'] = $ret['branch_id'];
+}
+if (isset($_POST['_customer_id_editor'])) {
+ copy_to_cn(); //store context
+ context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'], 'Items');
+}
if (isset($_GET['AddedID'])) {
$credit_no = $_GET['AddedID'];
processing_start();
$_SESSION['Items'] = new Cart(11,$trans_no);
copy_from_cn();
- line_start_focus();
}
//-----------------------------------------------------------------------------
check_db_has_bank_trans_types(_("There are no bank payment types defined in the system."));
//----------------------------------------------------------------------------------------
+if ($ret = context_restore()) {
+ if(isset($ret['customer_id']))
+ $_POST['customer_id'] = $ret['customer_id'];
+ if(isset($ret['branch_id']))
+ $_POST['BranchID'] = $ret['branch_id'];
+}
+if (isset($_POST['_customer_id_editor'])) {
+ context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'],
+ array( 'customer_id', 'BranchID', 'bank_account', 'DateBanked',
+ 'ReceiptType', 'ref', 'amount', 'discount', 'memo_') );
+}
if (isset($_GET['AddedID'])) {
$payment_no = $_GET['AddedID'];
}
if (isset($_POST['_customer_id_button'])) {
// unset($_POST['branch_id']);
- $Ajax->activate('branch_id');
+ $Ajax->activate('BranchID');
}
//----------------------------------------------------------------------------------------------
if ($order->customer_id != $_POST['customer_id'] /*|| $order->sales_type != $_POST['sales_type_id']*/)
{
// customer has changed
-
- // delete all the order items - drastic but necessary because of
- // change of currency, sales type, etc
-// $order->clear_items();
-
- // clear the branch selection
-// unset($_POST['branch_id']);
- $_POST['branch_id'] = '';
- $Ajax->activate('branch_id');
+ $Ajax->activate('branch_id');
}
customer_branches_list_row(_("Branch:"), $_POST['customer_id'],
}
if ($old_order->sales_type != $order->sales_type) {
// || $old_order->default_discount!=$order->default_discount
- $_POST['sales_type'] = $order->sales_type;
+ $_POST['sales_type_id'] = $order->sales_type;
$Ajax->activate('sales_type_id');
$change_prices = 1;
}
if ($order->customer_id != get_post('customer_id', -1))
{
// customer has changed
- // clear the branch selection
- $_POST['branch_id'] = '';
$Ajax->activate('branch_id');
}
customer_branches_list_row(_("Branch:"),
$selected_id = $_GET['SelectedBranch'];
}
+$id = find_submit('Select');
+if ($id != -1)
+{
+ context_return(array('customer_id' => $_POST['customer_id'],
+ 'branch_id' => $id)); // return to sales document
+}
+
//-----------------------------------------------------------------------------------------------
if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
$th = array(_("Name"), _("Contact"), _("Sales Person"), _("Area"),
_("Phone No"), _("Fax No"), _("E-mail"), _("Tax Group"), "", "");
+ if (count($_SESSION['Context'])) $th[] = '';
table_header($th);
while ($myrow = db_fetch($result))
label_cell($myrow["fax"]);
label_cell("<a href=mailto:" . $myrow["email"]. ">" . $myrow["email"]. "</a>");
label_cell($myrow["tax_group_name"]);
+ if (count($_SESSION['Context']))
+ edit_button_cell("Select".$myrow["branch_code"], _("Select"));
edit_button_cell("Edit".$myrow["branch_code"], _("Edit"));
edit_button_cell("Delete".$myrow["branch_code"], _("Delete"));
end_row();
include_once($path_to_root . "/includes/banking.inc");
include_once($path_to_root . "/includes/ui.inc");
+if (isset($_GET['debtor_no']))
+{
+ $_POST['customer_id'] = $_GET['debtor_no'];
+}
$new_customer = (!isset($_POST['customer_id']) || $_POST['customer_id'] == "");
//--------------------------------------------------------------------------------------------
if (strlen($_POST['CustName']) == 0)
{
display_error(_("The customer name cannot be empty."));
+ set_focus('CustName');
return false;
}
if (!check_num('credit_limit', 0))
{
display_error(_("The credit limit must be numeric and not less than zero."));
+ set_focus('credit_limit');
return false;
}
if (!check_num('pymt_discount', 0, 100))
{
display_error(_("The payment discount must be numeric and is expected to be less than 100% and greater than or equal to 0."));
+ set_focus('pymt_discount');
return false;
}
if (!check_num('discount', 0, 100))
{
display_error(_("The discount percentage must be numeric and is expected to be less than 100% and greater than or equal to 0."));
+ set_focus('discount');
return false;
}
$Ajax->activate('_page_body');
}
}
-
//--------------------------------------------------------------------------------------------
if (isset($_POST['submit']))
{
-
handle_submit();
}
+//--------------------------------------------------------------------------------------------
+if (isset($_POST['select']))
+{
+ context_return(array('customer_id' => $_POST['customer_id'])); // return to sales document
+}
//--------------------------------------------------------------------------------------------
if (isset($_POST['delete']))
} //end if Delete Customer
}
-
check_db_has_sales_types(_("There are no sales types defined. Please define at least one sales type before adding a customer."));
start_form();
payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']);
if (!$new_customer) {
-start_row();
- echo '<td>'._('Customer branches').':</td>';
- hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php",'<b>'. _("Add or Edit").'</b>', "debtor_no=".$_POST['customer_id']);
-end_row();
+ start_row();
+ echo '<td>'._('Customer branches').':</td>';
+ hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php",'<b>'. (count($_SESSION['Context']) ? _("Select or Add") : _("Add or Edit")).'</b>', "debtor_no=".$_POST['customer_id']);
+ end_row();
}
end_table();
{
submit_center_first('submit', _("Update Customer"),
_('Update customer data'), true);
+ submit_return('select', _("Return"), _("Select this customer and return to document entry."), true);
submit_center_last('delete', _("Delete Customer"),
_('Delete customer data if have been never used'), true);
}
include_once($path_to_root . "/reporting/includes/reporting.inc");
$js = '';
+if ($ret = context_restore()) {
+ // return from new customer add
+ copy_from_cart();
+ if(isset($ret['customer_id']))
+ $_POST['customer_id'] = $ret['customer_id'];
+ if(isset($ret['branch_id']))
+ $_POST['branch_id'] = $ret['branch_id'];
+}
+if (isset($_POST['_customer_id_editor'])) {
+ copy_to_cart(); //store context
+ context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'], 'Items');
+}
+
if ($use_popup_windows) {
$js .= get_js_open_window(900, 500);
}