PK

ADDRLIN : /home/anibklip/babekehospital.org/dAdmin/
FLL :
Current File : /home/anibklip/babekehospital.org/dAdmin/appointments.php

<?php
	include "include/session.php";  
	include "include/configure.php";
	include "include/header.php"; 
?>
	<div class="openHead">Manage Appointments</div>
    <div class="middleMainContainer"> 
 		<table class="listTb" border="1" cellpadding="0" cellspacing="0" width="100%">
            <tr class="addTdRow">
                <td align="right" colspan="6" >
                	<form method="get" action="appointments.php" class="searchApt">
                        <input type="text" style="width:68px;" value="<?=($_GET['apDt']!="")?$_GET['apDt']:DATE('Y-m-d');?>" readonly="readonly" id="apDt" name="apDt" class="apDt">
                        <script type="text/javascript">Zapatec.Calendar.setup({ 	inputField  : "apDt",  ifFormat    : "%Y-%m-%d", button      : "apDt"  });</script>
                        <input type="submit" class="smtButton" name="act" value="Search">
                    </form>
                 </td>
            </tr>
            <tr>
            	<th align="left" width="10%">&nbsp; SNo</th>
                <th align="left" width="25%">Department</th>
                <th align="left" width="25%">Doctor</th>
                <th align="left" width="15%" style="text-align:center;" >Appointment</th>
                <th align="left" width="10%" style="text-align:center;" >Action</th>
            </tr>
            <?php
			$page_name="appointments.php"; 
			
			$sqlCondtion = "";
			if(isset($_GET['apDt']) && $_GET['apDt']!=""){
				$sqlCondtion = " and a.appointment_date = '".$_GET['apDt']."' ";	
			}else{
				$sqlCondtion = " and a.appointment_date = '".DATE('Y-m-d')."' ";	
			}
			
			if(!isset($_REQUEST["start"])) {
				$start = 0;
			}
			else
			$start = $_REQUEST["start"];
			
			$eu = ($start - 0); 
			$limit = 20;          
			$this1 = $eu + $limit; 
			$back = $eu - $limit; 
			$next = $eu + $limit; 
			$sql = mysql_query("limit $eu, $limit");
			
			$sqlSeller = "SELECT d.*,count(a.doctor_id) as totalAppointment,a.doctor_id,a.appointment_date,dp.categoryName FROM appointments as a,doctors as d,department as dp where dp.id=d.department_id and a.doctor_id=d.id  ".$sqlCondtion." group by a.doctor_id ORDER BY a.id DESC limit $eu, $limit";
			$sqltot = "SELECT d.*,count(a.doctor_id) as totalAppointment,a.doctor_id,a.appointment_date,dp.categoryName FROM appointments as a,doctors as d,department as dp where dp.id=d.department_id and a.doctor_id=d.id  ".$sqlCondtion." group by a.doctor_id ORDER BY a.id DESC";
		
			$resultSeller= mysql_query($sqlSeller);
			$resulttot=mysql_query($sqltot);
			$nume=mysql_num_rows($resulttot);
			if (@mysql_num_rows($resultSeller)!=0){
				$sno=0;
            	
				while($rows=mysql_fetch_array($resultSeller)){
					$sno++;
					echo '<tr>
						<td>&nbsp; '.$sno.'</td>
						<td>'.$rows['categoryName'].'</td>
						<td>'.$rows['firstName'] . ' '.$rows['lastName'].'</td>
						<td align="center">'.$rows['totalAppointment'].'</td>
						<td align="center"><a target="_blank" href="appointmentsPrint.php?dt='.$rows['appointment_date'].'&dID='.$rows['doctor_id'].'" title="Print Report"><img src="img/print.png" alt="Print" /></a></td>
					</tr>';
				}
			
			?>
            <tr>
            	<td colspan="6">
                <?php
					echo "<table align = 'center' width='100%'><tr><td  align='left' width='30%'>";
					//// if our variable $back is equal to 0 or more then only we will display the link to move back ////////
					if($back >=0) { 
					print "<a href='$page_name?start=$back'><font face='Verdana' size='2'>PREV</font></a>"; 
					} 
					//////////////// Let us display the page links at  center. We will not display the current page as a link ///////////
					echo "</td><td align=center width='30%'>Page:";
					$i=0;
					$l=1;
					$total=0;
					for($i=0;$i < $nume;$i=$i+$limit){
					if($i <> $eu){
					echo " <a href='$page_name?start=$i'><font face='Verdana' size='2'>$l</font></a> ";
					}
					else { echo "<font face='Verdana' size='2' color=red>$l</font>";}        /// Current page is not displayed as link and given font color red
					$l=$l+1;
					$total = $total+1;
					}
					echo " of $total</td><td  align='right' width='30%'>";
					
					///////////// If we are not in the last page then Next link will be displayed. Here we check that /////
					if($this1 < $nume) { 
					print "<a href='$page_name?start=$next'><font face='Verdana' size='2'>NEXT</font></a>";} 
					echo "</td></tr></table>";
					?>
                </td>
            </tr><?php
            }else{
				echo "<tr>
					<td colspan='6' align='center'>No Data Found.</td>
				</tr>";
			} ?>
        </table>
        
    </div>
<?php include "include/footer.php"; ?>


PK 99