UnknownSec Bypass
403
:
/
var
/
www
/
cotutilitydash
/ [
drwxrwxr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
manage_consumption_entry.php
<?php include "header.php"?> <?php include "sidemenu.php"?> <div id="page-wrapper"> <div class="col-md-12 graphs"> <div class="xs"> <h3>Manage Consumption</h3> <input type="hidden" class="form-control1" id="hdid" name="hdid"> <div class="well1 white"> <fieldset> <div class="form-group"> <div class="row"> <div class="col-md-6 grid_box1"> <label class="control-label">Select Area</label> <select class="form-control1 ng-invalid ng-invalid-required" ng-model="model.select" required="" id="area" name="area" onchange="getequipment(this.value,'')"; > </select> </div> <div class="col-md-6"> <label class="control-label">Select Equipment</label> <select class="form-control1 ng-invalid ng-invalid-required" ng-model="model.select" required="" id="equipment" name="equipment" onclick="getsubarea(this.value,'')";> </select> </div> <div class="clearfix"> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-md-6"> <label class="control-label">Select Sub Area</label> <select class="form-control1 ng-invalid ng-invalid-required" ng-model="model.select" required="" id="subarea" name="subarea"> </select> </div> <div class="col-md-6 grid_box1"> <label class="control-label">Date</label> <input type="date" id="txtdate" name="txtdate" class="form-control1" placeholder="date"> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-md-6"> <label class="control-label">Total Consumption</label> <input type="number" id="txtconsumption" name="txtconsumption" class="form-control1" placeholder="Total Consumption"> </div> <div class="clearfix"> </div> </div> </div> <div class="form-group"> <button type="submit" class="btn btn-primary" id="btnsave" onclick="curdconsumption();">SAVE</button> <button type="reset" class="btn btn-default" onclick=" ClearAll();">Reset</button> </div> </fieldset> </div> <div class="bs-example4 tab-content" data-example-id="simple-responsive-table"> <h3>Consumption List</h3> <div class="table-responsive"> <?php $sql= " SELECT consumid, DATE_FORMAT(consuptiondate,'%d-%m-%Y') as consuptiondate,area,equipment,subarea,totalconsumption from v_consumptiondetails where area in(Select area from areapermissiontb where userid='".$_SESSION['userid']."' and isdeleted=0) and isdeleted=0 and userid='".$_SESSION['userid']."' order by consumid DESC Limit 5000"; $result=mysqli_query($conn, $sql) or die("Query Failed."); if (mysqli_num_rows($result)>0) { ?> <table id="studtable" class="table table-striped table-bordered"> <thead> <tr> <th>No.</th> <th>Date</th> <th>Area Name</th> <th>Equipment</th> <th>SubArea Name</th> <th>Consumptiopn</th> <th></th> <th></th> </tr> </thead> <tbody> <?php $serial= 1; while ($row = mysqli_fetch_assoc($result)) { ?> <tr> <td><?php echo $serial ?></td> <!-- <td><?php echo $row['id']; ?></td> --> <td> <?php echo $row['consuptiondate']; ?> </td> <td> <?php echo $row['area']; ?> </td> <td> <?php echo $row['equipment']; ?> </td> <td> <?php echo $row['subarea']; ?> </td> <td> <?php echo $row['totalconsumption']; ?> </td> <td align="center"> <a href="#" onclick="edit(<?php echo $row['consumid']; ?>);" style="corsor:pointer"><i class=" glyphicon glyphicon-pencil"></i></a> <a </td> <td align="center"> <a href="#" onclick="remove(<?php echo $row['consumid']; ?>);"><i class="glyphicon glyphicon-trash"></i></a> </td> </tr> <?php $serial++; } } ?> </tbody> </table> </div><!-- /.table-responsive --> </div> </div> <script> function remove(id) { var id = id; try { var urlgetcode = 'get_consumptiondetails.php'; $.ajax({ method: 'POST', url: urlgetcode, data: '&id=' + id, dataType: 'json', async: true, cache: false, success: function(data) { $('#hdid').val(data.consumid); getarea(data.area); getequipment(data.area,data.equipment); getsubarea1(data.area, data.equipment,data.subarea); $('#txtdate').val(data.condate); $('#txtconsumption').val(data.consumption); document.getElementById("btnsave").innerHTML = "REMOVE"; checkpermission(); }, error: function(request) { alert(request.responseText); } }); } catch (Error) { alert(Error); } return; } function ClearAll() { $('#hdid').val(""); $('#area').val("Select Area"); $('#equipment').val("Select Equipment"); $('#subarea').val(""); $('#txtdate').val(""); $('#txtconsumption').val(""); document.getElementById("btnsave").innerHTML = "SAVE"; checkpermission(); } function checkpermission() { var formname = "manage_consumption_entry.php"; try { var urlgetcode = 'get_permissiondetails.php'; $.ajax({ method: 'POST', url: urlgetcode, data: '&formname=' + formname, dataType: 'json', async: true, cache: false, success: function(data) { var btntext = document.getElementById("btnsave").innerHTML; if (btntext == "SAVE") { if (data.add == 0) { $(btnsave).prop("disabled", true); alert( "You do not have permission to add consumption entry, please contact to administrator" ); return; } else { $(btnsave).prop("disabled", false); } } else if (btntext == "UPDATE") { if (data.edit == 0) { $(btnsave).prop("disabled", true); alert( "You do not have permission to edit consumption entry, please contact to administrator" ); return; } else { $(btnsave).prop("disabled", false); } } else if (btntext == "REMOVE") { if (data.delete == 0) { $(btnsave).prop("disabled", true); alert( "You do not have permission to remove consumption entry, please contact to administrator" ); return; } else { $(btnsave).prop("disabled", false); } } }, error: function(request) { alert(request.responseText); } }); } catch (Error) { alert(Error); } return; } function edit(id) { var id = id; try { var urlgetcode = 'get_consumptiondetails.php'; $.ajax({ method: 'POST', url: urlgetcode, data: '&id=' + id, dataType: 'json', async: true, cache: false, success: function(data) { $('#hdid').val(data.consumid); getarea(data.area); getequipment(data.area,data.equipment); getsubarea1(data.area, data.equipment,data.subarea); $('#txtdate').val(data.condate); $('#txtconsumption').val(data.consumption); document.getElementById("btnsave").innerHTML = "UPDATE"; //checkpermission(); }, error: function(request) { alert(request.responseText); } }); } catch (Error) { alert(Error); } return; } function getarea(val) { $.ajax({ type: "Post", url: "get_userwise_area.php", success: function(res) { var data = JSON.parse(res); var sel = $("#area"); sel.empty(); $("#area").append('<option>Select Area</option>'); for (var i = 0; i < data.length; i++) { if (data[i].tname == val) { sel.append('<option value="' + data[i].tname + '" selected=true>' + data[i] .tname + '</option>'); } else { sel.append('<option value="' + data[i].tname + '">' + data[i].tname + '</option>'); } } } }); } function getequipment(val,val1) { var sel = $("#equipment"); sel.empty(); $.ajax({ type: "Post", url: "get_userwise_equipment.php", data: '&area=' + val, success: function(res) { var data = JSON.parse(res); $("#equipment").append('<option>Select Equipment</option>'); for (var i = 0; i < data.length; i++) { if (data[i].tname == val1) { sel.append('<option value="' + data[i].tname + '" selected=true>' + data[i] .tname + '</option>'); } else { sel.append('<option value="' + data[i].tname + '">' + data[i].tname + '</option>'); } } // $('#particular').editableSelect(); /// $("#state").html(data); } }); } function getsubarea1(area,equipment, val) { var sel = $("#subarea"); sel.empty(); $.ajax({ type: "Post", url: "get_userwise_subarea.php", data: '&area=' + area+'&equipment=' + equipment, success: function(res) { var data = JSON.parse(res); $("#subarea").append('<option>Select Subarea</option>'); for (var i = 0; i < data.length; i++) { if (data[i].tname == val) { sel.append('<option value="' + data[i].tname + '" selected=true>' + data[i] .tname + '</option>'); } else { sel.append('<option value="' + data[i].tname + '">' + data[i].tname + '</option>'); } } } }); } function getsubarea(equipment,val) { var area = document.getElementById("area").value; var sel = $("#subarea"); sel.empty(); $.ajax({ type: "Post", url: "get_userwise_subarea.php", data: '&area=' + area+'&equipment=' + equipment, success: function(res) { var data = JSON.parse(res); $("#subarea").append('<option>Select Subarea</option>'); for (var i = 0; i < data.length; i++) { if (data[i].tname == val) { sel.append('<option value="' + data[i].tname + '" selected=true>' + data[i] .tname + '</option>'); } else { sel.append('<option value="' + data[i].tname + '">' + data[i].tname + '</option>'); } } } }); } $(document).ready(function() { checkpermission(); getarea(""); $("#studtable").DataTable({ bLengthChange: true, "iDisplayLength": 10, bInfo: false, responsive: true, "bAutoWidth": false }); }); function curdconsumption() { var flag = true; var inputField1 = document.getElementById("area"); if (inputField1.value == "Select Area") { flag = false; alert("Please select area."); document.getElementById("area").focus(); return false; } var inputField22 = document.getElementById("equipment"); if (inputField22.value == "Select Equipment") { flag = false; alert("Please select equipment."); document.getElementById("equipment").focus(); return false; } var inputField2 = document.getElementById("subarea"); if (inputField2.value == "Select Subarea") { flag = false; alert("Please enter sub-area."); document.getElementById("subarea").focus(); return false; } var inputField3 = document.getElementById("txtdate"); if (inputField3.value == "") { flag = false; alert("Please select date."); document.getElementById("txtdate").focus(); return false; } var inputField4 = document.getElementById("txtconsumption"); if (inputField4.value == "") { flag = false; alert("Please enter consumption value."); document.getElementById("txtconsumption").focus(); return false; } /*var digits = "0123456789"; var temp; for (var i = 0; i < document.getElementById("txtconsumption").value.length; i++) { temp = document.getElementById("txtconsumption").value.substring(i, i + 1); if (digits.indexOf(temp) == -1) { alert("Use only numeric digits."); document.getElementById("txtconsumption").focus(); return false; } }*/ var area = document.getElementById("area").value; var equipment = document.getElementById("equipment").value; var subarea = document.getElementById("subarea").value; var condate = document.getElementById("txtdate").value; var consumption = document.getElementById("txtconsumption").value; var id = document.getElementById("hdid").value; var btnopration = document.getElementById("btnsave").innerHTML; try { if (flag == true) { var text = "Do you want to " + btnopration + " the consumption entry"; if (confirm(text) == false) { flag = false; return false; } var urlgetcode = 'curd_consumptionentry.php'; $.ajax({ method: 'POST', url: urlgetcode, data: '&area=' + area + '&equipment=' + equipment + '&subarea=' + subarea + '&condate=' + condate + '&consumption=' + consumption + '&id=' + id + '&btnopration=' + btnopration, dataType: 'json', async: true, cache: false, success: function(data) { alert(data); window.location.href = "manage_consumption_entry.php"; $('#hdid').val(""); $('#area').val(""); $('#subarea').val(""); }, error: function(request) { alert(request.responseText); } }); } } catch (Error) { alert(Error); } return; } </script> <?php include "footer.php"?>
Copyright © 2025 - UnknownSec