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

1096 lines
50 KiB
PHP

<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
<!-- page specific pl styles -->
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="assets/css/chosen.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
<link rel="stylesheet" href="adminlte/bower_components/bootstrap/less/type.less" />
<script src="assets/js/jquery-ui.custom.min.js"></script>
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/chosen.jquery.min.js"></script>
<script src="assets/js/spinbox.min.js"></script>
<script src="assets/js/bootstrap-datepicker.min.js"></script>
<script src="assets/js/bootstrap-timepicker.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
<script src="assets/js/dataTables.buttons.min.js"></script>
<script src="assets/js/buttons.flash.min.js"></script>
<script src="assets/js/buttons.html5.min.js"></script>
<script src="assets/js/buttons.print.min.js"></script>
<script src="assets/js/buttons.colVis.min.js"></script>
<script src="assets/js/dataTables.select.min.js"></script>
<script src="assets/js/moment.min.js"></script>
<script src="assets/js/daterangepicker.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
<script src="assets/js/jquery.knob.min.js"></script>
<script src="assets/js/autosize.min.js"></script>
<script src="assets/js/jquery.inputlimiter.min.js"></script>
<script src="assets/js/jquery.maskedinput.min.js"></script>
<script src="assets/js/bootstrap-tag.min.js"></script>
<script src="assets/js/ace-elements.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".glyphicon").css("top", "");
});
</script>
<?php
include('includes/config/config.php');
$Rolecodes= explode(',',$_SESSION ['RoleCode']) ;
$rolecode = $_SESSION['RoleCode'];
if (isset($_REQUEST['appointmentId'])) {
$sql = "select * from employee_appointment where appointment_id='" . $_REQUEST['appointmentId'] . "'";
// echo "query:".$sql;
$result = mysqli_query($conn, $sql);
$num_rows = @mysqli_num_rows($result);
if ($row = mysqli_fetch_array($result)) {
}
// echo fhfh;
}
?>
<script>
var rolecode = '<?php echo $_SESSION['RoleCode'] ?>';
</script>
<form id="ipd_form" method="post">
<div class="widget-box box box-success" id="ipd_form_pdf" style="margin-left: 5px; width: 100%">
<div class="widget-header" data-action="fullscreen">
<h5 class="widget-title">Patient Detention > &nbsp; <?php echo $patient_name ?> &nbsp;<a target="_blank"
href="emp_dashboard.php?flex_patient_id=<?php echo $row['emp_id'] ?>"><i style="font-size: 17px;"
class="glyphicon glyphicon-user"></i></a>
</h5>
<?php
$i = 0;
if (isset($_REQUEST['appointmentId'])) {
$sql_detention = "select id, opd_id, reporting_time,disposal_time from detention_master where opd_id='" . $_REQUEST['appointmentId'] . "'";
// echo "query:" . $sql_detention;
$result_detention = mysqli_query($conn, $sql_detention);
$num_rows = @mysqli_num_rows($result_detention);
$row_detention = null;
if ($num_rows > 0) {
if ($row_detention = @mysqli_fetch_array($result_detention)) {
@extract($row_detention);
}
}
}
error_log('report'.$row_detention['reporting_time']);
?>
<div class="widget-toolbar" style="float: right">
<div class="clearfix">
<div class="pull-right tableTools-container">
<div class="dt-buttons btn-overlap btn-group ">
<a href="<?php echo $_REQUEST['returnPage'] ?>"
class="dt-button buttons-csv buttons-html5 btn btn-white btn-primary btn-bold save_button"
style="float: left;">Back</a> <a
class="dt-button buttons-csv buttons-html5 btn btn-white btn-primary btn-bold save_button"
id="forwardButton" tabindex="0" aria-controls="dynamic-table"><span><i
class="fa fa-floppy-o bigger-110 green"></i>
<span class="hidden">Save</span></span></a>
<a class="dt-button buttons-print btn btn-white btn-primary btn-bold"
data-action="fullscreen" tabindex="0" aria-controls="dynamic-table"
data-original-title="" title=""><span><i class="fa fa fa-expand bigger-110 grey"></i>
<span class="hidden">Maximize</span></span></a> <input type="hidden"
name="attendedStatus" id="attendedStatus" <?php if ($rolecode == 'DOC') { ?>
value="<?php echo $__STATUS_DOCTOR_ATTENDED ?>" <?php } ?>
<?php if ($rolecode == 'DIS'|| in_array('DIS',$Rolecodes)) { ?>
value="<?php echo $__STATUS_PHARMACY_ATTENDED ?>" <?php } ?> /> <input type="hidden"
name="doctor_last_attended" id="doctor_last_attended" <?php if ($rolecode == 'DOC') { ?>
value="<?php echo $_SESSION['user_id'] ?>" <?php } else { ?>
value="<?php echo $row['doctor_last_attended'] ?>" <?php } ?> />
<input type="hidden" name='is_discharge' id="is_discharge"
value="<?= $row['is_discharge']?>" />
</div>
</div>
</div>
</div>
</div>
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-xs-12 table-responsive">
<div class="widget-box box box-warning">
<div class="widget-body">
<div class="widget-main">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-sm-4">
<label class="control-label" for="appoint"><strong
style="font-size: 11px">Ticket No</strong></label>
<input id="ticket_no" type="hidden" style="height: 30px"
class="form-control" name="ticket_no"
value="<?php echo $row['ticket_no'] ?>" />
<div class="input-group">
<?php echo $row['ticket_no']; ?>
</div>
</div>
<!-- <div class="col-sm-3">
<label class="control-label" for="appointment_date"><strong
style="font-size: 11px">Token No</strong></label>
<div class="input-group">
<input id="token_no" name="token_no" type="text"
value="<?php echo $row['ticket_no']; ?>" />
</div>
</div> -->
<input id="template_name" name="template_name" type="hidden" />
<div class="col-sm-4">
<label class="control-label" for="appointment_date"><strong
style="font-size: 11px;">Reporting Date &
Time</strong></label>
<div class="input-group">
<input id="emp_id" name="emp_id" type="hidden"
value="<?php echo $row['emp_id'] ?>" /> <input type="hidden"
name="appointment_id" id="appointment_id"
value="<?php echo $_REQUEST['appointmentId'] ?>" />
<input id="appointment_type" name="appointment_type"
type="hidden" value="O" /> <input id="appointment_date"
type="text" style="height: 30px"
value="<?php echo strtotime($row_detention['reporting_time']) ? date("d/m/Y h:m A", strtotime($row_detention['reporting_time'])) : ""; ?>"
class="form-control datetimepicker"
name="appointment_date" /> <span class="input-group-addon">
<i class="fa fa-clock-o bigger-110" style="height: 5px"></i>
</span>
</div>
</div>
<div class="col-sm-4">
<label class="control-label" for="disposal_time"><strong
style="font-size: 11px;">Disposal Time</strong></label>
<div class="input-group">
<input id="disposal_time" type="text" style="height: 30px"
class="form-control datetimepicker" name="disposal_time"
value="<?php echo isset($row_detention['disposal_time']) ? date("d/m/Y h:m A", strtotime($row_detention['disposal_time'])) : ""; ?>" />
<span class="input-group-addon"> <i
class="fa fa-clock-o bigger-110"
style="height: 5px"></i>
</span>
</div>
</div>
</div>
<div class="space-6"></div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-4">
<label class="control-label" for="ailment"><strong
style="font-size: 11px">Diagnosis</strong></label><br>
<div class="input-group">
<?php
$ailment_names_ids = $row['ailments_new'];
$ailment_names_ids_array = array();
$ailment_names_ids_array = explode(",", $ailment_names_ids);
$ailment_names = "";
for ($i = 0; $i < count($ailment_names_ids_array); $i++) {
if ($i == 0) {
$ailment_names = getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment_names_ids_array[$i]);
} else {
$ailment_names = $ailment_names . "," . getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $ailment_names_ids_array[$i]);
}
}
?>
<span><?php echo $ailment_names; ?>,&nbsp;&nbsp;</span>
</div>
</div>
</div>
<div class="space-6"></div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<table id="observation_table"
class="table table-striped table-bordered ordered-list"
style="padding: 2px; margin: 2px;">
<thead>
<h3>
<center>OBSERVATION</center>
</h3>
<tr class="success">
<th style="font-size: 9px; text-align: center;">Time
</th>
<th style="font-size: 9px; text-align: center;">BP(MMG)
</th>
<th style="font-size: 9px; text-align: center;">Pulse
rate (per min)</th>
<th style="font-size: 9px; text-align: center;">SPO2(%)
</th>
<th style="font-size: 9px; text-align: center;">ECG</th>
<th style="font-size: 9px; text-align: center;">Temp.(f)
</th>
<th style="font-size: 9px; text-align: center;"></th>
</tr>
</thead>
<tbody>
<?php
$row = null;
if (isset($_REQUEST['appointmentId'])) {
$sql_observation = "select * from detention_observation where det_id ='" . $_REQUEST['appointmentId'] . "'";
$result_observation = mysqli_query($conn, $sql_observation);
$num_rows = @mysqli_num_rows($result_observation);
$row_observation = @mysqli_fetch_array($result_observation);
}
do {
?>
<tr>
<td style="width: 20%"><input
id="observation_time<?php echo $i ?>" type="text"
style="height: 30px"
class="form-control datetimepicker"
value="<?php echo isset($row_observation['observation_time']) ? date("d/m/Y h:m A", strtotime($row_observation['observation_time'])) : ""; ?> ?>"
name="observation_time<?php echo $i ?>" /></td>
<td style="width: 15%"><input type="text"
name="bp<?php echo $i ?>"
value="<?php echo $row_observation['bp'] ?>"
id="bp<?php echo $i ?>" class="form-control" />
</td>
<td style="width: 8%"><input type="text"
name="pulse<?php echo $i ?>"
value="<?php echo $row_observation['pulse'] ?>"
id="pulse<?php echo $i ?>" class="form-control" />
</td>
<td style="width: 10%"><input type="text"
name="spo2<?php echo $i ?>"
id="spo2<?php echo $i ?>"
value="<?php echo $row_observation['spo2'] ?>"
class="form-control" /></td>
<td style="width: 15%"><input class="form-control"
value="<?php echo $row_observation['ecg'] ?>"
name="ecg<?php echo $i ?>" id="ecg<?php echo $i ?>"
type="text" /></td>
<td style="width: 20%"><input type="text"
value="<?php echo $row_observation['temp'] ?>"
name="temp<?php echo $i ?>"
id="temp<?php echo $i ?>" class="form-control" />
</td>
<td style="width: 10%"><a href="#" class="btn-lg"
data-toggle="tooltip" id="deletebtn"
title="Delete"><span
class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
<?php
$i++;
} while ($row_observation = @mysqli_fetch_array($result_observation)) ?>
</tbody>
<tfoot>
<tr style="margin-left: 10px;">
<td colspan="7" style="text-align: center;"><input
type="button" class="btn btn-lg" id="addrow"
value="Add Observation" /> <input type="hidden"
name="count_items" id="count_items"
value="<?php echo $i ?>" /></td>
</tr>
<tr>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<table id="intake_table"
class="table table-striped table-bordered ordered-list"
style="padding: 2px; margin: 2px;">
<thead>
<h3>
<center>INTAKE</center>
</h3>
<tr class="success">
<th style="font-size: 9px; text-align: center;">Time
</th>
<th style="font-size: 9px; text-align: center;">
Administration
Route</th>
<th style="font-size: 9px; text-align: center;">Medicine
</th>
<th style="font-size: 9px; text-align: center;">Issued
qty</th>
<th style="font-size: 9px; text-align: center;"></th>
</tr>
</thead>
<tbody>
<?php
$row = null;
if (isset($_REQUEST['appointmentId'])) {
$sql_intake = "select * from detention_intake where det_id ='" . $_REQUEST['appointmentId'] . "'";
error_log("ksfjckesncf" . $sql_intake);
$result_intake = mysqli_query($conn, $sql_intake);
$num_intake = @mysqli_num_rows($result_intake);
if ($row_intake = @mysqli_fetch_array($result_intake)) {
}
}
do {
@extract($row_intake);
?>
<tr>
<td style="width: 20%"><input
id="intake_time<?php echo $i ?>" type="text"
style="height: 30px"
class="form-control datetimepicker"
value="<?php echo isset($row_intake['intake_time']) ? date("d/m/Y h:m A", strtotime($row_intake['intake_time'])) : ""; ?>"
name="intake_time<?php echo $i ?>" /></td>
<td style="width: 20%"><select class="form-control select2"
id="administration_route<?php echo $i ?>"
name="administration_route<?php echo $i ?>"
data-placeholder="Choose administration route..."
style="width: 100%;">
<option value=""></option>
<?php echo generateOption('dosage_category', 'dosage_category', 'dosage_category_id', $row_intake['administration_route'], ''); ?>
</select></td>
<td style="width: 20%"><select class="form-control select2"
id="medicine<?php echo $i ?>"
name="medicine<?php echo $i ?>"
data-placeholder="Choose a item..."
style="width: 100%;">
<option value=""></option>
<?php echo generateOption('tbl_items', 'item_name', 'item_id', $row_intake['medicine'], ''); ?>
</select></td>
<td style="width: 20%"><input class="form-control"
value="<?php echo $row_intake['issued_qty'] ?>"
name="issued_qty<?php echo $i ?>"
id="issued_qty<?php echo $i ?>" type="number" />
</td>
<td style="width: 20%"><a href="#" class="btn-lg"
data-toggle="tooltip" id="deletebtn"
title="Delete"><span
class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
<?php
$i++;
} while ($row_intake = @mysqli_fetch_array($result_intake)) ?>
</tbody>
<tfoot>
<tr style="margin-left: 10px;">
<td colspan="7" style="text-align: center;"><input
type="button" class="btn btn-lg" id="addrow1"
value="Add Intake" /> <input type="hidden"
name="count_items1" id="count_items1"
value="<?php echo $i ?>" />
</td>
</tr>
<tr>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="space-6"></div>
<div class="row">
<div class="col-sm-12 table-responsive">
<table id="output_table"
class="table table-striped table-bordered ordered-list"
style="padding: 2px; margin: 2px;">
<thead>
<h3>
<center>OUTPUT</center>
</h3>
<tr class="success">
<th style="font-size: 9px; text-align: center;">Time
</th>
<th style="font-size: 9px; text-align: center;">
Route(Urination,Vomitting,Drainage,etc..)</th>
<th style="font-size: 9px; text-align: center;">
Quantity(ML)
</th>
<th style="font-size: 9px; text-align: center;"></th>
</tr>
</thead>
<tbody>
<?php
$row = null;
if (isset($_REQUEST['appointmentId'])) {
$sql_output = "select * from detention_output where det_id ='" . $_REQUEST['appointmentId'] . "'";
error_log("elslkf" . $sql_output);
$result_output = mysqli_query($conn, $sql_output);
$num_output = @mysqli_num_rows($result_output);
$row_output = @mysqli_fetch_array($result_output);
}
do {
?>
<tr>
<td style="width: 25%"><input
id="output_time<?php echo $i ?>" type="text"
style="height: 30px"
class="form-control datetimepicker"
value="<?php echo isset($row_output['output_time']) ? date("d/m/Y h:m A", strtotime($row_output['output_time'])) : ""; ?>"
name="output_time<?php echo $i ?>" /></td>
<td style="width: 25%"><input class="form-control"
name="output_route<?php echo $i ?>"
id="output_route<?php echo $i ?>" type="text"
value="<?php echo $row_output['output_route'] ?>" />
</td>
<td style="width: 25%"><input class="form-control"
name="output_qty<?php echo $i ?>"
id="output_qty<?php echo $i ?>" type="text"
value="<?php echo $row_output['output_qty'] ?>" />
</td>
<td style="width: 25%"><a href="#" class="btn-lg"
data-toggle="tooltip" id="deletebtn"
title="Delete"><span
class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
<?php
$i++;
} while ($row_output = @mysqli_fetch_array($result_output)) ?>
</tbody>
<tfoot>
<tr style="margin-left: 10px;">
<td colspan="7" style="text-align: center;"><input
type="button" class="btn btn-lg" id="addrow2"
value="Add Output" /> <input type="hidden"
name="count_items2" id="count_items2"
value="<?php echo $i ?>" />
</td>
</tr>
<tr>
</tr>
</tfoot>
</table>
</div>
</div>
<br>
</div>
<!-- /.col-xs-12 -->
</div>
<!--row end-->
</div>
<!--end of widget-main-->
</div>
<!--end of widget-body-->
</div>
<!--end of widget-box-->
</div>
</div>
</div>
</div>
</div>
</form>
<form id="pdfform" target="_blank">
<input type="hidden" id="appointment_id_pdf" value="<?php echo $row['appointment_id'] ?>" name="appointment_id_pdf">
</form>
<script type="text/javascript">
function exporttopdf() {
document.forms['pdfform'].action = "ipd_form_pdf.php";
document.forms['pdfform'].method = "post";
document.forms['pdfform'].submit();
}
jQuery(function($) {
$("#forwardButton").on("click", function() {
<?php if ($rolecode == 'DIS'|| in_array('DIS',$Rolecodes)) { ?>
BootstrapDialog.show({
title: 'Forward',
message: '<select class="form-control" id="forward_status" style="margin-left:100px;width:60%">' +
'<option value="Y">Discharge</option>' +
'<option value="N">Save</option>',
buttons: [{
label: 'OK',
action: function() {
$("#is_discharge").val($("#forward_status").val());
validate();
}
}]
});
<?php } else { ?>
$("#is_discharge").val('N');
validate();
<?php } ?>
});
});
function validate() {
save_detention();
}
jQuery(function($) {
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
})
//show datepicker when clicking on the icon
.next().on(ace.click_event, function() {
$(this).prev().focus();
});
$('#timepicker1').timepicker({
minuteStep: 1,
showSeconds: true,
showMeridian: false,
disableFocus: true,
icons: {
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down'
}
}).on('focus', function() {
$('#timepicker1').timepicker('showWidget');
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
/*
if(!ace.vars['old_ie']) $('#appointment_date').datetimepicker({
format: 'DD/MM/YYYY h:mm A',//use this option to display seconds
defaultDate: new Date(<?php echo $row['appointment_date'] ?>),
maxDate: new Date(),
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows ',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function(){
$(this).prev().focus();
});
*/
<?php if (($row_detention['reporting_time']) == '0000-00-00 00:00:00') { ?>$("#appointment_date")
.datetimepicker('setDate', '');
$("#appointment_date").val('') <?php } ?>
<?php if (($row_detention['disposal_time']) == '0000-00-00 00:00:00') { ?>$("#disposal_time")
.datetimepicker('setDate', '');
$("#disposal_time").val('') <?php } ?>
if (!ace.vars['old_ie']) $('.datetimepicker').datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
<?php if (($row_detention['disposal_time']) == '0000-00-00 00:00:00') { ?>$("#disposal_time")
.datetimepicker('setDate', '');
$("#disposal_time").val('') <?php } ?>
// if(!ace.vars['old_ie']) $('#intake_time<?php echo $i ?>').datetimepicker({
// format: 'DD/MM/YYYY h:mm A',//use this option to display seconds
// defaultDate: new Date(),
// maxDate: new Date(),
// icons: {
// time: 'fa fa-clock-o',
// date: 'fa fa-calendar',
// up: 'fa fa-chevron-up',
// down: 'fa fa-chevron-down',
// previous: 'fa fa-chevron-left',
// next: 'fa fa-chevron-right',
// today: 'fa fa-arrows',
// clear: 'fa fa-trash',
// close: 'fa fa-times'
// }
// }).next().on(ace.click_event, function(){
// $(this).prev().focus();
// });
// if(!ace.vars['old_ie']) $('#output_time<?php echo $i ?>').datetimepicker({
// format: 'DD/MM/YYYY h:mm A',//use this option to display seconds
// defaultDate: new Date(),
// maxDate: new Date(),
// icons: {
// time: 'fa fa-clock-o',
// date: 'fa fa-calendar',
// up: 'fa fa-chevron-up',
// down: 'fa fa-chevron-down',
// previous: 'fa fa-chevron-left',
// next: 'fa fa-chevron-right',
// today: 'fa fa-arrows',
// clear: 'fa fa-trash',
// close: 'fa fa-times'
// }
// }).next().on(ace.click_event, function(){
// $(this).prev().focus();
// });
})
$(document).ready(function() {
$("#addrow").on("click", function() {
var counter = $("#count_items").val();
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="text" class="form-control" id="observation_time' + counter +
'" name="observation_time' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="bp' + counter + '" name="bp' +
counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="pulse' + counter + '" name="pulse' +
counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="spo2' + counter + '" name="spo2' +
counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="ecg' + counter + '" name="ecg' +
counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="temp' + counter + '" name="temp' +
counter + '"/></td>'
cols +=
'<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
newRow.append(cols);
$("#observation_table").append(newRow);
/*$('#item_id'+counter).chosen({allow_single_deselect:true});
$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});*/
$('#observation_time' + counter).datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
counter++;
$('.select2').select2()
$("#count_items").val(counter);
});
$("#observation_table").on("click", "#deletebtn", function(event) {
$(this).closest("tr").remove();
// counter -= 1
// $("#count_items").val(counter);
});
$('.select2').select2()
});
$(document).ready(function() {
var itemOptions =
"<?php echo generateOption('tbl_items', 'concat(item_name," (",item_code,")")', 'item_id', '', ''); ?>";
var itemDosage =
"<?php echo generateOption('dosage_category', 'dosage_category', 'dosage_category_id', '', ''); ?>";
$("#addrow1").on("click", function() {
var newRow = $("<tr>");
var counter = $("#count_items1").val();
var cols = "";
var select_treatment = "";
select_treatment += "<select ";
select_treatment += "id=\"medicine" + counter + "\"name=\"medicine" + counter +
"\" data-placeholder=\"Choose a item...\" class=\"form-control select2\" style=\"width: 100%;\" ";
//select_treatment+="style=\"display: none;\"";
select_treatment += ">";
select_treatment += "<option value=\"\"> </option>";
select_treatment += itemOptions
select_treatment += "</select>";
var select_dosage = "";
select_dosage += "<select ";
select_dosage += "id=\"administration_route" + counter + "\"name=\"administration_route" +
counter +
"\" data-placeholder=\"Choose administration route...\" class=\"form-control select2\" style=\"width: 100%;\" ";
//select_treatment+="style=\"display: none;\"";
select_dosage += ">";
select_dosage += "<option value=\"\"> </option>";
select_dosage += itemDosage;
select_dosage += "</select>";
cols += '<td><input type="text" class="form-control" id="intake_time' + counter +
'" name="intake_time' + counter + '"/></td>';
cols += '<td>' + select_dosage + '</td>';
cols += '<td>' + select_treatment + '</td>';
cols += '<td><input type="text" class="form-control" id="issued_qty' + counter +
'" name="issued_qty' + counter + '"/></td>';
cols +=
'<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
newRow.append(cols);
$("#intake_table").append(newRow);
/*$('#item_id'+counter).chosen({allow_single_deselect:true});
$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});*/
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
})
$('#intake_time' + counter).datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
counter++;
$('.select2').select2()
$("#count_items1").val(counter);
});
$("#intake_table").on("click", "#deletebtn", function(event) {
$(this).closest("tr").remove();
// counter -= 1
// $("#count_items1").val(counter);
});
});
$(document).ready(function() {
$("#addrow2").on("click", function() {
var newRow = $("<tr>");
var cols = "";
var counter = $("#count_items2").val();
cols += '<td><input type="text" class="form-control" id="output_time' + counter +
'" name="output_time' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="output_route' + counter +
'" name="output_route' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="output_qty' + counter +
'" name="output_qty' + counter + '"/></td>';
cols +=
'<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
newRow.append(cols);
$("#output_table").append(newRow);
/*$('#item_id'+counter).chosen({allow_single_deselect:true});
$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});*/
$('.date-picker').datepicker({
autoclose: true,
todayHighlight: true
})
$('#output_time' + counter).datetimepicker({
format: 'DD/MM/YYYY h:mm A', //use this option to display seconds
defaultDate: new Date(),
maxDate: new Date(),
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-arrows',
clear: 'fa fa-trash',
close: 'fa fa-times'
}
}).next().on(ace.click_event, function() {
$(this).prev().focus();
});
counter++;
$('.select2').select2()
$("#count_items2").val(counter);
});
$("#output_table").on("click", "#deletebtn", function(event) {
$(this).closest("tr").remove();
// counter -= 1
//$("#count_items2").val(counter);
});
});
if ($('#ailment_new')) {
var ailments = new Array();
getAilments();
function getAilments() {
$.ajax({
url: 'select_ailments.php',
type: "GET",
success: function(data) {
ailments = $.parseJSON(data);
},
error: function(data) {
BootstrapDialog.alert('Error pulling Ailments');
return;
}
});
}
}
if ($('#ailment_new')) {
var tag_input_ailments = $('#ailment_new');
try {
tag_input_ailments.tag({
placeholder: tag_input_ailments.attr('placeholder'),
source: ailments
})
//programmatically add/remove a tag
var $tag_obj = $('#ailment_new').data('tag');
//$tag_obj.add('Programmatically Added');
//var existingAilments = "<?php echo $row['ailments_new'] ?>"
var existingAilments =
"<?php echo getCommaSeperatedValuesForInClause('select ailment_name from ailment', 'ailment_id', $row['ailments_new']) ?>"
if (existingAilments != undefined && existingAilments != null && existingAilments != '') {
var existingAilmentsArr = existingAilments.split(",");
jQuery.each(existingAilmentsArr, function(i, val) {
$tag_obj.add(val.toUpperCase());
});
}
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch (e) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_ailments.after('<textarea id="' + tag_input_ailments.attr('id') + '" name="' + tag_input_ailments
.attr('name') + '" rows="3">' + tag_input_ailments.val() + '</textarea>').remove();
//autosize($('#form-field-tags'));
}
} //end Ailments*/
function save_detention() {
$.ajax({
url: 'save_ipd.php',
type: "POST",
data: $("#ipd_form").serialize(),
success: function(data) {
var data = $.parseJSON(data);
//alert(data);
if (data.appointment_id != null) {
$("#appointment_id").val(data.appointment_id);
$("#appointment_id_pdf").val(data.appointment_id);
}
BootstrapDialog.alert('Details Saved Successfully.');
//loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id'] ?>');
//return;
// window.location.reload();
setTimeout(() => {
window.location.replace("detention_list.php");
}, 2000);
},
error: function(data) {
BootstrapDialog.alert('Error Saving Details');
//return;
}
});
}
</script>