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.149.25.26
<?php
function Generateiamarkspendingreport($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
ini_set('max_execution_time', 600);
ini_set('memory_limit', '-1');
$coll_from = $aobj_context->mobj_data["coll_from"];
$coll_to = $aobj_context->mobj_data["coll_to"];
$degree_code_from = $aobj_context->mobj_data["degree_code_from"];
$degree_code_to = $aobj_context->mobj_data["degree_code_to"];
$Examno_from = $aobj_context->mobj_data["Examno_from"];
$Examno_to = $aobj_context->mobj_data["Examno_to"];
$reg_from = $aobj_context->mobj_data["reg_from"];
$reg_to = $aobj_context->mobj_data["reg_to"];
$iapennding = $aobj_context->mobj_data["iapennding"];
$FCODEorSHRTNAME = $aobj_context->mobj_data["search_field"];
$Reglist_start = substr("00000000".$aobj_context->mobj_data["subwise_start"],-8);
$Reglist_end = substr("zzzzzzzz".$aobj_context->mobj_data["subwise_end"],-8);
$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_me_student_list.pdf";
$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);
$p_count =1;
include($pdf_writer_class);
$pdf= new FPDF();
$pdf->SetFont('Times','',10);
$pdf->SetMargins(6,13);
$pdf->AliasNbPages();
if($iapennding === true)
{ //var_dump($iapennding);
$query = " select mk.fcollcode, mk.fdegree, mk.fexamno, mk.fsubcode,
concat(s.fsubname, ', ', s.fssubname) as fsubname,count(mk.fregno) as ftotcnt, sum(case when ifnull(mk.fmarks,-1) = -1 then 1 else 0 end) as fpend from marks mk,subject s
where mk.fdegree = s.fdegree and mk.fexamno = s.fexamno and mk.`FSUBCODE` = s.`FCSUBCODE`
and s.fintass = 'T' and s.fretain = 'T'
and s.FTHEORY='T' AND s.FINTASS='T' AND IFNULL(s.FRETAIN,'F')='T'
and mk.fcollcode between '{$coll_from}' and '{$coll_to}'
and mk.fdegree between '{$degree_code_from}' and '{$degree_code_to}'
and mk.fexamno between '{$Examno_from}' and '{$Examno_to}' and mk.fregno between '{$reg_from}' and '{$reg_to}'
group by mk.fcollcode, mk.fdegree, mk.fexamno, mk.fsubcode, s.fsubname, s.fssubname ";
}else
{
$update = "SET SESSION group_concat_max_len = 1000000";
$aobj_context->mobj_db->Execute($update);
$create = "CREATE TEMPORARY TABLE IF NOT EXISTS temp_pendiamarks AS
SELECT CONCAT(mk.fcollcode,' - ',c.fcollname) AS fcollname,CONCAT(mk.fdegree,' - ',d.FDESCPN) AS fdegreename,
CONCAT(mk.fexamno,' - ',d.fexamname) AS fexam, mk.fsubcode, mk.fregno, mk.FMARKS,
CONCAT(s.fsubname, ', ', s.fssubname) AS fsubname, mk.FDELETED,mk.fcollcode, mk.FDEGREE, mk.FEXAMNO
FROM marks mk, college c, degree d, subject s
WHERE mk.FCOLLCODE = c.FCOLLCODE
AND mk.fdegree = d.fdegree
AND mk.FEXAMNO = d.fexamno
AND mk.fdegree = s.fdegree AND mk.fexamno = s.fexamno AND mk.fsubcode = s.fcsubcode
AND mk.fdegree BETWEEN '{$degree_code_from}' and '{$degree_code_to}'
AND mk.fexamno BETWEEN '{$Examno_from}' and '{$Examno_to}'
AND mk.fcollcode BETWEEN '{$coll_from}' and '{$coll_to}'
AND mk.fregno BETWEEN '{$reg_from}' and '{$reg_to}'
AND IFNULL(mk.fmarks,-1) = -1";
$result = $aobj_context->mobj_db->Execute($create);
//var_dump($create);
//var_dump($result);
$update1 = "UPDATE temp_pendiamarks SET FDELETED = NULL";
$aobj_context->mobj_db->Execute($update1);
$update2 = "UPDATE temp_pendiamarks a, candsum b, canddet c SET a.fdeleted = 'X'
WHERE a.fdegree = c.fdegree AND a.fexamno = c.fexamno
AND a.fregno = c.fregno AND INSTR(a.fsubcode,c.fsubcode) > 0
AND b.fdegree = c.fdegree AND b.fregno = c.fregno
AND IFNULL(b.frecptdate,'') <> '' AND IFNULL(b.ftotalfee,0) > 0
AND c.fpresent = 'P'
AND b.FFRESHEXAM = a.fexamno
AND c.fdegree BETWEEN '{$degree_code_from}' and '{$degree_code_to}'
AND c.fexamno BETWEEN '{$Examno_from}' and '{$Examno_to}'
AND c.fcollcode BETWEEN '{$coll_from}' and '{$coll_to}'
AND c.fregno BETWEEN '{$reg_from}' and '{$reg_to}'";
$result = $aobj_context->mobj_db->Execute($update2);
//var_dump($update2);
//var_dump($result);
$query = "SELECT fcollname AS fcollcode, fdegreename AS fdegree, fexam AS fexamno, fsubcode, fsubname,
GROUP_CONCAT(fregno) AS Regno,COUNT(fregno) AS fpend
FROM temp_pendiamarks WHERE fdeleted = 'X'
GROUP BY fcollcode, fdegree, fexamno, fsubcode
ORDER BY fcollcode, fdegree, fexamno, fsubcode";
//var_dump($query);
}
// var_dump($query);die();
$pdf->SetFont('Times','B',14);
$pdf->aobj_context =$aobj_context;
$pdf->WhichReport = 'iamarks_pending';
$pdf->FUNIVNAME = $lobj_page_header_university[FUNIVNAME];
$pdf->coll_from = $coll_from;
$pdf->coll_to = $coll_to;
$pdf->deg_from = $degree_code_from;
$pdf->deg_to = $degree_code_to;
$pdf->Examno_from = $Examno_from;
$pdf->Examno_to = $Examno_to;
$pdf->reg_from = $reg_from;
$pdf->reg_to = $reg_to;
$pdf->FTOWN = $lobj_page_header_university[FTOWN]; //$
$pdf->date_1 = $lobj_page_header_university['date'];
$pdf->SetFont('Times','B',9);
$lobj_get_student_data = $aobj_context->mobj_db->GetAll($query);
//var_dump($query);
//$first = true;
$count=1;
$pdf->AddPage();
foreach($lobj_get_student_data as $key => $value)
{
$linewidth = 205;
$lleftmargin = 6;
$lrightmargin = 8;
//$pdf->AddPage();
$new_y=$pdf->GetY();
if($new_y>=245)
{
$pdf->AddPage();
$pdf->SetY(30);
}
$count++;
$pdf->ln(4);
$new_y=$pdf->GetY();
$pdf->SetDash(0.5,0.5);
$pdf->Line($lleftmargin,$new_y, $linewidth,$new_y);
//$pdf->Line($lleftmargin,$new_y+.5, $linewidth,$new_y+.5);
$pdf->SetFont('Courier','B',9);
$pdf->ln(4);
$pdf->Cell(30,5,'',0,0,'L');
$pdf->Cell(150,5,'College :'.$value['fcollcode'],0,1,'C');
$pdf->Cell(30,5,'',0,0,'L');
$pdf->Cell(150,5,'Degree :'.$value['fdegree'].' Semester: '.$value['fexamno'],0,1,'C');
$pdf->Cell(30,5,'',0,0,'L');
$pdf->Cell(150,5,'Subject: '.$value['fsubcode'].' - '.$value['fsubname'],0,1,'L');
$pdf->ln(4);
$new_y=$pdf->GetY();
$pdf->Line($lleftmargin,$new_y, $linewidth,$new_y);
//$pdf->Line($lleftmargin,$new_y+.5, $linewidth,$new_y+.5);
$pdf->ln(4);
$pdf->SetFont('Courier','',9);
$j=1;
$pdf->Cell(18,4,'',0,0,'C');
if($value['fpend']>0)
{
$Regno=explode(',',$value['Regno']);
for($i=0;$i<=count($Regno);$i++)
{
if($Regno[$i]!=''){
$pdf->Cell(25,4,$Regno[$i],0,0,'C');
if($j>=6)
{
$new_y=$pdf->GetY();
if($new_y>=265)
{
$pdf->AddPage();
$pdf->SetY(30);
$pdf->ln(4);
$new_y=$pdf->GetY();
$pdf->SetFont('Courier','',9);
$pdf->SetDash(0.5,0.5);
$pdf->Line($lleftmargin,$new_y, $linewidth,$new_y);
//$pdf->Line($lleftmargin,$new_y+.5, $linewidth,$new_y+.5);
$pdf->SetFont('Courier','B',9);
$pdf->ln(4);
$pdf->Cell(30,5,'',0,0,'L');
$pdf->Cell(150,5,'College :'.$value['fcollcode'],0,1,'C');
$pdf->Cell(30,5,'',0,0,'L');
$pdf->Cell(150,5,'Degree :'.$value['fdegree'].' Semester: '.$value['fexamno'],0,1,'C');
$pdf->Cell(30,5,'',0,0,'L');
$pdf->Cell(150,5,'Subject: '.$value['fsubcode'].' - '.$value['fsubname'],0,1,'L');
$pdf->ln(4);
$new_y=$pdf->GetY();
$pdf->Line($lleftmargin,$new_y, $linewidth,$new_y);
//$pdf->Line($lleftmargin,$new_y+.5, $linewidth,$new_y+.5);
$pdf->SetFont('Courier','',9);
}
$pdf->ln(4);
$pdf->Cell(18,4,'',0,0,'C');
$j=0;
}
$j++;
}
}
}
$pdf->ln(4);
$new_y=$pdf->GetY();
$pdf->SetDash(0.5,0.5);
$pdf->Line($lleftmargin,$new_y, $linewidth,$new_y);
//$pdf->Line($lleftmargin,$new_y+.5, $linewidth,$new_y+.5);
$pdf->SetFont('Courier','B',9);
$pdf->ln(3);
$pdf->Cell(18,4,'',0,0,'C');
$pdf->Cell(150,4,'IA Marks required for '.$value['fpend'].' students',0,0,'L');
$pdf->ln(3);
}
$pdf->ln(3);
$new_y=$pdf->GetY();
$pdf->SetDash(0.5,0.5);
$pdf->Line($lleftmargin,$new_y, $linewidth,$new_y);
//$pdf->Line($lleftmargin,$new_y+.5, $linewidth,$new_y+.5);
$pdf->Output("report_me_student_list.pdf","D");
}
?>
|