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

110 lines
3.6 KiB
PHP

<?php
include ('pdf_header_reverse.php');
?>
<?php
$from_date = $_POST['startDate'];
$from_date = date('Y-m-d ', strtotime($from_date));
//echo $from_date;
//echo $hygiene_abnormal1;
$to_date = $_POST['endDate'];
$to_date = date('Y-m-d ', strtotime($to_date));
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<table width="100%">
<tr>
<div style="font-size: 12px">
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size: 40px"><strong>Medicine Issue Report</strong></td>
<td width="25%" align="left"> User : <?php echo $username ?></td>
<tr>
<?php if(isset($from_date) && isset($to_date)){?>
<td> Range : <?php echo $from_date; ?> to <?php echo $to_date ;?></td>
</tr>
<?php }?>
</tr>
</table>
<table width="87%" border="1">
<tr>
<th width="2%" align="center">Sr</th>
<th align="center" width="10%">Employee </th>
<th align="center" width="30%">Quantity Issued</th>
<th align="center" width="10%">Price</th>
</tr>
<?php
//echo $to_date;
$emp_id=$_POST['empName'];
error_reporting(E_ERROR | E_PARSE);
//echo $emp_id;
if($emp_id=="All"){
$sql_medicine = "select * from patient_master where ohc_type_id='".$_SESSION['current_ohcttype']."' group by id order by patient_master.id DESC ";
$sql_emp_appoint="select appointment_id from employee_appointment where ohc_type_id='".$_SESSION['current_ohcttype']."'";
}
else{
$sql_medicine = "select * from patient_master where id='$emp_id' group by id order by patient_master.id DESC ";
$sql_emp_appoint="select appointment_id from employee_appointment where emp_id='$emp_id'";
}
echo $sql_emp_appoint;
$results_emp_appoint = mysqli_query($conn,$sql_emp_appoint);
$count = 0;
while($row_emp_appoint = mysqli_fetch_array($results_emp_appoint))
{
$appointment_id=$row_emp_appoint['appointment_id'];
//echo $appointment_id;
$sql_appoint_id="select * from appointment_stock_history where appointment_id='$appointment_id' ";
//echo $sql_appoint_id;
$results_appoint = mysqli_query($conn,$sql_appoint_id);
$row_emp_appoint = mysqli_fetch_array($results_appoint);
$qtype = '';
$query = '';
$searchSql = ($qtype != '' && $query != '') ? "where upper($qtype) like upper('%".trim($query)."%')" : '';
// Get total count of records
if($qtype == 'from_date') {
$searchSql = " and date_format(date(from_date),'%Y-%m-%d')=str_to_date('$query','%d-%m-%Y') ";
}
elseif($qtype == 'to_date') {
$searchSql = " and date_format(date(to_date),'%Y-%m-%d')=str_to_date('$query','%d-%m-%Y') ";
}
else if($qtype=='checkup_date_between'){
$dates=explode("-",$query);
//$qtype=" due_date between ";
$searchSql=" and checkup_date between str_to_date('".trim($dates[0])."','%d/%m/%Y') and str_to_date('".trim($dates[1])."','%d/%m/%Y') ";
}
$results_medicine = mysqli_query($conn,$sql_medicine);
$row_medicine = mysqli_fetch_array($results_medicine);
$employee_name = getTableFieldValue('patient_master', 'patient_name', 'id', $row_medicine['id']);
?>
<tr>
<td align="center"><?php echo ++$count?></td>
<td align="center"><?php echo $employee_name?></td>
<td align="center"><?php echo $row_emp_appoint['issued_qty'];?></td>
<td align="center"><?php echo $row_emp_appoint['price'];?></td>
</tr>
<?php } ?>
</table>
<?php
include('pdf_footer.php');
?>