HIMS / views / discharge.php
discharge.php
Raw
<?php

        $status ="";


// php code to search data in mysql database and set it in input text

if(isset($_POST['search']))
{
    // id to search
    $sn = $_POST['sn'];
    
    // connect to mysql
    $connect = mysqli_connect("localhost", "root", "","himsdb");
    
    // mysql search query
    $query = "SELECT patient_data.ic_num,name,age,status,admit.ad_date,wad,c_code,bill.p_date,c_ward,payment,exc,bal FROM ((patient_data INNER JOIN admit ON patient_data.serial_num = admit.serial_num)INNER JOIN bill ON patient_data.serial_num = bill.serial_num) WHERE patient_data.serial_num = '$sn' AND admit.serial_num = '$sn' AND bill.serial_num = '$sn'";
    
    $result = mysqli_query($connect, $query);
    
    // if id exist 
    // show data in inputs
    if(mysqli_num_rows($result) > 0)
    {
      while ($row = mysqli_fetch_array($result))
      {
        $serial_num = $row['serial_num'];
        $ic_num = $row['ic_num'];
        $name = $row['name'];
        $age = $row['age'];
        $status = $row['status'];
        $ad_date = date("d-m-Y\ h:i A", strtotime($row['ad_date']));
        $wad = $row['wad'];
        $c_code = $row['c_code'];
        $p_date = $row['p_date'];
        $c_ward = $row['c_ward'];
        $payment = $row['payment'];
        $exc = $row['exc'];
        $bal = $row['bal'];
        
          

      }  
    }
    
    // if the id not exist
    // show a message and clear inputs
    else {
    
       echo '<script type="text/javascript">'; 
echo 'alert("Pesakit tiada di dalam sistem, Sila daftar di halaman berikut");'; 
echo 'window.location.href = "index.php?v=REG";';
echo '</script>';
     
     
    }
    
    
    mysqli_free_result($result);
    mysqli_close($connect);
    
}

// in the first time inputs are empty
else{
        $sn ="";
        $ic_num ="";
        $name ="";
        $age ="";
        $ad_date ="";
        $wad ="";
        $c_code ="";
        $p_date ="";
        $c_ward ="";
        $payment ="";
        $exc ="";
        $bal ="";
        
}


?>






    <!doctype html>
    <html lang="en">

    <head>
        <link rel="icon" href="../dist/img/hims.png">
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="../assets/vendor/bootstrap/css/bootstrap.min.css">
        <link href="../assets/vendor/fonts/circular-std/style.css" rel="stylesheet">
        <link rel="stylesheet" href="../assets/libs/css/style.css">
        <link rel="stylesheet" href="../assets/vendor/fonts/fontawesome/css/fontawesome-all.css">
        <title>HIMS</title>
        
            <script type="text/javascript">
// Using jQuery.

$(function() {
    $('sn').each(function() {
        $(this).find('input').keypress(function(e) {
            // Enter pressed?
            if(e.which == 10 || e.which == 13) {
                this.form.submit();
            }
        });

        $(this).find('input[type=submit]').hide();
    });
});
</script>
        
        <style>
            
            table td {
  position: relative;
}

table td input {
  position: absolute;
  display: block;
  top:0;
  left:0;
  margin: 0;
  height: 100%;
  border: none;
  padding: 10px;
  box-sizing: border-box;
}
            
            
            
        .blink_me {
  animation: blinker 1s linear infinite;
}

