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

846 lines
31 KiB
PHP

<?php include('techsyn_header.php'); ?>
<?php include('log_entry.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">Checkup Section Master
</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div class="box box-primary" align='center' style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
<form id="checkup_section_movement_form" method="post">
<!-- box-body-->
<div class="box-body" id="reload_amb " style="width:80%; ">
<div class="row">
<div class="col-sm-12">
<table id="myTable" class="table table-bordered order-list">
<thead>
<tr>
<th>CHECKUP SECTION NAME</th>
<th>DESCRIPTION</th>
<th>Notes</th>
<th>Comments</th>
</tr>
</thead>
<?php $i = 0;
$row = null;
if (isset($_REQUEST['flex_checkup_section_id'])) {
$sql = "select * from checkup_form_section where section_id='" . $_REQUEST['flex_checkup_section_id'] . "'";
$result = mysqli_query($conn, $sql);
$num_rows = mysqli_num_rows($result);
$row = mysqli_fetch_array($result);
}
do {
?>
<tbody>
<tr>
<td style="width:5%">
<input type="hidden" name="section_id<?= $i ?>" id="section_id<?= $i ?>" value="<?= $row['section_id'] ?>" />
<input type="text" name="section_name<?= $i ?>" value="<?= $row['section_name'] ?>" id="section_name<?= $i ?>" class="form-control" />
</td>
<td style="width:6%">
<input type="text" name="section_desc<?= $i ?>" id="section_desc<?= $i ?>" value="<?= $row['section_desc'] ?>" class="form-control" />
</td>
<td style="width: 10%;">
<textarea class="form-control" style="text-transform: none;" name="notes<?= $i ?>" id="notes<?= $i ?>" cols="30" rows="5"><?= $row['notes'] ?></textarea>
</td>
<td style="width: 10%;">
<textarea class="form-control" style="text-transform: none;" name="comments<?= $i ?>" id="comments<?= $i ?>" cols="30" rows="5"><?= $row['comments'] ?></textarea>
</td>
</tr>
<?php
$i++;
} while ($row = mysqli_fetch_array($result)) //end of while
?>
<input type="hidden" name="count_items" id="count_items" value="<?= $i ?>" />
</tbody>
<tfoot>
<tr>
<td style="width:4%">
<label for="">Set Status</label><br>
<input type="checkbox" name="Status" id="Status1" value="Active">
<label for="Status1"> Active</label><br>
<input type="checkbox" name="Status" id="Status1" value="Inactive">
<label for="Status1"> Inactive</label>
</td>
<td colspan="2">
<label for="rule">Applicable Rules</label>
<select multiple="" class="chosen-select form-control" id="rule" name="rule[]" data-placeholder="">
<optgroup label="With Result Field Value">
<option value="" disabled></option>
<?php echo generate_options("
select concat(r.rule_equation ,' (Section=> ',f.section_name,' )' ) as sname,rule_eq_id as id from rule_equation r left join
checkup_parameter c
on r.result = c.checkup_parameter_id left join checkup_form_section f on f.section_id = c.checkup_form_section_id
where result != '0'", '', 'id', 'sname', '', '') ?>
</optgroup>
<optgroup label="Without Result Field Value">
<option value="" disabled></option>
<?php echo generateOptionWithWhereClause('rule_equation', 'rule_equation', 'rule_eq_id', '', '', 'result', '0') ?>
</optgroup>
</select>
</td>
<td>
<label for="sequence">Section Sequence</label>
<input type="number" name="dis_order" id="dis_order" class="form-control">
</td>
</tr>
<tr>
<td>
<label for="is_Interpretation">Interpretation?</label>
<select name="is_interpretation" id="is_interpretation" class="form-control">
<option value="" disabled selected>
--select--
</option>
<?php echo generateOption('interpretation_master', 'interpretation_header', 'id', '', ''); ?>
</select>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<!-- End box-body-->
<!--box-footer-->
<?php
//$hasWriteAccess = isAccessible ( $_SESSION ['RoleId'], $menu_key, 'W' );
?>
<?php //if ($hasWriteAccess) {
?>
<div class="box-footer" style="text-align: center;">
<button class="btn btn-success new_button" id="new_button" type="reset" onclick="show_save_button();">
<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
New
</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-info save_button" type="button" id="save_button" onclick="validate();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
Save
</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-warning" type="reset">
<i class="ace-icon fa fa-undo bigger-110"></i>
Reset
</button>
</div>
<?php //}
?>
<!--End box-footer-->
</form>
</div>
<!-- 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>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<!-- End of breadcrumb -->
<div class="page-content" style="margin-top: -47px;">
<div id="flexigridDiv" class="table-responsive">
<form><input type="hidden" name="f1" method="post" id="flex_appointment_form" action="bio_medical_waste_generation_excel.php">
<div id="flex1" style="width:100%">
<input type="hidden" name="flex_checkup_section_id" id="flex_checkup_section_id" />
</div>
</form>
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action" value="checkup_section_pdf.php" />
<input type="hidden" name="excel_action" id="excel_action" value="checkup_section_excel.php" />
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$('input[type="checkbox"] ').on('change', function() {
$(this).siblings('input[type="checkbox"]').prop('checked', false);
});
$(function() {
var w = screen.width * .95;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .50;
$("#flex1").flexigrid({
url: 'checkup_section_scripts.php',
dataType: 'json',
colModel: [
{
display: 'SR.NO',
name: 'section_id',
width: w * .10,
sortable: true,
align: 'center'
},
{
display: '',
name: 'link',
width: w * .10,
sortable: false,
align: 'center'
},
{
display: 'CHECKUP SECTION NAME',
name: 'section_name',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'DESCRIPTION',
name: 'section_desc',
width: w * .20,
sortable: true,
align: 'left'
},
{
display: 'Status',
name: 'Status',
width: w * .10,
sortable: true,
align: 'left'
},
{
display: 'Note',
name: 'notes',
width: w * .40,
sortable: true,
align: 'left'
},
{
display: 'Comments',
name: 'comments',
width: w * .40,
sortable: true,
align: 'left'
}, {
display: 'Rules',
name: 'rules',
width: w * .40,
sortable: true,
align: 'left'
}, {
display: 'Section Sequence',
name: 'display_order',
width: w * .1,
sortable: true,
align: 'left'
}, {
display: 'Interpretation',
name: 'interpretation',
width: w * .1,
sortable: true,
align: 'left'
}
],
buttons: [
// {name: 'Add', bclass: 'add', onpress : add},
//{separator: true},
//{name: 'PDFReport', bclass: 'print', onpress : pdfReport},
// {separator: true},
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
}
],
searchitems: [
//{display: 'Patient Name', name : 'patient_name' },
{
display: 'CHECKUP SECTION NAME',
name: 'section_name'
},
{
display: 'DESCRIPTION',
name: 'section_desc'
},
],
sortname: "section_id",
sortorder: "asc",
usepager: true, //pagination
//title:"Employee OPD",
useRp: true,
rp: 20, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
// width: w,
height: h,
singleSelect: true
});
});
function add() {
$("#checkup_section_name").val("");
$("#description").val("");
//$('#modal-add-ambulance-form').modal("show");
}
function show_save_button() {
$("#save_button").show();
$("#checkup_section_id").val("");
}
function save_checkup_section_details() {
$.ajax({
url: 'save_checkup_section.php',
type: "POST",
data: $("#checkup_section_movement_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Checkup Section Details Saved Successfully.');
$("#flex1").flexReload();
$("#section_id").val("");
$("#section_name").val("");
$("#section_desc").val("");
$("#notes").val("");
$("#dis_order").val("");
$("#comments").val("");
$("#is_interpretation").val("");
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Checkup Section Details');
return;
}
});
$('.close').click();
}
function open_checkup_section_move(flex_checkup_section_id, action) {
if (action == "V") {
//$(".save_button").hide()
location.href = "view_checkup_section.php?flex_checkup_section_id=" + flex_checkup_section_id +
"";
$(".save_button").hide()
} else {
location.href = "checkup_section_master.php?flex_checkup_section_id=" +
flex_checkup_section_id + "";
}
}
function delete_checkup_section_form(section_id) {
$.ajax({
url: 'delete_checkup_section.php',
data: {
'section_id': section_id
},
type: 'POST',
dataType: 'json',
success: function(data) {
if (data == 'SUCCESS') {
BootstrapDialog.alert('Delele Checkup Section Details Successfully');
$("#flex1").flexReload();
return;
}
},
error: function(data) {
BootstrapDialog.alert('Error in Checkup Section Details ');
return;
}
});
}
function open_checkup_section_form(section_id, access) {
if (access == 'V') {
$("#save_button").hide()
} else if (access == 'E')
$("#save_button").show()
$.ajax({
url: 'select_checkup_section.php',
data: {
'section_id': section_id
},
type: 'POST',
dataType: 'json',
success: function(data) {
$("#section_id0").val(data.section_id);
$("#section_name0").val(data.section_name);
$("#section_desc0").val(data.section_desc);
$("#product_id").val(data.product_id);
$("#notes0").val(data.notes);
$("#comments0").val(data.comments);
$("#dis_order").val(data.display_order);
if (data.rule_ids != null) {
var rules = data.rule_ids
dataarray = rules.split(",");
$("#rule").val(dataarray);
$('#rule').trigger('chosen:updated');
}
// $("#Status").val(data.Status);
$('input:checkbox[id=Status1][value=' + data.Status + ']').prop('checked',
true);
$("#is_interpretation").val(data.interpretation);
//$('#modal-add-ambulance-form').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating Checkup Section Details');
return;
}
});
}
function pdf() {
window.open('checkup_section_pdf.php');
}
function excel() {
window.open('checkup_section_excel.php');
}
// function myDateFormat(date){
// var d=new Date(date);
// var day=d.getDate();
// var m=d.getMonth()+1;
// var y=d.getFullYear();
// return day+"-"+m+"-"+y;
// }
</script>
<?php // include('techsyn_footer.php');
?>
</div>
<!-- End of page-content -->
</div>
</div>
</div>
<script>
function validate() {
var checkup_section_name0 = $('#section_name0').val();
if (checkup_section_name0 == '') {
BootstrapDialog.alert('Please Enter Checkup Section Name.!!!');
return false;
}
let description = $('#section_desc0').val();
if (description == '') {
BootstrapDialog.alert('Please Enter Checkup Description.!!!');
return false;
}
for (let i = 0; i < description.length; i++) {
let result = isValid(description[i]);
if (!result) {
BootstrapDialog.alert("You can not enter spaces and special characters in section description");
return result;
}
}
save_checkup_section_details();
}
$("#section_desc0").keypress(function(event) {
var character = String.fromCharCode(event.keyCode);
// alert(character);
// alert(isValid(character));
return isValid(character);
});
function isValid(str) {
return !/[~`!@#$%\^&*()+=\-\\ \[\]\\';,/{}|\\":<>\?]/g.test(str);
}
</script>
<style>
#modal-add-ailment {
overflow-y: scroll;
}
</style>
<!--
<?php include('techsyn_footer.php');
?>
<script type="text/javascript">
$('.select2').select2()
jQuery(function($) {
var myTable =
$('#dynamic-table')
.DataTable( {
bAutoWidth: false,
"aoColumns": [
{ "bSortable": false },
null, null,null, null, null,
{ "bSortable": false }
],
"aaSorting": [],
select: {
style: 'multi'
}
} );
var defaultCopyAction = myTable.button(1).action();
myTable.button(1).action(function (e, dt, button, config) {
defaultCopyAction(e, dt, button, config);
$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
});
var defaultColvisAction = myTable.button(0).action();
myTable.button(0).action(function (e, dt, button, config) {
defaultColvisAction(e, dt, button, config);
if($('.dt-button-collection > .dropdown-menu').length == 0) {
$('.dt-button-collection')
.wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
.find('a').attr('href', '#').wrap("<li />")
}
$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
});
setTimeout(function() {
$($('.tableTools-container')).find('a.dt-button').each(function() {
var div = $(this).find(' > div').first();
if(div.length == 1) div.tooltip({container: 'body', title: div.parent().text()});
else $(this).tooltip({container: 'body', title: $(this).text()});
});
}, 500);
myTable.on( 'select', function ( e, dt, type, index ) {
if ( type === 'row' ) {
$( myTable.row( index ).node() ).find('input:checkbox').prop('checked', true);
}
} );
myTable.on( 'deselect', function ( e, dt, type, index ) {
if ( type === 'row' ) {
$( myTable.row( index ).node() ).find('input:checkbox').prop('checked', false);
}
} );
$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;
$('#dynamic-table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) myTable.row(row).select();
else myTable.row(row).deselect();
});
});
$('#dynamic-table').on('click', 'td input[type=checkbox]' , function(){
var row = $(this).closest('tr').get(0);
if(this.checked) myTable.row(row).deselect();
else myTable.row(row).select();
});
$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault();
});
var active_class = 'active';
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
var th_checked = this.checked;
$(this).closest('table').find('tbody > tr').each(function(){
var row = this;
if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
});
});
$('#simple-table').on('click', 'td input[type=checkbox]' , function(){
var $row = $(this).closest('tr');
if($row.is('.detail-row ')) return;
if(this.checked) $row.addClass(active_class);
else $row.removeClass(active_class);
});
$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
function tooltip_placement(context, source) {
var $source = $(source);
var $parent = $source.closest('table')
var off1 = $parent.offset();
var w1 = $parent.width();
var off2 = $source.offset();
if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
return 'left';
}
/***************/
$('.show-details-btn').on('click', function(e) {
e.preventDefault();
$(this).closest('tr').next().toggleClass('open');
$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass('fa-angle-double-up');
});
/***************/
})
$('.date-picker').datepicker({
autoclose:true,
format:'dd/mm/yyyy'
}).next().on(ace.click_event,function(){
$(this).prev().focus();
});
</script>
<!--
<script type="text/javascript"> -->
<!-- <script type="text/javascript">
$(document).ready(function () {
var counter = $("#count_items").val();
//alert (counter);
$("#addrow").on("click", function () {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="text" class="form-control" id="section_name' + counter + '" name="section_name' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="section_desc' + counter + '" name="section_desc' + 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);
$("#myTable").append(newRow);
/*$('#item_id'+counter).chosen({allow_single_deselect:true});
$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});*/
counter++;
// $('.select2').select2()
// $("#count_items").val(counter);
// $('.date-picker').datepicker({
// autoclose: true,
// todayHighlight: true
// })
});
$("#myTable").on("click", "#deletebtn", function (event) {
$(this).closest("tr").remove();
counter -= 1
$("#count_items").val(counter);
});
});
</script> -->