<?php $act =2; ?>
<!DOCTYPE html>
<!-- =========================================================
* ekseba Admin Template - Pro | v1.0.0
==============================================================

* Product Page: https://ekseba.com
* Created by: ekseba
* License: ekseba.com
* Copyright ThemeSelection (https://ekseba.com)

=========================================================
 -->
<!-- beautify ignore:start -->
<html lang="en"  class="light-style layout-menu-fixed"  dir="ltr"  data-theme="theme-default"  data-assets-path="assets/"  data-template="vertical-menu-template-free">
  <head>
    
    <?php include './html/head.php'; ?>
      <style>
          #customers {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%; font-size: 12px;
}

#customers td, #customers th {
  border: 1px solid #ddd;
  padding: 5px 2px 5px 2px; font-size: 12px;
  text-align: center;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  background-color: #04AA6D;
  color: white; font-size: 12px;
}
      </style>
  </head>

  <body>
    <!-- Layout wrapper -->
    <div class="layout-wrapper layout-content-navbar">
      <div class="layout-container">
        <!-- Menu -->
        <?php 
        include './menue.php';
        ?>
        <!-- / Menu -->

        <!-- Layout container -->
        <div class="layout-page">
          <!-- Navbar -->

          <?php include './navbar.php'; ?>

          <!-- / Navbar -->

          <!-- Content wrapper -->
          <div class="content-wrapper">
            <!-- Content -->

            <!-- Content wrapper -->
          <div class="content-wrapper">
            <!-- Content -->

            <div class="container-xxl flex-grow-1 container-p-y">
              <h4 class="fw-bold py-3 mb-4"><span class="text-muted fw-light">Forms/</span> Plots Information</h4>

              <!-- Basic Layout & Basic with Icons -->
              <div class="row">
                <!-- Basic Layout -->
                <div class="col-xl">
                  <div class="card mb-4">
                    <div class="card-header d-flex justify-content-between align-items-center">
                      <h5 class="mb-0">Payment Information</h5>
                      <small class="text-muted float-end">Payment Information</small>
                    </div>
                    <div class="card-body">
                     

                <div class="col-xxl">
                    
                   <?php require './student_attendance_manue.php'; ?>
                    
                  <div class="card mb-4">
                     <table style="width:100%;" id="customers" >                                
                        <tr style="font-weight: bold; background-color: #D3D3D3; text-align: center;">
                        <td style="text-align: center;padding: 5px; width: 20px;">SL.No.</td>   
                        <td style="width: 10px;">ID</td>
                        <td style="width:200px; text-align: center; padding-left: 5px; padding-right: 5px;">
                        Student&nbsp;Name
                        </td>

                <?php
                /* Default Date Indexing starts here. */
                include './login/connect.php';
                $timezone = "Asia/Calcutta";
                $Month=01;$Year=2024;
                date_default_timezone_set($timezone);
                $timestamp = mktime(0,0,0,$Month,1,$Year);
                $maxday = date("t",$timestamp);

                //echo "<td></td>";
                for ($k=1; $k<= $maxday; $k++) {  
                    $kv = sprintf('%02d', $k);
                    echo "<td style=''>$kv</td>";  
                }

                /* Default Date Indexing ends here. */
                ?>
                <td>TOT.P</td>
                <td>TOT.HLF</td>
                <td>TOT.A</td>
                <td>TOT.WO</td>
                <td>TOT.HLD</td>
            </tr>
            <?php
                include './login/connect.php';
                $class =$cl;
            //Getting all employee details according roster assign table.
            $sqlRA = "SELECT * from employee_details where DivisionDbKey = 'ok' and Status='ACTIVE' and class='$class' ORDER BY EmployeeId ASC";
            $resultRA = mysqli_query($conn, $sqlRA);
            $i = 1;
            while ($rowRA = mysqli_fetch_array($resultRA, MYSQLI_ASSOC)) {
                $EmployeeDbKey = $rowRA['DivisionDbKey'];
                $EmployeeId = $rowRA['EmployeeId'];
                $EmployeeName = $rowRA['EmployeeName'];                                                                        
                echo "<tr>";
                echo "<td style='text-align:center;'>$i</td>";
                echo "<td style='width:100px;'>$EmployeeId</td>";
                echo "<td>$EmployeeName</td>";
                $PCount = 0;$ACount = 0;$HLFCount = 0;$WOCount=0;$HLDCount=0;
                for ($kk=1; $kk<= $maxday; $kk++) {  
                    $kkv = sprintf('%02d', $kk);
                    $CurrentOPDate = $kkv."/0".$Month."/".$Year; 

                    $sqlRAD = "SELECT * from employee_attendance where EmployeeId= '$EmployeeId' and Date='$CurrentOPDate' and Status='ACTIVE' ORDER BY EmployeeId ASC";
                    $resultRAD = mysqli_query($conn, $sqlRAD);
                    $rowcountRAD = mysqli_num_rows($resultRAD);
                    if ($rowcountRAD != 0) {
                        
                        while ($rowRAD = mysqli_fetch_array($resultRAD, MYSQLI_ASSOC)) {
                            
                           $Attendance = $rowRAD['Attendance'];                                                                                   

                            $colorcode="";
                            if($Attendance == "P" || $Attendance == "p"){
                               $PCount = $PCount + 1;
                               $colorcode = "background-color:#00C0EF; color:#FFF;"; 
                            }                                                                                    
                            elseif ($Attendance == "WO" || $Attendance == "wo" || $Attendance == "Wo") {
                                 $WOCount = $WOCount + 1;
                                $colorcode = "background-color:#2980B9; color:#FFF;";
                            }
                            elseif ($Attendance =="HLD" || $Attendance =="hld" || $Attendance == 'Hld') {
                                $HLDCount = $HLDCount + 1;
                                $colorcode = "background-color:#FFD455;color:#000;";
                            }
                            elseif ($Attendance == "HLF" || $Attendance == "hlf" || $Attendance == "Hlf") {
                                $HLFCount = $HLFCount + 1;
                                $colorcode = "background-color:#931336; color:#FFF;";
                            } 
                            elseif ($Attendance == "A" || $Attendance == "a") {
                                $ACount = $ACount + 1;
                                $colorcode = "background-color:#F00; color:#FFF;";
                            } 
                            else {
                                   
                            }
                            echo "<td style='text-align:center;font-weight:bold;$colorcode' title=''>$Attendance</td>";
                        }
                    }
                    else{
                        $ACount = $ACount + 1;
                        $colorcode = "background-color:#F00; color:#FFF;";
                        echo "<td style='text-align:center;font-weight:bold;$colorcode'>0</td>";
                    }
                }
                ?>                                                              
                <td style="text-align: center;font-weight: bold;color:#F00;"><?php echo $PCount; ?></td>
                <td style="text-align: center;font-weight: bold;color:#F00;"><?php echo $HLFCount; ?></td>
                <td style="text-align: center;font-weight: bold;color:#F00;"><?php echo $ACount; ?></td>
                <td style="text-align: center;font-weight: bold;color:#F00;"><?php echo $WOCount; ?></td>
                <td style="text-align: center;font-weight: bold;color:#F00;"><?php echo $PCount*20; ?></td> 
                <!--<td style="text-align: center;font-weight: bold;color:#F00;"><?php //echo $HLDCount; ?></td> -->                                           
                <?php
                echo "</tr>";                                                                       
                $i = $i + 1;
            }        
            ?>
        </table>
                  </div>
                </div>
                <!-- Basic with Icons -->
                        

                        
                        
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- / Content -->
          </div>
            <!-- Footer -->
           <?php require './footer.php'; ?>