@keyframes blinker {  
  50% { opacity: 0; }
}
        
        </style>
        
    </head>

    <body>
        <!-- ============================================================== -->
        <!-- main wrapper -->
        <!-- ============================================================== -->
        <div class="dashboard-main-wrapper">
            <!-- ============================================================== -->
            <!-- navbar -->
            <!-- ============================================================== -->
            <?php include $_SERVER['DOCUMENT_ROOT'].'/hims/include/nav.php'; ?>

            <!-- ============================================================== -->
            <!-- end navbar -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- left sidebar -->
            <!-- ============================================================== -->
            <?php include $_SERVER['DOCUMENT_ROOT'].'/hims/include/sidebar.php'; ?>
            <!-- ============================================================== -->
            <!-- end left sidebar -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- wrapper  -->
            <!-- ============================================================== -->
            <div class="dashboard-wrapper">
                <div class="dashboard-ecommerce">
                    <div class="container-fluid dashboard-content ">
                        <!-- ============================================================== -->
                        <!-- pageheader  -->
                        <!-- ============================================================== -->
                        <div class="row">
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                                <div class="page-header">
                                    <h2 class="pageheader-title">Discharge </h2>
                                    <div class="page-breadcrumb">
                                        <nav aria-label="breadcrumb">
                                            <ol class="breadcrumb">
                                                <li class="breadcrumb-item"><a href="#" class="breadcrumb-link">In-Patient</a></li>
                                                <li class="breadcrumb-item active" aria-current="page">Discharge</li>
                                            </ol>
                                        </nav>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- ============================================================== -->
                        <!-- end pageheader  -->
                        <!-- ============================================================== -->
                        <div class="row">
                            <div class="offset-xl-2 col-xl-8 col-lg-12 col-md-12 col-sm-12 col-12">
                                <div class="card">
                                    <div class="card-header p-4">
                                        <a class="pt-2 d-inline-block" href="index.html">Discharge Details</a>

                                        <div class="float-right">
                                            <h3 class="blink_me" ><?php echo $status ?></h3>
                                        </div>
                                    </div>
                                    <div class="card-body">
                                        <div class="row mb-4">
                                            <div class="col">
                                                <h4>Patient Detail</h4>
                                                
                                                
                                                <form action="<?php echo WEB_ROOT; ?>views/?v=DIS" class="form-horizontal" method="post" id="validationform" data-parsley-validate="" novalidate="" class="needs-validation" novalidate>
                                    <div class="form-group row">
                                            <h4 for="inputWebSite" class="col-md-3">Serial Number</h4>
                                            <div>
                                                <input id="sn" type="" name="sn" data-parsley-type="" placeholder="" class="form-control" value="<?php echo $sn ?>" required="">
                                                <input type="submit" name="search" hidden>
                                            </div>
                                        </div>
                                    </form>

                                               <form action="<?php echo WEB_ROOT; ?>views/process.php?cmd=discharge" method="post">
                                                   <table class="table table-sm">
                                                   
                                                <input id="sn" type="text" name="sn" data-parsley-type="" placeholder="" class="form-control" value="<?php echo $sn;?>" hidden>

                                                   
                                                   
                                                    <tbody>
                                                       
                                                       
                                                       
                                                       <?php
                                                        
                                                     
                                                        
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>Name</th>";   
                                                        echo "<td>$name</td>";    
                                                        echo "</tr>";
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>IC</th>";   
                                                        echo "<td>$ic_num</td>";   
                                                        echo "</tr>";
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>Age</th>";   
                                                        echo "<td>$age</td>";   
                                                        echo "</tr>";
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>Ward</th>";   
                                                        echo "<td>$wad</td>";   
                                                        echo "</tr>";
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>Admit Date</th>";   
                                                        echo "<td>$ad_date</td>";   
                                                        echo "</tr>";
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>Charge Code</th>";   
                                                        echo "<td>$c_code</td>";   
                                                        echo "</tr>";
                                                        echo "<tr>";
                                                        echo "<th class='w-25'>Status</th>";   
                                                        echo "<td>$status</td>";   
                                                        echo "</tr>";
                                                        
                                                        
                                                        
                                                        ?>
                                                        
                                                        
                                                        <tr>
                                                        <th class='w-25'>Date</th>   
                                                        <td><input name="p_date" type="date" value="<?php echo $p_date ?>"></td>  
                                                        </tr>
                                                        
                                                        <tr>
                                                        <th class='w-25'>Caj Wad</th>   
                                                        <td><input name="charge" type="text" placeholder="RM" value="<?php echo $c_ward ?>"></td>  
                                                        </tr>
                                                        
                                                        <tr>
                                                        <th class='w-25'>Bayaran Tunai</th>   
                                                        <td><input name="pay" type="text" placeholder="RM" value="<?php echo $payment ?>"></td>  
                                                        </tr>
                                                        
                                                        <tr>
                                                        <th class='w-25'>Pengecualian</th>   
                                                        <td><input name="exc" type="text" placeholder="RM" value="<?php echo $exc ?>"></td>  
                                                        </tr>
                                                        
                                                        <tr>
                                                        <th class='w-25'>Balance</th>   
                                                        <td><input name="bal" type="text" placeholder="RM" value="<?php echo $bal ?>"></td>  
                                                        </tr>
        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                        
                                                    </tbody>
                                                </table>
                                                <br>
                                                <div class="text-center">
                                                <button class="btn btn-primary" type="submit">Discharge</button>
                                            </div>
                                                
                                                </form>
                                            </div>
                                            <!--<div class="col-sm-6">
                                            
                                            
                                            
                                            
                                            
                                            
                                        </div>-->

                                        </div>
                                        <div class="table-responsive-sm">
                                            <table class="table table-striped">
                                                <thead>
                                                    <tr>
                                                        <th class="center">Date</th>
                                                        <th>Caj Wad</th>
                                                        <th>Bayaran Tunai</th>
                                                        <th class="right">Pengecualian</th>
                                                        <th class="center">Balance</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td class="center"><?php echo $p_date ?></td>
                                                        <td class="left strong">RM <?php echo $c_ward ?></td>
                                                        <td class="left">RM <?php echo $payment ?></td>
                                                        <td class="right">RM <?php echo $exc ?></td>
                                                        <td class="center">RM <?php echo $bal ?></td>
                                                    </tr>
                                                   
                                                </tbody>
                                            </table>
                                        </div>
                                        
           
                                    </div>
                                    <div class="card-footer bg-white">
                                        <p class="mb-0">HIMS</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- ============================================================== -->
                    <!-- footer -->
                    <!-- ============================================================== -->
                    <div class="footer">
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
                                    Copyright © 2018 Concept. All rights reserved. Dashboard by <a href="https://colorlib.com/wp/">Colorlib</a>.
                                </div>
                                <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
                                    <div class="text-md-right footer-links d-none d-sm-block">
                                        <a href="javascript: void(0);">About</a>
                                        <a href="javascript: void(0);">Support</a>
                                        <a href="javascript: void(0);">Contact Us</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- ============================================================== -->
                    <!-- end footer -->
                    <!-- ============================================================== -->
                </div>
                <!-- ============================================================== -->
                <!-- end wrapper  -->
                <!-- ============================================================== -->
            </div>
        </div>
        <!-- ============================================================== -->
        <!-- end main wrapper  -->
        <!-- ============================================================== -->
        <!-- Optional JavaScript -->
        <!-- jquery 3.3.1 -->
        <script src="../assets/vendor/jquery/jquery-3.3.1.min.js"></script>
        <!-- bootstap bundle js -->
        <script src="../assets/vendor/bootstrap/js/bootstrap.bundle.js"></script>
        <!-- slimscroll js -->
        <script src="../assets/vendor/slimscroll/jquery.slimscroll.js"></script>
        <!-- main js -->
        <script src="../assets/libs/js/main-js.js"></script>
        <script src="../assets/vendor/parsley/parsley.js"></script>
    </body>

    </html>