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.148.105.152
<?php
ini_set('max_execution_time', 300);
$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
//$pdf_writer_class =$main_src."/tarka_pdf/fpdf.php";
$pdf_writer_class = $main_src . "/tcpdf/tcpdf.php";
require_once($pdf_writer_class);
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('GMT+5:30');
// PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
if (PHP_SAPI == 'cli')
die('This example should only be run from a Web Browser');
/** Include PHPExcel */
require_once($pdf_writer_class = $main_src . '/PHPExcel/Classes/PHPExcel.php');
class MYPDF extends TCPDF
{
public $aobj_context;
public function setData($aobj_context, $Deggrp, $reportType)
{
$this->aobj_context = $aobj_context;
$this->Deggrp = $Deggrp;
$this->reportType = $reportType;
$this->univcode = $this->aobj_context->mobj_data["univcode"];
}
public function Header()
{
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
$this->SetFillColor(248, 248, 255);
$img_path = $this->aobj_context->main_src . "/img/{$this->univcode}_logo.jpg";
if (file_exists($img_path))
$this->Image($img_path, 30, 6, 20, 20);
$this->SetFont('Times', 'B', 13);
$this->SetY(5);
$this->Cell(0, 4, $this->aobj_context->FUNIVNAME, 0, 1, 'C');
$this->SetFont('Times', '', 11);
$this->Cell(0, 4, $this->aobj_context->s_state, 0, 1, 'C');
$this->SetFont('Times', 'BU', 12);
$this->Ln(1);
$cur_year = date("Y");
$this->Cell(0, 5, $this->reportType, '0', 1, 'C');
$this->SetFont('Times', '', 12);
$this->Cell(0, 6, " Degree Group : " . $this->Deggrp . ' - ' . $this->aobj_context->fexamdate . ' EXAMINATION', "0", 1, "C");
//$this->Cell(0,6," Degree Group: ".$this->Deggrp.' '.$this->aobj_context->fexamdate,"0",1,"C");
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
}
public function Footer()
{
$this->SetXY(15, -15);
$this->SetFont('helvetica', 'I', 8);
$this->Cell(60, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
$this->Cell(70, 10, 'Date : ' . date("d/m/Y H:i:s"), 0, 0, 'C');
$this->Cell(60, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
}
}
class QPIndentReport
{
function DefaultConstructor($aobj_context, $Deggrp, $reportType)
{
$this->aobj_context = $aobj_context;
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->ip = $_SERVER["REMOTE_ADDR"];
$get_date = "select DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
$obj = $this->aobj_context->mobj_db->GetRow($get_date);
$get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
FUNIVADD1 as 'state', pdf_logo_path,
ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
$lobj_get_coll_name = $this->aobj_context->pobj_db->GetRow($get_coll_name);
$query = "select * from deggrp where fdeggrp = '{$Deggrp}'";
$results = $this->aobj_context->pobj_db->GetRow($query);
$aobj_context->fexamdate = $results['fexamdate'];
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
$aobj_context->s_state = $lobj_get_coll_name['state'];
$aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
$aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];
$this->Degree = $Deggrp;
// var_dump($this->Deggrp);
$this->current_date = $obj['now_date'];
$this->pdf = new MYPDF('L');
$this->pdf->setData($aobj_context, $Deggrp, $reportType);
}
function tableHeader($pdf)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(8, 6, "Sl.", "LRT", 0, "C");
$pdf->Cell(12, 6, "QP", "LRT", 0, "C");
$pdf->Cell(65, 6, "Subject Name", "LRT", 0, "C");
$pdf->Cell(18, 6, "Date", "LRT", 0, "C");
$pdf->Cell(37, 6, "Session", "LRT", 0, "C");
$pdf->Cell(12, 6, "QP", "LRT", 0, "C");
$pdf->Cell(43, 6, "Degree", "LRT", 1, "C");
$pdf->Cell(8, 6, "No", "LRB", 0, "C");
$pdf->Cell(12, 6, "Code", "LBR", 0, "C");
$pdf->Cell(65, 6, "", "LBR", 0, "C");
$pdf->Cell(18, 6, "", "LBR", 0, "C");
$pdf->Cell(37, 6, "", "LBR", 0, "C");
$pdf->Cell(12, 6, "Indent", "LBR", 0, "C");
$pdf->Cell(43, 6, "", "LBR", 1, "C");
$pdf->SetFont('Times', '', 10);
}
function headerQPWise($pdf)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(30, 6, "", 0, 0);
$pdf->Cell(8, 6, "Sl.", "LRT", 0, 'C');
$pdf->Cell(15, 6, "Center", "LRT", 0, "C");
$pdf->Cell(110, 6, "Center Name", "LRT", 0, "C");
$pdf->Cell(15, 6, "Total", "LRT", 1, "C");
$pdf->Cell(30, 6, "", 0, 0);
$pdf->Cell(8, 6, "No.", "LRB", 0, "C");
$pdf->Cell(15, 6, "Code", "LRB", 0, "C"); //w h txt brd pos align
$pdf->Cell(110, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "Count", "LBR", 1, "C");
$pdf->SetFont('Times', '', 10);
}
function headerDateWise($pdf)
{
$pdf->SetFont('Times', 'B', 10);
$pdf->Cell(8, 6, "Sl.", "LRT", 0, "C");
$pdf->Cell(20, 6, "Date", "LRT", 0, "C");
$pdf->Cell(41, 6, "Session", "LRT", 0, "C");
$pdf->Cell(10, 6, "QP", "LRT", 0, "C");
$pdf->Cell(80, 6, "Subject Name", "LRT", 0, "C");
$pdf->Cell(100, 6, "Degree", "LRT", 0, "C");
$pdf->Cell(15, 6, "QP", "LRT", 1, "C");
$pdf->Cell(8, 6, "No", "LRB", 0, "C");
$pdf->Cell(20, 6, "", "LRB", 0, "C"); //w h txt brd pos align
$pdf->Cell(41, 6, "", "LBR", 0, "C");
$pdf->Cell(10, 6, "Code", "LBR", 0, "C");
$pdf->Cell(80, 6, "", "LBR", 0, "C");
$pdf->Cell(100, 6, "", "LBR", 0, "C");
$pdf->Cell(15, 6, "Count", "LBR", 1, "C");
$pdf->SetFont('Times', '', 10);
}
function writeReport($cntrlist)
{
$pdf = $this->pdf;
$pdf->SetMargins(6, 30);
$pdf->startPageGroup();
$pdf->AddPage("P");
$orientation = 'P';
$pdf->SetFont('Times', '', 10);
// $this->tableHeader($pdf);
$old_cntr = '';
$new_cntr = $cntrlist[0]['fcntrcode'];
// var_dump($cntrlist);
$sl_no = 1;
foreach ($cntrlist as $key => $value) {
$new_cntr = $value['fcntrcode'];
// $value['fcntrname']
$str = explode(',', $value['fdegree']);
$str1 = implode(',', array_slice($str, 0, 4));
$str2 = implode(',', array_slice($str, 4));
$sub1 = substr($value['fsubname'], 0, 38);
$sub2 = substr($value['fsubname'], 38);
if ($old_cntr !== $new_cntr) {
if ($pdf->getY() > 240)
$pdf->AddPage();
$pdf->SetFont('Times', 'B', 12);
// var_dump($value['fcntrcode'] . ' - ' . $value['fcntrname']);
// echo "<br>";
$pdf->Cell(0, 12, $value['fcntrcode'] . ' - ' . $value['fcntrname'], 0, 1, "C");
$this->tableHeader($pdf);
$old_cntr = $value['fcntrcode'];
$sl_no = 1;
}
// var_dump($value['fqpcode'].'--'.$value['fdoe']);
// echo "<br/>";
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetX($x + 20);
$pdf->MultiCell(65, 6, $value['fsubname'], 1, "L");
$y1 = $pdf->GetY();
$h = $y1 - $y;
$pdf->SetXY($x, $y);
$pdf->Cell(8, $h, $sl_no, "1", 0, "C");
$pdf->cell(12, $h, $value['fqpcode'], "1", 0, "L");
// $pdf->cell(65, 6, $value['fsubname'], "1", 0, "L");
$pdf->SetXY($x + 85, $y);
$pdf->cell(18, $h, $value['fdoe'], "1", 0, "R");
$pdf->cell(37, $h, $value['fsession'], "1", 0, "R");
$pdf->cell(12, $h, moneyFormatIndia($value['frounded']), "1", 0, "C");
$pdf->cell(43, $h, $str1, "1", 1, "L");
if ($pdf->getY() > 260) {
$pdf->AddPage();
$pdf->SetFont('Times', 'B', 12);
$pdf->Cell(0, 12, $value['fcntrcode'] . ' - ' . $value['fcntrname'], 0, 1, "C");
$this->tableHeader($pdf);
}
$sl_no++;
}
}
function writeQPReport($qpList)
{
$pdf = $this->pdf;
$pdf->SetMargins(0, 35);
$pdf->startPageGroup();
$pdf->AddPage("P");
$pdf->SetFont('Times', '', 10);
$this->headerQPWise($pdf);
$sl_no = 0;
foreach ($qpList as $key => $value) {
$colname1 = strtolower(substr($value['fcntrname'], 0, 65));
$colname2 = strtolower(substr($value['fcntrname'], 65));
$sl_no++;
if ($pdf->getY() > 260) {
$pdf->AddPage("P");
$this->headerQPWise($pdf);
}
if ($colname2) {
$pdf->Cell(30, 6, "", 0, 0);
$pdf->Cell(8, 6, $sl_no, "LRT", 0, "C");
$pdf->Cell(15, 6, $value['fcntrcode'], "LRT", 0, "C");
$pdf->Cell(110, 6, ucwords($colname1, '\',. '), "LRT", 0, "L");
$pdf->Cell(15, 6, moneyFormatIndia($value['fcount']), "LRT", 1, "R");
$pdf->Cell(30, 6, "", 0, 0);
$pdf->Cell(8, 6, "", "LBR", 0);
$pdf->Cell(15, 6, "", "LBR", 0, "C");
$pdf->Cell(110, 6, $colname2, "LBR", 0, "L");
$pdf->Cell(15, 6, "", "LBR", 1, "R");
} else {
$pdf->Cell(30, 6, "", 0, 0);
$pdf->Cell(8, 6, $sl_no, "1", 0, "C");
$pdf->Cell(15, 6, $value['fcntrcode'], "1", 0, "C");
$pdf->Cell(110, 6, ucwords($colname1, '\',. '), "1", 0, "L");
$pdf->Cell(15, 6, moneyFormatIndia($value['fcount']), "1", 1, "R");
}
if ($pdf->getY() > 260) {
$pdf->AddPage("P");
$this->headerQPWise($pdf);
}
}
}
function writedoeReport($doelist)
{
$pdf = $this->pdf;
$pdf->SetMargins(10, 35);
$pdf->startPageGroup();
$pdf->AddPage("L");
$pdf->SetFont('Times', '', 10);
$this->headerDateWise($pdf);
$sl_no = 0;
foreach ($doelist as $key => $value) {
$sub = explode(',', $value['fdegree']);
$degstr = implode(', ', $sub);
$sub1 = substr($value['fsubname'], 0, 40);
$sub2 = substr($value['fsubname'], 40);
$sl_no++;
if ($sub2) {
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetX($x + 159);
$pdf->MultiCell(100, 6, $degstr, "LRT", "L");
$y1 = $pdf->GetY();
$h = $y1 - $y;
$pdf->SetXY($x, $y);
$pdf->Cell(8, $h, $sl_no, "LRT", 0, "C");
$pdf->Cell(20, $h, $value['fdoe'], "LRT", 0, "C");
$pdf->Cell(41, $h, $value['fsession'], "LRT", 0, "C");
$pdf->Cell(10, $h, $value['fqpcode'], "LRT", 0, "C");
$pdf->Cell(80, $h, $sub1, "LRT", 0, "L");
$pdf->SetX($x + 259);
$pdf->Cell(15, $h, moneyFormatIndia($value['fforcoll']), "LRT", 1, "C");
if ($sub2) {
$pdf->Cell(8, $h, "", "LBR", 0);
$pdf->Cell(20, $h, "", "LBR", 0, "C");
$pdf->Cell(41, $h, "", "LBR", 0, "C");
$pdf->Cell(10, $h, "", "LBR", 0, "C");
$pdf->Cell(80, $h, $sub2, "LBR", 0, "L");
$pdf->Cell(100, $h, "", "LBR", 0, "L");
$pdf->Cell(15, $h, "", "LBR", 1, "R");
}
if ($pdf->getY() > 170) {
$pdf->AddPage();
$this->headerDateWise($pdf);
}
} else {
$x = $pdf->GetX();
$y = $pdf->GetY();
$pdf->SetX($x + 159);
$pdf->MultiCell(100, 6, $degstr, 1, "L");
$y1 = $pdf->GetY();
$h = $y1 - $y;
$pdf->SetXY($x, $y);
$pdf->Cell(8, $h, $sl_no, "1", 0, "C");
$pdf->Cell(20, $h, $value['fdoe'], "1", 0, "C");
$pdf->Cell(41, $h, $value['fsession'], "1", 0, "C");
$pdf->Cell(10, $h, $value['fqpcode'], "1", 0, "C");
$pdf->Cell(80, $h, $sub1, "1", 0, "L");
$pdf->SetX($x + 259);
$pdf->Cell(15, $h, moneyFormatIndia($value['fforcoll']), "1", 1, "C");
if ($pdf->getY() > 170) {
$pdf->AddPage();
$this->headerDateWise($pdf);
}
}
if ($pdf->getY() > 180) {
$this->headerDateWise($pdf);
}
}
}
function SendOutput()
{
// ob_end_clean();
$this->pdf->Output("{$this->reportType}_QPIndent{$this->univcode}.pdf", "I");
}
}
function getqpIndentReport($aobj_context)
{
$univcode = $aobj_context->mobj_data["univcode"];
$deggrp = $aobj_context->mobj_data["dgp"];
$reportType = $aobj_context->mobj_data["rt"];
$reportFormat = $aobj_context->mobj_data["rf"];
$examrange = $aobj_context->mobj_data["examrange"];
$examnoStr = strtoupper($examrange);
$splitexamno = str_split($examnoStr);
$examno = implode("','", $splitexamno);
// var_dump($deggrp,$reportType,$resetData,$reportFormat);
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
$class_obj = new QPIndentReport();
$class_obj->univcode = $univcode;
$class_obj->reportType = $reportType;
$class_obj->DefaultConstructor($aobj_context, $deggrp, $reportType);
if ($reportType == 'Centrewise Indent') {
$query = "SELECT fcntrcode,fcntrname,fqpcode,fsubname,
DATE_FORMAT(fdoe, '%d/%m/%Y') AS fdoe,ifnull(r.fdescpn,'') as fsession,
fcnt,fextra,ftotal,frounded,fdegree
FROM tmpqpindsum s left join reason r on s.fsession = r.freasoncd
where s.fqpcode in (select fqpcode from subject where fexamno in ('{$examno}'))
ORDER BY fcntrcode, fqpcode";
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($query);
// return;
// die();
// var_dump($result);
if (count($result) > 0) {
if ($reportFormat == 'Excel Format')
writeReport($result, $aobj_context);
else {
$class_obj->writeReport($result);
$class_obj->SendOutput();
}
}
}
if ($reportType == 'Answer Book Indent') {
$query = "SELECT q.fcntrcode, q.fcntrname,SUM(q.frounded) AS fcount
FROM tmpqpindsum q
GROUP BY q.fcntrcode, q.fcntrname
ORDER BY q.fcntrcode, q.fcntrname";
$result = $aobj_context->pobj_db->GetAll($query);
if (count($result) > 0) {
if ($reportFormat == 'Excel Format')
writeABIReport($result, $aobj_context);
else {
$class_obj->writeQPReport($result);
$class_obj->SendOutput();
}
}
}
if ($reportType == 'Total Indent') {
$query = "SELECT DATE_FORMAT(q.fdoe, '%d/%m/%Y') as fdoe , ifnull(re.fdescpn,'') as fsession,
q.fqpcode, q.fsubname, r.fdegree, q.fforcoll
FROM tmpqpindtot q inner join tmpqpinddeg r on q.fqpcode = r.fqpcode
left join reason re on q.fsession = re.freasoncd
where q.fqpcode in (select fqpcode from subject where fexamno in ('{$examno}'))
GROUP BY q.fdoe, q.fsession, q.fqpcode, q.fsubname
ORDER BY q.fdoe, q.fsession, q.fqpcode";
$result = $aobj_context->pobj_db->GetAll($query);
// var_dump($result);
// die();
if (count($result) > 0) {
if ($reportFormat == 'Excel Format')
writedoeReport($result, $aobj_context);
else {
$class_obj->writedoeReport($result);
$class_obj->SendOutput();
}
}
}
}
function writeReport($result, $aobj_context)
{
$objPHPExcel = new PHPExcel();
$fileName = 'CenterwiseIndent';
// Set document properties
$objPHPExcel->getProperties()->setCreator("Me")->setLastModifiedBy("Me")->setTitle("My Excel Sheet")->setSubject("My Excel Sheet")->setDescription("Excel Sheet")->setKeywords("Excel Sheet")->setCategory("Me");
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Add column headers and make them bold
$styleArray = array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
'color' => array('argb' => '000000'),
),
),
);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()
->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'QP Code')
->setCellValue('C1', 'Center Code')
->setCellValue('D1', 'Center Name')
->setCellValue('E1', 'Subject Name')
->setCellValue('F1', 'Date')
->setCellValue('G1', 'Session')
->setCellValue('H1', 'Qp Indent')
// ->setCellValue('I1','Degree')
;
$objPHPExcel->getActiveSheet()->getStyle('A1:H1')->applyFromArray($styleArray);
// $objPHPExcel->getActiveSheet()->getColumnDimension('G1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
foreach ($result as $key => $value) {
$slNo = $key + 2;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(5);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fcntrcode'])->getColumnDimension('C')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fcntrname'])->getColumnDimension('D')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fqpcode'])->getColumnDimension('B')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['fsubname'])->getColumnDimension('E')->setwidth(34);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['fdoe'])->getColumnDimension('F')->setwidth(12.29);
$objPHPExcel->getActiveSheet()->setCellVAlue('G' . $slNo, $value['fsession'])->getColumnDimension('G')->setwidth(20.29);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['frounded'])->getColumnDimension('H')->setwidth(8);
// $objPHPExcel->getActiveSheet()->setCellValue('I'.$slNo, $value['fdegree'])->getColumnDimension('I')->setwidth(45);
// $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setwidth(12);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':H' . $slNo)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(33);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':C' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':C' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':I' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':I' . $slNo)->getAlignment()->setWrapText(true);
}
// Set worksheet title
$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
// $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
FUNIVADD1 as 'state', pdf_logo_path,
ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
$lobj_get_coll_name = $aobj_context->pobj_db->GetRow($get_coll_name);
// $aobj_context->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
// $aobj_context->s_state=$lobj_get_coll_name['state'];
// $aobj_context->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
// $aobj_context->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE'];
$deggrp = $aobj_context->mobj_data["dgp"];
$query = "select distinct concat(fexamdate,' ',' Examination') as fexamdate
from deggrp where fdeggrp = '{$deggrp}'";
$results = $aobj_context->pobj_db->GetRow($query);
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
$aobj_context->s_state = $lobj_get_coll_name['state'];
$aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
$aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];
$deggrp = $aobj_context->mobj_data["dgp"] . ' - ' . $results['fexamdate'];
$reportType = $aobj_context->mobj_data["rt"];
//
$reportType = $aobj_context->mobj_data["rt"];
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME . "\n" . '&12' . $reportType . ' - ' . $deggrp);
// $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$reportType.' - '.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');
getheaders($objPHPExcel, $fileName);
}
function writedoeReport($result, $aobj_context)
{
$objPHPExcel = new PHPExcel();
$fileName = 'TotalIndent';
// Set document properties
$objPHPExcel->getProperties()->setCreator("Me")->setLastModifiedBy("Me")->setTitle("My Excel Sheet")->setSubject("My Excel Sheet")->setDescription("Excel Sheet")->setKeywords("Excel Sheet")->setCategory("Me");
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Add column headers and make them bold
$styleArray = array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
'color' => array('argb' => '000000'),
),
),
);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()
->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'Date')
->setCellValue('C1', 'Session')
->setCellValue('D1', 'QP Code')
->setCellValue('E1', 'Subject Name')
->setCellValue('F1', 'Degree')
->setCellValue('G1', 'QP Count');
$objPHPExcel->getActiveSheet()->getStyle('A1:G1')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A1:G1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:G1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:G1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
//Put each record in a new cell
foreach ($result as $key => $value) {
$slNo = $key + 2;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(5);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fdoe'])->getColumnDimension('B')->setwidth(12.29);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fsession'])->getColumnDimension('C')->setwidth(21);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fqpcode'])->getColumnDimension('D')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->setCellVAlue('E' . $slNo, $value['fsubname'])->getColumnDimension('E')->setwidth(34);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['fdegree'])->getColumnDimension('F')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['fforcoll'])->getColumnDimension('G')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':G' . $slNo)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(60);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('B' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('B' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('G' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('G' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':G' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo . ':F' . $slNo)->getAlignment()->setWrapText(true);
}
// Set worksheet title and orientation
$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
// $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
FUNIVADD1 as 'state', pdf_logo_path,
ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
$lobj_get_coll_name = $aobj_context->pobj_db->GetRow($get_coll_name);
// $aobj_context->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
// $aobj_context->s_state=$lobj_get_coll_name['state'];
// $aobj_context->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
// $aobj_context->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE'];
$deggrp = $aobj_context->mobj_data["dgp"];
$query = "select distinct concat(fexamdate,' ',' Examination') as fexamdate
from deggrp where fdeggrp = '{$deggrp}'";
$results = $aobj_context->pobj_db->GetRow($query);
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
$aobj_context->s_state = $lobj_get_coll_name['state'];
$aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
$aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];
$deggrp = $aobj_context->mobj_data["dgp"] . ' - ' . $results['fexamdate'];
$reportType = $aobj_context->mobj_data["rt"];
$reportType = $aobj_context->mobj_data["rt"];
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME . "\n" . '&12' . $reportType . ' - ' . $deggrp);
// $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$reportType.' - '.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');
getheaders($objPHPExcel, $fileName);
}
function writeABIReport($result, $aobj_context)
{
$objPHPExcel = new PHPExcel();
$fileName = 'AnswerBookIndent';
// Set document properties
$objPHPExcel->getProperties()
->setCreator("Uniclare")->setLastModifiedBy("Me")->setTitle("My Excel Sheet")
->setSubject("My Excel Sheet")->setDescription("Excel Sheet")
->setKeywords("Excel Sheet")->setCategory("Me");
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Add column headers and make them bold
$styleArray = array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
'color' => array('argb' => '000000'),
),
),
);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->freezePane('A2');
$objPHPExcel->getActiveSheet()
->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'Center Code')
->setCellValue('C1', 'Center Name')
->setCellValue('D1', 'Total');
$slNo = 0;
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->applyFromArray($styleArray);
// $objPHPExcel->getActiveSheet()->getColumnDimension('G1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
//Put each record in a new cell
foreach ($result as $key => $value) {
$slNo = $key + 2;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(5);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fcntrcode'])->getColumnDimension('B')->setwidth(8);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fcntrname'])->getColumnDimension('C')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fcount'])->getColumnDimension('D')->setwidth(8.43);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':D' . $slNo)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getRowDimension($slNo)->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':D' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo . ':D' . $slNo)->getAlignment()->setWrapText(true);
}
// Set worksheet title
$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
// $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
FUNIVADD1 as 'state', pdf_logo_path,
ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
$lobj_get_coll_name = $aobj_context->pobj_db->GetRow($get_coll_name);
$deggrp = $aobj_context->mobj_data["dgp"];
$query = "select distinct fexamdate From degree where fdeggrp = '{$deggrp}'";
$results = $aobj_context->pobj_db->GetRow($query);
// $aobj_context->FUNIVNAME=$lobj_get_coll_name['FUNIVNAME'];
// $aobj_context->s_state=$lobj_get_coll_name['state'];
// $aobj_context->pdf_logo_path=$lobj_get_coll_name['pdf_logo_path'];
// $aobj_context->FUNIVCODE=$lobj_get_coll_name['FUNIVCODE'];
// $reportType = $aobj_context->mobj_data["rt"];
$query = "select concat(fexamdate,' ',' Examination') as fexamdate from deggrp where fdeggrp = '{$deggrp}'";
$results = $aobj_context->pobj_db->GetRow($query);
$aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
$aobj_context->s_state = $lobj_get_coll_name['state'];
$aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
$aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];
$deggrp = $aobj_context->mobj_data["dgp"] . ' - ' . $results['fexamdate'];
//$reportType = $aobj_context->mobj_data["rt"];
$reportType = $aobj_context->mobj_data["rt"];
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME . "\n" . '&12' . $reportType . ' - ' . $deggrp);
// $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$reportType.' - '.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');
getheaders($objPHPExcel, $fileName);
}
function getheaders($objPHPExcel, $fileName)
{
//To Fit To Page while printing
$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
$objPHPExcel->getActiveSheet()->getPageSetup()->setHorizontalCentered(true);
$objPHPExcel->getActiveSheet()->getPageSetup()->setVerticalCentered(false);
// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $fileName . '.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
ob_clean();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
function moneyFormatIndia($num)
{
$explrestunits = "";
if (strlen($num) > 3) {
$lastthree = substr($num, strlen($num) - 3, strlen($num));
$restunits = substr($num, 0, strlen($num) - 3); // extracts the last three digits
$restunits = (strlen($restunits) % 2 == 1) ? "0" . $restunits : $restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
$expunit = str_split($restunits, 2);
for ($i = 0; $i < sizeof($expunit); $i++) {
// creates each of the 2's group and adds a comma to the end
if ($i == 0) {
$explrestunits .= (int)$expunit[$i] . ","; // if is first value , convert into integer
} else {
$explrestunits .= $expunit[$i] . ",";
}
}
$thecash = $explrestunits . $lastthree;
} else {
$thecash = $num;
}
return $thecash; // writes the final format where $currency is the currency symbol.
}
|