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.145.152.168
<?php
$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
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 */
$pdf_writer_class = $main_src . '/PHPExcel/Classes/PHPExcel.php';
// var_dump($pdf_writer_class);
// die();
require_once($pdf_writer_class);
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 generate_tada_xl_report($aobj_context)
{
$nature_of_work = $aobj_context->mobj_data["nature_of_work"];
$from_orderid = $aobj_context->mobj_data["from_orderid"];
$to_orderid = $aobj_context->mobj_data["to_orderid"];
if($nature_of_work == "all"){
$query="select m.fteachcode, m.fteachname, m.fmobile, m.femail, m.FAADHARNO,
m.fpanno, m.fifsccode, m.faccno, m.fcity, m.ftechtype,
t.forderid, t.fnatwrk, t.fclaimfrm, t.fclaimto, t.fdayallow,
t.ftotdaily, t.fdespnwrk, t.fdist, t.ftravel, t.ftotal,
mdegn.fdegndesc, mdept.fdeptname ,t.fbillno,date_format(ifnull(t.fdate,''),'%d/%m/%Y') as fdate
from masteach m inner join masdegn mdegn on m.FDEGNCODE = mdegn.FDEGNCODE
inner join masdept mdept on
m.FDEPTCODE = mdept.FDEPTCODE
inner join tadabills t on m.fteachcode = t.fteachcode and
m.FAADHARNO = t.FAADHARNO order by m.FAADHARNO";
}else{
$query="select m.fteachcode, m.fteachname, m.fmobile, m.femail, m.FAADHARNO,
m.fpanno, m.fifsccode, m.faccno, m.fcity, m.ftechtype,
t.forderid, t.fnatwrk, t.fclaimfrm, t.fclaimto, t.fdayallow,
t.ftotdaily, t.fdespnwrk, t.fdist, t.ftravel, t.ftotal,
mdegn.fdegndesc, mdept.fdeptname ,t.fbillno,date_format(ifnull(t.fdate,''),'%d/%m/%Y') as fdate
from masteach m inner join masdegn mdegn on m.FDEGNCODE = mdegn.FDEGNCODE
inner join masdept mdept on
m.FDEPTCODE = mdept.FDEPTCODE
inner join tadabills t on m.fteachcode = t.fteachcode where t.fnatwrk='{$nature_of_work}' AND
t.forderid BETWEEN '{$from_orderid}' AND '{$to_orderid}' AND
m.FAADHARNO = t.FAADHARNO order by m.FAADHARNO";
}
$result = $aobj_context->mobj_db->GetAll($query);
$objPHPExcel = new PHPExcel();
$fileName = 'tadaBillDetails';
$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'),
),
),
);
// $count = "";
// $alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
// 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC',
// 'AD', 'AF', 'AE', 'AF', 'AG', 'AH'
// ];
// $j=4;
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('1:1')->getFont()->setSize(12);
$objPHPExcel->getActiveSheet()->freezePane('A1');
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Sl. No.')
->setCellValue('B1', 'Teacher Code')
->setCellValue('C1', 'Teacher Name')
->setCellValue('D1', 'Designation')
->setCellValue('E1', 'Aadhaar No')
->setCellValue('F1', 'Phone No')
->setCellValue('G1', 'Bank A/c')
->setCellValue('H1', 'IFSC')
->setCellValue('I1', 'Pan No')
->setCellValue('J1', 'Email')
->setCellValue('K1', 'City')
->setCellValue('L1', 'Teacher Type')
->setCellValue('M1', 'Purpose Of Visit/Claim')
->setCellValue('N1', 'Order ID')
->setCellValue('O1', 'No. of Days')
->setCellValue('P1', 'D.A/C.A')
->setCellValue('Q1', 'Kilo Meters')
->setCellValue('R1', 'T.A')
->setCellValue('S1', 'Total')
->setCellValue('T1', 'Bill No.')
->setCellValue('U1', 'Bill Date');
$objPHPExcel->getActiveSheet()->getStyle('A1:U1')->applyFromArray($styleArray);
// $objPHPExcel->getActiveSheet()->getColumnDimension('I1')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(29);
$objPHPExcel->getActiveSheet()->getStyle('A1:U1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:U1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:U1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $count=rtrim($count,",");
foreach ($result as $key => $value) {
$slNo = $key + 2;
// $j=4;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $slNo, $slNo - 1)->getColumnDimension('A')->setwidth(6.5);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $slNo, $value['fteachcode'])->getColumnDimension('B')->setwidth(9);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $slNo, $value['fteachname'])->getColumnDimension('C')->setwidth(40);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $slNo, $value['fdegndesc'])->getColumnDimension('D')->setwidth(30);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $slNo, $value['FAADHARNO'])->getColumnDimension('E')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $slNo, $value['fmobile'])->getColumnDimension('F')->setwidth(12);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $slNo, $value['faccno'])->getColumnDimension('G')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $slNo, $value['fifsccode'])->getColumnDimension('H')->setwidth(16);
$objPHPExcel->getActiveSheet()->setCellValue('I' . $slNo, $value['fpanno'])->getColumnDimension('I')->setwidth(16);
$objPHPExcel->getActiveSheet()->setCellValue('J' . $slNo, $value['femail'])->getColumnDimension('J')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('K' . $slNo, $value['fcity'])->getColumnDimension('K')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('L' . $slNo, $value['ftechtype'])->getColumnDimension('L')->setwidth(15);
$objPHPExcel->getActiveSheet()->setCellValue('M' . $slNo, $value['fnatwrk'])->getColumnDimension('M')->setwidth(50);
$objPHPExcel->getActiveSheet()->setCellValue('N' . $slNo, $value['forderid'])->getColumnDimension('N')->setwidth(20);
$objPHPExcel->getActiveSheet()->setCellValue('O' . $slNo, $value['fdayallow'])->getColumnDimension('O')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('P' . $slNo, $value['ftotdaily'])->getColumnDimension('P')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('Q' . $slNo, $value['fdist'])->getColumnDimension('Q')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('R' . $slNo, $value['ftravel'])->getColumnDimension('R')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('S' . $slNo, $value['ftotal'])->getColumnDimension('S')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('T' . $slNo, $value['fbillno'])->getColumnDimension('T')->setwidth(10);
$objPHPExcel->getActiveSheet()->setCellValue('U' . $slNo, $value['fdate'])->getColumnDimension('U')->setwidth(10);
// $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setwidth(12);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':U'. $slNo)->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A' . $slNo . ':B' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
// $objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_JUSTIFY);
// $objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('D' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo )->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$objPHPExcel->getActiveSheet()->getStyle('F' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('G' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('H' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('I' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// $objPHPExcel->getActiveSheet()->getStyle('J' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('L' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('N' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('O' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('P' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('Q' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('R' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('S' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('T' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('U' . $slNo)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('C' . $slNo)->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('E' . $slNo)->getAlignment()->setWrapText(true);
}
$objPHPExcel->getActiveSheet()->setTitle($fileName);
$objPHPExcel->getActiveSheet()->getPageSetup()
->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$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->mobj_db->GetRow($get_coll_name);
// $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'];
// die();
// $objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($aobj_context->main_src.'img/'.$aobj_context->FUNIVCODE.'_logo.jpg', PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H&"-,Bold"&16' . $aobj_context->FUNIVNAME . "\n" . '&12' . $rtype);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&C&H'.$deggrp);
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&RPage &P of &N');
getheaders($objPHPExcel, $fileName);
}
?>
|