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.15.15.91
<?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("00000".$aobj_context->mobj_data["subwise_start"],-5);
$sublist_end = substr("00000".$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 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->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=$sublist_start;
$pdf->RTO=$sublist_end;
// 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 s.FCSUBCODE>='{$sublist_start}' and s.FCSUBCODE<='{$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') ='F'
and m.FMARKS=-2
group by FCSUBCODE order by FCSUBCODE,m.FREGNO";
//var_dump($lobj_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,26) as Name1,
SUBSTRING(stu.FNAME,27) as Name2,
concat(s.FSUBNAME,',[',FSSUBNAME,']') as sub_name, if(m.FMARKS>0,right(concat('000',m.FMARKS),3),if(m.FMARKS=-2,'ABSENT','')) as Marks,
m.FSUBCODE, s.FSMAXMARKS
from marks m inner join student stu on m.FREGNO=stu.FREGNO
inner join subject s on m.FSUBCODE=s.FCSUBCODE
where s.FCSUBCODE>='{$sublist_start}' and s.FCSUBCODE<='{$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') ='F'
and m.FMARKS<>-1
group by FCSUBCODE,m.FREGNO order by FCSUBCODE,m.FREGNO;
";
// echo $get_subject_data; die();
$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>";
VAR_DUMP($lobj_get_subject_data); die(); */
$page_header_FEEZEDorNOT = "select if(FMESTATUS{$exam_code} like '%{$lobj_get_subject_data[0]['FSUBCODE']}%','FREEZED','NOT FREEGED') SUB_FREEZ_ADMIN ,
if(FCMESTATUS is null,'NOT CONFIRMED',concat('CONFIRMED(',FCMESTATUS,')')) as MESTATUS
from colldeg where fcollcode='{$college_code}'
and fdegree='{$degree_code}'
";
$lobj_page_header_FEEZEDorNOT = $aobj_context->mobj_db->GetRow($page_header_FEEZEDorNOT);
$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['MESTATUS'].' AND '.$lobj_page_header_FEEZEDorNOT['SUB_FREEZ_ADMIN'];
$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['SUB_FREEZ_ADMIN'];
$pdf->AddPage();
$pdf->SetFont('Times','',10);
$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)
{
//$DUP_FCSUBCODE=$value['FSUBCODE'];
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(90,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,'C');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,4,$value['Marks'],'R',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(90,4,$value['Name2'],'B',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(90,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,'C');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,6,$value['Marks'],'B',0,'C');
$pdf->Cell(40,6,getNumber(floatval($value['Marks'])),'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(FMESTATUS{$exam_code} like '%{$lobj_get_subject_data[0]['FSUBCODE']}%','FREEZED','NOT FREEGED') SUB_FREEZ_ADMIN ,
if(FCMESTATUS is null,'NOT CONFIRMED',concat('CONFIRMED(',FCMESTATUS,')')) as MESTATUS
from colldeg where fcollcode='{$college_code}'
and fdegree='{$degree_code}'
";
$lobj_page_header_FEEZEDorNOT = $aobj_context->mobj_db->GetRow($page_header_FEEZEDorNOT);
$pdf->REPORT_STATUS=$lobj_page_header_FEEZEDorNOT['SUB_FREEZ_ADMIN'].' AND '.$lobj_page_header_FEEZEDorNOT['MESTATUS'];
$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(6);
$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(5);
$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(90,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,'C');
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(20,4,$value['Marks'],'R',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(90,4,$value['Name2'],'B',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(90,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');
$pdf->Cell(40,6,getNumber(floatval($value['Marks'])),'LRB',1,'L');
}
}
}
// $pdf->Ln(2);
}
$pdf->Output("report_Subject_wise.pdf","D");
}
?>
|