188 lines
4.8 KiB
PHP
188 lines
4.8 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="#">Settings</li><li class="#">Medical Item</li><li class="active">Medical Frequency</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
|
|
<div>
|
|
|
|
<form name="f1" method="post" action="" id="flex_form_medicine">
|
|
<div id="flex1" style="width:100%">
|
|
</div>
|
|
<input type="hidden" name="flex_medicine_id" id="flex_medicine_id"/>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
|
|
</div><!-- /.page-content -->
|
|
</div>
|
|
</div><!-- /.main-content -->
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
var w=screen.width*.90;
|
|
var h =$(".main-content").height()+100;
|
|
$("#flex1").flexigrid({
|
|
url: 'medicine_script.php',
|
|
dataType: 'json',
|
|
colModel: [
|
|
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
|
|
|
|
{display: 'Medicine Frequency', name: 'medicine_frequency', width: w*.08, sortable: true, align: 'left'},
|
|
{display: 'Medicine Desc', name: 'medicine_name', width: w*.2, sortable: true, align: 'left'},
|
|
|
|
{display: '', name: '', width: w*.2, sortable: true, align: 'left'},
|
|
|
|
|
|
],
|
|
buttons: [
|
|
|
|
{name: 'Add', bclass: 'add', onpress : add},
|
|
{separator: true},
|
|
{name: 'PDF', bclass: 'print', onpress : pdf},
|
|
{separator: true},
|
|
{name: 'Excel', bclass: 'print_excel', onpress : excel},
|
|
{separator: true}
|
|
],
|
|
searchitems: [
|
|
|
|
{display: 'Medicine Frequency', name: 'medicine_frequency', isdefault: true},
|
|
{display: 'Medicine Desc', name: 'medicine_name'}
|
|
],
|
|
sortname: "medicine_id",
|
|
sortorder: "asc",
|
|
usepager: true, //pagination
|
|
|
|
useRp: true,
|
|
rp: 50, //records per page
|
|
showTableToggleBtn: false, //toggle button for the whole table
|
|
resizable: true,
|
|
//width: w,
|
|
height: h,
|
|
singleSelect: true
|
|
});
|
|
});
|
|
|
|
function pdf(){
|
|
window.open('pdf_medicine.php');
|
|
}
|
|
function excel(){
|
|
window.location = 'excel_medicine.php';
|
|
}
|
|
|
|
function add(){
|
|
$(".save_button").show();
|
|
$("#medicine_id").val("");
|
|
$("#medicine_name").val("");
|
|
$("#medicine_frequency").val("");
|
|
|
|
|
|
|
|
$('#modal-add-medicine').modal("show");
|
|
}
|
|
|
|
function delete_medicine(medicineId){
|
|
$("#flex_medicine_id").val(medicineId);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete the Medicine?', function(result){
|
|
if(result) {
|
|
$.ajax({
|
|
url : 'delete_medicine.php',
|
|
type : "POST",
|
|
data : $("#flex_form_medicine").serialize(),
|
|
success : function(data) {
|
|
if(data.indexOf("SUCCESS")!=-1){
|
|
BootstrapDialog.alert('Medicine Deleted Successfully.');
|
|
$("#flex1").flexReload();
|
|
|
|
}else{
|
|
BootstrapDialog.alert('Error Deleting Medicine');
|
|
}
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Deleting Medicine');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function save_medicine(){
|
|
var sub_category_id;
|
|
$.ajax({
|
|
url : 'save_medicine.php',
|
|
type : 'POST',
|
|
data : $("#medicine_form").serialize(),
|
|
success : function(data) {
|
|
BootstrapDialog.alert('Medicine Saved Successfully');
|
|
$("#flex1").flexReload();
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Saving Medicine');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
|
|
|
|
|
|
function open_medicine(medicineId, action) {
|
|
|
|
if(action=="V"){
|
|
$(".save_button").hide();
|
|
|
|
}else{
|
|
$(".save_button").show();
|
|
}
|
|
$.ajax({
|
|
url : 'select_medicine.php?medicineId='+medicineId+' ',
|
|
type : 'POST',
|
|
success : function(data) {
|
|
|
|
var data = $.parseJSON(data);
|
|
|
|
$("#medicine_id").val(data.medicine_id);
|
|
|
|
$("#medicine_name").val(data.medicine_name);
|
|
$("#medicine_frequency").val(data.medicine_frequency);
|
|
|
|
$('#modal-add-medicine').modal("show");
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Populating Medicine');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<?php include('form/add_medicine.php');?>
|