Added inital SEPA CORE (Direct Debit) support. Needs testing!
[memberdb.git] / include / xlsexport.php
index bc7e305..e32252d 100644 (file)
@@ -1,9 +1,95 @@
 <?php
 
-function action_export() {
+function action_export_members() {
        global $EARNING_TYPES, $EXPENSE_TYPES;
 
-    error_reporting(error_reporting() & ~E_DEPRECATED);
+    error_reporting(error_reporting() & ~E_DEPRECATED & ~E_STRICT);
+       require_once 'vendor/autoload.php';
+
+       // Creating a workbook
+       $workbook = new Spreadsheet_Excel_Writer();
+       $workbook->setVersion(8);
+
+       // sending HTTP headers
+       $workbook->send('Mitglieder.xls');
+
+       // Creating a worksheet
+
+       $members = db_get_members();
+
+
+       $row = 0;
+       $col = 0;
+
+       $worksheet =& $workbook->addWorksheet('Mitglieder');
+       $worksheet->setInputEncoding('UTF-8');
+       $row = 0;
+       $worksheet->write($row, $col++, 'Mitgliedsnummer');
+       $worksheet->write($row, $col++, 'Nickname');
+       $worksheet->write($row, $col++, 'E-Mail');
+       $worksheet->write($row, $col++, 'Vorname');
+       $worksheet->write($row, $col++, 'Nachname');
+       $worksheet->write($row, $col++, 'Stra├če');
+       $worksheet->write($row, $col++, 'Hausnummer');
+       $worksheet->write($row, $col++, 'PLZ');
+       $worksheet->write($row, $col++, 'Ort');
+       $worksheet->write($row, $col++, 'Land');
+       $worksheet->write($row, $col++, 'Telefon');
+       $worksheet->write($row, $col++, 'Fax');
+       $worksheet->write($row, $col++, 'Handy');
+       $worksheet->write($row, $col++, 'Jabber');
+       $worksheet->write($row, $col++, 'ICQ');
+       $worksheet->write($row, $col++, 'MSN');
+       $worksheet->write($row, $col++, 'AIM');
+       $worksheet->write($row, $col++, 'Skype');
+       $worksheet->write($row, $col++, 'Website');
+       $worksheet->write($row, $col++, 'Twitter');
+       $worksheet->write($row, $col++, 'Lastschrifteinzug');
+       $worksheet->write($row, $col++, 'Status');
+       $row++;
+       
+       foreach ($members as $member) {
+               $col = 0;
+               $worksheet->write($row, $col++, $member['number']);    
+               $worksheet->write($row, $col++, $member['nickname']);    
+               $worksheet->write($row, $col++, $member['email']);     
+               $worksheet->write($row, $col++, $member['firstname']);    
+               $worksheet->write($row, $col++, $member['lastname']);    
+               $worksheet->write($row, $col++, $member['street']);    
+               $worksheet->write($row, $col++, $member['housenumber']);
+               $worksheet->write($row, $col++, $member['postcode']);      
+               $worksheet->write($row, $col++, $member['city']);         
+               $worksheet->write($row, $col++, $member['country']); 
+               $worksheet->write($row, $col++, $member['phone']);         
+               $worksheet->write($row, $col++, $member['fax']);         
+               $worksheet->write($row, $col++, $member['mobile']);         
+               $worksheet->write($row, $col++, $member['jabber']);         
+               $worksheet->write($row, $col++, $member['icq']);         
+               $worksheet->write($row, $col++, $member['msn']);         
+               $worksheet->write($row, $col++, $member['aim']);         
+               $worksheet->write($row, $col++, $member['skype']);         
+               $worksheet->write($row, $col++, $member['url']);    
+               $worksheet->write($row, $col++, $member['twitter']);
+               $worksheet->write($row, $col++, $member['directdebit']);
+               $membership_info = fees_info_for_member($member['id'], time());
+               $worksheet->write($row, $col++, $membership_info['is_member']);
+               $col = 0;
+               $row++;
+       }
+
+       // Let's send the file
+       $workbook->close();
+
+       $content = ob_get_contents();
+       ob_end_clean();
+       echo $content;
+       exit();
+}
+
+function action_export_payments() {
+       global $EARNING_TYPES, $EXPENSE_TYPES;
+
+    error_reporting(error_reporting() & ~E_DEPRECATED & ~E_STRICT);
        require_once 'vendor/autoload.php';
 
        // Creating a workbook
@@ -66,4 +152,4 @@ function action_export() {
 }
 
 
-
+?>
\ No newline at end of file