-//start_table("class='tablestyle2'", 0, 3);
-start_table("class='tablestyle'", 3);
-
-table_section_title(_("Supplier"));
-
-if (!$new_supplier)
-{
- //SupplierID exists - either passed when calling the form or from the form itself
- $myrow = get_supplier($_POST['supplier_id']);
-
- $_POST['supp_name'] = $myrow["supp_name"];
- $_POST['address'] = $myrow["address"];
- $_POST['email'] = $myrow["email"];
- $_POST['bank_account'] = $myrow["bank_account"];
- $_POST['dimension_id'] = $myrow["dimension_id"];
- $_POST['dimension2_id'] = $myrow["dimension2_id"];
- $_POST['curr_code'] = $myrow["curr_code"];
- $_POST['payment_terms'] = $myrow["payment_terms"];
- $_POST['tax_group_id'] = $myrow["tax_group_id"];
- $_POST['payable_account'] = $myrow["payable_account"];
- $_POST['purchase_account'] = $myrow["purchase_account"];
- $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
-
-}
-else
-{
- $_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(_("Supplier Name:"), 'supp_name', null, 42, 40);
-textarea_row(_("Address:"), 'address', null, 35, 5);
-text_row(_("Email:"), 'email', null, 42, 40);
-text_row(_("Bank Account:"), 'bank_account', null, 42, 40);
-
-// Sherifoz 23.09.03 currency can't be changed if editing
-if (!$new_supplier)
-{
- label_row(_("Supplier's Currency:"), $_POST['curr_code']);
- hidden('curr_code', $_POST['curr_code']);
-}
-else
-{
- currencies_list_row(_("Supplier's Currency:"), 'curr_code', null);
-}
-
-tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
-
-payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
-
-table_section_title(_("Accounts"));
-
-gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
-
-gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account']);
-
-gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
-
-$dim = get_company_pref('use_dimension');
-if ($dim >= 1)
-{
- table_section_title(_("Dimension"));
-
- 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);
-
-end_table(1);
-div_start('controls');
-if (!$new_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"), true, '', true);
-}
-div_end();
+if (!$supplier_id)
+ unset($_POST['_tabs_sel']); // force settings tab for new customer
+
+tabbed_content_start('tabs', array(
+ 'settings' => array(_('&General settings'), $supplier_id),
+ 'contacts' => array(_('&Contacts'), $supplier_id),
+ 'transactions' => array(_('&Transactions'), (user_check_access('SA_SUPPTRANSVIEW') ? $supplier_id : null)),
+ 'orders' => array(_('Purchase &Orders'), (user_check_access('SA_SUPPTRANSVIEW') ? $supplier_id : null)),
+ ));
+
+ switch (get_post('_tabs_sel')) {
+ default:
+ case 'settings':
+ supplier_settings($supplier_id);
+ break;
+ case 'contacts':
+ $contacts = new contacts('contacts', $supplier_id, 'supplier');
+ $contacts->show();
+ break;
+ case 'transactions':
+ $_GET['supplier_id'] = $supplier_id;
+ include_once($path_to_root."/purchasing/inquiry/supplier_inquiry.php");
+ break;
+ case 'orders':
+ $_GET['supplier_id'] = $supplier_id;
+ include_once($path_to_root."/purchasing/inquiry/po_search_completed.php");
+ break;
+ };
+br();
+tabbed_content_end();