<?php 
    session_start();
    if(!$_SESSION['id']){
        header('location:index.php');
    }
    require_once '../system/conn.php';
?>
<!doctype html>
<html lang="en" class="semi-dark">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="assets/css/pace.min.css" rel="stylesheet" />
	<script src="assets/js/pace.min.js"></script>
    <link href="assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
    <link href="assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
    <link href="assets/plugins/datatable/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/bootstrap-extended.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/icons.css" rel="stylesheet">
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
    <link href="assets/css/dark-theme.css" rel="stylesheet" />
    <link href="assets/css/semi-dark.css" rel="stylesheet" />
    <link href="assets/css/header-colors.css" rel="stylesheet" />
    <title>UTCPL</title>
  </head>
  <body>
    <div class="wrapper">
    <?php include'system/header.php'?>
	    <div class="page-content-wrapper">
         <div class="page-content">
          <!--start breadcrumb-->
          <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
            <div class="breadcrumb-title pe-3">HERE YOU CAN SEND CURRENT MONTH SALARY SLIP DETAILS VIA SMS TO ALL THE EMPLYOEES OF THIS SITE ONLY.</div>
            <div class="ms-auto">
            </div>
          </div>
			<hr/>
             <?php
            $date=date('Y-m', strtotime(date('Y-m')." -1 month"));
            $date=explode('-',$date);
            $month=$date[1];
            $monthNum  = $month;
            $dateObj   = DateTime::createFromFormat('!m', $monthNum);
            $monthName = $dateObj->format('F');
            $year=$date[0];
            $emp=$conn->query("SELECT * FROM `emp_details` WHERE (`mobile_num`='NA' OR `mobile_num`='') ");
            $emp_count=$emp->num_rows;
            
            $select_gross=$conn->query("SELECT * FROM `emp_salary` WHERE `month`='$month' AND `year`='$year' ");
            $count_gross=$select_gross->num_rows;
            
            $select_ot=$conn->query("SELECT * FROM `ot_details` WHERE `month`='$month' AND `year`='$year' ");
            $count_ot=$select_ot->num_rows;
            
            ?>
            <div class="row">
              <div class="col-xl-12 mx-auto">
                <div class="card">
                  <div class="card-body">
                    <div class="p-4 border rounded">
                      <div>
                                           
                        <div class="row mb-3">
                            <div class="col l12 s12">
                                <h6>Please click on "SEND" button only after verifying the salary Data.</h6>
                                <P>This site has <SPAN style="color:red;">"<?php echo $emp_count; ?>"</SPAN> emplyoees whose mobile number has not been saved in the system yet. Please Update those.</P>
                            </div>
                        </div> 
                        <div class="row mb-3">
                            <div class="col l12 s12">
                                <h6>ELIGIBLE EMPLYOEES FOR SALARY: <?php  echo $count_gross; ?></h6>
                            </div>
                            <div class="col l12 s12">
                                <h6>TOTAL EMPLYOEES WITH OT SALARY : <?php  echo $count_ot; ?></h6>
                            </div>
                        </div> 
                        <div class="col-12">
                            <a href="sms-send.php">  <button class="btn btn-primary"><i class="fa fa-check-square-o"></i>SEND SALARY SMS</button></a>
                            <a href="sms-ot-process.php">  <button class="btn btn-primary"><i class="fa fa-check-square-o"></i>SEND OT SMS</button></a>
                        </div>
                       </div>    
                    </div>
                  </div>
                </div>
                
              </div>
            </div>
            <!--end row-->
        
          </div>
          <!-- end page content-->
         </div>
         
         

<?php include'system/footer.php'?>