ESH/medicine_category.php

197 lines
5.7 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="#">Masters</li><li class="active">Medicine Usage Category</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_role">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="role_id" id="flex_role_id"/>
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action" value="medicine_category_pdf.php"/>
<input type="hidden" name="excel_action" id="excel_action" value="medicine_category_excel.php"/>
</form>
</div>
</div><!-- /.page-content -->
</div>
</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: 'medicine_category_script.php',
dataType: 'json',
colModel: [
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
{display: 'Usage Name', name: 'medicine_usage_cat_name', width: w*.2, sortable: true, align: 'left'},
{display: 'Usage Description', name: 'cat_desc', width: w*.2, sortable: true, align: 'left'},
{display: 'Usage code', name: 'code', width: w*.2, sortable: true, align: 'left'},
//{display: 'Added By', name: '', 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: 'Usage Name', name: 'medicine_usage_cat_name', isdefault: true},
{display: 'Usage Description', name: 'cat_desc'},
{display: 'Usage Code', name: 'code'}
],
sortname: "medicine_usage_cat_name",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 25, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function pdf(){
window.open('ajax_pdf.php','Medicine Usage Category');
}
function excel(){
window.open('ajax_excel.php','Medicine Usage Category');
}
function add(){
$(".save_button").show();
$("#medicine_usage_cat_id").val("");
$("#medicine_usage_cat_name").val("");
$("#cat_desc").val("");
$("#code").val("");
$('#modal-add-medicine_usage_cat').modal("show");
}
function save_medicine_category(){
$.ajax({
url : 'save_medicine_category.php',
type : "POST",
data : $("#medicine_usage_cat_form").serialize(),
success : function(data) {
BootstrapDialog.alert('Medicine Saved Successfully.');
$("#flex1").flexReload();
return;
},
error : function(data) {
BootstrapDialog.alert('Error Saving In med cat ');
return;
}
});
$('.close').click();
}
var role_id = "";
function open_medicine_usage_cat(medicine_usage_cat_id, action) {
if(action=="V"){
$(".save_button").hide();
}else{
$(".save_button").show();
}
$.ajax({
url : 'select_medicine_category.php',
type : 'POST',
data:{medicine_usage_cat_id:medicine_usage_cat_id},
dataType:"json",
success : function(data) {
//alert(data);
//alert(data);
$("#medicine_usage_cat_id").val(data.medicine_usage_cat_id);
$("#medicine_usage_cat_name").val(data.medicine_usage_cat_name);
$("#cat_desc").val(data.cat_desc);
$("#code").val(data.code);
$('#modal-add-medicine_usage_cat').modal("show");
},
error : function(data) {
BootstrapDialog.alert('Error In Pulling Medicine category');
return;
}
});
}
function delete_medicine_category(medicine_usage_cat_id){
BootstrapDialog.confirm('Are you sure to delete the medicine?', function(result){
if(result){
$.ajax({
url : 'delete_medicine_category.php',
data:{medicine_usage_cat_id:medicine_usage_cat_id},
type : 'POST',
dataType:'json',
success : function(data) {
if(data=='SUCCESS') {
BootstrapDialog.alert('Deleted Medicine Details Successfully');
$("#flex1").flexReload();
return;
}
},
error : function(data) {
BootstrapDialog.alert('Error Medicine Details Successfully');
return;
}
});
}
});
}
</script>
<?php include('common_list.php'); ?>
<?php include('techsyn_footer.php'); ?>
<?php include('common_ace.php'); ?>
<?php include('form/add_medicine_category_form.php');?>