Facebook
From Adnan Tasleem, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 48
  1. <?php
  2. // session_start();
  3. // if(!isset($_SESSION['isLogin'])){
  4. //     header("location: login.php");
  5. // }
  6. $conn = new mysqli("localhost","root","","mobile");
  7. if (mysqli_connect_errno()) {
  8.   printf("Connect failed: %s\n", mysqli_connect_error());
  9.   exit();
  10. }
  11. if (isset($_GET['type']) && $_GET['type']!=""){
  12.   $type=$_GET['type'];
  13.   if($type == "status"){
  14.       $operation=$_GET['operation'];
  15.       $id= $_GET['id'];
  16.       if($operation =='deliverd'){
  17.           $status = 1;
  18.       }elseif($operation =='panding') {
  19.           $status = 2;
  20.       }
  21.       $update_status = "UPDATE `newtransaction` SET `status`='$status' WHERE `Id` = $id";
  22.       $conn -> query($update_status);
  23.       }
  24. }
  25.  
  26. if(isset($_POST['userLogin'])) {
  27.     $username = $mysqli -> real_escape_string($_POST['username']);
  28.     $pass = $mysqli -> real_escape_string($_POST['pass']);    
  29.     $checkUser = 'SELECT * FROM `user` WHERE `userName` = "'.$username.'"';
  30.     $result = $mysqli->query($checkUser);
  31.     if(!empty($result) && $result->num_rows > 0){
  32.       while($row = $result->fetch_assoc()){
  33.           $uID = $row['id'];
  34.           $userPass = $row['userPass'];
  35.       }if($userPass === $pass){
  36.           $_SESSION['isLogin'] = true;
  37.           $_SESSION['uID'] = $uID;
  38.           echo "done";
  39.           exit();
  40.           header("location: index.php");
  41.       }else{
  42.           header("location: login.php?message=Password Not Correct");
  43.       }
  44.   }
  45.     else{
  46.         header("location: login.php?message=User Not Found");
  47.     }
  48.     exit();
  49. }
  50.  
  51.  
  52. $sub_sql="";
  53. $toDate=$fromDate="";
  54. if(isset($_POST['searchByDate'])){
  55.   $from=$_POST['from'];
  56.         $fromDate=$from;
  57.         $fromArr=explode("/",$from);
  58.         $from=$fromArr['2'].'-'.$fromArr['1'].'-'.$fromArr['0'];
  59.  
  60.   $to=$_POST['to'];
  61.         $toDate=$to;
  62.         $toArr=explode("/",$to);
  63.         $to=$toArr['2'].'-'.$toArr['1'].'-'.$toArr['0'];
  64.   $sub_sql= " where transactionDate >= '$from' && transactionDate <= '$to' ";
  65. }
  66. $sql = "select * from newtransaction $sub_sql order by id desc";
  67. $result = $conn->query($sql);
  68.  
  69. ?>
  70. <!DOCTYPE html>
  71. <html lang="en">
  72.  
  73. <head>
  74.   <title>Login V8</title>
  75.   <meta charset="UTF-8">
  76.   <meta name="viewport" content="width=device-width, initial-scale=1">
  77.   <!--===============================================================================================-->
  78.   <link rel="icon" type="image/png" href="images/icons/favicon.ico" />
  79.   <!--===============================================================================================-->
  80.   <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
  81.   <!--===============================================================================================-->
  82.   <link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
  83.   <!--===============================================================================================-->
  84.   <link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
  85.   <!--===============================================================================================-->
  86.   <link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
  87.   <!--===============================================================================================-->
  88.   <link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
  89.   <!--===============================================================================================-->
  90.   <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
  91.   <!--===============================================================================================-->
  92.   <link rel="stylesheet" type="text/css" href="vendor/daterangepicker/daterangepicker.css">
  93.   <!--===============================================================================================-->
  94.   <link href="https://cdn.datatables.net/1.13.3/css/dataTables.bootstrap4.min.css">
  95.   <!-- <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> -->
  96.   <link rel="stylesheet" type="text/css" href="css/util.css">
  97.   <link rel="stylesheet" type="text/css" href="css/main.css">
  98.  
  99.  
  100.   <!--===============================================================================================-->
  101. </head>
  102.  
  103. <body>
  104.  
  105.  
  106.   <nav class="navbar navbar-expand-lg navbar-light bg-light">
  107.     <div class="continer">
  108.       <div class="row">
  109.         <img src="images/logo.png" alt="Logo" class="py-1">
  110.         <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
  111.           aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  112.           <span class="navbar-toggler-icon"></span>
  113.         </button>
  114.         <div class="collapse navbar-collapse" id="navbarSupportedContent">
  115.           <ul class="navbar-nav ml-auto">
  116.             <li class="nav-item active">
  117.               <a class="nav-link" href="index.php">Home <span class="sr-only">(current)</span></a>
  118.             </li>
  119.             <li class="nav-item">
  120.               <a class="nav-link" href="#">Change Password</a>
  121.             </li>
  122.             <li class="nav-item">
  123.               <a class="nav-link">Logout</a>
  124.             </li>
  125.           </ul>
  126.         </div>
  127.       </div>
  128.     </div>
  129.   </nav>
  130.  
  131.   <div class="container-fluid pt-5">
  132.  
  133.     <div class="text-right"><button type="button" class="btn btn-lg btn-primary px-5 mb-3" data-toggle="modal"
  134.         data-target="#newEntry">NEW</button></div>
  135.     <div class=" dis-inline ">
  136.       <form method="post" class="form-inline" style="margin-bottom: -37px; position: relative; z-index: 1;">
  137.         <input type="text" class="form-control" id="from" name="from" value="<?php echo $fromDate?>" required>
  138.         <label for="to" class=" mx-1">To</label>
  139.         <input type="text" class="form-control" id="to" name="to" value="<?php echo $toDate?>" required>
  140.  
  141.         <button type="submit" class="btn btn-primary ml-3" name="searchByDate">Search</button>
  142.         <!-- <input type="submit" name="submit" value="Filter"> -->
  143.       </form>
  144.     </div>
  145.     <table id="myTable" class="table display">
  146.       <thead>
  147.         <tr>
  148.           <th>Transaction</th>
  149.           <th>Customer Name</th>
  150.           <th>Mobile No.</th>
  151.           <th>Mobile Name</th>
  152.           <th>IMEI No.</th>
  153.           <th>Charges</th>
  154.           <th>Date</th>
  155.           <th>Remarks</th>
  156.           <th>Status</th>
  157.           <th>Action</th>
  158.         </tr>
  159.       </thead>
  160.       <tbody>
  161.         <?php
  162.                  $transactionType = "";
  163.                   if(!empty($result) && $result->num_rows > 0){
  164.                     while($row = $result->fetch_assoc()){
  165.                       if($row['transaction']==1){
  166.                         $transactionType = "Repairing";
  167.                       } elseif($row['transaction']==2){
  168.                         $transactionType = "Sale(New)";
  169.                       }elseif($row['transaction']==3){
  170.                         $transactionType = "Sale(Old)";
  171.                       }
  172.  
  173.                       if($row['status']==1){
  174.                         $stat = '<a href="?type=status&operation=panding&id='.$row['Id'].'" class="badge badge-success">Deliverd</a>';
  175.                       }else{
  176.                         $stat = '<a href="?type=status&operation=deliverd&id='.$row['Id'].'" class="badge badge-danger">Panding</a>';
  177.                       }
  178.                       echo'
  179.                       <tr>
  180.                       <td>'.$transactionType.'</td>
  181.                       <td>'.$row['customerName'].'</td>
  182.                       <td>'.$row['customerMobile'].'</td>
  183.                       <td>'.$row['mobName'].'</td>
  184.                       <td>'.$row['IMEInumber'].'</td>
  185.                       <td>'.$row['totalCost'].'</td>
  186.                       <td>'.$row['transactionDate'].'</td>
  187.                       <td><div class="tooltip"><i class="fa fa-eye" aria-hidden="true" style="font-size:20px"> eye
  188.                       <span class="tooltiptext">'.$row['remarks'].'</span>
  189.                     </div>
  190.  
  191.                       </td>
  192.                       <td>'.$stat.'</td>
  193.                       <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>
  194.                       <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>
  195.                            <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>
  196.                       </td>
  197.                       </tr>';
  198.                     }
  199.                   }
  200.                   ?>
  201.       </tbody>
  202.     </table>
  203.   </div>
  204.  
  205.   <!-- New Nentry ModelBox -->
  206.   <div class="modal fade" id="newEntry" tabindex="-1" aria-labelledby="newEntryLabel" aria-hidden="true">
  207.     <div class="modal-dialog">
  208.       <div class="modal-content">
  209.         <div class="modal-header">
  210.           <h5 class="modal-title" id="newEntryLabel">New Entry</h5>
  211.           <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  212.             <span aria-hidden="true">&times;</span>
  213.           </button>
  214.         </div>
  215.         <div class="modal-body">
  216.  
  217.           <form id="regForm" method="POST" action="action.php">
  218.             <div class="tab">
  219.               <h4>Select Transaction type</h4>
  220.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter username">
  221.                 <select class="custom-select custom-select-lg mb-3 input100" name="transaction" required>
  222.                   <option value="1">Reapairing</option>
  223.                   <option value="2">Sale (New)</option>
  224.                   <option value="3">Sale (Old)</option>
  225.                 </select>
  226.               </div>
  227.             </div>
  228.             <div class="tab">
  229.               <div class="m-b-2">
  230.                 <span id="emailError" style="color:red"></span>
  231.               </div>
  232.               <h4>Customer Detail</h4>
  233.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Customer Name">
  234.                 <input class="input100" type="text" name="customerName" placeholder="Customer Name"
  235.                   onKeyup="alphatbatOnly(this)">
  236.                 <span class="focus-input100"></span>
  237.               </div>
  238.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Mobile Number">
  239.                 <input class="input100" type="text" name="customerMobile" placeholder="Mobile Number"
  240.                   onKeyup="numberOnly(this)">
  241.                 <span class="focus-input100"></span>
  242.               </div>
  243.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Email Address">
  244.                 <input class="input100" type="text" id="email" name="customerEmail" placeholder="Email Address">
  245.                 <span class="focus-input100"> </span>
  246.               </div>
  247.               <div class="form-check">
  248.                 <input type="checkbox" class="form-check-input" id="supscriptionCheck" name="supscriptionCheck"
  249.                   value="1">
  250.                 <label class="form-check-label" for="supscriptionCheck">Are you agree to send you promotion
  251.                   email</label>
  252.               </div>
  253.             </div>
  254.             <div class="tab">
  255.               <h4>Mobile Detail</h4>
  256.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Colour">
  257.                 <input class="input100" type="text" name="mobName" placeholder="Mobile">
  258.                 <span class="focus-input100"></span>
  259.               </div>
  260.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Colour">
  261.                 <input class="input100" type="text" name="mobColor" placeholder="Mobile Colour">
  262.                 <span class="focus-input100"></span>
  263.               </div>
  264.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter 15 digit MEI Number">
  265.                 <input class="input100" type="text" name="IMEInumber" id="imei" value="000000000000000"
  266.                   placeholder="IMEI Number" maxlength="15" onKeyup="IMEIvalidate(this)">
  267.                 <span class="focus-input100"></span>
  268.               </div>
  269.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Price / Charges">
  270.                 <input class="input100" type="number" id="price" name="price" placeholder="Price / Charges"
  271.                   onKeyup="calculte()">
  272.                 <span class="focus-input100"></span>
  273.               </div>
  274.               <div class="wrap-input100 validate-input m-b-16 m-t-10">
  275.                 <input class="input50" type="text" id="tax" name="tax" placeholder="Tax 11%" disabled>
  276.                 <input class="input50" type="text" id="totalCost" name="totalCost" placeholder="Total Cost" disabled>
  277.               </div>
  278.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Remarks">
  279.                 <textarea class="textarea100" name="remarks" id="" rows="30" placeholder="Remarks / Fault"></textarea>
  280.                 <span class="focus-input100"></span>
  281.               </div>
  282.             </div>
  283.             <div style="overflow:auto;">
  284.               <div style="float:right;">
  285.                 <button type="button" id="prevBtn" onclick="nextPrev(-1)"
  286.                   class="btn btn-outline-danger">Previous</button>
  287.                 <button type="button" id="nextBtn" onclick="nextPrev(1)" class="btn btn-danger">Next</button>
  288.               </div>
  289.             </div>
  290.             <!-- Circles which indicates the steps of the form: -->
  291.             <div style="text-align:center;margin-top:40px;">
  292.               <span class="step"></span>
  293.               <span class="step"></span>
  294.               <span class="step"></span>
  295.               <!-- <span class="step"></span> -->
  296.             </div>
  297.           </form>
  298.         </div>
  299.       </div>
  300.     </div>
  301.   </div>
  302.  
  303.   <!-- Updat entry modelBoc -->
  304.   <div class="modal fade " id="updateEntry" tabindex="-1" aria-labelledby="updateEntryLabel" aria-hidden="true">
  305.     <div class="modal-dialog modal-xl">
  306.       <div class="modal-content">
  307.         <div class="modal-header">
  308.           <h5 class="modal-title" id="updateEntryLabel">New Entry</h5>
  309.           <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  310.             <span aria-hidden="true">&times;</span>
  311.           </button>
  312.         </div>
  313.  
  314.         <form id="UpdateRecord" method="POST" action="action.php" class="px-5">
  315.           <div class="row">
  316.             <div class="col">
  317.               <span class="ml-2"> Select Transaction Type:</span>
  318.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter username">
  319.                 <select class="custom-select custom-select-lg mb-3 input100" id="Utransaction" name="transaction"
  320.                   required>
  321.                   <option value="1">Reapairing</option>
  322.                   <option value="2">Sale (New)</option>
  323.                   <option value="3">Sale (Old)</option>
  324.                 </select>
  325.               </div>
  326.             </div>
  327.             <div class="col">
  328.               <span class="ml-2"> Customer Name:</span>
  329.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Customer Name">
  330.                 <input class="input100" type="text" name="customerName" id="UcustomerName" placeholder="Customer Name"
  331.                   onKeyup="alphatbatOnly(this)">
  332.                 <span class="focus-input100"></span>
  333.               </div>
  334.             </div>
  335.             <div class="col">
  336.               <span class="ml-2"> Custome Mobile:</span>
  337.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Mobile Number">
  338.                 <input class="input100" type="text" name="customerMobile" id="UcustomerMobile"
  339.                   placeholder="Mobile Number" onKeyup="numberOnly(this)">
  340.                 <span class="focus-input100"></span>
  341.               </div>
  342.             </div>
  343.           </div>
  344.  
  345.           <div class="row">
  346.             <div class="col">
  347.               <span class="ml-2"> Email address:</span>
  348.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Email Address">
  349.                 <input class="input100" type="text" id="UEmail" name="customerEmail" id="UcustomerEmail"
  350.                   placeholder="Email Address">
  351.                 <span class="focus-input100"> </span>
  352.               </div>
  353.               <div class="form-check">
  354.                 <input type="checkbox" class="form-check-input" id="UsupscriptionCheck" name="supscriptionCheck"
  355.                   value="1">
  356.                 <label class="form-check-label" for="UsupscriptionCheck">Are you agree to send you promotion
  357.                   email</label>
  358.               </div>
  359.             </div>
  360.             <div class="col">
  361.               <span class="ml-2"> Mobile Name:</span>
  362.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Name">
  363.                 <input class="input100" type="text" name="mobName" id="UmobName" placeholder="Mobile">
  364.                 <span class="focus-input100"></span>
  365.               </div>
  366.             </div>
  367.             <div class="col">
  368.               <span class="ml-2"> Mobile Color:</span>
  369.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please Enter Mobile Colour">
  370.                 <input class="input100" type="text" name="mobColor" id="UmobColor" placeholder="Mobile Colour">
  371.                 <span class="focus-input100"></span>
  372.               </div>
  373.             </div>
  374.           </div>
  375.  
  376.           <div class="row">
  377.             <div class="col">
  378.               <span class="ml-2"> Mobile IMEI:</span>
  379.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter 15 digit MEI Number">
  380.                 <input class="input100" type="text" name="IMEInumber" id="uImei" value="000000000000000"
  381.                   placeholder="IMEI Number" maxlength="15" onKeyup="IMEIvalidate(this)">
  382.                 <span class="focus-input100"></span>
  383.               </div>
  384.             </div>
  385.             <div class="col">
  386.               <span class="ml-2"> Price / Charges:</span>
  387.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Price / Charges">
  388.                 <input class="input100" type="number" id="uPrice" name="price" id="Uprice" placeholder="Price / Charges"
  389.                   onKeyup="calculte()">
  390.                 <span class="focus-input100"></span>
  391.               </div>
  392.             </div>
  393.             <div class="col">
  394.               <div class="row">
  395.                 <div class="col">
  396.                   <span class="ml-2"> Tax 11%:</span>
  397.                   <div class="wrap-input100 validate-input m-b-16 m-t-10">
  398.                     <input class="input100" type="text" id="uTax" name="tax" id="Utax" placeholder="Tax 11%" disabled>
  399.                   </div>
  400.                 </div>
  401.                 <div class="col">
  402.                   <span class="ml-2"> Total Cost:</span>
  403.                   <div class="wrap-input100 validate-input m-b-16 m-t-10">
  404.                     <input class="input100" type="text" id="uTotalCost" name="totalCost" id="UtotalCost"
  405.                       placeholder="Total Cost" disabled>
  406.                   </div>
  407.                 </div>
  408.               </div>
  409.             </div>
  410.           </div>
  411.  
  412.           <div class="row">
  413.             <div class="col-8">
  414.               <div class="wrap-input100 validate-input m-b-16 m-t-10" data-validate="Please enter Remarks">
  415.                 <textarea class="textarea100" name="remarks" id="Uremarks" rows="30"
  416.                   placeholder="Remarks / Fault"></textarea>
  417.                 <span class="focus-input100"></span>
  418.               </div>
  419.             </div>
  420.             <div class="col-4">
  421.               <button type="submit" class="btn btn-lg m-t-60 text-white theme" name="updateRecord">Update
  422.                 Record</button>
  423.             </div>
  424.           </div>
  425.         </form>
  426.       </div>
  427.     </div>
  428.   </div>
  429.   </div>
  430.  
  431.   <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  432.   <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"
  433.     integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
  434.   </script>
  435.   <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
  436.     integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous">
  437.   </script>
  438.   <!--===============================================================================================-->
  439.   <!-- <script src="vendor/jquery/jquery-3.2.1.min.js"></script> -->
  440.   <script src="https://cdn.datatables.net/1.13.3/js/jquery.dataTables.min.js"></script>
  441.   <script src="https://cdn.datatables.net/1.13.3/js/dataTables.bootstrap4.min.js"></script>
  442.  
  443.   <!--===============================================================================================-->
  444.   <script src="vendor/animsition/js/animsition.min.js"></script>
  445.   <!--===============================================================================================-->
  446.   <script src="vendor/bootstrap/js/popper.js"></script>
  447.   <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
  448.   <!--===============================================================================================-->
  449.   <script src="vendor/select2/select2.min.js"></script>
  450.   <!--===============================================================================================-->
  451.   <script src="vendor/daterangepicker/moment.min.js"></script>
  452.   <script src="vendor/daterangepicker/daterangepicker.js"></script>
  453.   <!--===============================================================================================-->
  454.   <script src="vendor/countdowntime/countdowntime.js"></script>
  455.  
  456.   <!--===============================================================================================-->
  457.   <script src="js/main.js"></script>
  458.  
  459.   <script>
  460.     $(document).ready(function () {
  461.       $('#myTable').DataTable({
  462.         ordering: true,
  463.         paging: false,
  464.         oLanguage: {
  465.           "sSearch": ""
  466.         }
  467.       });
  468.  
  469.       $('input[name="from"]').daterangepicker({
  470.         singleDatePicker: true,
  471.         locale: {
  472.           format: 'DD/MM/YYYY'
  473.         }
  474.       });
  475.       $('input[name="to"]').daterangepicker({
  476.         singleDatePicker: true,
  477.         locale: {
  478.           format: 'DD/MM/YYYY'
  479.         }
  480.       });
  481.  
  482.  
  483.     });
  484.  
  485.  
  486.  
  487.  
  488.     var currentTab = 0; // Current tab is set to be the first tab (0)
  489.     showTab(currentTab); // Display the current tab
  490.  
  491.     function showTab(n) {
  492.       // This function will display the specified tab of the form...
  493.       var x = document.getElementsByClassName("tab");
  494.       x[n].style.display = "block";
  495.       //... and fix the Previous/Next buttons:
  496.       if (n == 0) {
  497.         document.getElementById("prevBtn").style.display = "none";
  498.       } else {
  499.         document.getElementById("prevBtn").style.display = "inline";
  500.       }
  501.       if (n == (x.length - 1)) {
  502.         document.getElementById("nextBtn").innerHTML = "Submit";
  503.       } else {
  504.         document.getElementById("nextBtn").innerHTML = "Next";
  505.       }
  506.       //... and run a function that will display the correct step indicator:
  507.       fixStepIndicator(n)
  508.     }
  509.  
  510.     function nextPrev(n) {
  511.       // This function will figure out which tab to display
  512.       var x = document.getElementsByClassName("tab");
  513.       // Exit the function if any field in the current tab is invalid:
  514.       if (n == 1 && !validateForm()) return false;
  515.       // Hide the current tab:
  516.       x[currentTab].style.display = "none";
  517.       // Increase or decrease the current tab by 1:
  518.       currentTab = currentTab + n;
  519.       // if you have reached the end of the form...
  520.       if (currentTab >= x.length) {
  521.         // ... the form gets submitted:
  522.         document.getElementById("regForm").submit();
  523.         return false;
  524.       }
  525.       // Otherwise, display the correct tab:
  526.       showTab(currentTab);
  527.     }
  528.  
  529.     function validateForm() {
  530.       // This function deals with validation of the form fields
  531.       var x, y, i, valid = true;
  532.       x = document.getElementsByClassName("tab");
  533.       y = x[currentTab].getElementsByTagName("input");
  534.       // A loop that checks every input field in the current tab:
  535.       for (i = 0; i < y.length; i++) {
  536.         // If a field is empty...
  537.         if (y[i].value == "") {
  538.           // add an "invalid" class to the field:
  539.           y[i].className += " invalid";
  540.           // and set the current valid status to false
  541.           valid = false;
  542.         }
  543.       }
  544.       // If the valid status is true, mark the step as finished and valid:
  545.       if (valid) {
  546.         document.getElementsByClassName("step")[currentTab].className += " finish";
  547.       }
  548.       return valid; // return the valid status
  549.     }
  550.  
  551.     function fixStepIndicator(n) {
  552.       // This function removes the "active" class of all steps...
  553.       var i, x = document.getElementsByClassName("step");
  554.       for (i = 0; i < x.length; i++) {
  555.         x[i].className = x[i].className.replace(" active", "");
  556.       }
  557.       //... and adds the "active" class on the current step:
  558.       x[n].className += " active";
  559.     }
  560.  
  561.  
  562.     function IMEIvalidate(input) {
  563.       var imei = document.getElementById("imei").value;
  564.       if (imei.length < 15 || imei.length > 15) {
  565.         var num = /[^0-9]/gi;
  566.         input.value = input.value.replace(num, "");
  567.         document.getElementById("nextBtn").setAttribute("disabled", "");
  568.         document.getElementById("prevBtn").setAttribute("disabled", "");
  569.       } else {
  570.         document.getElementById("nextBtn").removeAttribute("disabled");
  571.         document.getElementById("prevBtn").removeAttribute("disabled");
  572.       }
  573.     }
  574.  
  575.     function validateEmail() {
  576.       var emailField = document.getElementById("email");
  577.       var emailError = document.getElementById("emailError");
  578.       var email = emailField.value;
  579.       var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  580.  
  581.       if (!emailRegex.test(email)) {
  582.         emailError.textContent = "Invalid email address";
  583.         emailField.classList.add("invalid");
  584.         document.getElementById("nextBtn").setAttribute("disabled", "");
  585.         document.getElementById("prevBtn").setAttribute("disabled", "");
  586.         return false;
  587.       } else {
  588.         emailError.textContent = "";
  589.         emailField.classList.remove("invalid");
  590.         document.getElementById("nextBtn").removeAttribute("disabled");
  591.         document.getElementById("prevBtn").removeAttribute("disabled");
  592.         return true;
  593.       }
  594.     }
  595.     $(function () {
  596.       $('[data-toggle="tooltip"]').tooltip()
  597.     })
  598.     var emailField = document.getElementById("email");
  599.     emailField.addEventListener("blur", validateEmail);
  600.  
  601.     function numberOnly(input) {
  602.       var num = /[^0-9]/gi;
  603.       input.value = input.value.replace(num, "");
  604.     }
  605.  
  606.     function alphatbatOnly(input) {
  607.       var num = /[^a-zA-Z]/gi;
  608.       input.value = input.value.replace(/[0-9]/g, "");
  609.     }
  610.  
  611.     function calculte() {
  612.  
  613.       var charges = parseInt(document.getElementById('price').value);
  614.       charges = Math.floor(charges);
  615.       var taxValue = charges * (11 / 100);
  616.       if (!isNaN(taxValue)) {
  617.         document.getElementById('tax').value = taxValue;
  618.         document.getElementById('totalCost').value = taxValue + charges;
  619.       } else {
  620.         document.getElementById('tax').value = 0;
  621.         document.getElementById('totalCost').value = 0;
  622.       }
  623.     }
  624.  
  625.     function confirmDelete(recordId) {
  626.       if (confirm("Are you sure you want to delete this record?")) {
  627.         deleteRecord(recordId);
  628.       }
  629.     }
  630.  
  631.     function deleteRecord(DeleteID) {
  632.       var xhr = new XMLHttpRequest();
  633.       xhr.open("POST", "action.php", true);
  634.       xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  635.       xhr.onreadystatechange = function () {
  636.         if (xhr.readyState == 4 && xhr.status == 200) {
  637.           alert(xhr.responseText);
  638.           location.reload();
  639.         }
  640.       };
  641.       xhr.send("Delete_id=" + DeleteID);
  642.     }
  643.  
  644.     function updateRecord(updateID) {
  645.       var xhr = new XMLHttpRequest();
  646.       xhr.onreadystatechange = function () {
  647.         if (xhr.readyState == 4 && xhr.status == 200) {
  648.           console.log(xhr.responseText)
  649.           var record = JSON.parse(xhr.responseText);
  650.           console.log(record);
  651.           console.log(record.customerName);
  652.           document.getElementById("Utransaction").value = record.transaction;
  653.           document.getElementById("customerName").value = record.customerName;
  654.           document.getElementById("customerMobile").value = record.customerMobile;
  655.           document.getElementById("customerEmail").value = record.customerEmail;
  656.           document.getElementById("UsupscriptionCheck").value = record.supscriptionCheck;
  657.           document.getElementById("UmobName").value = record.mobName;
  658.           document.getElementById("UmobColor").value = record.mobColor;
  659.           document.getElementById("uImei").value = record.IMEInumber;
  660.           document.getElementById("uPrice").value = record.price;
  661.           document.getElementById("uTax").value = record.tax;
  662.           document.getElementById("uTotalCost").value = record.totalCost;
  663.           document.getElementById("Uremarks").value = record.remarks;
  664.           // }
  665.         };
  666.         xhr.open("GET", "action.php?updatID=" + updateID, true);
  667.         xhr.send();
  668.         $('#updateEntry').modal('show');
  669.       }
  670.  
  671.       function printRecord(printID) {
  672.         var xhr = new XMLHttpRequest();
  673.         xhr.open("POST", "action.php", true);
  674.         xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  675.         xhr.onreadystatechange = function () {
  676.           if (xhr.readyState == 4 && xhr.status == 200) {
  677.             var content = xhr.responseText;
  678.             var myWindow = window.open('', 'Print', 'height=600,width=800');
  679.             myWindow.document.write('<html><head><title>Print</title>');
  680.             myWindow.document.write('</head><body>');
  681.             myWindow.document.write(content);
  682.             myWindow.document.write('</body></html>');
  683.             myWindow.document.close();
  684.             myWindow.focus();
  685.             myWindow.print();
  686.             myWindow.close();
  687.  
  688.           }
  689.         };
  690.         xhr.send("Print_id=" + printID);
  691.       }
  692.   </script>
  693.  
  694. </body>
  695.  
  696. </html>