
<div class="panel panel-default">

    <div class="panel-heading hidden-print">
        <h6 class="panel-title"><i class="fa fa-desktop"></i> Student Attendanc Information</h6> 
        <a onclick="window.print();" style="cursor:pointer;" class="pull-right btn btn-circle btn-xs btn-default hidden-print"><i class="fa fa-print"></i> Print</a> 					
    </div>

    <div class="panel-body">

        <form action="<?php echo site_url('everbright/attendancereport'); ?>" method="post" class="validate hidden-print" role="form">
            <div class="row form-group"> 

                <label class="col-xs-1 col-xs-offset-2 control-label text-right">
                    <h5>From<span class="mandatory">*</span></h5>
                </label>
                <div class="col-xs-2">
                    <input type="text" placeholder="From Date" class="form-control required datepicker" name="from_date" >
                </div>

                <label class="col-xs-1 control-label text-right">
                    <h5>To<span class="mandatory">*</span>
                    </h5>
                </label>
                <div class="col-xs-2">
                    <input type="text" placeholder="To Date" class="form-control required datepicker" name="to_date" >
                </div>

                
            </div>
			<div class="row form-group"> 

                <label class="col-xs-3 control-label text-right"><h5>Class <span class="mandatory">*</span></h5></label>
                <div class="col-xs-7">
                    <select data-placeholder="(:-- Select Class --:)" name="sclass" class="select-search">
                        <option value=""></option>

                        <?php
                        $query_invno = $this->main_model->sclass(); 
                        foreach($query_invno as $row_invno):
                        ?>
                        <option value="<?php echo $row_invno['scid']; ?>" >
                            <?php echo $row_invno['name']; ?>
                        </option>													
                        <?php endforeach; ?>
                    </select> 
                </div>

                
            </div>
			<div class="row form-group"> 

                <label class="col-xs-3 control-label text-right"><h5>Section <span class="mandatory">*</span></h5></label>
                <div class="col-xs-7">
                    <select data-placeholder="(:-- Select Class --:)" name="shift_name" class="select-search">
								<option value=""></option>
								<option selected value="1">A</option>
                                <option value="2">B</option>
								<option value="3">C</option>
								<option value="4">D</option>
                    </select> 
                </div>

                
            </div>
			<div class="row form-group"> 

                <label class="col-xs-3 control-label text-right"><h5>Group Name <span class="mandatory">*</span></h5></label>
                <div class="col-xs-7">
                    <select data-placeholder="(:-- Select Group --:)" name="section_name" class="select-search">
								<option value=""></option>
								 <option selected value="General">General</option>
                                <option value="Science">Science</option>
								<option value="Commerce">Commerce</option>
								<option value="Arts">Arts</option>
                    </select> 
                </div>

                <div class="col-xs-2">
                    <button type="submit" name="search" value="Search" class="pull-left btn btn-circle btn-xs btn-default"><i class="fa fa-search"></i> Search</button>
                </div>
            </div> 
			
            <hr />
        </form> 



        <?php if (isset($from_date) AND isset($to_date)): ?>

            <p class="text-center hidden-print">
                <strong style="font-size: 16px;">
                    <?php echo $this->main_model->company_name(); ?>
                </strong>
            </p>
            <br />            


            <!-- Arrival_NOC -->
            <div class="row">
                <div class="col-xs-12">
                    <table class="page-setup_ table table-bordered">
                        <caption>
                            <p class="text-center" style="font-size: 13px;">
                                <strong>ATTENDANCE REPORT [From: <?php echo date('F d, Y', strtotime($from_date)); ?> - To: <?php echo date('F d, Y', strtotime($to_date)); ?>]</strong>
                            </p>
                        </caption>
                        <thead>
                            <tr>
                                <th>Sl</th>
                                <th>Roll</th>
                                <th>U.ID</th>
								<th>Name</th>
								 <th>Class</th>
								 <th>Section</th>
                                <th>Group</th>
                                <th>Religion</th>
								<th>Gender</th>
                                <th>Present</th>
                                <th>Absent</th>
                               
                            </tr>
                        </thead>
                        <tbody> 
                            <?php
							$i=1;
                            //$this->db->where('date >=', $from_date);
                           // $this->db->where('date <=', $to_date);
							$this->db->where('class_name=', $sclass);
							$this->db->where('shift_name=', $shift_name);
							$this->db->where('section_name=', $section_name);
                            $query = $this->db->get('xpert_student')->result_array();
                            foreach ($query as $row):
                                
                                    ?>                              
                                    <tr>
                                        <td><?php echo $i; ?></td> 

																		
                                        <td><?php echo $row['stID']; ?></td> 
                                        <td><?php echo $row['jbID']; ?></td>
                                        <td><?php echo $row['name']; ?></td>
									
							
							 
                                        <td>
										<?php 
									$query111c = $this->main_model->sclass();
									foreach($query111c as $row123c):
								?>
								<?php if($row['class_name']==$row123c['scid']): ?><?php echo $row123c['name']; ?><?php endif; ?>
                            <?php endforeach; ?>
										</td>
                                        <td><?php if($row['shift_name']==1): ?><?php echo 'A'; ?><?php else: ?><?php echo 'B'; ?><?php endif; ?></td>
                                        <td><?php echo $row['section_name']; ?></td>
                                        <td><?php echo $row['religion']; ?></td>
                                        <td><?php echo $row['gender']; ?></td>
                                        
										
										 <?php 
										 $p=0;
								$stdid=$row['sID'];
						$this->db->where('sID=', $stdid);
						$this->db->where('date >=', $from_date);
                        $this->db->where('date <=', $to_date);
                        $queryv = $this->main_model->studentattendance();
                        foreach($queryv as $rowv):
                        ?>
							<?php $p=$p+$rowv['attendance']; ?>
							   <?php endforeach; ?> 

<?php 
										 $vb=0;
								$stdid=$row['sID'];
						$this->db->where('sID=', $stdid);
						$this->db->where('date >=', $from_date);
                        $this->db->where('date <=', $to_date);
						$result = $this->db->get('studentattendance')->num_rows();
						//$freight = $this->db->count_all('studentattendance');
                       // $queryv = $this->main_model->studentattendance();
                       // foreach($queryv as $rowv):
                        ?>
							<?php// $p=$p+$rowv['attendance']; ?>
							   <?php// endforeach; ?>							   

                                        <td><?php echo $p; ?></td>                                 
                                        <td><?php echo $vbd=$result-$p; ?></td>                                 
                                       
                                    </tr>
									<?php $i=$i+1; ?>
                                <?php endforeach; ?>  
                                                        
                        </tbody>                            
                    </table> 
                </div>
            </div>
            <!-- /Arrival_NOC -->   

            <br />
            <div class="hidden-print text-center">
                <strong><?php echo $this->main_model->company_address();?></strong>
            </div>


        <?php endif; ?>

    </div>

</div>
