| Server IP : 31.14.161.123 / Your IP : 216.73.216.229 Web Server : Apache System : Linux cpanel.classit.ro 4.18.0-553.144.1.el8_10.x86_64 #1 SMP Tue Jul 14 09:26:58 EDT 2026 x86_64 User : diamedic ( 1014) PHP Version : 8.2.32 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/diamedic/public_html/exemple/ |
Upload File : |
<?php
/**
* PHPExcel
*/
/** Error reporting */
// error_reporting(E_ALL);
// ini_set('display_errors', TRUE);
// ini_set('display_startup_errors', TRUE);
// date_default_timezone_set('Europe/London');
// define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once '../xls/PHPExcel.php';
require_once '../consumuri/api/functions/functii.php';
$luna = intval($_GET['luna']);
$an = intval($_GET['an']);
$d=cal_days_in_month(CAL_GREGORIAN, $luna, $an);
$denumiriLuni = array(
1 => 'ianuarie',
2 => 'februarie',
3 => 'martie',
4 => 'aprilie',
5 => 'mai',
6 => 'iunie',
7 => 'iulie',
8 => 'august',
9 => 'septembrie',
10 => 'octombrie',
11 => 'noiembrie',
12 => 'decembrie',
);
if($luna < 10){
$numeFisierMachete = 'cnp_01_' . $d . '.0' . $luna . '.' . $an;
}else{
$numeFisierMachete = 'cnp_01_' . $d . '.' . $luna . '.' . $an;
}
$numeFisierXML = '';
// 'machete_01_28.02.2014.xlsx'
$tarifHD = 496;
$tarifHDF = 563;
function cmp($a, $b) {
if ($a['C2'] == $b['C2']) {
return 0;
}
return ($a['C2'] < $b['C2']) ? -1 : 1;
}
$data = '01-' . $d . ' ' . $denumiriLuni[$luna] .' / '.$an;
// Create new PHPExcel object
//echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();
// Set document properties
//echo date('H:i:s') , " Set document properties" , EOL;
$objPHPExcel->getProperties()->setCreator("DiaMedicalPort")
->setLastModifiedBy("DiaMedicalPort/** Include PHPExcel */")
->setTitle("PHPExcel Test Document")
->setSubject("PHPExcel Test Document")
->setDescription("Test document for PHPExcel, generated using PHP classes.")
->setKeywords("office PHPExcel php")
->setCategory("Test result file");
$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial')
->setSize(9);
// prepare data HARDCODED
$listaSedinte = extrageListaPacienti($an,$luna,1);
$listaSedinteTemporare = extrageListaPacienti($an,$luna,2);
$sedinteHD = array_merge($listaSedinte['hd'], $listaSedinteTemporare['hd']);
$sedinteHDF = array_merge($listaSedinte['hdf'], $listaSedinteTemporare['hdf']);
usort($sedinteHD, "cmp");
usort($sedinteHDF, "cmp");
require_once 'lista_fise.php';
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
if($_GET['format'] === 'xlsx'){
// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="'. $numeFisierMachete .'.xlsx"');
header('Cache-Control: max-age=0');
// // If you're serving to IE 9, then the following may be needed
// header('Cache-Control: max-age=1');
// // If you're serving to IE over SSL, then the following may be needed
// header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
// header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
// header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
// header ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
}else if($_GET['format'] === 'xls'){
// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'. $numeFisierMachete .'.xls"');
header('Cache-Control: max-age=0');
// // If you're serving to IE 9, then the following may be needed
// header('Cache-Control: max-age=1');
// // If you're serving to IE over SSL, then the following may be needed
// header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
// header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
// header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
// header ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}else{
echo $numeFisierMachete . '.xlsx';
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save( $numeFisierMachete . '.xlsx');
}