| Current Path : /var/www/html/mmishra/icure/patient/ |
| Current File : /var/www/html/mmishra/icure/patient/registrations.inc |
<?php
$reg = $_REQUEST["reg"];
switch ($reg) {
case 'daily':
$ttl = 'Todays';
$regdate = date('Y-m-d');
break;
case 'monthly':
$ttl = 'Monthly';
$regdate = date('Y-m-');
break;
default:
$ttl = 'Yearly';
$regdate = date('Y-');
break;
}
?>
<h3 align='left'><?php echo $ttl; ?> Registrations</h3>
<center>
<table width='90%' border='1'>
<tr valign='top'>
<?php
$heads = array('Registration For','Registration By','Pathology Tests By','Patient Categorywise','Student Batchwise','Student Coursewise','Student Genderwise','Student Hostelwise','Student Bloodgroupwise');
$sqls = array("select concat(dr_name,', ',specialization) as doctor,count(reg_no) as patients
from registrations as a, doctors as b
where a.dr_id=b.dr_id and reg_date like '$regdate%' group by a.dr_id",
"select concat(ph_name,', ',specialization) as staff,count(reg_no) as patients
from registrations as a, staffs as b
where a.login_id=b.ph_id and reg_date like '$regdate%' group by a.login_id",
"select concat(ph_name,', ',specialization) as staff,count(distinct reg_no) as patients
from phresults as a, staffs as b
where a.login_id=b.ph_id and test_regdate like '$regdate%' group by a.login_id",
"select pat_group as Category,count(reg_no) as patients
from registrations
where reg_date like '$regdate%' group by pat_group",
"select year as batch,count(reg_no) as patients
from students as a,registrations as b
where a.roll_no=b.pat_id and reg_date like '$regdate%' group by year",
"select course_name,count(reg_no) as patients
from students as a,registrations as b
where a.roll_no=b.pat_id and reg_date like '$regdate%' group by course_name",
"select gender,count(reg_no) as patients
from students as a,registrations as b
where a.roll_no=b.pat_id and reg_date like '$regdate%' group by gender",
"select hostel_no,count(reg_no) as patients
from students as a,registrations as b
where a.roll_no=b.pat_id and reg_date like '$regdate%' group by hostel_no",
"select bg as blood_group,count(reg_no) as patients
from students as a,registrations as b
where a.roll_no=b.pat_id and reg_date like '$regdate%' group by bg");
$cols = 3;
$colw = 100/$cols;
$no = 0;
foreach ($sqls as $sql) {
echo "<td width='$colw%' align='center'><b>".$heads[$no]."</b><br><br>";
$no++;
$tno = 0;
$rs = mysql_query($sql);
if (mysql_num_rows($rs)) {
$colHeads = mysql_num_fields($rs);
echo "<table border='0' width='90%' align='center'>
<tr><th>Sr</th>";
for ($i=0; $i < $colHeads; $i++) { // Header
echo "<th>".ucwords(str_replace("_"," ",mysql_field_name($rs, $i)))."</th>";
}
echo "</tr>";
$j = 0;
while ($row = mysql_fetch_row($rs)) { //data
$j++;
if ($j % 2 == 0)
echo "<tr bgcolor='lightpink'><td>$j</td><td>".implode($row,'</td><td>')."</td></tr>";
else
echo "<tr><td>$j</td><td>".implode($row,'</td><td>')."</td></tr>\n";
$tno = $tno + $row[1];
}
echo "<tr><th colspan='2'>Total</th><th>$tno</th></tr></table><br>";
} else {
echo "---";
}
echo "</td>";
$k++;
if ($k % $cols == 0) echo "</tr><tr valign='top'>";
}
?>
</tr></table>