<?php require "_header.php"; 
	  require "data/sendingsms_studentpresant.php";

	$date=date("Y-m-d");

	$qry = "select 
				bm.branch_name,
				sm.semester_id,
				sbm.short_name,
				pm.day_present,
				pm.day_absent
		from 
			cms_presentmaster pm,
			cms_branchmaster bm,
			cms_semestermaster sm,
			cms_subjectmaster sbm,
			cms_batchmaster bhm 
	
		where 
			pm.branch_id=bm.branch_id 
			and pm.semester_id=sm.semester_id 
			and pm.subject_id=sbm.subject_id 
			and pm.batch_id=bhm.batch_id 
			and pm.college_id = '".$_SESSION["VedantnrCollegeId"]."' 
			AND pm.year_id = '".$_SESSION["VedantnrYearId"]."'
			and pm.day_date= '".$date."' 
			Order By branch_name,semester_name ASC";
			
			
			$rs=dbQuery($qry);
			if(dbRows($rs) > 0){
				$msg="Present For Date ".$date." Is \r\n";
			while($row = dbArray($rs)){
				
				$msg.= substr($row["branch_name"],0,4);
				$msg.="-".$row["semester_id"];
				$msg.="-".$row["short_name"];
				$temppr = explode(",",$row["day_present"]);
				$tempab = explode(",",$row["day_absent"]);
				$msg.="(P-".count($temppr).')';	
				$msg.="(A-".count($tempab).')';
				$msg.="\r\n";
				
			}
			
		}
		else
		{
			$msg="No Attendance Taken Date ".$date."";
		}
		
		sendSms($SmsUserName,$SmsPassword,$SmsSendapi,'9825598934',$msg);
		sendSms($SmsUserName,$SmsPassword,$SmsSendapi,'9879579809',$msg);
			
?>

<script language="javascript" type="text/javascript">
alert("Attendance Message Sent Success Fully");
location.href="loginhome.php";
</script>
<div id="abcd"></div>
<?php require "_footer.php";?>