Exemple #1
0
function display_rates($curr_code)
{
    global $table_style;
    $result = get_exchange_rates($curr_code);
    br(2);
    start_table($table_style);
    $th = array(tr("Date to Use From"), tr("Exchange Rate"), "", "");
    table_header($th);
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell(sql2date($myrow["date_"]));
        label_cell(number_format2($myrow["rate_buy"], user_exrate_dec()), "nowrap align=right");
        edit_link_cell("selected_id=" . $myrow["id"]);
        delete_link_cell("selected_id=" . $myrow["id"] . "&delete=1");
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
}
Exemple #2
0
function display_bom_items($selected_parent)
{
    global $table_style;
    $result = get_bom($selected_parent);
    start_table("{$table_style} width=60%");
    $th = array(tr("Code"), tr("Description"), tr("Location"), tr("Work Centre"), tr("Quantity"), tr("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["component"]);
        label_cell($myrow["description"]);
        label_cell($myrow["location_name"]);
        label_cell($myrow["WorkCentreDescription"]);
        label_cell(qty_format($myrow["quantity"]));
        label_cell($myrow["units"]);
        edit_link_cell(SID . "NewItem={$selected_parent}&selected_component=" . $myrow["id"]);
        delete_link_cell(SID . "delete=" . $myrow["id"] . "&stock_id=" . $_POST['stock_id']);
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
}
Exemple #3
0
$sql = "SELECT * FROM salesman";
$result = db_query($sql, "could not get sales persons");
start_table("{$table_style} width=60%");
$th = array(tr("Name"), tr("Phone"), tr("Fax"), tr("Email"), tr("Provision"), tr("Break Pt."), tr("Provision") . " 2", "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["salesman_name"]);
    label_cell($myrow["salesman_phone"]);
    label_cell($myrow["salesman_fax"]);
    label_cell($myrow["salesman_email"]);
    label_cell(percent_format($myrow["provision"]) . " %", "nowrap align=right");
    amount_cell($myrow["break_pt"]);
    label_cell(percent_format($myrow["provision2"]) . " %", "nowrap align=right");
    edit_link_cell(SID . "selected_id=" . $myrow["salesman_code"]);
    delete_link_cell(SID . "selected_id=" . $myrow["salesman_code"] . "&delete=1");
    end_row();
}
//END WHILE LIST LOOP
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"];
    $sql = "SELECT debtors_master.name, cust_branch.*, salesman.salesman_name," . "areas.description, tax_groups.name AS tax_group_name " . "FROM cust_branch, debtors_master, areas, salesman, tax_groups " . "WHERE cust_branch.debtor_no=debtors_master.debtor_no " . "AND cust_branch.tax_group_id=tax_groups.id " . "AND cust_branch.area=areas.area_code " . "AND cust_branch.salesman=salesman.salesman_code " . "AND cust_branch.debtor_no = '" . $_POST['customer_id'] . "'";
    $result = db_query($sql, "could not get customer branches");
    start_table("{$table_style} width=60%");
    $th = array(tr("Name"), tr("Contact"), tr("Sales Person"), tr("Area"), tr("Phone No"), tr("Fax No"), tr("E-mail"), tr("Tax Group"), "", "");
    table_header($th);
    while ($myrow = db_fetch($result)) {
        start_row();
        label_cell($myrow["br_name"]);
        label_cell($myrow["contact_name"]);
        label_cell($myrow["salesman_name"]);
        label_cell($myrow["description"]);
        label_cell($myrow["phone"]);
        label_cell($myrow["fax"]);
        label_cell("<a href=mailto:" . $myrow["email"] . ">" . $myrow["email"] . "</a>");
        label_cell($myrow["tax_group_name"]);
        edit_link_cell("debtor_no=" . $_POST['customer_id'] . "&SelectedBranch=" . $myrow["branch_code"]);
        delete_link_cell("debtor_no=" . $_POST['customer_id'] . "&SelectedBranch=" . $myrow["branch_code"] . "&delete=yes");
        end_row();
    }
    end_table();
    //END WHILE LIST LOOP
} else {
    display_note(tr("The selected customer does not have any branches. Please create at least one branch."));
}
if ($_POST['customer_id'] != "" && $_POST['branch_code'] != '') {
    hyperlink_params($_SERVER['PHP_SELF'], tr("New Customer Branch"), "debtor_no=" . $_POST['customer_id']);
}
echo "<br>";
start_table("{$table_style2} width=60%", 5);
echo "<tr valign=top><td>";
// outer table
Exemple #5
0
while ($myrow = db_fetch($result)) {
    if ($myrow["day_in_following_month"] == 0) {
        $full_text = tr("N/A");
    } else {
        $full_text = $myrow["day_in_following_month"];
    }
    if ($myrow["days_before_due"] == 0) {
        $after_text = tr("N/A");
    } else {
        $after_text = $myrow["days_before_due"] . " " . tr("days");
    }
    alt_table_row_color($k);
    label_cell($myrow["terms"]);
    label_cell($full_text);
    label_cell($after_text);
    edit_link_cell("selected_id=" . $myrow["terms_indicator"]);
    delete_link_cell("selected_id=" . $myrow["terms_indicator"] . "&delete=1");
    end_row();
}
//END WHILE LIST LOOP
end_table();
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Payment Term"));
//-------------------------------------------------------------------------------------------------
start_form();
start_table($table_style2);
$day_in_following_month = $days_before_due = 0;
if (isset($selected_id)) {
    //editing an existing payment terms
    $sql = "SELECT * FROM payment_terms\n\t\tWHERE terms_indicator='{$selected_id}'";
    $result = db_query($sql, "could not get payment term");
    $myrow = db_fetch($result);
//----------------------------------------------------------------------------------------------
$sql = "SELECT * FROM shippers ORDER BY shipper_id";
$result = db_query($sql, "could not get shippers");
start_table($table_style);
$th = array(tr("Name"), tr("Contact Person"), tr("Phone Number"), tr("Address"), tr("Shipping Charge:"), "", "");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["shipper_name"]);
    label_cell($myrow["contact"]);
    label_cell($myrow["phone"]);
    label_cell($myrow["address"]);
    label_cell($myrow["shipper_defcost"]);
    edit_link_cell("selected_id=" . $myrow[0]);
    delete_link_cell("selected_id=" . $myrow[0] . "&delete=1");
    end_row();
}
end_table();
//----------------------------------------------------------------------------------------------
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Shipping Company"));
start_form();
start_table($table_style2);
if (isset($selected_id)) {
    //editing an existing Shipper
    $sql = "SELECT * FROM shippers WHERE shipper_id={$selected_id}";
    $result = db_query($sql, "could not get shipper");
    $myrow = db_fetch($result);
    $_POST['shipper_name'] = $myrow["shipper_name"];
    $_POST['contact'] = $myrow["contact"];
Exemple #7
0
function display_modules()
{
    global $table_style, $installed_modules;
    echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteModule(id, name) {\n\t\t\tif (!confirm('" . tr("Are you sure you want to delete module: ") . "'+name))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('inst_module.php?c=df&id='+id)\n\t\t}\n\t\t</script>";
    start_table($table_style);
    $th = array(tr("Tab"), tr("Name"), tr("Folder"), tr("Filename"), "", "");
    table_header($th);
    $k = 0;
    $mods = $installed_modules;
    $n = count($mods);
    for ($i = 0; $i < $n; $i++) {
        alt_table_row_color($k);
        label_cell(get_tab_title($mods[$i]['tab']));
        label_cell($mods[$i]['name']);
        label_cell($mods[$i]['path']);
        label_cell($mods[$i]['filename']);
        edit_link_cell("selected_id=" . $i);
        label_cell("<a href='javascript:deleteModule(" . $i . ", \"" . $mods[$i]['name'] . "\")'>" . tr("Delete") . "</a>");
        end_row();
    }
    end_table();
}
$result = get_account_classes();
start_table($table_style);
$th = array(tr("Class ID"), tr("Class Name"), tr("Balance Sheet"), "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if ($myrow["balance_sheet"] == 0) {
        $bs_text = tr("No");
    } else {
        $bs_text = tr("Yes");
    }
    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);
