} else { hidden('New', 'Yes'); } hidden('branch_code', $_POST['branch_code']); table_section_title(tr("Name and Contact")); text_row(tr("Branch Name:"), 'br_name', $_POST['br_name'], 35, 40); text_row(tr("Contact Person:"), 'contact_name', $_POST['contact_name'], 35, 40); text_row(tr("Phone Number:"), 'phone', null, 20, 20); text_row(tr("Fax Number:"), 'fax', null, 20, 20); text_row("<a href='Mailto:'>" . tr("E-mail:") . "</a>", 'email', $_POST['email'], 35, 55); table_section_title(tr("Sales")); sales_persons_list_row(tr("Sales Person:"), 'salesman', null); sales_areas_list_row(tr("Sales Area:"), 'area', null); locations_list_row(tr("Default Inventory Location:"), 'default_location', null); shippers_list_row(tr("Default Shipping Company:"), 'default_ship_via', null); tax_groups_list_row(tr("Tax Group:"), 'tax_group_id', null, 31, 30); language_list_row(tr("Language"), 'lang_code', null, 31, 30); yesno_list_row(tr("Disable this Branch:"), 'disable_trans', null); echo "</table>"; echo "</td><td class='tableseparator'>"; // outer table echo "<table>"; table_section_title(tr("GL Accounts")); gl_all_accounts_list_row(tr("Sales Account:"), 'sales_account', $_POST['sales_account']); gl_all_accounts_list_row(tr("Sales Discount Account:"), 'sales_discount_account', $_POST['sales_discount_account']); gl_all_accounts_list_row(tr("Accounts Receivable Account:"), 'receivables_account', $_POST['receivables_account']); gl_all_accounts_list_row(tr("Prompt Payment Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']); table_section_title(tr("Addresses")); textarea_row(tr("Mailing Address:"), 'br_post_address', $_POST['br_post_address'], 35, 5); textarea_row(tr("Billing Address:"), 'br_address', $_POST['br_address'], 35, 5); end_table();
function customer_settings($selected_id) { global $SysPrefs, $path_to_root, $auto_create_branch; if (!$selected_id) { if (list_updated('customer_id') || !isset($_POST['CustName'])) { $_POST['CustName'] = $_POST['cust_ref'] = $_POST['address'] = $_POST['tax_id'] = ''; $_POST['dimension_id'] = 0; $_POST['dimension2_id'] = 0; $_POST['sales_type'] = -1; $_POST['curr_code'] = get_company_currency(); $_POST['credit_status'] = -1; $_POST['payment_terms'] = $_POST['notes'] = ''; $_POST['discount'] = $_POST['pymt_discount'] = percent_format(0); $_POST['credit_limit'] = price_format($SysPrefs->default_credit_limit()); } } else { $myrow = get_customer($selected_id); $_POST['CustName'] = $myrow["name"]; $_POST['cust_ref'] = $myrow["debtor_ref"]; $_POST['address'] = $myrow["address"]; $_POST['tax_id'] = $myrow["tax_id"]; $_POST['dimension_id'] = $myrow["dimension_id"]; $_POST['dimension2_id'] = $myrow["dimension2_id"]; $_POST['sales_type'] = $myrow["sales_type"]; $_POST['curr_code'] = $myrow["curr_code"]; $_POST['credit_status'] = $myrow["credit_status"]; $_POST['payment_terms'] = $myrow["payment_terms"]; $_POST['discount'] = percent_format($myrow["discount"] * 100); $_POST['pymt_discount'] = percent_format($myrow["pymt_discount"] * 100); $_POST['credit_limit'] = price_format($myrow["credit_limit"]); $_POST['notes'] = $myrow["notes"]; $_POST['inactive'] = $myrow["inactive"]; } start_outer_table(TABLESTYLE2); table_section(1); table_section_title(_("Name and Address")); text_row(_("Customer Name:"), 'CustName', $_POST['CustName'], 40, 80); text_row(_("Customer Short Name:"), 'cust_ref', null, 30, 30); textarea_row(_("Address:"), 'address', $_POST['address'], 35, 5); text_row(_("GSTNo:"), 'tax_id', null, 40, 40); if (!$selected_id || is_new_customer($selected_id)) { currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']); } else { label_row(_("Customer's Currency:"), $_POST['curr_code']); hidden('curr_code', $_POST['curr_code']); } sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']); if ($selected_id) { record_status_list_row(_("Customer status:"), 'inactive'); } elseif (isset($auto_create_branch) && $auto_create_branch == 1) { table_section_title(_("Branch")); text_row(_("Phone:"), 'phone', null, 32, 30); text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30); text_row(_("Fax Number:"), 'fax', null, 32, 30); email_row(_("E-mail:"), 'email', null, 35, 55); sales_persons_list_row(_("Sales Person:"), 'salesman', null); } table_section(2); table_section_title(_("Sales")); percent_row(_("Discount Percent:"), 'discount', $_POST['discount']); percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']); amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']); payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']); credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']); $dim = get_company_pref('use_dimension'); if ($dim >= 1) { dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1); } if ($dim > 1) { dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2); } if ($dim < 1) { hidden('dimension_id', 0); } if ($dim < 2) { hidden('dimension2_id', 0); } if ($selected_id) { start_row(); echo '<td class="label">' . _('Customer branches') . ':</td>'; hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", '<b>' . (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")) . '</b>', "debtor_no=" . $selected_id . (@$_REQUEST['popup'] ? '&popup=1' : '')); end_row(); } textarea_row(_("General Notes:"), 'notes', null, 35, 5); if (!$selected_id && isset($auto_create_branch) && $auto_create_branch == 1) { table_section_title(_("Branch")); locations_list_row(_("Default Inventory Location:"), 'location'); shippers_list_row(_("Default Shipping Company:"), 'ship_via'); sales_areas_list_row(_("Sales Area:"), 'area', null); tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null); } end_outer_table(1); div_start('controls'); if (!$selected_id) { submit_center('submit', _("Add New Customer"), true, '', 'default'); } else { submit_center_first('submit', _("Update Customer"), _('Update customer data'), @$_REQUEST['popup'] ? true : 'default'); submit_return('select', $selected_id, _("Select this customer and return to document entry.")); submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true); } div_end(); }
if (!isset($_POST['sales_discount_account']) || $_POST['sales_discount_account'] == "") { $_POST['sales_discount_account'] = $company_record["default_sales_discount_act"]; } if (!isset($_POST['receivables_account']) || $_POST['receivables_account'] == "") { $_POST['receivables_account'] = $company_record["debtors_act"]; } if (!isset($_POST['payment_discount_account']) || $_POST['payment_discount_account'] == "") { $_POST['payment_discount_account'] = $company_record["default_prompt_payment_act"]; } gl_all_accounts_list_row("Sales Account:", 'sales_account', $_POST['sales_account']); gl_all_accounts_list_row("Sales Discount Account:", 'sales_discount_account', $_POST['sales_discount_account']); gl_all_accounts_list_row("Receivables Account:", 'receivables_account', $_POST['receivables_account']); gl_all_accounts_list_row("Payment Discount Account:", 'payment_discount_account', $_POST['payment_discount_account']); table_section_title("Location, Tax Type, Sales Type, Sales Person and Payment Terms"); locations_list_row("Location:", 'default_location', 'DEF'); tax_groups_list_row(_("Default Tax Group:"), 'tax_group_id', $default_TaxGroup); sales_types_list_row("Sales Type:", 'sales_type', null); sales_persons_list_row("Sales Person:", 'salesman', null); sales_areas_list_row("Sales Area:", 'area'); currencies_list_row("Customer Currency:", 'currency', $default_Currency); payment_terms_list_row("Payment Terms:", 'payment_terms', null); text_row("Starting Zen Cart Customer ID:", 'min_cid', $min_cid, 10, 10); text_row("Ending Zen Cart Customer ID:", 'max_cid', $max_cid, 10, 10); end_table(1); hidden('action', 'c_import'); submit_center('cimport', "Import Zen Cart Customers"); end_form(); end_page(); } if ($action == 'oimport') { start_form(true);
function supplier_settings(&$supplier_id) { start_outer_table(TABLESTYLE2); table_section(1); if ($supplier_id) { //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['supp_ref'] = $myrow["supp_ref"]; $_POST['address'] = $myrow["address"]; $_POST['supp_address'] = $myrow["supp_address"]; $_POST['gst_no'] = $myrow["gst_no"]; $_POST['website'] = $myrow["website"]; $_POST['supp_account_no'] = $myrow["supp_account_no"]; $_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['credit_limit'] = price_format($myrow["credit_limit"]); $_POST['tax_group_id'] = $myrow["tax_group_id"]; $_POST['tax_included'] = $myrow["tax_included"]; $_POST['payable_account'] = $myrow["payable_account"]; $_POST['purchase_account'] = $myrow["purchase_account"]; $_POST['payment_discount_account'] = $myrow["payment_discount_account"]; $_POST['notes'] = $myrow["notes"]; $_POST['inactive'] = $myrow["inactive"]; } else { $_POST['supp_name'] = $_POST['supp_ref'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = $_POST['website'] = $_POST['supp_account_no'] = $_POST['notes'] = ''; $_POST['dimension_id'] = 0; $_POST['dimension2_id'] = 0; $_POST['tax_included'] = 0; $_POST['sales_type'] = -1; $_POST['gst_no'] = $_POST['bank_account'] = ''; $_POST['payment_terms'] = ''; $_POST['credit_limit'] = price_format(0); $company_record = get_company_prefs(); $_POST['curr_code'] = $company_record["curr_default"]; $_POST['payable_account'] = $company_record["creditors_act"]; $_POST['purchase_account'] = ''; // default/item's cogs account $_POST['payment_discount_account'] = $company_record['pyt_discount_act']; } table_section_title(_("Basic Data")); text_row(_("Supplier Name:"), 'supp_name', null, 42, 40); text_row(_("Supplier Short Name:"), 'supp_ref', null, 30, 30); text_row(_("GSTNo:"), 'gst_no', null, 42, 40); link_row(_("Website:"), 'website', null, 35, 55); if ($supplier_id && !is_new_supplier($supplier_id) && (key_in_foreign_table($_POST['supplier_id'], 'supp_trans', 'supplier_id') || key_in_foreign_table($_POST['supplier_id'], 'purch_orders', 'supplier_id'))) { 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); text_row(_("Our Customer No:"), 'supp_account_no', null, 42, 40); table_section_title(_("Purchasing")); text_row(_("Bank Name/Account:"), 'bank_account', null, 42, 40); amount_row(_("Credit Limit:"), 'credit_limit', null); payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null); // // tax_included option from supplier record is used directly in update_average_cost() function, // therefore we can't edit the option after any transaction waas done for the supplier. // if (is_new_supplier($supplier_id)) { check_row(_("Prices contain tax included:"), 'tax_included'); } else { hidden('tax_included'); label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No')); } 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'], false, false, _("Use Item Inventory/COGS Account")); gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']); if (!$supplier_id) { table_section_title(_("Contact Data")); text_row(_("Phone Number:"), 'phone', null, 32, 30); text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30); } table_section(2); $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); } table_section_title(_("Addresses")); textarea_row(_("Mailing Address:"), 'address', null, 35, 5); textarea_row(_("Physical Address:"), 'supp_address', null, 35, 5); table_section_title(_("General")); textarea_row(_("General Notes:"), 'notes', null, 35, 5); if ($supplier_id) { record_status_list_row(_("Supplier status:"), 'inactive'); } else { table_section_title(_("Contact Data")); text_row(_("Contact Person:"), 'contact', null, 42, 40); text_row(_("Fax Number:"), 'fax', null, 32, 30); email_row(_("E-mail:"), 'email', null, 35, 55); languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default')); } end_outer_table(1); div_start('controls'); if ($supplier_id) { submit_center_first('submit', _("Update Supplier"), _('Update supplier data'), @$_REQUEST['popup'] ? true : 'default'); submit_return('select', get_post('supplier_id'), _("Select this supplier and return to document entry.")); submit_center_last('delete', _("Delete Supplier"), _('Delete supplier data if have been never used'), true); } else { submit_center('submit', _("Add New Supplier Details"), true, '', 'default'); } div_end(); }
check_row(_("Use Paypal Transaction Id:"), 'use_paypal_trn_id', null); check_row(_("Receipts Date Today:"), 'paypal_recpt_today', null); table_section_title(_("PayPal File")); text_row_ex(_("Company Name Column:"), 'paypal_name_col', 25, 55); table_section_title(_("Customers")); sales_types_list_row("Sales Type:", 'paypal_sales_type_id', null); sales_persons_list_row(_("Sales Person:"), 'paypal_salesman', null); sales_areas_list_row(_("Sales Area:"), 'paypal_area', null); credit_status_list_row(_("Credit Status:"), 'paypal_credit_status', null); locations_list_row(_("Default Location:"), 'paypal_location', null); shippers_list_row(_("Default Shipper:"), 'paypal_shipper', null); table_section(2); table_section_title(_("Accounts")); bank_accounts_list_row(_("Bank Account:"), 'paypal_bank_id', $_POST['paypal_bank_id'], false); gl_all_accounts_list_row(_("Sales Account:"), 'paypal_sales_act', $_POST['paypal_sales_act']); gl_all_accounts_list_row(_("Sales Tax Account:"), 'paypal_sales_tax_act', $_POST['paypal_sales_tax_act']); gl_all_accounts_list_row(_("Shipping Account:"), 'paypal_shipping_act', $_POST['paypal_shipping_act']); gl_all_accounts_list_row(_("Fee Account:"), 'paypal_fee_act', $_POST['paypal_fee_act']); gl_all_accounts_list_row(_("Insurance Account:"), 'paypal_insurance_act', $_POST['paypal_insurance_act']); bank_accounts_list_row(_("Withdrawal Account:"), 'paypal_withdraw_id', $_POST['paypal_withdraw_id'], false); table_section_title(_("Tax")); check_row(_("Add Tax to Receipts:"), 'paypal_add_tax', null); check_row(_("Tax Included in Paypal Amount:"), 'paypal_tax_included', null); tax_types_list_row("Default Tax Type:", 'paypal_tax_type_id', null); tax_groups_list_row("Default Tax Group:", 'paypal_tax_group_id', null); item_tax_types_list_row("Default Item Tax Group:", 'paypal_item_tax_id', null); end_outer_table(1); submit_center('submit', _("Update"), true, '', 'default'); end_form(); //------------------------------------------------------------------------------------------------- end_page();
function branch_settings($selected_id) { global $Mode, $num_branches; start_outer_table(TABLESTYLE2); table_section(1); $_POST['email'] = ""; if ($selected_id != -1) { if ($Mode == 'Edit' || !isset($_POST['br_name'])) { //editing an existing branch $myrow = get_cust_branch($_POST['customer_id'], $_POST['branch_code']); set_focus('br_name'); $_POST['branch_code'] = $myrow["branch_code"]; $_POST['br_name'] = $myrow["br_name"]; $_POST['br_ref'] = $myrow["branch_ref"]; $_POST['br_address'] = $myrow["br_address"]; $_POST['br_post_address'] = $myrow["br_post_address"]; // $_POST['contact_name'] = $myrow["contact_name"]; $_POST['salesman'] = $myrow["salesman"]; $_POST['area'] = $myrow["area"]; // $_POST['rep_lang'] =$myrow["rep_lang"]; // $_POST['phone'] =$myrow["phone"]; // $_POST['phone2'] =$myrow["phone2"]; // $_POST['fax'] =$myrow["fax"]; // $_POST['email'] =$myrow["email"]; $_POST['tax_group_id'] = $myrow["tax_group_id"]; $_POST['disable_trans'] = $myrow['disable_trans']; $_POST['default_location'] = $myrow["default_location"]; $_POST['default_ship_via'] = $myrow['default_ship_via']; $_POST['sales_account'] = $myrow["sales_account"]; $_POST['sales_discount_account'] = $myrow['sales_discount_account']; $_POST['receivables_account'] = $myrow['receivables_account']; $_POST['payment_discount_account'] = $myrow['payment_discount_account']; $_POST['group_no'] = $myrow["group_no"]; $_POST['notes'] = $myrow["notes"]; } } elseif ($Mode != 'ADD_ITEM') { //end of if $SelectedBranch only do the else when a new record is being entered $myrow = get_default_info_for_branch($_POST['customer_id']); // $_POST['rep_lang'] = $myrow['rep_lang']; if (!$num_branches) { $_POST['br_name'] = $myrow["name"]; $_POST['br_ref'] = $myrow["debtor_ref"]; $_POST['contact_name'] = _('Main Branch'); $_POST['br_address'] = $_POST['br_post_address'] = $myrow["address"]; } $_POST['branch_code'] = ""; if (!isset($_POST['sales_account']) || !isset($_POST['sales_discount_account'])) { $company_record = get_company_prefs(); // We use the Item Sales Account as default! // $_POST['sales_account'] = $company_record["default_sales_act"]; $_POST['sales_account'] = $_POST['notes'] = ''; $_POST['sales_discount_account'] = $company_record['default_sales_discount_act']; $_POST['receivables_account'] = $company_record['debtors_act']; $_POST['payment_discount_account'] = $company_record['default_prompt_payment_act']; } } hidden('popup', @$_REQUEST['popup']); table_section_title(_("Name and Contact")); text_row(_("Branch Name:"), 'br_name', null, 35, 40); text_row(_("Branch Short Name:"), 'br_ref', null, 30, 30); table_section_title(_("Sales")); sales_persons_list_row(_("Sales Person:"), 'salesman', null); sales_areas_list_row(_("Sales Area:"), 'area', null); sales_groups_list_row(_("Sales Group:"), 'group_no', null, true); locations_list_row(_("Default Inventory Location:"), 'default_location', null); shippers_list_row(_("Default Shipping Company:"), 'default_ship_via', null); tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null); table_section_title(_("GL Accounts")); // 2006-06-14. Changed gl_al_accounts_list to have an optional all_option 'Use Item Sales Accounts' gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, true); gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account'); gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', null, true); gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account'); table_section(2); if ($selected_id == -1) { table_section_title(_("General contact data")); text_row(_("Contact Person:"), 'contact_name', null, 35, 40); text_row(_("Phone Number:"), 'phone', null, 32, 30); text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30); text_row(_("Fax Number:"), 'fax', null, 32, 30); email_row(_("E-mail:"), 'email', null, 35, 55); languages_list_row(_("Document Language:"), 'rep_lang', null, _("Customer default")); } table_section_title(_("Addresses")); textarea_row(_("Mailing Address:"), 'br_post_address', null, 35, 4); textarea_row(_("Billing Address:"), 'br_address', null, 35, 4); textarea_row(_("General Notes:"), 'notes', null, 35, 4); if ($selected_id != -1) { yesno_list_row(_("Disable this Branch:"), 'disable_trans', null); } end_outer_table(1); submit_add_or_update_center($selected_id == -1, '', 'both'); }