403Webshell
Server IP : 172.67.187.206  /  Your IP : 172.71.28.155
Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586
User : SYSTEM ( 0)
PHP Version : 5.6.30
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Inetpub/www/education/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Inetpub/www/education//admin_reports.php
<?php
require_once 'config.php';
check_login();
check_admin();

$page_title = "รายงานโดยละเอียด - ระบบจัดการข้อมูลการเรียนต่อ สพม.ราชบุรี";

$current_year = get_current_academic_year();

// ดึงข้อมูลรายงานแบบละเอียด
$sql_detailed_report = "
    SELECT 
        u.name as school_name,
        un.name as uni_name,
        fn.name as faculty_name,
        fd.name as field_name,
        scs.student_count,
        scs.created_at
    FROM student_continue_study scs
    LEFT JOIN user u ON scs.user_id = u.id
    LEFT JOIN uni_name un ON scs.uni_id = un.id
    LEFT JOIN faculty_name fn ON scs.faculty_id = fn.id
    LEFT JOIN field_name fd ON scs.field_id = fd.id
    WHERE scs.academic_year = '$current_year'
    ORDER BY u.name, scs.created_at DESC
";

$sql_work_report = "
    SELECT 
        u.name as school_name,
        sw.student_count,
        sw.created_at
    FROM student_work sw
    LEFT JOIN user u ON sw.user_id = u.id
    WHERE sw.academic_year = '$current_year'
    ORDER BY u.name, sw.created_at DESC
";

$detailed_report = mysqli_query($conn, $sql_detailed_report);
$work_report = mysqli_query($conn, $sql_work_report);

include 'template/header.php';
?>

