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 :  E:/Inetpub/www/work/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/www/work/print_daily_report.php
<?php 
require_once 'config.php';
require_once 'functions.php';

// ตรวจสอบสิทธิ์ Admin
if($_SESSION['type'] != 'admin'){ 
    exit("Access Denied: คุณไม่มีสิทธิ์เข้าถึงรายงานนี้"); 
}

// รับค่าจาก GET
$date = isset($_GET['date']) ? mysqli_real_escape_string($conn, $_GET['date']) : date('Y-m-d');
$p_id = isset($_GET['p_id']) ? (int)$_GET['p_id'] : 0;

// ดึงชื่อประเภทบุคลากร (กรณีมีการกรองประเภท)
$type_name = "บุคลากรทุกประเภท";
if($p_id > 0) {
    $t_res = mysqli_query($conn, "SELECT p_name FROM personnel_types WHERE p_id = '$p_id'");
    $t_row = mysqli_fetch_assoc($t_res);
    if($t_row) $type_name = $t_row['p_name'];
}

// สร้างคำสั่ง SQL ตามเงื่อนไขที่เลือก
$where = " WHERE a.att_date = '$date' ";
if($p_id > 0) {
    $where .= " AND u.p_id = '$p_id' ";
}

$sql = "SELECT a.*, u.fullname, u.signature, pt.p_name 
        FROM attendance a 
        JOIN users u ON a.u_id = u.u_id 
        LEFT JOIN personnel_types pt ON u.p_id = pt.p_id
        $where 
        ORDER BY a.time_in ASC";
