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(); }
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(); }
$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"]; $_POST['salesman_phone'] = $myrow["salesman_phone"];
$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 echo "<table>";
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); $_POST['terms'] = $myrow["terms"];
$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"]; $_POST['phone'] = $myrow["phone"];
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"]; $_POST['contact'] = $myrow["contact"];
} } //---------------------------------------------------------------------------------- $result = get_all_item_units(); start_table("{$table_style} width=50%"); $th = array(tr('Unit'), tr('Description'), tr('Decimals'), "", ""); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["abbr"]); label_cell($myrow["name"]); label_cell($myrow["decimals"]); edit_link_cell(SID . "selected_id={$myrow['0']}"); delete_link_cell(SID . "selected_id={$myrow['0']}&delete=yes"); end_row(); } end_table(); //---------------------------------------------------------------------------------- hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Unit of Measure")); start_form(); start_table("class='tablestyle_noborder'"); if (isset($selected_id)) { //editing an existing item category $myrow = get_item_unit($selected_id); $_POST['abbr'] = $myrow["abbr"]; $_POST['description'] = $myrow["name"]; $_POST['decimals'] = $myrow["decimals"]; hidden('selected_id', $selected_id); }
//--------------------------------------------------------------------------------------------------- $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"]); $_POST['factor'] = price_format($myrow["factor"]);
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'"); }
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'"); }
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"]; $_POST['bank_account_number'] = $myrow["bank_account_number"];
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'])) { $sql = "SELECT purch_data.*,suppliers.supp_name FROM purch_data\n\t\tINNER JOIN suppliers ON purch_data.supplier_id=suppliers.supplier_id\n\t\tWHERE purch_data.supplier_id='{$supplier_id}'\n\t\tAND purch_data.stock_id='" . $_POST['stock_id'] . "'";
table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); $last_visit_date = sql2date($myrow["last_visit_date"]); /*The security_headings array is defined in config.php */ label_cell($myrow["user_id"]); label_cell($myrow["real_name"]); label_cell($myrow["phone"]); label_cell($myrow["email"]); label_cell($last_visit_date, "nowrap"); label_cell($security_headings[$myrow["full_access"]]); edit_link_cell("selected_id=" . $myrow["user_id"]); if (strcasecmp($myrow["user_id"], $_SESSION["wa_current_user"]->username) && $_SESSION["wa_current_user"]->access == 2) { delete_link_cell("selected_id=" . $myrow["user_id"] . "&delete=1"); } end_row(); } //END WHILE LIST LOOP end_table(); //------------------------------------------------------------------------------------------------- hyperlink_no_params($_SERVER['PHP_SELF'], tr("New User")); start_form(); start_table($table_style2); if (isset($selected_id)) { //editing an existing User $myrow = get_user($selected_id); $_POST['user_id'] = $myrow["user_id"]; $_POST['real_name'] = $myrow["real_name"]; $_POST['phone'] = $myrow["phone"];