<?php 
include 'connect.php';
session_start();

	$sql = "SELECT * FROM `bahagian/unit`";
	$result = mysqli_query($conn,$sql);
	$row = mysqli_fetch_array($result);
	
	$sql1 = "select * from `user` where kad_pengenalan = '".$_SESSION['kadPengenalan']."' ";
	$result1 = mysqli_query($conn,$sql1);
	$row1 = mysqli_fetch_array($result1);
	
	$userID = $row1["id_user"];
	//echo $peranan_user;
	
	$idSuratMasuk=$_GET['idSuratMasuk'];
	
	$sql2="select * from`cek` where id_surat_masuk = '".$idSuratMasuk."'";
	$result2= mysqli_query($conn,$sql2);
	
	
	$sql3="select * from`surat_masuk` where id_surat_masuk = '".$idSuratMasuk."'";
	$result3= mysqli_query($conn,$sql3);
	$row3 = mysqli_fetch_array($result3);
	
	$tarikhSuratMasuk = $row3["tarikh_terima_surat"];
	$id_cek = $_GET["id_cek"];
	
	$sql4="select * from`cek` where id_cek = '".$id_cek."'";
	$result4= mysqli_query($conn,$sql4);
	$row4 = mysqli_fetch_array($result4);	

?>

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

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>Sistem Pendaftaran Surat</title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  <!-- Favicons -->
  <link href="assets/img/logo_tab.png" rel="icon">

  <!-- Google Fonts -->
  <link href="https://fonts.gstatic.com" rel="preconnect">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">

  <!-- Vendor CSS Files -->
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <link href="assets/vendor/quill/quill.snow.css" rel="stylesheet">
  <link href="assets/vendor/quill/quill.bubble.css" rel="stylesheet">
  <link href="assets/vendor/remixicon/remixicon.css" rel="stylesheet">
  <link href="assets/vendor/simple-datatables/style.css" rel="stylesheet">

  <!-- Template Main CSS File -->
  <link href="assets/css/style.css" rel="stylesheet">
  
  <!-- Script logout -->
  <script type="text/javascript" src="internalPage/logoutConfirmation.js"></script>

  <!-- =======================================================
  * Template Name: NiceAdmin - v2.2.0
  * Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
  * Author: BootstrapMade.com
  * License: https://bootstrapmade.com/license/
  ======================================================== -->
</head>

<body>

<?php 
  include 'header.php';
  
  ?>

  <main id="main" class="main" style="margin-top:0px;">
    <div class="pagetitle">
		  <h1>Senarai Cek</h1>
		  <nav>
			<ol class="breadcrumb">
			  <li class="breadcrumb-item"><a href="">No. Rujukan Surat: <?php echo $row3['no_rujukan_surat']?></a></li>          
			</ol>
		  </nav>
		</div><!-- End Page Title -->
		
		<section class="section">
		  <div class="row">
					<section class="section">
						<div class="col-lg-12">

						  <div class="card" style="overflow:scroll">
							<div class="card-body">

							  <!-- Table with stripped rows -->
							  <table class="table datatable">
								<thead>
								  <tr>
									<th scope="col">#</th>
									<th scope="col">No. Cek/dll:</th>
									<th scope="col">No. Resit</th>
									<th scope="col">Jumlah (RM)</th>
									<th scope="col">Tarikh Resit</th>
									<th scope="col">Perihal 1</th>
									<th scope="col">Perihal 2</th>
									<th scope="col">Lain-lain Hal</th>

									
								  </tr>
								</thead>
								<tbody>
								<?php
								
									$no=0;
									
									while ($row2 = mysqli_fetch_array($result2))
									{
										$no++;
															
														
								?>
								  <tr>
									<th scope="row"><?php echo $no; ?></th>
									<td><?php echo $row2["no_cek"]; ?></td>
									<td><?php echo $row2["no_resit"]; ?></td>
									<td><?php echo $row2["jumlah"]; ?></td>
									<td><?php echo date("d-m-Y", strtotime($row2["tarikh_resit"])) ?></td>
									<td><?php echo $row2["perihal1"]; ?></td>
									<td><?php echo $row2["perihal2"]; ?></td>
									<td><?php echo $row2["lain_lain_hal"]; ?></td>												
								  </tr>
								<?php
									}
									
								?>	
								</tbody>
							  </table>
							  <!-- End Table with stripped rows -->

							</div>
						</div>
					</section>
			</div>
			
		  </div>
	    </section>
	</main>
 <!-- ======= Footer ======= -->
  <footer id="footer" class="footer">
    <div class="copyright">
      &copy; Copyright <strong><span>Majlis Agama Islam Negeri Pulau Pinang @ 2022</span></strong>.
    </div>
  </footer><!-- End Footer -->

  <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <!-- Vendor JS Files -->
  <script src="assets/vendor/apexcharts/apexcharts.min.js"></script>
  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/chart.js/chart.min.js"></script>
  <script src="assets/vendor/echarts/echarts.min.js"></script>
  <script src="assets/vendor/quill/quill.min.js"></script>
  <script src="assets/vendor/simple-datatables/simple-datatables.js"></script>
  <script src="assets/vendor/tinymce/tinymce.min.js"></script>
  <script src="assets/vendor/php-email-form/validate.js"></script>

  <!-- Template Main JS File -->
  <script src="assets/js/main.js"></script>

</body>

</html>