- <?php
- // session_start();
- // if(!isset($_SESSION['isLogin'])){
- // header("location: login.php");
- // }
- $conn = new mysqli("localhost","root","","mobile");
- if (mysqli_connect_errno()) {
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
- }
- if (isset($_GET['type']) && $_GET['type']!=""){
- $type=$_GET['type'];
- if($type == "status"){
- $operation=$_GET['operation'];
- $id= $_GET['id'];
- if($operation =='deliverd'){
- $status = 1;
- }elseif($operation =='panding') {
- $status = 2;
- }
- $update_status = "UPDATE `newtransaction` SET `status`='$status' WHERE `Id` = $id";
- $conn -> query($update_status);
- }
- }
- if(isset($_POST['userLogin'])) {
- $username = $mysqli -> real_escape_string($_POST['username']);
- $pass = $mysqli -> real_escape_string($_POST['pass']);
- $checkUser = 'SELECT * FROM `user` WHERE `userName` = "'.$username.'"';
- $result = $mysqli->query($checkUser);
- if(!empty($result) && $result->num_rows > 0){
- while($row = $result->fetch_assoc()){
- $uID = $row['id'];
- $userPass = $row['userPass'];
- }if($userPass === $pass){
- $_SESSION['isLogin'] = true;
- $_SESSION['uID'] = $uID;
- echo "done";
- exit();
- header("location: index.php");
- }else{
- header("location: login.php?message=Password Not Correct");
- }
- }
- else{
- header("location: login.php?message=User Not Found");
- }
- exit();
- }
- $sub_sql="";
- $toDate=$fromDate="";
- if(isset($_POST['searchByDate'])){
- $from=$_POST['from'];
- $fromDate=$from;
- $fromArr=explode("/",$from);
- $from=$fromArr['2'].'-'.$fromArr['1'].'-'.$fromArr['0'];
- $to=$_POST['to'];
- $toDate=$to;
- $toArr=explode("/",$to);
- $to=$toArr['2'].'-'.$toArr['1'].'-'.$toArr['0'];
- $sub_sql= " where transactionDate >= '$from' && transactionDate <= '$to' ";
- }
- $sql = "select * from newtransaction $sub_sql order by id desc";
- $result = $conn->query($sql);
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Login V8</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!--===============================================================================================-->
- <link rel="icon" type="image/png" href="images/icons/favicon.ico" />
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
- <!--===============================================================================================-->
- <link rel="stylesheet" type="text/css" href="vendor/daterangepicker/daterangepicker.css">
- <!--===============================================================================================-->
- <link href="https://cdn.datatables.net/1.13.3/css/dataTables.bootstrap4.min.css">
- <!-- <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> -->
- <link rel="stylesheet" type="text/css" href="css/util.css">
- <link rel="stylesheet" type="text/css" href="css/main.css">
- <!--===============================================================================================-->
- </head>
- <body>
- <nav class="navbar navbar-expand-lg navbar-light bg-light">
- <div class="continer">
- <div class="row">
- <img src="images/logo.png" alt="Logo" class="py-1">
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
- aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- <ul class="navbar-nav ml-auto">
- <li class="nav-item active">
- <a class="nav-link" href="index.php">Home <span class="sr-only">(current)</span></a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">Change Password</a>
- </li>
- <li class="nav-item">
- <a class="nav-link">Logout</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </nav>
- <div class="container-fluid pt-5">
- <div class="text-right"><button type="button" class="btn btn-lg btn-primary px-5 mb-3" data-toggle="modal"
- data-target="#newEntry">NEW</button></div>
- <div class=" dis-inline ">
- <form method="post" class="form-inline" style="margin-bottom: -37px; position: relative; z-index: 1;">
- <input type="text" class="form-control" id="from" name="from" value="<?php echo $fromDate?>" required>
- <label for="to" class=" mx-1">To</label>
- <input type="text" class="form-control" id="to" name="to" value="<?php echo $toDate?>" required>
- <button type="submit" class="btn btn-primary ml-3" name="searchByDate">Search</button>
- <!-- <input type="submit" name="submit" value="Filter"> -->
- </form>
- </div>
- <table id="myTable" class="table display">
- <thead>
- <tr>
- <th>Transaction</th>
- <th>Customer Name</th>
- <th>Mobile No.</th>
- <th>Mobile Name</th>
- <th>IMEI No.</th>
- <th>Charges</th>
- <th>Date</th>
- <th>Remarks</th>
- <th>Status</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $transactionType = "";
- if(!empty($result) && $result->num_rows > 0){
- while($row = $result->fetch_assoc()){
- if($row['transaction']==1){
- $transactionType = "Repairing";
- } elseif($row['transaction']==2){
- $transactionType = "Sale(New)";
- }elseif($row['transaction']==3){
- $transactionType = "Sale(Old)";
- }
- if($row['status']==1){
- $stat = '<a href="?type=status&operation=panding&id='.$row['Id'].'" class="badge badge-success">Deliverd</a>';
- }else{
- $stat = '<a href="?type=status&operation=deliverd&id='.$row['Id'].'" class="badge badge-danger">Panding</a>';
- }
- echo'
- <tr>
- <td>'.$transactionType.'</td>
- <td>'.$row['customerName'].'</td>
- <td>'.$row['customerMobile'].'</td>
- <td>'.$row['mobName'].'</td>
- <td>'.$row['IMEInumber'].'</td>
- <td>'.$row['totalCost'].'</td>
- <td>'.$row['transactionDate'].'</td>
- <td><div class="tooltip"><i class="fa fa-eye" aria-hidden="true" style="font-size:20px"> eye
- <span class="tooltiptext">'.$row['remarks'].'</span>
- </div>
- </td>
- <td>'.$stat.'</td>
- <td><a class="mr-2 text-primary" type="button" onclick="printRecord('.$row['Id'].')"><i class="fa fa-print" aria-hidden="true" style="font-size:20px"></i></a>
- <a class="mr-2 text-primary" type="button" onclick="updateRecord('.$row['Id'].')"><i class="fa fa-pencil-square-o" aria-hidden="true" style="font-size:20px"></i></a>
- <a class="text-danger" type="button" onClick="confirmDelete('.$row['Id'].')"><i class="fa fa-trash-o" aria-hidden="true" style="font-size:20px"></i></a>
- </td>
- </tr>';
- }
- }
- ?>
- </tbody>
- </table>
- </div>
- <!-- New Nentry ModelBox -->
- <div class="modal fade" id="newEntry" tabindex="-1" aria-labelledby="newEntryLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="newEntryLabel">New Entry</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <form id="regForm" method="POST" action="action.php">
- <div class="tab">
- <h4>Select Transaction type</h4>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter username">
- <select class="custom-select custom-select-lg mb-3 input100" name="transaction" required>
- <option value="1">Reapairing</option>
- <option value="2">Sale (New)</option>
- <option value="3">Sale (Old)</option>
- </select>
- </div>
- </div>
- <div class="tab">
- <div class="m-b-2">
- <span id="emailError" style="color:red"></span>
- </div>
- <h4>Customer Detail</h4>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Customer Name">
- <input class="input100" type="text" name="customerName" placeholder="Customer Name"
- onKeyup="alphatbatOnly(this)">
- <span class="focus-input100"></span>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Mobile Number">
- <input class="input100" type="text" name="customerMobile" placeholder="Mobile Number"
- onKeyup="numberOnly(this)">
- <span class="focus-input100"></span>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Email Address">
- <input class="input100" type="text" id="email" name="customerEmail" placeholder="Email Address">
- <span class="focus-input100"> </span>
- </div>
- <div class="form-check">
- <input type="checkbox" class="form-check-input" id="supscriptionCheck" name="supscriptionCheck"
- value="1">
- <label class="form-check-label" for="supscriptionCheck">Are you agree to send you promotion
- email</label>
- </div>
- </div>
- <div class="tab">
- <h4>Mobile Detail</h4>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Colour">
- <input class="input100" type="text" name="mobName" placeholder="Mobile">
- <span class="focus-input100"></span>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Colour">
- <input class="input100" type="text" name="mobColor" placeholder="Mobile Colour">
- <span class="focus-input100"></span>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter 15 digit MEI Number">
- <input class="input100" type="text" name="IMEInumber" id="imei" value="000000000000000"
- placeholder="IMEI Number" maxlength="15" onKeyup="IMEIvalidate(this)">
- <span class="focus-input100"></span>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Price / Charges">
- <input class="input100" type="number" id="price" name="price" placeholder="Price / Charges"
- onKeyup="calculte()">
- <span class="focus-input100"></span>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10">
- <input class="input50" type="text" id="tax" name="tax" placeholder="Tax 11%" disabled>
- <input class="input50" type="text" id="totalCost" name="totalCost" placeholder="Total Cost" disabled>
- </div>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Remarks">
- <textarea class="textarea100" name="remarks" id="" rows="30" placeholder="Remarks / Fault"></textarea>
- <span class="focus-input100"></span>
- </div>
- </div>
- <div style="overflow:auto;">
- <div style="float:right;">
- <button type="button" id="prevBtn" onclick="nextPrev(-1)"
- class="btn btn-outline-danger">Previous</button>
- <button type="button" id="nextBtn" onclick="nextPrev(1)" class="btn btn-danger">Next</button>
- </div>
- </div>
- <!-- Circles which indicates the steps of the form: -->
- <div style="text-align:center;margin-top:40px;">
- <span class="step"></span>
- <span class="step"></span>
- <span class="step"></span>
- <!-- <span class="step"></span> -->
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <!-- Updat entry modelBoc -->
- <div class="modal fade " id="updateEntry" tabindex="-1" aria-labelledby="updateEntryLabel" aria-hidden="true">
- <div class="modal-dialog modal-xl">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="updateEntryLabel">New Entry</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <form id="UpdateRecord" method="POST" action="action.php" class="px-5">
- <div class="row">
- <div class="col">
- <span class="ml-2"> Select Transaction Type:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter username">
- <select class="custom-select custom-select-lg mb-3 input100" id="Utransaction" name="transaction"
- required>
- <option value="1">Reapairing</option>
- <option value="2">Sale (New)</option>
- <option value="3">Sale (Old)</option>
- </select>
- </div>
- </div>
- <div class="col">
- <span class="ml-2"> Customer Name:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Customer Name">
- <input class="input100" type="text" name="customerName" id="UcustomerName" placeholder="Customer Name"
- onKeyup="alphatbatOnly(this)">
- <span class="focus-input100"></span>
- </div>
- </div>
- <div class="col">
- <span class="ml-2"> Custome Mobile:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Mobile Number">
- <input class="input100" type="text" name="customerMobile" id="UcustomerMobile"
- placeholder="Mobile Number" onKeyup="numberOnly(this)">
- <span class="focus-input100"></span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <span class="ml-2"> Email address:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Email Address">
- <input class="input100" type="text" id="UEmail" name="customerEmail" id="UcustomerEmail"
- placeholder="Email Address">
- <span class="focus-input100"> </span>
- </div>
- <div class="form-check">
- <input type="checkbox" class="form-check-input" id="UsupscriptionCheck" name="supscriptionCheck"
- value="1">
- <label class="form-check-label" for="UsupscriptionCheck">Are you agree to send you promotion
- email</label>
- </div>
- </div>
- <div class="col">
- <span class="ml-2"> Mobile Name:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Name">
- <input class="input100" type="text" name="mobName" id="UmobName" placeholder="Mobile">
- <span class="focus-input100"></span>
- </div>
- </div>
- <div class="col">
- <span class="ml-2"> Mobile Color:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Colour">
- <input class="input100" type="text" name="mobColor" id="UmobColor" placeholder="Mobile Colour">
- <span class="focus-input100"></span>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <span class="ml-2"> Mobile IMEI:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter 15 digit MEI Number">
- <input class="input100" type="text" name="IMEInumber" id="uImei" value="000000000000000"
- placeholder="IMEI Number" maxlength="15" onKeyup="IMEIvalidate(this)">
- <span class="focus-input100"></span>
- </div>
- </div>
- <div class="col">
- <span class="ml-2"> Price / Charges:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Price / Charges">
- <input class="input100" type="number" id="uPrice" name="price" id="Uprice" placeholder="Price / Charges"
- onKeyup="calculte()">
- <span class="focus-input100"></span>
- </div>
- </div>
- <div class="col">
- <div class="row">
- <div class="col">
- <span class="ml-2"> Tax 11%:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10">
- <input class="input100" type="text" id="uTax" name="tax" id="Utax" placeholder="Tax 11%" disabled>
- </div>
- </div>
- <div class="col">
- <span class="ml-2"> Total Cost:</span>
- <div class="wrap-input100 validate-input m-b-16 m-t-10">
- <input class="input100" type="text" id="uTotalCost" name="totalCost" id="UtotalCost"
- placeholder="Total Cost" disabled>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-8">
- <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Remarks">
- <textarea class="textarea100" name="remarks" id="Uremarks" rows="30"
- placeholder="Remarks / Fault"></textarea>
- <span class="focus-input100"></span>
- </div>
- </div>
- <div class="col-4">
- <button type="submit" class="btn btn-lg m-t-60 text-white theme" name="updateRecord">Update
- Record</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
- integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
- </script>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"
- integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous">
- </script>
- <!--===============================================================================================-->
- <!-- <script src="vendor/jquery/jquery-3.2.1.min.js"></script> -->
- <script src="https://cdn.datatables.net/1.13.3/js/jquery.dataTables.min.js"></script>
- <script src="https://cdn.datatables.net/1.13.3/js/dataTables.bootstrap4.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/animsition/js/animsition.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/bootstrap/js/popper.js"></script>
- <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/select2/select2.min.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/daterangepicker/moment.min.js"></script>
- <script src="vendor/daterangepicker/daterangepicker.js"></script>
- <!--===============================================================================================-->
- <script src="vendor/countdowntime/countdowntime.js"></script>
- <!--===============================================================================================-->
- <script src="js/main.js"></script>
- <script>
- $(document).ready(function () {
- $('#myTable').DataTable({
- ordering: true,
- paging: false,
- oLanguage: {
- "sSearch": ""
- }
- });
- $('input[name="from"]').daterangepicker({
- singleDatePicker: true,
- locale: {
- format: 'DD/MM/YYYY'
- }
- });
- $('input[name="to"]').daterangepicker({
- singleDatePicker: true,
- locale: {
- format: 'DD/MM/YYYY'
- }
- });
- });
- var currentTab = 0; // Current tab is set to be the first tab (0)
- showTab(currentTab); // Display the current tab
- function showTab(n) {
- // This function will display the specified tab of the form...
- var x = document.getElementsByClassName("tab");
- x[n].style.display = "block";
- //... and fix the Previous/Next buttons:
- if (n == 0) {
- document.getElementById("prevBtn").style.display = "none";
- } else {
- document.getElementById("prevBtn").style.display = "inline";
- }
- if (n == (x.length - 1)) {
- document.getElementById("nextBtn").innerHTML = "Submit";
- } else {
- document.getElementById("nextBtn").innerHTML = "Next";
- }
- //... and run a function that will display the correct step indicator:
- fixStepIndicator(n)
- }
- function nextPrev(n) {
- // This function will figure out which tab to display
- var x = document.getElementsByClassName("tab");
- // Exit the function if any field in the current tab is invalid:
- if (n == 1 && !validateForm()) return false;
- // Hide the current tab:
- x[currentTab].style.display = "none";
- // Increase or decrease the current tab by 1:
- currentTab = currentTab + n;
- // if you have reached the end of the form...
- if (currentTab >= x.length) {
- // ... the form gets submitted:
- document.getElementById("regForm").submit();
- return false;
- }
- // Otherwise, display the correct tab:
- showTab(currentTab);
- }
- function validateForm() {
- // This function deals with validation of the form fields
- var x, y, i, valid = true;
- x = document.getElementsByClassName("tab");
- y = x[currentTab].getElementsByTagName("input");
- // A loop that checks every input field in the current tab:
- for (i = 0; i < y.length; i++) {
- // If a field is empty...
- if (y[i].value == "") {
- // add an "invalid" class to the field:
- y[i].className += " invalid";
- // and set the current valid status to false
- valid = false;
- }
- }
- // If the valid status is true, mark the step as finished and valid:
- if (valid) {
- document.getElementsByClassName("step")[currentTab].className += " finish";
- }
- return valid; // return the valid status
- }
- function fixStepIndicator(n) {
- // This function removes the "active" class of all steps...
- var i, x = document.getElementsByClassName("step");
- for (i = 0; i < x.length; i++) {
- x[i].className = x[i].className.replace(" active", "");
- }
- //... and adds the "active" class on the current step:
- x[n].className += " active";
- }
- function IMEIvalidate(input) {
- var imei = document.getElementById("imei").value;
- if (imei.length < 15 || imei.length > 15) {
- var num = /[^0-9]/gi;
- input.value = input.value.replace(num, "");
- document.getElementById("nextBtn").setAttribute("disabled", "");
- document.getElementById("prevBtn").setAttribute("disabled", "");
- } else {
- document.getElementById("nextBtn").removeAttribute("disabled");
- document.getElementById("prevBtn").removeAttribute("disabled");
- }
- }
- function validateEmail() {
- var emailField = document.getElementById("email");
- var emailError = document.getElementById("emailError");
- var email = emailField.value;
- var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
- if (!emailRegex.test(email)) {
- emailError.textContent = "Invalid email address";
- emailField.classList.add("invalid");
- document.getElementById("nextBtn").setAttribute("disabled", "");
- document.getElementById("prevBtn").setAttribute("disabled", "");
- return false;
- } else {
- emailError.textContent = "";
- emailField.classList.remove("invalid");
- document.getElementById("nextBtn").removeAttribute("disabled");
- document.getElementById("prevBtn").removeAttribute("disabled");
- return true;
- }
- }
- $(function () {
- $('[data-toggle="tooltip"]').tooltip()
- })
- var emailField = document.getElementById("email");
- emailField.addEventListener("blur", validateEmail);
- function numberOnly(input) {
- var num = /[^0-9]/gi;
- input.value = input.value.replace(num, "");
- }
- function alphatbatOnly(input) {
- var num = /[^a-zA-Z]/gi;
- input.value = input.value.replace(/[0-9]/g, "");
- }
- function calculte() {
- var charges = parseInt(document.getElementById('price').value);
- charges = Math.floor(charges);
- var taxValue = charges * (11 / 100);
- if (!isNaN(taxValue)) {
- document.getElementById('tax').value = taxValue;
- document.getElementById('totalCost').value = taxValue + charges;
- } else {
- document.getElementById('tax').value = 0;
- document.getElementById('totalCost').value = 0;
- }
- }
- function confirmDelete(recordId) {
- if (confirm("Are you sure you want to delete this record?")) {
- deleteRecord(recordId);
- }
- }
- function deleteRecord(DeleteID) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "action.php", true);
- xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4 && xhr.status == 200) {
- alert(xhr.responseText);
- location.reload();
- }
- };
- xhr.send("Delete_id=" + DeleteID);
- }
- function updateRecord(updateID) {
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4 && xhr.status == 200) {
- console.log(xhr.responseText)
- var record = JSON.parse(xhr.responseText);
- console.log(record);
- console.log(record.customerName);
- document.getElementById("Utransaction").value = record.transaction;
- document.getElementById("customerName").value = record.customerName;
- document.getElementById("customerMobile").value = record.customerMobile;
- document.getElementById("customerEmail").value = record.customerEmail;
- document.getElementById("UsupscriptionCheck").value = record.supscriptionCheck;
- document.getElementById("UmobName").value = record.mobName;
- document.getElementById("UmobColor").value = record.mobColor;
- document.getElementById("uImei").value = record.IMEInumber;
- document.getElementById("uPrice").value = record.price;
- document.getElementById("uTax").value = record.tax;
- document.getElementById("uTotalCost").value = record.totalCost;
- document.getElementById("Uremarks").value = record.remarks;
- // }
- };
- xhr.open("GET", "action.php?updatID=" + updateID, true);
- xhr.send();
- $('#updateEntry').modal('show');
- }
- function printRecord(printID) {
- var xhr = new XMLHttpRequest();
- xhr.open("POST", "action.php", true);
- xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xhr.onreadystatechange = function () {
- if (xhr.readyState == 4 && xhr.status == 200) {
- var content = xhr.responseText;
- var myWindow = window.open('', 'Print', 'height=600,width=800');
- myWindow.document.write('<html><head><title>Print</title>');
- myWindow.document.write('</head><body>');
- myWindow.document.write(content);
- myWindow.document.write('</body></html>');
- myWindow.document.close();
- myWindow.focus();
- myWindow.print();
- myWindow.close();
- }
- };
- xhr.send("Print_id=" + printID);
- }
- </script>
- </body>
- </html>