1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| <?php
// librairie nécessaire
include_once'../PHP_include/date-script.php';
include_once'../CLASS/Intermittents.class.php';
include_once'../CLASS/prod.class.php';
include_once'../CLASS/calculjour.class.php';
include_once'../manager/manager.php';
include '../classePHPExcel/PHPExcel.php';
include'../classePHPExcel/PHPExcel/Writer/Excel2007.php';
date_default_timezone_set('Europe/Paris');
$date_du_jour = (strftime("%Y-%m-%d"));
list($an,$mois,$jour)=explode("-",$date_du_jour);
$datedujourFR=$jour."-".$mois."-".$an;
$precedent='';
$affich_prod2->execute(array($_GET['n']));
$affichprod = $affich_prod2->fetch();
$nomprod=new prod();
$nomprod->hydrate($affichprod);
$affich_equipe->bindValue(1, $_GET['n'], PDO::PARAM_INT);
$affich_equipe->execute();
$ligne=0;
// objet php excel
$workbook = new PHPExcel;
//instance de la feuille corante
$sheet =$workbook->getActiveSheet();
//remplissage des cellules
$sheet->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
$sheet->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
while ($donnees=$affich_equipe->fetch()){
if ($ligne==0){
$ligne++;
$prod=new prod();
$prod->hydrate($donnees);
$sheet->setCellValue('A1',$prod->titre_presta());
PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
$sheet->setCellValue('B1',$prod->datedebutFR());
$sheet->getStyle('B1')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15);
$sheet->setCellValue('A2',"Production");
$sheet->setCellValue('B2',$nomprod->prenom_charge_prod()." ".$nomprod->nom_charge_prod());
$sheet->setCellValue('A3',"Commercial");
$sheet->setCellValue('B3',"non défini");
$sheet->setCellValue('A4',"nter");
}
$intermittent=new intermittent();
$intermittent->hydrate($donnees);
$i=5;$i++;
$sheet->setCellValue('A'.$i,$i.$intermittent->nom()." ".ucfirst (mb_strtolower($intermittent->prenom())));
$sheet->setCellValue('B'.$i,$intermittent->fonction_presta());
}
$sheet->getColumnDimension('A')->setAutoSize(true);
$sheet->getColumnDimension('B')->setAutoSize(true);
$sheet->getColumnDimension('C')->setAutoSize(true);
$sheet->getColumnDimension('D')->setAutoSize(true);
$sheet->getColumnDimension('E')->setAutoSize(true);
$sheet->setTitle($prod->titre_presta());
$styleA1=array(
'font'=>array(
'bold'=>false,
'color'=>array('rgb'=>'FFFFFF'),
'size'=>20
),
'fill'=>array(
'type'=>PHPExcel_Style_Fill::FILL_SOLID,
'color'=>array('rgb'=>'004489')
),
'alignment'=>array(
'horizontal'=>PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
'vertical'=>PHPExcel_Style_Alignment::VERTICAL_CENTER,
)
);
$sheet->getStyle('A1:B1')->applyFromArray($styleA1);
// *********************************************************
// *
// * Création de la deuxième feuille
// *******************************************************
//création de la nouvelle feuille
$sheet2 = $workbook->createSheet();
//nom de la feuille
$sheet2->setTitle('LA feuille 2');
//ojet writer pour définir le format de sortie défini ausi par la classe
$writer = new PHPExcel_Writer_Excel2007($workbook);
header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition:inline;filename=Fichier.xlsx ');
$writer->save('php://output');
?> |
Partager