<?php 
$page_id = null;
$comp_model = new SharedController;
$current_page = $this->set_current_page_link();
?>
<div>
    <div  class="bg-light p-3 mb-3">
        <div class="container">
            <div class="row ">
                <div class="col-md-12 comp-grid">
                    <h4 >The Dashboard ( <?php echo date("d-M-Y"); ?> )</h4>
                </div>
            </div>
        </div>
    </div>
    <div  class="">
        <div class="container">
            <div class="row ">
                <div class="col comp-grid">
                    <div class=""><div>
                        <?php if(USER_ROLE==2){ ?>
                        <?php  $jeController = new Salary_sheetController;
                        $db = $jeController->GetModel(); 
                        $db->where("userid",USER_ID);
                        $db->where("for_date",date("Y-m-d"));
                        $db->orderby("id","DESC");
                        $lastentry=$db->getValue("absent_in_out","CONCAT(attendance_type,in_out)");
                        ?>
                        <?php if($lastentry=="" || is_null($lastentry)){ ?>
                        <a href="<?PHP echo SITE_ADDR ?>absent_in_out/add?attendance_type=ATTENDANCE&in_out=IN"><button class="btn btn-success">PRESENT IN</button></a>
                        <?php } ?>
                        <?php if($lastentry=="ATTENDANCEIN"){ ?>
                        <a href="<?PHP echo SITE_ADDR ?>absent_in_out/add?attendance_type=LUNCH&in_out=IN"><button class="btn btn-primary">LUNCH IN</button></a>
                        <?php } ?>
                        <?php if($lastentry=="LUNCHIN"){ ?>
                        <a href="<?PHP echo SITE_ADDR ?>absent_in_out/add?attendance_type=LUNCH&in_out=OUT"><button class="btn btn-info">LUNCH OUT</button></a>
                        <?php } ?>
                        <?php if($lastentry=="LUNCHOUT"){ ?>
                        <a href="<?PHP echo SITE_ADDR ?>absent_in_out/add?attendance_type=ATTENDANCE&in_out=OUT"><button class="btn btn-danger">PRESENT OUT</button></a>
                        <?php } ?>
                        <?php if($lastentry=="ATTENDANCEOUT"){ ?>
                        <h3>Bye, Your Attendance profile for today is completed.</h3>
                        <?php } ?>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div  class="">
    <div class="container">
        <div class="row ">
            <div class="col-md-12 comp-grid">
                <div class=""><div></div>
                <?PHP if(USER_ROLE==20){ ?></div>
                <?php $rec_count = $comp_model->getcount_totalemployeesinorganization();  ?>
                <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("employee_details/empdetails") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Employees in Organization </div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $rec_count; ?></strong></h4>
                    </div>
                </a>
                <?php $rec_count = $comp_model->getcount_totalemployeespresenttoday();  ?>
                <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("absent_in_out/presenttoday") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Employees Present Today</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $rec_count; ?></strong></h4>
                    </div>
                </a>
                <div class="">  <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("absent_in_out/absenttoday") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Employees Absent Today</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $comp_model->getcount_totalemployeesinorganization()-$rec_count; ?></strong></h4>
                    </div>
                </a></div>
                <?php $rec_count = $comp_model->getcount_totalemployeespresentyesterday();  ?>
                <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("absent_in_out/") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Employees Present Yesterday</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $rec_count; ?></strong></h4>
                    </div>
                </a>
                <div class="">  <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("absent_in_out/absenttoday") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Employees Absent Yesterday</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $comp_model->getcount_totalemployeesinorganization()-$rec_count; ?></strong></h4>
                    </div>
                </a></div>
                <?php $rec_count = $comp_model->getcount_totalsalarypaidincurrentmonth();  ?>
                <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("salary_data/monthsalary") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Salary Paid In Current Month</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $rec_count; ?></strong></h4>
                    </div>
                </a>
                <?php $rec_count = $comp_model->getcount_totalsalarypaidinlastmonth();  ?>
                <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("salary_data/monthsalary") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Salary Paid In Last Month</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $rec_count; ?></strong></h4>
                    </div>
                </a>
                <?php $rec_count = $comp_model->getcount_totalsalarypaidincurrentyear();  ?>
                <a class="animated zoomIn record-count card bg-light text-dark"  href="<?php print_link("salary_data/yearsalary") ?>">
                    <div class="row">
                        <div class="col-2">
                            <i class="fa fa-globe"></i>
                        </div>
                        <div class="col-10">
                            <div class="flex-column justify-content align-center">
                                <div class="title">Total Salary Paid In Current Year</div>
                                <small class=""></small>
                            </div>
                        </div>
                        <h4 class="value"><strong><?php echo $rec_count; ?></strong></h4>
                    </div>
                </a>
                <div class=""><div></div>
                <?PHP } ?></div>
            </div>
        </div>
    </div>
</div>
</div>
