Example #1
0
            $_POST['loc_code'] = $myrow["loc_code"];
            $_POST['component'] = $myrow["component"];
            // by Tom Moulton
            $_POST['workcentre_added'] = $myrow["workcentre_added"];
            $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["component"]));
            label_row(_("Component:"), $myrow["component"] . " - " . $myrow["description"]);
        }
        hidden('selected_id', $selected_id);
    } else {
        start_row();
        label_cell(_("Component:"), "class='label'");
        echo "<td>";
        echo stock_component_items_list('component', $selected_parent, null, false, true);
        if (get_post('_component_update')) {
            $Ajax->activate('quantity');
        }
        echo "</td>";
        end_row();
    }
    hidden('stock_id', $selected_parent);
    locations_list_row(_("Location to Draw From:"), 'loc_code', null);
    workcenter_list_row(_("Work Centre Added:"), 'workcentre_added', null);
    $dec = get_qty_dec(get_post('component'));
    $_POST['quantity'] = number_format2(input_num('quantity', 1), $dec);
    qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
    end_table(1);
    submit_add_or_update_center($selected_id == -1, '', 'both');
    end_form();
}
// ----------------------------------------------------------------------------------
end_page();
Example #2
0
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();
}
Example #3
0
if (!isset($_POST['New']) && $num_branches) {
    // nothing to do
} 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);
function display_credit_options()
{
    global $Ajax;
    br();
    if (isset($_POST['_CreditType_update'])) {
        $Ajax->activate('options');
    }
    div_start('options');
    start_table(TABLESTYLE2);
    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();
}
Example #5
0
    $_POST['units_issued'] = $_POST['released'] = 0;
    ref_row(_("Reference:"), 'wo_ref', '', $Refs->get_next(ST_WORKORDER));
    wo_types_list_row(_("Type:"), 'type', null);
}
if (get_post('released')) {
    hidden('stock_id', $_POST['stock_id']);
    hidden('StockLocation', $_POST['StockLocation']);
    hidden('type', $_POST['type']);
    label_row(_("Item:"), $myrow["StockItemName"]);
    label_row(_("Destination Location:"), $myrow["location_name"]);
} else {
    stock_manufactured_items_list_row(_("Item:"), 'stock_id', null, false, true);
    if (list_updated('stock_id')) {
        $Ajax->activate('quantity');
    }
    locations_list_row(_("Destination Location:"), 'StockLocation', null);
}
if (!isset($_POST['quantity'])) {
    $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
} else {
    $_POST['quantity'] = qty_format($_POST['quantity'], $_POST['stock_id'], $dec);
}
if (get_post('type') == WO_ADVANCED) {
    qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec);
    if ($_POST['released']) {
        label_row(_("Quantity Manufactured:"), number_format($_POST['units_issued'], get_qty_dec($_POST['stock_id'])));
    }
    date_row(_("Date") . ":", 'date_', '', true);
    date_row(_("Date Required By") . ":", 'RequDate', '', null, $SysPrefs->default_wo_required_by());
} else {
    qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
 }
 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']);
 $dim = get_company_pref('use_dimension');
 if ($dim < 1) {
     hidden('dimension_id', 0);
 }
 if ($dim < 2) {
     hidden('dimension2_id', 0);
 }
 global $SysPrefs;
 $credit_limit = price_format($SysPrefs->default_credit_limit());
 table_section_title("Location, Tax Type, Sales Type, Sales Person and Payment Terms");
 locations_list_row("Location:", 'default_location', null);
 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', get_company_pref("curr_default"));
 payment_terms_list_row("Payment Terms:", 'payment_terms', null);
 amount_row(_("Credit Limit:"), 'credit_limit', $credit_limit);
 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);
 }
 text_row("Starting osC Customer ID:", 'min_cid', $min_cid, 6, 6);
 text_row("Ending osC Customer ID:", 'max_cid', $max_cid, 6, 6);
Example #7
0
    }
    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') {
