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.144.98.43
<?php
function Generateappfeedetails($aobj_context)
{
session_start();
$collcode=$_SESSION['collcode'];
$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
$main_src = $main_src_obj[1];
$pdf_writer_class = $aobj_context->main_src."/Excel_Writer/Writer.php";
$Workbook = $aobj_context->main_src."/Excel_Writer/Workbook.php";
$PEAR = $aobj_context->main_src."/Excel_Writer/PEAR.php";
//var_dump($aobj_context->main_src);die();
//$root_pdf_file_download = $aobj_context->main_src."/Report_details/output/report_me_student_list.pdf";
require_once($pdf_writer_class);
require_once($Workbook);
require_once($PEAR);
ini_set('memory_limit','300M');
ini_set('max_execution_time',3300);
$filename = 'Fee_Summary';
$xls =& new Spreadsheet_Excel_Writer("");
$xls->setVersion(8);
// Add a worksheet to the file, returning an object to add data to
$sheet =& $xls->addWorksheet('Binary Count');
$sum=0;
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// Create the format of the merged cells
// Using setAlign('center') works best (same as 'align' => 'center)
$format_a = array('bordercolor' => 'Black',
'left' => 0,
'bottom' => 0,
'right' =>0,
'top' => 0,
'bold'=>'1',
'size' => '14',
'color'=>'Black',
'align' => 'center');
// Add the format. This could be done all together.
// I keep it separated for ease of use
$format =& $xls->addFormat($format_a);
// Now apply the format to the cells you want to merge
// This is the same as:
// $sheet->write(1,0,'',$format);
// $sheet->write(1,1,'',$format);
// $sheet->write(1,2,'',$format);
// $sheet->write(1,3,'',$format);
// $sheet->write(1,4,'',$format);
// I just think it's cleaner
$query = "select CONCAT(funivname,',',ftown) as univname from control";
$results = $aobj_context->mobj_db->GetRow($query);
// Write in the title or whatever you want in the merged cells
$sheet->write(0,0,$results['univname'],$format);
$sheet->mergeCells(0,0,0,7);
$sheet->write(1,1,'College Name Will Appear hear',$format);
$sheet->mergeCells(1,1,1,7);
// Now apply the merge to the cells
/*
******************************************
* The rest of this just populates the sheet
* with some data and totals it up.
******************************************
*/
// Write some numbers
$coll_from = trim($aobj_context->mobj_data["coll_from"]);
$coll_to=trim($aobj_context->mobj_data["coll_to"]);
$deg_from = trim($aobj_context->mobj_data["deg_from"]);
$deg_to = trim($aobj_context->mobj_data["deg_to"]);
$exam_from=trim($aobj_context->mobj_data["exam_from"]);
$exam_to=trim($aobj_context->mobj_data["exam_to"]);
$cat_from = trim($aobj_context->mobj_data["cat_from"]);
$cat_to = trim($aobj_context->mobj_data["cat_to"]);
$lowfee = trim($aobj_context->mobj_data["lowfee"]);
$reporttype = "";
if($lowfee == 'T')
{
$reporttype = " and ac.FFEETYPE = 'Low Income' ";
}else
{
$reporttype = " and ac.FFEETYPE = 'Normal Fee'";
}
$query ="select GROUP_CONCAT(ac.fregno,'->',s.fname,'->',ac.FCATEGORY,'->',ac.appno,'->',ac.ftotalfee,'->',ac.frecptdate) as app,ac.fdegree,ac.fcollcode
from appcandsum ac,student s
where s.fregno = ac.fregno and s.fdegree = ac.fdegree and ac.fcollcode = s.fcollcode
and IFNULL(ac.frecptdate,'0000-00-00') <> '0000-00-00' and IFNULL(ac.ftotalfee,'') <> ''
and ac.fcollcode between '{$coll_from}' and '{$coll_to}'
and ac.fdegree between '{$deg_from}' and '{$deg_to}' and ac.fexamno between '{$exam_from}' and '{$exam_to}' and ac.FCATEGORY between '{$cat_from}' and '{$cat_to}'
{$reporttype}
group by ac.fcollcode,ac.fdegree";
//var_dump($get_data);
//$this->lowfee = trim($this->aobj_context->mobj_data["lowfee"]);
$i = 3;
$results = $aobj_context->mobj_db->GetAll($query);
foreach($results as $dk => $dv)
{
$degreenew = $dv['fdegree'];
//var_dump($degreenew);
$collnew = $dv['fcollcode'];
$sl_no = 1;
if($degreenew != $degreeold || $collnew != $collold)
{
$degreeold = $degreenew;
$collold = $collnew;
$first = true;
}
$data = explode(',',$dv['app']);
if($first == true || $k2 == 1)
{
$sheet->write($i,0, "Sl. No.", $format);
$sheet->write($i,1, "Reg. No.", $format);
$sheet->write($i,2, "Name", $format);
$sheet->write($i,3, "Category", $format);
$sheet->write($i,4, "App. No.", $format);
$sheet->write($i,5, "Amount", $format);
$sheet->write($i,6, "Date", $format);
$first = false;
}
$format_c = array(
'left' => 0,
'bottom' => 0,
'right' => 0,
'top' => 0,
'bold'=>'0',
'size' => '12',
'color'=>'black',
'align' => 'center'
);
$format =& $xls->addFormat($format_c);
for($i=4;$i<count($data);$i++)
{
$feedet = explode('->',$data[$i]);
$sheet->write($i,0, $sl_no,$format);
$sheet->write($i,1, $feedet[0],$format);
$sheet->write($i,2, $feedet[1],$format);
$sheet->write($i,3, $feedet[2],$format);
$sheet->write($i,4, $feedet[3],$format);
$sheet->write($i,5, $feedet[4],$format);
$sheet->write($i,6, $feedet[5],$format);
$sl_no++;
$k2++;
}
}
header("Content-Type:application/xls");
header("Content-Disposition: attachment; filename={$filename}.xls");
echo $sheet;
echo $sheet;
// Finish the spreadsheet, dumping it to the browser
$xls->close();
}
?>
|