$res = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<html lang="th">
<head>
    <meta charset="UTF-8">
    <title>รายงานการลงเวลา - <?php echo $type_name; ?></title>
    <link href="https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;600&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Sarabun', sans-serif; font-size: 14px; color: #000; padding: 20px; line-height: 1.4; }
        .header { text-align: center; margin-bottom: 25px; }
        .title { font-size: 18px; font-weight: bold; margin-bottom: 5px; }
        .subtitle { font-size: 15px; margin-bottom: 5px; }
        
        table { width: 100%; border-collapse: collapse; margin-top: 10px; }
        table, th, td { border: 1px solid #000; }
        th { padding: 10px 5px; background-color: #f5f5f5; text-align: center; font-weight: 600; }
        td { padding: 8px 6px; vertical-align: middle; }
        
        .sig-container { height: 50px; display: flex; align-items: center; justify-content: center; }
        .sig-img { max-height: 45px; max-width: 110px; filter: grayscale(1); }
        
        /* สไตล์สำหรับการพิมพ์ส่วนสรุปและใบเซ็นนามตามเอกสาร Word */
        .summary-section { width: 100%; margin-top: 20px; font-size: 14px; }
        .summary-table { width: 100%; border: none !important; margin-top: 5px; }
        .summary-table td { border: none !important; padding: 3px 0; }
        .sign-table { width: 100%; border: none !important; margin-top: 30px; }
        .sign-table td { border: none !important; text-align: center; vertical-align: top; padding-top: 10px; }
        
        .leave-text-section { margin-top: 15px; margin-bottom: 15px; line-height: 1.8; }
        
        @media print {
            @page { size: A4; margin: 1.5cm; }
            .no-print { display: none; }
            body { padding: 0; }
        }
    </style>
</head>
<body onload="window.print()">

    <div class="no-print" style="margin-bottom: 20px; text-align: right;">
        <button onclick="window.print()" style="padding: 8px 20px; background: #333; color: #fff; border: none; cursor: pointer; border-radius: 5px;">
            <i class="fas fa-print"></i> พิมพ์รายงาน
        </button>
    </div>

    <div class="header">
        <div class="title">บัญชีลงเวลาปฏิบัติงานบุคลากร</div>
        <div class="subtitle"><strong>ประเภท:</strong> <?php echo $type_name; ?></div>
        <div>ประจำวันที่ <?php echo DateThai($date); ?></div>
    </div>

    <table>
        <thead>
            <tr>
                <th width="5%">ที่</th>
                <th width="22%">ชื่อ - นามสกุล</th>
                <th width="10%">เวลามา</th>
                <th width="23%">ลายเซ็น (มา)</th>
                <th width="10%">เวลากลับ</th>
                <th width="23%">ลายเซ็น (กลับ)</th>
            </tr>
        </thead>
        <tbody>
            <?php 
            $i = 1;
            $count_total = 0;
            $count_office = 0;
            $count_home = 0;
            $count_late = 0;

            while($row = mysqli_fetch_assoc($res)): 
                $count_total++;
                if($row['work_location'] == 'office') { $count_office++; }
                if($row['work_location'] == 'home') { $count_home++; }
                if($row['time_in'] > '08:30:00') { $count_late++; }
            ?>
            <tr>
                <td align="center"><?php echo $i++; ?></td>
                <td><?php echo $row['fullname']; ?></td>
                <td align="center"><?php echo $row['time_in']; ?></td>
                <td align="center">
                    <div class="sig-container">
                        <?php if($row['signature']): ?>
                            <img src="uploads/<?php echo $row['signature']; ?>" class="sig-img">
                        <?php endif; ?>
                    </div>
                </td>
                <td align="center">
                    <?php echo ($row['time_out'] == "00:00:00" || empty($row['time_out'])) ? "-" : $row['time_out']; ?>
                </td>
                <td align="center">
                    <div class="sig-container">
                        <?php 
                        if($row['signature'] && $row['time_out'] != "00:00:00" && !empty($row['time_out'])): 
                        ?>
                            <img src="uploads/<?php echo $row['signature']; ?>" class="sig-img">
                        <?php endif; ?>
                    </div>
                </td>
            </tr>
            <?php endwhile; ?>
            
            <?php if(mysqli_num_rows($res) == 0): ?>
                <tr>
                    <td colspan="6" align="center" style="padding: 40px; color: #666;">
                        ไม่พบข้อมูลการปฏิบัติงานของ<?php echo $type_name; ?> ในวันที่เลือก
                    </td>
                </tr>
            <?php endif; ?>
        </tbody>
    </table>

    <div class="summary-section">
        
        <div class="leave-text-section">
            <?php 
            // ตรวจสอบว่าเป็นกลุ่มผู้บริหาร ข้าราชการ หรือกรณียังไม่ได้เลือกประเภท (แสดงแบบรูปที่ 1)
            if ($p_id == 0 || strpos($type_name, 'ผู้บริหาร') !== false || strpos($type_name, 'ข้าราชการ') !== false): 
            ?>
                <div>ขออนุญาตไปราชการ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;จำนวน &nbsp;.........&nbsp; คน</div>
                <div>..............................................................................................................................................................................</div>
                <div>..............................................................................................................................................................................</div>
                <div style="margin-bottom: 10px;">..............................................................................................................................................................................</div>
                <div>ขออนุญาตลาพักผ่อน&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;จำนวน &nbsp;.........&nbsp; คน</div>
                <div>ขออนุญาตลาป่วย&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;จำนวน &nbsp;.........&nbsp; คน</div>
            
            <?php 
            // ตรวจสอบว่าเป็นกลุ่มพนักงานราชการ (แสดงแบบรูปที่ 2)
            elseif (strpos($type_name, 'พนักงานราชการ') !== false): 
            ?>
                <div>ขออนุญาตลาพักผ่อน&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;จำนวน &nbsp;.........&nbsp; คน</div>
            <?php endif; ?>
        </div>

        <table class="summary-table">
            <tr>
                <td width="35%"><strong><?php echo $type_name; ?>ทั้งหมด</strong></td>
                <td>................................... คน</td>
            </tr>
            <tr>
                <td>ตำแหน่งว่าง</td>
                <td>................................... คน</td>
            </tr>
            <tr>
                <td>ยืมตัวมาช่วยราชการ</td>
                <td>................................... คน</td>
            </tr>
            <tr>
                <td>มาปฏิบัติงานในสำนักงาน</td>
                <td>................................... คน (ระบบตรวจพบจากบันทึก: <?php echo $count_office; ?> คน)</td>
            </tr>
            <tr>
                <td>ปฏิบัติงานที่บ้าน</td>
                <td>................................... คน (ระบบตรวจพบจากบันทึก: <?php echo $count_home; ?> คน)</td>
            </tr>
            <tr>
                <td>ไปราชการ</td>
                <td>................................... คน</td>
            </tr>
            <tr>
                <td>มาสาย</td>
                <td>................................... คน (ระบบตรวจพบจากบันทึก: <?php echo $count_late; ?> คน)</td>
            </tr>
            <tr>
                <td>ไม่มาปฏิบัติราชการ</td>
                <td>................................... คน</td>
            </tr>
        </table>

        <table class="sign-table">
            <tr>
                <td width="50%">
                    <br><br><br>
                    <p>ผู้ตรวจ..........................................................................</p>
                    <p style="padding-left: 35px;">(..................................................................)</p>
                    <p>ผู้อำนวยการกลุ่มบริหารงานบุคคล</p>
                </td>
                <td width="50%">
                    <p>ตรวจสอบแล้วถูกต้อง</p>
                    <br>
                    <p>..........................................................................</p>
                    <p>(..................................................................)</p>
                    <p>รองผู้อำนวยการ<br />สำนักงานเขตพื้นที่การศึกษามัธยมศึกษาราชบุรี</p>
                </td>
            </tr>
        </table>
    </div>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit