cod

cod

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

$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A1 ′,' Adroddiadau Rhoddion ');
$ objPHPExcel-> setActiveSheetIndex (0) -> mergeCells ('A1: C1 ′, ”);
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('A2 ′,' SI ');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('B2 ′,' Project ');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('C2 ′,' Is-brosiect ');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('D2 ′,' Lleoliad ');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('E2 ′,' Cyfanswm ');

$ file = 'Rhodd'. amser (). '.xlsx'; //
// $ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007 ′);
// $ objWriter-> arbed (“upload / excelsheet /”. $ file);
// Ail-enwi taflen waith
$ objPHPExcel-> getActiveSheet () -> setTitle ('Matrics Pris');

// Gosod mynegai dalen weithredol i'r ddalen gyntaf, felly mae Excel yn agor hwn fel y ddalen gyntaf
$ objPHPExcel-> setActiveSheetIndex (0);

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

$ queryexport = (“SELECT“. $ wpdb-> rhagddodiad. ”user_donating. *,”. $ wpdb-> rhagddodiad. ”detholiadau. *, swm (“. $ wpdb-> rhagddodiad. ”user_donating.total_amt) fel totalamount FROM . rhwng '". $ cychwyn."' A '". $ enddate."' GRWP yn ôl prosiect, sub_project, lleoliad ");

$ canlyniad = mysql_query ($ queryexport);
$ pennawd = ”;
$ i = 3;
$ j = 1;

tra ($ rhes = mysql_fetch_array ($ canlyniad)) {
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('A'. $ i, $ j);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('B'. $ i, $ rhes ['prosiect']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('C'. $ i, $ rhes ['sub_project']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('D'. $ i, $ rhes ['lleoliad']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('E'. $ i, '£' .number_format ($ rhes ['totalamount'], 2));

$ i ++;
$ j ++;
}

$ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007 ′);
$ objWriter-> arbed (“upload / excelsheet /”. $ file);
$ file_url = 'ffeil llwytho i fyny / excelsheet /'.$;

pennawd ('Math o Gynnwys: cais / vnd.openxmlformats-officedocument.spreadsheetml.sheet');
pennawd ("Cynnwys-Gwarediad: atodiad; enw ffeil =". $ ffeil);
pennawd (“Rheoli Cache: rhaid ail-ddilysu, ôl-wirio = 0, rhag-wirio = 0 ″);
ob_end_clean ();
ffeil ddarllen ($ file_url);
ymadael;

?>



ANGEN CYMORTH? Cliciwch yma i gael help ar-lein