1531 lines
61 KiB
PHP
1531 lines
61 KiB
PHP
<link rel="stylesheet"
|
|
href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|
|
|
<!-- page specific plugin 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","");
|
|
|
|
|
|
});
|
|
|
|
function open_treatments(appointment_id){
|
|
$('#modal-add-consultation').modal("show");
|
|
|
|
}
|
|
|
|
</script>
|
|
<?php
|
|
include('includes/config/config.php');
|
|
|
|
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);
|
|
$row =null;
|
|
|
|
//echo fhfh;
|
|
if($num_rows>0)
|
|
{
|
|
$row=@mysqli_fetch_array($result);
|
|
}
|
|
$sql_for_treatment="select * from treatment where appointment_id='".$_REQUEST['appointmentId']."' and is_display!='N'";
|
|
$result_for_treatment =@mysqli_query($conn,$sql_for_treatment);
|
|
$num_rows_treatment=@mysqli_num_rows($result_for_treatment);
|
|
//echo $row['emp_id'];
|
|
|
|
// echo "shub".$num_rows_treatment;
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
<form id="opd_form" method="post">
|
|
<div class="widget-box box box-success" id="opd_form_pdf" style="margin-left:5px;margin-right:50px;width:99%" >
|
|
<div class="widget-header" data-action="fullscreen" >
|
|
<h5 class="widget-title">Employee OPD/Injury</h5>
|
|
|
|
|
|
<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'].'&backButon=back'?>" 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-print btn btn-white btn-primary btn-bold" onclick="exporttopdf();" tabindex="0" aria-controls="dynamic-table" data-original-title="" title=""><span><i class="fa fa-print bigger-110 grey"></i> <span class="hidden">Print</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>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="widget-body">
|
|
<div class="widget-main">
|
|
<div class="row">
|
|
<div class="col-xs-9 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-3">
|
|
<label class="control-label" for="appoint"><strong style="font-size:11px">Ticket No:</strong></label>
|
|
<?php echo $row['ticket_no'];?>
|
|
|
|
|
|
<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" >
|
|
|
|
|
|
|
|
<input id="appoint" type="hidden" style="height:30px" class="form-control" name="appoint" value="<?php echo $_REQUEST['appointmentId']?>" disabled/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-offset-3 col-sm-3">
|
|
<label class="control-label" for="appointment_date"><strong style="font-size:11px">Visit Date</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']?>"/>
|
|
|
|
<div><?php echo $row['appointment_date']?></div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="space-6"></div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="form-field-8"><strong style="font-size:11px">Complaints</strong></label>
|
|
<?php echo $row['complaints']?>
|
|
|
|
</div>
|
|
<?php $rolecode = $_SESSION ['RoleCode'];
|
|
if ($rolecode == 'RCP') {?>
|
|
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="ailment"><strong
|
|
style="font-size: 11px">Remarks</strong></label>
|
|
|
|
<textarea name="remarks_rece" rows="3" cols="8" id="remarks_rece"
|
|
placeholder="Remaks"
|
|
class="autosize-transition form-control"
|
|
style="overflow: hidden; overflow-wrap: break-word;"><?php echo $row['remarks_rece']?></textarea>
|
|
|
|
|
|
</div>
|
|
<input type="hidden" name="doctor_attended_flag" id="doctor_attended_flag" value="N">
|
|
<input type="hidden" name="medicine_disbursement" id="medicine_disbursement" value="N">
|
|
</div>
|
|
|
|
<?php }else{?>
|
|
<?php if($roleId==2){?>
|
|
<input type="hidden" name="medical_disbursement_flag" id="medical_disbursement_flag" value="Y">
|
|
<?php }?>
|
|
<input type="hidden" name="doctor_attended_flag" id="doctor_attended_flag" value="Y">
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="form-field-8"><strong style="font-size:11px">Examination Findings</strong></label>
|
|
|
|
<div><?php echo $row['examination_remarks']?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="space-6"></div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="ailment"><strong style="font-size:11px">Diagnosis</strong></label>
|
|
<?php
|
|
if($roleId==2){?>
|
|
<input name="ailment[]" type="hidden" data-placeholder="Ailments" value="<?php echo $row['ailment_ids'] ?>" >
|
|
<input name="ailment_system[]" type="hidden" data-placeholder="Ailments" value="<?php echo $row['ailment_system_ids'] ?>" >
|
|
<input name="injury_part[]" type="hidden" data-placeholder="Ailments" value="<?php echo $row['injury_parts'] ?>" >
|
|
<input name="health_advice_name[]" type="hidden" data-placeholder="Ailments" value="<?php echo $row['health_advices'] ?>" >
|
|
|
|
<input name="isEmergency" type="hidden" data-placeholder="Ailments" value="<?php echo $row['IsEmergency'] ?>" >
|
|
|
|
|
|
|
|
<?php }?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select multiple="" class="chosen-select form-control" id="ailment" disabled name="ailment[]" data-placeholder="Ailments" >
|
|
|
|
<?php echo generateOptionForMultiple('ailment','ailment_name','ailment_id',$row['ailment_ids']); ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="ailment_system"><strong style="font-size:11px">Ailment System</strong></label>
|
|
|
|
|
|
<select multiple="" disabled class="chosen-select form-control" id="ailment_system" name="ailment_system[]" data-placeholder="Choose a System..." >
|
|
<?php echo generateOptionForMultiple('ailment_system','ailment_sys_name','ailment_sys_id',$row['ailment_system_ids']); ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="space-6"></div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-12 table-responsive">
|
|
<table id="treatmentTable<?php echo $row_history['appointment_id']?>" class="table table-striped table-bordered">
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class=" control-label " for="form-field-8"><strong
|
|
` style="font-size: 11px">Medicine Disbursement</strong>
|
|
</label>
|
|
</div>
|
|
<div class="col-sm-1">
|
|
|
|
<div> <?php if($row['medi_disbursement']=='Y'){ echo "Yes"; }
|
|
if($row['medi_disbursement']=='N'){ echo "No"; }
|
|
?> </div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="row">
|
|
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="referral"><strong style="font-size:11px">Referral</strong></label>
|
|
<div name="referral" rows="4" cols="8"id="referral" placeholder="Referral"><?php echo $row['referral']?></div>
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
|
<label class="control-label" for="followup"><strong style="font-size:11px">Follow-up</strong></label>
|
|
<div id="followup" rows="4" cols="8"name="followup" placeholder="Follow Up" "><?php echo $row['followup']?></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php }?>
|
|
|
|
|
|
|
|
</div><!-- /.col-xs-12 -->
|
|
</div><!--row end-->
|
|
|
|
</div><!--end of widget-main-->
|
|
</div><!--end of widget-body-->
|
|
</div><!--end of widget-box-->
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-xs-3 table-responsive">
|
|
<div class="widget-box box box-danger">
|
|
|
|
<div class="widget-body">
|
|
<div class="widget-main">
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label class="control-label" for="form-field-select-1"><strong style="font-size:11px">Emergency?</strong></label>
|
|
<div><?php if($row['IsEmergency']==0){echo "No";}else {echo "Yes";}?></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="space-6"></div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div>
|
|
<div class="col-sm-3">SBP:<?php echo $row['bp_sbp']?></div>
|
|
<div class="col-sm-3">DBP:<?php echo $row['bp_dbp']?></div>
|
|
<div class="col-sm-6">Heart Rate:<?php echo $row['heart_rate']?></div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="space-6"></div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div>
|
|
<div class="col-sm-3">FBS:<?php echo $row['blood_sugar_fbs']?></div>
|
|
<div class="col-sm-3">RBS:<?php echo $row['blood_sugar_rbs']?></div>
|
|
<div class="col-sm-3">PPBS:<?php echo $row['blood_sugar_ppbs']?></div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php if ($rolecode == 'RCP') {?>
|
|
|
|
<div class="space-6"></div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label class="control-label" for="injury_part"><strong style="font-size:11px">Affected Body Parts</strong></label>
|
|
<select multiple="" class="chosen-select form-control" id="injury_part" name="injury_part[]" disabled data-placeholder="Affected Body Parts..">
|
|
<?php echo generateOptionForMultiple('injury_part','inj_name','inj_id',$row['injury_parts'],''); ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="space-6"></div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label class="control-label" for="health_advice_name"><strong style="font-size:11px">Health Advices</strong></label>
|
|
<select multiple="" class="chosen-select form-control" id="health_advice_name" name="health_advice_name[]" disabled data-placeholder="Health Advices.." >
|
|
<?php echo generateOptionForMultiple('health_advice','health_advice_name','health_advice_id',$row['health_advices'],''); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="space-6"></div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label class="control-label" for="additional_advices"><strong style="font-size:11px">Doctor Recommended Tests</strong></label>
|
|
<select multiple="" class="chosen-select form-control" id="recommended_test" disabled name="recommended_test[]" data-placeholder="Doctor Recommended Tests.." >
|
|
<?php echo generateOptionForMultiple('checkup_form_section','section_name','section_id',$row['tests'],''); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="space-6"></div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label class="control-label" for="additional_advices"><strong style="font-size:11px">Additional Precautions</strong></label>
|
|
<div><?php echo $row['remarks']?></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<?php }?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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">
|
|
|
|
var roleId="<?php echo $_SESSION['RoleId'];?>"
|
|
if(roleId==2){
|
|
$('textarea').prop('readonly', true);
|
|
$('#injury_part').attr("readonly", "readonly");
|
|
$('#sbp').attr("readonly", "readonly");
|
|
$('#DBP').attr("readonly", "readonly");
|
|
$('#heart_rate').attr("readonly", "readonly");
|
|
$('#fbs').attr("readonly", "readonly");
|
|
$('#rbs').attr("readonly", "readonly");
|
|
$('#ppbs').attr("readonly", "readonly");
|
|
//sbp
|
|
|
|
|
|
|
|
|
|
|
|
$('#health_advice_name').prop('readonly',true);
|
|
$('#ailment').prop('disabled',true);
|
|
$('#ailment_system').prop('disabled',true);
|
|
$('#health_advice_name').prop('disabled',true);
|
|
$('#injury_part').prop('disabled',true);
|
|
$('#isEmergency').prop('disabled',true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
getMedicine();
|
|
function getMedicine(){
|
|
|
|
|
|
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();
|
|
});
|
|
|
|
|
|
|
|
//$("#appointment_date").val(appointment_date_format);
|
|
|
|
var appointment_id='<?php echo $row['appointment_id']?>'
|
|
//alert(appointment_id);
|
|
$("#appointment_id").val(appointment_id);
|
|
var content="";
|
|
content+="<thead>"
|
|
content+="<tr class=\"active\" >"
|
|
content+="<th style=\"font-size:11px; text-align: center;\" >Medicine</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">Dosage</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">For Days</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">Qty</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">Price Per Unit</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">Stock</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">Issued</th>"
|
|
content+="<th style=\"font-size:11px; text-align: center;\">Total Price</th>"
|
|
|
|
if(roleId==2){
|
|
content+="<button type=\"button\" disabled onclick=\"addRow('<?php echo $row['appointment_id']?>')\" class=\"btn btn-info btn-sm\" id=\"addrow<?php echo $row_history['appointment_id']?>\">"
|
|
content+="<span class=\"glyphicon glyphicon-plus\"></span></button></th></tr></thead>"
|
|
}
|
|
|
|
content+="<tbody>";
|
|
$("#treatmentTable").html(content);
|
|
<?php $row_treatment =null;?>
|
|
|
|
|
|
var count=0;
|
|
<?php
|
|
|
|
if($num_rows_treatment>0){
|
|
while($row_treatment=@mysqli_fetch_array($result_for_treatment)){
|
|
|
|
?>
|
|
content="";
|
|
content+="<tr style=\"width:70%\">"
|
|
content+="<td class=\"col-sm-2\" style=\"width:15%\">"
|
|
if(roleId==2){
|
|
content+="<input name=\"treatment_item_"+count+"\" id=\"treatment_item_"+count+"\" type=\"hidden\" value=\"<?php echo $row_treatment['item_id']?>\" >"
|
|
|
|
content+="<input id=\"treatment_item_dosage"+'_'+count+"\" type=\"hidden\" value=\"<?php echo $row_treatment['frequency_id']?>\" >"
|
|
content+="<input type=\"hidden\" name=\"treatment_id"+count+"\" id=\"treatment_id"+'_'+count+"\" value=\"<?php echo $row_treatment['treatment_id']?>\">"
|
|
|
|
|
|
|
|
content+="<div id=\"treatment_item\"><?php $item=getTableFieldValue('tbl_items','item_name','item_id',$row_treatment['item_id']); echo $item;?></div></td>"
|
|
content+="<td class=\"col-sm-2\" style=\"width:15%\">"
|
|
content+="<select class=\"chosen-select form-control\" id=\"treatment_item_dosage"+'_'+count+"\" name=\"treatment_item_dosage"+count+"\" data-placeholder=\"Dosages...\" onchange=\"getFrequenceyQty(this.value,'frequency_qty"+"_"+count+"','dosage"+"_"+count+"','"+appointment_id+"', '"+count+"');\">"
|
|
content+="<?php echo generateOption('medicine_frequency','medicine_frequency','frequency_id',$row_treatment['frequency_id'],''); ?>"
|
|
content+="</select>"
|
|
content+="<input type=\"hidden\" name=\"treatment_id"+count+"\" id=\"treatment_id"+'_'+count+"\" value=\"<?php echo $row_treatment['treatment_id']?>\"></td>"
|
|
content+="<td class=\"col-sm-2\" style=\"width:10%\">"
|
|
content+="<div id=\"treatment_item_days"+'_'+count+"\" > <?php echo $row_treatment['for_days']?></div>"
|
|
|
|
|
|
}else{
|
|
content+="<input name=\"treatment_item_"+count+"\" id=\"treatment_item_"+count+"\" type=\"hidden\" value=\"<?php echo $row_treatment['item_id']?>\" >"
|
|
content+="<input id=\"treatment_item_dosage"+'_'+count+"\" type=\"hidden\" value=\"<?php echo $row_treatment['frequency_id']?>\" >"
|
|
content+="<div id=\"treatment_item\"><?php $item=getTableFieldValue('tbl_items','item_name','item_id',$row_treatment['item_id']); echo $item;?></div></td>"
|
|
content+="<td class=\"col-sm-2\" style=\"width:15%\">"
|
|
content+="<?php echo getTableFieldValue('medicine_frequency','medicine_frequency','frequency_id',$row_treatment['frequency_id'],''); ?>"
|
|
|
|
content+="<input type=\"hidden\" name=\"treatment_id"+count+"\" id=\"treatment_id"+'_'+count+"\" value=\"<?php echo $row_treatment['treatment_id']?>\"></td>"
|
|
content+="<td class=\"col-sm-2\" style=\"width:10%\">"
|
|
content+="<div id=\"treatment_item_days"+'_'+count+"\" > <?php echo $row_treatment['for_days']?></div>"
|
|
}
|
|
|
|
|
|
|
|
content+="</td>"
|
|
|
|
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
|
content+="<input type=\"hidden\" name=\"frequency_qty"+count+"\" id=\"frequency_qty"+'_'+count+"\" />"
|
|
content+="<input type=\"hidden\" name=\"dosage"+count+"\" id=\"dosage"+'_'+count+"\" />"
|
|
content+="<div style=\"text-align:center\" id=\"treatment_item_total_"+count+"\">"
|
|
content+="</div>"
|
|
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_total"+count+"\" id=\"treatment_item_total"+'_'+count+"\" />"
|
|
content+="</td>"
|
|
|
|
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
|
content+="<div style=\"text-align:center\" id=\"current_rate_div"+count+"\" >"
|
|
content+="</div>"
|
|
|
|
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"current_rate"+count+"\" id=\"current_rate"+'_'+count+"\" />"
|
|
content+="</td>"
|
|
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
|
content+="<div style=\"text-align:center\" id=\"current_stock_div"+count+"\">"
|
|
content+="</div>"
|
|
content+="<input type=\"hidden\" name=\"current_stock"+count+"\" id=\"current_stock"+'_'+count+"\" />"
|
|
|
|
content+="</td>"
|
|
|
|
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
|
content+="<input type=\"text\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_qtygvn"+count+"\" id=\"treatment_item_qtygvn"+'_'+count+"\" value=\"<?php echo $row_treatment['issued_qty']?>\" onchange=\"itemLevelTotol('treatment_item_qtygvn"+"_"+count+"','current_rate"+"_"+count+"','treatment_item_total_amount"+"_"+count+"','treatment_item_total_amount_div"+count+"');checkQty()\"/>"
|
|
content+="</td>"
|
|
|
|
content+="<td class=\"col-sm-1\" style=\"width:5%\">"
|
|
content+="<div style=\"text-align:center\" id=\"treatment_item_total_amount_div"+count+"\"><?php echo $row_treatment['price']?></div>"
|
|
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px\" class=\"form-control\" name=\"treatment_item_total_amount"+count+"\" id=\"treatment_item_total_amount"+'_'+count+"\" value=\"<?php echo $row_treatment['price']?>\" />"
|
|
//content+="<td class=\"col-sm-1\" style=\"width:5%\"><a class=\"deleteRow\"></a>"
|
|
|
|
content+="</td>"
|
|
|
|
content+="</tr>"
|
|
$("#treatmentTable").append(content);
|
|
if(roleId==2){
|
|
$('#treatment_item'+'_'+count).prop('disabled',true);
|
|
$('#treatment_item_dosage'+'_'+count).prop('disabled',true);
|
|
}
|
|
|
|
|
|
getItemDetails($("#treatment_item"+'_'+count).val(),"current_stock"+'_'+count,"current_stock_div"+count,"current_rate"+'_'+count,"current_rate_div"+count,appointment_id+"_"+count,count,'edit');
|
|
getFrequenceyQty($("#treatment_item_dosage"+'_'+count).val(),"frequency_qty"+'_'+count,"dosage"+'_'+count,appointment_id,count);
|
|
updateTotalMedicineQty("frequency_qty"+'_'+count,"treatment_item_days"+'_'+count,"treatment_item_total"+'_'+count,"treatment_item_total_amount_div"+count);
|
|
//itemLevelTotol("treatment_item_qtygvn"+appointment_id+"_"+count,"current_rate"+appointment_id+"_"+count,"treatment_item_total_amount"+appointment_id+"_"+count,"treatment_item_total_amount"+appointment_id+count);
|
|
|
|
count=count+1;
|
|
|
|
|
|
|
|
//onchange=\"getItemDetails(this.value,'current_stock"+appointment_id+'_'+count,"current_stock"+appointment_id+'_'+count,"current_rate"+appointment_id+'_'+count,"current_rate"+appointment_id+'_'+count,appointment_id+"_"+count, count);\"
|
|
//'dosage<?php echo $row['appointment_id']?>_0','<?php echo $row['appointment_id']?>',"+count+");\">"
|
|
|
|
var content=""; //$('#treatment_item'+appointment_id+'_'+count+").val()
|
|
if(count<=1) {
|
|
content+="</tbody>"
|
|
content+="<tfoot>"
|
|
content+="<tr>"
|
|
content+="<td colspan=\"7\" style=\"text-align: right;\">"
|
|
content+="<strong style=\"font-size:11px;\">Total Amount :</strong></td>"
|
|
content+="<td colspan=\"2\" >"
|
|
content+="<input type=\"hidden\" name=\"count_treatment_item\" id=\"count_treatment_item\" value=\"0\" />"
|
|
content+="<input type=\"hidden\" name=\"count_treatment_item_old\" id=\"count_treatment_item_old\" value=\"0\" />"
|
|
|
|
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px;width:60px;align:center\" class=\"form-control\" name=\"order_level_total\" id=\"order_level_total\" value=\"<?php echo $row['total_amount']?>\" />"
|
|
content+="<div id=\"order_level_total_div\" style=\"margin-left:30px\"><?php echo $row['total_amount']?></div>"
|
|
content+="</td>"
|
|
content+="</tr>"
|
|
content+="<tr>"
|
|
content+="</tr>"
|
|
content+="</tfoot>"
|
|
$("#treatmentTable").append(content);
|
|
|
|
|
|
}
|
|
|
|
$("#count_treatment_item").val(count);
|
|
setFieldDisableOrEnable('<?php echo $row['medi_disbursement'];?>')
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
}else{
|
|
|
|
?>
|
|
var content="";
|
|
content+="</tbody>"
|
|
content+="<tfoot>"
|
|
content+="<tr>"
|
|
content+="<td colspan=\"7\" style=\"text-align: right;\">"
|
|
content+="<strong style=\"font-size:11px;\">Total Amount :</strong></td>"
|
|
content+="<td colspan=\"2\" >"
|
|
content+="<input type=\"hidden\" name=\"count_treatment_item\" id=\"count_treatment_item\" value=\"0\" />"
|
|
content+="<input type=\"hidden\" name=\"count_treatment_item_old\" id=\"count_treatment_item_old\" value=\"0\" />"
|
|
|
|
content+="<input type=\"hidden\" style=\"height:25px;font-size:12px;width:60px;align:center\" class=\"form-control\" name=\"order_level_total\" id=\"order_level_total\" value=\"<?php echo $row['total_amount']?>\" />"
|
|
content+="<div id=\"order_level_total_div\" style=\"margin-left:30px\"><?php echo $row['total_amount']?></div>"
|
|
content+="</td>"
|
|
content+="</tr>"
|
|
content+="<tr>"
|
|
content+="</tr>"
|
|
content+="</tfoot>"
|
|
$("#treatmentTable").append(content);
|
|
$("#count_treatment_item").val(count);
|
|
$("#count_treatment_item_old").val(count);
|
|
|
|
var appointment_id="<?php echo $row['appointment_id']?>";
|
|
addRow(appointment_id);
|
|
addRow(appointment_id);
|
|
addRow(appointment_id);
|
|
|
|
<?php
|
|
}
|
|
|
|
|
|
|
|
//getItemDetails(item_id, current_stock_field,current_stock_field_div, current_rate_field,current_rate_field_div, appointment_id, counter)
|
|
|
|
?>
|
|
|
|
|
|
//alert(no_rows);
|
|
|
|
|
|
|
|
|
|
|
|
//var itemOptions="<?php echo generateOption('tbl_items','item_name','item_id',$row_treatment['item_id'],''); ?>"
|
|
//$("#treatment_item0").html(itemOptions);
|
|
|
|
|
|
}
|
|
function addRow(appointment_id){
|
|
var counter=$("#count_treatment_item").val();
|
|
var itemOptions="<?php echo generateOption('tbl_items','item_name','item_id','',''); ?>";
|
|
var itemDosages="<?php echo generateOption('medicine_frequency','medicine_frequency','frequency_id','',''); ?>";
|
|
|
|
var newRow = $("<tr style=\"width:70%\">");
|
|
var cols = "";
|
|
var select_treatment="";
|
|
select_treatment+="<select onchange=\"getItemDetails(this.value,'current_stock"+"_"+counter+"','current_stock_div"+counter+"','current_rate"+"_"+counter+"','current_rate_div"+counter+"','"+appointment_id+"', '"+counter+"');\" class='chosen-select form-control'";
|
|
select_treatment+="id=\"treatment_item"+"_"+counter+"\"name=\"treatment_item"+counter+"\"data-placeholder=\"Treatment...\"";
|
|
//select_treatment+="style=\"display: none;\"";
|
|
select_treatment+=">";
|
|
|
|
select_treatment+="<option value=\"\"> </option>";
|
|
select_treatment+=itemOptions
|
|
select_treatment+="</select>";
|
|
|
|
cols += '<td style=\"width:15%\">'+select_treatment+'</td>';
|
|
var select_dosage="";
|
|
select_dosage+="<select onchange=\"getFrequenceyQty(this.value,'frequency_qty"+"_"+counter+"','dosage"+"_"+counter+"','"+appointment_id+"', '"+counter+"');\" class='chosen-select form-control'";
|
|
select_dosage+="id=\"treatment_item_dosage"+"_"+counter+"\"name=\"treatment_item_dosage"+counter+"\"data-placeholder=\"Dosage...\"";
|
|
//select_dosage+="style=\"display: none;\"";
|
|
select_dosage+=">";
|
|
|
|
select_dosage+="<option value=\"\"> </option>";
|
|
select_dosage+=itemDosages
|
|
select_dosage+="</select>";
|
|
|
|
cols += '<td style=\"width:15%\" >'+select_dosage+'</td>';
|
|
cols += '<td style=\"width:10%\"><input type=\"hidden\" name=\"treatment_id'+counter+'" id=\"treatment_id'+'_'+counter+'" ><input type="number" style="height:25px;font-size:12px" class="form-control"id ="treatment_item_days'+'_'+counter+'" value="1" onblur="updateTotalMedicineQty(\'frequency_qty'+'_'+counter+'\',\'treatment_item_days'+'_'+counter+'\',\'treatment_item_total_'+counter+'\',\'treatment_item_total_div'+counter+'\')" name="treatment_item_days'+ counter + '"/></td>';
|
|
cols += '<td style=\"width:5%\" ><div style="text-align:center" id="treatment_item_total_div'+counter+'""></div><input type="hidden" style="height:25px;font-size:12px" class="form-control"id="treatment_item_total_'+counter+'" name="treatment_item_total'+appointment_id + counter + '" readonly/></td>';
|
|
cols += '<td style=\"width:5%\"><input type="hidden" name="frequency_qty'+counter+'" id="frequency_qty'+'_'+counter+'" /><input type="hidden" name="dosage'+counter+'" id="dosage'+appointment_id+'_'+counter+'" /> <div style="text-align:center" id="current_rate_div'+counter+'" "></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="current_rate'+'_'+counter+'" name="current_rate' + counter + '" onblur="updatePrice(\'treatment_item_qtygvn'+'_'+counter+'\',\'treatment_item'+'_'+counter+'\',\'current_rate'+'_'+counter+'\',\'current_stock'+'_'+counter+'\',\'price'+'_'+counter+'\')" /></td>';
|
|
cols += '<td style=\"width:5%\"><div style="text-align:center" id="current_stock_div'+counter + '" ></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="current_stock'+'_'+counter+'" name="current_stock' + counter + '" /></td>';
|
|
cols += '<td style=\"width:5%\"><input type="text" style="height:25px;font-size:12px" class="form-control" id="treatment_item_qtygvn'+'_'+counter+'" name="treatment_item_qtygvn' + counter + '" onchange="itemLevelTotol(\'treatment_item_qtygvn'+'_'+counter+'\',\'current_rate'+'_'+counter+'\',\'treatment_item_total_amount'+'_'+counter+'\',\'treatment_item_total_amount_div'+counter+'\');checkQty()" /></td>';
|
|
|
|
cols += '<td style=\"width:5%\"><div style="text-align:center" id="treatment_item_total_amount_div'+counter+'"></div><input type="hidden" style="height:25px;font-size:12px" class="form-control" id="treatment_item_total_amount'+'_'+counter+'" name="treatment_item_total_amount' + counter + '"/></td>';
|
|
if(counter>0)
|
|
cols += '<td style=\"width:5%\"><a href="#"><i class="ace-icon fa fa-trash-o bigger-130"></i></a></td>';
|
|
else
|
|
cols += '<td style=\"width:5%\"></td>';
|
|
|
|
newRow.append(cols);
|
|
$("#treatmentTable").append(newRow);
|
|
|
|
//$('#ailment_system').trigger('chosen:updated');
|
|
$('#treatment_item_dosage'+"_"+counter).chosen({allow_single_deselect:true});
|
|
$('#treatment_item_dosage'+"_"+counter).next().css({'width': $('#treatment_item_dosage'+counter).parent().width()});
|
|
|
|
$('#treatment_item'+"_"+counter).chosen({allow_single_deselect:true});
|
|
$('#treatment_item'+"_"+counter).next().css({'width': $('#treatment_item'+counter).parent().width()});
|
|
//$('#manufacturer').trigger('chosen:updated');
|
|
|
|
counter++;
|
|
$("#count_treatment_item").val(counter);
|
|
//resizeChosen();
|
|
//jQuery(window).on('resize', resizeChosen);
|
|
|
|
/* $("#treatmentTable").on("click", ".fa-trash-o", function (event) {
|
|
$(this).closest("tr").remove();
|
|
counter -= 1
|
|
$("#count_treatment_item").val(counter);
|
|
});*/
|
|
|
|
var valueChecked= $('input[name=medicine_disbursement]:checked').val();
|
|
|
|
setFieldDisableOrEnable(valueChecked)
|
|
}
|
|
$("#treatmentTable").on("click", ".fa-trash-o", function (event) {
|
|
$(this).closest("tr").remove();
|
|
var counter=$("#count_treatment_item").val();
|
|
counter -= 1
|
|
$("#count_treatment_item").val(counter);
|
|
});
|
|
|
|
/*function validate_update(formId, appointment_id){
|
|
var appointment_date = $('#appointment_date'+appointment_id).val();
|
|
if(appointment_date == ''){
|
|
BootstrapDialog.alert('Please Enter Appointment Name.!!!');
|
|
return false;
|
|
}
|
|
var complaints = $('#complaints'+appointment_id).val();
|
|
if(complaints == ''){
|
|
BootstrapDialog.alert('Please Enter Complaints.!!!');
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
var counter=$("#count_treatment_item").val();
|
|
for(var i=0;i<counter;i++){
|
|
var treatment_qty=$("#treatment_item_total_"+i).val();
|
|
var issued_qty=$("#treatment_item_qtygvn_"+i).val();
|
|
if(issued_qty==null || issued_qty==''){
|
|
issued_qty=0;
|
|
}
|
|
if(issued_qty>treatment_qty){
|
|
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
update_appointment(formId, appointment_id);
|
|
}
|
|
function update_appointment(formId, appointment_id){
|
|
$.ajax({
|
|
url : 'save_opd.php',
|
|
type : "POST",
|
|
data : $("#"+formId).serialize(),
|
|
success : function(data) {
|
|
BootstrapDialog.show({
|
|
message: 'Details Updated Successfully.',
|
|
buttons: [ {
|
|
label: 'OK',
|
|
action: function(dialogItself){
|
|
dialogItself.close();
|
|
window.location.reload();
|
|
}
|
|
}]
|
|
});
|
|
|
|
//window.location.reload();
|
|
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Updating Details');
|
|
return;
|
|
}
|
|
});
|
|
//window.location.reload();
|
|
}*/
|
|
|
|
function getFrequenceyQty(frequency_id, qty_value_field_id, dosage_desc_field_id, appointment_id, counter){
|
|
|
|
$.ajax({
|
|
url : 'select_frequency.php?frequency_id='+frequency_id,
|
|
type : "GET",
|
|
//data : $("#"+formId).serialize(),
|
|
async:false,
|
|
success : function(data) {
|
|
var data = $.parseJSON(data);
|
|
//alert(data);
|
|
if(data.qty!=null){
|
|
$("#"+qty_value_field_id).val(data.qty);
|
|
$("#"+dosage_desc_field_id).val(data.frequency_description);
|
|
|
|
}
|
|
|
|
//BootstrapDialog.alert('Injury Details Updated Successfully.');
|
|
//location.reload();
|
|
//return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error pulling frequency qty');
|
|
return;
|
|
}
|
|
|
|
});
|
|
updateTotalMedicineQty('frequency_qty'+'_'+counter,'treatment_item_days'+'_'+counter,'treatment_item_total'+'_'+counter,'treatment_item_total_amount_div'+counter)
|
|
}
|
|
|
|
function getItemDetails(item_id, current_stock_field,current_stock_field_div, current_rate_field,current_rate_field_div, appointment_id, counter,e){
|
|
|
|
$.ajax({
|
|
url : 'select_item.php?item_id='+item_id,
|
|
type : "GET",
|
|
//data : $("#"+formId).serialize(),
|
|
success : function(data) {
|
|
var data = $.parseJSON(data);
|
|
//alert(data);
|
|
//if(data.qty!=null){
|
|
if(e=='edit'){
|
|
$("#"+current_stock_field).val(data.current_stock_level)
|
|
document.getElementById(current_stock_field_div+"").innerText=data.current_stock_level;
|
|
//$("#"+current_rate_field).val(data.current_rate);
|
|
if(typeof(counter)!='undefined' && counter != null){
|
|
//document.getElementById(current_rate_field_div+"").innerText =data.current_rate;
|
|
}
|
|
|
|
|
|
}else if(data.current_stock_level>1){
|
|
|
|
$("#"+current_stock_field).val(data.current_stock_level)
|
|
document.getElementById(current_stock_field_div+"").innerText=data.current_stock_level;
|
|
//$("#"+current_rate_field).val(data.current_rate);
|
|
if(typeof(counter)!='undefined' && counter != null){
|
|
// document.getElementById(current_rate_field_div+"").innerText =data.current_rate;
|
|
}
|
|
|
|
}else{
|
|
|
|
BootstrapDialog.alert('This Item is not available in stock.');
|
|
}
|
|
|
|
|
|
|
|
//}
|
|
|
|
//BootstrapDialog.alert('Injury Details Updated Successfully.');
|
|
//location.reload();
|
|
//return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error pulling Item Details');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
/*var url='opd_form.php?employeeId='+employeeId;
|
|
alert(url);
|
|
window.location =url;*/
|
|
function opd_form(id){
|
|
$("#flex_opd_id").val(id);
|
|
$("#flex_form_opd_for").attr('method', 'POST');
|
|
$("#flex_form_opd_for").attr('action', 'opd_form.php');
|
|
$("#flex_form_opd_for").submit();
|
|
|
|
}
|
|
|
|
function setFieldDisableOrEnable(value){
|
|
var count=$("#count_treatment_item").val();
|
|
if(value=='Y'){
|
|
// $("[name='field07']").prop("disabled", false);
|
|
for(var i=0;i<count;i++){
|
|
$("#treatment_item_qtygvn_"+i).prop("disabled", false);
|
|
}
|
|
}else if(value=='N'){
|
|
|
|
for(var i=0;i<count;i++){
|
|
$("#treatment_item_qtygvn_"+i).prop("disabled", true);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function checkQty(){
|
|
|
|
|
|
var counter=$("#count_treatment_item").val();
|
|
for(var i=0;i<counter;i++){
|
|
var treatment_qty=$("#treatment_item_total_"+i).val();
|
|
var issued_qty=$("#treatment_item_qtygvn_"+i).val();
|
|
if(issued_qty==null || issued_qty==''){
|
|
issued_qty=0;
|
|
}
|
|
if(issued_qty>treatment_qty){
|
|
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function toCheckItemStock(){
|
|
|
|
var counter=$("#count_treatment_item").val();
|
|
for(var i=0;i<counter;i++){
|
|
var treatment_qty=$("#treatment_item_total_"+i).val();
|
|
var issued_qty=$("#treatment_item_qtygvn_"+i).val();
|
|
if(issued_qty==null || issued_qty==''){
|
|
issued_qty=0;
|
|
}
|
|
if(issued_qty>treatment_qty){
|
|
BootstrapDialog.alert(' Issue Qty should be less than or equal to Treatment Qty .!!!');
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function delete_appointment(appointment_id){
|
|
$("#flex_appointment_id").val(appointment_id);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete?', function(result){
|
|
if(result) {
|
|
$.ajax({
|
|
url : 'delete_appointment.php',
|
|
type : "POST",
|
|
data : $("#flex_appointment_form").serialize(),
|
|
success : function(data) {
|
|
if(data.indexOf("SUCCESS")!=-1){
|
|
BootstrapDialog.alert('Deleted Successfully.');
|
|
|
|
//$("#flex1").flexReload();
|
|
loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id']?>');
|
|
|
|
}else{
|
|
BootstrapDialog.alert('Error Deleting');
|
|
}
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Deleting');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
function itemLevelTotol(treatment_item_qtygvn_field,current_rate_field,treatment_item_total_amount_field,treatment_item_total_amount_field_div){
|
|
var appointment_id='<?php echo $row['appointment_id']?>'
|
|
var count= $("#count_treatment_item").val();
|
|
//alert(count);
|
|
var price=$("#"+current_rate_field).val();
|
|
var qty=$("#"+treatment_item_qtygvn_field).val();
|
|
var totalValue=price*qty;
|
|
///alert(totalValue);
|
|
$("#"+treatment_item_total_amount_field).val(totalValue);
|
|
document.getElementById(treatment_item_total_amount_field_div+"").innerText=totalValue;
|
|
|
|
orderLevelTotal(count);
|
|
}
|
|
|
|
function orderLevelTotal(count){
|
|
var totalAmount=0;
|
|
var appointment_id='<?php echo $row['appointment_id']?>'
|
|
//totalAmount=totalAmount+parseInt(treatment_item_total_amount_field_value);
|
|
for(var i=0;i<parseInt(count);i++){
|
|
if($("#treatment_item_total_amount_div"+'_'+i).val()!="")
|
|
totalAmount=totalAmount+parseInt($("#treatment_item_total_amount_div"+'_'+i).val());
|
|
}
|
|
|
|
//alert(totalAmount);
|
|
$("#order_level_total").val(totalAmount);
|
|
|
|
document.getElementById("order_level_total_div").innerText=totalAmount;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
function updateTotalMedicineQty(frequency_qty_fieild,treatment_item_days_fieild,treatment_item_total_fieild,treatment_item_total_fieild_div)
|
|
{
|
|
frequency_qty = parseInt($("#"+frequency_qty_fieild).val());
|
|
treatment_item_days=parseInt($("#"+treatment_item_days_fieild).text());
|
|
if(treatment_item_days==null || treatment_item_days=='' || treatment_item_days==0){
|
|
treatment_item_days =1;
|
|
}
|
|
$("#"+treatment_item_total_fieild).text(treatment_item_days*frequency_qty);
|
|
document.getElementById(treatment_item_total_fieild_div+"").innerText =treatment_item_days*frequency_qty;
|
|
}
|
|
|
|
function updatePrice(qty_issued_field, item_id_field,current_rate_field,current_stock_field,price_field){
|
|
|
|
qty_issued = $("#"+qty_issued_field).val();
|
|
item_id = $("#"+item_id_field).val();
|
|
current_rate = $("#"+current_rate_field).val();
|
|
current_stock = $("#"+current_stock_field).val();
|
|
if(parseFloat(current_stock)<parseFloat(qty_issued)){
|
|
BootstrapDialog.alert('You trying to issue more than the available qty. Available:'+current_stock+", issued qty:"+qty_issued);
|
|
|
|
}
|
|
price = $("#"+price_field).val(qty_issued*current_rate);
|
|
|
|
|
|
}
|
|
/* function validate(){
|
|
var appointment_date = $('#appointment_date').val();
|
|
if(appointment_date == ''){
|
|
BootstrapDialog.alert('Please Enter Appointment Name.!!!');
|
|
return false;
|
|
}
|
|
var complaints = $('#complaints').val();
|
|
if(complaints == ''){
|
|
BootstrapDialog.alert('Please Enter Complaints.!!!');
|
|
return false;
|
|
}
|
|
save_appointment();
|
|
} */
|
|
|
|
function exporttopdf(){
|
|
|
|
|
|
document.forms['pdfform'].action="opd_form_pdf.php";
|
|
document.forms['pdfform'].method="post";
|
|
document.forms['pdfform'].submit();
|
|
}
|
|
function save_appointment(){
|
|
$.ajax({
|
|
url : 'save_opd.php',
|
|
type : "POST",
|
|
data : $("#opd_form").serialize(),
|
|
success : function(data) {
|
|
var data = $.parseJSON(data);
|
|
//alert(data);
|
|
if(data[0].appointment_id!=null){
|
|
$("#appointment_id").val(data[0].appointment_id);
|
|
$("#appointment_id_pdf").val(data[0].appointment_id);
|
|
}
|
|
if(data[1]!=null && data[1]!=""){
|
|
for(var i=0;i<data[1].length;i++){
|
|
$("#treatment_id_"+i).val(data[1][i]);
|
|
}
|
|
|
|
}
|
|
|
|
BootstrapDialog.alert('Details Saved Successfully.');
|
|
window.location.reload();
|
|
//loadAppointmentHistory('<?php echo $_REQUEST['flex_opd_id']?>');
|
|
//return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Saving Details');
|
|
//return;
|
|
}
|
|
});
|
|
}
|
|
|
|
jQuery(function($) {
|
|
$('#id-disable-check').on('click', function() {
|
|
var inp = $('#form-input-readonly').get(0);
|
|
if(inp.hasAttribute('disabled')) {
|
|
inp.setAttribute('readonly' , 'true');
|
|
inp.removeAttribute('disabled');
|
|
inp.value="This text field is readonly!";
|
|
}
|
|
else {
|
|
inp.setAttribute('disabled' , 'disabled');
|
|
inp.removeAttribute('readonly');
|
|
inp.value="This text field is disabled!";
|
|
}
|
|
});
|
|
|
|
|
|
if(!ace.vars['touch']) {
|
|
$('.chosen-select').chosen({allow_single_deselect:true});
|
|
//resize the chosen on window resize
|
|
|
|
$(window)
|
|
.off('resize.chosen')
|
|
.on('resize.chosen', function() {
|
|
$('.chosen-select').each(function() {
|
|
var $this = $(this);
|
|
$this.next().css({'width': $this.parent().width()});
|
|
})
|
|
}).trigger('resize.chosen');
|
|
//resize chosen on sidebar collapse/expand
|
|
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
|
|
if(event_name != 'sidebar_collapsed') return;
|
|
$('.chosen-select').each(function() {
|
|
var $this = $(this);
|
|
$this.next().css({'width': $this.parent().width()});
|
|
})
|
|
});
|
|
|
|
|
|
$('#chosen-multiple-style .btn').on('click', function(e){
|
|
var target = $(this).find('input[type=radio]');
|
|
var which = parseInt(target.val());
|
|
if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
|
|
else $('#form-field-select-4').removeClass('tag-input-style');
|
|
});
|
|
}
|
|
|
|
|
|
$('[data-rel=tooltip]').tooltip({container:'body'});
|
|
$('[data-rel=popover]').popover({container:'body'});
|
|
|
|
autosize($('textarea[class*=autosize]'));
|
|
|
|
$('textarea.limited').inputlimiter({
|
|
remText: '%n character%s remaining...',
|
|
limitText: 'max allowed : %n.'
|
|
});
|
|
|
|
$.mask.definitions['~']='[+-]';
|
|
$('.input-mask-date').mask('99/99/9999');
|
|
$('.input-mask-phone').mask('(999) 999-9999');
|
|
$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
|
|
$(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
|
|
|
|
|
|
|
|
$( "#input-size-slider" ).css('width','200px').slider({
|
|
value:1,
|
|
range: "min",
|
|
min: 1,
|
|
max: 8,
|
|
step: 1,
|
|
slide: function( event, ui ) {
|
|
var sizing = ['', 'input-sm', 'input-lg', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
|
|
var val = parseInt(ui.value);
|
|
$('#form-field-4').attr('class', sizing[val]).attr('placeholder', '.'+sizing[val]);
|
|
}
|
|
});
|
|
|
|
$( "#input-span-slider" ).slider({
|
|
value:1,
|
|
range: "min",
|
|
min: 1,
|
|
max: 12,
|
|
step: 1,
|
|
slide: function( event, ui ) {
|
|
var val = parseInt(ui.value);
|
|
$('#form-field-5').attr('class', 'col-xs-'+val).val('.col-xs-'+val);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
//"jQuery UI Slider"
|
|
//range slider tooltip example
|
|
$( "#slider-range" ).css('height','200px').slider({
|
|
orientation: "vertical",
|
|
range: true,
|
|
min: 0,
|
|
max: 100,
|
|
values: [ 17, 67 ],
|
|
slide: function( event, ui ) {
|
|
var val = ui.values[$(ui.handle).index()-1] + "";
|
|
|
|
if( !ui.handle.firstChild ) {
|
|
$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
|
|
.prependTo(ui.handle);
|
|
}
|
|
$(ui.handle.firstChild).show().children().eq(1).text(val);
|
|
}
|
|
}).find('span.ui-slider-handle').on('blur', function(){
|
|
$(this.firstChild).hide();
|
|
});
|
|
|
|
|
|
$( "#slider-range-max" ).slider({
|
|
range: "max",
|
|
min: 1,
|
|
max: 10,
|
|
value: 2
|
|
});
|
|
|
|
$( "#slider-eq > span" ).css({width:'90%', 'float':'left', margin:'15px'}).each(function() {
|
|
// read initial values from markup and remove that
|
|
var value = parseInt( $( this ).text(), 10 );
|
|
$( this ).empty().slider({
|
|
value: value,
|
|
range: "min",
|
|
animate: true
|
|
|
|
});
|
|
});
|
|
|
|
$("#slider-eq > span.ui-slider-purple").slider('disable');//disable third item
|
|
|
|
|
|
$('#id-input-file-1 , #id-input-file-2').ace_file_input({
|
|
no_file:'No File ...',
|
|
btn_choose:'Choose',
|
|
btn_change:'Change',
|
|
droppable:false,
|
|
onchange:null,
|
|
thumbnail:false //| true | large
|
|
//whitelist:'gif|png|jpg|jpeg'
|
|
//blacklist:'exe|php'
|
|
//onchange:''
|
|
//
|
|
});
|
|
//pre-show a file name, for example a previously selected file
|
|
//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
|
|
|
|
|
|
$('#id-input-file-3').ace_file_input({
|
|
style: 'well',
|
|
btn_choose: 'Drop files here or click to choose',
|
|
btn_change: null,
|
|
no_icon: 'ace-icon fa fa-cloud-upload',
|
|
droppable: true,
|
|
thumbnail: 'small'//large | fit
|
|
//,icon_remove:null//set null, to hide remove/reset button
|
|
/**,before_change:function(files, dropped) {
|
|
//Check an example below
|
|
//or examples/file-upload.html
|
|
return true;
|
|
}*/
|
|
/**,before_remove : function() {
|
|
return true;
|
|
}*/
|
|
,
|
|
preview_error : function(filename, error_code) {
|
|
//name of the file that failed
|
|
//error_code values
|
|
//1 = 'FILE_LOAD_FAILED',
|
|
//2 = 'IMAGE_LOAD_FAILED',
|
|
//3 = 'THUMBNAIL_FAILED'
|
|
//alert(error_code);
|
|
}
|
|
|
|
}).on('change', function(){
|
|
//console.log($(this).data('ace_input_files'));
|
|
//console.log($(this).data('ace_input_method'));
|
|
});
|
|
|
|
|
|
//$('#id-input-file-3')
|
|
//.ace_file_input('show_file_list', [
|
|
//{type: 'image', name: 'name of image', path: 'http://path/to/image/for/preview'},
|
|
//{type: 'file', name: 'hello.txt'}
|
|
//]);
|
|
|
|
|
|
|
|
|
|
//dynamically change allowed formats by changing allowExt && allowMime function
|
|
$('#id-file-format').removeAttr('checked').on('change', function() {
|
|
var whitelist_ext, whitelist_mime;
|
|
var btn_choose
|
|
var no_icon
|
|
if(this.checked) {
|
|
btn_choose = "Drop images here or click to choose";
|
|
no_icon = "ace-icon fa fa-picture-o";
|
|
|
|
whitelist_ext = ["jpeg", "jpg", "png", "gif" , "bmp"];
|
|
whitelist_mime = ["image/jpg", "image/jpeg", "image/png", "image/gif", "image/bmp"];
|
|
}
|
|
else {
|
|
btn_choose = "Drop files here or click to choose";
|
|
no_icon = "ace-icon fa fa-cloud-upload";
|
|
|
|
whitelist_ext = null;//all extensions are acceptable
|
|
whitelist_mime = null;//all mimes are acceptable
|
|
}
|
|
var file_input = $('#id-input-file-3');
|
|
file_input
|
|
.ace_file_input('update_settings',
|
|
{
|
|
'btn_choose': btn_choose,
|
|
'no_icon': no_icon,
|
|
'allowExt': whitelist_ext,
|
|
'allowMime': whitelist_mime
|
|
})
|
|
file_input.ace_file_input('reset_input');
|
|
|
|
file_input
|
|
.off('file.error.ace')
|
|
.on('file.error.ace', function(e, info) {
|
|
//console.log(info.file_count);//number of selected files
|
|
//console.log(info.invalid_count);//number of invalid files
|
|
//console.log(info.error_list);//a list of errors in the following format
|
|
|
|
//info.error_count['ext']
|
|
//info.error_count['mime']
|
|
//info.error_count['size']
|
|
|
|
//info.error_list['ext'] = [list of file names with invalid extension]
|
|
//info.error_list['mime'] = [list of file names with invalid mimetype]
|
|
//info.error_list['size'] = [list of file names with invalid size]
|
|
|
|
|
|
/**
|
|
if( !info.dropped ) {
|
|
//perhapse reset file field if files have been selected, and there are invalid files among them
|
|
//when files are dropped, only valid files will be added to our file array
|
|
e.preventDefault();//it will rest input
|
|
}
|
|
*/
|
|
|
|
|
|
//if files have been selected (not dropped), you can choose to reset input
|
|
//because browser keeps all selected files anyway and this cannot be changed
|
|
//we can only reset file field to become empty again
|
|
//on any case you still should check files with your server side script
|
|
//because any arbitrary file can be uploaded by user and it's not safe to rely on browser-side measures
|
|
});
|
|
|
|
|
|
/**
|
|
file_input
|
|
.off('file.preview.ace')
|
|
.on('file.preview.ace', function(e, info) {
|
|
console.log(info.file.width);
|
|
console.log(info.file.height);
|
|
e.preventDefault();//to prevent preview
|
|
});
|
|
*/
|
|
|
|
});
|
|
|
|
$('#spinner1').ace_spinner({value:0,min:0,max:200,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
|
|
.closest('.ace-spinner')
|
|
.on('changed.fu.spinbox', function(){
|
|
//console.log($('#spinner1').val())
|
|
});
|
|
$('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, touch_spinner: true, icon_up:'ace-icon fa fa-caret-up bigger-110', icon_down:'ace-icon fa fa-caret-down bigger-110'});
|
|
$('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus bigger-110', icon_down:'ace-icon fa fa-minus bigger-110', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
|
|
$('#spinner4').ace_spinner({value:0,min:-100,max:100,step:10, on_sides: true, icon_up:'ace-icon fa fa-plus', icon_down:'ace-icon fa fa-minus', btn_up_class:'btn-purple' , btn_down_class:'btn-purple'});
|
|
|
|
//$('#spinner1').ace_spinner('disable').ace_spinner('value', 11);
|
|
//or
|
|
//$('#spinner1').closest('.ace-spinner').spinner('disable').spinner('enable').spinner('value', 11);//disable, enable or change value
|
|
//$('#spinner1').closest('.ace-spinner').spinner('value', 0);//reset to 0
|
|
|
|
|
|
//datepicker plugin
|
|
//link
|
|
$('.date-picker').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true
|
|
})
|
|
//show datepicker when clicking on the icon
|
|
.next().on(ace.click_event, function(){
|
|
$(this).prev().focus();
|
|
});
|
|
|
|
//or change it into a date range picker
|
|
$('.input-daterange').datepicker({autoclose:true});
|
|
|
|
|
|
//to translate the daterange picker, please copy the "examples/daterange-fr.js" contents here before initialization
|
|
$('input[name=date-range-picker]').daterangepicker({
|
|
'applyClass' : 'btn-sm btn-success',
|
|
'cancelClass' : 'btn-sm btn-default',
|
|
locale: {
|
|
applyLabel: 'Apply',
|
|
cancelLabel: 'Cancel',
|
|
}
|
|
})
|
|
.prev().on(ace.click_event, function(){
|
|
$(this).next().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(),
|
|
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();
|
|
});
|
|
|
|
|
|
$('#colorpicker1').colorpicker();
|
|
//$('.colorpicker').last().css('z-index', 2000);//if colorpicker is inside a modal, its z-index should be higher than modal'safe
|
|
|
|
$('#simple-colorpicker-1').ace_colorpicker();
|
|
//$('#simple-colorpicker-1').ace_colorpicker('pick', 2);//select 2nd color
|
|
//$('#simple-colorpicker-1').ace_colorpicker('pick', '#fbe983');//select #fbe983 color
|
|
//var picker = $('#simple-colorpicker-1').data('ace_colorpicker')
|
|
//picker.pick('red', true);//insert the color if it doesn't exist
|
|
|
|
|
|
$(".knob").knob();
|
|
|
|
|
|
var tag_input = $('#form-field-tags');
|
|
try{
|
|
tag_input.tag(
|
|
{
|
|
placeholder:tag_input.attr('placeholder'),
|
|
//enable typeahead by specifying the source array
|
|
source: ailments,//defined in ace.js >> ace.enable_search_ahead
|
|
/**
|
|
//or fetch data from database, fetch those that match "query"
|
|
source: function(query, process) {
|
|
$.ajax({url: 'remote_source.php?q='+encodeURIComponent(query)})
|
|
.done(function(result_items){
|
|
process(result_items);
|
|
});
|
|
}
|
|
*/
|
|
}
|
|
)
|
|
|
|
//programmatically add/remove a tag
|
|
var $tag_obj = $('#form-field-tags').data('tag');
|
|
$tag_obj.add('Programmatically Added');
|
|
|
|
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.after('<textarea id="'+tag_input.attr('id')+'" name="'+tag_input.attr('name')+'" rows="3">'+tag_input.val()+'</textarea>').remove();
|
|
//autosize($('#form-field-tags'));
|
|
}
|
|
|
|
|
|
/////////
|
|
$('#modal-form input[type=file]').ace_file_input({
|
|
style:'well',
|
|
btn_choose:'Drop files here or click to choose',
|
|
btn_change:null,
|
|
no_icon:'ace-icon fa fa-cloud-upload',
|
|
droppable:true,
|
|
thumbnail:'large'
|
|
})
|
|
|
|
//chosen plugin inside a modal will have a zero width because the select element is originally hidden
|
|
//and its width cannot be determined.
|
|
//so we set the width after modal is show
|
|
$('#modal-form').on('shown.bs.modal', function () {
|
|
if(!ace.vars['touch']) {
|
|
$(this).find('.chosen-container').each(function(){
|
|
$(this).find('a:first-child').css('width' , '210px');
|
|
$(this).find('.chosen-drop').css('width' , '210px');
|
|
$(this).find('.chosen-search input').css('width' , '200px');
|
|
});
|
|
}
|
|
})
|
|
/**
|
|
//or you can activate the chosen plugin after modal is shown
|
|
//this way select element becomes visible with dimensions and chosen works as expected
|
|
$('#modal-form').on('shown', function () {
|
|
$(this).find('.modal-chosen').chosen();
|
|
})
|
|
*/
|
|
|
|
|
|
|
|
$(document).one('ajaxloadstart.page', function(e) {
|
|
autosize.destroy('textarea[class*=autosize]')
|
|
|
|
$('.limiterBox,.autosizejs').remove();
|
|
$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu').remove();
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
.modal-dialog {
|
|
padding: 15px;
|
|
width: 45%;
|
|
}
|
|
|
|
.form-control {
|
|
height: 30px;
|
|
}
|
|
|
|
.close {
|
|
font-size: 12px;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.input-group-addon {
|
|
padding: unset;
|
|
}
|
|
</style>
|