448 lines
15 KiB
PHP
448 lines
15 KiB
PHP
<?php include('techsyn_header.php'); ?>
|
|
<!-- Main Content Container for side bar and body-->
|
|
<?php
|
|
$rule_eq_id = $_REQUEST['flex_rule_equation_id'];
|
|
$action = $_REQUEST['toPage'];
|
|
error_log("action " . $action);
|
|
//$rule_eq_id=1;
|
|
error_log("rule_eq_id" . $rule_eq_id);
|
|
|
|
if ($rule_eq_id != Null || $rule_eq_id != "") {
|
|
|
|
$sqll1 = "select * from rule_equation where rule_eq_id='" . $rule_eq_id . "'";
|
|
|
|
error_log("sqll1" . $sqll1);
|
|
$resultl1 = mysqli_query($conn, $sqll1);
|
|
$rowl1 = mysqli_fetch_array($resultl1);
|
|
|
|
$checkup_form_section_id = $rowl1['checkup_form_section_id'];
|
|
// error_log("checkup_form_section_id" . $checkup_form_section_id);
|
|
// $section_name = getTableFieldValue('checkup_form_section', 'section_name', 'section_id', $checkup_form_section_id);
|
|
// error_log("section_name" . $section_name);
|
|
}
|
|
|
|
?>
|
|
|
|
<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">Limit Setter</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
<div class="page-content">
|
|
<div class="box box-primary" style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; ">
|
|
|
|
<form name="rulegen" method="post" id="rulegen">
|
|
<!-- box-body-->
|
|
<div class="box-body" id="reload_rule">
|
|
<div class="row">
|
|
<div class="form-group col-sm-12">
|
|
<label for="firm_code"> Activity</label>
|
|
<select name="checkup_section_id" id="checkup_section_id" value="<?=$checkup_form_section_id?>" style="width:100%" ><?= generateOption('program_master','program_name','program_id',$checkup_form_section_id,'')?></select>
|
|
<input type="hidden" name="rule_eq_id" id="rule_eq_id" value="<?= $rule_eq_id ?>" />
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<input type="hidden" name="rule_eq_id" id="rule_eq_id" value="<?= $rule_eq_id ?>" />
|
|
<div class="col-sm-12">
|
|
<table id="myTable" class="table table-bordered order-list">
|
|
<thead>
|
|
<tr>
|
|
<th>Joiner</th>
|
|
<th>Open Bracket</th>
|
|
<th>Benificiary parameter</th>
|
|
<th>Condition</th>
|
|
<th>Value</th>
|
|
<th>close bracket</th>
|
|
<th>Add</th>
|
|
</tr>
|
|
</thead>
|
|
<?php $i = 0;
|
|
|
|
$sql2 = "select * from rule_save where equation_rule_id='" . $rule_eq_id . "'";
|
|
error_log("sql2" . $sql2);
|
|
$result2 = mysqli_query($conn, $sql2);
|
|
$row2 = mysqli_fetch_assoc($result2);
|
|
@extract($row2);
|
|
do {
|
|
?>
|
|
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<?php if ($i > 0) {
|
|
?>
|
|
<select id="rule_joiner_id<?= $i ?>" name="rule_joiner_id<?= $i ?>" value="<?= $row2['joiner_id']; ?>" class="form-control" style="width:100%;">
|
|
<option disabled selected>select the joiner</option>
|
|
<?php echo generateOption('rule_joiner', 'joiner_sy', 'rule_joiner_id', '', ''); ?>
|
|
</select>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
<td>
|
|
<input type="text" name="op_br<?= $i ?>" id="op_br<?= $i ?>" value="<?= $row2['op_br']; ?>" style="width: 100%;" />
|
|
</td>
|
|
|
|
<td>
|
|
<select name="checkup_parameter_id<?= $i ?>" id="checkup_parameter_id<?= $i ?>" value="<?= $row2['checkup_parameter']; ?>" class="form-control" style="width: 100%;">
|
|
<option disabled selected>select paramter</option>
|
|
<?php echo generateOption('checkup_parameter a','concat(parameter_name,"-",(select program_name from program_master where program_id=a.activity ))','column_name',$row2['checkup_parameter'],'');
|
|
?>
|
|
|
|
</select>
|
|
</td>
|
|
|
|
<td><select id="rule_condition_id<?= $i ?>" name="rule_condition_id<?= $i ?>" value="<?= $row2['condition_id']; ?>" class="form-control" style="width:100%;">
|
|
<option disabled selected>select the condition</option> <?php echo generateOption('rule_condition', 'condition_sy', 'rule_condition_id', '', ''); ?>
|
|
</select></td>
|
|
<td><input type="number" step="any" name="value<?= $i ?>" id="value<?= $i ?>" value="<?= $row2['rule_s_val']; ?>" style="width:100%;"></td>
|
|
<td>
|
|
<input type="text" name="cl_br<?= $i ?>" id="cl_br<?= $i ?>" value="<?= $row2['cl_br']; ?>" style="width: 100%;" />
|
|
</td>
|
|
<td align="center">
|
|
<?php
|
|
if ($i == 0) { ?>
|
|
<input type="button" class="btn btn-sm btn-block " id="addrow" value="join Condition" />
|
|
<?php } else { ?>
|
|
<a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a><?php
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
$i++;
|
|
} while ($row2 = mysqli_fetch_array($result2)) ?>
|
|
<input type="hidden" name="count_items" id="count_items" value="<?= $i ?>" />
|
|
|
|
</tbody>
|
|
|
|
|
|
<tfoot>
|
|
|
|
<!-- <td>RESULT PARAMETER</td> -->
|
|
<td>
|
|
<!-- <select name="result" id="result" class="form-control">
|
|
<option value="" disabled selected>select paramter</option>
|
|
<?php
|
|
$sqle = "select * from checkup_parameter where checkup_form_section_id='" . $checkup_form_section_id . "'";
|
|
error_log("sqle " . $sqle);
|
|
$resulte = mysqli_query($conn, $sqle);
|
|
while ($rowe = mysqli_fetch_array($resulte)) {
|
|
?><option value="<?php echo $rowe['checkup_parameter_id'] ?>"><?php echo $rowe['parameter_name'] ?></option><?php
|
|
} ?>
|
|
</select>-->
|
|
</td>
|
|
<td><label>Yearly Subsidy</label><input type="number" name="Subsidy" id="Subsidy" value="<?= $rowl1['Subsidy']; ?>" style="width: 100%;"></td>
|
|
<td><label>No. of Bags Per Month</label><input type="number" name="no_of_bag" id="no_of_bag" value="<?= $rowl1['no_of_bag']; ?>" style="width: 100%;"></td>
|
|
<!-- <td><label>Gender</label><select id="rule_gender" name="rule_gender" style="width: 100%" class="form-control" value="<?= $rowl1['rule_gender']; ?>">
|
|
<option disabled selected value="">Select Gender </option>
|
|
<option value="M">Male</option>
|
|
<option value="F">Female </option>
|
|
</select></td>-->
|
|
|
|
<!-- <td><label for="result">Abnormality Alter To Show</label><input type="text" name="result_disp" id="result_disp" value="<?= $rowl1['result_disp']; ?>" style="width: 100%;" /></td> -->
|
|
<!--<td>
|
|
<label for="abnormality">Abnormality</label>
|
|
<select name="abnormality" id="abnormality" class="form-control">
|
|
<option value="">select</option>
|
|
<?php echo generateOption('abnormality', 'abnormality_name', 'abnormality_id', $rowl1['abnormality'], '') ?>
|
|
</select>
|
|
</td>
|
|
|
|
</tfoot>
|
|
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<!-- End box-body-->
|
|
<!--box-footer-->
|
|
<?php
|
|
//change on module
|
|
//$hasWriteAccess = isAccessible($_SESSION['RoleId'], $menu_key, 'W');
|
|
// error_log("RoleId".$_SESSION['RoleId']);
|
|
$hasWriteAccess = 1;
|
|
?>
|
|
<?php if ($hasWriteAccess) { ?>
|
|
<div class="box-footer" style="text-align: center;">
|
|
<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>
|
|
|
|
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<!--End box-footer-->
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- /.page-content -->
|
|
</div>
|
|
</div><!-- /.main-content -->
|
|
|
|
<script type="text/javascript">
|
|
var itemOptions1 = "<?php echo generateOption('rule_joiner', 'joiner_sy', 'rule_joiner_id', '', ''); ?>";
|
|
var itemOptions2 = "<?php echo generateOption('rule_condition', 'condition_sy', 'rule_condition_id', '', ''); ?>";
|
|
var itemOptions ="<?php echo generateOption('checkup_parameter a','concat(parameter_name,"-",(select program_name from program_master where program_id=a.activity ))','column_name',$row2['checkup_parameter'],''); ?>"
|
|
|
|
var rule_eq_id = "<?php echo $rule_eq_id ?>";
|
|
var action = "<?php echo $action ?>";
|
|
var cout = "<?php echo getTableFieldValue('rule_equation', 'cout', 'rule_eq_id', $rule_eq_id); ?>";
|
|
|
|
$(document).ready(function() {
|
|
var counter = $("#count_items").val();
|
|
open_user(rule_eq_id, action);
|
|
$("#addrow").on("click", function() {
|
|
// var checkup_section_id = "<?php echo $checkup_form_section_id; ?>";
|
|
// if (checkup_section_id == null || checkup_section_id == "") {
|
|
// BootstrapDialog.alert("Please select checkup section");
|
|
// } else {
|
|
selectpar1(counter);
|
|
var itemOptions = "<?php echo generateOption('checkup_parameter a','concat(parameter_name,"-",(select program_name from program_master where program_id=a.activity ))','column_name',$row2['checkup_parameter'],'');?>";
|
|
var newRow = $("<tr>");
|
|
var cols = "";
|
|
cols += "<td><select ";
|
|
cols += "id=\"rule_joiner_id" + counter + "\"name=\"rule_joiner_id" + counter + "\" class=\"form-control select2\" style=\"width:100%;\"";
|
|
cols += ">";
|
|
cols += "<option disabled selected>select the joiner</option>";
|
|
cols += itemOptions1;
|
|
cols += "</select></td>";
|
|
cols += '<td><input type="text" name="op_br' + counter + '" id="op_br' + counter + '" pattern="[^(]+" style=\"width:100%;\" /></td>';
|
|
cols += "<td><select ";
|
|
cols += "id=\"checkup_parameter_id" + counter + "\"name=\"checkup_parameter_id" + counter + "\" class=\"form-control select2\" style=\"width:100%;\"";
|
|
cols += ">";
|
|
cols += itemOptions;
|
|
cols += "</select></td>";
|
|
cols += "<td><select ";
|
|
cols += "id=\"rule_condition_id" + counter + "\"name=\"rule_condition_id" + counter + "\" class=\"form-control select2\" style=\"width:100%;\"";
|
|
cols += ">";
|
|
cols += "<option disabled selected>select the condition</option>";
|
|
cols += itemOptions2;
|
|
cols += "</select></td>";
|
|
cols += '<td><input type="number" name="value' + counter + '" id="value' + counter + '" style="width:100%;"></td>';
|
|
cols += '<td><input type="text" name="cl_br' + counter + '" id="cl_br' + counter + '" pattern="[^(]+" style=\"width:100%;\" /></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);
|
|
counter++;
|
|
$("#count_items").val(counter);
|
|
// }
|
|
});
|
|
$("#myTable").on("click", "#deletebtn", function(event) {
|
|
$(this).closest("tr").remove();
|
|
counter -= 1
|
|
$("#count_items").val(counter);
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<script>
|
|
// function selectpar(checkup_section_id) {
|
|
// $("#checkup_section_id").val();
|
|
// $.ajax({
|
|
// type: "POST",
|
|
// url: "get_checkup_parameter.php",
|
|
// data: {
|
|
// 'checkup_section_id': checkup_section_id
|
|
// },
|
|
// success: function(data) {
|
|
// $("#checkup_parameter_id0").html(data);
|
|
|
|
// }
|
|
// });
|
|
// }
|
|
|
|
function selectpar1(sid) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "get_key_checkup_param_name.php",
|
|
data: {sid:sid,
|
|
checkup_section_id:$('#checkup_section_id').val()
|
|
},
|
|
success: function(data) {
|
|
// alert(data);
|
|
$("#checkup_parameter_id" + sid).html(data);
|
|
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<script>
|
|
function validate() {
|
|
$.ajax({
|
|
url: 'save_rule_gen.php',
|
|
type: "POST",
|
|
data: $("#rulegen").serialize(),
|
|
success: function(data) {
|
|
BootstrapDialog.alert('Rule created sucesfully.');
|
|
$("checkup_section_id").val("");
|
|
$("checkup_parameter_id").val("");
|
|
$("rule_condition_id").val("");
|
|
$("rule_joiner_id").val("");
|
|
$("result").val("");
|
|
window.location = 'rule_generation.php';
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Saving Rule Details');
|
|
return;
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function refr() {
|
|
('#')
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
function open_user(rule_eq_id, action) {
|
|
if (action == "V") {
|
|
$(".save_button").hide();
|
|
|
|
} else {
|
|
$(".save_button").show();
|
|
}
|
|
|
|
|
|
$("#rule_condition_id0").val("");
|
|
|
|
$.ajax({
|
|
url: 'select_rules.php',
|
|
data: {
|
|
'rule_eq_id': rule_eq_id
|
|
},
|
|
type: 'POST',
|
|
success: function(data) {
|
|
|
|
var data = $.parseJSON(data);
|
|
// alert(data[0].cout);
|
|
console.log(data);
|
|
if (data[0].cout > 1) {
|
|
// $("#checkup_parameter_id0").val(data.checkup_parameter);
|
|
// var checkup_parameter_id = data.checkup_parameter;
|
|
for (i = 0; i < data[0].cout; i++) {
|
|
$("#checkup_parameter_id" + (i)).val(data[i].checkup_parameter);
|
|
$("#rule_condition_id" + (i)).val(data[i].condition_id);
|
|
$("#rule_joiner_id" + (i)).val(data[i].joiner_id);
|
|
$("#result").val(data[i].result);
|
|
$("#rule_gender").val(data[i].rule_gender);
|
|
// $("#checkup_parameter_id1").val(data[1].checkup_parameter);
|
|
// $("#rule_condition_id1").val(data[1].condition_id);
|
|
// $("#checkup_section_id").val(data.checkup_form_section_id);
|
|
// var cfsid = data.checkup_form_section_id;
|
|
// var content = "<option value=" + data.staff_id + ">" + data.name + "</option>";
|
|
// onchange=selectpar(cfsid);
|
|
// $("#staff_id").val(data.staff_id).change();
|
|
}
|
|
} else {
|
|
$("#checkup_parameter_id0").val(data[0].checkup_parameter);
|
|
$("#rule_condition_id0").val(data[0].condition_id);
|
|
$("#result").val(data[0].result);
|
|
$("#rule_gender").val(data[0].rule_gender);
|
|
console.log(data[0].result);
|
|
// $("#rule_joiner_id1").val(data[1].joiner_id);
|
|
|
|
|
|
}
|
|
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Populating User');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
// function findcheckup_parameter_id(checkup_parameter_id) {
|
|
// $("#checkup_parameter_id0").val();
|
|
// $.ajax({
|
|
// type:"POST",
|
|
// url:"get_checkup_parameter.php",
|
|
// data:{'checkup_parameter_id':checkup_parameter_id},
|
|
// success:function(data2){
|
|
// var data2 = $.parseJSON(data2);
|
|
// $("#checkup_parameter_id0").val(data2.parameter_name);
|
|
// console.log(data2.parameter_name);
|
|
// },
|
|
// error: function(data) {
|
|
// BootstrapDialog.alert('Error Populating User');
|
|
// return;
|
|
// }
|
|
// });
|
|
// }
|
|
</script>
|
|
|
|
|
|
|
|
<script src="assets/js/select2.min.js"></script>
|
|
|
|
<script>
|
|
(function(i, s, o, g, r, a, m) {
|
|
i['GoogleAnalyticsObject'] = r;
|
|
i[r] = i[r] || function() {
|
|
|
|
(i[r].q = i[r].q || []).push(arguments)
|
|
}, i[r].l = 1 * new Date();
|
|
a = s.createElement(o),
|
|
|
|
m = s.getElementsByTagName(o)[0];
|
|
a.async = 1;
|
|
a.src = g;
|
|
m.parentNode.insertBefore(a, m)
|
|
|
|
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
|
|
|
|
|
|
|
ga('create', 'UA-38894584-2', 'auto');
|
|
|
|
ga('send', 'pageview');
|
|
$('.select2').select2()
|
|
|
|
$(document).one('ajaxloadstart.page', function(e) {
|
|
|
|
//in ajax mode, remove remaining elements before leaving page
|
|
|
|
try {
|
|
|
|
$('.editable').editable('destroy');
|
|
|
|
} catch (e) {}
|
|
|
|
$('[class*=select2]').remove();
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|