<?php 
$pgMod="alert";
$pgAct="view";
if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);


if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}

?>

<!-- nitish code start-->

<form method="post" action="">.
    <div class="row-fluid">
        <div class="control-group">
            <div class="controls span3">
                                <select onchange="changeIns()" name="class" id="class">
                                    <option value="">Class</option>
                                    <?php 
                                        $class=$db->getRows("select * from class  where school_id='".$_SESSION["admin"]["school_id"]."'");
                                        foreach($class as $cla){
                                            ?>
                                            <option <?php if($cla["class"]==$_GET["class"])echo 'selected';?> value="<?php echo $cla["class"] ?>">
                                                <?php echo $cla["class"] ?>
                                            </option>
                                            <?php
                                        }
                                    ?>
                                </select>
                            </div>
            <div class="span3"><input required type="date" id="tfrom" name="tfrom" class="input-block-level" value="<?php if($_POST)echo $_POST["tfrom"];?>"></div>
            <div class="span3"><input type="submit" class="btn" /></div>
        </div>
    </div>
</form>

<!-- nitish code end-->
 
<div class="row-fluid"><div class="span12"><div class="top-bar">
<h3><i class="icon-eye-open"></i> <?php echo ucwords($pgAct." ".$pgMod); ?></h3>
	<div style="float:right; margin-top:5px">
        <a onclick="printDiv('printableDiv')" class="btn btn-primary" target="_blank">Print</a>
   <button type="button"  onclick="SMS('birthdaysms_detail')" class="btn btn-primary">SMS</button>

    </div>
</div>
<div class="well no-padding" id="printableDiv">
<?php

$aryPgAct=array("page_id"=>$pgMod,"action"=>"add");

$between="";
if(isset($_POST["tfrom"])){

$sdate=$_POST["tfrom"];
$newDate = date("%-m-d", strtotime($sdate));

if(isset($_POST["class"]) && trim($_POST["class"])!=""){
			$where[]=" class='".$_POST["class"]."' ";
			$conwhere.=" and class='".$_POST["class"]."' ";
		}
$aryList=$db->getRows("SELECT *  FROM student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'  and dob like'".$newDate."' $conwhere");

//echo $s="SELECT *  FROM student where school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."'  and dob like'".$newDate."' $conwhere"; 



 $i=0;$total="";
if(is_array($aryList) && count($aryList)>0)
{
	$tndate = date('Y/m/d', strtotime('-1 days',strtotime($_POST["tto"])));
			//echo $tndate." ".$fdate
			?>
            
	
	
	<table class="table">
		<thead>
			<tr>
			
				<th>Serial No</th>
				<th>Name</th>
				
				<th>Father Name</th>
				<th>DOB</th>
				<th>Class</th>
				<th>Admission No</th>
				<th>Dob</th>
				<!--<th>Income date</th>
                <th>Payment for</th> -->
				
			</tr>
		</thead>
		<tbody>
		<?php foreach($aryList as $clist){ $i++; 
		
		?>
			<tr>
	<input type="hidden" name="sid[]" value="<?php echo $clist["idno"] ?>" />

				<td><?php echo $i; ?></td>
				<td><?php echo $clist["name"] ?></td>
				<td><?php echo $clist["fname"] ?></td>
				<td><?php echo $clist["dob"] ?></td>
                <td><?php echo $clist["class"] ?></td>				
				<td><?php echo $clist["admissionno"] ?></td>
                <td><?php echo $clist["dob"] ?></td>				
			</tr>
		<?php } ?>
		</tbody>
		
	</table>
	<?php
}
else{
	?>
	<div class="alert alert-info">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> Record not found </i>
	</div>
	<?php
}
}
?>
</div></div></div>
<?php

?>
<script type="text/javascript">

function SMS(type){
	var ids=document.getElementsByName('sid[]');
	var detail=document.getElementsByName('details[]');
	var arr = [];
	for(var i=0;i<ids.length;i++){
		arr.push(ids[i].value);
	}
	
	var Fee=arr.join(",");
//	alert(Fee);
	$.post( "ajax.php", { type: type ,fee: Fee} , function( data ) {
		alert("message sent successfully");
	});
}
</script>
<!-- / Forms -->