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

411 lines
12 KiB
PHP

<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try{ace.settings.loadState('main-container')}catch(e){}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li>
<i class="ace-icon fa fa-home home-icon"></i>
<a href="#">Home</a>
</li>
<li class="#">Ambulance MANAGEMENT</li><li class="active">Ambulance Movement</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div class="box box-primary"
style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
<form id="ambulance_form" method="post">
<!-- box-body-->
<div class="box-body">
<div class="row" >
<div class="col-sm-12">
<table id="myTable" class="table table-bordered order-list" >
<thead>
<tr>
<th>Date</th>
<th>Driver Name</th>
<th>FROM</th>
<th>TO</th>
<th>OUT KMt</th>
<th>IN KM</th>
<th>Total KM</th>
<th>OUT TIME</th>
<th>IN TIME</th>
<th>Duty TYPE</th>
<th>UDED BY</th>
<th>DETAILS</th>
</tr>
</thead>
<?php $i=0;
$row=null;
if(isset($_REQUEST['flex_ambulance_id'])){
$sql="select * from ambulance_details where ambulance_id='".$_REQUEST['flex_ambulance_id']."'";
$result = mysqli_query($conn,$sql);
$num_rows=mysqli_num_rows($result);
$row=mysqli_fetch_array($result);
}
do{
?>
<tbody>
<tr>
<td style="width:8%">
<?php echo date_format(date_create($row['ambulance_date']),"d/m/Y")?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_driver']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_from']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_to']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_out_km']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_in_km']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_total_km']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_out_time']?>
</td>
<td style="width:8%"><?php echo $row['ambulance_in_time']?></td>
<td style="width:8%">
<?php echo $row['ambulance_duty']?>
</td>
<td style="width:8%">
<?php echo $row['ambulance_used']?>
</td>
<td style="width:12%"><?php echo $row['ambulance_details']?></td>
</tr>
<?php
$i++;
}while($row=@mysqli_fetch_array($result))//end of while
?>
<input type="hidden" name="count_items" id="count_items" value="<?php echo $i?>" />
</tbody>
<tfoot>
<tr>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<!-- End box-body-->
<!--End box-footer-->
</form>
</div>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try{ace.settings.loadState('main-container')}catch(e){}
</script>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<!-- End of breadcrumb -->
<div class="page-content" style="
margin-top: -47px;">
<div id="flexigridDiv" class="table-responsive">
<form name="f1" method="post" id="flex_appointment_form" action="bio_medical_waste_generation_excel.php">
<div id="flex1" style="width:100%">
<input type="hidden" name="flex_ambulance_id" id="flex_ambulance_id"/>
</div>
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action" value="ambulance_pdf.php"/>
<input type="hidden" name="excel_action" id="excel_action" value="excel_ambulance.php"/>
</form>
</div>
</div>
<script type="text/javascript">
$(function() {
var w=screen.width*.90;
var h =0;
h =(window.innerHeight-($("#navbar").height()+$(".breadcrumbs").height()))*.75;
$("#flex1").flexigrid({
url: 'ambulance_details_script.php',
dataType: 'json',
colModel : [
{display: '', name : 'link', width : w*.07, sortable : false, align: 'left'},
{display: 'Sr', name : 'count', width : w*.05, sortable : false, align: 'left'},
{display: ' Date', name : 'ambulance_date', width : w*.10, sortable : true, align: 'left'},
{display: 'Driver Name', name : 'ambulance_driver', width : w*.15, sortable : true, align: 'left'},
{display: 'From ', name : 'ambulance_from', width : w*.07, sortable : true, align: 'left'},
{display: 'To', name : 'ambulance_to', width : w*.07, sortable : true, align: 'left'},
{display: 'OUT KM', name : 'ambulance_out_km', width : w*.07, sortable : true, align: 'left'},
{display: 'IN KM', name : 'ambulance_in_km', width : w*.07, sortable : true, align: 'left'},
{display: 'TOTAL KM', name : 'ambulance_total_km', width : w*.07, sortable : true, align: 'left'},
{display: 'OUT TIME ', name : 'ambulance_out_time', width : w*.07, sortable : true, align: 'left'},
{display: 'IN TIME', name : 'ambulance_in_time', width : w*.07, sortable : true, align: 'left'},
{display: 'Type of Duty', name : 'ambulance_duty', width : w*.07, sortable : false, align: 'left'},
{display: 'Used By', name : 'ambulance_used', width : w*.07, sortable : false, align: 'left'},
{display: 'Details', name : 'ambulance_details', width : w*.07, sortable : false, align: 'left'}
],
buttons : [
// {name: 'Add', bclass: 'add', onpress : add},
//{separator: true},
//{name: 'PDFReport', bclass: 'print', onpress : pdfReport},
// {separator: true},
{name: 'PDF', bclass: 'print', onpress : pdf},
{separator: true},
{name: 'Excel', bclass: 'print_excel', onpress : excel},
{separator: true}
],
searchitems : [
//{display: 'Patient Name', name : 'patient_name' },
{display: 'Driver', name : 'ambulance_driver'},
{display: 'FROM', name : 'ambulance_from'},
{display: 'USED BY', name : 'ambulance_used'},
{display: 'DUTY TYPE', name : 'ambulance_duty'},
{display: 'TO', name : 'ambulance_to'},
{display: 'Ambulance Date BETWEEN', name : 'ambulance_date_between'},
],
sortname: "ambulance_id",
sortorder: "asc",
usepager: true,//pagination
//title:"Employee OPD",
useRp: true,
rp: 50,//records per page
showTableToggleBtn: false,//toggle button for the whole table
resizable: true,
// width: w,
height: h,
singleSelect: true
});
});
function add(){
$("#ambulance_date").val("");
$("#ambulance_driver").val("");
$('#ambulance_from').val("");
$("#ambulance_to").val("");
$("#ambulance_out_km").val("");
$("#ambulance_in_km").val("");
$('#ambulance_total_km').val("");
$("#ambulance_out_time").val("");
$("#ambulance_in_time").val("");
$("#ambulance_duty").val("");
$("#ambulance_used").val("");
$("#ambulance_details").val("");
$("#ambulance_id").val("");
$('#modal-add-ambulance-form').modal("show");
}
function save_ambulance_details(){
$.ajax({
url : 'save_ambulance_details.php',
type : "POST",
data : $("#ambulance_movement_form").serialize(),
success : function(data) {
BootstrapDialog.alert('Ambulance Details Saved Successfully.');
$("#flex1").flexReload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving Ambulance Details');
return;
}
});
$('.close').click();
}
function open_ambulance_move(flex_ambulance_id,action){
if(action=="V"){
//$(".save_button").hide()
location.href="ambulance_details.php?flex_ambulance_id="+flex_ambulance_id+"";
$(".save_button").hide()
}else{
location.href="ambulance_details.php?flex_ambulance_id="+flex_ambulance_id+"";
}
}
function delete_ambulance_form(ambulance_id){
$.ajax({
url : 'delete_ambulance_details.php',
data:{ambulance_id:ambulance_id},
type : 'POST',
dataType:'json',
success : function(data) {
if(data=='SUCCESS') {
BootstrapDialog.alert('Delelet Ambulance Details Successfully');
$("#flex1").flexReload();
return;
}
},
error : function(data) {
BootstrapDialog.alert('Error Ambulance Details Successfully');
return;
}
});
}
function open_ambulance_form(ambulance_id,access){
if(access=='V'){
$("#save_button").hide()
}else if(access=='E')
$("#save_button").show()
$.ajax({
url : 'select_ambulance_details.php',
data:{ambulance_id:ambulance_id},
type : 'POST',
dataType:'json',
success : function(data) {
$("#ambulance_date").val(myDateFormat(data.ambulance_date));
$("#ambulance_driver").val(data.ambulance_driver);
$("#ambulance_from").val(data.ambulance_from);
$("#ambulance_to").val(data.ambulance_to);
$("#ambulance_out_km").val(data.ambulance_out_km);
$("#ambulance_in_km").val(data.ambulance_in_km);
$("#ambulance_total_km").val(data.ambulance_total_km);
$("#ambulance_out_time").val(data.ambulance_out_time);
$("#ambulance_in_time").val(data. ambulance_in_time);
$("#ambulance_duty").val(data.ambulance_duty);
$("#ambulance_details").val(data.ambulance_details);
$("#ambulance_used").val(data.ambulance_used);
$("#ambulance_id").val(data.ambulance_id);
$('#modal-add-ambulance-form').modal("show");
},
error : function(data) {
BootstrapDialog.alert('Error Populating Ambulance Details');
return;
}
});
}
function pdf(){
window.open('ajax_pdf.php','Ambulance Lis');
}
function excel(){
window.open('ajax_excel.php','Ambulance List');
}
function myDateFormat(date){
var d=new Date(date);
var day=d.getDate();
var m=d.getMonth()+1;
var y=d.getFullYear();
return day+"-"+m+"-"+y;
}
</script>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->