Current File : /home/inlingua/public_html/dwarka/icentex/admin_cert/visit_rpt.php |
<?php
include("header_cert.php");
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$month=$_REQUEST[month];
$year=$_REQUEST[year];
//$num = cal_days_in_month(CAL_GREGORIAN, $month, $year);
//$date1="".$year."-".$month."-01";
//$date2="".$year."-".$month."-".$num."";
$date1=$_REQUEST['startdate'];
$date2=$_REQUEST['enddate'];
//$dat=date("F Y",strtotime($date1));
$dat="".$date1." to ".$date2."";
?>
<h3>
Visit Reports (<a href="<?php echo "reports/visit_".$date1." to ".$date2.".xlsx" ?>" target="_blank">Download Excel Report</a>)
</h3>
<div id="contentnew">
<?php
echo "<b>Duration : ".$dat." For ".$_REQUEST['location']."</b>";
$query="select * from timesheet_user where (usertype='fd' || fd='Y') && status='Active'";
if($_REQUEST['location']!="All")
{
$query.=" && primarycenter='".$_REQUEST['location']."'";
}
$query.=" order by name";
//echo $query;
$result=mysqli_query($conn,$query);
$tota=0;
$totb=0;
$totc=0;
$totd=0;
$tote=0;
echo"<table width='100%'><tr class='rowH'><td>Instructor</td>
<td>Visits</td><td>Written Test</td><td>Oral Test</td><td>Need Analysis</td><td>Cancelled Visits</td></tr>";
while($num=mysqli_fetch_array($result))
{
$queryTot="select count(*) as totreg from ingl_admission where createdBy='".$num['recNo']."' && status_delete='0' && date(createDate)>='".$date1."' && date(createDate)<='".$date2."'";
$resultTot=mysqli_query($conn,$queryTot);
$numTot=mysqli_fetch_array($resultTot);
$queryTot1="select count(*) as totreg1 from ingl_admission where createdBy='".$num['recNo']."' && status_delete='1' && date(createDate)>='".$date1."' && date(createDate)<='".$date2."'";
$resultTot1=mysqli_query($conn,$queryTot1);
$numTot1=mysqli_fetch_array($resultTot1);
$queryW="select count(*) as totregW from ingl_test_answer a left join ingl_admission b on a.student_id=b.recNo where b.createdBy='".$num['recNo']."' && date(b.createDate)>='".$date1."' && date(b.createDate)<='".$date2."'";
$resultW=mysqli_query($conn,$queryW);
$numW=mysqli_fetch_array($resultW);
$queryO="select count(*) as totregO from ingl_test_oral a left join ingl_admission b on a.student_id=b.recNo where b.createdBy='".$num['recNo']."' && date(b.createDate)>='".$date1."' && date(b.createDate)<='".$date2."'";
$resultO=mysqli_query($conn,$queryO);
$numO=mysqli_fetch_array($resultO);
$queryA="select count(*) as totregA from ingl_admission_analysis a left join ingl_admission b on a.ingl_student=b.recNo where b.createdBy='".$num['recNo']."' && date(b.createDate)>='".$date1."' && date(b.createDate)<='".$date2."'";
$resultA=mysqli_query($conn,$queryA);
$numA=mysqli_fetch_array($resultA);
?>
<tr><td><?php echo $num['name'] ?></td>
<td><?php echo $numTot['totreg'] ?></td><td><?php echo $numW['totregW'] ?></td>
<td><?php echo $numO['totregO'] ?></td><td><?php echo $numA['totregA'] ?></td><td><?php echo $numTot1['totreg1'] ?></td></tr>
<?php
$tota=$tota+$numTot['totreg'];
$totb=$totb+$numW['totregW'];
$totc=$totc+$numO['totregO'];
$totd=$totd+$numTot1['totreg1'];
$tote=$tote+$numA['totregA'];
}
?>
<tr class='rowH'><td>Total</td>
<td><?php echo $tota ?></td><td><?php echo $totb ?></td><td><?php echo $totc ?></td><td><?php echo $tote ?></td><td><?php echo $totd ?></td></tr>
</table>
</div>
<?php
include("05featuredemo1_visit.php");
include("footer_cert.php");
?>