0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.141.41.109


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/AttDateWiseReportexcel.php

<?php

function AttDateWiseReportexcel($aobj_context)
{
	session_start();
	
	$type = trim($aobj_context->mobj_data["type"]);
	if($type == 'app'){
		$collcode = trim($aobj_context->mobj_data["collcode"]);
		$univcode = trim($aobj_context->mobj_data["univcode"]);
	}else{
		$collcode=$_SESSION['collcode'];
	}

	ini_set('memory_limit','300M');
	ini_set('max_execution_time',3300);
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$filename = 'Day_Wise';
	$f = fopen('php://output', 'w'); 

	$classId = trim($aobj_context->mobj_data["classid"]);
	$datefrom = trim($aobj_context->mobj_data["datefrom"]);
	$dateto = trim($aobj_context->mobj_data["dateto"]);

    
    $query = "select distinct date_format(d.fdate,'%d/%m/%Y') as fdate, a.fclassname ,a.FCLASSID
              from attend_det d 
              inner join attclass a on a.fclassid = d.fclassid
              where d.fclassid='{$classId}' 
              and d.fdate between date_format(str_to_date('{$datefrom}','%Y-%m-%d'),'%Y-%m-%d')
              and date_format(str_to_date('{$dateto}','%Y-%m-%d'),'%Y-%m-%d')";

	$res1 = $aobj_context->mobj_db->GetRow($query);
  
	// var_dump($query);die();	

    $collquery = "select ifnull(FCOLLCODE,'') as fcollcode,ifnull(FCOLLNAME,'') as fcollname,concat(FCOLLCODE, '-' ,FCOLLNAME, ', ' ,FTOWN) as fcoll
	from college
	where fcollcode = '{$collcode}'";
	$rescollquery = $aobj_context->mobj_db->GetRow($collquery);
   
	$unviquery = "select concat(funivname, '-' , ftown) as coll, funivadd1, ifnull(fregroll, 'Reg. No.')as fregroll from control";
	$resuniquery = $aobj_context->mobj_db->GetRow($unviquery);

	if(!empty($res1) )
	{
        
		$e_data.="<table cellspacing='0' cellpadding='1' border='1' width = ''>";
        $e_data.="<thead>";
        $e_data.="<tr style='height: 25px;'>";
        $e_data.="<th colspan='5'>{$resuniquery['coll']}</th>";
		$e_data.="</tr>";
		$e_data.="<tr style='height: 25px;'>";
		$e_data.="<th colspan='6'>{$resuniquery[funivadd1]}</th>";
		$e_data.="</tr>";
		$e_data.="<tr style='height: 25px;'>";
		$e_data.="<th colspan='6'>College : {$rescollquery['fcoll']}</th>";
		$e_data.="</tr>";
		$e_data.="<tr style='height: 25px;'>";
		$e_data.="<th colspan='6'>Date Wise Attendance</th>";
		$e_data.="</tr>";
		$e_data.="<tr style='height: 25px;'>";
		$e_data.="<th colspan='6'>Class Name: {$res1['fclassname']} - {$res1['FCLASSID']}</th>";
        $e_data.="</tr>";
        $e_data.="</thead>";
		$e_data.="<tr style='height: 25px;'>";
		$e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;' >Sl. No.</td>";
		$e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;' >".$resuniquery['fregroll']."</td>";
        $e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;' >Name</td>";
        $e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;' >Date</td>";
		$e_data.="<td style = 'text-align:center;font-weight: bold;row-height:20px;' >Period</td>";
        $e_data.="<td style = 'text-align:center;font-weight: bold;row-height:20px;' >Ab./Pr.</td>";
        $e_data.="</tr>";
        $i = 1;

        $query = "select s.fname, a.*  from attend_det a inner join student s
                 on s.fregno = a.fregno where fdate = date_format(str_to_date('{$res1['fdate']}','%d/%m/%Y'),'%Y-%m-%d')
                and a.fclassid='{$classId}' order by fdate";
				  

            $lobj_get_data = $aobj_context->mobj_db->GetAll($query);
			// var_dump($query);
			// die(); 
        foreach($lobj_get_data as $key => $value)
        {
            $e_data.="<tr style='height: 25px;'>";
            $e_data.="<td style = 'text-align:center;row-height:40px;' >{$i}</td>";
            $e_data.="<td style = 'text-align:center;row-height:40px;' >{$value['FREGNO']}</td>";
            $e_data.="<td style = 'text-align:left;row-height:40px;' >{$value['fname']}</td>";
            $e_data.="<td style = 'text-align:center;row-height:40px;' >{$res1['fdate']}</td>";
			
			$e_data.="<td style = 'text-align:center;row-height:20px;' >{$value['FPERIOD']}</td>";

            $e_data.="<td style = 'text-align:center;row-height:20px;' >{$value['FPRESENT']}</td>";	
            $e_data.="</tr>";	
            
            $i++;
            
        }	
				
		$filename = 'day_wise';

		
	}
	else
	{
		$arr['html'] = '<p> No record found </p>';
	}	
	header("Content-Type:application/xls");
	header("Content-Disposition: attachment; filename={$filename}.xls"); 
	echo $e_data;
}

?>