



<!DOCTYPE html>
<html>
<head>
	<title>Export Data Ke Excel Dengan PHP - www.mitrakoperasi.com</title>
</head>
<body>
	<style type="text/css">
	body{
		font-family: sans-serif;
	}
	table{
		margin: 20px auto;
		border-collapse: collapse;
	}
	table th,
	table td{
		border: 1px solid #3c3c3c;
		padding: 3px 8px;
 
	}
	a{
		background: blue;
		color: #fff;
		padding: 8px 10px;
		text-decoration: none;
		border-radius: 2px;
	}
	</style>
 
<?php 
    session_start();
    include 'header_excell.php'; 

        $tgl_s =date('Y-m-d');            
        $oleh=$_SESSION['id'];
        $kdc=$_SESSION['kdc'];
        
        $tgl_dr=$_GET['tgl_dr']; 
        $tgl_sd=$_GET['tgl_sd'];
        
        $now=date("d-m-Y H:i:s");
	    header("Content-type: application/vnd-ms-excel");
	    header("Content-Disposition: attachment; filename=".$kdc."_daftar_donatur_".$now.".xls");

?>

	<table border="0">
            <tr>
                <th Style="text-align:center" colspan="11">DAFTAR DONATUR</th>
            </tr>  
            <tr>
                <th Style="text-align:center" colspan="11">Yang Masuk dari <?php echo date('d-m-Y', strtotime($tgl_dr)); ?> s/d <?php echo date('d-m-Y', strtotime($tgl_sd)); ?></th>
            </tr>             
            <tr>
              <th width="3%" class="text-center" style="text-align:left; font-size: 9pt; font-weight:normal;">No</th>
              <th width="5%" class="text-center" style="text-align:left; font-size: 9pt; font-weight:normal;">NoAng</th>
              <th width="30%" class="text-center">NAMA</th>
              <th width="10%" class="text-center">Alamat</th>
              <th width="5%" class="text-center">RT</th>
              <th width="5%" class="text-center">RW</th>
              <th width="15%" class="text-center">Kel</th>
              <th width="15%" class="text-center">Kec</th>
              <th width="15%" class="text-center">Kab/Kota</th>
              <th width="15%" class="text-center">No HP</th>
              <th width="7%" class="text-center">Tanggal</th>
            </tr>
                  </thead>
          <tbody>
            <?php 
            $no=1;
            $data = mysqli_query($koneksi,"SELECT * FROM anggota WHERE tglmasuk>='$tgl_d' and tglmasuk<='$tgl_s' ");
            while($d = mysqli_fetch_array($data)){
                $noang  =$d['angg_no'] ;
                $rt   =$d['rt'] ;
                $rw   =$d['rw'] ;
              ?>
              <tr>
                <td style="text-align:center; font-size: 8pt; font-weight:normal;"><?php echo $no++; ?></td>
                <td style="text-align:center; font-size: 8pt; font-weight:normal;"><?php echo $d['angg_no'] ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $d['nama']; ?></td>
                <td style="text-align:left; font-size: 9pt; font-weight:normal;"><?php echo $d['alamat']; ?></td>
                <td style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo $d['rt']; ?></td>
                <td style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo $d['rw']; ?></td>
                <td style="text-align:left; font-size: 8pt; font-weight:normal;"><?php echo $d['kel']; ?></td>
                <td style="text-align:left; font-size: 8pt; font-weight:normal;"><?php echo $d['kec']; ?></td>
                <td style="text-align:left; font-size: 8pt; font-weight:normal;"><?php echo $d['kab']; ?></td>
                <td style="text-align:left; font-size: 8pt; font-weight:normal;"><?php echo $d['hp']; ?></td>
                <td style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo date('d/m/Y', strtotime($d['tglmasuk'])); ?></td>
                <?php };?>  

          </tbody>
        </table>
</body>
</html>