Add version files and new GIF images for UI components
This commit is contained in:
1149
xlsdoc/Classes/PHPExcel.php
Normal file
1149
xlsdoc/Classes/PHPExcel.php
Normal file
File diff suppressed because it is too large
Load Diff
152
xlsdoc/xls4giccid.php
Normal file
152
xlsdoc/xls4giccid.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
//require_once('libconfig.php');
|
||||
//require_once('libhtml.php');
|
||||
//require_once('libmsginfo.php');
|
||||
//require_once('libdefine.php');
|
||||
//require_once('libdbconn.php');
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
//if($idfakultas){$nmfakultas=$cl->fn_get_fieldvalue("namafakultas","select namafakultas from ".DB_UNDIAN.".tbl_fakultas where id='$idfakultas'");}
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL')
|
||||
->setCellValue('A2','4G ICCID')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','Status')
|
||||
->setCellValue('C6','ICCI Number')
|
||||
->setCellValue('D6','IMSI Number')
|
||||
->setCellValue('E6','EKI')
|
||||
->setCellValue('F6','KeyInd')
|
||||
->setCellValue('G6','MSISDN')
|
||||
->setCellValue('H6','Register Date')
|
||||
->setCellValue('I6','Finished')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:I6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('4GICCID_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:I6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','I') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$swhere="";
|
||||
$qry="select p.id,p.isprocess,p.iccid,p.imsi,p.eki,p.keyind,p.msisdn,p.regdate,p.status,p.regdate,p.finisheddate
|
||||
from ".DB_APORTIL.".tbl_marsal_4giccid i left join ".DB_APORTIL.".tbl_marsal_4gprovisioning p on (i.id=p.idiccid or i.id<>p.idiccid)
|
||||
where (i.imsi like '%$keyword%' or i.iccid like '%$keyword%') $swhere and p.isdeleted=0 and i.isdeleted=0
|
||||
order by i.id asc";
|
||||
$qry="select i.id,p.isprocess,i.iccid,i.imsi,i.eki,p.keyind,p.msisdn,p.regdate,p.status,p.finisheddate
|
||||
from ".DB_APORTIL.".tbl_marsal_4giccid i left join ".DB_APORTIL.".tbl_marsal_4gprovisioning p on (i.id=p.idiccid or p.idiccid is null)
|
||||
where (i.imsi like '%$keyword%' or i.iccid like '%$keyword%') and (p.isdeleted=0 or p.isdeleted is null) and i.isdeleted=0
|
||||
order by i.id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$registerdate="";
|
||||
if($rw["regdate"]){$registerdate=date("Y-m-d H:i:s",strtotime($rw["regdate"]));}
|
||||
$finisheddate="";
|
||||
if($rw["finisheddate"]){$finisheddate=date("Y-m-d H:i:s",strtotime($rw["finisheddate"]));}
|
||||
$statusdescription="";
|
||||
if(!is_null($rw["status"]))
|
||||
{
|
||||
$statusdescription=$cl->fn_get_fieldvalue("description","select description from ".DB_APORTIL.".tbl_marsal_4gprovisioningstatus where status='".$rw["status"]."'");
|
||||
}
|
||||
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$statusdescription)
|
||||
->setCellValue('C'.$i,$rw["iccid"])
|
||||
->setCellValue('D'.$i,$rw["imsi"])
|
||||
->setCellValue('E'.$i,$rw["eki"])
|
||||
->setCellValue('F'.$i,$rw["keyind"])
|
||||
->setCellValue('G'.$i,$rw["msisdn"])
|
||||
->setCellValue('H'.$i,$registerdate)
|
||||
->setCellValue('I'.$i,$finisheddate)
|
||||
;
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="4GICCID.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
143
xlsdoc/xls4gprovision.php
Normal file
143
xlsdoc/xls4gprovision.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
//require_once('libconfig.php');
|
||||
//require_once('libhtml.php');
|
||||
//require_once('libmsginfo.php');
|
||||
//require_once('libdefine.php');
|
||||
//require_once('libdbconn.php');
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$status=$_REQUEST['status'];
|
||||
$cl=new MY_HTML();
|
||||
//if($idfakultas){$nmfakultas=$cl->fn_get_fieldvalue("namafakultas","select namafakultas from ".DB_UNDIAN.".tbl_fakultas where id='$idfakultas'");}
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL')
|
||||
->setCellValue('A2','4G PROVISIONING')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','Status')
|
||||
->setCellValue('C6','ICCI Number')
|
||||
->setCellValue('D6','IMSI Number')
|
||||
->setCellValue('E6','EKI')
|
||||
->setCellValue('F6','KeyInd')
|
||||
->setCellValue('G6','MSISDN')
|
||||
->setCellValue('H6','Register Date')
|
||||
->setCellValue('I6','Finished')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:I6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('4GPROVISIONING_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:I6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','I') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$swhere="";
|
||||
if($status!==''){$swhere="and status='$status'";}
|
||||
$qry="select id,isprocess,iccid,imsi,eki,keyind,msisdn,regdate,status,regdate,finisheddate
|
||||
from ".DB_APORTIL.".tbl_marsal_4gprovisioning
|
||||
where (imsi like '%$keyword%' or msisdn like '%$keyword%') $swhere and isdeleted=0 and iby='".$_SESSION['nik']."'
|
||||
order by id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$registerdate=date("Y-m-d H:i:s",strtotime($rw["regdate"]));
|
||||
$finisheddate=date("Y-m-d H:i:s",strtotime($rw["finisheddate"]));
|
||||
$statusdescription=$cl->fn_get_fieldvalue("description","select description from ".DB_APORTIL.".tbl_marsal_4gprovisioningstatus where status='".$rw["status"]."'");
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$statusdescription)
|
||||
->setCellValue('C'.$i,$rw["iccid"])
|
||||
->setCellValue('D'.$i,$rw["imsi"])
|
||||
->setCellValue('E'.$i,$rw["eki"])
|
||||
->setCellValue('F'.$i,$rw["keyind"])
|
||||
->setCellValue('G'.$i,$rw["msisdn"])
|
||||
->setCellValue('H'.$i,$registerdate)
|
||||
->setCellValue('I'.$i,$finisheddate)
|
||||
;
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="4GPROVISIONING.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
107
xlsdoc/xlsancreg.php
Normal file
107
xlsdoc/xlsancreg.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
ini_set('memory_limit', '1024M');
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL')
|
||||
->setCellValue('A2','ANC REGISTRATION REPORTING')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','MSISDN')
|
||||
->setCellValue('C6','Customer Name')
|
||||
->setCellValue('D6','Customer Address')
|
||||
->setCellValue('E6','ID Card')
|
||||
->setCellValue('F6','Register Date')
|
||||
->setCellValue('G6','Type')
|
||||
->setCellValue('H6','CSO NIK')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:H6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('ANCREGISTER_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:H6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','H') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$swhere="";
|
||||
|
||||
$qry="select id,msisdn,customername,customeraddress,idcard,registerdate,idtypes,types,iby
|
||||
from ".DB_APORTIL.".tbl_marsal_simcardreg
|
||||
where (msisdn like '%$keyword%' or customername like '%$keyword%') and isdeleted=0
|
||||
order by id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$registerdate=date("Y-m-d H:i:s",strtotime($rw["registerdate"]));
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["msisdn"])
|
||||
->setCellValue('C'.$i,$rw["customername"])
|
||||
->setCellValue('D'.$i,$rw["customeraddress"])
|
||||
->setCellValue('E'.$i,$rw["idcard"])
|
||||
->setCellValue('F'.$i,$registerdate)
|
||||
->setCellValue('G'.$i,$rw["types"])
|
||||
->setCellValue('H'.$i,$rw["iby"])
|
||||
;
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="ANCRegistration.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
150
xlsdoc/xlscellsinfo.php
Normal file
150
xlsdoc/xlscellsinfo.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
//require_once('libconfig.php');
|
||||
//require_once('libhtml.php');
|
||||
//require_once('libmsginfo.php');
|
||||
//require_once('libdefine.php');
|
||||
//require_once('libdbconn.php');
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
//if($idfakultas){$nmfakultas=$cl->fn_get_fieldvalue("namafakultas","select namafakultas from ".DB_UNDIAN.".tbl_fakultas where id='$idfakultas'");}
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL')
|
||||
->setCellValue('A2','Cells Information List')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','Site ID')
|
||||
->setCellValue('C6','Site Name')
|
||||
->setCellValue('D6','Long')
|
||||
->setCellValue('E6','Lat')
|
||||
->setCellValue('F6','2G Cell Name MSC')
|
||||
->setCellValue('G6','3G Cell Name MSC (850)')
|
||||
->setCellValue('H6','3G Cell Name MSC (2100)')
|
||||
->setCellValue('I6','3G Cell Name MSC (2100) 2nd Carrier')
|
||||
->setCellValue('J6','3G Cell Name MSC (2100) 3rd Carrier')
|
||||
->setCellValue('K6','CI 2G')
|
||||
->setCellValue('L6','CI 3G (850)')
|
||||
->setCellValue('M6','CI 3G (2100)')
|
||||
->setCellValue('N6','CI 3G (2100) - 2nd Carrier')
|
||||
->setCellValue('O6','CI 3G (2100) - 3rd Carrier')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:O6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('CellsInfo_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:O6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','O') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$qry="select c.id,c.idsiteid,s.siteid,s.sitename,s.lng,s.lat,c.cell2g,c.cell3g850,c.cell3g2100A,c.cell3g2100B,c.cell3g2100C,c.ci2g,c.ci3g850,c.ci3g2100A,c.ci3g2100B,c.ci3g2100C
|
||||
from ".DB_APORTIL.".tbl_nits_siteslacci s inner join ".DB_APORTIL.".tbl_nits_sitescells c on s.id=c.idsiteid
|
||||
where (s.siteid like '%$keyword%' or s.sitename like '%$keyword%' or c.cell2g like '%$keyword%'
|
||||
or c.cell3g850 like '%$keyword%' or c.cell3g2100A like '%$keyword%' or c.cell3g2100B like '%$keyword%' or c.cell3g2100C like '%$keyword%')
|
||||
and c.isdeleted=0
|
||||
order by c.id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["siteid"])
|
||||
->setCellValue('C'.$i,$rw["sitename"])
|
||||
->setCellValue('D'.$i,$rw["lng"])
|
||||
->setCellValue('E'.$i,$rw["lat"])
|
||||
->setCellValue('F'.$i,$rw["cell2g"])
|
||||
->setCellValue('G'.$i,$rw["cell3g850"])
|
||||
->setCellValue('H'.$i,$rw["cell3g2100A"])
|
||||
->setCellValue('I'.$i,$rw["cell3g2100B"])
|
||||
->setCellValue('J'.$i,$rw["cell3g2100C"])
|
||||
->setCellValue('K'.$i,$rw["ci2g"])
|
||||
->setCellValue('L'.$i,$rw["ci3g850"])
|
||||
->setCellValue('M'.$i,$rw["ci3g2100A"])
|
||||
->setCellValue('N'.$i,$rw["ci3g2100B"])
|
||||
->setCellValue('O'.$i,$rw["ci3g2100C"])
|
||||
;
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="CELLSINFO.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
162
xlsdoc/xlsemplist.php
Normal file
162
xlsdoc/xlsemplist.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL')
|
||||
->setCellValue('A2','Employee List')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','NIK GROUP')
|
||||
->setCellValue('C6','NIK ORIGINAL')
|
||||
->setCellValue('D6','NAMA LENGKAP')
|
||||
->setCellValue('E6','EMPLOYEE GROUP')
|
||||
->setCellValue('F6','EMPLOYEE SUB GROUP')
|
||||
->setCellValue('G6','PERSONAL AREA')
|
||||
->setCellValue('H6','PERSONAL SUB AREA')
|
||||
->setCellValue('I6','OBJIDPOSISI')
|
||||
->setCellValue('J6','NAMA POSISI')
|
||||
->setCellValue('K6','ABBR POSISI')
|
||||
->setCellValue('L6','OBJIDUNIT')
|
||||
->setCellValue('M6','ABBR UNIT')
|
||||
->setCellValue('N6','NAMA UNIT')
|
||||
->setCellValue('O6','LONG UNIT')
|
||||
->setCellValue('P6','PERUSAHAAN')
|
||||
->setCellValue('Q6','TANGGAL LAHIR')
|
||||
->setCellValue('R6','JNS KELAMIN')
|
||||
->setCellValue('S6','KOTA KELAHIRAN')
|
||||
->setCellValue('T6','KEBANGSAAN')
|
||||
->setCellValue('U6','STATUS PERNIKAHAN')
|
||||
->setCellValue('V6','TANGGAL NIKAH')
|
||||
->setCellValue('W6','AGAMA')
|
||||
->setCellValue('X6','ALAMAT TETAP KARYAWAN')
|
||||
->setCellValue('Y6','KOTA TETAP')
|
||||
->setCellValue('Z6','KODEPOS TETAP')
|
||||
->setCellValue('AA6','NEGARA TETAP')
|
||||
->setCellValue('AB6','ALAMAT SMTR KARYAWAN')
|
||||
->setCellValue('AC6','KOTA SEMENTARA')
|
||||
->setCellValue('AD6','KODEPOS SEMENTARA')
|
||||
->setCellValue('AE6','NEGARA SEMENTARA')
|
||||
->setCellValue('AF6','BAND POSISI')
|
||||
->setCellValue('AG6','HANDPHONE')
|
||||
->setCellValue('AH6','EMAIL')
|
||||
->setCellValue('AI6','KODE PA')
|
||||
->setCellValue('AJ6','OBJIDPOSISI PARENT')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:AJ6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('EmployeeInfo_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:AJ6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','AJ') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$qry="select id,nikgroup,nik,fullname,empgroup,empsubgroup,personalarea,personalsubarea,objidposition,
|
||||
positionname,abbrposition,idsubunit,objidunit,abbrunit,unitname,subunitname,companyname,birthday,gender,
|
||||
birthofplace,nation,married,marrieddate,religion,address,town,postalcode,regiondefault,addresstemp,
|
||||
towntemp,postalcodetemp,regiontemp,bandposition,hpnumber,email,codepa,objidpositionparent
|
||||
from ".DB_APORTIL.".tbl_employee
|
||||
where (nikgroup like '%$keyword%' or nik like '%$keyword%' or fullname like '%$keyword%' or positionname like '%$keyword%'
|
||||
or empgroup like '%$keyword%' or unitname like '%$keyword%')
|
||||
and isdeleted=0
|
||||
order by id asc";
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["nikgroup"])
|
||||
->setCellValue('C'.$i,$rw["nik"])
|
||||
->setCellValue('D'.$i,$rw["fullname"])
|
||||
->setCellValue('E'.$i,$rw["empgroup"])
|
||||
->setCellValue('F'.$i,$rw["empsubgroup"])
|
||||
->setCellValue('G'.$i,$rw["personalarea"])
|
||||
->setCellValue('H'.$i,$rw["personalsubarea"])
|
||||
->setCellValue('I'.$i,$rw["objidposition"])
|
||||
->setCellValue('J'.$i,$rw["positionname"])
|
||||
->setCellValue('K'.$i,$rw["abbrposition"])
|
||||
->setCellValue('L'.$i,$rw["objidunit"])
|
||||
->setCellValue('M'.$i,$rw["abbrunit"])
|
||||
->setCellValue('N'.$i,$rw["unitname"])
|
||||
->setCellValue('O'.$i,$rw["subunitname"])
|
||||
->setCellValue('P'.$i,$rw["companyname"])
|
||||
->setCellValue('Q'.$i,$rw["birthday"])
|
||||
->setCellValue('R'.$i,$rw["gender"])
|
||||
->setCellValue('S'.$i,$rw["birthofplace"])
|
||||
->setCellValue('T'.$i,$rw["nation"])
|
||||
->setCellValue('U'.$i,$rw["married"])
|
||||
->setCellValue('V'.$i,$rw["marrieddate"])
|
||||
->setCellValue('W'.$i,$rw["religion"])
|
||||
->setCellValue('X'.$i,$rw["address"])
|
||||
->setCellValue('Y'.$i,$rw["town"])
|
||||
->setCellValue('Z'.$i,$rw["postalcode"])
|
||||
->setCellValue('AA'.$i,$rw["regiondefault"])
|
||||
->setCellValue('AB'.$i,$rw["addresstemp"])
|
||||
->setCellValue('AC'.$i,$rw["towntemp"])
|
||||
->setCellValue('AD'.$i,$rw["postalcodetemp"])
|
||||
->setCellValue('AE'.$i,$rw["regiontemp"])
|
||||
->setCellValue('AF'.$i,$rw["bandposition"])
|
||||
->setCellValue('AG'.$i,$rw["hpnumber"])
|
||||
->setCellValue('AH'.$i,$rw["email"])
|
||||
->setCellValue('AI'.$i,$rw["codepa"])
|
||||
->setCellValue('AJ'.$i,$rw["objidpositionparent"])
|
||||
;
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="RPT_EMPLOYEE'.date("Ymd").'.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
166
xlsdoc/xlshcmabs.php
Normal file
166
xlsdoc/xlshcmabs.php
Normal file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// === Init Vars
|
||||
$month=$_REQUEST['month'];
|
||||
$period=$_REQUEST['period'];
|
||||
$totdays=cal_days_in_month(CAL_GREGORIAN,$month,$period);
|
||||
|
||||
$idemployee=$_REQUEST['idemployee'];
|
||||
$idsubunit=$_REQUEST['idsubunit'];
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','Employee Absence Reporting')
|
||||
->setCellValue('A2','Human Capital '.$_SESSION['employeename'])
|
||||
->setCellValue('A3','Date Reporting : '.date("d/m/Y H:i:s"))
|
||||
->setCellValue('A4','Periode : '.$cl->FN_GETMONTHNAME($month)." $period");
|
||||
|
||||
if($idsubunit)
|
||||
{
|
||||
$subunitname=$cl->fn_get_fieldvalue("subunitname","select subunitname from ".DB_APORTIL.".tbl_employee_subunit where id='$idsubunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5','Sub Unit : '.$subunitname);
|
||||
}
|
||||
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A7','No')
|
||||
->setCellValue('B7','Employee Name')
|
||||
->setCellValue('C7','Nik')
|
||||
->setCellValue('D7','Position')
|
||||
->setCellValue('E7','Dates')
|
||||
->setCellValue('F7','Clock In')
|
||||
->setCellValue('G7','Clock Out')
|
||||
->setCellValue('H7','Reason')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:H7')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Absence_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A7:H7","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','H') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$swhere="";//
|
||||
if($idemployee)
|
||||
{
|
||||
$swhere="a.idemployee='$idemployee' and ";
|
||||
}
|
||||
if($month)
|
||||
{
|
||||
$swhere.="a.months='$month' and ";
|
||||
}
|
||||
if($period)
|
||||
{
|
||||
$swhere.="a.years='$period' and ";
|
||||
}
|
||||
|
||||
$qry="select a.idemployee,e.fullname,e.positionname,a.nik,a.date,a.clockin,a.clockout,a.reason
|
||||
from ".DB_APORTIL.".tbl_employee e inner join ".DB_APORTIL.".tbl_hcm_absence a on e.id=a.idemployee
|
||||
where $swhere a.isdeleted=0 and a.idstatus in (0,3,4)
|
||||
order by a.date asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=8;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$colors="000000";
|
||||
if((int)date("Hi",strtotime($rw['clockin']))>900)
|
||||
{
|
||||
$colors="FF0000";
|
||||
}
|
||||
$phpColor = new PHPExcel_Style_Color();
|
||||
$phpColor->setRGB($colors);
|
||||
$clockout=date("H:i",strtotime($rw['clockout']));
|
||||
if(!$rw['clockout']){$clockout="";}
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["fullname"])
|
||||
->setCellValue('C'.$i,$rw["nik"])
|
||||
->setCellValue('D'.$i,$rw["positionname"])
|
||||
->setCellValue('E'.$i,date("d/m/Y",strtotime($rw['date'])))
|
||||
->setCellValue('F'.$i,date("H:i",strtotime($rw['clockin'])))
|
||||
->setCellValue('G'.$i,$clockout)
|
||||
->setCellValue('H'.$i,$rw['reason'])
|
||||
;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('F'.$i)->getFont()->setColor($phpColor);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('G'.$i)->getFont()->setColor($phpColor);
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="HCM_ABSENCE.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
239
xlsdoc/xlshcmabssbnit.php
Normal file
239
xlsdoc/xlshcmabssbnit.php
Normal file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// === Init Vars
|
||||
$month=$_REQUEST['month'];
|
||||
$period=$_REQUEST['period'];
|
||||
$totdays=cal_days_in_month(CAL_GREGORIAN,$month,$period);
|
||||
|
||||
$idemployee=$_REQUEST['idemployee'];
|
||||
$idsubunit=$_REQUEST['idsubunit'];
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','Employee Absence Reporting')
|
||||
->setCellValue('A2','Human Capital '.$_SESSION['employeename'])
|
||||
->setCellValue('A3','Date Reporting : '.date("d/m/Y H:i:s"))
|
||||
->setCellValue('A4','Periode : '.$cl->FN_GETMONTHNAME($month)." $period");
|
||||
|
||||
if($idsubunit)
|
||||
{
|
||||
$subunitname=$cl->fn_get_fieldvalue("subunitname","select subunitname from ".DB_APORTIL.".tbl_employee_subunit where id='$idsubunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5','Sub Unit : '.$subunitname);
|
||||
}
|
||||
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
//$objPHPExcel->setActiveSheetIndex(0)
|
||||
// ->setCellValue('A7','')
|
||||
// ->setCellValue('B7','')
|
||||
// ->setCellValue('C7','')
|
||||
// ->setCellValue('D7','');
|
||||
|
||||
$style = array(
|
||||
'alignment' => array(
|
||||
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
|
||||
)
|
||||
);
|
||||
// === Dates title
|
||||
$objPHPExcel->getActiveSheet()->mergeCells('A7:D7');
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A7','Dates');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7')->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:D7')->applyFromArray($style);
|
||||
$objPHPExcel->cellColor("A7:D7","938e8e");
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:D7')->getFont()->getColor()->setRGB('ffffff');
|
||||
|
||||
$startcol=69;$endcol=70;$prefix="";$prefixinc=65;
|
||||
for($i=1;$i<=$totdays;$i++)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($startcol).'7')->getFont()->setBold(true);
|
||||
$objPHPExcel->getActiveSheet()->mergeCells($prefix.chr($startcol).'7:'.$prefix.chr($endcol).'7');
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($startcol).'7:'.$prefix.chr($endcol).'7')->applyFromArray($style);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($prefix.chr($startcol).'7',$i." ".$cl->FN_GETMONTHNAME($month));
|
||||
$objPHPExcel->cellColor($prefix.chr($startcol)."7:".$prefix.chr($endcol)."7","938e8e");
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($startcol)."7:".$prefix.chr($endcol)."7")->getFont()->getColor()->setRGB('ffffff');
|
||||
|
||||
$startcol+=2;$endcol+=2;
|
||||
if($startcol>90||$endcol>90){
|
||||
$startcol=65;$endcol=66;
|
||||
$prefix=chr($prefixinc);
|
||||
$prefixinc+=1;
|
||||
}
|
||||
}
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A8','No.')
|
||||
->setCellValue('B8','Name')
|
||||
->setCellValue('C8','Nik')
|
||||
->setCellValue('D8','Position');
|
||||
$prefix="";$prefixinc=65;$j=69;$k=70;$qrydt="";$qrysum="";$lastcol="";
|
||||
for($i=1;$i<=$totdays;$i++)
|
||||
{
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($prefix.chr($j).'8','In');
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($j).'8:'.$prefix.chr($j).'8')->applyFromArray($style);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($prefix.chr($k).'8','Out');
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($k).'8:'.$prefix.chr($k).'8')->applyFromArray($style);
|
||||
$lastcol=$prefix.chr($k).'8';
|
||||
$j+=2;$k+=2;
|
||||
if($j>90||$k>90){
|
||||
$prefix=chr($prefixinc);
|
||||
$prefixinc+=1;$j=65;$k=66;
|
||||
}
|
||||
$qrydt.="case when cast(date_format(a.date,'%d') as integer)='".$i."' and a.clockin<>'' then cast(time_format(a.clockin,'%H%i') as double) else 0 end in_$i,";
|
||||
$qrydt.="case when cast(date_format(a.date,'%d') as integer)='".$i."' and a.clockout<>'' then cast(time_format(a.clockout,'%H%i') as double) else 0 end out_$i,";
|
||||
$qrysum.="sum(x.in_$i) in_$i,sum(x.out_$i) out_$i,";
|
||||
|
||||
}
|
||||
$qrydt=substr($qrydt,0,strlen($qrydt)-1);
|
||||
$qrysum=substr($qrysum,0,strlen($qrysum)-1);
|
||||
|
||||
//$j-=1;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
//$objPHPExcel->getActiveSheet()->getStyle('E9:'.chr($j).'9')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('Absence_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
//$objPHPExcel->cellColor("A7:N7","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
|
||||
// === Set auto COlumn width
|
||||
//$prefix="";$prefixinc=65;$j=69;
|
||||
//foreach(range('B',$lastcol) as $columnID)
|
||||
//{
|
||||
// $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
//}
|
||||
|
||||
// === Data
|
||||
$swhere="";
|
||||
if($idemployee){$swhere="a.idemployee='$idemployee' and ";}
|
||||
if($idsubunit){$swhere.="e.idsubunit='$idsubunit' and ";}
|
||||
|
||||
$qry="select x.nik,x.fullname,x.positionname,$qrysum
|
||||
from
|
||||
(
|
||||
select a.nik,e.fullname,e.positionname,a.islate,a.date,$qrydt
|
||||
from ".DB_APORTIL.".tbl_employee e inner join ".DB_APORTIL.".tbl_hcm_absence a on e.id=a.idemployee
|
||||
where $swhere a.months='$month' and a.years='$period' and a.isdeleted=0
|
||||
group by a.nik,e.fullname,e.positionname,a.date
|
||||
) x group by x.nik,x.fullname,x.positionname";
|
||||
$rsdba=$cl->selectquery($qry);
|
||||
if($rsdba){
|
||||
$i=9;$x=1;
|
||||
while($rw=$cl->data_row_array($rsdba))
|
||||
{
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$x)
|
||||
->setCellValue('B'.$i,$rw["fullname"])
|
||||
->setCellValue('C'.$i,$rw["nik"])
|
||||
->setCellValue('D'.$i,$rw["positionname"]);
|
||||
$prefix="";$prefixinc=65;$m=69;$n=70;
|
||||
for($j=1;$j<=$totdays;$j++)
|
||||
{
|
||||
$valin='-';$colors="000000";$dot="";
|
||||
if($rw["in_$j"]!='0')
|
||||
{
|
||||
$dtin=substr("00000".$rw["in_$j"],strlen("00000".$rw["in_$j"])-4,strlen("00000".$rw["in_$j"]));
|
||||
$timein=substr($dtin,0,2).":".substr($dtin,strlen($dtin)-2,strlen($dtin));
|
||||
//$valin=date("H",strtotime($rw["in_$j"]))."<sup>".date("i",strtotime($rw["in_$j"]));
|
||||
$valin=date("H",strtotime($timein)).":".date("i",strtotime($timein));
|
||||
//if(date("Hi",strtotime($rw["in_$j"]))>900){$color="red";}
|
||||
if($rw["in_$j"]>900){$colors="FF0000";}
|
||||
$dot=".";
|
||||
}
|
||||
$valout='-';
|
||||
if($rw["out_$j"]!='0'){$valout=date("H",strtotime($rw["out_$j"])).":".date("i",strtotime($rw["out_$j"]));}
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($prefix.chr($m).$i,$valin);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($m).$i.':'.$prefix.chr($m).$i)->applyFromArray($style);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($prefix.chr($n).$i,$valout);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($n).$i.':'.$prefix.chr($n).$i)->applyFromArray($style);
|
||||
|
||||
$phpColor = new PHPExcel_Style_Color();
|
||||
$phpColor->setRGB($colors);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($m).$i)->getFont()->setColor($phpColor);
|
||||
$objPHPExcel->getActiveSheet()->getStyle($prefix.chr($n).$i)->getFont()->setColor($phpColor);
|
||||
|
||||
$m+=2;$n+=2;
|
||||
if($m>90||$n>90){
|
||||
$prefix=chr($prefixinc);
|
||||
$prefixinc+=1;$m=65;$n=66;
|
||||
}
|
||||
}
|
||||
$x+=1;$i+=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="HCM_ABSENCE.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
212
xlsdoc/xlshcmleave.php
Normal file
212
xlsdoc/xlshcmleave.php
Normal file
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// === Init Vars
|
||||
$month1=$_REQUEST['month1'];
|
||||
$period1=$_REQUEST['period1'];
|
||||
$month2=$_REQUEST['month2'];
|
||||
$period2=$_REQUEST['period2'];
|
||||
|
||||
$idemployee=$_REQUEST['idemployee'];
|
||||
$idunit=$_REQUEST['idunit'];
|
||||
$idsubunit=$_REQUEST['idsubunit'];
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','Employee Leave Reporting')
|
||||
->setCellValue('A2','Human Capital '.$_SESSION['employeename'])
|
||||
->setCellValue('A3','Date Reporting : '.date("d/m/Y H:i:s"))
|
||||
->setCellValue('A4','Periode : '.$cl->FN_GETMONTHNAME($month1)." $period1 s/d ".$cl->FN_GETMONTHNAME($month2)." $period2");
|
||||
|
||||
if($idunit)
|
||||
{
|
||||
$unitname=$cl->fn_get_fieldvalue("unitname","select unitname from ".DB_APORTIL.".tbl_employee_unit where id='$idunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5','Unit : '.$unitname);
|
||||
}
|
||||
if($idsubunit)
|
||||
{
|
||||
$subunitname=$cl->fn_get_fieldvalue("subunitname","select subunitname from ".DB_APORTIL.".tbl_employee_subunit where id='$idsubunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A6','Sub Unit : '.$subunitname);
|
||||
}
|
||||
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A7','No')
|
||||
->setCellValue('B7','Nik')
|
||||
->setCellValue('C7','Employee Name')
|
||||
->setCellValue('D7','Position')
|
||||
->setCellValue('E7','Band')
|
||||
->setCellValue('F7','Hari')
|
||||
->setCellValue('G7','Tgl')
|
||||
->setCellValue('H7','Start')
|
||||
->setCellValue('I7','End')
|
||||
->setCellValue('J7','Lama Lembur ( Menit )')
|
||||
->setCellValue('K7','Lama Lembur ( Jam )')
|
||||
//->setCellValue('L7','Over ( Jam )')
|
||||
->setCellValue('L7','Hari Lembur')
|
||||
->setCellValue('M7','Deskripsi')
|
||||
->setCellValue('N7','User')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:N7')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('OVERTIME_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A7:N7","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','N') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$swhere="";
|
||||
if($month1&&$month2)
|
||||
{
|
||||
$dt1=date("Y-m-d",strtotime($period1."-".$month1."-01"));
|
||||
$dt2=date("Y-m-d",strtotime($period2."-".$month2."-01"));
|
||||
$swhere="cast(l.overtime_date as date) between cast('$dt1' as date) and cast('$dt2' as date) and ";
|
||||
}
|
||||
if($idemployee)
|
||||
{
|
||||
$swhere.="e.id='$idemployee' and ";
|
||||
}
|
||||
if($idunit)
|
||||
{
|
||||
$swhere.="e.idunit='$idunit' and ";
|
||||
}
|
||||
if($idsubunit)
|
||||
{
|
||||
$swhere.="e.idsubunit='$idsubunit' and ";
|
||||
}
|
||||
|
||||
$qry="select l.id, l.id_employee, l.nik, l.empgroup, l.fullname, l.title, l.date, l.overtime_date,
|
||||
l.end_date, l.start_hour, l.end_hour, l.total_duration, l.task, l.user, l.status_approval, l.description
|
||||
from ".DB_APORTIL.".tbl_employee e inner join ".DB_APORTIL.".tbl_hcm_lembur l on e.id=l.id_employee
|
||||
where $swhere l.isdeleted=0
|
||||
order by l.id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=8;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$bandposition=$cl->fn_get_fieldvalue("bandposition","select bandposition from ".DB_APORTIL.".tbl_employee where id='".$rw['id_employee']."'");
|
||||
$days=date("l",strtotime($rw['overtime_date']));
|
||||
$colors="000000";
|
||||
if(strtolower($days)!='saturday'&&strtolower($days)!='sunday')
|
||||
{
|
||||
//if(strtotime($rw->start_hour)>=strtotime("18:00:00"&&strtotime($rw->end_hour)<=strtotime("21:00:00")))
|
||||
$dayscategory="Weekdays";
|
||||
if(strtotime($rw['end_hour'])>strtotime("21:00:00"))
|
||||
{
|
||||
$dayscategory="Weekdays Night";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$colors="FF0000";
|
||||
$dayscategory="Weekend";
|
||||
}
|
||||
$durationmenit=$rw['total_duration'];
|
||||
$durationhour=round(($rw['total_duration']/60),2);
|
||||
$over=0;
|
||||
if($durationhour>5)
|
||||
{
|
||||
$over=($durationhour%5);
|
||||
}
|
||||
$phpColor = new PHPExcel_Style_Color();
|
||||
$phpColor->setRGB($colors);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["nik"])
|
||||
->setCellValue('C'.$i,$rw["fullname"])
|
||||
->setCellValue('D'.$i,$rw["title"])
|
||||
->setCellValue('E'.$i,$bandposition)
|
||||
->setCellValue('F'.$i,$days)
|
||||
->setCellValue('G'.$i,date("d/m/Y",strtotime($rw['overtime_date'])))
|
||||
->setCellValue('H'.$i,date("H:i",strtotime($rw['start_hour'])))
|
||||
->setCellValue('I'.$i,date("H:i",strtotime($rw['end_hour'])))
|
||||
->setCellValue('J'.$i,$durationmenit)
|
||||
->setCellValue('K'.$i,$durationhour)
|
||||
// ->setCellValue('L'.$i,$over)
|
||||
->setCellValue('L'.$i,$dayscategory)
|
||||
->setCellValue('M'.$i,$rw['task'])
|
||||
->setCellValue('N'.$i,$rw['user'])
|
||||
;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('L'.$i)->getFont()->setColor($phpColor);
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="HCM_OVERTIME.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
181
xlsdoc/xlshcmleavemn.php
Normal file
181
xlsdoc/xlshcmleavemn.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// === Init Vars
|
||||
$ismonthly=$_REQUEST['ismonthly'];
|
||||
$month=$_REQUEST['month'];
|
||||
$period=$_REQUEST['period'];
|
||||
$idemployee=$_REQUEST['idemployee'];
|
||||
$idsubunit=$_REQUEST['idsubunit'];
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','Employee Leave Reporting')
|
||||
->setCellValue('A2','Human Capital '.$_SESSION['employeename'])
|
||||
->setCellValue('A3','Date Reporting : '.date("d/m/Y H:i:s"))
|
||||
->setCellValue('A4','Periode : '.$cl->FN_GETMONTHNAME($month)." $period");
|
||||
|
||||
|
||||
if($idsubunit)
|
||||
{
|
||||
$subunitname=$cl->fn_get_fieldvalue("subunitname","select subunitname from ".DB_APORTIL.".tbl_employee_subunit where id='$idsubunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5','Sub Unit : '.$subunitname);
|
||||
}
|
||||
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A7','No')
|
||||
->setCellValue('B7','Name')
|
||||
->setCellValue('C7','Nik')
|
||||
->setCellValue('D7','Position')
|
||||
->setCellValue('E7','Status')
|
||||
->setCellValue('F7','Leave Category')
|
||||
->setCellValue('G7','Submit Date')
|
||||
->setCellValue('H7','Start Date')
|
||||
->setCellValue('I7','End Date')
|
||||
->setCellValue('J7','Leave Days')
|
||||
->setCellValue('K7','Approval 1')
|
||||
->setCellValue('L7','Approval 2')
|
||||
->setCellValue('M7','Excess')
|
||||
;
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('LEAVEINFO_'.date("Ym"));
|
||||
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:M7')->getFont()->getColor()->setRGB('ffffff');
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A7:M7","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','M') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
// Data
|
||||
$swhere="";
|
||||
if($idemployee){$swhere="e.id='$idemployee' and ";}
|
||||
if($idsubunit){$swhere.="e.idsubunit='$idsubunit' and ";}
|
||||
if($month){$swhere.="month(d.startdate)='$month' and ";}
|
||||
$qry="select e.id idemployee,e.nik,e.fullname,e.positionname,d.id idleavedata,d.leavetype,d.startdate,d.enddate,d.hcmdurationdays,
|
||||
d.fullnameapproval approval1,d.fullnameapproval2 approval2,d.credit,d.status
|
||||
from tbl_employee e inner join tbl_hcm_leavedata d on e.id=d.idemployee
|
||||
where $swhere d.isdeleted=0 and d.status>=-1";
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=8;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$qry="select description from tbl_hcm_leavestatus where status='".$rw['status']."' and isdeleted=0";
|
||||
$statusdescription=$cl->fn_get_fieldvalue("description",$qry);
|
||||
|
||||
$qry="select idt dates from tbl_hcm_leavedatahistory where idheader='".$rw['idleavedata']."' and status=0 and isdeleted=0 order by id asc limit 1";
|
||||
$sd=$cl->fn_get_fieldvalue("dates",$qry);
|
||||
$submitdate="";
|
||||
if($sd&&(int)$sd!=0){$submitdate=date("Y-m-d H:i:s",strtotime($sd));}
|
||||
|
||||
$qry="select idt dates from tbl_hcm_leavedatahistory where idheader='".$rw['idleavedata']."' and status=2 and isdeleted=0 order by id asc limit 1";
|
||||
$sd=$cl->fn_get_fieldvalue("dates",$qry);
|
||||
$appdate1="";
|
||||
if($sd&&(int)$sd!=0&&$rw['approval1']){$appdate1=date("Y-m-d H:i:s",strtotime($sd));}
|
||||
|
||||
$qry="select idt dates from tbl_hcm_leavedatahistory where idheader='".$rw['idleavedata']."' and status=5 and isdeleted=0 order by id asc limit 1";
|
||||
$sd=$cl->fn_get_fieldvalue("dates",$qry);
|
||||
$appdate2="";
|
||||
if($sd&&(int)$sd!=0){$appdate2=date("Y-m-d H:i:s",strtotime($sd));}
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["fullname"])
|
||||
->setCellValue('C'.$i,$rw["nik"])
|
||||
->setCellValue('D'.$i,$rw["positionname"])
|
||||
->setCellValue('E'.$i,$statusdescription)
|
||||
->setCellValue('F'.$i,$rw["leavetype"])
|
||||
->setCellValue('G'.$i,$submitdate)
|
||||
->setCellValue('H'.$i,date("d/m/Y",strtotime($rw['startdate'])))
|
||||
->setCellValue('I'.$i,date("d/m/Y",strtotime($rw['enddate'])))
|
||||
->setCellValue('J'.$i,$rw['hcmdurationdays'])
|
||||
->setCellValue('K'.$i,$rw['approval1']." ".$appdate1)
|
||||
->setCellValue('L'.$i,$rw['approval2']." ".$appdate2)
|
||||
->setCellValue('M'.$i,$rw['credit'])
|
||||
;
|
||||
$colors="000000";
|
||||
if($rw['credit']<0){$colors="FF0000";}
|
||||
$phpColor = new PHPExcel_Style_Color();
|
||||
$phpColor->setRGB($colors);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('M'.$i)->getFont()->setColor($phpColor);
|
||||
$i+=1;$j+=1;
|
||||
$j+=1;
|
||||
}
|
||||
$rowcount=$j-1;
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
|
||||
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="HCM_LEAVEINFO.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
231
xlsdoc/xlshcmleaveyr.php
Normal file
231
xlsdoc/xlshcmleaveyr.php
Normal file
@ -0,0 +1,231 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// === Init Vars
|
||||
$ismonthly=$_REQUEST['ismonthly'];
|
||||
$month=$_REQUEST['month'];
|
||||
$period=$_REQUEST['period'];
|
||||
$idemployee=$_REQUEST['idemployee'];
|
||||
$idsubunit=$_REQUEST['idsubunit'];
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','Employee Leave Reporting')
|
||||
->setCellValue('A2','Human Capital '.$_SESSION['employeename'])
|
||||
->setCellValue('A3','Date Reporting : '.date("d/m/Y H:i:s"))
|
||||
->setCellValue('A4','Periode : '.$period);
|
||||
|
||||
|
||||
if($idsubunit)
|
||||
{
|
||||
$subunitname=$cl->fn_get_fieldvalue("subunitname","select subunitname from ".DB_APORTIL.".tbl_employee_subunit where id='$idsubunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5','Sub Unit : '.$subunitname);
|
||||
}
|
||||
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A7','No')
|
||||
->setCellValue('B7','Nik')
|
||||
->setCellValue('C7','Employee Name')
|
||||
->setCellValue('D7','Subunit')
|
||||
;
|
||||
$style = array(
|
||||
'alignment' => array(
|
||||
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||
'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
|
||||
)
|
||||
);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->mergeCells('A7:A8');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:A8')->applyFromArray($style);
|
||||
$objPHPExcel->getActiveSheet()->mergeCells('B7:B8');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('B7:B8')->applyFromArray($style);
|
||||
$objPHPExcel->getActiveSheet()->mergeCells('C7:C8');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('C7:C8')->applyFromArray($style);
|
||||
$objPHPExcel->getActiveSheet()->mergeCells('D7:D8');
|
||||
$objPHPExcel->getActiveSheet()->getStyle('D7:D8')->applyFromArray($style);
|
||||
|
||||
$arrheader=array();$qryheader="";$qrydetail="";
|
||||
$qry="select distinct leavetype from tbl_hcm_leavetype where isdeleted=0";
|
||||
$rs=$cl->selectquery($qry);
|
||||
if($rs)
|
||||
{
|
||||
$i=0;$startcol=69;$endcol=71;
|
||||
while($rw=$cl->data_row_object($rs))
|
||||
{
|
||||
//$html.="<th colspan='3' valign='top' width='90px' style='text-align:center;border-bottom:1px dotted black;border-right:1px dotted black'>".$rw->leavetype."</th>";
|
||||
$objPHPExcel->getActiveSheet()->mergeCells(chr($startcol).'7:'.chr($endcol).'7');
|
||||
$objPHPExcel->getActiveSheet()->getStyle(chr($startcol).'7:'.chr($endcol).'7')->applyFromArray($style);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue(chr($startcol).'7',$rw->leavetype);
|
||||
|
||||
$arrheader[$i]=$rw->leavetype;
|
||||
$i+=1;$startcol+=3;$endcol+=3;
|
||||
}
|
||||
}
|
||||
$x1=69;$x2=70;$x3=71;$j=0;
|
||||
for($i=0;$i<count($arrheader);$i++)
|
||||
{
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue(chr($x1).'8','Tot');
|
||||
$objPHPExcel->getActiveSheet()->getStyle(chr($x1).'8:'.chr($x1).'8')->applyFromArray($style);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue(chr($x2).'8','LV');
|
||||
$objPHPExcel->getActiveSheet()->getStyle(chr($x2).'8:'.chr($x2).'8')->applyFromArray($style);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue(chr($x3).'8','Cr');
|
||||
$objPHPExcel->getActiveSheet()->getStyle(chr($x3).'8:'.chr($x3).'8')->applyFromArray($style);
|
||||
$objPHPExcel->cellColor(chr($x1).'8:'.chr($x3).'8',"bdc3c7");
|
||||
$x1+=3;$x2+=3;$x3+=3;
|
||||
// === // qry detail
|
||||
$qrydetail.="case when l.leavetype='".$arrheader[$i]."' then l.leave_total else 0 end tt$j,";
|
||||
//$qrydetail.="case when l.leavetype='".$arrheader[$i]."' and not(d.hcmdurationdays is null) then sum(d.hcmdurationdays) else 0 end t$j,";
|
||||
|
||||
//$qryheader.="sum(x.tt$j) tt$j,sum(x.t$j) t$j,";
|
||||
$qryheader.="sum(x.tt$j) tt$j,";
|
||||
$j+=1;
|
||||
}
|
||||
$qryheader=substr($qryheader,0,strlen($qryheader)-1);
|
||||
$qrydetail=substr($qrydetail,0,strlen($qrydetail)-1);
|
||||
|
||||
// === Merge Cells
|
||||
$objPHPExcel->getActiveSheet()->getStyle('E7:'.chr($endcol-3).'7')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('LEAVEINFO_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("E7:".chr($endcol-3)."7","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(10);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
// === Data
|
||||
$swhere="";
|
||||
if($idemployee){$swhere="e.id='$idemployee' and ";}
|
||||
if($idsubunit){$swhere.="e.idsubunit='$idsubunit' and ";}
|
||||
$qry="select id,nik,fullname,idempgroup,subunitname,idgender
|
||||
from ".DB_APORTIL.".tbl_employee where $swhere isdeleted=0
|
||||
order by bandposition,objidposition asc";
|
||||
$qry="select x.id idemployee,x.nik,x.fullname,x.subunitname,x.idgender,x.bandposition,x.objidposition,
|
||||
$qryheader
|
||||
from
|
||||
(
|
||||
select e.id,e.nik,e.fullname,e.subunitname,e.bandposition,e.objidposition,e.idgender,$qrydetail
|
||||
from (tbl_employee e inner join tbl_hcm_leavetype l on e.idempgroup=l.idempgroup)
|
||||
where $swhere e.isdeleted=0
|
||||
order by e.bandposition,e.objidposition asc
|
||||
) x group by x.id,x.nik,x.fullname
|
||||
order by x.bandposition,x.objidposition asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$j=1;$n=9;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$n,$j)
|
||||
->setCellValue('B'.$n,$rw["nik"])
|
||||
->setCellValue('C'.$n,$rw["fullname"])
|
||||
->setCellValue('D'.$n,$rw["subunitname"]);
|
||||
$x1=69;$x2=70;$x3=71;
|
||||
for($i=0;$i<count($arrheader);$i++)
|
||||
{
|
||||
//echo $arrheader[$i];
|
||||
//echo $rw->id
|
||||
$total=$rw["tt".$i];
|
||||
$swheremonth="";
|
||||
if($month){$swheremonth="and month(startdate)=$month";}
|
||||
|
||||
$qrytake="select sum(hcmdurationdays) take
|
||||
from ".DB_APORTIL.".tbl_hcm_leavedata
|
||||
where idemployee='".$rw['idemployee']."' and leavetype='".$arrheader[$i]."'
|
||||
and period='$period' and isdeleted=0 and status>=-1 $swheremonth";
|
||||
//echo $qrytake."</br>";
|
||||
$take=$cl->fn_get_fieldvalue("take",$qrytake);
|
||||
if(!$take){$take=0;}
|
||||
//$take=$rw1["t".$i];
|
||||
$credit=$total-$take;
|
||||
//$credit=$rw1["tt".$i]-$rw1["t".$i];
|
||||
if($arrheader[$i]=="Maternity"&&$rw['idgender']==1){
|
||||
$total=0;$take=0;$credit=0;
|
||||
}
|
||||
$color="black";
|
||||
if($credit<0){$color="red";}
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue(chr($x1).$n,$total)
|
||||
->setCellValue(chr($x2).$n,$take)
|
||||
->setCellValue(chr($x3).$n,$credit);
|
||||
$colors="000000";
|
||||
if($credit<0){$colors="FF0000";}
|
||||
$phpColor = new PHPExcel_Style_Color();
|
||||
$phpColor->setRGB($colors);
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle(chr($x3).$n)->getFont()->setColor($phpColor);
|
||||
$x1+=3;$x2+=3;$x3+=3;
|
||||
|
||||
}
|
||||
$j+=1;
|
||||
$n+=1;
|
||||
}
|
||||
|
||||
}
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="HCM_LEAVEINFO.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
212
xlsdoc/xlshcmovertime.php
Normal file
212
xlsdoc/xlshcmovertime.php
Normal file
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Asia/Tokyo');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// === Init Vars
|
||||
$month1=$_REQUEST['month1'];
|
||||
$period1=$_REQUEST['period1'];
|
||||
$month2=$_REQUEST['month2'];
|
||||
$period2=$_REQUEST['period2'];
|
||||
|
||||
$idemployee=$_REQUEST['idemployee'];
|
||||
$idunit=$_REQUEST['idunit'];
|
||||
$idsubunit=$_REQUEST['idsubunit'];
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','Employee Overtime Reporting')
|
||||
->setCellValue('A2','Human Capital '.$_SESSION['employeename'])
|
||||
->setCellValue('A3','Date Reporting : '.date("d/m/Y H:i:s"))
|
||||
->setCellValue('A4','Periode : '.$cl->FN_GETMONTHNAME($month1)." $period1 s/d ".$cl->FN_GETMONTHNAME($month2)." $period2");
|
||||
|
||||
if($idunit)
|
||||
{
|
||||
$unitname=$cl->fn_get_fieldvalue("unitname","select unitname from ".DB_APORTIL.".tbl_employee_unit where id='$idunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5','Unit : '.$unitname);
|
||||
}
|
||||
if($idsubunit)
|
||||
{
|
||||
$subunitname=$cl->fn_get_fieldvalue("subunitname","select subunitname from ".DB_APORTIL.".tbl_employee_subunit where id='$idsubunit'");
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A6','Sub Unit : '.$subunitname);
|
||||
}
|
||||
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A7','No')
|
||||
->setCellValue('B7','Nik')
|
||||
->setCellValue('C7','Employee Name')
|
||||
->setCellValue('D7','Position')
|
||||
->setCellValue('E7','Band')
|
||||
->setCellValue('F7','Hari')
|
||||
->setCellValue('G7','Tgl')
|
||||
->setCellValue('H7','Start')
|
||||
->setCellValue('I7','End')
|
||||
->setCellValue('J7','Lama Lembur ( Menit )')
|
||||
->setCellValue('K7','Lama Lembur ( Jam )')
|
||||
//->setCellValue('L7','Over ( Jam )')
|
||||
->setCellValue('L7','Hari Lembur')
|
||||
->setCellValue('M7','Deskripsi')
|
||||
->setCellValue('N7','User')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A7:N7')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('OVERTIME_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A7:N7","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','N') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$swhere="";
|
||||
if($month1&&$month2)
|
||||
{
|
||||
$dt1=date("Y-m-d",strtotime($period1."-".$month1."-01"));
|
||||
$dt2=date("Y-m-d",strtotime($period2."-".((int)$month2+1)."-01"));
|
||||
$swhere="cast(l.overtime_date as date) between cast('$dt1' as date) and cast('$dt2' as date) and ";
|
||||
}
|
||||
if($idemployee)
|
||||
{
|
||||
$swhere.="e.id='$idemployee' and ";
|
||||
}
|
||||
if($idunit)
|
||||
{
|
||||
$swhere.="e.idunit='$idunit' and ";
|
||||
}
|
||||
if($idsubunit)
|
||||
{
|
||||
$swhere.="e.idsubunit='$idsubunit' and ";
|
||||
}
|
||||
|
||||
$qry="select l.id, l.id_employee, l.nik, l.empgroup, l.fullname, l.title, l.date, l.overtime_date,
|
||||
l.end_date, l.start_hour, l.end_hour, l.total_duration, l.task, l.user, l.status_approval, l.description
|
||||
from ".DB_APORTIL.".tbl_employee e inner join ".DB_APORTIL.".tbl_hcm_lembur l on e.id=l.id_employee
|
||||
where $swhere l.isdeleted=0
|
||||
order by l.id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=8;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$bandposition=$cl->fn_get_fieldvalue("bandposition","select bandposition from ".DB_APORTIL.".tbl_employee where id='".$rw['id_employee']."'");
|
||||
$days=date("l",strtotime($rw['overtime_date']));
|
||||
$colors="000000";
|
||||
if(strtolower($days)!='saturday'&&strtolower($days)!='sunday')
|
||||
{
|
||||
//if(strtotime($rw->start_hour)>=strtotime("18:00:00"&&strtotime($rw->end_hour)<=strtotime("21:00:00")))
|
||||
$dayscategory="Weekdays";
|
||||
if(strtotime($rw['end_hour'])>strtotime("21:00:00"))
|
||||
{
|
||||
$dayscategory="Weekdays Night";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$colors="FF0000";
|
||||
$dayscategory="Weekend";
|
||||
}
|
||||
$durationmenit=$rw['total_duration'];
|
||||
$durationhour=round(($rw['total_duration']/60),2);
|
||||
$over=0;
|
||||
if($durationhour>5)
|
||||
{
|
||||
$over=($durationhour%5);
|
||||
}
|
||||
$phpColor = new PHPExcel_Style_Color();
|
||||
$phpColor->setRGB($colors);
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["nik"])
|
||||
->setCellValue('C'.$i,$rw["fullname"])
|
||||
->setCellValue('D'.$i,$rw["title"])
|
||||
->setCellValue('E'.$i,$bandposition)
|
||||
->setCellValue('F'.$i,$days)
|
||||
->setCellValue('G'.$i,date("d/m/Y",strtotime($rw['overtime_date'])))
|
||||
->setCellValue('H'.$i,date("H:i",strtotime($rw['start_hour'])))
|
||||
->setCellValue('I'.$i,date("H:i",strtotime($rw['end_hour'])))
|
||||
->setCellValue('J'.$i,$durationmenit)
|
||||
->setCellValue('K'.$i,$durationhour)
|
||||
// ->setCellValue('L'.$i,$over)
|
||||
->setCellValue('L'.$i,$dayscategory)
|
||||
->setCellValue('M'.$i,$rw['task'])
|
||||
->setCellValue('N'.$i,$rw['user'])
|
||||
;
|
||||
$objPHPExcel->getActiveSheet()->getStyle('L'.$i)->getFont()->setColor($phpColor);
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="HCM_OVERTIME.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
157
xlsdoc/xlsreguser.php
Normal file
157
xlsdoc/xlsreguser.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
//require_once('libconfig.php');
|
||||
//require_once('libhtml.php');
|
||||
//require_once('libmsginfo.php');
|
||||
//require_once('libdefine.php');
|
||||
//require_once('libdbconn.php');
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
//if($idfakultas){$nmfakultas=$cl->fn_get_fieldvalue("namafakultas","select namafakultas from ".DB_UNDIAN.".tbl_fakultas where id='$idfakultas'");}
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL 4GLTE')
|
||||
->setCellValue('A2','Registrant List')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','Site ID')
|
||||
->setCellValue('C6','Site Name')
|
||||
->setCellValue('D6','Site Type')
|
||||
->setCellValue('E6','Band')
|
||||
->setCellValue('F6','Lng')
|
||||
->setCellValue('G6','Lat')
|
||||
->setCellValue('H6','2G Frekuensi')
|
||||
->setCellValue('I6','3G Frekuensi')
|
||||
->setCellValue('J6','4G Frekuensi')
|
||||
->setCellValue('K6','Position')
|
||||
->setCellValue('L6','District')
|
||||
->setCellValue('M6','Subdistrict')
|
||||
->setCellValue('N6','Suco')
|
||||
->setCellValue('O6','Time On')
|
||||
->setCellValue('P6','Cluster Area')
|
||||
->setCellValue('Q6','Tower Height')
|
||||
->setCellValue('R6','Owner')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:R6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('SITEINFO_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:R6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','R') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$qry="select id,siteid,sitename,idsitetypes,sitetype,band,lng,lat,2G,3G,4G,position,district,subdistrict,suco,onair,clusterarea,towerheight,owner
|
||||
from ".DB_APORTIL.".tbl_nits_siteslacci
|
||||
where (siteid like '%$keyword%' or sitename like '%$keyword%' or band like '%$keyword%' or sitetype like '%$keyword%')
|
||||
and isdeleted=0
|
||||
order by id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$timeon="";
|
||||
if($rw["onair"]){$timeon=date("Y-m-d",strtotime($row["onair"]));}
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["siteid"])
|
||||
->setCellValue('C'.$i,$rw["sitename"])
|
||||
->setCellValue('D'.$i,$rw["sitetype"])
|
||||
->setCellValue('E'.$i,$rw["band"])
|
||||
->setCellValue('F'.$i,$rw["lng"])
|
||||
->setCellValue('G'.$i,$rw["lat"])
|
||||
->setCellValue('H'.$i,$rw["2G"])
|
||||
->setCellValue('I'.$i,$rw["3G"])
|
||||
->setCellValue('J'.$i,$rw["4G"])
|
||||
->setCellValue('K'.$i,$rw["position"])
|
||||
->setCellValue('L'.$i,$rw["district"])
|
||||
->setCellValue('M'.$i,$rw["subdistrict"])
|
||||
->setCellValue('N'.$i,$rw["suco"])
|
||||
->setCellValue('O'.$i,$timeon)
|
||||
->setCellValue('P'.$i,$rw["clusterarea"])
|
||||
->setCellValue('Q'.$i,$rw["towerheight"])
|
||||
->setCellValue('R'.$i,$rw["owner"])
|
||||
;
|
||||
$i+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="SITEINFO.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
158
xlsdoc/xlssiteinfo.php
Normal file
158
xlsdoc/xlssiteinfo.php
Normal file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (C) 2006 - 2013 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 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.7.9, 2013-06-02
|
||||
*/
|
||||
|
||||
/** Error reporting */
|
||||
//require_once('libconfig.php');
|
||||
//require_once('libhtml.php');
|
||||
//require_once('libmsginfo.php');
|
||||
//require_once('libdefine.php');
|
||||
//require_once('libdbconn.php');
|
||||
|
||||
$keyword=$_REQUEST['keyword'];
|
||||
$cl=new MY_HTML();
|
||||
//if($idfakultas){$nmfakultas=$cl->fn_get_fieldvalue("namafakultas","select namafakultas from ".DB_UNDIAN.".tbl_fakultas where id='$idfakultas'");}
|
||||
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', TRUE);
|
||||
ini_set('display_startup_errors', TRUE);
|
||||
date_default_timezone_set('Europe/London');
|
||||
|
||||
if (PHP_SAPI == 'cli')
|
||||
die('This example should only be run from a Web Browser');
|
||||
|
||||
/** Include PHPExcel */
|
||||
|
||||
require_once 'Classes/PHPExcel.php';
|
||||
if(preg_match("/^windows/i",strtolower(php_uname()))){PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);}
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
// My data
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A1','TELKOMCEL')
|
||||
->setCellValue('A2','Site Information List')
|
||||
->setCellValue('A3','Reported By : '.$_SESSION['nik']);
|
||||
|
||||
// set format cell
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
|
||||
|
||||
|
||||
// Print Header
|
||||
$objPHPExcel->setActiveSheetIndex(0)
|
||||
->setCellValue('A6','No')
|
||||
->setCellValue('B6','Site ID')
|
||||
->setCellValue('C6','Site Name')
|
||||
->setCellValue('D6','Site Type')
|
||||
->setCellValue('E6','Band')
|
||||
->setCellValue('F6','Lng')
|
||||
->setCellValue('G6','Lat')
|
||||
->setCellValue('H6','2G Frekuensi')
|
||||
->setCellValue('I6','3G Frekuensi')
|
||||
->setCellValue('J6','4G Frekuensi')
|
||||
->setCellValue('K6','Position')
|
||||
->setCellValue('L6','District')
|
||||
->setCellValue('M6','Subdistrict')
|
||||
->setCellValue('N6','Suco')
|
||||
->setCellValue('O6','Time On')
|
||||
->setCellValue('P6','Cluster Area')
|
||||
->setCellValue('Q6','Tower Height')
|
||||
->setCellValue('R6','Owner')
|
||||
;
|
||||
|
||||
// === Merge Cells
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('G5:H5');
|
||||
//$objPHPExcel->getActiveSheet()->mergeCells('I5:J5');
|
||||
|
||||
$objPHPExcel->getActiveSheet()->getStyle('A6:R6')->getFont()->getColor()->setRGB('ffffff');
|
||||
// Worksheet Name
|
||||
$objPHPExcel->getActiveSheet()->setTitle('SITEINFO_'.date("Ym"));
|
||||
|
||||
// === Set Background Cell
|
||||
$objPHPExcel->cellColor("A6:R6","938e8e");
|
||||
|
||||
// === set Column Width A
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(6);
|
||||
// === Set auto COlumn width
|
||||
foreach(range('B','R') as $columnID)
|
||||
{
|
||||
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
|
||||
$qry="select id,siteid,sitename,idsitetypes,sitetype,band,lng,lat,2G,3G,4G,position,district,subdistrict,suco,onair,clusterarea,towerheight,owner
|
||||
from ".DB_APORTIL.".tbl_nits_siteslacci
|
||||
where (siteid like '%$keyword%' or sitename like '%$keyword%' or band like '%$keyword%' or sitetype like '%$keyword%')
|
||||
and isdeleted=0
|
||||
order by id asc";
|
||||
|
||||
$rsrpt=$cl->selectquery($qry);
|
||||
if($rsrpt)
|
||||
{
|
||||
$i=7;$j=1;
|
||||
while($rw=$cl->data_row_array($rsrpt))
|
||||
{
|
||||
$timeon="";
|
||||
if($rw["onair"]){$timeon=date("Y-m-d",strtotime($row["onair"]));}
|
||||
|
||||
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$i,$j)
|
||||
->setCellValue('B'.$i,$rw["siteid"])
|
||||
->setCellValue('C'.$i,$rw["sitename"])
|
||||
->setCellValue('D'.$i,$rw["sitetype"])
|
||||
->setCellValue('E'.$i,$rw["band"])
|
||||
->setCellValue('F'.$i,$rw["lng"])
|
||||
->setCellValue('G'.$i,$rw["lat"])
|
||||
->setCellValue('H'.$i,$rw["2G"])
|
||||
->setCellValue('I'.$i,$rw["3G"])
|
||||
->setCellValue('J'.$i,$rw["4G"])
|
||||
->setCellValue('K'.$i,$rw["position"])
|
||||
->setCellValue('L'.$i,$rw["district"])
|
||||
->setCellValue('M'.$i,$rw["subdistrict"])
|
||||
->setCellValue('N'.$i,$rw["suco"])
|
||||
->setCellValue('O'.$i,$timeon)
|
||||
->setCellValue('P'.$i,$rw["clusterarea"])
|
||||
->setCellValue('Q'.$i,$rw["towerheight"])
|
||||
->setCellValue('R'.$i,$rw["owner"])
|
||||
;
|
||||
$i+=1;$j+=1;
|
||||
}
|
||||
}
|
||||
$cl->clearrecordset($rsrpt);
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a web browser (Excel2007)
|
||||
//header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="SITEINFO.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
|
||||
$objWriter->save('php://output');
|
||||
exit;
|
||||
?>
|
||||
Reference in New Issue
Block a user