kood

kood

<?php
ini_set ('kuvamisvead', 1);
Nõua_kord ('PHPExcel.php');
Nõua_kord ('PHPExcel / IOFactory.php');
include_once ('../../../ wp-load.php');
$ objPHPExcel = uus PHPExcel ();
globaalne $ wpdb;
// $ objPHPExcel-> getActiveSheet ();

$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A1', 'Annetusaruanded');
$ objPHPExcel-> setActiveSheetIndex (0) -> mergeCells ('A1: C1 ′, ");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A2', 'SI');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('B2', 'Projekt');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('C2', 'Alamprojekt');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('D2', 'Asukoht');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('E2', 'Kokku');

$ file = 'Annetus'. aeg (). '.xlsx'; //
// $ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007 ′);
// $ objWriter-> save (“upload / excelsheet /”. $ file);
// Töölehe ümbernimetamine
$ objPHPExcel-> getActiveSheet () -> setTitle ('Hinnamaatriks');

/ / Määra aktiivse lehe indeks esimesele lehele, nii et Excel avab selle esimese lehe
$ objPHPExcel-> setActiveSheetIndex (0);

$ startdate = $ _REQUEST ['exportstartdate']. ' 00:00:00 ′;
$ enddate = $ _REQUEST ['exportenddate']. ' 00:00:00 ′;

$ queryexport = („SELECT“. $ wpdb-> prefiks. ”user_donating. *,”. $ wpdb-> prefiks. ”valikud. *, summa (“. $ wpdb-> prefiks. ”user_donating.total_amt) kogusummana FROM “. $ Wpdb-> prefiks.” User_donating LEFT JOIN ”. $ Wpdb-> prefix.” Valikud ON “. $ Wpdb-> prefix.” User_donating.selection_id = “. $ Wpdb-> prefiks.” Selections.uniqetime_id WHERE posted_date ''. $ startdate. "'AND'". $ enddate vahel. "'GRUPP projekti, alamprojekti, asukoha järgi");

$ result = mysql_query ($ queryexport);
$ päis = ”;
$ i = 3;
$ j = 1;

samas ($ row = mysql_fetch_array ($ result)) {
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('A'. $ i, $ j);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('B'. $ i, $ rida ['projekt']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('C'. $ i, $ real ['sub_project']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('D'. $ i, $ rida ['asukoht']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('E'. $ i, '£' .number_formaat ($ rida ['kogusumma'], 2));

$ I ++;
$ j ++;
}

$ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007');
$ objWriter-> save ("upload / excelsheet /". $ fail);
$ file_url = 'upload / excelsheet /'.$ fail;

päis ('Content-Type: application / vnd.openxmlformats-officedocument.spreadsheetml.sheet');
päis (“Content-Disposition: manus; failinimi =”. $ fail);
päis („Cache-Control: peab uuesti kehtima, post-check = 0, pre-check = 0 ″);
ob_end_clean ();
readfile ($ file_url);
väljumine;

?>



ABI VAJAMA? Vajuta siia spikri