# Export Feature - Simpanan Module

## Files Created

### 1. Export Files
- `simpanan/simpanan_sukarela_rekap_export.php` - Export for individual member sukarela savings
- `simpanan/simpanan_sukarela_rekap_umum_export.php` - Export for sukarela savings summary (all members)
- `simpanan/simpanan_dana_pensiun_rekap_export.php` - Export for individual member dana_pensiun
- `simpanan/simpanan_dana_pensiun_rekap_umum_export.php` - Export for dana_pensiun summary (all members)

### 2. Modified Files (Added Export Button)
- `simpanan/simpanan_sukarela_rekap.php` - Added export button
- `simpanan/simpanan_sukarela_rekap_umum.php` - Added export button
- `simpanan/simpanan_dana_pensiun_rekap.php` - Added export button
- `simpanan/simpanan_dana_pensiun_rekap_umum.php` - Added export button

## Features

### Supported Formats
1. **PDF** - Print-ready PDF with proper formatting
2. **Word (.doc)** - Microsoft Word document
3. **Excel (.xlsx)** - Genuine XLSX file (using ZipArchive)

### Workflow
1. Click "Export (PDF/Word/Excel)" button on any rekap page
2. Preview page opens with 3 options:
   - Preview PDF (shows in iframe)
   - Preview Word (download link)
   - Preview Excel (download link)
3. Each format has:
   - Print button (for PDF)
   - Download button
   - Navigation to switch between formats
   - Back button to return to original page

### Export Content
- Header with cooperative name and document title
- Member information (No. Anggota, Nama)
- Transaction details table (No, Tanggal, Tipe, Jumlah, Keterangan, Petugas)
- Summary section (Total Setoran, Total Penarikan, Saldo)
- Signature blocks for official documents

### Technical Details
- **PDF**: Uses browser print-to-PDF with @media print CSS
- **Word**: HTML-based Word document with Office XML namespaces
- **Excel**: Genuine XLSX created using PHP ZipArchive (no external libraries needed)
- All exports support filtering by year/month

## How to Add More Exports

For additional simpanan pages (wajib, pokok, etc.):

1. Create `simpanan_xxx_export.php` based on existing export files
2. Modify the query to get the right data
3. Update the export functions with proper titles/formatting
4. Add export button to the original page:

```php
<a href="simpanan_xxx_export.php" class="btn btn-primary" style="background: linear-gradient(135deg, #COLOR1 0%, #COLOR2 100%); border: none;">
    <i class="fas fa-file-export"></i> Export (PDF/Word/Excel)
</a>
```

## Color Schemes Used
- Sukarela: Green gradient (#10b981 → #059669)
- Dana Pensiun: Orange gradient (#f59e0b → #d97706)
- Sukarela Rekap Umum: Purple gradient (#667eea → #764ba2)

## Dependencies
- No external libraries required
- Uses PHP built-in ZipArchive for Excel
- Uses browser native print for PDF
- Uses HTML-to-Word conversion
