146 lines
4.6 KiB
PHP
146 lines
4.6 KiB
PHP
<?php //include('pdf_header_reverse.php');
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
|
|
header("Content-type:application/octet-stream");
|
|
|
|
header("Content-type: application/x-msdownload");
|
|
header("Content-Disposition: attachment; filename=ambulance_recovery_report_excel.xls");
|
|
header("Pragma: no-cache");
|
|
header("Expires: 0");
|
|
$start = $_POST['ambulance_recovery_startDate'];
|
|
$end = $_POST['ambulance_recovery_endDate'];
|
|
//$month_name = date("F", mktime(0, 0, 0, $month, 10));
|
|
?>
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
<style>
|
|
@page {
|
|
margin: 15px;
|
|
}
|
|
|
|
.btn {
|
|
background-color: #4CAF50;
|
|
border-radius: 5%;
|
|
/* Green */
|
|
border: none;
|
|
color: white;
|
|
padding: 5px 8px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 12px;
|
|
margin: 4px 2px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
@media print {
|
|
#printPageButton {
|
|
display: none;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<body>
|
|
<?php include('pdf_ohc_header.php'); ?>
|
|
<table width="100%">
|
|
<tr>
|
|
|
|
<td align="center" style="font-size: 18px;color:red"><strong>Ambulance Recovery Report</strong></td>
|
|
|
|
</tr>
|
|
<tr>
|
|
<td align="center" style="font-size: 12px"><strong>(For Interval:
|
|
<?php echo $start." To ".$end ; ?>)</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 bgcolor="#eeeeee" Height="23px">
|
|
<td align="left" style="font-size:13px" width="1%"><strong>Sr N.</td>
|
|
|
|
<td align="left" style="font-size:13px" width="4%"><strong>Name</td>
|
|
|
|
|
|
<td align="left" style="font-size:13px" width="3%"><strong>ECode/G.Pass</td>
|
|
<td align="left" style="font-size:13px" width="3%"><strong>City</td>
|
|
<td align="left" style="font-size:13px" width="3%"><strong>Total Cost</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<?php
|
|
$count=1;
|
|
$city=array();
|
|
$emp_ids=array();
|
|
$total_cost=array();
|
|
$sql = "select a.*,c.* from ambulance_details a left join patient_master c on a.patient_id = c.id where date_format(date(ambulance_date),'%Y-%m-%d') between STR_TO_DATE('".$start."','%d-%m-%Y') and STR_TO_DATE('".$end."','%d-%m-%Y') ; ";
|
|
error_log('dlme'.$sql);
|
|
$result_sql = mysqli_query($conn,$sql);
|
|
$num_rows = mysqli_num_rows($result_sql);
|
|
while( $row = mysqli_fetch_assoc($result_sql)){
|
|
if($row['primary_patient_id']== null || $row['primary_patient_id']=='') {
|
|
$row['patient_id']= $row['patient_id'];
|
|
}
|
|
else{
|
|
$row['patient_id']=$row['primary_patient_id'];
|
|
}
|
|
array_push($emp_ids,$row['patient_id']);
|
|
array_push($total_cost,$row['total_cost']);
|
|
array_push($city,$row['city_id']);
|
|
}
|
|
$main_emp_ids=array();
|
|
$main_emp_ids=array_unique($emp_ids);
|
|
error_log('main_empid- '.print_r($main_emp_ids,true).'all_empid- '.print_r($emp_ids,true).'cost-'.print_r($total_cost,true).'city-'.print_r($city,true));
|
|
$data=array();
|
|
for($i=0;$i<count($main_emp_ids);$i++){
|
|
$cost=0;
|
|
$citys_name='';
|
|
for($j=0;$j<count($emp_ids);$j++){
|
|
|
|
if($main_emp_ids[$i]==$emp_ids[$j]){
|
|
$cost+=$total_cost[$j];
|
|
$citys_name .= getTableFieldValue('citys','city','city_id',$city[$j]).',' ;
|
|
}
|
|
$data[$i]['emp_id']=$main_emp_ids[$i];
|
|
$data[$i]['city']=$citys_name;
|
|
$data[$i]['total_cost']=$cost;
|
|
}
|
|
|
|
}
|
|
error_log('print data '.print_r($data,true));
|
|
for($x=0;$x<count($data);$x++){
|
|
|
|
?>
|
|
<strong>
|
|
|
|
<tr Height="20px" bgcolor="#eeeeee">
|
|
<td align="left" style="font-size:13px" width="1%"><?=$count?></td>
|
|
|
|
|
|
<td align="left" style="font-size:13px" width="4%">
|
|
<?= getTableFieldValue('patient_master','patient_name','id' ,$data[$x]['emp_id'])?></td>
|
|
|
|
<td align="left" style="font-size:13px" width="3%">
|
|
<?= getTableFieldValue('patient_master','emp_code','id' ,$data[$x]['emp_id'])?></td>
|
|
<td align="left" style="font-size:13px" width="3%"><?= $data[$x]['city']?></td>
|
|
|
|
<td align="left" style="font-size:13px" width="3%"><?= $data[$x]['total_cost']?></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<?php $count++;
|
|
}
|
|
?>
|
|
<tr Height="10px">
|
|
<td style="font-size:12px" colspan="10"><b>TOTAL: <?php echo $count-1 ?></b></td>
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
</body>
|