ESH/medical_form_list.php

184 lines
5.1 KiB
PHP
Raw Permalink Normal View History

2024-10-23 18:28:06 +05:30
<?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 class="#">Data Setup</li><li class="#">Medical Items</li><li class="active">medical_form</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div id="flexigridDiv" class="table-responsive">
<form name="f1" method="post" action=""id="flex_form_medical_form">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_medical_form_id" id="flex_medical_form_id"/>
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function () {
var w=screen.width*.90;
var h =0;
h =(window.innerHeight-($("#navbar").height()+$(".breadcrumbs").height()))*.75;
$("#flex1").flexigrid({
url: 'medical_form_list_script.php',
dataType: 'json',
colModel: [
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
{display: 'Medical Form Name', name: 'form_name', width: w*.2, sortable: true, align: 'left'},
{display: 'Medical Form Code', name: 'form_code', width: w*.2, sortable: true, align: 'left'},
{display: 'is Qty Fixed?', name: 'is_qty_fixed', width: w*.2, sortable: true, align: 'left'},
{display: '', name: '', width: w*.3, sortable: false, 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: 'Medical Form Name', name: 'form_name', isdefault: true},
{display: 'Medical Form Code', name: 'form_code'}
],
sortname: "form_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 add(){
$(".save_button").show();
$("#medical_form_id").val("");
$("#medical_form_name").val("");
$("#medical_form_code").val("");
$('#modal-add-medical-form').modal("show");
}
function pdf(){
window.open('pdf_medical_form.php');
}
function excel(){
window.location = 'excel_medical_form.php';
}
function delete_medical_form(medical_formId){
$("#flex_medical_form_id").val(medical_formId);
BootstrapDialog.confirm('Are you sure to delete the Medical Form?', function(result){
if(result) {
$.ajax({
url : 'delete_medical_form.php',
type : "POST",
data : $("#flex_form_medical_form").serialize(),
success : function(data) {
if(data.indexOf("SUCCESS")!=-1){
BootstrapDialog.alert('Medicine Form Deleted Successfully.');
$("#flex1").flexReload();
}else{
BootstrapDialog.alert('Error Deleting Medicine Form');
}
return;
},
error : function(data) {
BootstrapDialog.alert('Error Deleting Medicine Form');
return;
}
});
}
});
}
function save_medical_form(){
$.ajax({
url : 'save_medical_form.php ',
type : "POST",
data : $("#medical_form_form").serialize(),
success : function(data) {
BootstrapDialog.alert('Medical Form Saved Successfully.');
$("#flex1").flexReload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving Medical Form');
return;
}
});
$('.close').click();
}
var medical_form_id = "";
function open_medical_form(medical_formId, action) {
var medical_form_id = "";
if(action=="V"){
$(".save_button").hide();
}else{
$(".save_button").show();
}
$.ajax({
url : 'select_medical_form.php?medical_formId='+medical_formId+' ',
type : 'POST',
success : function(data) {
//alert(data);
var data = $.parseJSON(data);
//alert(data);
$("#medical_form_id").val(data.form_id);
$("#medical_form_name").val(data.form_name);
$("#medical_form_code").val(data.form_code);
$("#is_qty_fixed").val(data.is_qty_fixed);
$('#modal-add-medical-form').modal("show");
},
error : function(data) {
BootstrapDialog.alert('Error Populating Medical');
return;
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/add_medical_form.php');?>