(/ESCb6Ѐ_p5MT&.`lN'S_ Q7鯾I5$<^@En9l[4œ,UUB;G12iv8XdJ]ێ @҉,QJf,᠛.V vEj$HwgӷZ>0!Mn2N F3b!eaa 9(cԾ\Ӷ(~],{}I{]07qZX:i]יVW  .-ȹ='@.xQmBr6Ao*"#0 }lkYuǿCo@ }U@ED/i[n{a3+ G_1`B%䢇=^i[:7'_0G֖o4/FgD ŭ8F" i[@ptPo:qvFDi0bYkR6yqʎ#AyJg_ L^n{>h}BqcE[~?H3 *%0WQRyq>@,:ʨo'I3̠ՆKԄm+gt^jy y1Bi病`ٻ;CmiR`\P$ހ xz rz:7 5<ʠSL|,sA _G0uݒs$._ɽ{A(-ҁ_6c ".%-p-T5TR >wU ~fRǖbԦB(vȭ 4>C1qQTBcx@Ű\uH(e GᢘS;5.iRVh޾%˧^4t{xoʓwCc+iqXCR&( ӈ\k=3 )t17^,uǰEhlƕGvR7F *}U8XΒ{-/ZFȥH(spVt;F{lz qyv:4 "S`PK[R.;väZ#A2OLjݲH'xc6֟ u?d{WCR0?rc"0dؤkl #Q8rS1Bp{λC-.dBiX ̸w]A[| 027o^ҷ{*3'?< T T/[*E[?fIH>ݏ YTv^¿7Ղ3V#!. n6Ob[ +w:vYSJ?^$X3jb@hp>|(#W'ɗpYp+J1vP8jv;6Y mOnxD7WgW El׳ύl2m<-%LFZ1Aݨc*JYdWʞoqWԃǣXis-m ثCM^H˪tb:w\M{RVb*8xEaR4(RTו7B};cԘq(?;S.cg(QKyAsls'Kb"bw$Vq 2K &O:6cs싚hDAlS97m5& oS.΀iAq. 'W2D#jQN iwidFwdIuFdч&d˵ЌhݍZA~Zml%gkn lczc1,)&_y~5g=wBiIcZxcRI~]ܣ#8{< !=\]nSSDx /oJjJk11ӫ_m?gsiuR$}z!ᥧ.eB".o@ &˝C5?? [_ >[cqxR9.!PSb/mY>B;u߯sA ^zkO#탋CıN cT~c#)Qa3dJM0-`\ndIb,Zٙ=GS#rbAAmqV2>AXqȃXXmL>mKLK0oQ-I쵌Rsi@<2͙,P K`ݏ7XA̓+xYX_F4jZ`@Htlh-3lbwVh$gMECJgf~btjDٸN펧e9·eE.df_^G` Jy݊0JܽP@62׆ԼI>[F᧛A+[lYF iē/E΀iAq_el` T(MЮP67p,>IanCG S^.֚[??9r= @fn.4~DUxb!]SVbڏBvfTb/:)Jb9t;vbq3:p=8iLIGFgd\+}*5|K$bT᷅k'}Omyjno!eʢ0lXDЅ*;6|>.)'6v1nÉORHbicBl:A*.yOCeÎ9x-omL |>+F`GHdJO0){ $val=$years.' Years '.$val; } return($val); //return (date_diff($cDate,$jDate)); } function calculateBalance($conn,$stdID) { //$query="update employee_personal_information set balance=(select sum(monthly)-sum(amtReceived) from studentFee where studentFee.stdID=employee_personal_information.stdID and date_=(select max(date_) from studentFee) group by stdID) "; //odbc_exec( $conn, $query ); if($stdID=="0"){ $query="update employee_personal_information set balance=(select sum(monthly)-sum(amtReceived) from studentFee where studentFee.stdID=employee_personal_information.stdID and date_=(select max(date_) from studentFee) group by stdID) "; odbc_exec( $conn, $query ); }else{ $query="update employee_personal_information set balance=(select sum(monthly)-sum(amtReceived) from studentFee where stdID='$stdID' and date_=(select max(date_) from studentFee where stdID='$stdID') ) where stdID='$stdID' "; //echo alert("$query"); odbc_exec( $conn, $query ); } } function date_01($date_) { $x = date('d',strtotime($date_)); if($x>1){ $y=$x-1; $date_=date('Y-m-d', strtotime($date_. "- $y day")); } return ($date_); } function fillCMB($conn,$idSelected,$qry) { //echo $qry ; $opt=""; $cur2= odbc_exec( $conn, $qry); while( odbc_fetch_row( $cur2 ) ) { $id= odbc_result( $cur2, 1 ); $name= odbc_result( $cur2, 2 ); if($id==$idSelected) $opt.=""; else $opt.=""; } //odbc_close($conn); return ($opt); } function protect($strg){ //$strg = mysql_real_escape_string(trim(strip_tags(addslashes($strg)))); $strg = str_replace('=','',$strg); $strg = str_replace('>','',$strg); $strg = str_replace('<','',$strg); $strg = str_replace('<=','',$strg); $strg = str_replace('>=','',$strg); $strg = str_replace('!=','',$strg); $strg = str_replace('drop database','',$strg); $strg = str_replace('drop table','',$strg); $strg = str_replace('delete from','',$strg); $strg = str_replace('truncate table','',$strg); $strg = str_replace(';','',$strg); $strg = str_replace('limit','',$strg); $strg = str_replace("'","''",$strg); $strg = str_replace("insert into","''",$strg); $strg = str_replace('--','',$strg); return $strg; } function fillList($conn,$qry) { //$opt= ""; $opt= ""; $run = mysql_query($qry); while ($row=mysql_fetch_array($run)){ $opt.=""; return $opt; } function getName($conn,$qry){ //echo"br>".$qry; $cur2= odbc_exec( $conn, $qry); $getName=""; while( odbc_fetch_row( $cur2 ) ) { $getName= odbc_result( $cur2, 1 ); } //odbc_close($conn); return ($getName); } function calculateAttendanceGeneral($conn,$date_){ $from = date('Y-m-d',strtotime($date_)); $type_="Normal"; $day_= date('d',strtotime($from)); $month_= date('m',strtotime($from)); $year_= date('Y',strtotime($from)); //alter table checkinout add machineid int $cur= odbc_exec( $conn, "update checkinout set machineid=(select CAST(BADGENUMBER AS int) from userinfo where userinfo.userID=checkinout.userID) where machineid is null "); $cur= odbc_exec( $conn, "delete from empAttendance where (date_='$from') "); $query="insert into empAttendance (machineid,date_,symbol) "; $query=$query."select distinct machineid,'$from','P' from CHECKINOUT "; $query=$query." where day(CHECKTIME)='$day_' and month(CHECKTIME)='$month_' and year(CHECKTIME)='$year_' "; $query=$query." and userid not in(select machineid from empAttendance where day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_') "; //echo "
".$query; $cur= odbc_exec( $conn, $query); //set Absent All remains Code=1 $query="insert into empAttendance (machineid,date_,symbol) "; $query.="select machineid,'$from','A' from employee_personal_information "; $query=$query."where Status=0 and machineid not in (select machineid from empAttendance where date_='$from') "; //echo $query; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent1=(select '$from'+cast(entry1 as datetime) from empTimings where empTimings.machineid=empAttendance.machineid) "; $query.=" where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ext1=(select '$from'+cast(exit1 as datetime) from empTimings where empTimings.machineid=empAttendance.machineid ) "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent2=(select '$from'+cast(entry2 as datetime) from empTimings where empTimings.machineid=empAttendance.machineid and entry2 is not null ) "; $query=$query." where date_='$from' "; //$cur= odbc_exec( $conn, $query); $query="update empAttendance set ext2=(select '$from'+cast(exit2 as datetime) from empTimings where empTimings.machineid=empAttendance.machineid and exit2 is not null) "; $query=$query." where date_='$from' "; //$cur= odbc_exec( $conn, $query); //$cur= odbc_exec( $conn, "update empAttendance set ent2=null,ext2=null where ent2='$from'"); $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.machineid and checktime between DATEADD(MINUTE, -300, 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.machineid and checktime between DATEADD(MINUTE, +10, entryTime) and DATEADD(MINUTE, +300, ext1) )"; $query=$query."where date_='$from' "; odbc_exec( $conn, $query ); $query="update empAttendance set entryTime2=(select min(checktime) from checkinout where empAttendance.machineid=checkinout.machineid 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.machineid 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"); //Late Code=2 //$query="update empAttendance set symbol='t' where (symbol is null) and entryTime>DATEADD(MINUTE, 60, ent1) and (date_='$from') "; $query=" select headDescription from accountHeads where headType='Leaves'"; $query="update empAttendance set symbol='Pt' where symbol not in(".$query.") and entryTime>DATEADD(MINUTE, 60, ent1) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $cur= odbc_exec( $conn, "update empAttendance set symbol='A' where (date_='$from') AND (entryTime IS NOT NULL) and (symbol is null) "); //$query="update empAttendance set symbol='1' 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 ); //Leaves Record Updation $query="update empAttendance set symbol=(select symbol from LeavesView2 where LeavesView2.machineid=empAttendance.machineid and date_='$from') where date_='$from' and machineid in(select machineid from Leaves where date_='$from') "; $cur= odbc_exec( $conn, $query ); // for Sunday if(date('D',strtotime($date_))=='Sun') $cur= odbc_exec( $conn, "update empAttendance set symbol='Su' where symbol='A' and date_='$from' " ); return $type_; } function calculateStudentAttendance($conn,$date_){ $ret=calculateAttendanceGeneral($conn,$date_); exit(); $from = date('Y-m-d',strtotime($date_)); $type_="Normal"; //$type_=getName($conn,"select case rate when '1') 'Normal' when '2') 'Event' else '3' end from DollarRate where date_='$from'"); //if($type_=="" or $type_=="3") { // return $type_; //} //CAST(BADGENUMBER AS int) $day_= date('d',strtotime($from)); $month_= date('m',strtotime($from)); $year_= date('Y',strtotime($from)); //$cur= odbc_exec( $conn, "delete from empAttendance where (date_='$from') and (symbol2 not in('L','CL','SL','HD','X','OD'))"); $cur= odbc_exec( $conn, "delete from empAttendance where (date_='$from') and (symbol2 not in(select id from LeaveType where id>9))"); $query="insert into empAttendance (machineid,date_,type_) "; //$query=$query."select distinct UserID,'$from','$type_' from CHECKINOUT "; $query=$query."select distinct CAST(BADGENUMBER AS int),'$from','$type_' from CHECKINOUT "; $query=$query." where day(CHECKTIME)='$day_' and month(CHECKTIME)='$month_' and year(CHECKTIME)='$year_' "; $query=$query." and userid not in(select machineid from empAttendance where day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_') "; //echo "
".$query; $cur= odbc_exec( $conn, $query); //set Absent All remains Code=1 $query="insert into empAttendance (machineid,date_,symbol2,type_) "; $query=$query."select machineid,'$from','1','$type_' from employee_personal_information "; $query=$query."where Status=0 and machineid not in (select machineid from empAttendance where day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_') "; //echo $query; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent1=(select '$from'+cast(entry1 as datetime) from empTimings where empTimings.stdID=empAttendance.machineid and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ext1=(select '$from'+cast(exit1 as datetime) from empTimings where empTimings.stdID=empAttendance.machineid and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent2=(select '$from'+cast(entry2 as datetime) from empTimings where empTimings.stdID=empAttendance.machineid and entry2 is not null and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ext2=(select '$from'+cast(exit2 as datetime) from empTimings where empTimings.stdID=empAttendance.machineid and exit2 is not null and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $cur= odbc_exec( $conn, "update empAttendance set ent2=null,ext2=null where ent2='$from'"); $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, -200, ent1) and ext1 )"; $query="update empAttendance set entryTime=(select min(checktime) from checkinout where empAttendance.machineid=CAST(checkinout.BADGENUMBER AS int) 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=CAST(checkinout.BADGENUMBER AS int) 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=CAST(checkinout.BADGENUMBER AS int) 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=CAST(checkinout.BADGENUMBER AS int) 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"); //Late Code=2 $query="update empAttendance set symbol2='2' where (symbol2 is null) and entryTime>DATEADD(MINUTE, 60, ent1) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $cur= odbc_exec( $conn, "update empAttendance set symbol2='0' where (date_='$from') AND (entryTime IS NOT NULL) and (symbol2 is null) "); $query="update empAttendance set symbol2='1' where (symbol2 is null) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $query="update empAttendance set symbol2=null where (symbol2='1') and (ent1>getdate()) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); //$dayName = date('D',strtotime($date_)); if(date('D',strtotime($date_))=='Sun') $cur= odbc_exec( $conn, "update empAttendance set symbol2=3 where date_='$from' " ); return $type_; } function calculateAttendance($conn,$date_){ $ret=calculateAttendanceGeneral($conn,$date_); exit(); $from = date('Y-m-d',strtotime($date_)); $type_="Normal"; //$type_=getName($conn,"select case rate when '1') 'Normal' when '2') '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 (date_='$from') and (symbol2 not in('L','CL','SL','HD','X','OD'))"); $cur= odbc_exec( $conn, "delete from empAttendance where (date_='$from') and (symbol2 not in(select id from LeaveType where id>9))"); $query="insert into empAttendance (machineid,date_,type_) "; $query=$query."select distinct UserID,'$from','$type_' from CHECKINOUT "; $query=$query." where day(CHECKTIME)='$day_' and month(CHECKTIME)='$month_' and year(CHECKTIME)='$year_' "; $query=$query." and userid not in(select machineid from empAttendance where day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_') "; //echo "
".$query; $cur= odbc_exec( $conn, $query); $query="insert into empAttendance (machineid,date_,symbol2,type_) "; $query=$query."select employeeid,'$from','1','$type_' from employee "; $query=$query."where Status=0 and employeeid not in (select machineid from empAttendance where day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_') "; //echo $query; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent1=(select '$from'+cast(entry1 as datetime) from empTimings where empTimings.employeeid=empAttendance.machineid and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ext1=(select '$from'+cast(exit1 as datetime) from empTimings where empTimings.employeeid=empAttendance.machineid and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ent2=(select '$from'+cast(entry2 as datetime) from empTimings where empTimings.employeeid=empAttendance.machineid and entry2 is not null and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $query="update empAttendance set ext2=(select '$from'+cast(exit2 as datetime) from empTimings where empTimings.employeeid=empAttendance.machineid and exit2 is not null and type='$type_') "; $query=$query." where date_='$from' "; $cur= odbc_exec( $conn, $query); $cur= odbc_exec( $conn, "update empAttendance set ent2=null,ext2=null where ent2='$from'"); $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, -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"); //Late Code=2 $query="update empAttendance set symbol2='2' where (symbol2 is null) and entryTime>DATEADD(MINUTE, 60, ent1) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $cur= odbc_exec( $conn, "update empAttendance set symbol2='0' where (date_='$from') AND (entryTime IS NOT NULL) and (symbol2 is null) "); $query="update empAttendance set symbol2='1' where (symbol2 is null) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); $query="update empAttendance set symbol2=null where (symbol2='1') and (ent1>getdate()) and (date_='$from') "; $cur= odbc_exec( $conn, $query ); //$dayName = date('D',strtotime($date_)); if(date('D',strtotime($date_))=='Sun') $cur= odbc_exec( $conn, "update empAttendance set symbol2=3 where date_='$from' " ); return $type_; } function calculateEmpAttendance($conn,$date_,$employeeid){ $from = date('Y-m-d',strtotime($date_)); $type_=getName($conn,"select case rate when '1') 'Normal' when '2') '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 symbol2 not in(select id from LeaveType where id>9) and machineid='$employeeid' and day(date_)='$day_' and month(date_)='$month_' and year(date_)='$year_'"); $query="insert into empAttendance (machineid,date_,symbol2,type_) "; $query=$query."select employeeid,'$from','1','$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 symbol2='0' 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 symbol2='2' where symbol2 not in(select id from LeaveType where id>9) 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); } ?>