Current File : /home/inlingua/public_html/dwarka/icentex/admin/05featuredemo1.inc_oral_designation.php
<?php
/**
 * PHPExcel
 *
 * Copyright (C) 2006 - 2010 PHPExcel
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category   PHPExcel
 * @package    PHPExcel
 * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
 * @version    1.7.3, 2010-05-17
 */

/** Error reporting */
//error_reporting(E_ALL);


/** PHPExcel */
//require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
require_once '../Classes/PHPExcel.php';



//$num1=mysqli_fetch_array($result1);

// Create new PHPExcel object
//echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();



// Set properties
//echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Vikas Umrao")
							 ->setLastModifiedBy("Vikas Umrao")
							 ->setTitle("Office 2007 XLSX Test Document")
							 ->setSubject("Office 2007 XLSX Test Document")
							 ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
							 ->setKeywords("office 2007 openxml php")
							 ->setCategory("Reports Oral");
$objPHPExcel->setActiveSheetIndex(0);


$sharedStyle1 = new PHPExcel_Style();

$sharedStyle1->applyFromArray(
	array('fill' 	=> array(
								'type'		=> PHPExcel_Style_Fill::FILL_SOLID,
								'color'		=> array('argb' => 'FFFFFF00')
							),
		  'borders' => array(
								'bottom'	=> array('style' => PHPExcel_Style_Border::BORDER_THIN),
								'right'		=> array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
							)
		 ));





$styleThickBrownBorderOutline = array(
	'borders' => array(
		'outline' => array(
			'style' => PHPExcel_Style_Border::BORDER_THICK,
			'color' => array('argb' => 'FF000000'),
		),
	),
);



$i1=0;



$ic=3;
$total=0;
$objPHPExcel->getActiveSheet()->getStyle('A'.$ic.':E'.$ic.'')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle('A'.$ic.':E'.$ic.'')->getFill()->getStartColor()->setARGB('FF808080');

//$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', 'Designation');
$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', 'Name');
$objPHPExcel->getActiveSheet()->setCellValue('B'.$ic.'', 'Primary Center');
$objPHPExcel->getActiveSheet()->setCellValue('C'.$ic.'', 'Total(Rs)');
$objPHPExcel->getActiveSheet()->setCellValue('D'.$ic.'', 'For Months');

$ic++;

$monthmk=mktime(0,0,0,$numR['month'],1,$numR['year']);

$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Oral Report for '.date("F, Y",$datemk1).'(Submitted during period '.$date1.' - '.$date2.' )');
					 

//$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Month');
//$objPHPExcel->getActiveSheet()->setCellValue('B4', ''.date("F",$monthmk).', '.$numR['year'].'');

$designation=array("user"=>"Teaching services","FD"=>"Customer services","Administration and Accounts"=>"Administration and Accounts","Business Assets"=>"Business Assets","Other"=>"Other");

/*$queryDesignation="select * from ingl_conveyance_designation";
$resultDesignation=mysqli_query($conn,$queryDesignation);

while($numDesignation=mysqli_fetch_array($resultDesignation))

{
foreach($designation as $key=>$val)
{*/
//$objPHPExcel->getActiveSheet()->getStyle('A'.$ic.':E'.$ic.'')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
//$objPHPExcel->getActiveSheet()->getStyle('A'.$ic.':E'.$ic.'')->getFill()->getStartColor()->setARGB('FFFF66');

//$objPHPExcel->getActiveSheet()->mergeCells('A'.$ic.':E'.$ic.'');
//$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', ''.$val.'');



//$ic++;
$total=0;
if($_REQUEST['location']=="All")
{
//$queryR="select recNo,name,primarycenter,rates_designation from  timesheet_user  where   usertype ='".$key."'   order by name";
$queryR="select recNo,name,primarycenter,rates_designation from  timesheet_user order by name";
}
else
{

//$queryR="select recNo,name,primarycenter,rates_designation from timesheet_user   where  primarycenter='".$_REQUEST['location']."' &&  usertype ='".$key."' order by name";
$queryR="select recNo,name,primarycenter,rates_designation from timesheet_user   where  primarycenter='".$_REQUEST['location']."' order by name";
}

$resultR=mysqli_query($conn,$queryR);
while($numR=mysqli_fetch_array($resultR))
{
    
if($numR["primarycenter"]=="S.Extn")
{
$numR["primarycenter"]="South Extension";
}
$tot=0;
$des="";
$query="select * from ingl_oral_main where instructor='".$numR['recNo']."' && sendDate>='".$date1."' && sendDate<='".$date2."' && status='Send'";
$result=mysqli_query($conn,$query);
$count11=mysqli_num_rows($result);
while($num=mysqli_fetch_array($result))
{
  $monthmk=mktime(0,0,0,$num['month'],1,$num['year']);  
  $tot=$tot+$num['totalAmount'];
  $des.=''.date("F",$monthmk).', '.$num['year'].' | ';
}

if($count11>0)
{
//$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', ''.$val.'');
$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', ''.stripslashes($numR['name']).'');
$objPHPExcel->getActiveSheet()->setCellValue('B'.$ic.'', ''.$numR['primarycenter'].'');
$objPHPExcel->getActiveSheet()->setCellValue('C'.$ic.'', ''.$tot.'');
$objPHPExcel->getActiveSheet()->setCellValue('D'.$ic.'', ''.$des.'');

$total.='+ C'.$ic.'';

$ic++;
}

}

$objPHPExcel->getActiveSheet()->mergeCells('A'.$ic.':B'.$ic.'');
$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', 'Total');
$objPHPExcel->getActiveSheet()->setCellValue('C'.$ic.'', '='.$total.'');
$total1.='+ C'.$ic.'';

//$ic++;
//$ic++;

//}
$ic++;
$objPHPExcel->getActiveSheet()->getStyle('A'.$ic.':D'.$ic.'')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle('A'.$ic.':D'.$ic.'')->getFill()->getStartColor()->setARGB('93DCFF');
$objPHPExcel->getActiveSheet()->mergeCells('A'.$ic.':B'.$ic.'');
$objPHPExcel->getActiveSheet()->setCellValue('A'.$ic.'', 'Final Total');
$objPHPExcel->getActiveSheet()->setCellValue('C'.$ic.'', '='.$total1.'');

$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(18);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(18);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(18);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(40);
//$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(40);
$objPHPExcel->getActiveSheet()->mergeCells('A1:L1');
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
//$objPHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_BLACK);

// Set header and footer. When no different headers for odd/even are used, odd header is assumed.
//echo date('H:i:s') . " Set header/footer\n";
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BInvoice&RPrinted on &D');
$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');

// Set page orientation and size
//echo date('H:i:s') . " Set page orientation and size\n";
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);