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.211.190
<?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 = $aobj_context->mobj_data["subwise_start"];
$sublist_end = $aobj_context->mobj_data["subwise_end"];
$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_SUBJECTWISENEW';
$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=strtoupper(substr($sublist_start,-4));
//$pdf->RTO=strtoupper(substr($sublist_end,-4));
$pdf->RFROM=$sublist_start;
$pdf->RTO=$sublist_end;
// echo substr("naveen",1,1); die();
//end header
$get_total_absent= " select marks.FSUBCODE,count(distinct marks.FREGNO) as total_absent from marks,student,subject
where student.`FCOLLCODE` = marks.`FCOLLCODE` and student.`FDEGREE` = marks.`FDEGREE`
and student.`FEXAMNO` = marks.`FEXAMNO` and subject.`FDEGREE` = student.`FDEGREE`
and marks.`FEXAMNO` = subject.`FEXAMNO` and subject.`FCSUBCODE` = marks.`FSUBCODE`
and marks.fcollcode='1005' and m.FEXAMNO='{$exam_code}' and marks.`FSUBCODE` between '00000' and 'ZZZZZ'
group by marks.FSUBCODE order by marks.FSUBCODE,marks.FREGNO";
/* $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.FSUBCODE >='{$sublist_start}' and s.FSUBCODE <='{$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 and ifnull(s.fintass,'F') = 'T'
group by FSUBCODE order by FSUBCODE,m.FREGNO"; */
$lobj_get_total_absent = $aobj_context->mobj_db->GetAll($get_total_absent);
//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(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.fdegree = stu.fdegree and m.FREGNO=stu.FREGNO
inner join subject s on m.FSUBCODE=s.FCSUBCODE
where s.FSUBCODE between '{$sublist_start}' and '{$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;
"; */
/* $get_subject_data= "select m.FREGNO, SUBSTRING(stu.FNAME,1,36) as Name1,SUBSTRING(stu.FNAME,37) as Name2,
group_concat(s.FSSUBNAME,'->',if(m.FMARKS>=0,m.FMARKS,if(m.FMARKS=-2,'ABSENT','')),'->',m.FSUBCODE,'->',s.FSUBCODE order by m.FSUBCODE separator '~') as subjmarks,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 m.FCOLLCODE='{$college_code}' 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 s.FSUBCODE between '{$sublist_start}' and '{$sublist_end}' 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 m.FREGNO order by m.FREGNO"; */
$get_subject_data="select m.FREGNO, SUBSTRING(stu.FNAME,1,36) as Name1,SUBSTRING(stu.FNAME,37) as Name2,
group_concat(s.FSUBCODE,'->',s.FSSUBNAME,'->',if(m.FMARKS>=0,m.FMARKS,if(m.FMARKS=-2,'ABSENT','')) order by m.FSUBCODE separator '~') as subjmarks,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 m.FCOLLCODE='{$college_code}' 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 s.FSUBCODE between '{$sublist_start}' and '{$sublist_end}' 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 m.FREGNO order by m.FREGNO";
$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($get_subject_data);
$pdf->Subject_name='';
// ECHO "<PRE>";
//print_r($lobj_get_subject_data); die();
$page_header_FEEZEDorNOT = "select if(FMESTATUS{$exam_code} like '%{$lobj_get_subject_data[0]['FSUBCODE']}%','FREEZED (READY TO SEND TO UNIVERSITY)','FREEZING PENDING (TO BE SENT TO UNIVERSITY AFTER FREEZING)') SUB_FREEZ_ADMIN ,
if(FCMESTATUS is null,'',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'].' '.$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)
{
$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');
$totsubdet = $value['subjmarks'];
var_dump($totsubdet);echo '</br>';die();
$subdet = explode('~',$totsubdet);
$subjcodearry = explode('->',$subdet[0]);
$subjcode = $subjcodearry[0];
$totmarks=0;
foreach($subdet as $subkey => $subval)
{
$subarry = explode('->',$subval);
if($subjcode != $subarry[0])
{
$pdf->Cell(10,4,$totmarks,1,0,'C');
//var_dump($totmarks.' '.$subjcode .' '.$subarry[2]);die();
$totmarks=0;
}
if($subarry[2]=='ABSENT')
{
$pdf->page_absent_count++;
$pdf->total_absent_count=$sub_wise_total_absent[$subarry[2]];
$pdf->Cell(10,6,'-',1,0,'C');
//$pdf->Cell(40,6,$subarry[1],'LRB',1,'C');
$totmarks +=$subarry[2];
}
else
{
//$number_to_word=number_to_words(Floatval($value['Marks']));
$pdf->Cell(10,6,$subarry[2],1,0,'C');
//$pdf->Cell(40,6,getNumber(floatval($subarry[1])),'LRB',1,'L');
$totmarks +=$subarry[2];
}
}
$pdf->Cell(10,6,$totmarks,1,0,'C');
$count++;
$row_cnt++;
if(($row_cnt) > 30)
{
$pdf->SetFont('Times','',10);
$pdf->SetMargins(18,15);
$pdf->AddPage();
$row_cnt=0;
}
$pdf->Cell(1,6,'',0,1,'C');
// $pdf->Ln(2);
}
//die();
$pdf->Output("report_Subject_wise.pdf","D");
}
?>
|