151 lines
5.0 KiB
PHP
151 lines
5.0 KiB
PHP
<?php
|
|
// include('pdf_header.php');
|
|
include ('includes/config/config.php');
|
|
include ('includes/functions.php');
|
|
header('Content-Type: application/force-download');
|
|
header('Content-disposition: attachment; filename=opd_report_excel.xls');
|
|
error_reporting ( E_ERROR | E_PARSE );
|
|
$query_for_company="select company_name, company_logo, image_type from company_profile ";
|
|
//echo $query_for_company;
|
|
$result_for_company = @mysqli_query($conn,$query_for_company);
|
|
if($row_for_company = @mysqli_fetch_array($result_for_company)){
|
|
@extract($row_for_company);
|
|
}
|
|
$month=$_POST['month4'];
|
|
$year = $_POST['year4'];
|
|
// error_log($year);
|
|
$month_name = date("F", mktime(0, 0, 0, $month, 10));
|
|
?>
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
<body>
|
|
<table width="100%">
|
|
<tr>
|
|
|
|
<td align="center" style="font-size: 15px"><strong>OPD Report</strong></td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td align="left" style="font-size: 12px"><strong>For Month: <?php echo $month_name; ?></strong></td>
|
|
<td align="right" style="font-size: 15px"><button align ="center" id="printPageButton" class="btn btn-success" onClick="window.print();">Print</button></td>
|
|
</tr>
|
|
|
|
</table>
|
|
<br>
|
|
<table border="1" width="100%" cellspacing="0">
|
|
<tr>
|
|
|
|
<th align="center" width="2%">Date</th>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$sql="select * from ailment_system";
|
|
$result=mysqli_query($conn,$sql);
|
|
$total=mysqli_num_rows($result);
|
|
// error_log($total);
|
|
while($row=mysqli_fetch_assoc($result)){?>
|
|
|
|
<th align="center" width="5%" ><?php echo $row['ailment_sys_name']?></th>
|
|
<?php }?>
|
|
<th align="center" width="5%">Total</th>
|
|
<?php
|
|
$sqlc="select * from emp_cadre";
|
|
$resultc=mysqli_query($conn,$sqlc);
|
|
$totalc=mysqli_num_rows($resultc);
|
|
// error_log($total);
|
|
while($rowc=mysqli_fetch_assoc($resultc)){?>
|
|
|
|
<th align="center" width="5%" ><?php echo $rowc['remarks']?></th>
|
|
<?php }?>
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<?php for($i=1;$i<=31;$i++){?>
|
|
|
|
<tr>
|
|
<td width="2%" align="center"><?php echo $i?></td>
|
|
|
|
<?php
|
|
|
|
|
|
// error_log($year);
|
|
|
|
$sql1="select * from ailment_system";
|
|
$result1=mysqli_query($conn,$sql1);
|
|
$total1=mysqli_num_rows($result1);
|
|
// error_log("as".$total1);
|
|
$sum=0;
|
|
$sum_cadre_1=0;
|
|
$sum_cadre_2=0;
|
|
$sum_cadre_3=0;
|
|
for ($j=1;$j<=$total1;$j++){
|
|
|
|
$sqll="SELECT count(*) as total_patient FROM `employee_appointment` WHERE month(appointment_date)='$month' AND year(appointment_date)='$year' AND DATE_FORMAT(appointment_date, '%d')='".$i."' and ailment_systems_new='".$j."'";
|
|
|
|
$result2=mysqli_query($conn,$sqll);
|
|
$total2=mysqli_num_rows($result2);
|
|
$row0= mysqli_fetch_assoc($result2);
|
|
$sum+=$row0['total_patient'];
|
|
// error_log("abcde");
|
|
|
|
$sql_cadre="SELECT COUNT(*) as total_exec FROM `employee_appointment` a LEFT JOIN patient_master b on a.emp_id=b.id WHERE ailment_systems_new!=0 and month(appointment_date)='$month' AND year(appointment_date)='$year' AND DATE_FORMAT(appointment_date, '%d')='".$i."' AND b.emp_cadre=1 and ailment_systems_new='".$j."'";
|
|
|
|
error_log("executive ::",$sql_cadre);
|
|
|
|
$result3=mysqli_query($conn,$sql_cadre);
|
|
// $total3=mysqli_num_rows($result3);
|
|
$rowl= mysqli_fetch_assoc($result3);
|
|
$sum_cadre_1+=$rowl['total_exec'];
|
|
error_log("Sum cadre 1",$sum_cadre_1);
|
|
|
|
$sql_cadre2="SELECT COUNT(*) as total_non_exec FROM `employee_appointment` a LEFT JOIN patient_master b on a.emp_id=b.id WHERE ailment_systems_new!=0 and month(appointment_date)='$month' AND year(appointment_date)='$year' AND DATE_FORMAT(appointment_date, '%d')='".$i."' AND b.emp_cadre=2 and ailment_systems_new='".$j."'";
|
|
|
|
$result4=mysqli_query($conn,$sql_cadre2);
|
|
$total3=mysqli_num_rows($result4);
|
|
$rowll= mysqli_fetch_assoc($result4);
|
|
|
|
$sum_cadre_2+=$rowll['total_non_exec'];
|
|
|
|
$sql_cadre3="SELECT COUNT(*) as total_cont FROM `employee_appointment` a LEFT JOIN patient_master b on a.emp_id=b.id WHERE ailment_systems_new!=0 and month(appointment_date)='$month' AND year(appointment_date)='$year' AND DATE_FORMAT(appointment_date, '%d')='".$i."' AND b.emp_cadre=3 and ailment_systems_new='".$j."'";
|
|
|
|
$result5=mysqli_query($conn,$sql_cadre3);
|
|
$total5=mysqli_num_rows($result5);
|
|
$rowlll= mysqli_fetch_assoc($result5);
|
|
|
|
$sum_cadre_3+=$rowlll['total_cont'];
|
|
|
|
|
|
?>
|
|
<td>
|
|
<?php echo $row0['total_patient']?>
|
|
</td>
|
|
|
|
|
|
<?php }?>
|
|
<td><?php echo $sum?></td>
|
|
|
|
|
|
|
|
<td><?php echo $sum_cadre_1 ?></td>
|
|
|
|
|
|
|
|
|
|
<td><?php echo $sum_cadre_2 ?></td>
|
|
|
|
|
|
|
|
|
|
<td><?php echo $sum_cadre_3 ?></td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
<?php }?>
|
|
|
|
</table>
|
|
</body>
|