Exemple #9
0
/* It could still be the second time the page has been run and a record has been selected for modification - selected_id will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters
then none of the above are true and the list of locations will be displayed with
links to delete or edit each. These will call the same page again and allow update/input
or deletion of the records*/
$sql = "SELECT * FROM locations";
$result = db_query($sql, "could not query locations");
start_table("{$table_style} width=30%");
$th = array(tr("Location Code"), tr("Location Name"), "", "");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch_row($result)) {
    alt_table_row_color($k);
    label_cell($myrow[0]);
    label_cell($myrow[1]);
    edit_link_cell("selected_id={$myrow['0']}");
    delete_link_cell("selected_id={$myrow['0']}&delete=1");
    end_row();
}
//END WHILE LIST LOOP
//end of ifs and buts!
end_table();
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Location"));
start_form();
start_table($table_style2);
if (isset($selected_id)) {
    //editing an existing Location
    $myrow = get_item_location($selected_id);
    $_POST['loc_code'] = $myrow["loc_code"];
    $_POST['location_name'] = $myrow["location_name"];
    $_POST['delivery_address'] = $myrow["delivery_address"];
Exemple #10
0
function display_fiscalyears()
{
    global $table_style;
    $company_year = get_company_pref('f_year');
    $result = get_all_fiscalyears();
    start_table($table_style);
    $th = array(tr("Fiscal Year Begin"), tr("Fiscal Year End"), tr("Closed"), "", "");
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        if ($myrow['id'] == $company_year) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        $from = sql2date($myrow["begin"]);
        $to = sql2date($myrow["end"]);
        if ($myrow["closed"] == 0) {
            $closed_text = tr("No");
        } else {
            $closed_text = tr("Yes");
        }
        label_cell($from);
        label_cell($to);
        label_cell($closed_text);
        edit_link_cell("selected_id=" . urlencode($from));
        if ($myrow["id"] != $company_year) {
            delete_link_cell("selected_id=" . urlencode($from) . "&to_date=" . urlencode($to) . "&delete=1");
        }
        end_row();
    }
    end_table();
    display_note(tr("The marked fiscal year is the current fiscal year which cannot be deleted."), 0, 0, "class='currentfg'");
}
Exemple #11
0
}
//---------------------------------------------------------------------------------------------------
$mb_flag = get_mb_flag($_POST['stock_id']);
$prices_list = get_prices($_POST['stock_id']);
start_table("{$table_style} width=30%");
$th = array(tr("Currency"), tr("Sales Type"), tr("Price"), tr("Factor"), "", "");
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($prices_list)) {
    alt_table_row_color($k);
    label_cell($myrow["curr_abrev"]);
    label_cell($myrow["sales_type"]);
    amount_cell($myrow["price"]);
    amount_cell($myrow["factor"]);
    edit_link_cell("PriceID=" . $myrow["id"] . "&Edit=1");
    delete_link_cell("PriceID=" . $myrow["id"] . "&delete=yes");
    end_row();
}
end_table();
//------------------------------------------------------------------------------------------------
if (db_num_rows($prices_list) == 0) {
    display_note(tr("There are no prices set up for this part."));
}
echo "<br>";
if (isset($_GET['Edit'])) {
    $myrow = get_stock_price($_GET['PriceID']);
    hidden('PriceID', $_GET['PriceID']);
    $_POST['curr_abrev'] = $myrow["curr_abrev"];
    $_POST['sales_type_id'] = $myrow["sales_type_id"];
    $_POST['price'] = price_format($myrow["price"]);
Exemple #12
0
function display_currencies()
{
    global $table_style;
    $company_currency = get_company_currency();
    $result = get_currencies();
    start_table($table_style);
    $th = array(tr("Abbreviation"), tr("Symbol"), tr("Currency Name"), tr("Hundredths name"), tr("Country"), "", "");
    table_header($th);
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        if ($myrow[1] == $company_currency) {
            start_row("class='currencybg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($myrow["curr_abrev"]);
        label_cell($myrow["curr_symbol"]);
        label_cell($myrow["currency"]);
        label_cell($myrow["hundreds_name"]);
        label_cell($myrow["country"]);
        edit_link_cell("selected_id=" . $myrow["curr_abrev"]);
        if ($myrow["curr_abrev"] != $company_currency) {
            delete_link_cell("selected_id=" . $myrow["curr_abrev"] . "&delete=1");
        }
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    display_note(tr("The marked currency is the home currency which cannot be deleted."), 0, 0, "class='currentfg'");
}
Exemple #13
0
$result = db_query($sql, "could not get bank accounts");
check_db_error("The bank accounts set up could not be retreived", $sql);
start_table("{$table_style} width='80%'");
$th = array(tr("GL Account"), tr("Bank"), tr("Account Name"), tr("Type"), tr("Number"), tr("Currency"), tr("Bank Address"));
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap");
    label_cell($myrow["bank_name"], "nowrap");
    label_cell($myrow["bank_account_name"], "nowrap");
    label_cell(bank_account_types::name($myrow["account_type"]), "nowrap");
    label_cell($myrow["bank_account_number"], "nowrap");
    label_cell($myrow["bank_curr_code"], "nowrap");
    label_cell($myrow["bank_address"]);
    edit_link_cell("selected_id=" . $myrow["account_code"]);
    delete_link_cell("selected_id=" . $myrow["account_code"] . "&delete=1");
    end_row();
}
//END WHILE LIST LOOP
end_table();
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Bank Account"));
start_form();
$is_editing = isset($selected_id) && !isset($_GET['delete']);
start_table($table_style2);
if ($is_editing) {
    $myrow = get_bank_account($selected_id);
    $_POST['account_code'] = $myrow["account_code"];
    $_POST['account_type'] = $myrow["account_type"];
    $_POST['bank_name'] = $myrow["bank_name"];
    $_POST['bank_account_name'] = $myrow["bank_account_name"];
Exemple #14
0
    if (db_num_rows($result) == 0) {
        display_note(tr("There is no purchasing data set up for the part selected"));
    } else {
        start_table("{$table_style} width=60%");
        $th = array(tr("Supplier"), tr("Price"), tr("Currency"), tr("Supplier's Unit"), tr("Supplier's Description"), "", "");
        table_header($th);
        $k = $j = 0;
        //row colour counter
        while ($myrow = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($myrow["supp_name"]);
            amount_cell($myrow["price"]);
            label_cell($myrow["curr_code"]);
            label_cell($myrow["suppliers_uom"]);
            label_cell($myrow["supplier_description"]);
            edit_link_cell("stock_id=" . $_POST['stock_id'] . "&supplier_id=" . $myrow["supplier_id"] . "&Edit=1");
            delete_link_cell("stock_id=" . $_POST['stock_id'] . "&supplier_id=" . $myrow["supplier_id"] . "&Delete=1");
            end_row();
            $j++;
            if ($j == 12) {
                $j = 1;
                table_header($th);
            }
            //end of page full new headings
        }
        //end of while loop
        end_table();
    }
}
//------------------------------------------------------------------------------------------------
if (isset($_GET['Edit'])) {
Exemple #15
0
        db_query($sql, "could not delete sales area");
        meta_forward($_SERVER['PHP_SELF']);
    }
    //end if Delete area
}
//-------------------------------------------------------------------------------------------------
$sql = "SELECT * FROM areas";
$result = db_query($sql, "could not get areas");
start_table("{$table_style} width=40%");
$th = array(tr("Area Name"), "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["description"]);
    edit_link_cell("selected_id=" . $myrow["area_code"]);
    delete_link_cell("selected_id=" . $myrow["area_code"] . "&delete=1");
    end_row();
}
end_table();
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Sales Area"));
//-------------------------------------------------------------------------------------------------
start_form();
start_table("{$table_style2} width=40%");
if (isset($selected_id)) {
    //editing an existing area
    $sql = "SELECT * FROM areas WHERE area_code='{$selected_id}'";
    $result = db_query($sql, "could not get area");
    $myrow = db_fetch($result);
    $_POST['description'] = $myrow["description"];
    hidden("selected_id", $selected_id);
Exemple #16
0
function display_languages()
{
    global $table_style, $installed_languages;
    $lang = $_SESSION["language"]->code;
    echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteLanguage(id) {\n\t\t\tif (!confirm('" . tr("Are you sure you want to delete language no. ") . "'+id))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('inst_lang.php?c=df&id='+id)\n\t\t}\n\t\t</script>";
    start_table($table_style);
    $th = array(tr("Language"), tr("Name"), tr("Encoding"), tr("Right To Left"), "", "");
    table_header($th);
    $k = 0;
    $conn = $installed_languages;
    $n = count($conn);
    for ($i = 0; $i < $n; $i++) {
        if ($conn[$i]['code'] == $lang) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($conn[$i]['code']);
        label_cell($conn[$i]['name']);
        label_cell($conn[$i]['encoding']);
        if (isset($conn[$i]['rtl']) && $conn[$i]['rtl']) {
            $rtl = tr("Yes");
        } else {
            $rtl = tr("No");
        }
        label_cell($rtl);
        edit_link_cell("selected_id=" . $i);
        if ($conn[$i]['code'] != $lang) {
            label_cell("<a href='javascript:deleteLanguage(" . $i . ")'>" . tr("Delete") . "</a>");
        }
        end_row();
    }
    end_table();
    display_note(tr("The marked language is the current language which cannot be deleted."), 0, 0, "class='currentfg'");
}