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 : 18.226.187.224


Current Path : /var/www/html/gug/Report_details/
Upload File :
Current File : /var/www/html/gug/Report_details/report_daliy_report.php

<?php
function generateDaliyReport($aobj_context)
{	
	include_once($aobj_context->main_src."/src/format.php");
	session_start();
	$college_code = $_SESSION['collcode']; 
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    
	//echo $college_code; 
	$degree_code_start = $aobj_context->mobj_data["degree_code_start"]; 
	$degree_code_end = $aobj_context->mobj_data["degree_code_end"]; 
	
	$date_start = substr("0000000000".db_date_Format($aobj_context->mobj_data["Date_start"]),-10); 
	$date_end   = substr("ZZZZZZZZZZ".db_date_Format($aobj_context->mobj_data["Date_end"]),-10);
	 
	$session     = $aobj_context->mobj_data["session"]; 
	
	$exam_start = substr("0".$aobj_context->mobj_data["exam_start"],-1);  
	$exam_end   = substr("Z".$aobj_context->mobj_data["exam_end"],-1);   
	
	$sub_start   = substr("00000".$aobj_context->mobj_data["sub_start"],-5); 
	$sub_end     = substr("ZZZZZ".$aobj_context->mobj_data["sub_end"],-5); 
	
	 
	
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	$pdf_writer_class=$aobj_context->main_src."/maya-pdf/fpdf.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_daliy_rpt.pdf";

	include($pdf_writer_class);		
	$pdf= new FPDF(); //Landscape
	
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(20,12);		
	$pdf->AliasNbPages();
	
	$page_header_university = "select FUNIVNAME,FTOWN, date_format(now(),'%d/%m/%Y') as date from control";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);
	
	$page_header_college ="select concat('[',FCOLLCODE,']  ',FCOLLNAME,', ',FTOWN) as college_name
							from college where FCOLLCODE='{$college_code}'";
	$lobj_page_header_college = $aobj_context->mobj_db->GetRow($page_header_college); 

	$page_header_degree = "select concat('[',FDEGREE,'] - ', FDESCPN,space(2),'-',space(2),FEXAMDATE) as Degree_name, FADYEAR  
							from degree where FDEGREE = '{$degree_code_start}' ";
	$lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);	
	$pdf->aobj_context =$aobj_context ;
	$pdf->WhichReport = 'ReportDaliy';
	$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
	$pdf->FTOWN = $lobj_page_header_university[FTOWN];
	$pdf->date_1 = $lobj_page_header_university['date'];
	$pdf->college_name = $lobj_page_header_college['college_name'];
	$pdf->Degree_name = $lobj_page_header_degree['Degree_name'];	
	$pdf->RFROM= $aobj_context->mobj_data["Date_start"];
	$pdf->RTO= $date_end;	
	$pdf->EXM_START= $exam_start;	
	$pdf->EXM_END= $aobj_context->mobj_data["Date_end"];
	
	$get_fcsubcode_from_both_table = "select sub.FDEGREE, sub.FEXAMNO,sub.FCSUBCODE,
	concat('[ ',sub.FCSUBCODE,' ]', space(2), sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp
										from colldesp cd inner join subject sub on 
										cd.FDEGREE = sub.FDEGREE and cd.FCSUBCODE=sub.FCSUBCODE and cd.FEXAMNO = sub.FEXAMNO 
										where cd.FCOLLCODE='{$college_code}' and 
										cd.FDEGREE>='{$degree_code_start}' and cd.FDEGREE<='{$degree_code_end}' 
										and cd.FDOE>='{$date_start}' and cd.FDOE<='{$date_end}' 
										and cd.FSESSION='{$session}' and 
										cd.FEXAMNO>='{$exam_start}' and cd.FEXAMNO<='{$exam_end}' 
										and sub.FCSUBCODE>='{$sub_start}' and sub.FCSUBCODE<='{$sub_end}' and cd.FDELETED='F' 
										union
										select a.FDEGREE, a.FEXAMNO, a.FCSUBCODE,
										concat('[ ',sub.FCSUBCODE,' ]', space(2), sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp
										from absent a inner join subject sub on
							a.FDEGREE = sub.FDEGREE and 
							a.FCSUBCODE=sub.FCSUBCODE and
							a.FEXAMNO = sub.FEXAMNO where 
										a.FDEGREE>='{$degree_code_start}' and a.FDEGREE<='{$degree_code_end}' and 
										a.FEXAMNO>='{$exam_start}' and a.FEXAMNO<='{$exam_end}' and 
										a.FCSUBCODE>='{$sub_start}' and a.FCSUBCODE<='{$sub_end}' 
										and a.FDELETED='F' group by a.FABSTYPE,a.FCSUBCODE";	
		$lobj_get_fcsubcode_from_both_table = $aobj_context->mobj_db->GetAll($get_fcsubcode_from_both_table);
	$pdf->Subject_name=$lobj_get_fcsubcode_from_both_table[0][FCSUBCODE];

	 $get_daliy_data = "  select cd.FDEGREE, cd.FEXAMNO,cd.FCSUBCODE,
							concat('[ ',sub.FCSUBCODE,' ]', space(2), sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp,
							FNOBUNDLE,FTOTSCRIPT 
							from colldesp cd inner join subject sub on
							cd.FDEGREE = sub.FDEGREE and 
							cd.FCSUBCODE=sub.FCSUBCODE and
							cd.FEXAMNO = sub.FEXAMNO
							where  
							cd.FCOLLCODE='{$college_code}' and
							cd.FDEGREE>='{$degree_code_start}' and cd.FDEGREE<='{$degree_code_end}' and 
							cd.FDOE>='{$date_start}' and cd.FDOE<='{$date_end}'  and
							cd.FSESSION='{$session}' and
							cd.FEXAMNO>='{$exam_start}' and cd.FEXAMNO<='{$exam_end}' and
							cd.FCSUBCODE>='{$sub_start}' and cd.FCSUBCODE<='{$sub_end}' and
							cd.FDELETED='F' "; 
	 					
   $lobj_get_daliy_data = $aobj_context->mobj_db->GetAll($get_daliy_data);
   var_dump($get_daliy_data);die();
   // FSESSION='{$session}' and
   //FDOE>='{$date_start}' and FDOE<='{$date_end}'  and
	$get_daliy_absent_data= " select a.FABSTYPE as type,concat('[ ',sub.FCSUBCODE,' ]', space(2), sub.FSUBNAME, space(2), '( ',sub.FSSUBNAME,' )') as subject_desp,
								a.FCSUBCODE,GROUP_CONCAT(a.FREGNO SEPARATOR '  ') as RegNo 
								from absent a 
								inner join subject sub on
								a.FDEGREE = sub.FDEGREE and 
								a.FCSUBCODE=sub.FCSUBCODE and
								a.FEXAMNO = sub.FEXAMNO
								where 
								a.FDEGREE>='{$degree_code_start}' and a.FDEGREE<='{$degree_code_end}' and 
								a.FEXAMNO>='{$exam_start}' and a.FEXAMNO<='{$exam_end}' and
								a.FCSUBCODE>='{$sub_start}' and a.FCSUBCODE<='{$sub_end}' and 
								a.FDELETED='F' and  a.FCOLLCODE='{$college_code}'
								group by a.FABSTYPE,a.FCSUBCODE" ;	
   $lobj_get_daliy_absent_data = $aobj_context->mobj_db->GetAll($get_daliy_absent_data);
  // echo $get_daliy_absent_data; die();  
   /*  echo "<pre>";
   var_dump($lobj_get_daliy_absent_data ); die();  */
 
	$pdf->Subject_name = $lobj_get_daliy_data[0]['subject_desp'];   
	$pdf->Subject_name=(empty($pdf->Subject_name))?$lobj_get_daliy_absent_data[0]['subject_desp']:$pdf->Subject_name; 
	$pdf->AddPage();		
	$pdf->SetFont('Times','',9);	
	
  $check_same_deg_code = $lobj_get_fcsubcode_from_both_table[0]['FDEGREE'];  
  $check_same_sub_code = $lobj_get_fcsubcode_from_both_table[0]['FCSUBCODE'];
	
	$arr_w = array(70,80,90,40,120,23);
	$arr_h = array(5,8);
	$pdf->Ln(10);
	$flag_same_sub =0;
	foreach($lobj_get_fcsubcode_from_both_table as $key => $value)
	{
		$bundle_flag=1;
		$flag_ab =1;
		$flag_mp =1;
		if($value['FCSUBCODE']== $check_same_sub_code)	// total script
		 {
			
			$flag_same_sub=1;
		 }
		 else
		 {
			$check_same_deg_code = $value['FDEGREE'];
			$check_same_sub_code = $value['FCSUBCODE'];
			$pdf->Subject_name = $value['subject_desp'];
			$pdf->AddPage();
			$flag_same_sub=1;
			$pdf->Ln(10);
		 }
		if($flag_same_sub)	 
		{
			
			foreach($lobj_get_daliy_data as $key => $value)    // absent
			{
				// var_dump('arun');
				if($check_same_sub_code == $value['FCSUBCODE'])
				{
				$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
				$pdf->Cell($arr_w[1],$arr_h[1],'Total Number of Bundles','LT',0,'L');
				$pdf->Cell($arr_w[3],$arr_h[1],$value['FNOBUNDLE'],'1',1,'C');	
				$pdf->Cell($arr_w[5],$arr_h[1],'','R',0,'L');
				$pdf->Cell($arr_w[1],$arr_h[1],'Total Number of Scripts','LB',0,'L');		
				$pdf->Cell($arr_w[3],$arr_h[1],$value['FTOTSCRIPT'],'1',1,'C');	
				$bundle_flag=0;
				}
			}
			   if($bundle_flag)
				{
				$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
				$pdf->Cell($arr_w[1],$arr_h[1],'Total Number of Bundles','LT',0,'L');
				$pdf->Cell($arr_w[3],$arr_h[1],'0','1',1,'C');	
				$pdf->Cell($arr_w[5],$arr_h[1],'','R',0,'L');
				$pdf->Cell($arr_w[1],$arr_h[1],'Total Number of Scripts','LB',0,'L');		
				$pdf->Cell($arr_w[3],$arr_h[1],'0','1',1,'C');					
				} 
			
							//$pdf->Ln(20);
			foreach($lobj_get_daliy_absent_data as $key => $value)    // absent
			{
				$temp_reg = '';
				$pdf->Subject_name=(empty($pdf->Subject_name))?$value['subject_desp']:$pdf->Subject_name; 
				if($check_same_sub_code == $value['FCSUBCODE'])
				{
					$count_reg = explode("  ",$value['RegNo']);					
					
	//  ab					
				if($value['type'] == 'A')
					{
						$pdf->Ln(15);
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'Total Absents:   '.count($count_reg),'1',1,'L');
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						 $pdf->MultiCell($arr_w[4],$arr_h[1],$value['RegNo'],1,"L");
						//$pdf->Cell($arr_w[4],$arr_h[1],$value['RegNo'],'1',1,'L');
						//echo $value['RegNo']."<br>";
						$flag_ab =0;						
					}
					/* else  if($value['type'] != 'M' && !$flag_ab)
					{
						$pdf->Ln(15);
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'Total Absents:   '.'0','1',1,'L');
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'','1',1,'L');	
						$flag_ab =0;
					} */
		//  mp			
					if($value['type'] == 'M')
					{
						$pdf->Ln(15);
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'Total Malpractice / Unfair Means:  '.count($count_reg),'1',1,'L');						
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],$value['RegNo'],'1',1,'L');
						$flag_mp =0;
					}
					/* else if($value['type'] == 'A' && !$flag_mp)
					{
						$pdf->Ln(15);
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'Total Malpractice / Unfair Means:  '.'0','1',1,'L');						
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'','1',1,'L');
						$flag_mp=0;
					} */
				}
            } $flag_same_sub=0;	
				if($flag_ab) {
						$pdf->Ln(15);
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'Total Absents:   '.'0','1',1,'L');
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'','1',1,'L');	
						$flag_ab =0;
					}
				if($flag_mp)
					{
						$pdf->Ln(15);
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'Total Malpractice / Unfair Means:  '.'0','1',1,'L');						
						$pdf->Cell($arr_w[5],$arr_h[1],'','0',0,'L');
						$pdf->Cell($arr_w[4],$arr_h[1],'','1',1,'L');
						$flag_mp=0;
					} 				
		}			
		/* else //if($value['FCSUBCODE'] != $check_same_sub_code)	
		 {
			$check_same_deg_code = $value['FDEGREE'];
			$check_same_sub_code = $value['FCSUBCODE'];
			$pdf->AddPage();
			$pdf->Cell($arr_w[3],$arr_h[1],'','0',0,'L');
			$pdf->Cell($arr_w[1],$arr_h[1],'Total Number of Bundles','LT',0,'L');
			$pdf->Cell($arr_w[3],$arr_h[1],$value['FNOBUNDLE'],'1',1,'C');	
			$pdf->Cell($arr_w[3],$arr_h[1],'','R',0,'L');
			$pdf->Cell($arr_w[1],$arr_h[1],'Total Number of Scripts','LB',0,'L');		
			$pdf->Cell($arr_w[3],$arr_h[1],$value['FTOTSCRIPT'],'1',1,'C');			
		 }  */
	}	
 
	$pdf->Output("report_daliy_rpt.pdf","D");
}
?>