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.129.70.138
<?php
function GenerateMarksEntrySubjectWiseReport($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$college_code = $_SESSION['collcode'];
$degree_code = $aobj_context->mobj_data["degree_code"];
$exam_code = $aobj_context->mobj_data["exam_code"];
$sublist_start = substr("0000".$aobj_context->mobj_data["subwise_start"],-5);
$sublist_end = substr("0000".$aobj_context->mobj_data["subwise_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_general_list.pdf";
$getnumword=$aobj_context->main_src."/src/getnumword.php";
include($getnumword);
// global varibales
$p_count =1;
// end global varibales
//echo getnumber_to_word("001"); die();
include($pdf_writer_class);
$pdf= new FPDF();
$pdf->SetFont('Times','',10);
$pdf->SetMargins(18,15);
$pdf->AliasNbPages();
// query for the page header
$page_header_university = "select FUNIVNAME,FTOWN, date_format(now(),'%d/%m/%Y') as date,FSNGLENT 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) as Degree_name,
concat('( ', FEXAMNAME ,' Examination ',FEXAMDATE,')') as Exam ,FADYEAR
from degree where FDEGREE = '{$degree_code}' and FEXAMNO='{$exam_code}' ";
$lobj_page_header_degree = $aobj_context->mobj_db->GetRow($page_header_degree);
$page_header_REGROLL = "select FREGROLL from control";
$lobj_page_header_REGROLL = $aobj_context->mobj_db->GetRow($page_header_REGROLL);
$pdf->aobj_context =$aobj_context ;
$pdf->WhichReport = 'MARKS_SUBJECTWISE';
$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
$pdf->FTOWN = $lobj_page_header_university[FTOWN];
$pdf->FSNGLENT = $lobj_page_header_university[FSNGLENT];
$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->Exam = $lobj_page_header_degree['Exam'];
$pdf->AdmissionYear = $lobj_page_header_degree['FADYEAR'];
$pdf->REGROLL=$lobj_page_header_REGROLL['FREGROLL'];
$pdf->RFROM=strtoupper(substr($sublist_start,-4));
$pdf->RTO=strtoupper(substr($sublist_end,-4));
// echo substr("naveen",1,1); die();
//end header
$get_total_absent= " select m.FSUBCODE,count(distinct m.FREGNO) as total_absent
from marks m inner join student stu on m.FREGNO=stu.FREGNO
inner join subject s on m.FSUBCODE=s.FCSUBCODE
where s.FSSUBCODE=1 and lpad(s.FCSUBCODE,5,'0')>='{$sublist_start}' and lpad(s.FCSUBCODE,5,'0')<='{$sublist_end}'
and m.FDEGREE='{$degree_code}'
and m.FEXAMNO='{$exam_code}'
and m.FCOLLCODE='{$college_code}' and s.FEXAMNO=m.FEXAMNO and m.FDEGREE=s.FDEGREE
and IFNULL(m.FDELETED,'F') <> 'T'
and m.FMARKS = -2 and ifnull(s.fintass,'F') = 'T'
group by FCSUBCODE order by FCSUBCODE,m.FREGNO";
//var_dump($lobj_get_total_absent); die();
//echo $get_total_absent; die();
for($m=0;$m<count($lobj_get_total_absent);$m++)
{
$sub_wise_total_absent[$lobj_get_total_absent[$m]['FSUBCODE']]=$lobj_get_total_absent[$m]['total_absent'];
}
// s.FSSUBCODE=1 and
$get_subject_data= " select m.FREGNO, SUBSTRING(stu.FNAME,1,36) as Name1,
SUBSTRING(stu.FNAME,37) as Name2,
concat(s.FSUBNAME,',[',FSSUBNAME,']') as sub_name,
if(ifnull(m.FMARKS,-1)>=0,right(concat('000',ifnull(m.FMARKS,-1)),3),
if(ifnull(m.FMARKS,-1)=-2,'ABSENT','')) as Marks,
if(ifnull(m.FMARKS2,-1)>=0,right(concat('000',ifnull(m.FMARKS2,-1)),3),
if(ifnull(m.FMARKS2,-1)=-2,'ABSENT','')) as Marks2,
m.FSUBCODE, s.FSMAXMARKS
from marks m inner join student stu on m.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
inner join subject s on m.FSUBCODE=s.FCSUBCODE
where lpad(s.FCSUBCODE,5,'0')>='{$sublist_start}'
and lpad(s.FCSUBCODE,5,'0')<='{$sublist_end}'
and m.FDEGREE='{$degree_code}'
and m.FEXAMNO='{$exam_code}'
and ((m.FMARKS<>'' and m.FMARKS is not null and m.FMARKS>-3) or m.FMARKS=0 )
and m.FCOLLCODE='{$college_code}' and s.FEXAMNO=m.FEXAMNO and m.FDEGREE=s.FDEGREE
and IFNULL(m.FDELETED,'F') ='F'
and m.FMARKS<>-1 and ifnull(s.fintass,'F') = 'T'
group by FCSUBCODE,m.FREGNO order by FCSUBCODE,m.FREGNO;
";
$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);
$pdf->Subject_name=$lobj_get_subject_data[0]['FSUBCODE'].' '.$lobj_get_subject_data[0]['sub_name'].', Max: '.$lobj_get_subject_data[0]['FSMAXMARKS'];
// ECHO "<PRE>";
//print_r($lobj_get_subject_data); die();
$page_header_FEEZEDorNOT = "select if(ifnull(ffreezed,'')='F','FREEZED (READY TO SEND TO UNIVERSITY)','FREEZING PENDING (TO BE SENT TO UNIVERSITY AFTER FREEZING)') SUB_FREEZ_ADMIN
from collia where fcollcode='{$college_code}'
and fdegree='{$degree_code}' and fexamno = '{$exam_code}'
and fsubcode = '{$lobj_get_subject_data[0]['FSUBCODE']}'";
$lobj_page_header_FEEZEDorNOT = $aobj_context->mobj_db->GetRow($page_header_FEEZEDorNOT);
$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['MESTATUS'].' '.$lobj_page_header_FEEZEDorNOT['SUB_FREEZ_ADMIN'];
$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['SUB_FREEZ_ADMIN'];
$pdf->AddPage();
$pdf->SetFont('Times','',10);
$pdf->SetFont('Arial','',8);
$Count_subject=1;
$DUP_FCSUBCODE='';
$pdf->page_absent_count=0;
$pdf->total_absent_count=0;
$count=0;
$DUP_FCSUBCODE=$lobj_get_subject_data[0]['FSUBCODE'];
$row_cnt=0;
foreach($lobj_get_subject_data as $key => $value)
{
if($DUP_FCSUBCODE==$value['FSUBCODE'])
{
if(!empty($value['Name2']))
{
$pdf->Cell(10,4,$Count_subject++,'LR',0,'C');
$pdf->Cell(20,4,$value['FREGNO'],'R',0,'L');
$pdf->Cell(70,4,$value['Name1'],'R',0,'L');
if($value['Marks']=='ABSENT')
{
$pdf->page_absent_count++;
$pdf->total_absent_count=$sub_wise_total_absent[$value['FSUBCODE']];
$pdf->Cell(20,4,'-','R',0,'C');
$pdf->Cell(40,4,$value['Marks'],'R',1,'L');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,4,$value['Marks'],'R',0,'C');
if($pdf->FSNGLENT == 'F')
$pdf->Cell(20,4,$value['Marks2'],'1',0,'C');
$pdf->Cell(40,4,getNumber(floatval($value['Marks'])),'R',1,'L');
}
$pdf->Cell(10,4,' ','LRB',0,'C');
$pdf->Cell(20,4,' ','LRB',0,'L');
$pdf->Cell(70,4,$value['Name2'],'B',0,'L');
$pdf->Cell(20,4,' ','LRB',0,'L');
$pdf->Cell(20,4,' ','LRB',0,'L');
$pdf->Cell(40,4,' ','LRB',1,'L');
} // for name 2
else
{
$pdf->Cell(10,6,$Count_subject++,'LRB',0,'C');
$pdf->Cell(20,6,$value['FREGNO'],'B',0,'L');
$pdf->Cell(70,6,$value['Name1'],'LRB',0,'L');
if($value['Marks']=='ABSENT')
{
$pdf->page_absent_count++;
$pdf->total_absent_count=$sub_wise_total_absent[$value['FSUBCODE']];
$pdf->Cell(20,6,'-','B',0,'C');
$pdf->Cell(40,6,$value['Marks'],'LRB',1,'L');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,6,$value['Marks'],'B',0,'C');
if($pdf->FSNGLENT == 'F')
$pdf->Cell(20,6,$value['Marks2'],'1',0,'C');
$star=getNumber(floatval($value['Marks']));
if($pdf->FSNGLENT == 'F')
{
if($value['Marks']!=$value['Marks2'] and ($value['Marks'] >-1 and $value['Marks2'] >-1 and !empty($value['Marks2'])))
$star=" ***";
}
$pdf->Cell(40,6,$star,'LRB',1,'L');
}
}
$count++;
$row_cnt++;
if(($row_cnt) > 30)
{
$pdf->SetFont('Times','',10);
$pdf->SetMargins(18,15);
$pdf->AddPage();
$row_cnt=0;
}
}
else if($count > 0)
{
$pdf->Subject_name=$value['FSUBCODE'].' '.$value['sub_name'].', Max: '.$value['FSMAXMARKS'];
// for header -> subject freezed or not
$page_header_FEEZEDorNOT = "select if(ifnull(ffreezed,'')='F','FREEZED (READY TO SEND TO UNIVERSITY)','FREEZING PENDING (TO BE SENT TO UNIVERSITY AFTER FREEZING)') SUB_FREEZ_ADMIN
from collia where fcollcode='{$college_code}'
and fdegree='{$degree_code}' and fexamno = '{$exam_code}'
and fsubcode = '{$value['FSUBCODE']}'";
//var_dump($page_header_FEEZEDorNOT);die();
$lobj_page_header_FEEZEDorNOT = $aobj_context->mobj_db->GetRow($page_header_FEEZEDorNOT);
//echo $page_header_FEEZEDorNOT."<br><br>";
$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['SUB_FREEZ_ADMIN'];
$DUP_FCSUBCODE=$value['FSUBCODE'];
$Count_subject=1;
$row_cnt=0;
$pdf->Ln(6);
$pdf->SetFont('Arial','',8);
$pdf->Cell(50,3,"Date : {$pdf->date_1}",'0',1,'L');
$pdf->Ln(8);
$pdf->Cell(50,3,'Signature of the Teaching Faculty','0',0,'L');
$pdf->Cell(120,3,'Signature of the H.O.D','0',1,'R');
$pdf->Ln(8);
$pdf->Cell(170,3,'Signature of the Principal','0',1,'R');
$pdf->Ln(3);
$pdf->AddPage();
if(!empty($value['Name2']))
{
if(($Count_subject) > 30)
{
$pdf->SetFont('Times','',10);
$pdf->SetMargins(18,15);
$pdf->AddPage();
}
$pdf->Cell(10,4,$Count_subject++,'LR',0,'C');
$pdf->Cell(20,4,$value['FREGNO'],'R',0,'L');
$pdf->Cell(70,4,$value['Name1'],'R',0,'L');
if($value['Marks']=='ABSENT')
{
$pdf->page_absent_count++;
$pdf->total_absent_count=$sub_wise_total_absent[$value['FSUBCODE']];
$pdf->Cell(40,4,$value['Marks'],'R',1,'L');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,4,$value['Marks'],'R',0,'C');
if($pdf->FSNGLENT == 'F')
$pdf->Cell(20,4,$value['Marks2'],'1',0,'C');
$star=getNumber(floatval($value['Marks']));
if($pdf->FSNGLENT == 'F')
{
if($value['Marks']!=$value['Marks2'] and ($value['Marks'] >-1 and $value['Marks2'] >-1 and !empty($value['Marks2'])))
$star=" ***";
}
$pdf->Cell(40,6,$star,'LRB',1,'L');
}
$pdf->Cell(10,4,' ','LRB',0,'C');
$pdf->Cell(20,4,' ','LRB',0,'L');
$pdf->Cell(70,4,$value['Name2'],'B',0,'L');
$pdf->Cell(20,4,' ','LRB',0,'L');
$pdf->Cell(20,4,' ','LRB',0,'L');
$pdf->Cell(40,4,' ','LRB',1,'L');
} // for name 2
else
{
$pdf->Cell(10,6,$Count_subject++,'LRB',0,'C');
$pdf->Cell(20,6,$value['FREGNO'],'B',0,'L');
$pdf->Cell(70,6,$value['Name1'],'LRB',0,'L');
if($value['Marks']=='ABSENT')
{
$pdf->page_absent_count++;
$pdf->total_absent_count=$sub_wise_total_absent[$value['FSUBCODE']];
$pdf->Cell(20,6,'-','B',0,'C');
$pdf->Cell(40,6,$value['Marks'],'LRB',1,'L');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,6,$value['Marks'],'B',0,'C');
if($pdf->FSNGLENT == 'F')
$pdf->Cell(20,6,$value['Marks2'],'1',0,'C');
$star=getNumber(floatval($value['Marks']));
if($pdf->FSNGLENT == 'F')
{
if($value['Marks']!=$value['Marks2'] and ($value['Marks'] >-1 and $value['Marks2'] >-1 and !empty($value['Marks2'])))
$star=" ***";
}
$pdf->Cell(40,6,$star,'LRB',1,'L');
}
}
}
// $pdf->Ln(2);
}
$pdf->Ln(4);
$pdf->SetFont('Arial','',8);
$pdf->Cell(50,3,"Date : {$pdf->date_1}",'0',1,'L');
$pdf->Ln(8);
$pdf->Cell(50,3,'Signature of Data entered by','0',0,'L');
$pdf->Cell(120,3,'Signature of Data verified by concerned Faculty','0',1,'R');
$pdf->Ln(8);
$pdf->Cell(170,3,'Signature of the HOD or Principal','0',1,'R');
$pdf->Ln(3);
//die();
$pdf->Output("report_Subject_wise.pdf","D");
}
?>
|