Example #8
0
$_POST['paypal_location'] = $myrow['paypal_location'];
$_POST['paypal_shipper'] = $myrow['paypal_shipper'];
$_POST['paypal_credit_status'] = $myrow['paypal_credit_status'];
//---------------
table_section_title(_("Options"));
check_row(_("Create Customers/Invoices:"), 'paypal_create_invoices', null);
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);
function display_credit_options()
{
    global $table_style2;
    echo "<br>";
    start_table($table_style2);
    echo "<tr><td>" . tr("Credit Note Type") . "</td>";
    echo "<td><select name='CreditType' onchange='this.form.submit();'>";
    if (!isset($_POST['CreditType']) || $_POST['CreditType'] == "Return") {
        echo "<option value='WriteOff'>" . tr("Items Written Off") . "</option>";
        echo "<option selected value='Return'>" . tr("Items Returned to Inventory Location") . "</option>";
    } else {
        echo "<option selected value='WriteOff'>" . tr("Items Written Off") . "</option>";
        echo "<option value='Return'>" . tr("Items Returned to Inventory Location") . "</option>";
    }
    echo "</select>";
    echo "</td></tr>";
    if (!isset($_POST['CreditType']) || $_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(tr("Items Returned to Inventory Location"), 'Location', $_POST['Location']);
    } else {
        /* the goods are to be written off to somewhere */
        gl_all_accounts_list_row(tr("Write Off the Cost of the Items to"), 'WriteOffGLCode', $_POST['WriteOffGLCode']);
    }
    textarea_row(tr("Memo"), "CreditText", null, 45, 3);
    end_table();
}
Example #10
0
        $_POST['adjustment_account'] = $company_record["default_adj_act"];
    }
    if (!isset($_POST['assembly_account']) || $_POST['assembly_account'] == "") {
        $_POST['assembly_account'] = $company_record["default_assembly_act"];
    }
    if (!isset($_POST['sep'])) {
        $_POST['sep'] = ",";
    }
    gl_all_accounts_list_row("Sales Account:", 'sales_account', $_POST['sales_account']);
    gl_all_accounts_list_row("Inventory Account:", 'inventory_account', $_POST['inventory_account']);
    gl_all_accounts_list_row("C.O.G.S. Account:", 'cogs_account', $_POST['cogs_account']);
    gl_all_accounts_list_row("Inventory Adjustments Account:", 'adjustment_account', $_POST['adjustment_account']);
    gl_all_accounts_list_row("Item Assembly Costs Account:", 'assembly_account', $_POST['assembly_account']);
    table_section_title("Separator, Location, Tax and Sales Type");
    text_row("Field separator:", 'sep', $_POST['sep'], 2, 1);
    locations_list_row("To Location:", 'location', null);
    item_tax_types_list_row("Item Tax Type:", 'tax_type_id', null);
    sales_types_list_row("Sales Type:", 'sales_type_id', null);
    label_row("CSV Import File:", "<input type='file' id='imp' name='imp'>");
    end_table(1);
    submit_center('import', "Import CSV File");
    end_form();
}
if ($action == 'export') {
    start_form(true);
    start_table(TABLESTYLE2, "width=40%");
    $company_record = get_company_prefs();
    $currency = $company_record["curr_default"];
    hidden('currency', $currency);
    table_section_title("Export Selection");
    ?>
Example #11
0
}
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        $myrow = get_sales_point($selected_id);
        $_POST['name'] = $myrow["pos_name"];
        $_POST['location'] = $myrow["pos_location"];
        $_POST['account'] = $myrow["pos_account"];
        if ($myrow["credit_sale"]) {
            $_POST['credit_sale'] = 1;
        }
        if ($myrow["cash_sale"]) {
            $_POST['cash_sale'] = 1;
        }
    }
    hidden('selected_id', $selected_id);
}
text_row_ex(_("Point of Sale Name") . ':', 'name', 20, 30);
if ($cash) {
    check_row(_('Allowed credit sale terms selection:'), 'credit', check_value('credit_sale'));
    check_row(_('Allowed cash sale terms selection:'), 'cash', check_value('cash_sale'));
    cash_accounts_list_row(_("Default cash account") . ':', 'account');
} else {
    hidden('credit', 1);
    hidden('account', 0);
}
locations_list_row(_("POS location") . ':', 'location');
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
end_page();
Example #12
0
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');
}