
<div class="report-pdf"  >
 <?php 
  echo $today; 
   $design = ''; 
   $design .= '	


<div id="view-part">

    <div class="row-fluid">
        
            <strong>Daily Report (Shift: '.$shipt_name.' , Medium: '.$medium_name.' ) For '.$today.'</strong>
       	<div class="hr hr-double hr-dotted hr18"></div>
    
    </div> ';
	
	$design .= ' 
	<table class="" style="width:100%;border: 1px solid #000000;">
		<thead style="border: 1px solid #000000; ">
			<th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Class </b></th>
            <th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Department </b></th>
            <th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Student Type </b></th>
            <th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Section </b></th>
           <th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Total Stuednt </b></th>
			<th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Preseant</b></th>
			<th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Absent</b></th>
			<th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Late</b></th>
			<th style="border: 1px solid #000000;font-size:11px;text-align:center; "><b>Leave</b></th>
		</thead>
		<tbody>' ;
		
	$table_name=" _atd_daily_status_class";
	$column="*";
	$where_cond='_atd_status = 1 && DATE(_entry_date) = "'.$today.'" ';
	$all_section_id=$obj->View_all_data_row_column_By_Cond($table_name,$column,$where_cond);
	
	$j = 1;
	$total_student = 0;
	$for_total_absent = 0;
	$for_total_late = 0;
	$for_total_leave = 0;

if(!empty($all_section_id)){
		foreach($all_section_id as $value ){
			
		
		$section_id = $value['_section_id'];
		$status_comments = $value['_comments'];
		$_atd_time = $value['_atd_time'];
		$approved_status = $value['_approve_satus'];
		$atd_status_id = $value['_id'];
			 				 
		$table_name="_int_institute_setup_vw iv LEFT JOIN _atd_daily_status_class hs ON hs._section_id = iv.section_id";
		$column="iv.section,iv.section,iv.student_type,iv.class,iv.department";
		$where_cond='_atd_status = 1 && iv.section_id = '.$section_id.' && DATE(_entry_date) = "'.$today.'" order by TIME(_entry_date) ASC limit 1 ';
		 
		$list = $obj->View_all_data_row_column_By_Cond($table_name,$column,$where_cond);
		
		
		
		$class_name = $list[0]['class'] ;
		$department_name = $list[0]['department'] ;
		$student_type = $list[0]['student_type'] ;
		$section_name = $list[0]['section'] ;
		
		
		$table_name1 = '_pf_std_basic_info';
		$where_cond1 = '_section_id='.$section_id;
		
		$total_row = $obj->View_All_By_Cond($table_name1,$where_cond1 ); 



			
			$i=0;
			$p = 0 ;
			$ab= 0;
			$la = 0;
			$le= 0;
			
			$where_cond = 'sc._id='.$section_id.' AND pf_std._status!="D" &&  DATE(hmc._entry_date) ="'.$today.'"  ORDER BY hmc._atd_status  ASC';
	
			foreach($obj->View_Student_List_atttd_with_comment($where_cond) as $value){
			
				extract($value);
				
				 $_late_time = $value['_late_time'] ;
				 
				 
				if($_atd_status=='P'){
					$atd_status = 'Present';
					
				}
				elseif( $_atd_status=='A')
				{
					$atd_status = 'Absent';
					$ab = $ab +1 ;
					
					
				}elseif($_atd_status=='LA'){
					$atd_status = 'Late';
					$la = $la +1 ;
					
				
				}elseif($_atd_status=='LE'){
					$atd_status = 'Leave';
					$le = $le +1 ;
					
				}
				
				 
				
				$i++;
			
			
			}
			$selected_student = $i;
			$total_row = $obj->View_Student_List_rows("sc._id='$section_id' AND pf_std._status!='D'");
			
			$present = $total_row-($ab+$la +$le) ;
			$prsent_persentage = round(($present * 100)/$total_row, 1);
			
			
			$sing_ab_persentage = round(($ab * 100)/$total_row, 1);
			$sing_la_persentage = round(($la * 100)/$total_row, 1);
			$single_le_persentage = round(($le * 100)/$total_row, 1);
			
			
			/// count at every loop, this is for counting total info of all
			$for_total_absent = $for_total_absent + $ab  ;
			$for_total_late = $for_total_late + $la  ;
			$for_total_leave = $for_total_leave + $le  ;
			$total_student = $total_student + $total_row ;
			
			
				
                
          $design .= ' <tr>
                      	 <td style="border: 1px solid #000000;font-size:11px;">'. $class_name.'  </td>
                         <td style="border: 1px solid #000000;font-size:11px;">'. $department_name.'</td>
                         <td style="border: 1px solid #000000;font-size:11px;">'. $student_type.'</td>
                         <td style="border: 1px solid #000000;font-size:11px;">'. $section_name.' </td>
                          <td style="border: 1px solid #000000;font-size:11px;">'. $total_row." " .' </td>
                          <td style="border: 1px solid #000000;font-size:11px;"> '.($total_row-($ab+$la +$le))." ( ".$prsent_persentage."%) ".' </td>
                         <td style="border: 1px solid #000000;font-size:11px;">'. $ab." ( ".$sing_ab_persentage."%), ".'</td>
                    
                         <td style="border: 1px solid #000000;font-size:11px;">'.$la." ( ".$sing_la_persentage."%) ".' </td>
                         <td style="border: 1px solid #000000;font-size:11px;">'. $le." ( ".$single_le_persentage."%) " .' </td> 
                	</tr> 
					
					
		
 ' ;


		 } 
		 
	$design .= '	</tbody> </table>	</div>  ';
	} 
  
  


 
if(!empty($all_section_id)){



$design .= '	<div class="row-fluid">	
					
	
	<table class="table table-striped table-bordered table-hover table-final-view">
		<thead>
			<th>Total Student </th>
			<th>Preseant</th>
			<th>Absent</th>
			<th>Late</th>
			<th style="text-align: center;">Leave</th>
		</thead>
		<tbody> .' ;
			
			
			
			
			$total_present = $total_student-($for_total_absent+$for_total_late +$for_total_leave) ;
			$prsent_persentage = round(($total_present * 100)/$total_student, 1);
			$absent_persentage = round(($for_total_absent * 100)/$total_student, 1);
			$late_persentage = round(($for_total_late * 100)/$total_student, 1);
			$leave_persentage = round(($for_total_leave * 100)/$total_student, 1);
				
		$design .= '		<tr>
				
				<td class="td_pad">'.$total_student.' </td>
				<td class="td_pad">'. $total_present." ( ".$prsent_persentage.'%)'.' </td>
				<td class="td_pad">'.$for_total_absent." ( ".$absent_persentage.'%)'.' </td>
			
				<td class="td_pad" style="text-align: center;"> '.$for_total_late." ( ".$late_persentage.'%)'.' </td>
				<td class="td_pad" style="text-align: center;">	'. $for_total_leave." ( ".$leave_persentage.'%)' .' </td>
				
				
			</tr>
            
		</tbody>	

	</table>
</div> ';



 }


	 


$design .= '</div>


</div>  ';

echo $design;