kood

kood

<? Php
ini_set ('display_errors', 1);
require_once ('PHPExcel.php');
require_once ('PHPExcel / IOFactory.php');
include_once ('../../../ wp-load.php');
$ objPHPExcel = uus PHPExcel ();
globaalne $ wpdb;
// $ objPHPExcel-> getActiveSheet ();

$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A1', 'Donation Reports');
$ objPHPExcel-> setActiveSheetIndex (0) -> mergeCells ('A1: C1', ");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A2', 'SI');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('B2', 'Project');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('C2', 'Sub Project');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('D2', 'Asukoht');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('E2', 'Kokku');

$ file = 'annetamine'. aeg (). '.xlsx'; //
// $ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007');
// $ objWriter-> salvestada ("upload / excelsheet /". $ file);
// Töölehe ümbernimetamine
$ objPHPExcel-> getActiveSheet () -> setTitle ('Price Matrix');

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

$ startdate = $ _REQUEST ['exporttartdate']. ' 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) totalamount FROM "$ Wpdb-> prefiks" user_donating LEFT JOIN ". $ Wpdb-> prefiks." Valikud ON ". $ Wpdb-> prefiks." User_donating.selection_id = ". $ Wpdb-> prefiks." Selections.uniqetime_id WHERE posted_date vahel "". $ startdate. "" JA "". $ enddate. "" GROUP by project, sub_project, location ");

$ result = mysql_query ($ queryexport);
$ header = ";
$ i = 3;
$ j = 1;

samas ($ row = mysql_fetch_array ($ result)) {
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('A'. $ i, $ j);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('B'. $ i, $ row ['project']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('C'. $ i, $ row ['sub_project']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('D'. $ i, $ row ['location']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('E'. $ i, '£' .number_format ($ rida ['totalamount'], 2));

$ I ++;
$ j ++;
}

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

päis ('Sisu-tüüp: rakendus / vnd.openxmlformats-officedocument.spreadsheetml.sheet');
päis ("Content-Disposition: attachment; filename =". $ file);
päis ("Cache-Control: must-revalidate, post-check = 0, eelkontroll = 0");
ob_end_clean ();
readfile ($ file_url);
väljumine;

?>

ABI VAJAMA? Vajuta siia spikri