First commit of biketree to github!

This commit is contained in:
Jonathan Rosenbaum
2017-09-05 03:39:54 +00:00
commit 8ca61d45eb
175 changed files with 24173 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/form.php");
include ("../../classes/display.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$brand_value='';
$id=-1;
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateBrand");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'brands';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$brand_value=$row['brand'];
}
}
else
{
$display->displayTitle("$lang->addBrand");
}
//creates a form object
$f1=new form('process_form_brands.php','POST','brands','300',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("<b>$lang->brandName:</b>",'text','brand',"$brand_value",'24','150');
//sends 2 hidden varibles needed for process_form_users.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$id'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+68
View File
@@ -0,0 +1,68 @@
<?php session_start(); ?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url)
{
if(confirm(message) )
{
location.href = url;
}
}
// --->
</SCRIPT>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/display.php");
include ("../../classes/form.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageBrands");
$f1=new form('manage_brands.php','POST','brands','425',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForBrand</b>",'text','search','','24','350');
$f1->endForm();
$tableheaders=array("$lang->rowID","$lang->brandName","$lang->updateBrand","$lang->deleteBrand");
$tablefields=array('id','brand');
if(isset($_POST['search']))
{
$search=$_POST['search'];
echo "<center>$lang->searchedForBrand: <b>$search</b></center>";
$display->displayManageTable("$cfg_tableprefix",'brands',$tableheaders,$tablefields,'brand',"$search",'brand');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'brands',$tableheaders,$tablefields,'','','brand');
}
$dbf->closeDBlink();
?>
</body>
</html>
+106
View File
@@ -0,0 +1,106 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
//creates 3 objects needed for this script.
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'brands';
$field_names=null;
$field_data=null;
$id=-1;
//checks to see if action is delete and an ID is specified. (only delete uses $_GET.)
if(isset($_GET['action']) and isset($_GET['id']))
{
$action=$_GET['action'];
$id=$_GET['id'];
}
//checks to make sure data is comming from form ($action is either delete or update)
elseif(isset($_POST['brand']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables entered by user.
$brand = $_POST['brand'];
//insure all fields are filled in.
if($brand=='')
{
echo "$lang->forgottenFields";
exit();
}
else
{
$field_names=array('brand');
$field_data=array("$brand");
}
}
else
{
//outputs error message because user did not use form to fill out data.
echo "$lang->mustUseForm";
exit();
}
switch ($action)
{
//finds out what action needs to be taken and preforms it by calling methods from dbf class.
case $action=="insert":
$dbf->insert($field_names,$field_data,$tablename,true);
break;
case $action=="update":
$dbf->update($field_names,$field_data,$tablename,$id,true);
break;
case $action=="delete":
$dbf->deleteRow($tablename,$id);
break;
default:
echo "$lang->noActionSpecified";
break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_brands.php"><?php echo "$lang->manageBrands" ?>--></a>
<br>
<a href="form_brands.php?action=insert"><?php echo "$lang->createBrand" ?>--></a>
</body>
</html>
+86
View File
@@ -0,0 +1,86 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/form.php");
include ("../../classes/display.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display= new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$category_value='';
$id=-1;
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateCategory");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'categories';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$category_value=$row['category'];
}
}
else
{
$display->displayTitle("$lang->addCategory");
}
//creates a form object
$f1=new form('process_form_categories.php','POST','categories','300',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("<b>$lang->categoryName:</b>",'text','category',"$category_value",'24','150');
//sends 2 hidden varibles needed for process_form_users.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$id'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+67
View File
@@ -0,0 +1,67 @@
<?php session_start(); ?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url)
{
if(confirm(message) )
{
location.href = url;
}
}
// --->
</SCRIPT>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/display.php");
include ("../../classes/form.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageCategories");
$f1=new form('manage_categories.php','POST','categories','475',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForCategory</b>",'text','search','','24','375');
$f1->endForm();
$tableheaders=array("$lang->rowID","$lang->categoryName","$lang->updateCategory","$lang->deleteCategory");
$tablefields=array('id','category');
if(isset($_POST['search']))
{
$search=$_POST['search'];
echo "<center>$lang->searchedForCategory: <b>$search</b></center>";
$display->displayManageTable("$cfg_tableprefix",'categories',$tableheaders,$tablefields,'category',"$search",'category');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'categories',$tableheaders,$tablefields,'','','category');
}
$dbf->closeDBlink();
?>
</body>
</html>
+106
View File
@@ -0,0 +1,106 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
//creates 3 objects needed for this script.
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'categories';
$field_names=null;
$field_data=null;
$id=-1;
//checks to see if action is delete and an ID is specified. (only delete uses $_GET.)
if(isset($_GET['action']) and isset($_GET['id']))
{
$action=$_GET['action'];
$id=$_GET['id'];
}
//checks to make sure data is comming from form ($action is either delete or update)
elseif(isset($_POST['category']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables entered by user.
$category = $_POST['category'];
//insure all fields are filled in.
if($category=='')
{
echo "$lang->forgottenFields";
exit();
}
else
{
$field_names=array('category');
$field_data=array("$category");
}
}
else
{
//outputs error message because user did not use form to fill out data.
echo "$lang->mustUseForm";
exit();
}
switch ($action)
{
//finds out what action needs to be taken and preforms it by calling methods from dbf class.
case $action=="insert":
$dbf->insert($field_names,$field_data,$tablename,true);
break;
case $action=="update":
$dbf->update($field_names,$field_data,$tablename,$id,true);
break;
case $action=="delete":
$dbf->deleteRow($tablename,$id);
break;
default:
echo "$lang->noActionSpecified";
break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_categories.php"><?php echo $lang->manageCategories ?>--></a>
<br>
<a href="form_categories.php?action=insert"><?php echo $lang->createCategory ?>--></a>
</body>
</html>
+101
View File
@@ -0,0 +1,101 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/form.php");
include ("../../classes/display.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display= new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$item_id_value='';
$percent_off_value='';
$comment_value='';
$id=-1;
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateDiscount");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'discounts';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$item_id_value=$row['item_id'];
$percent_off_value=$row['percent_off'];
$comment_value=$row['comment'];
}
}
else
{
$display->displayTitle("$lang->addDiscount");
}
//creates a form object
$f1=new form('process_form_discounts.php','POST','discounts','300',$cfg_theme,$lang);
//creates form parts.
$itemtable = "$cfg_tableprefix".'items';
$item_option_titles=$dbf->getAllElements("$itemtable",'item_name','item_name');
$item_option_titles[0] = $dbf->idToField("$itemtable",'item_name',"$item_id_value");
$item_option_values=$dbf->getAllElements("$itemtable",'id','item_name');
$item_option_values[0] = $item_id_value;
$f1->createSelectField("<b>$lang->itemName:</b>",'item_id',$item_option_values,$item_option_titles,'160');
$f1->createInputField("<b>$lang->percentOff: (%)</b> ",'text','percent_off',"$percent_off_value",'24','150');
$f1->createInputField("$lang->comment: ",'text','comment',"$comment_value",'24','150');
//sends 2 hidden varibles needed for process_form_discounts.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$id'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+67
View File
@@ -0,0 +1,67 @@
<?php session_start(); ?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url)
{
if(confirm(message) )
{
location.href = url;
}
}
// --->
</SCRIPT>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/display.php");
include ("../../classes/form.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageDiscounts");
$f1=new form('manage_discounts.php','POST','discounts','475',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForDiscount</b>",'text','search','','24','375');
$f1->endForm();
$tableheaders=array("$lang->rowID","$lang->itemName","$lang->percentOff","$lang->comment","$lang->updateDiscount","$lang->deleteDiscount");
$tablefields=array('id','item_id','percent_off','comment');
if(isset($_POST['search']))
{
$search=$_POST['search'];
echo "<center>$lang->searchedForDiscount: <b>$search</b></center>";
$display->displayManageTable("$cfg_tableprefix",'discounts',$tableheaders,$tablefields,'percent_off',"$search",'percent_off');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'discounts',$tableheaders,$tablefields,'','','percent_off');
}
$dbf->closeDBlink();
?>
</body>
</html>
+108
View File
@@ -0,0 +1,108 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
//creates 2 objects needed for this script.
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'discounts';
$field_names=null;
$field_data=null;
$id=-1;
//checks to see if action is delete and an ID is specified. (only delete uses $_GET.)
if(isset($_GET['action']) and isset($_GET['id']))
{
$action=$_GET['action'];
$id=$_GET['id'];
}
//checks to make sure data is comming from form ($action is either delete or update)
elseif(isset($_POST['item_id']) and isset($_POST['percent_off']) and isset($_POST['comment']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables entered by user.
$item_id=$_POST['item_id'];
$percent_off=$_POST['percent_off'];
$comment=$_POST['comment'];
//insure all fields are filled in.
if($item_id=='' or $percent_off=='')
{
echo "$lang->forgottenFields";
exit();
}
else
{
$field_names=array('item_id','percent_off','comment');
$field_data=array("$item_id","$percent_off","$comment");
}
}
else
{
//outputs error message because user did not use form to fill out data.
echo "$lang->mustUseForm";
exit();
}
switch ($action)
{
//finds out what action needs to be taken and preforms it by calling methods from dbf class.
case $action=="insert":
$dbf->insert($field_names,$field_data,$tablename,true);
break;
case $action=="update":
$dbf->update($field_names,$field_data,$tablename,$id,true);
break;
case $action=="delete":
$dbf->deleteRow($tablename,$id);
break;
default:
echo "$lang->noActionSpecified";
break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_discounts.php"><?php echo $lang->manageDiscounts ?>--></a>
<br>
<a href="form_discounts.php?action=insert"><?php echo $lang->discountAnItem ?>--></a>
</body>
</html>
+164
View File
@@ -0,0 +1,164 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../settings.php");
include ("../language/$cfg_language");
include ("../classes/db_functions.php");
include ("../classes/security_functions.php");
include ("../classes/form.php");
include ("../classes/display.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$brandtable=$cfg_tableprefix.'brands';
$categorytable=$cfg_tableprefix.'categories';
$suppliertable=$cfg_tableprefix.'suppliers';
$tb1=mysql_query("SELECT id FROM $brandtable",$dbf->conn);
$tb2=mysql_query("SELECT id FROM $categorytable",$dbf->conn);
$tb3=mysql_query("SELECT id FROM $suppliertable",$dbf->conn);
if(mysql_num_rows($tb1)==0 or mysql_num_rows($tb2)==0 or mysql_num_rows($tb3)==0)
{
echo "$lang->brandsCategoriesSupplierError";
exit();
}
//set default values, these will change if $action==update.
$item_name_value='';
$description_value='';
$item_number_value='';
$brand_id_value='';
$category_id_value='';
$supplier_id_value='';
$buy_price_value='';
$unit_price_value='';
$supplier_catalogue_number_value='';
$tax_percent_value="$cfg_default_tax_rate";
$total_cost_value='';
$quantity_value='';
$reorder_level_value='';
$id='unknown';
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateItem");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'items';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$item_name_value=$row['item_name'];
$item_number_value=$row['item_number'];
$description_value=$row['description'];
$brand_id_value=$row['brand_id'];
$category_id_value=$row['category_id'];
$supplier_id_value=$row['supplier_id'];
$buy_price_value=$row['buy_price'];
$unit_price_value=$row['unit_price'];
$supplier_catalogue_number_value=$row['supplier_catalogue_number'];
$tax_percent_value=$row['tax_percent'];
$total_cost_value=$row['total_cost'];
$quantity_value=$row['quantity'];
$reorder_level_value=$row['reorder_level'];
$id=$row['id'];
}
}
else
{
$display->displayTitle("$lang->addItem");
}
//creates a form object
$f1=new form('process_form_items.php','POST','items','400',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("<b>$lang->itemName:</b> ",'text','item_name',"$item_name_value",'24','160');
$f1->createInputField("$lang->description: ",'text','description',"$description_value",'24','160');
$f1->createInputField("$lang->itemNumber: ",'text','item_number',"$item_number_value",'24','160');
$brandtable = "$cfg_tableprefix".'brands';
$brand_option_titles=$dbf->getAllElements("$brandtable",'brand','brand');
$brand_option_titles[0] = $dbf->idToField("$brandtable",'brand',"$brand_id_value");
$brand_option_values=$dbf->getAllElements("$brandtable",'id','brand');
$brand_option_values[0] = $brand_id_value;
$f1->createSelectField("<b>$lang->brand:</b>",'brand_id',$brand_option_values,$brand_option_titles,'160');
$categorytable = "$cfg_tableprefix".'categories';
$category_option_titles=$dbf->getAllElements("$categorytable",'category','category');
$category_option_titles[0] = $dbf->idToField("$categorytable",'category',"$category_id_value");
$category_option_values=$dbf->getAllElements("$categorytable",'id','category');
$category_option_values[0] = $category_id_value;
$f1->createSelectField("<b>$lang->category:</b>",'category_id',$category_option_values,$category_option_titles,'160');
$suppliertable = "$cfg_tableprefix".'suppliers';
$supplier_option_titles=$dbf->getAllElements("$suppliertable",'supplier','supplier');
$supplier_option_titles[0] = $dbf->idToField("$suppliertable",'supplier',"$supplier_id_value");
$supplier_option_values=$dbf->getAllElements("$suppliertable",'id','supplier');
$supplier_option_values[0] = $supplier_id_value;
$f1->createSelectField("<b>$lang->supplier:</b>",'supplier_id',$supplier_option_values,$supplier_option_titles,'160');
$f1->createInputField("<b>$lang->buyingPrice:</b>",'text','buy_price',"$buy_price_value",'10','160');
$f1->createInputField("<b>$lang->sellingPrice ($lang->wo $lang->tax):</b>",'text','unit_price',"$unit_price_value",'10','160');
$f1->createInputField("<b>$lang->tax (%):</b> ",'text','tax_percent',"$tax_percent_value",'4','160');
$f1->createInputField("$lang->supplierCatalogue: ",'text','supplier_catalogue_number',"$supplier_catalogue_number_value",'24','160');
$f1->createInputField("<b>$lang->quantityStock:</b> ",'text','quantity',"$quantity_value",'3','160');
$f1->createInputField("<b>$lang->reorderLevel:</b> ",'text','reorder_level',"$reorder_level_value",'3','160');
//sends 2 hidden varibles needed for process_form_users.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$id'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+58
View File
@@ -0,0 +1,58 @@
<?php session_start();
include ("../settings.php");
include("../language/$cfg_language");
include ("../classes/db_functions.php");
include ("../classes/security_functions.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
echo "
<html>
<body>
<table border=\"0\" width=\"500\">
<tr>
<td><img border=\"0\" src=\"../images/items.gif\" width=\"32\" height=\"33\" valign='top'><font color='#005B7F' size='4'>&nbsp;<b>$lang->items</b></font><br>
<br>
<font face=\"Verdana\" size=\"2\">$lang->itemsWelcomeScreen</font>
<ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"form_items.php?action=insert\">$lang->createNewItem</a></font></li>
<ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"discounts/form_discounts.php?action=insert\">$lang->discountAnItem</a></font></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"discounts/manage_discounts.php\">$lang->manageDiscounts</a></font></li>
</ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"manage_items.php\">$lang->manageItems</a></font></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"items_barcode.php\">$lang->itemsBarcode</a></font></li>
</ul>
<ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"brands/form_brands.php?action=insert\">$lang->createBrand</a></font></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"brands/manage_brands.php\">$lang->manageBrands</a></font></li>
</ul>
<ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"categories/form_categories.php?action=insert\">$lang->createCategory</a></font></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"categories/manage_categories.php\">$lang->manageCategories</a></font></li>
</ul>
<ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"suppliers/form_suppliers.php?action=insert\">$lang->createSupplier</a></font></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"suppliers/manage_suppliers.php\">$lang->manageSuppliers</a></font></li>
</ul>
<p>&nbsp;</td>
</tr>
</table>
</body>
</html>";
$dbf->closeDBlink();
?>
+59
View File
@@ -0,0 +1,59 @@
<?php session_start();
include ("../settings.php");
include ("../language/$cfg_language");
include ("../classes/db_functions.php");
include ("../classes/display.php");
include ("../classes/security_functions.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(isset($_GET['generateWith']))
{
$generateWith=$_GET['generateWith'];
}
else
{
$generateWith='id';
}
$display->displayTitle("$lang->itemsBarcode"." ($generateWith)");
echo "<a href='items_barcode.php?generateWith=item_number'>$lang->itemNumber</a> / <a href='items_barcode.php?generateWith=id'>id</a>";
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$items_table=$cfg_tableprefix.'items';
$result=mysql_query("SELECT * FROM $items_table ORDER by item_name",$dbf->conn);
echo '<table border=0 width=85% align=center cellspacing=5 cellpadding=12>
<tr>';
$counter=0;
while($row=mysql_fetch_assoc($result))
{
if($counter%2==0)
{
echo '</tr><tr>';
}
echo "<td align='center'><img src='../classes/barcode.php?barcode=$row[$generateWith]&width=256&text=*$row[item_name]*'></td>";
$counter++;
}
echo '</tr></table>';
$dbf->closeDBlink();
?>
+87
View File
@@ -0,0 +1,87 @@
<?php session_start(); ?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url)
{
if(confirm(message) )
{
location.href = url;
}
}
// --->
</SCRIPT>
</head>
<body>
<?php
include ("../settings.php");
include ("../language/$cfg_language");
include ("../classes/db_functions.php");
include ("../classes/security_functions.php");
include ("../classes/display.php");
include ("../classes/form.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageItems");
$f1=new form('manage_items.php','POST','items','400',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForItemBy</b>",'text','search','','24','150');
$option_values2=array('item_name','item_number','id','quantity','supplier_catalogue_number');
$option_titles2=array("$lang->itemName","$lang->itemNumber",'ID',"$lang->quantityStock","$lang->supplierCatalogue");
$f1->createSelectField("<b>$lang->searchBy</b>",'searching_by',$option_values2,$option_titles2,100);
$f1->endForm();
echo "<a href='manage_items.php?outofstock=go'>$lang->showOutOfStock</a><br>";
echo "<a href='manage_items.php?reorder=go'>$lang->showReorder</a>";
$tableheaders=array("$lang->rowID","$lang->itemName","$lang->itemNumber","$lang->description","$lang->brand","$lang->category","$lang->supplier","$lang->buyingPrice","$lang->sellingPrice","$lang->tax $lang->percent","$lang->finalSellingPricePerUnit","$lang->quantityStock","$lang->reorderLevel","$lang->supplierCatalogue","$lang->updateItem","$lang->deleteItem");
$tablefields=array('id','item_name','item_number','description','brand_id','category_id','supplier_id','buy_price','unit_price','tax_percent','total_cost','quantity','reorder_level','supplier_catalogue_number');
if(isset($_POST['search']))
{
$search=$_POST['search'];
$searching_by =$_POST['searching_by'];
echo "<center>$lang->searchedForItem: <b>$search</b> $lang->searchBy <b>$searching_by</b></center>";
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,"$searching_by","$search",'id');
}
elseif(isset($_GET['outofstock']))
{
echo "<center>$lang->outOfStock</b></center>";
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,'quantity',"outofstock",'id');
}
elseif(isset($_GET['reorder']))
{
echo "<center>$lang->reorder</b></center>";
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,'quantity',"reorder",'id');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'items',$tableheaders,$tablefields,'','','id');
}
$dbf->closeDBlink();
?>
</body>
</html>
+124
View File
@@ -0,0 +1,124 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../settings.php");
include ("../language/$cfg_language");
include ("../classes/db_functions.php");
include ("../classes/security_functions.php");
//creates 3 objects needed for this script.
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'items';
$field_names=null;
$field_data=null;
$id=-1;
//checks to see if action is delete and an ID is specified. (only delete uses $_GET.)
if(isset($_GET['action']) and isset($_GET['id']))
{
$action=$_GET['action'];
$id=$_GET['id'];
}
//checks to make sure data is comming from form ($action is either delete or update)
elseif(isset($_POST['item_name']) and isset($_POST['description']) and isset($_POST['item_number']) and isset($_POST['brand_id'])
and isset($_POST['category_id']) and isset($_POST['supplier_id']) and isset($_POST['buy_price']) and isset($_POST['unit_price']) and isset($_POST['tax_percent'])
and isset($_POST['supplier_catalogue_number']) and isset($_POST['quantity']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables entered by user.
$item_name = $_POST['item_name'];
$description = $_POST['description'];
$item_number = $_POST['item_number'];
$brand_id = $_POST['brand_id'];
$category_id = $_POST['category_id'];
$supplier_id = $_POST['supplier_id'];
$buy_price = number_format($_POST['buy_price'],2,'.', '');
$unit_price = number_format($_POST['unit_price'],2,'.', '');
$tax_percent = $_POST['tax_percent'];
$supplier_catalogue_number = $_POST['supplier_catalogue_number'];
$quantity = $_POST['quantity'];
$reorder_level= $_POST['reorder_level'];
//insure all fields are filled in.
if($item_name=='' or $brand_id=='' or $category_id=='' or $supplier_id=='' or $buy_price=='' or $unit_price=='' or $tax_percent=='' or $quantity=='' or $reorder_level=='' )
{
echo "$lang->forgottenFields";
exit();
}
elseif( (!is_numeric($buy_price)) or (!is_numeric($unit_price)) or (!is_numeric($tax_percent)) or (!is_numeric($quantity)) or (!is_numeric($reorder_level)))
{
echo "$lang->mustEnterNumeric";
exit();
}
else
{
$total_cost = number_format($unit_price*(1+($tax_percent/100)),2,'.', '');
$field_names=array('item_name','description','item_number','brand_id','category_id','supplier_id','buy_price','unit_price','tax_percent','supplier_catalogue_number','total_cost','quantity','reorder_level');
$field_data=array("$item_name","$description","$item_number","$brand_id","$category_id","$supplier_id","$buy_price","$unit_price","$tax_percent","$supplier_catalogue_number","$total_cost","$quantity","$reorder_level");
}
}
else
{
//outputs error message because user did not use form to fill out data.
echo "$lang->mustUseForm";
exit();
}
switch ($action)
{
//finds out what action needs to be taken and preforms it by calling methods from dbf class.
case $action=="insert":
$dbf->insert($field_names,$field_data,$tablename,true);
break;
case $action=="update":
$dbf->update($field_names,$field_data,$tablename,$id,true);
break;
case $action=="delete":
$dbf->deleteRow($tablename,$id);
break;
default:
echo "lang->noActionSpecified";
break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_items.php"><?php echo $lang->manageItems ?>--></a>
<br>
<a href="form_items.php?action=insert"><?php echo $lang->createNewItem ?>--></a>
</body>
</html>
+100
View File
@@ -0,0 +1,100 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/form.php");
include ("../../classes/display.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
$display= new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
//set default values, these will change if $action==update.
$supplier_value='';
$address_value='';
$phone_number_value='';
$contact_value='';
$email_value='';
$other_value='';
$id=-1;
//decides if the form will be used to update or add a user.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="insert";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
$display->displayTitle("$lang->updateSupplier");
if(isset($_GET['id']))
{
$id=$_GET['id'];
$tablename = "$cfg_tableprefix".'suppliers';
$result = mysql_query("SELECT * FROM $tablename WHERE id=\"$id\"",$dbf->conn);
$row = mysql_fetch_assoc($result);
$supplier_value=$row['supplier'];
$address_value=$row['address'];
$phone_number_value=$row['phone_number'];
$contact_value=$row['contact'];
$email_value=$row['email'];
$other_value=$row['other'];
}
}
else
{
$display->displayTitle("$lang->addSupplier");
}
//creates a form object
$f1=new form('process_form_suppliers.php','POST','suppliers','300',$cfg_theme,$lang);
//creates form parts.
$f1->createInputField("<b>$lang->supplierName:</b>",'text','supplier',"$supplier_value",'24','150');
$f1->createInputField("<b>$lang->address:</b>",'text','address',"$address_value",'24','150');
$f1->createInputField("<b>$lang->phoneNumber:</b>",'text','phone_number',"$phone_number_value",'24','150');
$f1->createInputField("<b>$lang->contact:</b>",'text','contact',"$contact_value",'24','150');
$f1->createInputField("$lang->email: ",'text','email',"$email_value",'24','150');
$f1->createInputField("$lang->other: ",'text','other',"$other_value",'24','150');
//sends 2 hidden varibles needed for process_form_suppliers.php.
echo "
<input type='hidden' name='action' value='$action'>
<input type='hidden' name='id' value='$id'>";
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+67
View File
@@ -0,0 +1,67 @@
<?php session_start(); ?>
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url)
{
if(confirm(message) )
{
location.href = url;
}
}
// --->
</SCRIPT>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
include ("../../classes/display.php");
include ("../../classes/form.php");
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("$lang->manageSuppliers");
$f1=new form('manage_suppliers.php','POST','suppliers','475',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForSupplier</b>",'text','search','','24','375');
$f1->endForm();
$tableheaders=array("$lang->rowID","$lang->supplierName","$lang->address","$lang->phoneNumber","$lang->contact","$lang->email","$lang->other","$lang->updateSupplier","$lang->deleteSupplier");
$tablefields=array('id','supplier','address','phone_number','contact','email','other');
if(isset($_POST['search']))
{
$search=$_POST['search'];
echo "<center>$lang->searchedForSupplier: <b>$search</b></center>";
$display->displayManageTable("$cfg_tableprefix",'suppliers',$tableheaders,$tablefields,'supplier',"$search",'supplier');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'suppliers',$tableheaders,$tablefields,'','','supplier');
}
$dbf->closeDBlink();
?>
</body>
</html>
+111
View File
@@ -0,0 +1,111 @@
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<?php
include ("../../settings.php");
include ("../../language/$cfg_language");
include ("../../classes/db_functions.php");
include ("../../classes/security_functions.php");
//creates 2 objects needed for this script.
$lang=new language();
$dbf=new db_functions($cfg_server,$cfg_username,$cfg_password,$cfg_database,$cfg_tableprefix,$cfg_theme,$lang);
$sec=new security_functions($dbf,'Admin',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'suppliers';
$field_names=null;
$field_data=null;
$id=-1;
//checks to see if action is delete and an ID is specified. (only delete uses $_GET.)
if(isset($_GET['action']) and isset($_GET['id']))
{
$action=$_GET['action'];
$id=$_GET['id'];
}
//checks to make sure data is comming from form ($action is either delete or update)
elseif(isset($_POST['supplier']) and isset($_POST['address']) and isset($_POST['phone_number']) and isset($_POST['contact']) and isset($_POST['email']) and isset($_POST['other']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables entered by user.
$supplier = $_POST['supplier'];
$address = $_POST['address'];
$phone_number=$_POST['phone_number'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$other = $_POST['other'];
//insure all fields are filled in.
if($supplier=='' or $address=='' or $phone_number=='' or $contact==='')
{
echo "$lang->forgottenFields";
exit();
}
else
{
$field_names=array('supplier','address','phone_number','contact','email','other');
$field_data=array("$supplier","$address","$phone_number","$contact","$email","$other");
}
}
else
{
//outputs error message because user did not use form to fill out data.
echo "$lang->mustUseForm";
exit();
}
switch ($action)
{
//finds out what action needs to be taken and preforms it by calling methods from dbf class.
case $action=="insert":
$dbf->insert($field_names,$field_data,$tablename,true);
break;
case $action=="update":
$dbf->update($field_names,$field_data,$tablename,$id,true);
break;
case $action=="delete":
$dbf->deleteRow($tablename,$id);
break;
default:
echo "$lang->noActionSpecified";
break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_suppliers.php"><?php echo $lang->manageSuppliers ?>--></a>
<br>
<a href="form_suppliers.php?action=insert"><?php echo $lang->createSupplier ?>--></a>
</body>
</html>