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
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();
end_table(1);
// outer table
submit_add_or_update_center(isset($_POST['New']));
end_form();
end_page();
function check_branches()
{
    $cust = $_POST['customer_id'];
    $branch = $_POST['branch_code'];
    if ($cust != "" && $branch != "") {
        $sql = "SELECT branch_code from cust_branch WHERE debtor_no={$cust} AND " . "branch_code={$branch} ORDER BY branch_code ASC";
        $result = db_query($sql);
        $myrow = db_fetch_row($result);
        if ($myrow[0] == 0) {
            $branch = '';
        }
    }
    if ($cust != "" && $branch == '') {
Example #3
0
end_table();
//------------------------------------------------------------------------------------------------
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Sales Person"));
//------------------------------------------------------------------------------------------------
start_form();
if (isset($selected_id)) {
    //editing an existing Sales-person
    $sql = "SELECT *  FROM salesman WHERE salesman_code='{$selected_id}'";
    $result = db_query($sql, "could not get sales person");
    $myrow = db_fetch($result);
    $_POST['salesman_name'] = $myrow["salesman_name"];
    $_POST['salesman_phone'] = $myrow["salesman_phone"];
    $_POST['salesman_fax'] = $myrow["salesman_fax"];
    $_POST['salesman_email'] = $myrow["salesman_email"];
    $_POST['provision'] = percent_format($myrow["provision"]);
    $_POST['break_pt'] = price_format($myrow["break_pt"]);
    $_POST['provision2'] = percent_format($myrow["provision2"]);
    hidden('selected_id', $selected_id);
}
start_table("{$table_style2} width=60%");
text_row_ex(tr("Sales person name:"), 'salesman_name', 30);
text_row_ex(tr("Telephone number:"), 'salesman_phone', 20);
text_row_ex(tr("Fax number:"), 'salesman_fax', 20);
text_row_ex(tr("Email:"), 'salesman_email', 40);
percent_row(tr("Provision"), 'provision');
amount_row(tr("Break Pt.:"), 'break_pt');
percent_row(tr("Provision") . " 2", 'provision2');
end_table(1);
submit_add_or_update_center(!isset($selected_id));
end_form();
end_page();
function display_fiscalyear_edit($selected_id)
{
    global $Mode;
    start_form();
    start_table(TABLESTYLE2);
    $company_year = get_company_pref('f_year');
    $result = get_all_fiscalyears();
    $row_cnt = db_num_rows($result);
    if ($selected_id != -1) {
        if ($Mode == 'Edit') {
            $myrow = get_fiscalyear($selected_id);
            $_POST['from_date'] = sql2date($myrow["begin"]);
            $_POST['to_date'] = sql2date($myrow["end"]);
            $_POST['closed'] = $myrow["closed"];
        }
        if ($row_cnt == 1) {
            date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
        } else {
            hidden('from_date');
            label_row(_("Fiscal Year Begin:"), $_POST['from_date']);
        }
        hidden('to_date');
        label_row(_("Fiscal Year End:"), $_POST['to_date']);
        if ($myrow["id"] != $company_year) {
            yesno_list_row(_("Is Closed:"), 'closed', null, "", "", false);
        } else {
            hidden('closed');
            label_row(_("Is Closed:"), yesno_value($_POST['closed']));
        }
    } else {
        $begin = next_begin_date();
        if ($begin && $Mode != 'ADD_ITEM') {
            $_POST['from_date'] = $begin;
            $_POST['to_date'] = end_month(add_months($begin, 11));
            $_POST['closed'] = 0;
        }
        hidden('from_date');
        hidden('to_date');
        hidden('closed');
    }
    hidden('selected_id', $selected_id);
    end_table(1);
    submit_add_or_update_center($selected_id == -1, '', 'both');
    end_form();
}
Example #5
0
function display_currency_edit($selected_id)
{
    global $Mode;
    start_table(TABLESTYLE2);
    if ($selected_id != '') {
        if ($Mode == 'Edit') {
            //editing an existing currency
            $myrow = get_currency($selected_id);
            $_POST['Abbreviation'] = $myrow["curr_abrev"];
            $_POST['Symbol'] = $myrow["curr_symbol"];
            $_POST['CurrencyName'] = $myrow["currency"];
            $_POST['country'] = $myrow["country"];
            $_POST['hundreds_name'] = $myrow["hundreds_name"];
            $_POST['auto_update'] = $myrow["auto_update"];
        }
        hidden('Abbreviation');
        hidden('selected_id', $selected_id);
        label_row(_("Currency Abbreviation:"), $_POST['Abbreviation']);
    } else {
        $_POST['auto_update'] = 1;
        text_row_ex(_("Currency Abbreviation:"), 'Abbreviation', 4, 3);
    }
    text_row_ex(_("Currency Symbol:"), 'Symbol', 10);
    text_row_ex(_("Currency Name:"), 'CurrencyName', 20);
    text_row_ex(_("Hundredths Name:"), 'hundreds_name', 15);
    text_row_ex(_("Country:"), 'country', 40);
    check_row(_("Automatic exchange rate update:"), 'auto_update', get_post('auto_update'));
    end_table(1);
    submit_add_or_update_center($selected_id == '', '', 'both');
}
Example #6
0
function display_fiscalyear_edit($selected_id)
{
    global $Mode;
    start_form();
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        if ($Mode == 'Edit') {
            $myrow = get_fiscalyear($selected_id);
            $_POST['from_date'] = sql2date($myrow["begin"]);
            $_POST['to_date'] = sql2date($myrow["end"]);
            $_POST['closed'] = $myrow["closed"];
        }
        hidden('from_date');
        hidden('to_date');
        label_row(_("Fiscal Year Begin:"), $_POST['from_date']);
        label_row(_("Fiscal Year End:"), $_POST['to_date']);
    } else {
        $begin = next_begin_date();
        if ($begin && $Mode != 'ADD_ITEM') {
            $_POST['from_date'] = $begin;
            $_POST['to_date'] = end_month(add_months($begin, 11));
        }
        date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
        date_row(_("Fiscal Year End:"), 'to_date', '', null, 0, 0, 1001);
    }
    hidden('selected_id', $selected_id);
    yesno_list_row(_("Is Closed:"), 'closed', null, "", "", false);
    end_table(1);
    submit_add_or_update_center($selected_id == -1, '', 'both');
    end_form();
}
Example #7
0
    }
    label_cell($myrow["cid"]);
    label_cell($myrow['class_name']);
    label_cell($bs_text);
    edit_link_cell("selected_id=" . $myrow["cid"]);
    delete_link_cell("selected_id=" . $myrow["cid"] . "&delete=1");
    end_row();
}
end_table();
//-----------------------------------------------------------------------------------
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Account Class"));
start_form();
start_table($table_style2);
if ($selected_id != -1) {
    //editing an existing status code
    $myrow = get_account_class($selected_id);
    $_POST['id'] = $myrow["cid"];
    $_POST['name'] = $myrow["class_name"];
    $_POST['Balance'] = $myrow["balance_sheet"];
    hidden('selected_id', $selected_id);
    label_row(tr("Class ID:"), $_POST['id']);
} else {
    text_row_ex(tr("Class ID:"), 'id', 3);
}
text_row_ex(tr("Class Name:"), 'name', 50);
yesno_list_row(tr("Balance Sheet:"), 'Balance', null, "", "", false);
end_table(1);
submit_add_or_update_center($selected_id == -1);
end_form();
//------------------------------------------------------------------------------------
end_page();
Example #8
0
function display_rate_edit()
{
    global $selected_id, $Ajax, $xr_providers, $dflt_xr_provider;
    $xchg_rate_provider = isset($xr_providers) && isset($dflt_xr_provider) ? $xr_providers[$dflt_xr_provider] : 'ECB';
    start_table(TABLESTYLE2);
    if ($selected_id != "") {
        //editing an existing exchange rate
        $myrow = get_exchange_rate($selected_id);
        $_POST['date_'] = sql2date($myrow["date_"]);
        $_POST['BuyRate'] = maxprec_format($myrow["rate_buy"]);
        hidden('selected_id', $selected_id);
        hidden('date_', $_POST['date_']);
        label_row(_("Date to Use From:"), $_POST['date_']);
    } else {
        $_POST['date_'] = Today();
        $_POST['BuyRate'] = '';
        date_row(_("Date to Use From:"), 'date_');
    }
    if (isset($_POST['get_rate'])) {
        $_POST['BuyRate'] = maxprec_format(retrieve_exrate($_POST['curr_abrev'], $_POST['date_']));
        $Ajax->activate('BuyRate');
    }
    amount_row(_("Exchange Rate:"), 'BuyRate', null, '', submit('get_rate', _("Get"), false, _('Get current rate from') . ' ' . $xchg_rate_provider, true), 'max');
    end_table(1);
    submit_add_or_update_center($selected_id == '', '', 'both');
    display_note(_("Exchange rates are entered against the company currency."), 1);
}
Example #9
0
function display_rate_edit()
{
    global $selected_id, $table_style2;
    start_table($table_style2);
    if (isset($_POST['get_rate'])) {
        $_POST['BuyRate'] = exrate_format(get_ecb_rate($_POST['curr_abrev']));
    }
    if ($selected_id != "") {
        //editing an existing exchange rate
        $myrow = get_exchange_rate($selected_id);
        $_POST['date_'] = sql2date($myrow["date_"]);
        $_POST['BuyRate'] = exrate_format($myrow["rate_buy"]);
        hidden('selected_id', $selected_id);
        hidden('date_', $_POST['date_']);
        hidden('curr_abrev', $_POST['curr_abrev']);
        label_row(tr("Date to Use From:"), $_POST['date_']);
    } else {
        date_row(tr("Date to Use From:"), 'date_');
    }
    small_amount_row(tr("Exchange Rate:"), 'BuyRate', null, '', submit('get_rate', tr("Get")), user_exrate_dec());
    end_table(1);
    submit_add_or_update_center($selected_id == "");
    display_note(tr("Exchange rates are entered against the company currency."), 1);
}
Example #10
0
function display_language_edit($selected_id)
{
    global $installed_languages, $dflt_lang;
    if ($selected_id == -1) {
        $n = count($installed_languages);
    } else {
        $n = $selected_id;
    }
    start_form(true);
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        $lang = $installed_languages[$n];
        $_POST['code'] = $lang['code'];
        $_POST['name'] = $lang['name'];
        $_POST['encoding'] = $lang['encoding'];
        if (isset($lang['rtl']) && $lang['rtl'] === true) {
            $_POST['rtl'] = $lang['rtl'];
        } else {
            $_POST['rtl'] = false;
        }
        $_POST['dflt'] = $dflt_lang == $lang['code'];
        hidden('selected_id', $selected_id);
    }
    text_row_ex(_("Language Code"), 'code', 20);
    text_row_ex(_("Language Name"), 'name', 20);
    text_row_ex(_("Encoding"), 'encoding', 20);
    yesno_list_row(_("Right To Left"), 'rtl', null, "", "", false);
    yesno_list_row(_("Default Language"), 'dflt', null, "", "", false);
    file_row(_("Language File") . " (PO)", 'uploadfile');
    file_row(_("Language File") . " (MO)", 'uploadfile2');
    end_table(0);
    display_note(_("Select your language files from your local harddisk."), 0, 1);
    submit_add_or_update_center(false, '', 'both');
    end_form();
}
Example #11
0
    $sql = get_sql_for_attached_documents($type);
    $cols = array(_("#") => array('fun' => 'trans_view', 'ord' => ''), _("Description") => array('name' => 'description'), _("Filename") => array('name' => 'filename'), _("Size") => array('name' => 'filesize'), _("Filetype") => array('name' => 'filetype'), _("Date Uploaded") => array('name' => 'tran_date', 'type' => 'date'), array('insert' => true, 'fun' => 'edit_link'), array('insert' => true, 'fun' => 'view_link'), array('insert' => true, 'fun' => 'download_link'), array('insert' => true, 'fun' => 'delete_link'));
    $table =& new_db_pager('trans_tbl', $sql, $cols);
    $table->width = "60%";
    display_db_pager($table);
}
//----------------------------------------------------------------------------------------
start_form(true);
viewing_controls();
display_rows($_POST['filterType']);
br(2);
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        $row = get_attachment($selected_id);
        $_POST['trans_no'] = $row["trans_no"];
        $_POST['description'] = $row["description"];
        hidden('trans_no', $row['trans_no']);
        hidden('unique_name', $row['unique_name']);
        label_row(_("Transaction #"), $row['trans_no']);
    }
    hidden('selected_id', $selected_id);
} else {
    text_row_ex(_("Transaction #") . ':', 'trans_no', 10);
}
text_row_ex(_("Description") . ':', 'description', 40);
file_row(_("Attached File") . ":", 'filename', 'filename');
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'process');
end_form();
end_page();
Example #12
0
function display_fiscalyear_edit($selected_id)
{
    global $table_style2;
    start_form();
    start_table($table_style2);
    if ($selected_id) {
        $myrow = get_fiscalyear($selected_id);
        $_POST['from_date'] = sql2date($myrow["begin"]);
        $_POST['to_date'] = sql2date($myrow["end"]);
        $_POST['closed'] = $myrow["closed"];
        hidden('selected_id', $selected_id);
        hidden('from_date', $_POST['from_date']);
        hidden('to_date', $_POST['to_date']);
        label_row(tr("Fiscal Year Begin:"), $_POST['from_date']);
        label_row(tr("Fiscal Year End:"), $_POST['to_date']);
    } else {
        date_row(tr("Fiscal Year Begin:"), 'from_date', null, 0, 0, 1001);
        date_row(tr("Fiscal Year End:"), 'to_date', null, 0, 0, 1001);
    }
    yesno_list_row(tr("Is Closed:"), 'closed', null, "", "", false);
    end_table(1);
    submit_add_or_update_center(!isset($selected_id));
    end_form();
}
Example #13
0
function display_currency_edit($selected_id)
{
    global $table_style2;
    start_form();
    start_table($table_style2);
    if ($selected_id != "") {
        //editing an existing currency
        $myrow = get_currency($selected_id);
        $_POST['Abbreviation'] = $myrow["curr_abrev"];
        $_POST['Symbol'] = $myrow["curr_symbol"];
        $_POST['CurrencyName'] = $myrow["currency"];
        $_POST['country'] = $myrow["country"];
        $_POST['hundreds_name'] = $myrow["hundreds_name"];
        hidden('selected_id', $selected_id);
        hidden('Abbreviation', $_POST['Abbreviation']);
        label_row(tr("Currency Abbreviation:"), $_POST['Abbreviation']);
    } else {
        text_row_ex(tr("Currency Abbreviation:"), 'Abbreviation', 4, 3);
    }
    text_row_ex(tr("Currency Symbol:"), 'Symbol', 10);
    text_row_ex(tr("Currency Name:"), 'CurrencyName', 20);
    text_row_ex(tr("Hundredths Name:"), 'hundreds_name', 15);
    text_row_ex(tr("Country:"), 'country', 40);
    end_table(1);
    submit_add_or_update_center($selected_id == "");
    end_form();
}
Example #14
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');
}