kodiċi

kodiċi

<? PHP
ini_set ('display_errors', 1);
require_once ('PHPExcel.php');
require_once ('PHPExcel / IOFactory.php');
include_once ('../../../ wp-load.php');
$ objPHPExcel = PHPExcel ġdid ();
globali $ wpdb;
// $ objPHPExcel-> getActiveSheet ();

$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ("A1", "Rapporti ta 'Donazzjoni");
$ objPHPExcel-> setActiveSheetIndex (0) -> mergeCells ("A1: C1", ");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ("A2", "SI");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ("B2", "Proġett");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ('C2', 'Proġett Sub');
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ("D2", "Post");
$ objPHPExcel-> setActiveSheetIndex (0) -> setCellValue ("E2", "Total");

$ file = 'Donazzjoni'. ħin (). '.xlsx'; //
// $ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel2007');
// $ objWriter-> save ("upload / excelsheet /". $ file);
// Tidħil mill-ġdid tal-worksheet
$ objPHPExcel-> getActiveSheet () -> setTitle ("Price Matrix");

// Issettja l-indiċi tal-karta attiva għall-ewwel folja, għalhekk Excel jiftaħ dan bħala l-ewwel folja
$ objPHPExcel-> setActiveSheetIndex (0);

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

$ queryexport = ("SELECT". $ wpdb-> prefiss. "user_donating. *,". $ wpdb-> prefiss. "selezzjonijiet. *, somma (". $ wpdb-> prefiss ". user_donating.total_amt) bħala totalamount FROM ". Wpdb-> prefiss." User_donating LEFT JOIN ". $ Wpdb-> prefiss." Selezzjonijiet FUQ ". $ Wpdb-> prefiss." User_donating.selection_id = ". $ Wpdb-> prefiss." Selezzjonijiet.uniqetime_id DOMMATI posted_date bejn '". $ startdate." "U" ". $ enddate." "GRUPP bi proġett, sottoproġett, post");

$ riżultat = mysql_query ($ queryexport);
$ header = ";
$ i = 3;
$ j = 1;

filwaqt li ($ row = mysql_fetch_array ($ riżultat)) {
$ 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 ['lokazzjoni']);
$ objPHPExcel-> getActiveSheet () -> SetCellValue ('E'. $ i, '£' .number_format (row $ ['totalamount'], 2));

$ i ++;
$ j ++;
}

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

header ('Content-Type: application / vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header ("Content-Disposition: attachment; filename =". $ file);
header ("Cache-Control: must-revalidate, post-check = 0, pre-check = 0");
ob_end_clean ();
readfile ($ file_url);
ħruġ;

?>

Bżonn l-għajnuna? Ikklikkja hawn għall-għajnuna fuq l-internet