-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcheckout_printEB.php
executable file
·142 lines (117 loc) · 4.36 KB
/
checkout_printEB.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php require_once('config.php'); ?>
<html>
<body>
<?php
$colname_Recordset1 = "1";
if (isset($HTTP_GET_VARS['EquipID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['EquipID'] : addslashes($HTTP_GET_VARS['EquipID']);
}
mysql_select_db($database_equip, $equip);
$query_Recordset1 = sprintf("SELECT * FROM equip WHERE ID = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $equip) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$ServerEquipID = $HTTP_GET_VARS['EquipID'];
$colname_Recordset2 = "1";
if (isset($HTTP_GET_VARS['EquipID'])) {
$colname_Recordset2 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['EquipID'] : addslashes($HTTP_GET_VARS['EquipID']);
}
mysql_select_db($database_equip, $equip);
$query_Recordset2 = sprintf("SELECT * FROM equipment_accessory INNER JOIN accessory_type ON accessory_type.ID = equipment_accessory.Accessory_TypeID WHERE EquipmentID = $ServerEquipID;");
$Recordset2 = mysql_query($query_Recordset2, $equip) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$colname_Recordset3 = "1";
if (isset($HTTP_GET_VARS['StudentID'])) {
$colname_Recordset3 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['StudentID'] : addslashes($HTTP_GET_VARS['StudentID']);
}
mysql_select_db($database_equip, $equip);
$query_Recordset3 = sprintf("SELECT * FROM students WHERE ID = %s", $colname_Recordset3);
$Recordset3 = mysql_query($query_Recordset3, $equip) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
?>
<strong><?php echo $row_Recordset3['FirstName']; ?> <?php echo $row_Recordset3['LastName']; ?> (Code # <?php echo $row_Recordset3['ID']; ?></strong>) is
checking out a <strong><?php echo $row_Recordset1['Name']; ?></strong><br>
Checked Out:<strong> <?php $ServerCheckHours = $row_Recordset1['CheckHours']; ?>
<?
// NEED TO ADD MORE DATE LOGIC TO SKIP WEEKENDS
echo date("D, F j, g:i a")
?>
</strong><br>
Due Back:
<strong>
<?php
if (($ServerCheckHours+date('g'))<24) {
$returndate = mktime(date('g')+$ServerCheckHours,date('i'),0,date('n'),date('j'),date('Y'));
} else {
if ( date("D", mktime(date('g'),date('i'),0,date('n'),date('j')+1,date('Y'))) == "Sat") {
$returndate = mktime(date('g'),date('i'),0,date('n'),date('j')+3,date('Y'));
} else {
$returndate = mktime(date('g'),date('i'),0,date('n'),date('j')+1,date('Y'));
}
$Year = date('Y');
$Day = (date('j')+1);
if ( date("D", mktime(date('g'),date('i'),0,date('n'),date('j')+1,date('Y'))) == "Sat") {
$Day = (date('j')+3);
}
$Month = date('n');
$Hours = date('g');
if ($Hours< 10) {
$Hours = "0".$Hours;
}
$Minutes = date('i');
if ($Month<10) {
$Month = "0".$Month;
}
$returndateSQL = "$Year-$Month-$Day $Hours:$Minutes:00";
}
//echo "<P>";
//echo "SQL Formatted Date = $returndateSQL";
//echo "<P>";
echo date("D, F j, g:i", $returndate); ?>
</strong><br>
Fine Per Day: $1.00<br>
<?php //echo $row_Recordset1['ID']; ?>
<br>
<table width="40%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> Item: <?php echo $row_Recordset1['ID']; ?>- <?php echo $row_Recordset1['Name']; ?></td>
</tr>
<tr>
<td><div align="center"><IMG SRC="<?php echo $row_Recordset1['Image']; ?>"><br>
</div></td>
</tr>
<tr>
<td>Serial Number: <?php echo $row_Recordset1['SerialNumber']; ?><br></td>
</tr>
<tr>
<td>Model Number: <?php echo $row_Recordset1['ModelNumber']; ?><br></td>
</tr>
</table>
<br>
<HR>
<u><strong>Be sure these accessories are included:</strong></u> <br>
(LAB AIDS: Check off all accessories in bags. If accessories is not in the bag
do
not
check
off.)
<form action="checkoutactionEB.php" method="get">
<input type="hidden" name="EquipID" value="<? echo $HTTP_GET_VARS['EquipID'] ?>">
<input type="hidden" name="StudentID" value="<? echo $HTTP_GET_VARS['StudentID'] ?>">
<input type="hidden" name="ReturnDate" value="<? echo $returndateSQL ?>">
<?php do { ?>
<p>
<input name="Accessory_TypeID[]" type="checkbox" value="<?php echo $row_Recordset2['Accessory_TypeID']; ?>">
<?php echo $row_Recordset2['Name']; ?><br>
</p>
<?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
</form>
</html>
</body>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
mysql_free_result($Recordset3);
?>