SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: pls help!

  1. #1
    SitePoint Zealot cachobong's Avatar
    Join Date
    Jan 2005
    Location
    cebu
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation pls help!

    PHP Code:
    $dq "SELECT * FROM dtr WHERE empid='$empid' AND date='".date('Y-m-d'$datenow)."'";
    $dr = @mysql_query($dq$connection) or die (mysql_error());
    $dd =  mysql_fetch_assoc($dr);
                
    $shiftq "SELECT shift FROM employee WHERE empid = '$empid'";
    $shiftr mysql_query($shiftq$connection) or die(mysql_error()); 
    $shiftd mysql_fetch_assoc($shiftr);
    $sname $shiftd['shift'];
    echo 
    $sname;
                
    $sq "SELECT * FROM shift WHERE name = '$sname'";
    $sr mysql_query($sq$connection) or die(mysql_error());
    $sd mysql_fetch_assoc($sr);
    $policyname $sd['policyname'];
    echo 
    $policyname;
                
    $pq "SELECT * FROM timepolicy WHERE name = '$policyname'";
    $pr mysql_query($pq$connection) or die(mysql_error());
    $pd mysql_fetch_assoc($pr);
    $p2 $pd['name'];
    echo 
    $p2;
                
    //calculate workinghrs
    $one strtotime($sd['timein']); 
    $two strtotime($sd['breakout']); 
    $three strtotime($sd['breakin']); 
    $four strtotime($sd['timeout']); 
    $workinghrs $workinghrs + (abs($two $one) / 60) + (abs($four $three) / 60); 
                
    //calculate latemin
    $xtimein $dd['timein'];
    $xtimein strtotime($xtimein);
    $xbreakout $dd['breakout'];
    $xbreakout strtotime('H:i',$xbreakout);
    $xbreakin $dd['breakin'];
    $xbreakin strtotime('H:i',$xbreakin);
    $xtimeout $dd['timeout'];
    $xtimeout strtotime('H:i',$xtimeout);
    $xot1 $dd['ot1'];
    $xot1 strtotime('H:i',$xot1);
    $xot2 $dd['ot2'];
    $xot2 strtotime('H:i',$xot2);
                
    $timein $sd['timein'];
    $breakin $sd['breakin'];
    $allowance $pd['late'];
    $timeinlate strtotime("$timein + $allowance minutes");
    $breakinlate strtotime("$breakin + $allowance minutes");
    $timein strtotime($sd['timein']);
    $breakin strtotime($sd['breakin']);
    if (
    $xtimein $timeinlate)
    {
         
    $absenthrs $absenthrs + (abs($two $one) / 60);
    }
    else if(
    $xtimein $timein)
    {
         
    $latemin = (abs($xtimein $timein) / 60);
    }
    if (
    $xbreakin $breakinlate)
    {
        
    $absenthrs $absenthrs + (abs($four $three) / 60);
    }
    else if(
    $xbreakin $breakin)
    {
    $latemin = (abs($xbreakin $breakin) / 60);

    im am making a DTR system for my school project. this is the only functionality that is lacking. this is my code. working hrs computation already works.
    my problem is with the late minutes. $xtimein,$xbreakin is from the table where there are the actual times the employee logged in. $timein, $breakin is the ideal time an employee should log in. $breakinlate, $timeinlate is the the ideal time with allowance that was set in the database. if the log in time is more than the allowance, the employee is considered absent. if it is within the allowance and the ideal time, the employee is considered late and the difference of the actual time and ideal time is his late mins...i have a problem with this function...pls help everybody! questions will be glady entertaind!

  2. #2
    SitePoint Zealot cachobong's Avatar
    Join Date
    Jan 2005
    Location
    cebu
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pls help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •