403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/Menu กลุ่มงานบริการทางการแพทย์/wd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/Menu กลุ่มงานบริการทางการแพทย์/wd/indexLR.php
<?php
include 'config/db.php'; // ให้แน่ใจว่า path ถูกต้อง
session_start();
if (!isset($_SESSION['username'])) {
  header("Location: sign_in_test.php");
  exit();
}

$loggedInBuilding = array();
if (isset($_SESSION['building'])) {
  $loggedInBuilding = explode(',', $_SESSION['building']);
}

?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Hospital Dashboard</title>
  <link rel="stylesheet" type="text/css" href="assets/bootstrap.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">

</head>


<body>
  <div id="popup-overlay" class="popup-overlay">
    <div class="popup">
      <img src="img/succ.png" style="width: 80px; height: 80px;" />
      <h2>Thank You!</h2>
      <p>บันทึกข้อมูลสำเร็จ</p>
      <button type="button" onclick="closePopup()">ตกลง</button>
    </div>


    <div class="popup" id="popup-error">
      <img src="img/err.png" style="width: 80px; height: 80px;" />
      <h2>เกิดข้อผิดพลาด!</h2>
      <p>กรุณากรอกข้อมูลให้ครบถ้วน</p> <!-- JavaScript จะเปลี่ยนข้อความตรงนี้ -->
      <button type="button" onclick="closeErrorPopup()">ตกลง</button>
    </div>
  </div>

  <nav class="navbar navbar-expand-lg fixed-top navbar-custom">
    <div class="container-fluid">
      <!-- โลโก้ + ชื่อกลุ่มการพยาบาล -->
      <a class="navbar-brand d-flex align-items-center" href="http://10.0.1.10">
        <img src="img/km10logo.png" alt="โลโก้" class="logo-img me-2" />
      </a>

      <!-- เนื้อหาใน navbar -->
      <div class="collapse navbar-collapse justify-content-end" id="navbarRightMenu">
        <ul class="nav navbar-nav navbar-right">
          <li class="nav-item"><a class="nav-link" href="../index.php">หน้าหลัก</a></li>
          <li class="nav-item"><a class="nav-link" href="../โครงสร้าง.html">โครงสร้าง</a></li>
          <li class="nav-item"><a class="nav-link" href="../บุคลากร.html">บุคลากร</a></li>
          <li class="nav-item"><a class="nav-link" href="../พันธกิจ.html">พันธกิจ</a></li>
          <li class="nav-item"><a class="nav-link" href="../นโยบาย.html">นโยบาย</a></li>
          <li class="nav-item"><a class="nav-link" href="../วัตถุประสงค์.html">วัตถุประสงค์</a></li>
          <li class="nav-item"><a class="nav-link" href="sign_in.php" target="_blank">Ward Daily Dashboard</a></li>
          <li class="nav-item"><a class="nav-link" href="../IC/index.html" target="_blank">IC</a></li>
          <li class="nav-item">
            <a class="nav-link text-danger" href="sign_out.php">
              <i class="fas fa-sign-out-alt"></i> ออกจากระบบ
            </a>
          </li>
        </ul>
      </div>
    </div>
  </nav>



  <div id="main-content">
    <div class="container first-container">
      <div class="panel panel-primary">
        <div class="panel-heading text-center mb-4 ">
          <h1><i class="fas fa-hospital-alt"></i> Ward Daily Dashboard</h1>
        </div>

        <div class="panel-body ">
          <form action="save.php" method="post">

            <div class="row col-md-8">

              <a href="queryLR.php" class="btn btn-jump btn-m fas fa-search"> ค้นหาข้อมูล</a>

              <!-- Building dropdown -->
              <div class="form-group mb-3 col-md-offset-6 form-inline ">
                <label for="building" class="form-label" style="font-size: 1.8rem; margin-right: 10px; padding-left: 55px; ">Ward</label>
                <select id="building" name="building" class="form-control input-lg" required>
                  <?php foreach ($loggedInBuilding as $bld): ?>
                    <option value="<?php echo htmlspecialchars($bld, ENT_QUOTES) ?>">
                      <?php echo htmlspecialchars($bld) ?>
                    </option>
                  <?php endforeach; ?>
                </select>
                <input type="submit" value="บันทึก" class="btn btn-success btn-lg " />
              </div>
            </div>

            <div class="row col-md-6">
              <div class="form-group mb-3 col-md-offset-2">
                <label for="pt1" class="form-label">ประเภทที่ 1</label>
                <input type="number" name="pt1" id="pt1" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ ประเภทที่ 1" />
              </div>

              <div class="form-group mb-3 col-md-offset-2">
                <label for="pt2" class="form-label">ประเภทที่ 2</label>
                <input type="number" name="pt2" id="pt2" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ ประเภทที่ 2" />
              </div>

              <div class="form-group mb-3 col-md-offset-2">
                <label for="pt3" class="form-label">ประเภทที่ 3</label>
                <input type="number" name="pt3" id="pt3" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ ประเภทที่ 3" />
              </div>

              <div class="form-group mb-3 col-md-offset-2">
                <label for="pt4" class="form-label">ประเภทที่ 4</label>
                <input type="number" name="pt4" id="pt4" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ ประเภทที่ 4" />
              </div>

              <div class="form-group mb-3 col-md-offset-2">
                <label for="pt5" class="form-label">ประเภทที่ 5</label>
                <input type="number" name="pt5" id="pt5" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ ประเภทที่ 5" />
              </div>

            </div>


            <div class="row col-md-6">
              <div class="form-group mb-3 col-md-offset-1">
                <label for="admit" class="form-label">Admit</label>
                <input type="number" name="admit" id="admit" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ที่ Admit" />
              </div>

              <div class="form-group mb-3 col-md-offset-1">
                <label for="refer" class="form-label">Refer</label>
                <input type="number" name="refer" id="refer" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ที่ Refer" />
              </div>

              <div class="form-group mb-3 col-md-offset-1">
                <label for="dead" class="form-label">Dead</label>
                <input type="number" name="dead" id="dead" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ที่ Dead" />
              </div>


              <div class="form-group mb-3 col-md-offset-1">
                <label for="viproom" class="form-label">ห้องพิเศษ</label>
                <input type="number" name="viproom" id="viproom" class="form-control input-lg" placeholder="เพิ่มจำนวนคนไข้ที่ ห้องพิเศษ" />
              </div>
            </div>

          </form>
        </div>

        <div class="panel-footer text-right text-muted py-3 mt-5">
          <small>&copy; 2025 Zein Dev. Ward Dashboard System</small>
        </div>
      </div>
    </div>

    <?php
    if (isset($_GET["selected_date"]) || isset($_GET["quick"])) {
      // ตรวจสอบว่ากด quick action หรือไม่
      if (isset($_GET["quick"])) {
        $quick = $_GET["quick"];
        if ($quick === "today") {
          $selected_date = date("Y-m-d");
        } elseif ($quick === "yesterday") {
          $selected_date = date("Y-m-d", strtotime("-1 day"));
        }
      } else {
        // ถ้าเลือกวันที่เอง
        $selected_date = $_GET["selected_date"];
      }
      echo "<h4>ข้อมูลวันที่: $selected_date</h4>";

      $sql = "SELECT building,
            SUM(pt1) AS pt1,
            SUM(pt2) AS pt2,
            SUM(pt3) AS pt3,
            SUM(pt4) AS pt4,
            SUM(pt5) AS pt5,
            SUM(total) AS total,
            SUM(admit) AS admit,
            SUM(refer) AS refer,
            SUM(dead) AS dead,
            SUM(viproom) AS viproom
            FROM patient_count WHERE create_at LIKE '{$selected_date}%'
            GROUP BY building";

      $result = $conn->query($sql);


      if ($result->num_rows > 0) {
        echo
        '<div class="row justify-content-center">';
        echo '<div class="col-12 col-md-12">';
        echo '<div class="table-responsive">';
        echo '<table class="table table-bordered table-striped table-sm mb-0 text-center" style="margin: 0 auto; max-width: 1200px; font-size: 1.15rem;">';
        echo '<thead><tr>
        <th>Ward</th>
        <th>ประเภทที่ 1 (ราย)</th>
        <th>ประเภทที่ 2 (ราย)</th>
        <th>ประเภทที่ 3 (ราย)</th>
        <th>ประเภทที่ 4 (ราย)</th>  
        <th>ประเภทที่ 5 (ราย)</th>
        <th>รวม (ราย)</th>
        <th>Admit (ราย)</th>
        <th>Refer (ราย)</th>
        <th>Dead (ราย)</th>
        <th>ห้องพิเศษ (ราย)</th>
      </tr></thead><tbody>';
        while ($row = $result->fetch_assoc()) {
          echo '<tr>';
          echo '<td>' . htmlspecialchars($row["building"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["pt1"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["pt2"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["pt3"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["pt4"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["pt5"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["total"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["admit"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["refer"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["dead"]) . '</td>';
          echo '<td>' . htmlspecialchars($row["viproom"]) . '</td>';
          echo '</tr>';
        }
        echo '</tbody></table>';
        echo '</div>';
        echo '</div>';
        echo '</div>';
      } else {
        echo "ไม่พบข้อมูลในวันดังกล่าว";
      };
    }

    $conn->close();
    ?>
  </div>
  </div>
  </div>
  </div>

  <!-- JavaScript -->
  <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"></script>

  <script>
    $(document).ready(function() {
      $("form[action=\'save.php\']").submit(function(e) {
        e.preventDefault(); // หยุดการ submit ปกติ

        const building = $("#building").val();
        const fields = ["pt1", "pt2", "pt3", "pt4", "pt5", "admit", "refer", "dead", "viproom"];
        let allEmpty = true;

        // เช็คว่า building ถูกเลือกหรือไม่
        if (!building) {
          openErrorPopup("กรุณาเลือก Ward");
          return;
        }

        // เช็คว่า input ทุกช่องเป็นค่าว่างหรือไม่
        fields.forEach(id => {
          if ($("#" + id).val().trim() !== "") {
            allEmpty = false;
          }
        });

        if (allEmpty) {
          openErrorPopup("กรุณากรอกข้อมูลอย่างน้อย 1 ช่อง");
          return;
        }

        // ผ่านเงื่อนไข -> ส่งข้อมูลไป save.php แบบ AJAX
        $.ajax({
          url: "save.php",
          type: "POST",
          data: $(this).serialize(),
          success: function(response) {
            if (response.includes("success")) {
              openPopup();
            } else {
              openErrorPopup(response);
            }
          },
          error: function() {
            openErrorPopup("เกิดข้อผิดพลาดในการเชื่อมต่อเซิร์ฟเวอร์");
          }
        });
      });
    });

    function openPopup() {
      document.getElementById("popup-overlay").style.display = "flex";
      document.querySelector(".popup").style.display = "block"; // แสดง popup ตัวแรก
      document.getElementById("popup-error").style.display = "none";
      document.getElementById("main-content").classList.add("blur");
    }

    function openErrorPopup(msg) {
      document.getElementById("popup-overlay").style.display = "flex";
      document.querySelector(".popup").style.display = "none"; // ซ่อน popup ขอบคุณ
      document.getElementById("popup-error").style.display = "block";
      document.getElementById("popup-error").querySelector("p").textContent = msg;
      document.getElementById("main-content").classList.add("blur");
    }

    function closePopup() {
      document.getElementById("popup-overlay").style.display = "none";
      document.getElementById("main-content").classList.remove("blur");
      location.reload();
    }

    function closeErrorPopup() {
      document.getElementById("popup-overlay").style.display = "none";
      document.getElementById("main-content").classList.remove("blur");
      location.reload();
    }

    // function openErrorPopup(msg) {
    // $("#popup-error p").text(msg);
    // $("#popup-error").addClass("open-popup");
    // }

    // function closeErrorPopup() {
    // $("#popup-error").removeClass("open-popup").remove("blur");
    // setTimeout(() => {
    // location.reload();
    // }, 500);
    // }
  </script>
</body>

</html>

Youez - 2016 - github.com/yon3zu
LinuXploit