<?php include 'header.php';
include 'admin/config.php';
?>

<!-- breadcrumb -->
<div class="site-breadcrumb" style="background: url(assets/img/home/s0.png)">
    <div class="container">
        <h2 class="breadcrumb-title">Annual Reports</h2>
        <ul class="breadcrumb-menu">
            <li><a href="index.php">Home</a></li>
            <li class="active">Annual Reports</li>
        </ul>
    </div>
</div>
<!-- breadcrumb end -->


<!-- course-area -->
<div class="course-area py-80">
    <div class="container">
        <div class=" text-center mb-4">
            <h2 class="mb-3">
                Annual Accounts & Internal Auditor Report
            </h2>

        </div>
        <div class="row">
            <div class="col-md-6 mb-5 mb-md-0">
                <table class="table annual-report text-center table-bordered">
                    <thead>
                        <tr class="table-info">
                            <th scope="col">Annual Accounts</th>
                            <th scope="col">View / Download</th>
                        </tr>
                    </thead>
                    <tbody class="">
                        <?php
                        $sql = "SELECT * FROM `annual_accounts` ORDER BY year DESC"; // Order by year (latest first)
                        $query = mysqli_query($con, $sql);
                        if ($query) {
                            while ($row = mysqli_fetch_assoc($query)) {
                                $year = $row['year'];
                                $pdf = $row['document'];
                                $pdf_path = "admin/image/" . $pdf;
                        ?>
                                <tr>
                                    <td><?php echo $year; ?></td>
                                    <td> <a href="<?php echo $pdf_path; ?>" target="_blank"><i class="fa-solid fa-file-arrow-down"></i></a> </td>
                                </tr>
                        <?php
                            }
                        }
                        ?>



                    </tbody>
                </table>
            </div>

            <div class="col-md-6">
                <table class="table annual-report text-center table-bordered">
                    <thead>
                        <tr class="table-info">
                            <th scope="col">Internal Auditor Report</th>
                            <th scope="col">View / Download</th>
                        </tr>
                    </thead>
                    <tbody class="">
                        <?php
                        $sql = "SELECT * FROM `internal_auditor_report` ORDER BY year DESC"; // Order by year (latest first)
                        $query = mysqli_query($con, $sql);
                        if ($query) {
                            while ($row = mysqli_fetch_assoc($query)) {
                                $year = $row['year'];
                                $pdf = $row['document'];
                                $pdf_path = "admin/image/" . $pdf;
                        ?>
                                <tr>
                                    <td><?php echo $year; ?></td>
                                    <td> <a href="<?php echo $pdf_path; ?>" target="_blank"><i class="fa-solid fa-file-arrow-down"></i></a> </td>
                                </tr>
                        <?php
                            }
                        }
                        ?>



                    </tbody>
                </table>
            </div>

        </div>


    </div>
</div>
<!-- course-area -->

<?php include 'footer.php' ?>