<?php session_start();
require_once 'config.php';
require_once 'auth.php';
$PageName = "Payment History";
$UserId = $_SESSION['User']['id'];
 ?>
<!doctype html>
<html lang="en" class="h-100">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="generator" content="">
    <title><?php echo $Proj_Title; ?></title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="apple-touch-icon" href="img/favicon180.png" sizes="180x180">
    <link rel="icon" href="img/favicon32.png" sizes="32x32" type="image/png">
    <link rel="icon" href="img/favicon16.png" sizes="16x16" type="image/png">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&amp;display=swap" rel="stylesheet">
    <link href="vendor/swiper/css/swiper.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet" id="style">
</head>

<body class="body-scroll d-flex flex-column h-100 menu-overlay">
    <main class="flex-shrink-0 main">
        <?php include_once 'back-header.php'; ?> 
        <div class="main-container">
            <div class="container">
               
                  
                  <div class="card">
                     <div class="card-header border-bottom">
                        <h6 class="mb-0" style="text-align: center;">My Payment History</h6>
                    </div>
                    <div class="card-body px-0 pt-0">
                        <ul class="list-group list-group-flush">
                             <?php 
                                        $srno = 1;
                                       $sql2 = "SELECT tgl.*,td.Name As Department,tc.Name As Course FROM tbl_general_ledger tgl
                     LEFT JOIN tbl_departments td ON tgl.DeptId = td.id 
                     LEFT JOIN tbl_courses tc ON tgl.CourseId = tc.id 
                     WHERE tgl.Type='PR' AND tgl.CrDr='dr' AND tgl.Roll=2 AND CustId='$user_id'"; 
                                        $res2 = $conn->query($sql2);
                                        $row_cnt = mysqli_num_rows($res2);
                                        if($row_cnt > 0){
                                        while($row = $res2->fetch_assoc()){
                                          
                                     ?>
                            <li class="list-group-item">
                                <div class="row align-items-center">
                                   
                                    <div class="col align-self-center pr-0">
                                        <h6 class="font-weight-normal mb-1">#<?php echo $row['Code']; ?></h6>
                                       
                                        <p class="small text-secondary"><?php echo date("d/m/Y", strtotime(str_replace('-', '/',$row['PaymentDate'])))?><br>Payment Mode : <?php echo $row['PayType']; ?></p>
                                    </div>
                                    <div class="col-auto">
                                        <h6 class="text-success">&#8377;<?php echo number_format($row["Amount"],2); ?></h6>
                                        <a href="view-receipt.php?id=<?php echo $row['id']; ?>">View Receipt</a>
                                    </div>
                                </div>
                            </li>
                        <?php } }?>
                       
                           
                        </ul>
                        
                    </div>
                </div>
                    
                       
               
            </div>
        </div>
    </main>

<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="vendor/swiper/js/swiper.min.js"></script>
<script src="js/main.js"></script>
<script src="js/color-scheme-demo.js"></script>
<script src="js/app.js"></script>
</body>
</html>
