2024-10-16 19:18:52 +05:30
< ? php
include ( 'includes/config/config.php' );
include ( 'includes/functions.php' );
header ( 'Content-Type: application/force-download' );
header ( 'Content-disposition: attachment; filename=patient_categorywise_excel.xls' );
?>
< html >
< link href = " includes/css-js/admin.css " rel = " stylesheet " type = " text/css " />
< body >
< table border = " 1 " style = " text-aling: center; " >
< tr bgcolor = " #eeeeee " >
< th width = " 5% " ; > Sr No .</ th >
< th width = " 10% " ; > Emp . Code </ th >
< th width = " 10% " ; > Name </ th >
< th width = " 10% " ; > Associate Employee </ th >
< th width = " 12% " ; > Designation </ th >
< th width = " 12% " ; > Department </ th >
< th width = " 12% " ; > Emp Cadre </ th >
< th width = " 12% " ; > Contact No </ th >
< th width = " 12% " ; > Visit Date </ th >
< th width = " 12% " ; > OPD No .</ th >
< th width = " 12% " ; > Diagnosis </ th >
< th width = " 12% " ; > Ailment Systems </ th >
< th width = " 12% " ; > Abnormality </ th >
</ tr >
< ? php
$date = date ( " Y-m-d " );
$default_start_date = date ( 'Y-m-d' , strtotime ( $date . ' -7 days' ));
$default_end_date = date ( 'Y-m-d' , strtotime ( $date ));
error_log ( $_POST [ 'startDateCat' ] . " startdateeee " );
error_log ( $_POST [ 'endDateCat' ] . " startdateeee " );
error_log ( " date . " . $default_start_date . " " . $default_end_date );
error_log ( $_POST [ 'startDateCat' ] . " startDateCat " );
error_log ( $_POST [ 'end_date' ] . " end_date " );
if ( ! empty ( $_POST [ 'startDateCat' ])) {
$default_start_date = date ( 'Y-m-d' , strtotime ( $_POST [ 'startDateCat' ]));
}
if ( ! empty ( $_POST [ 'endDateCat' ])) {
$default_end_date = date ( 'Y-m-d' , strtotime ( $_POST [ 'endDateCat' ]));
}
error_log ( " date after filter . " . $default_start_date . " " . $default_end_date );
// $total_patient_cat = array();
// $total_patient_count = array();
// $sql = "select * from patient_category where patient_cat_name != ''";
// $result = mysqli_query($conn, $sql);
// while ($row = mysqli_fetch_assoc($result)) {
// array_push($total_patient_cat, '"' . $row['patient_cat_name'] . '"');
// array_push($total_patient_count, $row['patient_cat_id']);
// }
error_log ( " total medical " . print_r ( $total_patient_count , true ));
// $checkup_data = array();
// $date_data = array();
2024-11-02 18:03:13 +05:30
// for ($i = 0; $i < count($total_patient_count); $i++) {
2024-10-16 19:18:52 +05:30
$sql = " SELECT e.ailments_new , p.primary_patient_id, e.emp_id , e.dept ,e.ticket_no,e.designation,e.ailment_systems_new,e.abnormalitys, e.department, e.appointment_date , p.emp_cadre , p.patient_name ,p.dob ,p.primary_phone , p.patient_cat_id from employee_appointment e left join patient_master p on e.emp_id=p.id where date(e.appointment_date) >= ' " . $default_start_date . " ' and date(e.appointment_date) <= ' " . $default_end_date . " ' and appointment_type='O' " ;
error_log ( $sql . " query " );
$result = mysqli_query ( $conn , $sql );
$i = 1 ;
while ( $fetchData = mysqli_fetch_array ( $result )) { ?>
< tr style = " text-align: center; " >
< td >< ? php echo $i ?> </td>
< ? php error_log ( $fetchData [ 'emp_id' ] . " dmdmdm " ); ?>
< td >< ? php echo getFieldFromTable ( 'emp_code' , 'patient_master' , 'id' , $fetchData [ 'emp_id' ]); ?> </td>
< td >< ? php echo getFieldFromTable ( 'patient_name' , 'patient_master' , 'id' , $fetchData [ 'emp_id' ]); ?> </td>
< ? php
if ( empty ( $fetchData [ 'emp_id' ])) {
?>
< td >< ? php echo getFieldFromTable ( 'patient_name' , 'patient_master' , 'id' , $fetchData [ 'primary_patient_id' ]); ?> </td>
< ? php
} else {
?>
< td ></ td >
< ? php
}
?>
< td >< ? php echo getFieldFromTable ( 'designation_name' , 'designation' , 'designation_id' , $fetchData [ 'designation' ]); ?> </td>
< td >< ? php echo getFieldFromTable ( 'dept_name' , 'department' , 'dept_id' , $fetchData [ 'department' ]); ?> </td>
< td >< ? php echo getFieldFromTable ( 'emp_cadre' , 'emp_cadre' , 'emp_cadre_id' , $fetchData [ 'emp_cadre' ]); ?>
</ td >
< td >< ? php echo getFieldFromTable ( 'primary_phone' , 'patient_master' , 'id' , $fetchData [ 'emp_id' ]); ?> </td>
< ? php $checkupDate = date ( 'd-m-Y' , strtotime ( $fetchData [ 'appointment_date' ])); ?>
< td >< ? php echo $checkupDate ?> </td>
< td >< ? php echo $fetchData [ 'ticket_no' ] ?> </td>
< td >< ? php echo getCommaSeperatedValuesForInClause ( " select ailment_name from ailment " , " ailment_id " , $fetchData [ 'ailments_new' ]); ?> </td>
< td >< ? php echo getCommaSeperatedValuesForInClause ( " select ailment_sys_name from ailment_system " , " ailment_sys_id " , $fetchData [ 'ailment_systems_new' ]); ?> </td>
< td >< ? php echo getCommaSeperatedValuesForInClause ( " select abnormality_name from abnormality " , " abnormality_id " , $fetchData [ 'abnormalitys' ]); ?> </td>
</ tr >
< ? php
$i ++ ;
}
?>
</ table >
</ body >
</ html >