Permalink
Browse files

Changes corresponding to changes in the attendanceTime DB table where…

… the barcode field was removed & instead serialNumber field was added
  • Loading branch information...
1 parent 3707d53 commit d51d66ca6c8f2f30fbfc16921b3f50dd607395b4 @hanushh committed Mar 7, 2012
Showing with 30 additions and 14 deletions.
  1. +23 −12 User/attendance.class.php
  2. +6 −1 myattendancerecord.php
  3. +1 −1 scanning/login.class.php
View
@@ -3,17 +3,17 @@ class Attendance
{
public function insertAttendenceLoginTime($barcode)
{
- $this->barcode = dbconnect::escape($barcode);
-
- $date = date("Y-m-d");
-
- $ampm = date('a', time());
- $time = date('h:i:s', time());
- $q1= "SELECT * FROM `attendanceTime` WHERE `barcode`='$barcode' AND `date`='$date'";
- $res=mysql_query($q1);
- $row=mysql_fetch_array($res);
+ $this->barcode = dbconnect::escape($barcode);
+ $serialNumber = $this->getSerialNumber( $this -> barcode );
+ $date = date("Y-m-d");
+
+ $ampm = date('a', time());
+ $time = date('h:i:s', time());
+ $q1 = "SELECT * FROM `attendanceTime` WHERE `serialNumber`='$serialNumber' AND `date`='$date'";
+ $res = mysql_query($q1);
+ $row = mysql_fetch_array($res);
if($ampm == "am")
- {
+ {
//if($row['inAM']!='00:00:00' or $row['inAM']!= NULL)
$INam = $time;
$INpm = "00:00:00";
@@ -24,7 +24,7 @@ public function insertAttendenceLoginTime($barcode)
$INam = "00:00:00";
}
- $q = "INSERT INTO `attendanceTime`(barcode, date, inAM, inPM ) VALUES ('".$this->barcode."', '$date', '$INam', '$INpm')";
+ $q = "INSERT INTO `attendanceTime`(serialNumber, date, inAM, inPM ) VALUES ('".$serialNumber."', '$date', '$INam', '$INpm')";
mysql_query($q) or die(mysql_error());
return mysql_insert_id();
@@ -36,12 +36,23 @@ public function updateAttendenceLoginTime($barcode,$date, $inAM, $inPM)
$this->inAM = dbconnect::escape($inAM);
$this->inPM = dbconnect::escape($inPM);
- $q = "UPDATE`attendanceTime` SET inAM='{$this->inAM}', inPM='{$this->inPM}' WHERE barcode='{$this->barcode}' AND date ='{$this->date}'";
+ $q = "UPDATE`attendanceTime` SET inAM='{$this->inAM}', inPM='{$this->inPM}' WHERE serialNumber='{$serialNumber}' AND date ='{$this->date}'";
mysql_query($q) or die($q. mysql_error());
return mysql_insert_id();
}
+ public function getSerialNumber($barcode){
+
+ $q = "SELECT serialNumber FROM `user` WHERE barcode='{$barcode}'";
+
+ $res = mysql_query($q) or die(mysql_error());
+
+ $arr = mysql_fetch_array($res);
+
+ return $arr['serialNumber'];
+
+ }
View
@@ -2,6 +2,11 @@
<html><head><?php error_reporting(E_ALL ^ E_NOTICE);
require_once("logcheck.php");
require_once ('config.php');
+
+require_once('User/user.class.php');
+
+$obj_user = new User();
+$serialNumber = $obj_user->getSerialNumber($barcode);
?>
@@ -42,7 +47,7 @@
<th>Result</th>
</tr>
<?php $barcode=$_SESSION['barcode'];
-$sql="SELECT * FROM attendanceTime WHERE `barcode`='$barcode'";
+$sql="SELECT * FROM attendanceTime WHERE `serialNumber`='$serialNumber'";
$res=mysql_query($sql);
$i=0;
while($row = mysql_fetch_array($res)):
View
@@ -96,7 +96,7 @@ function barcode_Scanning($barcode)
$q = "UPDATE `attendanceTime` SET inPM='$INpm',i=$i,j=$j WHERE `serialNumber`='$serialNumber' AND `date`='$date'";
} else {
- $q = "INSERT INTO `attendanceTime`(serialNumber date, inAM, inPM,i,j ) VALUES ('$serialNumber','$date', '$INam', '$INpm',$i,$j)";
+ $q = "INSERT INTO `attendanceTime`(serialNumber, date, inAM, inPM,i,j ) VALUES ('$serialNumber','$date', '$INam', '$INpm',$i,$j)";
}
}

0 comments on commit d51d66c

Please sign in to comment.