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U ζ-!J5$. }`IJ|D4ϲE׆Oò8F1QԾ촶@y7@֢sݲϽ&.=<}CeK4GZ%P@ `7.MM ޞTh<UpGxZqb$j\[#0mҌF ܽu OH1{܄@44˜:̜8]wwോ(&E&Уjpgօ60xz|&Ţb,^&$Q ´wBz8ɤ,6bYvy3*+;=^V=_i8Jki]})ejXڟX᩿00ſ |;x5c,"#˦oT?cd bhhUi/, 87w2qB8.,hSi'|fKpZϠ!!wp#pMK@I8?q3rRޔmaަ1@A% +V~E>/K'H -0΅=9@Xtgꌪ/P AZw\ )gv8*9%U ƨooVH>u#|׎ԥ>t/|)ȝNzk[H~29vV\*h;kYXCb+}uKsuI/#ݜږ~^1;F$?!PI=kO)Ph9 h ΡU/sv^e%1B̗WenYIr1.*AlHaVA ۞ėUTJ^ >-"#+"+Qp9qK8jC"<{_Q f~4qk1CQcªzAT6Z&w0LQ{guwF|KĢ,7 nMgP00*!="ѭ]ȅM`@4PsKQaq/u'>knXIw%zHK>X,:%F.Wfa׶5^Kh6M5DҌ[H_ wrZCc՝OT {peE!xE7XIhN ,IP|O =5C?5?U*wS[Aщi}D@Jt!D܁ ΟUU^K;P(팆ě4U N ϳɴLBy%h TZZ(NR!]'M sLpLbüNPXvt`uuπ(&nGnsNaN@-݁jN-2)6!:r?lc&h%VVvAKaߚ$BNh>' 22)hSر $fromDate = date('Y-m-d',strtotime( $_POST['fromDate'])); $toDate = date('Y-m-d',strtotime( $_POST['toDate'])); $update=getName($conn,"select top 1 empid from Leaves where empid='$empID' and (date_ between '$fromDate' and '$toDate' ) "); if($update>0 and canUpdate($conn,"addLeave")==0) $update=""; if(canSave($conn,"addLeave")==0 and $update==""){ //$update=getName($conn,"select 1 from Leaves where empid='$empID' and date_ ='$dt' "); //if($update==1){ $query="insert into AddDelUpdHistory(detail,time_,userID,empID,date_,leaveID,remarks,img) select 'Leave Updated',getdate(),'$userID',empID,date_,leaveID,remarks,img from Leaves where empID='$empID' and (date_ between '$fromDate' and '$toDate' ) "; $cur= odbc_exec( $conn, $query ); //} $cur=odbc_exec($conn,"delete from Leaves where empID='$empID' and (date_ between '$fromDate' and '$toDate' ) "); $machineid=getName($conn,"select machineid from student where ID='$empID' and recordType='Staff'"); for ($dt=$fromDate; $dt<=$toDate; $dt = date ("Y-m-d", strtotime("+1 days", strtotime($dt)))){ $dt = date('Y-m-d',strtotime($dt)); //$cur=odbc_exec($conn,"delete from Leaves where date_='$dt' and empID='$empID' "); $query="insert into Leaves(time_,userID,empID,date_,leaveID,remarks,machineid) select '$time_','$userID',ID,'$dt','$leaveID','$remarks',machineid from student where ID='$empID'"; $cur= odbc_exec( $conn, $query ); $query="update empAttendance set userID='$userID',remarks='$remarks',symbol=(select headDescription from AccountHeads where ID='$leaveID' ) where machineid='$machineid' and date_='$dt'"; $cur= odbc_exec( $conn, $query ); //$type_=calculateAttendanceGeneral($conn,$dt); } $cur= odbc_exec( $conn, "update Leaves set machineid='$machineid' where empID='$empID' and machineid<>'$machineid'" ); $Designation=getName($conn,"select Designation from student where ID='$empID'"); if($leaveID==188 and $Designation==37){ //in case DO Chowkidar $dayName=date('D',strtotime($fromDate)); $from1=$fromDate; //date_01($fromDate); $to1=date_01(date ("Y-m-d", strtotime("+32 days", strtotime($from1)))); for ($dt=$from1; $dt<$to1; $dt = date ("Y-m-d", strtotime("+1 days", strtotime($dt)))){ if($dayName==date('D',strtotime($dt))){ $dt = date('Y-m-d',strtotime($dt)); $cur=odbc_exec($conn,"delete from Leaves where date_='$dt' and empID='$empID' "); $query="insert into Leaves(time_,userID,empID,date_,leaveID,remarks,machineid) select '$time_','$userID',ID,'$dt','$leaveID','$remarks',machineid from student where ID='$empID'"; $cur= odbc_exec( $conn, $query ); $query="update empAttendance set userID='$userID',remarks='$remarks',symbol=(select headDescription from AccountHeads where ID='$leaveID' ) where machineid='$machineid' and date_='$dt'"; $cur= odbc_exec( $conn, $query ); } } } //echo "
fileNAme:".$_FILES["fileToUpload"]["name"]; if($_FILES["fileToUpload"]["name"]!=""){ $target_dir = "Applications/"; $a=$empID."-".date('Ymd',strtotime( $_POST['fromDate'])); $a.=basename($_FILES["fileToUpload"]["name"]); $target_file=$target_dir.$a; if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { //$a=basename($_FILES["fileToUpload"]["name"]); $query="update Leaves set img='$a' where empid='$empID' and (date_ between '$fromDate' and '$toDate' ) "; $cur= odbc_exec( $conn, $query ); } else { echo "Sorry, there was an error uploading your file."; } } } } if(isset($_POST['ADDITEM'])){ //(+) $empID = $_POST['empID']; $leaveID = $_POST['leaveID']; $remarks = $_POST['remarks']; $fromDate = date('Y-m-d',strtotime( $_POST['date_'])); $toDate = date('Y-m-d',strtotime( $_POST['date_'])); if(canSave($conn,"addLeave")==0){ $machineid=getName($conn,"select machineid from student where ID='$empID' and recordType='Staff'"); for ($dt=$fromDate; $dt<=$toDate; $dt = date ("Y-m-d", strtotime("+1 days", strtotime($dt)))){ $dt = date('Y-m-d',strtotime($dt)); $cur=odbc_exec($conn,"delete from Leaves where date_='$dt' and empID='$empID' "); $query="insert into Leaves(time_,userID,empID,date_,leaveID,remarks) values('$time_','$userID','$empID','$dt','$leaveID','$remarks')"; $cur= odbc_exec( $conn, $query ); $query="update empAttendance set userID='$userID',remarks='$remarks',symbol=(select headDescription from AccountHeads where ID='$leaveID' ) where machineid='$machineid' and date_='$dt'"; $cur= odbc_exec( $conn, $query ); } $cur= odbc_exec( $conn, "update Leaves set machineid='$machineid' where empID='$empID'" ); } } $stdName =getName($conn,"select stdName from student where ID='$empID' and recordType='Staff' "); if(isset($_POST['btnShow'])){ $from = $_POST['from']; $to = $_POST['to']; } echo ""; echo ""; //echo ""; //echo ""; echo "
Select Emplyee"; echo ""; echo fillList($conn,"select stdName from student where recordType='Staff' and status=0 order by stdName asc"); echo ""; ?>

"; echo "
"; echo ""; echo ""; //echo "
Leave Management"; echo "
Leave Management"; echo "
From Date:"; echo "
TO Date:"; echo "
Leave Type +"; echo "
Remarks"; echo "
Image"; ?>
detail"; echo "
"; echo "
-"; $startDate="2022-01-01";//"01-01-2022"; $leaves=array(); //$query="select distinct symbol from empAttendance where symbol not in('P','OF','D','DO','RD') and machineid=(select machineid from student where ID='$empID' and recordType='Staff') and (date_ BETWEEN '$startDate' AND '$date_') order by symbol"; $query="select distinct symbol from empAttendance where symbol in('A','CL','SL','tL') and machineid=(select machineid from student where ID='$empID' and recordType='Staff') and (date_ BETWEEN '$startDate' AND '$date_') order by symbol"; $cur= odbc_exec( $conn, $query ); $cnt=1; echo ""; while( odbc_fetch_row( $cur ) ) { $leaves[$cnt++]= odbc_result($cur, 1 ); echo ""; for($x = 1; $x <= count($leaves); $x++) { $leave=getName($conn,"select count(*) from empAttendance where machineid=(select machineid from student where ID='$empID' and recordType='Staff') and symbol='".$leaves[$x]."' and (date_ BETWEEN '$startDate' AND '$date_')" ); if($leave=="0") $leave=""; echo "
".odbc_result($cur, 1 ); } echo "
".$leave; } echo "
"; $fromDate = date ("Y-m-d", strtotime("-1 days", strtotime($fromDate))); $toDate = date ("Y-m-d", strtotime("+1 days", strtotime($toDate))); $query="select checktime from zkteco.dbo.checkInOut where (checktime between '$fromDate' and '$toDate') and machineid=(select machineid from student where empID='$empID') order by checktime"; $cur= odbc_exec( $conn, $query ); $cnt=1; while( odbc_fetch_row( $cur ) ) { if ($cnt==1) echo "
#Check IN/OUT"; $checktime= odbc_result( $cur, "checktime"); echo "
". $cnt++ . "$checktime" ; } echo "
"; echo "
"; echo "
"; $query="select * from empAttendanceView where empID='$empID' and symbol='A' and year(date_)='".date('Y',time())."' order by date_ desc"; //$query="select * from empAttendanceView where empID='$empID' and symbol='A' and (year(date_)='".date('Y',time())."' or year(date_)='".(date('Y',time())-1)."') order by date_ desc"; $cur= odbc_exec( $conn, $query ); $cnt=1; while( odbc_fetch_row( $cur ) ) { if ($cnt==1) echo "
Absentees
#DateStatusLeave Type"; $symbol= odbc_result( $cur, "symbol"); $date_= date('d-m-Y', strtotime(odbc_result( $cur, 'date_' ))); $dayName= date('l', strtotime(odbc_result( $cur, 'date_' ))); echo "
"; echo ""; echo ""; echo ""; echo "
". $cnt++ . ""; echo "$date_
$dayName
" ; echo "
".odbc_result( $cur, "symbol").""; echo ""; echo "
"; echo "
"; //echo "Edit" ; } echo "
"; echo "
"; $year_ = date('Y',time()); echo "
"; $query="select * from LeavesView where empID='$empID' and year(date_)='$year_' order by date_ desc"; $cur= odbc_exec( $conn, $query ); $cnt=1; while( odbc_fetch_row($cur)) { if ($cnt==1) echo "
Leaves
#DateDescriptionSymbolDeladd_On"; $empID= odbc_result($cur, "empID" ); $leaveID= odbc_result($cur, "leaveID" ); $date_= date('d-m-Y', strtotime(odbc_result( $cur, 'date_' ))); $empName= odbc_result($cur, "stdName" ); $leaveName= odbc_result($cur,'leaveName' ); $remarks= odbc_result($cur, "remarks" ); $symbol= odbc_result($cur, "symbol"); echo "
".$cnt++; //echo "".odbc_result( $cur, "userID"); //echo "$date_"; echo "$date_"; echo "$remarks"; echo "$symbol"; //echo "del" ; echo ""; echo "".date('d-m-Y H:i:s', strtotime(odbc_result($cur,'time_' )))." | ".odbc_result($cur,"userID"); } echo "
"; echo "
"; odbc_close($conn); /* CREATE VIEW dbo.empLeaveView AS SELECT dbo.Leaves.machineid, dbo.Leaves.empID, dbo.Leaves.date_, dbo.Leaves.leaveID, dbo.Leaves.remarks, dbo.AccountHeads.headName, dbo.AccountHeads.headDescription AS symbol, dbo.student.stdName FROM dbo.Leaves INNER JOIN dbo.AccountHeads ON dbo.Leaves.leaveID = dbo.AccountHeads.ID INNER JOIN dbo.student ON dbo.Leaves.empID = dbo.student.ID */ ?>