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

68 lines
3.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=peme_short_term.xls');
error_reporting ( E_ERROR | E_PARSE );
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<? include('excel_ohc_header.php');?>
<table border="1" width="100%">
<?
$month2=$_POST['month2'];
$year = $_POST['year2'];
$current_ohc = $_SESSION['current_ohcttype'];
//$sql_waste="SELECT c.ohc_type_name,a.waste_category_name,b.* FROM `waste_category` a inner join bio_medical_waste b on a.waste_category_id=b.waste_category inner join ohc_type c on c.ohc_type_id=b.ohc_type_id where b.ohc_type_id='".$_SESSION['current_ohcttype']."' ";
//$results_issue_items = mysqli_query($GLOBALS['conn'], $sql_issue_items);
//$sql=base64_decode($filterkey);
//$results= mysqli_query($GLOBALS['conn'], $sql_waste);
$sqll="SELECT count(*) as total FROM `medical_examination` a JOIN patient_master b on a.patient_id=b.id WHERE MONTHNAME(STR_TO_DATE(DATE_FORMAT(a.medical_entry_date, '%m'), '%m'))='".$month2."' AND year(a.medical_entry_date) =$year and task='peme_short' and a.ohc_location_id='$current_ohc' ORDER BY a.medical_entry_date ASC";
$result_sqll=mysqli_query($GLOBALS['conn'], $sqll);
$num_rows=mysqli_num_rows($result_sqll);
$row0= mysqli_fetch_assoc($result_sqll);
// error_log("total".$row0['total']);
$sql="SELECT DATE_FORMAT(a.medical_entry_date, '%d-%m-%y') as date,a.*,b.patient_name,b.dept_id,b.employer_contractor_id FROM `medical_examination` a JOIN patient_master b on a.patient_id=b.id WHERE MONTHNAME(STR_TO_DATE(DATE_FORMAT(a.medical_entry_date, '%m'), '%m'))='".$month2."' AND year(a.medical_entry_date) =$year and task='peme_short' and a.ohc_location_id='$current_ohc' ORDER BY a.medical_entry_date ASC";
error_log($sql);
$result = mysqli_query($GLOBALS['conn'], $sql);
?>
<strong><tr bgcolor="#eeeeee"><td align="left" width="2%" >Sr.</td><td align="left" width="10%">Date</td><td align="left" width="10%">CERT. NO</td><td align="left" width="10%"> Name </td><td align="left" width="8%">Contractor</td><td valign="top" align="left" width="5%">DEPARTMENT</td><td width="5%" valign="top" align="left">Blood Group</td><td valign="top" align="left" width="2%">Remarks</td></tr>
<?
$count=1;
while ($row1= mysqli_fetch_assoc($result)){
extract($row1);
// error_log($row1['employer_contractor_id']);
?>
<tr>
<td><?=$count?></td>
<td><? echo $row1['date']?></td>
<td><? echo $row1['ime_no']?></td>
<td><? echo $row1['patient_name']?></td>
<td><?echo getTableFieldValue('employer_contractor','employer_contractor_name',$row1['employer_contractor_id'],'id')?></td>
<td><?echo getTableFieldValue('department','dept_name',$row1['dept_id'],'dept_id')?></td>
<td><? echo $row1['blood_group']?></td>
<td><? echo $row1['opinion_remarks']?></td>
</tr>
<?
$count++;
}
?>
<tr Height="10px"><td colspan="8"><b>TOTAL: &nbsp;<? echo $row0['total']?></b></td></tr>
</table>
</body>