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
+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,'Sales Clerk',$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->customersBarcode"." ($generateWith)");
echo "<a href='customers_barcode.php?generateWith=account_number'>$lang->accountNumber</a> / <a href='customers_barcode.php?generateWith=id'>id</a>";
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$customers_table=$cfg_tableprefix.'customers';
$result=mysql_query("SELECT * FROM $customers_table ORDER by last_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=227&text=*$row[last_name], $row[first_name]*'></td>";
$counter++;
}
echo '</tr></table>';
$dbf->closeDBlink();
?>
+169
View File
@@ -0,0 +1,169 @@
<?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,'Sales Clerk',$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.
$bikebrand_value='';
$bikemodel_value='';
$bikecolor_value='';
$biketype_number_value='';
$wheel_value='';
$frame_value='';
$bikestatus_value="$_GET[mode]";
$putinservice_value='';
$inrepair_value='';
$retired_value='';
$sold_value='';
$notes_value='';
$id=-1;
//decides if the form will be used to update or add a bike.
if(isset($_GET['action']))
{
$action=$_GET['action'];
}
else
{
$action="update";
}
//if action is update, sets variables to what the current users data is.
if($action=="update")
{
if (!$_POST[id] && !$_GET[passbike]){ echo "Oops. Try again. Maybe with a valid bike number this time"; die(); }
$display->displayTitle("Update a $_POST[mode] Bike");
if(isset($_POST['id']) || isset($_GET['passbike']))
{
$id=$_POST['id'];
if($id == ""){
$id=$_GET[passbike];
}
$tablename = "$cfg_tableprefix".'bikes';
$queree = "SELECT * FROM $tablename WHERE id=$id";
$result = mysql_query("$queree",$dbf->conn);
$row = mysql_fetch_assoc($result);
$bikebrand_value=$row['bikebrand'];
$bikemodel_value=$row['bikemodel'];
$bikecolor_value=$row['bikecolor'];
$biketype_value=$row['biketype'];
if ($biketype_value == ""){ echo "Oops, one of the fly rod's has gone out askew on the treddle. Try again. Maybe with a valid bike number this time"; die(); }
$wheel_value=$row['wheel'];
$frame_value=$row['frame'];
$bikestatus_value=$row['bikestatus'];
$putinservice_value=$row['putinservice'];
$inrepair_value=$row['inrepair'];
if($putinservice_value != "0000-00-00" && $bikestatus_value == "repair"){ echo "This fuckin bike was a repair and has already been returned to the owner."; die();}
if ($inrepair_value != '' && $inrepair_value != '0000-00-00' && $bikestatus_value == "library"){ echo "<center><h4 style=\"background: #000000; color: #FFFFFF; display: inline;\">This library bike is in for repair!</h4><center><br />"; }
$userID_value=$row['userID'];
$retired_value=$row['retired'];
if($retired_value != "0000-00-00" && $retired_value != ""){ die('This bike has been retired and probably stripped down');}
$sold_value=$row['sold'];
$notes_value=$row['notes'];
}
}
else
{
$display->displayTitle("Add a $bikestatus_value Bike");
}
//creates a form object
$f1=new form('process_form_bikes.php','POST','bikes','450',$cfg_theme,$lang);
//creates form parts.
//Get user List first
$idarray = array();
$namearray = array();
$result = mysql_query("SELECT id,first_name,last_name FROM customers ORDER BY last_name ASC");
while($field = mysql_fetch_array($result)) {
$namearray[] = "$field[last_name], $field[first_name]";
$idarray[] = "$field[id]";
}
if($_POST[id]){ $disable = "DISABLED"; }
if ($_GET[mode] == "repair" || isset($userID_value) && $userID_value != 0){ $f1->createSelectField("<b>Which Member?</b>",'userID',$idarray,$namearray,'150',"$disable","$userID_value"); }
$f1->createInputField("<b>Brand:</b> ",'text','bikebrand',"$bikebrand_value",'24','150');
$f1->createInputField("<b>Model:</b> ",'text','bikemodel',"$bikemodel_value",'24','150');
$f1->createInputField("<b>Color:</b> ",'text','bikecolor',"$bikecolor_value",'24','150');
//make the bike type arrays
$option_values = array('newroad','10spd','8spdinternal','5spd','3spd','singlespeedcoaster','singlespeed','fixedgear','mountain','hybrid','chopper');
$option_titles = array('road bike (12-27speed)','10 speed road bike','8 speed internal hub','5 speed road bike','3 speed internal hub','single speed w/coaster brake','single speed w/brakes','fixed gear','mountain bike','hybrid (road/mountain)','chopper');
$f1->createSelectField("<b>Bike Type</b>",'biketype',$option_values,$option_titles,'150','NULL',"$biketype_value");
//make the wheel size array
$option_values = array('20inch','22inch','24inch','26inch','26fractional','27inch','','','650','700');
$option_titles = array('20 inch','22 inch','24 inch','26 inch','26 by fraction','27 inch','','----Metric Crap----','650','700c');
$f1->createSelectField("<b>Wheel Size</b>",'wheel',$option_values,$option_titles,'150','NULL',"$wheel_value");
$f1->createInputField("<b>Frame Height (inches)</b>: ",'text','frame',"$frame_value",'4','150');
//select bikeStatus here
//make the bike status array and form field
$option_values = array('library','sale','repair');
$option_titles = array('Library bike','For sale bike','Member bike in for repair');
if($action == "insert"){ $statdisable = "DISABLED"; }
$f1->createSelectField("<b>Bike Status</b>",'bikestatus',$option_values,$option_titles,'150',"$statdisable","$bikestatus_value");
if ($_GET[mode] == "repair"){ $f1->createSingleDateSelectField("To be picked up on:"); }
// major changes to library bike
if($inrepair_value != "" && $inrepair_value != "0000-00-00"){ $repairtext = "Mark library bike as fixed"; $repairvalue = "makeoutrepair"; }
else { $repairtext = "Mark as broken library bike"; $repairvalue = "makeinrepair";}
$option_values = array("$repairvalue",'makeretire');
$option_titles = array("$repairtext",'Retire this bike from library');
if($bikestatus_value=="library" && $action=="update"){ $f1->createRadioField("Major Updates",'majorupdates',$option_values,$option_titles,'150','',"$bikestatus_value"); }
$f1->createTextareaField("Repair needed:<br />Accepted by:<br />Other notes:",'notes','6','30',"$notes_value",'150');
if($bikestatus_value == "repair"){
$f1->createCheckboxField("Remember to process payment<br /> in the sales area. ",'repairpickup','150','','','<b>Check if being picked up</b>');
}
//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'>";
if($action == "insert"){ echo "<input type='hidden' name='bikestatus' value='$_GET[mode]'>"; }
$f1->endForm();
$dbf->closeDBlink();
?>
</body>
</html>
+57
View File
@@ -0,0 +1,57 @@
<?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,'Sales Clerk',$lang);
if(!$sec->isLoggedIn()){
header("location: ../login.php");
exit();
}
if(!$sec->isOpen()){
header("location: ../books/openshop.php");
exit();
}
echo "
<html>
<body>
<head>
</head>
<table border=\"0\" width=\"500\">
<tr>
<td><img border=\"0\" src=\"../images/customers.gif\" width=\"41\" height=\"33\" valign='top'><font color='#005B7F' size='4'>&nbsp;<b>Rental Bikes - Sale Bikes - Repair Bikes</b></font><br>
<br>
<font face=\"Verdana\" size=\"2\">Welcome to the Bikes panel! Here you can manage <b>any</b> bikes that are in the shop. What would you like to do?
<br /><br /><b>Add a bike!</b>
<ul>
<li><font face=\"Verdana\" size=\"2\"><a href=\"form_bikes.php?action=insert&mode=repair\">Enter a new member bike in for repair</a></font><br /><br /></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"form_bikes.php?action=insert&mode=library\">Add a new bike to the library</a></font><br /><br /></li>
<li><font face=\"Verdana\" size=\"2\"><a href=\"form_bikes.php?action=insert&mode=sale\">Add a new for-sale completed bike</a></font><br /><br /></li>
</ul></font>
<font face=\"Verdana\" size=\"2\"><b>Update/modify bike info</b><br /></font>
<form name=bikenumber enctype=\"multipart/form-data\" method=\"POST\" action=\"form_bikes.php?action=update\">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=\"Verdana\" size=\"2\">Bike Number:</font>
&nbsp;<input type=\"text\" name=\"id\" size=\"10\">
<input type=\"submit\" name=\"submit\" value=\"Ok Go!\">
</form>
</td>
</tr>
</table>
</body>
</html>";
$dbf->closeDBlink();
?>
+74
View File
@@ -0,0 +1,74 @@
<?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,'Sales Clerk',$lang);
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit();
}
$display=new display($dbf->conn,$cfg_theme,$cfg_currency_symbol,$lang);
$display->displayTitle("Manage Members");
$f1=new form('manage_customers.php','POST','customers','450',$cfg_theme,$lang);
$f1->createInputField("<b>$lang->searchForCustomer</b>",'text','search','','24','150');
$option_values2=array('first_name','last_name','account_number','id');
$option_titles2=array("$lang->firstName","$lang->lastName","$lang->accountNumber",'ID');
$f1->createSelectField("<b>$lang->searchBy</b>",'searching_by',$option_values2,$option_titles2,100);
$f1->endForm();
$tableheaders=array("$lang->rowID","$lang->lastName","$lang->firstName","$lang->phoneNumber","$lang->email","$lang->streetAddress","More Info","Update/Edit Member","Remove Member");
$tablefields=array('id','last_name','first_name','phone_number','email','street_address');
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",'customers',$tableheaders,$tablefields,"$searching_by","$search",'last_name');
}
else
{
$display->displayManageTable("$cfg_tableprefix",'customers',$tableheaders,$tablefields,'','','last_name');
}
$dbf->closeDBlink();
?>
</body>
</html>
+160
View File
@@ -0,0 +1,160 @@
<?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,'Sales Clerk',$lang);
//checks if user is logged in.
if(!$sec->isLoggedIn())
{
header ("location: ../login.php");
exit ();
}
//variables needed globably in this file.
$tablename="$cfg_tableprefix".'bikes';
$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 dateup or update)
elseif(isset($_POST['bikebrand']) and isset($_POST['bikemodel']) and isset($_POST['bikecolor'])
and isset($_POST['biketype']) and isset($_POST['wheel']) and isset($_POST['frame']) and isset($_POST['bikestatus']) and isset($_POST['id']) and isset($_POST['action']) )
{
$action=$_POST['action'];
$id = $_POST['id'];
//gets variables ALWAYS used for everything
$bikebrand=$_POST['bikebrand'];
$bikemodel=$_POST['bikemodel'];
$bikecolor=$_POST['bikecolor'];
$biketype=$_POST['biketype'];
$wheel=$_POST['wheel'];
$frame=$_POST['frame'];
$bikestatus=$_POST['bikestatus'];
//Adding a library bike to be in-service? Make a date for it... today perhaps?
if($action == "insert" && $bikestatus == "library"){ $putinservice=date('Y-m-d'); }
//Making a library bike into an out of service library bike or vice versa? Make it so in the DB...
if($_POST[majorupdates] == "makeinrepair"){ $inrepair = date('Y-m-d'); }
if($_POST[majorupdates] == "makeoutrepair"){ $inrepair = ""; }
//same for retiring a library bike
if($_POST[majorupdates] == "makeretire"){ $retired = date('Y-m-d'); }
//If it's a member repair... same as above
if($bikestatus == "repair" && $action == "insert"){ $inrepair = date('Y-m-d'); $userID=$_POST['userID']; }
if($bikestatus == "repair" && $action == "update" && $_POST[repairpickup] == "on"){ $pickedupdate = date('Y-m-d'); }
$duedate= "$_POST[year]-$_POST[month]-$_POST[day]";
$notes=$_POST['notes'];
// HERE YOU ARE UP TO
//ensure all fields are filled in.
if($bikebrand=='' or $bikemodel=='' or $bikecolor=='' or $frame=='')
{
echo "$lang->forgottenFields";
exit();
}
else if($bikestatus == "library" && $action == "insert")
{
$field_names=array('bikebrand','bikemodel','bikecolor','biketype','wheel','frame','bikestatus','putinservice','inrepair',' retired','notes');
$field_data=array("$bikebrand","$bikemodel","$bikecolor","$biketype","$wheel","$frame","$bikestatus","$putinservice","$inrepair","$retired","$notes");
}
else if($bikestatus == "library" && $action == "update")
{
$field_names=array('bikebrand','bikemodel','bikecolor','biketype','wheel','frame','bikestatus','inrepair',' retired','notes');
$field_data=array("$bikebrand","$bikemodel","$bikecolor","$biketype","$wheel","$frame","$bikestatus","$inrepair","$retired","$notes");
}
else if($bikestatus == "sale")
{
$field_names=array('bikebrand','bikemodel','bikecolor','biketype','wheel','frame','bikestatus','notes');
$field_data=array("$bikebrand","$bikemodel","$bikecolor","$biketype","$wheel","$frame","$bikestatus","$notes");
}
else if($bikestatus == "repair" && $action == "update")
{
$field_names=array('bikebrand','bikemodel','bikecolor','biketype','wheel','frame','bikestatus','notes','putinservice');
$field_data=array("$bikebrand","$bikemodel","$bikecolor","$biketype","$wheel","$frame","$bikestatus","$notes","$pickedupdate");
}
else if($bikestatus == "repair" && $action == "insert")
{
$field_names=array('bikebrand','bikemodel','bikecolor','biketype','wheel','frame','bikestatus','inrepair','userID','duedate','notes');
$field_data=array("$bikebrand","$bikemodel","$bikecolor","$biketype","$wheel","$frame","$bikestatus","$inrepair","$userID","$duedate","$notes");
}
}
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);
$newnumber = mysql_insert_id();
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();
if($action == "insert"){ echo "<center><h2>Important!!!</h2><h2>Tag this bike as BIKE NUMBER $newnumber</h2>"; }
?>
<br />
<a href="index.php">Manage Bikes--></a>
<br>
<a href="/pos/home.php">Go Home--></a></center>
</body>
</html>