<div class="container-fluid main-content">
    <div class="row">
        <!-- Sidebar -->
        <div class="col-md-3 col-lg-2 px-0">
            <div class="sidebar">
                <div class="p-3">
                    <h6 class="text-muted fw-bold mb-3">เมนูผู้ดูแลระบบ</h6>
                    <nav class="nav flex-column">
                        <a class="nav-link" href="dashboard.php">
                            <i class="bi bi-house me-2"></i>หน้าหลัก
                        </a>
                        <a class="nav-link" href="admin_stats.php">
                            <i class="bi bi-bar-chart me-2"></i>สถิติภาพรวม
                        </a>
                        <a class="nav-link active" href="admin_reports.php">
                            <i class="bi bi-file-earmark-text me-2"></i>รายงาน
                        </a>
                    </nav>
                </div>
            </div>
        </div>
        
        <!-- Main content -->
        <div class="col-md-9 col-lg-10">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <h2 class="text-white mb-4">
                            <i class="bi bi-file-earmark-text me-2"></i>
                            รายงานโดยละเอียด
                        </h2>
                    </div>
                </div>
                
                <!-- Export Buttons -->
                <div class="row mb-4">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <h5 class="mb-0">
                                    <i class="bi bi-download me-2"></i>
                                    ส่งออกรายงาน
                                </h5>
                            </div>
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-md-4 mb-3">
                                        <button onclick="exportToExcel('continue')" class="btn btn-success w-100">
                                            <i class="bi bi-file-earmark-excel me-2"></i>
                                            ส่งออกข้อมูลการเรียนต่อ (Excel)
                                        </button>
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <button onclick="exportToExcel('work')" class="btn btn-warning w-100">
                                            <i class="bi bi-file-earmark-excel me-2"></i>
                                            ส่งออกข้อมูลการประกอบอาชีพ (Excel)
                                        </button>
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <button onclick="window.print()" class="btn btn-primary w-100">
                                            <i class="bi bi-printer me-2"></i>
                                            พิมพ์รายงาน
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Continue Study Report -->
                <div class="row mb-4">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <h5 class="mb-0">
                                    <i class="bi bi-mortarboard me-2"></i>
                                    รายงานข้อมูลการเรียนต่อ (ปีการศึกษา <?php echo $current_year; ?>)
                                </h5>
                            </div>
                            <div class="card-body">
                                <?php if(mysqli_num_rows($detailed_report) > 0): ?>
                                    <div class="table-responsive">
                                        <table class="table table-hover" id="continueTable">
                                            <thead>
                                                <tr>
                                                    <th>ลำดับ</th>
                                                    <th>โรงเรียน</th>
                                                    <th>มหาวิทยาลัย</th>
                                                    <th>คณะ</th>
                                                    <th>สาขาวิชา</th>
                                                    <th class="text-center">จำนวน (คน)</th>
                                                    <th class="text-center">วันที่บันทึก</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php 
                                                $no = 1;
                                                $total_continue = 0;
                                                while($row = mysqli_fetch_assoc($detailed_report)): 
                                                    $total_continue += $row['student_count'];
                                                ?>
                                                    <tr>
                                                        <td><?php echo $no++; ?></td>
                                                        <td><?php echo $row['school_name']; ?></td>
                                                        <td><?php echo $row['uni_name']; ?></td>
                                                        <td><?php echo $row['faculty_name']; ?></td>
                                                        <td><?php echo $row['field_name']; ?></td>
                                                        <td class="text-center">
                                                            <span class="badge bg-primary"><?php echo number_format($row['student_count']); ?></span>
                                                        </td>
                                                        <td class="text-center"><?php echo date('d/m/Y H:i', strtotime($row['created_at'])); ?></td>
                                                    </tr>
                                                <?php endwhile; ?>
                                            </tbody>
                                            <tfoot>
                                                <tr class="table-primary">
                                                    <td colspan="5" class="text-end fw-bold">รวมทั้งหมด:</td>
                                                    <td class="text-center fw-bold"><?php echo number_format($total_continue); ?> คน</td>
                                                    <td></td>
                                                </tr>
                                            </tfoot>
                                        </table>
                                    </div>
                                <?php else: ?>
                                    <div class="text-center py-5">
                                        <i class="bi bi-inbox" style="font-size: 4rem; color: #ccc;"></i>
                                        <h5 class="text-muted mt-3">ยังไม่มีข้อมูลการเรียนต่อ</h5>
                                        <p class="text-muted">ยังไม่มีข้อมูลการเรียนต่อสำหรับปีการศึกษา <?php echo $current_year; ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Work Report -->
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <h5 class="mb-0">
                                    <i class="bi bi-briefcase me-2"></i>
                                    รายงานข้อมูลการประกอบอาชีพ (ปีการศึกษา <?php echo $current_year; ?>)
                                </h5>
                            </div>
                            <div class="card-body">
                                <?php if(mysqli_num_rows($work_report) > 0): ?>
                                    <div class="table-responsive">
                                        <table class="table table-hover" id="workTable">
                                            <thead>
                                                <tr>
                                                    <th>ลำดับ</th>
                                                    <th>โรงเรียน</th>
                                                    <th>ประเภท</th>
                                                    <th class="text-center">จำนวน (คน)</th>
                                                    <th class="text-center">วันที่บันทึก</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php 
                                                $no = 1;
                                                $total_work = 0;
                                                while($row = mysqli_fetch_assoc($work_report)): 
                                                    $total_work += $row['student_count'];
                                                ?>
                                                    <tr>
                                                        <td><?php echo $no++; ?></td>
                                                        <td><?php echo $row['school_name']; ?></td>
                                                        <td>ประกอบอาชีพ</td>
                                                        <td class="text-center">
                                                            <span class="badge bg-success"><?php echo number_format($row['student_count']); ?></span>
                                                        </td>
                                                        <td class="text-center"><?php echo date('d/m/Y H:i', strtotime($row['created_at'])); ?></td>
                                                    </tr>
                                                <?php endwhile; ?>
                                            </tbody>
                                            <tfoot>
                                                <tr class="table-success">
                                                    <td colspan="3" class="text-end fw-bold">รวมทั้งหมด:</td>
                                                    <td class="text-center fw-bold"><?php echo number_format($total_work); ?> คน</td>
                                                    <td></td>
                                                </tr>
                                            </tfoot>
                                        </table>
                                    </div>
                                <?php else: ?>
                                    <div class="text-center py-5">
                                        <i class="bi bi-inbox" style="font-size: 4rem; color: #ccc;"></i>
                                        <h5 class="text-muted mt-3">ยังไม่มีข้อมูลการประกอบอาชีพ</h5>
                                        <p class="text-muted">ยังไม่มีข้อมูลการประกอบอาชีพสำหรับปีการศึกษา <?php echo $current_year; ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Include SheetJS for Excel export -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>

<script>
function exportToExcel(type) {
    let tableId = type === 'continue' ? 'continueTable' : 'workTable';
    let fileName = type === 'continue' ? 'รายงานการเรียนต่อ_<?php echo $current_year; ?>' : 'รายงานการประกอบอาชีพ_<?php echo $current_year; ?>';
    
    const table = document.getElementById(tableId);
    if (!table) {
        alert('ไม่พบข้อมูลสำหรับส่งออก');
        return;
    }
    
    const wb = XLSX.utils.table_to_book(table, {sheet: "รายงาน"});
    XLSX.writeFile(wb, fileName + '.xlsx');
}

// Print styles
const printStyles = `
    <style media="print">
        @page { margin: 0.5in; }
        body { font-family: 'Sarabun', sans-serif; font-size: 12px; }
        .sidebar { display: none !important; }
        .navbar { display: none !important; }
        .btn { display: none !important; }
        .card { border: none; box-shadow: none; }
        .card-header { background: #f8f9fa !important; color: #333 !important; }
        .table { font-size: 11px; }
        .badge { color: #333 !important; background: #f8f9fa !important; }
        h2 { color: #333 !important; }
    </style>
`;

document.head.insertAdjacentHTML('beforeend', printStyles);
</script>

<?php include 'template/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit