UnknownSec Bypass
403
:
/
var
/
www
/
zenithentcare
/
stmedicosoftware
/ [
drwxrwxr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
manage_procedure.php
<?php include "top1.php";?> <head> <link href="dist/jquery-editable-select.min.css" rel="stylesheet" /> </head> <!-- /inner_content--> <div class="inner_content"> <!-- /inner_content_w3_agile_info--> <!-- breadcrumbs --> <div class="w3l_agileits_breadcrumbs"> <div class="w3l_agileits_breadcrumbs_inner"> <ul> <li><a href="dashboard.php">Dashboard</a><span>«</span></li> <li>Manage Procedure</li> </ul> </div> </div> <!-- //breadcrumbs --> <div class="inner_content_w3_agile_info two_in"> <h2 class="w3_inner_tittle">Manage Procedure</h2> <input type="hidden" class="form-control1" id="hduhid" name="hduhid"> <input type="hidden" class="form-control1" id="hdfileno" name="hdfileno"> <input type="hidden" class="form-control1" id="hdvoucherno" name="hdvoucherno"> <!--/forms--> <div class="forms-main_agileits"> <!--/forms-inner--> <div class="forms-inner"> <!--/set-1--> <div class="set-1_w3ls"> <div class="col-md-4 button_set_one agile_info_shadow graph-form"> <table width="100%"> <tr> <td width="40%"> <h3 class="w3_inner_tittle two">Pt. Details </h3> </td> <td width="20%"> </td> <td width="40%" align="right"> <button id="myBtn" class="btn btn-primary" width="100%">Find Patient</button> </td> </tr> </table> <div class="form-body"> <div class="form-group"> <table width="100%"> <tr> <td width="50%"> <label for="testDepartmentyName">Voucher No.</label> <input type="Number" class="form-control" id="voucherno" disabled="disabled"> </td> <td width="50%"> <label for="testDepartmentyName">UHID</label> <input type="text" class="form-control" id="uhid" disabled="disabled" placeholder=""> </td> </tr> </table> </div> <div class="form-group"> <table width="100%"> <tr> <td width="50%"> <label for="testDepartmentyName">Voucher Date</label> <input type="date" class="form-control1" id="voucherdate" style="font-size: 14px; width: 100%;" placeholder=""> </td> <td width="50%"> <label for="testDepartmentyName">Time</label> <input type="text" class="form-control1" id="vouchertime" style="font-size: 14px; width: 100%;" placeholder=""> </td> </tr> </table> </div> <div class="form-group"> <label for="testDepartmentyName">Patient Name</label> <table width="100%"> <tr> <td width="20%"> <select name="cmbpatientpre" id="cmbpatientpre" class="form-control1" style="font-size: 14px"> <option value="Mr.">Mr.</option> <option value="Mrs.">Mrs</option> <option value="Miss.">Miss.</option> <option value="Master">Master</option> </select> </td> <td width="80%"> <input type="text" class="form-control1" id="name" style="font-size: 14px; width: 100%;" placeholder=""> </td> </tr> </table> </div> <div class="form-group"> <table> <tr> <td width="35%"> <label for="testDepartmentyName">Sex</label> <select name="cmbsex" id="cmbsex" class="form-control1" style="font-size: 14px"> <option value="Male">Male</option> <option value="Female">Female</option> </select> </td> <td width="45%"> <label for="testDepartmentyName">Age</label> <input type="number" class="form-control1" id="age" onkeypress="return isNumberKey(event,this);" style="font-size: 14px; width: 100%;" placeholder=""> </td> <td width="20%"> <label for="testDepartmentyName">.</label> <select name="cmbageinyear" id="cmbageinyear" class="form-control1" style="font-size: 14px"> <option value="Year">Year</option> <option value="Month">Month</option> <option value="Day">Day</option> </select> </td> </tr> </table> </div> <div class="form-group"> <table width="100%"> <tr> <td width="50%"> <label for="testDepartmentyName">Mobile No.</label> <input type="text" class="form-control1" id="mobileno" onkeypress="return isNumberKey(event,this);" style="font-size: 14px; width: 100%;" placeholder=""> </td> <td width="50%"> <label for="testDepartmentyName">Patient Type</label> <select name="pattype" id="pattype" class="form-control1" style="font-size: 14px; width: 100%;" style="width: 100%"> <option value="Direct">Direct</option> <option value="OPD">OPD</option> <option value="IPD">IPD</option> </select> </td> </tr> </table> </div> <div class="form-group"> <label for="testDepartmentyName">Address</label> <input type="text" class="form-control" id="address" placeholder=""> </div> <div class="form-group"> <label for="testDepartmentyName">Department</label> <select name="department" id="department" onChange="getdoctor('',this.value);" class="form-control1" style="width: 100%"> </select> </div> <div class="form-group"> <label for="testDepartmentyName">Consultant</label> <select name="consultant" id="consultant" class="form-control1" style="width: 100%"> </select> </div> <div class="form-group"> <label for="testDepartmentyName">Referred by</label> <select name="referedby" id="referedby" class="form-control1" style="width: 100%"> </select> </div> </div> </div> <div class="col-md-8 graph-form general agile_info_shadow"> <h3 class="w3_inner_tittle two">Service List </h3> <div class="form-body"> <table class="table table-striped table-bordered"> <tr> <th>Particular</th> <th>Qty</th> <th>Rate</th> <th>Amount</th> <th></th> </tr> <tr> <td width="40%"> <select name="particular" id="particular" onchange="gettestdetails(this.value);" onfocus="gettest($('#category').val())" class="form-control1" style="font-size: 14px"> </select> </td> <td width="15%"> <input type="text" class="form-control" id="qty" maxlength="5" onkeyup=getamount(); onkeypress="return isNumberKey(event,this);" placeholder="Qty"></td> <td width="15%"> <input type="text" class="form-control" id="rate" maxlength="10" onkeyup=getamount(); onkeypress="return isNumberKey(event,this);" placeholder="Rate"></td> <td width="15%"> <input type="text" class="form-control" id="amount" maxlength="10" placeholder="Amt" onkeypress="return isNumberKey(event,this);"></td> <td width="15%"><button type="submit" class="btn btn-default" id="btnadd" onclick="savetempdata();">Add</button></td> </tr> </table> <input type="text" class="form-control" id="category" disabled="disabled"> </div> <hr /> <div class="form-body"> <table class=" table table-bordered content-table"> <thead> <td>S.No.</td> <td>Particular</td> <td>Qty</td> <td>Rate</td> <td>Amount</td> <td>Action</td> </thead> <tbody id="root"> </tbody> </table> </div> <hr /> <div class="form-body"> <table class="table table-striped table-bordered"> <tr> <td> <label for="testDepartmentyName">Payment Mode</label></td> <td> <select name="txtpaymentmode" id="txtpaymentmode" onchange="enabledisablebank(this.value);" class="form-control1" style="font-size: 14px"> <option value="CASH">CASH</option> <option value="BANK">BANK</option> <option value="CHEQUE">CHEQUE</option> <option value="ONLINE">ONLINE</option> <option value="POS">POS</option> </select> </td> <td> <label for="testDepartmentyName">Total</label></td> <td> <input type="text" class="form-control" id="total" disabled="disabled" placeholder=""></td> </tr> <tr> <td> <label for="testDepartmentyName">Bank Name</label></td> <td> <select name="bank" id="bank" class="form-control1" disabled="disabled" style="font-size: 14px"> </select></td> <td> <label for="testDepartmentyName">Discount</label></td> <td> <input type="text" class="form-control" id="discount" onkeyup="getdiscount()" onkeypress="return isNumberKey(event,this);" placeholder=""></td> </tr> <tr> <td> <label for="testDepartmentyName">Transaction No.</label></td> <td> <input type="text" class="form-control" id="tranno" placeholder=""></td> <td> <label for="testDepartmentyName">Net Amount</label></td> <td> <input type="text" class="form-control" id="netamount" disabled="disabled" placeholder=""></td> </tr> <tr> <td> </td> <td> </td> <td> <label for="testDepartmentyName">Receive Amount</label></td> <td> <input type="text" class="form-control" id="receiveamt" onkeypress="return isNumberKey(event,this);" placeholder=""></td> </tr> </table> </div> <div class="form-body" align="center"> <button type="submit" id="save" class="btn btn-default" onclick="saveproceduredata()">Save</button> <button type="submit" id="clear" class="btn btn-default" onclick="clear1();">Clear</button> <button type="submit" id="print" class="btn btn-default" onclick="printslip()">Print</button> </div> </div> <div class="clearfix"> </div> </div> <!--//set-1--> </div> <!--//forms-inner--> </div> <!--//forms--> </div> <div id="myModal" class="modal"> <!-- Modal content --> <div class="modal-content"> <span class="close">×</span> <div class="inner_content_w3_agile_info two_in"> <!--/forms--> <div class="forms-main_agileits"> <!--/forms-inner--> <div class="forms-inner"> <!--/set-1--> <div class="set-1_w3ls"> <div class="col-md-12 graph-form general agile_info_shadow"> <h3 class="w3_inner_tittle two">Patient List </h3> <div class="form-body"> <table id="example" class="display" width="100%" cellspacing="0"> <thead> <tr> <th>Date</th> <th>UHID</th> <th>Name</th> <th>Age</th> <th>Sex</th> <th>Mobile</th> <th></th> </tr> </thead> </table> </div> </div> <div class="clearfix"> </div> </div> <!--//set-1--> </div> <!--//forms-inner--> </div> <!--//forms--> </div> </div> </div> <!-- //inner_content_w3_agile_info--> </div> <!-- //inner_content--> <style> /* The Modal (background) */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0, 0, 0); /* Fallback color */ background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */ } /* Modal Content/Box */ .modal-content { background-color: #fefefe; margin: 5% auto; /* 15% from the top and centered */ padding: 20px; border: 1px solid #888; width: 80%; /* Could be more or less, depending on screen size */ } /* The Close Button */ .close { color: #aaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; } </style> <script src="dist/jquery-editable-select.js"></script> <script type="text/javascript"> function getbilldetails(billno) { let newarr = JSON.parse(localStorage.getItem("ser_data")); for (let k in newarr) { let arr = JSON.parse(localStorage.getItem("ser_data")); arr.splice(k); localStorage.setItem('ser_data', JSON.stringify(arr)); } select(); localStorage.clear(); let identifier = 1; $.ajax({ method: 'POST', url: 'get_billtestdetails.php', data: '&billno=' + billno + '&identifier=' + identifier, dataType: "JSON", success: function(res) { let arr = JSON.parse(localStorage.getItem("ser_data")); for (var i = 0; i < res.length; i++) { let name = res[i].name; let qty = res[i].qty; let rate = res[i].rate; let amount = res[i].amount; let arrdata = { name: name, qty: qty, rate: rate, amount: amount }; if (arr == null) { arr = [] } arr.push(arrdata); localStorage.setItem('ser_data', JSON.stringify(arr)); } select(); // $('#consultant').val(data.examid); } }); } function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } function getbilldetail() { var id = getUrlVars()['vou']; var op = getUrlVars()['op']; if (jQuery.type(id) == "undefined") { return; } if (id != "") { let identifier = 2; $.ajax({ method: 'POST', url: 'get_billtestdetails.php', data: '&billno=' + id + '&identifier=' + identifier, dataType: "JSON", success: function(res) { $('#print').removeAttr('disabled'); $('#hduhid').val(res.uhid); $('#hdfileno').val(res.fileno); $('#uhid').val(res.suhid); $('#voucherdate').val(res.trandate); $('#vouchertime').val(res.trantime); $('#voucherno').val(res.svoucherno); //var voucherno = document.getElementById("hdvoucherno").value; $('#cmbpatientpre').val(res.pntpre); $('#name').val(res.name); $('#cmbsex').val(res.sex); $('#age').val(res.agey); $('#cmbageinyear').val(res.pntageyrs); $('#mobileno').val(res.mobile); $('#pattype').val(res.filetype); $('#address').val(res.address1); $('#category').val(res.categorytype); $('#category').attr('disabled', 'disabled'); $('#department').val(res.depid); gettest(res.categorytype); $('#txtpaymentmode').val(res.cashyacheque); getbank(res.bankid) $('#tranno').val(res.chequeno); getdepartment(res.depid); getdoctor(res.examid, res.depid) getbilldetails(id); $('#total').val(res.totalamount); $('#discount').val(res.discount); $('#netamount').val(res.nettotal); $('#receiveamt').val(res.receiveamt); $('#hdvoucherno').val(res.voucherno); $('#save').text("Update"); } }); } } function clear1() { var date = new Date(); document.getElementById("voucherdate").value = formatDate(date); document.getElementById("vouchertime").value = formatTime(date); $('#hduhid').val(""); $('#hdfileno').val(""); $('#uhid').val(""); $('#voucherno').val(""); $('#voucherdate').val(""); $('#vouchertime').val(""); $('#hdvoucherno').val(""); //var voucherno = document.getElementById("hdvoucherno").value; $('#cmbpatientpre').val(""); $('#name').val(""); $('#cmbsex').val("Male"); $('#age').val(""); $('#cmbageinyear').val("Year"); $('#mobileno').val(""); $('#pattype').val(""); $('#address').val(""); $('#category').val(""); $('#category').attr('disabled', 'disabled'); $('#department').val("Select Department"); $('#particular').val("Select Services"); $('#consultant').val(""); $('#txtpaymentmode').val(""); $('#tranno').val(""); $('#total').val(""); $('#discount').val(""); $('#netamount').val(""); $('#receiveamt').val(""); $('#save').text("Save"); let newarr = JSON.parse(localStorage.getItem("ser_data")); for (let k in newarr) { let arr = JSON.parse(localStorage.getItem("ser_data")); arr.splice(k); localStorage.setItem('ser_data', JSON.stringify(arr)); } select(); localStorage.clear(); window.location.href = "manage_procedure.php"; } function getpatientdetails(val) { $.ajax({ method: 'POST', url: 'get_propatientdetails.php', data: '&suhid=' + val, dataType: "JSON", success: function(data) { $('#hduhid').val(data.uhid); $('#uhid').val(data.suhid); $('#hdfileno').val(data.fileno); $('#cmbpatientpre').val(data.pntpre); $('#name').val(data.name); $('#cmbsex').val(data.sex); $('#age').val(data.age); $('#cmbageinyear').val(data.pntageyrs); $('#mobileno').val(data.mobile); $('#pattype').val(data.filetype); $('#address').val(data.address1); // $('#department').val(data.depid); getdepartment(data.depid); getdoctor(data.examid, data.depid) // $('#consultant').val(data.examid); } }); } function getvoucherno() { $.ajax({ method: 'POST', url: 'get_voucherno.php', dataType: "JSON", success: function(data) { $('#hdvoucherno').val(data.voucherno); } }); } function getuhid() { $.ajax({ method: 'POST', url: 'get_uhid.php', dataType: "JSON", success: function(data) { $('#hduhid').val(data.uhid); } }); } function gettest(val) { $.ajax({ type: "Post", url: "get_services.php", data: '&category=' + val, success: function(res) { var data = JSON.parse(res); var sel = $("#particular"); sel.empty(); $("#particular").append('<option>Select Services</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>'); } } // $('#particular').editableSelect(); /// $("#state").html(data); } }); } function gettest1(val, val1) { $.ajax({ type: "Post", url: "get_services.php", data: '&category=' + val, success: function(res) { var data = JSON.parse(res); var sel = $("#particular"); sel.empty(); $("#particular").append('<option>Select Services</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 gettestdetails(val) { $.ajax({ type: "Post", url: "get_servicedetails.php", data: '&testname=' + val, success: function(res) { var data = JSON.parse(res); $('#rate').val(data[0].trate); $('#qty').val("1"); $('#amount').val(data[0].trate); $('#category').val(data[0].tcategory); /// $("#state").html(data); } }); } $(document).ready(function() { localStorage.clear(); var id = getUrlVars()['vou']; var op = getUrlVars()['op']; if (id == undefined) { getvoucherno(); $('#print').attr('disabled', 'disabled'); } getdepartment(""); getuhid(); select(); gettest(""); getbank(""); var date = new Date(); document.getElementById("voucherdate").value = formatDate(date); document.getElementById("vouchertime").value = date.toLocaleTimeString(); getbilldetail(); $("#particular").select2(); $("#consultant").select2(); $("#department").select2(); }); function formatTime(dt) { var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds(); return time; } function enabledisablebank(val) { if(val=="CASH") $('#bank').attr('disabled', 'disabled'); else $('#bank').removeAttr('disabled'); } function formatDate(dt) { var d, y, m; d = dt.getDate(); m = dt.getMonth() + 1; y = dt.getFullYear(); var ret = ''; if (d < 10) d = '0' + d; if (m < 10) m = '0' + m; ret = y + "-" + m + "-" + d; return ret; } function isNumberKey(evt, element) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57) && !(charCode == 46 || charCode == 8)) return false; else { var len = $(element).val().length; var index = $(element).val().indexOf('.'); if (index > 0 && charCode == 46) { return false; } if (index > 0) { var CharAfterdot = (len + 1) - index; if (CharAfterdot > 3) { return false; } } } return true; } function getamount() { var qty = document.getElementById("qty").value; var rate = document.getElementById("rate").value; var amount = qty * rate; $('#amount').val(amount); } function getdiscount() { var total = document.getElementById("total").value; var discount = document.getElementById("discount").value; var netamount = total - discount; if (netamount < 0) { alert("Discount can not be greater than total amount"); document.getElementById("discount").focus(); return; } $('#netamount').val(netamount); $('#receiveamt').val(netamount); } function printslip() { var voucherno = document.getElementById("hdvoucherno").value; if (voucherno == "") { alert("Please enter voucher no."); return; } window.location.href = "print_procedurenew.php?id=" + voucherno; } function saveproceduredata() { var flag = true; var voucherdate = document.getElementById("voucherdate").value; var vouchertime = document.getElementById("vouchertime").value; if (vouchertime == "") { alert("Please select time"); document.getElementById("vouchertime").focus(); return; } var patprefix = document.getElementById("cmbpatientpre").value; var patname = document.getElementById("name").value; if (patname == "") { alert("Please enter patient name"); document.getElementById("name").focus(); return; } var sex = document.getElementById("cmbsex").value; var age = document.getElementById("age").value; if (age == "") { alert("Please enter patient age"); document.getElementById("age").focus(); return; } var ageinyear = document.getElementById("cmbageinyear").value; var mobileno = document.getElementById("mobileno").value; if (mobileno == "") { alert("Please enter mobile number"); document.getElementById("mobileno").focus(); return; } var pattype = document.getElementById("pattype").value; var address = document.getElementById("address").value; var department = document.getElementById("department").value; if (department == "Select Department") { alert("Please select department"); document.getElementById("department").focus(); return; } var consultant = document.getElementById("consultant").value; if (consultant == "Select Consultant Doctor" || consultant == "") { alert("Please select consultant doctor"); document.getElementById("consultant").focus(); return; } var referedby = document.getElementById("referedby").value; var category = document.getElementById("category").value; var paymentmode = document.getElementById("txtpaymentmode").value; var bank = document.getElementById("bank").value; var tranno = document.getElementById("tranno").value; if(paymentmode!="CASH") { if (bank == "Select Bank") { alert("Please select Bank"); document.getElementById("bank").focus(); return; } if (tranno == "") { alert("Please enter transaction no"); document.getElementById("tranno").focus(); return; } } var total = document.getElementById("total").value; var discount = document.getElementById("discount").value; var netamount = document.getElementById("netamount").value; var receiveamt = document.getElementById("receiveamt").value; var uhid = document.getElementById("hduhid").value; var fileno = document.getElementById("hdfileno").value; var voucherno = document.getElementById("hdvoucherno").value; if (voucherno == "") { alert("voucher no. can not be empty"); retun; } var btnopration = document.getElementById("save").innerHTML; let arr = JSON.parse(localStorage.getItem("ser_data")); if (arr != null) { var text = "Do you want to submit the bill"; if (confirm(text) == false) { flag = false; return false; } $.ajax({ type: "Post", url: "procedure_saveupdate.php", data: { servicedata: JSON.stringify(arr), voucherdate: voucherdate, vouchertime: vouchertime, patprefix: patprefix, patname: patname, sex: sex, age: age, ageinyear: ageinyear, mobileno: mobileno, pattype: pattype, address: address, department: department, consultant: consultant, referedby: referedby, category: category, paymentmode: paymentmode, bank: bank, tranno: tranno, total: total, discount: discount, netamount: netamount, receiveamt: receiveamt, uhid: uhid, fileno: fileno, voucherno: voucherno, btnopration: btnopration }, success: function(res) { document.getElementById("category").value = res; if (res == 1) { alert("Bill save successfully"); printslip(); localStorage.clear(); // window.location.href = "manage_procedure.php"; } else if (res == 2) { alert("Bill update successfully"); localStorage.clear(); window.location.href = "manage_procedure.php"; } else { alert("There is problem to save the bill"); } } }); } else { alert("Please add test then press save button."); } } function select() { let newarr = JSON.parse(localStorage.getItem("ser_data")); if (newarr != null) { let html = ''; let sno = 1; var total = 0; for (let k in newarr) { t = 0; let n = newarr[k].name; let q = newarr[k].qty; total = total + parseInt(newarr[k].amount); html = html + `<tr><td>${sno}</td><td>${newarr[k].name} </td> <td>${newarr[k].qty}</td> <td>${newarr[k].rate}</td> <td>${newarr[k].amount}</td> <td><a href="javascript:void(0)" onclick="editData(${sno})"><i class="glyphicon glyphicon-pencil"></i></a> <a href="javascript:void(0)" onclick="deleteData(${sno})"><i class="glyphicon glyphicon-trash"></i></a></td></tr>`; sno++; }; var discount = 0; if (document.getElementById('discount').value == "") discount = 0; else var discount = parseInt(document.getElementById('discount').value); var netamount = total - discount; document.getElementById('root').innerHTML = html; document.getElementById('particular').value = ""; document.getElementById('qty').value = ""; document.getElementById('rate').value = ""; document.getElementById('amount').value = ""; document.getElementById('total').value = total; document.getElementById('discount').value = discount; document.getElementById('netamount').value = netamount; document.getElementById('receiveamt').value = netamount; id = "No"; } } let id = "No" function savetempdata() { let arr = JSON.parse(localStorage.getItem("ser_data")); var name = document.getElementById('particular').value; var qty = document.getElementById('qty').value; var rate = document.getElementById('rate').value; var amount = document.getElementById('amount').value; var flag=true; if (name == "Select Services" || name == "" ) { alert("Please select service name"); flag=false; return flag; } else if (qty == "") { alert("Please enter qty"); document.getElementById('qty').focus(); flag=false; return flag; } else { if(flag==false) { return flag; } if (id == "No") { let testarr = JSON.parse(localStorage.getItem("ser_data")); for (let i in testarr) { if (testarr[i].name == name) { alert("Test Name is already exist."); retun; break; } } let arrdata = { name: name, qty: qty, rate: rate, amount: amount }; if (arr == null) { arr = [] } arr.push(arrdata); localStorage.setItem('ser_data', JSON.stringify(arr)); } else { let testarr1 = JSON.parse(localStorage.getItem("ser_data")); for (let i in testarr1) { if (testarr1[i].name == name && i != id) { alert("Test Name is already exist."); retun; break; } } let arr = JSON.parse(localStorage.getItem("ser_data")); arr[id].name = name; arr[id].qty = qty; arr[id].rate = rate; arr[id].amount = amount; localStorage.setItem('ser_data', JSON.stringify(arr)); document.getElementById('btnadd').innerHTML = "Add"; alert("Update"); } let newarr = JSON.parse(localStorage.getItem("ser_data")); if (newarr != null) { let html = ''; let sno = 1; var total = 0; for (let k in newarr) { let n = newarr[k].name; let q = newarr[k].qty; total = total + parseInt(newarr[k].amount); html = html + `<tr><td>${sno}</td><td>${newarr[k].name} </td> <td>${newarr[k].qty}</td> <td>${newarr[k].rate}</td> <td>${newarr[k].amount}</td> <td><a href="javascript:void(0)" onclick="editData(${sno})"><i class="glyphicon glyphicon-pencil"></i></a> <a href="javascript:void(0)" onclick="deleteData(${sno})"><i class="glyphicon glyphicon-trash"></i></a></td></tr>`; sno++; }; var discount = 0; if (document.getElementById('discount').value == "") discount = 0; else var discount = parseInt(document.getElementById('discount').value); var netamount = total - discount; document.getElementById('root').innerHTML = html; $('#particular').val("Select Services"); document.getElementById('particular').value = "Select Services"; document.getElementById('qty').value = ""; document.getElementById('rate').value = ""; document.getElementById('amount').value = ""; document.getElementById('total').value = total; document.getElementById('discount').value = discount; document.getElementById('netamount').value = netamount; document.getElementById('receiveamt').value = netamount; id = "No"; gettest($('#category').val()); document.getElementById('category').focus(); } } } function deleteData(rid) { id = rid - 1; let arr = JSON.parse(localStorage.getItem("ser_data")); arr.splice(id, 1); localStorage.setItem('ser_data', JSON.stringify(arr)); select(); let newarr = JSON.parse(localStorage.getItem("ser_data")); if (newarr.length == 0) { document.getElementById('category').value = ""; } } function editData(rid) { id = rid - 1; let arr = JSON.parse(localStorage.getItem("ser_data")); gettest1(document.getElementById('category').value, arr[rid - 1].name); document.getElementById('particular').value = arr[rid - 1].name; document.getElementById('qty').value = arr[rid - 1].qty; document.getElementById('rate').value = arr[rid - 1].rate; document.getElementById('amount').value = arr[rid - 1].amount; document.getElementById('btnadd').innerHTML = "Edit"; } function getdepartment(val) { var identifier = 1; $.ajax({ type: "Post", url: "getalldepartment.php", data: '&identifier=' + identifier, success: function(res) { var data = JSON.parse(res); var sel = $("#department"); sel.empty(); $("#department").append('<option>Select Department</option>'); for (var i = 0; i < data.length; i++) { if (data[i].parcode == val) { sel.append('<option value="' + data[i].parcode + '" selected=true>' + data[i] .parname + '</option>'); } else { sel.append('<option value="' + data[i].parcode + '">' + data[i].parname + '</option>'); } } } }); } function getbank(val) { var identifier = 5; $.ajax({ type: "Post", url: "getalldepartment.php", data: '&identifier=' + identifier, success: function(res) { var data = JSON.parse(res); var sel = $("#bank"); sel.empty(); for (var i = 0; i < data.length; i++) { if (data[i].parcode == val) { sel.append('<option value="' + data[i].parcode + '" selected=true>' + data[i] .parname + '</option>'); } else { sel.append('<option value="' + data[i].parcode + '">' + data[i].parname + '</option>'); } } } }); } function getdoctor(val, sid) { var identifier = 4; $.ajax({ type: "Post", url: "getalldepartment.php", data: '&identifier=' + identifier + '&sid=' + sid, success: function(res) { var data = JSON.parse(res); var sel = $("#consultant"); sel.empty(); for (var i = 0; i < data.length; i++) { if (data[i].parcode == val) { sel.append('<option value="' + data[i].parcode + '" selected=true>' + data[i] .parname + '</option>'); } else { sel.append('<option value="' + data[i].parcode + '">' + data[i].parname + '</option>'); } } } }); } </script> <script> // Get the modal var modal = document.getElementById("myModal"); // Get the button that opens the modal var btn = document.getElementById("myBtn"); var btnselect = document.getElementById("select"); // Get the <span> element that closes the modal var span = document.getElementsByClassName("close")[0]; // When the user clicks on the button, open the modal btn.onclick = function() { var table = $('#example').DataTable({ "ajax": "load_patient.php", "bPaginate": true, destroy: true, "bProcessing": true, "pageLength": 20, "columns": [{ mData: 'opddate' }, { mData: 'suhid' }, { mData: 'name' }, { mData: 'agey' }, { mData: 'sex' }, { mData: 'mobile' }, { mData: null, defaultContent: '<button>select</button>', targets: -1 } ] }); modal.style.display = "block"; table.on('click', 'button', function(e) { var currentRow = $(this).closest("tr"); var col1 = currentRow.find("td:eq(1)").text(); modal.style.display = "none"; getpatientdetails(col1); }); } function isNumberKey(evt, element) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57) && !(charCode == 46 || charCode == 8)) return false; else { var len = $(element).val().length; var index = $(element).val().indexOf('.'); if (index > 0 && charCode == 46) { return false; } if (index > 0) { var CharAfterdot = (len + 1) - index; if (CharAfterdot > 3) { return false; } } } return true; } function refresh() { myModal.ajax.reload(); } function closemodalpopup(val) { modal.style.display = "none"; getpatientdetails(val); } // When the user clicks on <span> (x), close the modal span.onclick = function() { modal.style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } </script> <?php include "footer.php";?>
Copyright © 2025 - UnknownSec