[ PHPXref.com ] [ Generated: Sun Jul 20 19:57:02 2008 ] [ PHP Timeclock 1.02 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> timeclock.php (source)

   1  <?php
   2  session_start();
   3  
   4  include  'config.inc.php';
   5  include  'header.php';
   6  
   7  if (!isset($_GET['printer_friendly'])) {
   8  
   9      if (isset($_SESSION['valid_user'])) {
  10          $set_logout = "1";
  11      }
  12  
  13      include  'topmain.php';
  14      include  'leftmain.php';
  15  }
  16  
  17  echo "<title>$title</title>\n";
  18  $current_page = "timeclock.php";
  19  
  20  if (!isset($_GET['printer_friendly'])) {
  21      echo "    <td align=left class=right_main scope=col>\n";
  22      echo "      <table width=100% height=100% border=0 cellpadding=5 cellspacing=1>\n";
  23      echo "        <tr class=right_main_text>\n";
  24      echo "          <td valign=top>\n";
  25  }
  26  
  27  // code to allow sorting by Name, In/Out, Date, Notes //
  28  
  29  if ($show_display_name == "yes") {
  30      if (!isset($_GET['sortcolumn'])) {
  31          $sortcolumn = "displayname";
  32      } else {
  33          $sortcolumn = $_GET['sortcolumn'];
  34      }
  35  
  36  } else {
  37  
  38      if (!isset($_GET['sortcolumn'])) {
  39          $sortcolumn = "fullname";
  40      } else {
  41          $sortcolumn = $_GET['sortcolumn'];
  42      }
  43  
  44  }
  45  
  46  if (!isset($_GET['sortdirection'])) {
  47      $sortdirection = "asc";
  48  } else {
  49      $sortdirection = $_GET['sortdirection'];
  50  }
  51  
  52  if ($sortdirection == "asc") {
  53      $sortnewdirection = "desc";
  54  } else {
  55      $sortnewdirection = "asc";
  56  }
  57  
  58  // determine what users, office, and/or group will be displayed on main page //
  59  
  60  if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) {
  61      $current_users_date = strtotime(date($datefmt));
  62      $calc = 86400;
  63      $a = $current_users_date + $calc - @$tzo;
  64      $b = $current_users_date - @$tzo;
  65  
  66      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
  67                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
  68                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
  69                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and 
  70                (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
  71                order by `$sortcolumn` $sortdirection";
  72      $result = mysql_query($query);
  73  } 
  74  
  75  elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) { 
  76  
  77      $current_users_date = strtotime(date($datefmt));
  78      $calc = 86400;
  79      $a = $current_users_date + $calc - @$tzo;
  80      $b = $current_users_date - @$tzo;
  81  
  82      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
  83                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
  84                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
  85                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' 
  86                and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
  87                and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
  88                order by `$sortcolumn` $sortdirection";
  89      $result = mysql_query($query);
  90  } 
  91  
  92  elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) { 
  93  
  94      $current_users_date = strtotime(date($datefmt));
  95      $calc = 86400;
  96      $a = $current_users_date + $calc - @$tzo;
  97      $b = $current_users_date - @$tzo;
  98  
  99      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
 100                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
 101                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
 102                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' 
 103                and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
 104                and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
 105                order by `$sortcolumn` $sortdirection";
 106      $result = mysql_query($query);
 107  } 
 108  
 109  elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) {
 110  
 111      $current_users_date = strtotime(date($datefmt));
 112      $calc = 86400;
 113      $a = $current_users_date + $calc - @$tzo;
 114      $b = $current_users_date - @$tzo;
 115  
 116      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
 117                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
 118                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
 119                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' 
 120                and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') 
 121                and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1'
 122                and ".$db_prefix."employees.empfullname <> 'admin'
 123                order by `$sortcolumn` $sortdirection";
 124      $result = mysql_query($query);
 125  } 
 126  
 127  elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) {
 128  
 129      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
 130                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
 131                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
 132                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1'
 133                and ".$db_prefix."employees.empfullname <> 'admin'
 134                order by `$sortcolumn` $sortdirection";
 135      $result = mysql_query($query);
 136  } 
 137  
 138  elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) {
 139  
 140      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
 141                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
 142                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
 143                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
 144                and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
 145                order by `$sortcolumn` $sortdirection";
 146      $result = mysql_query($query);
 147  } 
 148  
 149  elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) {
 150  
 151      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
 152                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
 153                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
 154                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
 155                and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
 156                order by `$sortcolumn` $sortdirection";
 157      $result = mysql_query($query);
 158  } 
 159  
 160  elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) {
 161  
 162      $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
 163                from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
 164                where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
 165                and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
 166                and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1'
 167                and ".$db_prefix."employees.empfullname <> 'admin'
 168                order by `$sortcolumn` $sortdirection";
 169      $result = mysql_query($query);
 170  }
 171  
 172  $tclock_hour = gmdate('H');
 173  $tclock_min = gmdate('i');
 174  $tclock_sec = gmdate('s');
 175  $tclock_month = gmdate('m');
 176  $tclock_day = gmdate('d');
 177  $tclock_year = gmdate('Y');
 178  $tclock_stamp = mktime ($tclock_hour, $tclock_min, $tclock_sec, $tclock_month, $tclock_day, $tclock_year);
 179  
 180  $tclock_stamp = $tclock_stamp + @$tzo;
 181  $tclock_time = date($timefmt, $tclock_stamp);
 182  $tclock_date = date($datefmt, $tclock_stamp);
 183  $report_name="Current Status Report";
 184  
 185  echo "            <table width=100% align=center class=misc_items border=0 cellpadding=3 cellspacing=0>\n";
 186  
 187  if (!isset($_GET['printer_friendly'])) {
 188      echo "              <tr class=display_hide>\n";
 189  } else {
 190      echo "              <tr>\n";
 191  }
 192  
 193  echo "                <td nowrap style='font-size:9px;color:#000000;padding-left:10px;'>$report_name&nbsp;&nbsp;---->&nbsp;&nbsp;As of: $tclock_time, 
 194                      $tclock_date</td></tr>\n";
 195  echo "            </table>\n";
 196  include  'display.php';
 197  
 198  if (!isset($_GET['printer_friendly'])) {
 199      include  'footer.php';
 200  }
 201  
 202  ?>
 203  


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