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գk+F ь5'I`Ǐ8)2>snL Ug@5!of7\Za iF6e(@٦ܨ߈OGn"MnMsѭqNœBHֿ֐J3Y~ ߚW>w t]w7y`NyZ:.: v;lL؋!_#wIpEuRL˾  IX,+BuRxBP#h0N|kiLk+) v}eaG]&!Wbp0+Gbh& VZ,xOl{tw١ofL9@& ^;,+j*?SG8)ct[ۺ? ]]G&wt)@)USoˤObTK,ù>&ɂ} ,z Z_՘DyTӛ(?L5c@w"4nz'ڨXq_8ju`\ǻSl`NtA".$query; $query="update empAttendance set entryTime=(select min(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, -200, ent1) and ext1 )"; $query=$query."where date_='$from' "; odbc_exec( $conn, $query ); $query="update empAttendance set exitTime=(select max(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, +10, entryTime) and DATEADD(MINUTE, +100, ext1) )"; $query=$query."where date_='$from' "; odbc_exec( $conn, $query ); $query="update empAttendance set entryTime2=(select min(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, -100, ent2) and ext2 )"; $query=$query."where date_='$from' "; odbc_exec( $conn, $query ); $query="update empAttendance set exitTime2=(select max(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, +10, entryTime2) and DATEADD(MINUTE, +100, ext2) )"; $query=$query."where date_='$from' "; odbc_exec( $conn, $query ); $cur= odbc_exec( $conn, "update empAttendance set exitTime=null where entryTime=exitTime"); $cur= odbc_exec( $conn, "update empAttendance set exitTime2=null where entryTime2=exitTime2"); $query="update empAttendance set symbol='t' where (symbol is null) and entryTime>DATEADD(MINUTE, 10, ent1) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $cur= odbc_exec( $conn, "update empAttendance set symbol='P' where (date_='$from') AND (entryTime IS NOT NULL) and (symbol is null) "); $query="update empAttendance set symbol='A' where (symbol is null) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $query="update empAttendance set symbol=null where (symbol='A') and (ent1>getdate()) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); return $type_; } function calculateEmpAttendance($conn,$date_,$employeeid){ $from = date('Y-m-d',strtotime($date_)); $type_=getName($conn,"select case rate when '1' then 'Normal' when '2' then 'Event' else '3' end from DollarRate where date_='$from'"); if($type_=="" or $type_=="3") { return $type_; } $day_= date('d',strtotime($from)); $month_= date('m',strtotime($from)); $year_= date('Y',strtotime($from)); $cur= odbc_exec( $conn, "delete from empAttendance where symbol not in('L','CL','SL','HD','X','OD') and machineid='$employeeid' and day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_'"); $query="insert into empAttendance (machineid,date_,symbol,type_) "; $query=$query."select employeeid,'$from','A','$type_' from employee "; $query=$query."where employeeid='$employeeid' "; //echo $query; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent1=(select '$from'+cast(entry1 as datetime) from empTimings where empTimings.employeeid='$employeeid' and type='$type_') "; $query=$query." where date_='$from' and machineid='$employeeid' "; $cur= odbc_exec( $conn, $query); //$query="update empAttendance set exit1=(select exit1 from empTimings where empTimings.employeeid=empAttendance.machineid and type='$type_') "; $query="update empAttendance set ext1=(select '$from'+cast(exit1 as datetime) from empTimings where empTimings.employeeid='$employeeid' and type='$type_') "; $query=$query." where date_='$from' and machineid='$employeeid' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent2=(select '$from'+cast(entry2 as datetime) from empTimings where empTimings.employeeid='$employeeid' and entry2 is not null and type='$type_') "; $query=$query." where date_='$from'and machineid='$employeeid' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ext2=(select '$from'+cast(exit2 as datetime) from empTimings where empTimings.employeeid='$employeeid' and exit2 is not null and type='$type_') "; $query=$query." where date_='$from' and machineid='$employeeid' "; $cur= odbc_exec( $conn, $query); $cur= odbc_exec( $conn, "update empAttendance set ent2=null,ext2=null where ent2='$from' and machineid='$employeeid' "); $cur= odbc_exec( $conn, "update empAttendance set ext1=DATEADD(day, 1, ext1) where ext1".$query; $query="update empAttendance set entryTime=(select min(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, -100, ent1) and ext1 )"; $query=$query."where date_='$from' and machineid='$employeeid' "; odbc_exec( $conn, $query ); $query="update empAttendance set exitTime=(select max(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, +10, entryTime) and DATEADD(MINUTE, +100, ext1) )"; $query=$query."where date_='$from' and machineid='$employeeid' "; odbc_exec( $conn, $query ); $query="update empAttendance set entryTime2=(select min(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, -100, ent2) and ext2 )"; $query=$query."where date_='$from' and machineid='$employeeid' "; odbc_exec( $conn, $query ); $query="update empAttendance set exitTime2=(select max(checktime) from checkinout where empAttendance.machineid=checkinout.userid and checktime between DATEADD(MINUTE, +10, entryTime2) and DATEADD(MINUTE, +100, ext2) )"; $query=$query."where date_='$from' and machineid='$employeeid' "; odbc_exec( $conn, $query ); $cur= odbc_exec( $conn, "update empAttendance set exitTime=null where entryTime=exitTime and machineid='$employeeid' "); $cur= odbc_exec( $conn, "update empAttendance set exitTime2=null where entryTime2=exitTime2 and machineid='$employeeid' "); $cur= odbc_exec( $conn, "update empAttendance set symbol='P' where entryTime is not null and day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_' and machineid='$employeeid' "); //Late Calculate $query="update empAttendance set symbol='t' where symbol not in('L','CL','SL','HD','X','OD') and entryTime>DATEADD(MINUTE, 10, ent1) and day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_' and machineid='$employeeid' "; $cur= odbc_exec( $conn, $query ); //odbc_close($conn); return $type_; } function convertNumberToWord($num = false) { $num = str_replace(array(',', ' '), '' , trim($num)); if(! $num) { return false; } $num = (int) $num; $words = array(); $list1 = array('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen' ); $list2 = array('', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', 'hundred'); $list3 = array('', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion', 'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quattuordecillion', 'quindecillion', 'sexdecillion', 'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion' ); $num_length = strlen($num); $levels = (int) (($num_length + 2) / 3); $max_length = $levels * 3; $num = substr('00' . $num, -$max_length); $num_levels = str_split($num, 3); for ($i = 0; $i < count($num_levels); $i++) { $levels--; $hundreds = (int) ($num_levels[$i] / 100); $hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' hundred' . ' ' : ''); $tens = (int) ($num_levels[$i] % 100); $singles = ''; if ( $tens < 20 ) { $tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' ); } else { $tens = (int)($tens / 10); $tens = ' ' . $list2[$tens] . ' '; $singles = (int) ($num_levels[$i] % 10); $singles = ' ' . $list1[$singles] . ' '; } $words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' ); } //end for loop $commas = count($words); if ($commas > 1) { $commas = $commas - 1; } return implode(' ', $words); } ?>