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.140.195.142
<?php
function Generatefeesummary($aobj_context)
{
session_start();
$collcode = $_SESSION['collcode'];
ini_set('memory_limit','300M');
ini_set('max_execution_time',3300);
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$f = fopen('php://output', 'w');
$degree_from = trim($aobj_context->mobj_data["degree_from"]);
$degree_to = trim($aobj_context->mobj_data["degree_to"]);
$coll_from = trim($aobj_context->mobj_data["coll_from"]);
$coll_from = trim($aobj_context->mobj_data["coll_from"]);
$date_from = trim($aobj_context->mobj_data["date_from"]);
$date_to = trim($aobj_context->mobj_data["date_to"]);
$reporttype = trim($aobj_context->mobj_data["reporttype"]);
$report = trim($aobj_context->mobj_data["report"]);
$collegewise = trim($aobj_context->mobj_data["collegewise"]);
$degreewsie = trim($aobj_context->mobj_data["degreewsie"]);
if($collegewise == '1')
{
$order = "fcollcode,fdegree";
$degree = "cs.fdegree";
}
if($degreewsie == '1')
{
$order = "fdegree,fcollcode";
$degree = "concat(cs.fdegree,' - ',FDESCPN) as fdegree";
}
if($report == 'cs')
{
$title1 = array('Sl. No.','Degree','CAT-I','GM','IIA','IIB','IIIA','IIIB','SC','ST');
$w = array('30','60','50','50','50','50','50','50','50','50');
}
if($report == 'gs')
{
$title1 = array('Sl. No.','Degree','M','F');
$w = array('30','60','60','60');
}else
{
$title1 = array('Sl. No.','Degree','I Semister','II Semister','III Semister','IV Semister','V Semister','VI Semister','VII Semister','VIII Semister');
$w = array('30','60','100','100','100','100','100','100','100','100');
}
if($reporttype == 'examapplication')
{
if($report == 'cs')
{
$query = "select concat(cs.fcollcode,' - ',c.fcollname) as fcollcode ,{$degree},
sum(case when ifnull(cs.FCATEGORY,'') = '{$title1[2]}' then cs.ftotalfee else 0 end) as '{$title1[2]}',
sum(case when cs.FCATEGORY ='{$title1[3]}' then cs.ftotalfee else 0 end) {$title1[3]},
sum(case when cs.FCATEGORY ='{$title1[4]}' then cs.ftotalfee else 0 end) {$title1[4]},
sum(case when cs.FCATEGORY ='{$title1[5]}' then cs.ftotalfee else 0 end) {$title1[5]},
sum(case when cs.FCATEGORY ='{$title1[6]}' then cs.ftotalfee else 0 end) {$title1[6]},
sum(case when cs.FCATEGORY ='{$title1[7]}' then cs.ftotalfee else 0 end) {$title1[7]},
sum(case when cs.FCATEGORY ='{$title1[8]}' then cs.ftotalfee else 0 end) {$title1[8]},
sum(case when cs.FCATEGORY ='{$title1[9]}' then cs.ftotalfee else 0 end) {$title1[9]}
from appcandsum cs,college c
where cs.fcollcode = c.fcollcode
and ifnull(FRECPTDATE,'') <> ''
and ifnull(FTOTALFEE,'') <> ''
group by cs.fcollcode,cs.fdegree
order by {$order}";
}if($report == 'gs')
{
$query = "select concat(cs.fcollcode,' - ',c.fcollname) as fcollcode ,{$degree},
sum(case when ifnull(s.FSEX,'') = '{$title1[2]}' then cs.ftotalfee else 0 end) as '{$title1[2]}',
sum(case when ifnull(s.FSEX,'') ='{$title1[3]}' then cs.ftotalfee else 0 end) {$title1[3]}
from appcandsum cs,college c,student s
where cs.fcollcode = c.fcollcode and s.fdegree = cs.fdegree and s.fcollcode = cs.fcollcode
and s.fregno = cs.fregno
and ifnull(FRECPTDATE,'') <> ''
and ifnull(FTOTALFEE,'') <> ''
group by cs.fcollcode,cs.fdegree
order by {$order}";
}else
{
$query = "select concat(cs.fcollcode,'-',college.fcollname,',',ftown) as fcollcode,{$degree},
sum(FEXAMFEEA) as '{$title1[2]}',sum(FEXAMFEEB) as '{$title1[3]}',sum(FEXAMFEEC) as '{$title1[4]}',
sum(FEXAMFEED) as '{$title1[5]}',sum(FEXAMFEEE) as '{$title1[6]}',sum(FEXAMFEEF) as '{$title1[7]}',
sum(FEXAMFEEG) as '{$title1[8]}',
sum(FEXAMFEEH) as '{$title1[9]}' FROM appcandsum cs,college,degree d
where ifnull(FRECPTDATE,'') <> '' and ifnull(FTOTALFEE,'') <> '' and college.fcollcode = cs.fcollcode and d.fdegree = cs.fdegree and cs.fexamno = d.fexamno
group by fcollcode,fdegree
order by {$order}";
}
}else if($reporttype == 'revaluation')
{
$query = "select rs.fcollcode,rs.fdegree,rs.fexamno as fexamno,sum(rs.famount) as famount,s.FCASTE,FCORRTYPE from res_stud rs
inner join student s on s.fdegree = rs.fdegree and s.fregno = rs.fregno and s.fcollcode = rs.fcollcode
where FPAYMENTSTATUS = 'success' and ifnull(fackdate,'') <> ''
group by fdegree,fcollcode,fexamno,FCORRTYPE";
}else if($reporttype == 'revaluation')
{
$query = "select concat(candsum.fcollcode,'-',college.fcollname,',',ftown) as fcollcode,{$degree},sum(FEXAMFEEA) as 1sem,sum(FEXAMFEEB) as 2sem,sum(FEXAMFEEC) as 3sem,
sum(FEXAMFEED) as 4sem,sum(FEXAMFEEE) as 5sem,sum(FEXAMFEEF) as 6sem,sum(FEXAMFEEG) as 7sem,
sum(FEXAMFEEH) as 8sem FROM candsum,college,degree d
where ifnull(FRECPTDATE,'') <> '' and ifnull(FTOTALFEE,'') <>'' and college.fcollcode = candsum.fcollcode and d.fdegree = candsum.fdegree and candsum.fexamno = d.fexamno
group by fcollcode,fdegree
order by {$order}";
}
var_dump($query);die();
$lobj_get_data = $aobj_context->mobj_db->GetAll($query);
$arrW =0;
$subjRow ='';
if(!empty($lobj_get_data))
{
$e_data.="<table cellspacing='0' cellpadding='1' border='1' width = ''>";
$e_data.="<tr>";
for($i = 0;$i<count($w);$i++)
{
$e_data.="<td style = 'text-align:center;font-weight: bold;row-height:40px;width:{$w[$i]}px;' >{$title1[$i]}</td>";
}
$e_data.="</tr>";
$filename = 'Fee_Summary';
$counter_degree = 1;
$collcodeold = '';
$collcodenew = '';
$degcodenew = '';
$degcodeold = '';
foreach($lobj_get_data as $key=>$value)
{
if($collegewise == '1')
{
$collcodenew = $value['fcollcode'];
if($collcodenew != $collcodeold)
{
$e_data.="<br>";
$fcollcode = wordwrap($value['fcollcode'], 500, '\n', false);
$e_data.="<tr style = 'white-space: nowrap;rowspan=3;'><td style = 'white-space: nowrap;'>{$fcollcode}</td></tr>";
$collcodeold = $collcodenew;
}
}
if($degreewsie == '1')
{
$degcodenew = $value['fdegree'];
if($degcodenew != $degcodeold)
{
$e_data.="<br>";
$fdegree = wordwrap($value['fdegree'], 500, '\n', false);
$e_data.="<tr style = 'white-space: nowrap;rowspan=3;'><td style = 'white-space: nowrap;row-height:40px;'>{$fdegree}</td></tr>";
$degcodeold = $degcodenew;
}
}
$e_data.="<tr>";
$e_data.="<td style = 'text-align:center;' >{$counter_degree}</td>";
if($degreewsie == '1')
$e_data.="<td style = 'white-space: nowrap;text-align:center;' >{$value['fcollcode']}</td>";
if($collegewise == '1')
$e_data.="<td style = 'text-align:center;' >{$value['fdegree']}</td>";
for($i = 2;$i<count($w);$i++)
{
$e_data.="<td style = 'text-align:center;' >{$value[$title1[$i]]}</td>";
}
$e_data.="</tr>";
$counter_degree++;
}
$e_data.="</table>";
//var_dump($e_data);die();
$arr['total_count']= $m;
$arr['html']=$e_data;
$arr['error']=0;
}
else
{
$arr['html'] = '<p> No record found </p>';
}
header("Content-Type:application/xls");
header("Content-Disposition: attachment; filename={$filename}.xls");
echo $e_data;
}
?>
|