ESH/monthly_cases_report.php
2024-10-23 18:28:06 +05:30

250 lines
7.9 KiB
PHP

<?php
include('pdf_header_reverse.php');
//include('pop_up_top.php');
// include('includes/config/config.php');
// include('includes/functions.php');
include('log_entry.php');
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<?php
$month = $_POST['summary_month'];
$month_name = date("F", mktime(0, 0, 0, $month, 10));
$y = $_POST['summary_year'];
?>
<?php $sql_comp = "select * from company_profile where company_id=5";
$result_comp = mysqli_query($GLOBALS['conn'],$sql_comp);
$row_comp = mysqli_fetch_array($result_comp); ?>
<table width="100%" >
<tr><div style="font-size:12px">
<td width="100%" align="center" style="font-size:20px"><strong><?php echo $row_comp['company_name']?></strong></td>
</tr>
<tr>
<td colspan="2" align="center" ><strong><?php echo $row_comp['address']?></strong></td>
</tr>
<tr>
<td colspan="2" align="center" ><strong>SUMMARY OF MONTHLY CASES</strong></td>
</tr>
<tr>
<td colspan="2" align="left"><strong>For Month: <?php echo $month_name?></strong></td>
</tr>
</table>
<table border="1" cellspacing="0" width="100%">
<tr>
<th>SR.NO</th>
<th>Doctor's Name/Paramedic</th>
<th>OPD CASES</th>
<th>INJURY CASES</th>
<th>FITNESS CASES</th>
<th>PEME CASES</th>
<th>PEME SHORT DURATION CASES</th>
<th>POHC CASES</th>
<th>EYE CHECKUP CASES</th>
<th>FOOD HANDLER EXAMINATION CASES</th>
<th>MOCKDRILL CASES</th>
<th>HEIGHT AND BAR TEST CASES</th>
</tr>
<?php
function getMonthlyOpdCount($id)
{
if($id == '25'){
$sql_division = "select count(*) count from employee_appointment where appointment_type='O' and month(appointment_date) = '".$_POST['summary_month']."' and year(appointment_date) = '".$_POST['summary_year']."' and doctor_attended_flag = 'N'";
}
else{
$sql_division = "select count(*) count from employee_appointment where appointment_type='O' and month(appointment_date) = '".$_POST['summary_month']."' and year(appointment_date) = '".$_POST['summary_year']."' and modified_by = '$id'";
}
error_log("OPD QUERY:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array( $result_name )) {
error_log("OPD count1:".$row_name ['count']);
return $row_name ['count'];
}
error_log("OPD count2:".$row_name ['count']);
}
function getMonthlyInjuryCount($id)
{
if($id == '25'){
$sql_division = "select count(appointment_id) count from employee_appointment where appointment_type='I' and month(appointment_date) = '".$_POST['summary_month']."' and year(appointment_date) = '".$_POST['summary_year']."' and doctor_attended_flag = 'N'";
}
else{
$sql_division = "select count(appointment_id) count from employee_appointment where appointment_type='I' and month(appointment_date) = '".$_POST['summary_month']."' and year(appointment_date) = '".$_POST['summary_year']."' and modified_by = '$id'";
}
error_log("Injury QUERY:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlySicknessCount($id)
{
$sql_division = "select count(sickness_id) count from sickness where year(sickness_date) = '".$_POST['summary_year']."' and month(sickness_date) = '".$_POST['summary_month']."' and modified_by = '$id' ";
error_log("OPD sicjness :".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlyPEMECount($id)
{
$sql_division = "select count(medical_exam_id) count from medical_examination where task='peme' and year(medical_entry_date) = '".$_POST['summary_year']."' and month(medical_entry_date) = '".$_POST['summary_month']."' and modified_by = '$id' ";
error_log("OPD peme:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlyPEMEShortCount($id)
{
$sql_division = "select count(medical_exam_id) count from medical_examination where task='peme_short' and year(medical_entry_date) = '".$_POST['summary_year']."' and month(medical_entry_date) = '".$_POST['summary_month']."' and modified_by = '$id' ";
error_log("OPD pme short:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlyPOHCCount($id)
{
$sql_division = "select count(medical_exam_id) count from medical_examination where task='pohc' and year(medical_entry_date) = '".$_POST['summary_year']."' and month(medical_entry_date) = '".$_POST['summary_month']."' and modified_by = '$id' ";
error_log("OPD pohc:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlyFoodHandExamCount($id)
{
$sql_division = "select count(medical_exam_id) count from medical_examination where task='foodhand_exam' and year(medical_entry_date) = '".$_POST['summary_year']."' and month(medical_entry_date) = '".$_POST['summary_month']."' and modified_by = '$id' ";
error_log("OPD food hand:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlyEyeCheckupCount($id)
{
$sql_division = "select count(medical_exam_id) count from medical_examination where task='eye_check' and year(medical_entry_date) = '".$_POST['summary_year']."' and month(medical_entry_date) = '".$_POST['summary_month']."' and modified_by = '$id' ";
error_log("OPD eye:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
function getMonthlyWahCount($id)
{
$sql_division = "select count(wah_id) count from work_at_height_details_new where year(screen_date) = '".$_POST['summary_year']."' and month(screen_date) = '".$_POST['summary_month']."' and attended_statuus= '$id'";
error_log("OPD wah:".$sql_division);
$result_name = mysqli_query($GLOBALS['conn'], $sql_division );
if ($row_name = @mysqli_fetch_array ( $result_name )) {
return $row_name ['count'];
}
}
$sql_med = "select user_id,user_name from tbl_users where role_id = '8' or role_id='10' or user_id = '25' order by user_id desc";
error_log("USERS QUERY:".$sql_med);
$result_med = mysqli_query($GLOBALS['conn'],$sql_med);
$num_med = mysqli_num_rows($result_med);
$count = 0;
while($row_med = mysqli_fetch_array($result_med)){
error_log("user_name:".$row_med['user_name']);
error_log("user_id:".$row_med['user_id']);
$count_opd= getMonthlyOpdCount($row_med['user_id']);
error_log("result_med:".$count_opd);
// error_log("result_med:".$result_med);
if($row_med['user_name'] == 'medicalteam'){
$row_med['user_name'] = 'PARAMEDIC STAFF';
}
?>
<tr>
<td><?php echo ++$count?></td>
<td width="15%"><?php echo $row_med['user_name']?></td>
<td><?php echo getMonthlyOpdCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyInjuryCount($row_med['user_id'])?></td>
<td><?php echo getMonthlySicknessCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyPEMECount($row_med['user_id'])?></td>
<td><?php echo getMonthlyPEMEShortCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyPOHCCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyEyeCheckupCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyFoodHandExamCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyFoodHandExamCount($row_med['user_id'])?></td>
<td><?php echo getMonthlyWahCount($row_med['user_id'])?></td>
</tr>
<?php }?>
</table>
</body>
<?php
include('pdf_footer.php');
?>