mirror of
https://github.com/fspc/biketree.git
synced 2026-09-16 14:31:36 -04:00
First commit of biketree to github!
This commit is contained in:
Executable
+59
@@ -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();
|
||||
|
||||
?>
|
||||
Executable
+162
@@ -0,0 +1,162 @@
|
||||
<?php session_start(); ?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
|
||||
include ("../settings.php");
|
||||
include ("../classes/db_functions.php");
|
||||
include("../language/$cfg_language");
|
||||
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.
|
||||
$userID='';
|
||||
$loanID='';
|
||||
$deposittaken='';
|
||||
$loandate='';
|
||||
$returndate='';
|
||||
$notes='';
|
||||
$latefeespaid='';
|
||||
$paid='';
|
||||
$id=-1;
|
||||
|
||||
|
||||
//echo "post is $_POST[bikeID]and id is $id";
|
||||
//Destroy the world if they didn't put a valid bike number in. Then apologize.
|
||||
$bikecheck = mysql_query("SELECT * FROM bikes WHERE id='$_POST[bikeID]' LIMIT 1",$dbf->conn);
|
||||
echo mysql_error();
|
||||
$bikeexists = mysql_fetch_array($bikecheck);
|
||||
$back = "<br /><br /><a href=\"index.php\">[Go Baaaaaack]</a>";
|
||||
if($bikeexists['id'] == ""){ echo "<br />Bike Doesn't exist. Divide by zero. Did you put a bike number in the box? If you <b>did</b> put a number in, go back and try typing it again.$back"; die(); }
|
||||
if($bikeexists['bikestatus'] == "repair"){ echo "<br />This is <b>a personal bike in for repair!</b> Take it from them and make a note! $back"; die(); }
|
||||
if($bikeexists['bikestatus'] != "library"){ echo "<br />This is not a library bike. It is marked as <b>$bikeexists[bikestatus]</b>. Take it from them and tell the IT working group $back"; die(); }
|
||||
if($bikeexists['putinservice'] == "" || $bikeexists['putinservice'] == "0000-00-00"){ echo "<br />This bike has not yet been put in service! DO NOT LOAN. Merci! $back"; die(); }
|
||||
if($bikeexists['inrepair'] != "" && $bikeexists['inrepair'] != "0000-00-00"){ echo "<br />This bike is in repair. DO NOT LOAN. Merci! $back"; die(); }
|
||||
if($bikeexists['retired'] != "" && $bikeexists['retired'] != "0000-00-00"){ echo "<br />This bike has been retired from the library. Do not loan. $back"; die(); }
|
||||
|
||||
|
||||
//Check if bike is in or out
|
||||
$inoutquery = mysql_query("SELECT * FROM libraryloans WHERE bikeID='$_POST[bikeID]' AND bikeout=1",$dbf->conn);
|
||||
$loanarray = mysql_fetch_array($inoutquery);
|
||||
|
||||
//decides if the form will be used to sign in or add a loan.
|
||||
if($loanarray['id'] != "")
|
||||
{
|
||||
$action="update";
|
||||
// print_r($loanarray);
|
||||
}
|
||||
else
|
||||
{
|
||||
$action="insert";
|
||||
}
|
||||
|
||||
//if action is update, sets variables to what the current loan data is.
|
||||
if($action=="update")
|
||||
{
|
||||
$display->displayTitle("Bike is OUT. Sign it in");
|
||||
|
||||
if(isset($_POST['bikeID']))
|
||||
{
|
||||
// echo "Now it's all: $_POST[bikeID]";
|
||||
$bikeID=$_POST['bikeID'];
|
||||
$tablename = "$cfg_tableprefix".'libraryloans';
|
||||
$result = mysql_query("SELECT *, UNIX_TIMESTAMP(duedate)as latedate FROM $tablename WHERE bikeID=\"$bikeID\" AND bikeout=1",$dbf->conn);
|
||||
|
||||
$row = mysql_fetch_assoc($result);
|
||||
$userID=$row['userID'];
|
||||
$loanID=$row['id'];
|
||||
$deposittaken=$row['deposittaken'];
|
||||
$loandate=$row['loandate'];
|
||||
$duedate=$row['duedate'];
|
||||
$returndate=$row['returndate'];
|
||||
$notes=$row['notes'];
|
||||
$latefees=$row['latefees'];
|
||||
$latedate=$row['latedate'];
|
||||
|
||||
$today = date('U');
|
||||
if($today > $latedate){
|
||||
$todayowing = round((($today-$latedate)/60/60/24)-1, 0) * $cfg_dailyLateFee;
|
||||
echo "<center>There is <b>\$$todayowing.00</b> owing in late fees.</center><br />";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$display->displayTitle("Bike #$_POST[bikeID] is available for loan. Use form below.");
|
||||
}
|
||||
//creates a form object
|
||||
$f1=new form('process_form_library.php','POST','library','450',$cfg_theme,$lang);
|
||||
|
||||
// Get User ID's and names for the select creation
|
||||
//sidenote: if user has bike, grab user number and add SELECTED to their entry in the select (last 3 lines)
|
||||
$fnamearray = array();
|
||||
$lnamearray = array();
|
||||
$userIDarray = array();
|
||||
$usrquery = mysql_query("SELECT first_name, last_name, id FROM customers ORDER BY last_name ASC");
|
||||
while ($row = mysql_fetch_assoc($usrquery))
|
||||
{
|
||||
$namearray[] = $row['last_name'] .',' . $row['first_name'];
|
||||
$idstring = $row['id'];
|
||||
if($userID == $row['id']){
|
||||
$idstring .= "SELECTED"; }
|
||||
$userIDarray[] = $idstring;
|
||||
}
|
||||
|
||||
if($action == "update"){ $disabled="disabled"; }
|
||||
|
||||
|
||||
|
||||
//creates form parts.
|
||||
$f1->createSelectField("<b>Member: </b>",'userID',$userIDarray,$namearray,'170',"$disabled");
|
||||
$f1->createInputField("<b>Deposit Taken:</b> $",'text','deposittaken',"$deposittaken",'24','170',"$disabled");
|
||||
if ($action == "update"){ $f1->createInputField("Due Date (YYYY-MM-DD): ",'text','<b>duedate</b>',"$duedate",'24','170',"$disabled"); }
|
||||
if ($action == "insert"){ $f1->createSingleDateSelectField("<b>Due Date</b>"); }
|
||||
$f1->createCheckboxField("<b>Paying fees now?</b>","feespaid",'170');
|
||||
//$f1->createInputField("<i>Late Fees Paid: $</i> ",'text','amtpaid',"",'24','170');
|
||||
$f1->createTextareaField("Notes about this loan:",'notes','5','24',"$notes",'170');
|
||||
|
||||
//sends many hidden varibles needed for process_form_library.php.
|
||||
echo "
|
||||
<input type='hidden' name='action' value='$action'>
|
||||
<input type='hidden' name='action' value='$action'>
|
||||
<input type='hidden' name='id' value='$loanID'>
|
||||
<input type='hidden' name='bikeID' value='$_POST[bikeID]'>";
|
||||
if($action == "update"){
|
||||
echo "<input type='hidden' name='userID' value='$userID'>";
|
||||
echo "<input type='hidden' name='duedate' value='$duedate'>";
|
||||
echo "<input type='hidden' name='deposittaken' value='$deposittaken'>";
|
||||
echo "<input type='hidden' name='todayowing' value='$todayowing'>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
$f1->endLibraryForm();
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
<?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'> <b>Bike Library</b></font><br>
|
||||
<br>
|
||||
<form name=booking enctype=\"multipart/form-data\" method=\"POST\" action=\"form_library.php\">
|
||||
<font face=\"Verdana\" size=\"2\">Sign in/out - Bike Number:</font>
|
||||
<input type=\"text\" name=\"bikeID\" size=\"10\" value=\"$_GET[passbike]\">
|
||||
<input type=\"submit\" name=\"submit\" value=\"Ok Go!\">
|
||||
</form>
|
||||
To modify a library bike, please use the <a href=\"../bikes/index.php\"> <b>bikes</b></a> panel.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
$dbf->closeDBlink();
|
||||
|
||||
|
||||
?>
|
||||
Executable
+74
@@ -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>
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
<?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".'libraryloans';
|
||||
$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['userID']) and isset($_POST['deposittaken']) and isset($_POST['notes']) )
|
||||
{
|
||||
|
||||
$action = $_POST['action'];
|
||||
$id = $_POST['id'];
|
||||
$bikeID = $_POST['bikeID'];
|
||||
//gets variables entered by user.
|
||||
$userID = $_POST['userID'];
|
||||
$deposittaken = $_POST['deposittaken'];
|
||||
$duedate = "$_POST[year]-$_POST[month]-$_POST[day]";
|
||||
$paid = $_POST['feespaid'];
|
||||
$notes = $_POST['notes'];
|
||||
$todayowing = $_POST['todayowing'];
|
||||
$today = date('Y-m-d');
|
||||
//insure all fields are filled in.
|
||||
if($userID=='' or $deposittaken=='' or $duedate=='')
|
||||
{
|
||||
echo "$userID AND $deposittaken AND $duedate $lang->forgottenFields";
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($action == "insert"){
|
||||
$field_names=array('userID','bikeID','bikeout','deposittaken','loandate','duedate','notes');
|
||||
$field_data=array("$userID","$bikeID","1","$deposittaken","$today","$duedate","$notes");
|
||||
}
|
||||
if($action == "update")
|
||||
{
|
||||
if($paid == "on"){ $feesowing = 0; }
|
||||
$field_names=array('bikeout','returndate','notes','latefees');
|
||||
$field_data=array("0","$today","$notes","$feesowing");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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="index.php">Back to Bike Library--></a>
|
||||
<br>
|
||||
<a href="../home.php">Go Home--></a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user