[ PHPXref.com ] [ Generated: Sun Jul 20 20:12:55 2008 ] [ Scout Tracker 0.13 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/includes/ -> all_service_record.php (source)

   1  <?php
   2  if ($script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]) == "all_service_record.php" ) {
   3   print "<meta http-equiv=\"refresh\" content=\"0; URL=./index.php\">";
   4   exit;
   5  }
   6  
   7  print "<center><h3>All Scouts Service Record</h3></center></center>";
   8  
   9  
  10  if ($add_date == "Y" && $user_group <=2) {
  11   $check_date = verifydate($service_date);
  12   if ($check_date == '0000-00-00') {
  13    print "<center><h2>Invalid Date $service_date</h2></center>\n<br>";
  14   } else {
  15    print "<center><h3>Adding Service Date $check_date at $service for:</h3></center>";
  16    foreach ($service_hours as $rowid => $hours) {
  17     if ($hours > 0) {
  18      $sql_insert = mysql_query("insert into tbl_scout_service
  19                                 (scout_key
  20                                 ,date
  21                                 ,service
  22                                 ,hours
  23                                 ) values
  24                                 (\"$rowid\"
  25                                 ,\"$check_date\"
  26                                 ,\"$service\"
  27                                 ,\"$hours\"
  28                                 )
  29                                 ");
  30      $sql = mysql_query("select last_name, first_name from tbl_scout where record_key=$rowid");
  31      extract(mysql_fetch_assoc($sql));
  32      mysql_free_result($sql);
  33      print "$first_name,$last_name for $hours hours<br>\n";
  34     }
  35    }
  36  
  37   }
  38  }
  39  
  40  if ($user_group < "2" ) {
  41      print "<form method=POST action=./index.php>";
  42      print "<input type=hidden name=all_service_record value=Y>";
  43      print "<input type=hidden name=add_date value=Y>";
  44  }
  45  
  46  print "<table border=1 align=center class=white><tr align=center><td><h3>Scout</td><td><h3>Total Hours</td>";
  47  if ($user_group < "2" ) {
  48   print "<td><h3>Add<br>Hours</td>";
  49  }
  50  print "</tr>";
  51  
  52  $sql = mysql_query("select a.first_name,
  53                      a.last_name,
  54                sum(b.hours) as hours,
  55                a.record_key as rowid
  56                      from tbl_scout as a
  57                      left join tbl_scout_service as b
  58                      on a.record_key = b.scout_key
  59                      group by a.last_name, a.first_name
  60                      order by birthdate");
  61  
  62  while ($row = mysql_fetch_assoc($sql)) {
  63      extract($row);
  64      print "<tr><td>$first_name $last_name</td><td align=center>$hours</td>";
  65      if ($user_group < "2" ) {
  66       print "<td align=center><input type=text name=service_hours[$rowid] size=2 maxlength=2></td>";
  67      }
  68      print "</tr>\n";
  69  }
  70  mysql_free_result($sql);
  71  
  72  print "</table>";
  73  if ($user_group < "2" ) {
  74   print "<center><hr width=50%>Add Service Date: <input type=text name=service_date size=10
  75          onChange=\"var box=document.forms[0].service_date;var d=parseDate(box.value);
  76                           if(d==null){
  77                            alert('Date string not recognizable!');
  78                            box.value='';
  79                            box.focus();
  80                           } else {
  81                            box.value=formatDate(d,'yyyy-MM-dd');
  82                           }\"><br>
  83          Service Activity: <input type=text name=service size=25<br>
  84          <input type=submit value=Submit></form>";
  85  }
  86  
  87  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]