Advertisement
tjromano

print_detail

Oct 26th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.51 KB | None | 0 0
  1. <?php
  2. session_cache_limiter();
  3. session_start();
  4.  
  5. $userGroup = $_SESSION['group1'];
  6.  
  7. //include config and functions pages
  8. include ('config.php');
  9. include ('functions.php');
  10.  
  11. //check for administrative rights
  12. if (allow_access('Administrators') != "yes")
  13. {
  14.     include ('no_access.html');
  15.     exit;
  16. }
  17.  
  18. //Get the id from the previous page
  19. $id_routes = $_GET['id_routes'];
  20. //$id_routes = 1;
  21.  
  22. //routes info query
  23. $sql = "SELECT ro.*, dl.dep_name, dl.dep_address, dl.dep_city, dl.dep_state, dl.dep_am, dl.dep_pm, ca.car_num FROM routes ro LEFT JOIN departure_lot dl ON ro.id_dep_lot=dl.id_dep_lot LEFT JOIN cars ca ON ro.id_cars=ca.id_cars
  24. WHERE ro.id_routes=$id_routes";
  25.  
  26. $results = mysql_query($sql) or die(mysql_error());
  27.  
  28. while ($row = mysql_fetch_assoc($results)){
  29.     $rtn = $row['route_num'];
  30.     $dn = $row['dep_name'];
  31.     $da = $row['dep_address'];
  32.     $dc = $row['dep_city'];
  33.     $ds = $row['dep_state'];
  34.     $dam = $row['dep_am'];
  35.     $dpm = $row['dep_pm'];
  36.     $cn = $row['car_num'];
  37. }
  38.  
  39. //driver info query
  40. $sql2 = "SELECT ro.*, au.firstname, au.lastname FROM routes ro LEFT JOIN authorize au ON ro.id_auth=au.id_auth
  41. WHERE ro.id_routes=$id_routes";
  42. $results2 = mysql_query($sql2) or die(mysql_error());
  43.  
  44. while ($row = mysql_fetch_assoc($results2)){
  45.  
  46.     $auf = $row['firstname'];
  47.     $aul = $row['lastname'];
  48. }
  49.  
  50. //region info query
  51. $sql3 = "SELECT cl.*, s.sch_name, s.sch_address, s.sch_city, s.sch_state, s.sch_start, s.sch_end, r.reg_name FROM clients cl LEFT JOIN schools s ON cl.id_schools=s.id_schools LEFT JOIN regions r ON s.id_reg=r.id_reg WHERE s.id_reg=r.id_reg";
  52.  
  53. $results3 = mysql_query($sql3) or die(mysql_error());
  54.  
  55. while ($row = mysql_fetch_assoc($results3)){
  56.     $rgn = $row['reg_name'];
  57.     $sn = $row['sch_name'];
  58.     $sa = $row['sch_address'];
  59.     $sc = $row['sch_city'];
  60.     $ss = $row['sch_state'];
  61.     $sst = $row['sch_start'];
  62.     $se = $row['sch_end'];
  63.        
  64. }
  65.  
  66. //counts rows in table
  67. $sql = "SELECT COUNT(id_clients) FROM client_schedule WHERE id_routes=$id_routes";
  68. $result = mysql_query($sql) or die(mysql_error());
  69. echo mysql_error();
  70. $r = mysql_fetch_row($result);
  71. $numrows = $r[0];
  72.  
  73.  
  74. $day = date('l');
  75. $day = strtolower($day);
  76.  
  77. $sql4 = "Select cs.*, cl.id_clients as client_id, cl.cl_fn, cl.cl_ln, cl.cl_address, cl.cl_city, cl.cl_notes, a.aides_fn, a.aides_ln FROM client_schedule cs LEFT JOIN clients cl ON cs.id_clients = cl.id_clients LEFT JOIN aides a ON cs.id_aides = a.id_aides WHERE ".$day." = 1 AND id_routes = $id_routes AND cs.time_in <> '' AND (start_date < NOW() AND end_date >NOW()) ORDER BY cs.order_num ASC";
  78.  
  79. $results4 = mysql_query($sql4) or die(mysql_error());
  80.  
  81. while ($row = mysql_fetch_assoc($results4)){
  82.    
  83.     $af = $row['aides_fn'];
  84.     $al = $row['aides_ln'];
  85.    
  86. }
  87.  
  88. $day = date('l');
  89. $day = strtolower($day);
  90.  
  91. $sql5 = "Select cs.*, cl.id_clients as client_id, cl.cl_fn, cl.cl_ln, cl.cl_address, cl.cl_city, cl.cl_notes FROM client_schedule cs LEFT JOIN clients cl ON cs.id_clients = cl.id_clients WHERE ".$day." = 1 AND id_routes = $id_routes AND cs.time_in <> '' AND (start_date < NOW() AND end_date >NOW()) ORDER BY cs.order_num ASC";
  92.  
  93. $results5 = mysql_query($sql5) or die(mysql_error());
  94.  
  95. ?>
  96.     <div id="content">
  97.         <table width="800" border="2">
  98.       <tr bgcolor="#CCCCCC">
  99.   <td width="400"><p><img src="images/connecticut transportation.jpg" width="285" height="74" />
  100.     <h2>Itinerary</h2></td>
  101.     <td colspan="2" align="center"><h2>555 Highland Ave<br />
  102.     Cheshire, CT  06410<br />
  103.     (203) 592-7213</h2>
  104.   </tr>
  105.   <tr>
  106.     <td align="center"><h3>Run # / Lot</h3></td>
  107.     <td width="100" align="center">#<?php echo $rtn;?></td>
  108.     <td width="300" align="center"><?php echo $dn;?><br /><?php echo $da;?><br /><?php echo $dc;?>,<?php echo $ds;?></td>
  109.   </tr>
  110.   <tr>
  111.     <td align="center"><h3>Vehicle # / Driver</h3></td>
  112.     <td colspan="2" align="center">#<?php echo $cn;?>/<?php echo $auf;?> <?php echo $aul;?></td>
  113.   </tr>
  114.   <tr>
  115.     <td align="center"><h3>Region</h3></td>
  116.     <td colspan="2" align="center"><?php echo $rgn;?></td>
  117.   </tr>
  118.   <tr>
  119.     <td align="center"><h3>School</h3></td>
  120.     <td colspan="2" align="center"><?php echo $sn;?><br /><?php echo $sa;?><br /><?php echo $sc;?>,<?php echo $ss;?></td>
  121.   </tr>
  122.   <tr>
  123.     <td align="center"><h3># of Students</h3></td>
  124.     <td colspan="2" align="center"><?php
  125.         echo "$numrows";
  126.         ?></td>
  127.   </tr>
  128.   <tr>
  129.     <td align="center"><h3>Assigned Aide</h3></td>
  130.     <td colspan="2" align="center"><?php echo $af;?> <?php echo $al;?></td>
  131.   </tr>
  132.   <tr>
  133.     <td align="center"><h3>School Hours</h3></td>
  134.     <td colspan="2" align="center"><?php echo $sst;?> AM/ <?php echo $se;?> PM</td>
  135.   </tr>
  136.   <tr>
  137.     <td align="center"><h3>Depart Lot:  <?php echo $dn;?></h3></td>
  138.     <td colspan="2" align="center"><?php echo $dam;?> AM/ <?php echo $dpm;?> PM</td>
  139.   </tr>
  140. </table>
  141.  
  142. <?php while ($row = mysql_fetch_assoc($result5)){
  143.  
  144.                
  145.      ?>
  146. <table width="800" border="2">
  147.   <tr>
  148.     <td colspan="3" align="center"></td>
  149.   </tr>
  150.   <tr>
  151.     <td width="198"><h3>Student Order: <?php echo $row['order_num'];?></h3></td>
  152.     <td width="278"><?php echo $row['cl_fn'];?> <?php echo $row['cl_ln'];?><br /><?php echo $row['cl_address'];?><br /><?php echo $row['cl_city'];?>, <?php echo $row['cl_state'];?></td>
  153.     <td>Mother = <?php echo $row['cl_mother_fn'];?><br />Father = <?php echo $row['cl_father_fn'];?><br /><?php echo $row['cl_home_ptn'];?>/<?php echo $row['cl_day_ptn'];?></td>
  154.   </tr>
  155. </table>
  156. <?php
  157.          
  158.         }
  159.         ?>
  160.  
  161. <!-- end .content --></div>
  162. <!-- end content-container --></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement