





<!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 include 'header_excell.php'; ?>
    <?php 
        session_start();
        $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");
    ?>
	<?php
	    header("Content-type: application/vnd-ms-excel");
	    header("Content-Disposition: attachment; filename=".$kdc."_daftar_transaksi_non_zakat_".$now.".xls");
    ?>

	<table border="0">
            <tr>
                <th Style="text-align:center" colspan="6">DAFTAR TRANSAKSI PENERIMAAN NON ZAKAT</th>
            </tr>  
            <tr>
                <th Style="text-align:center" colspan="6">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="5%" class="text-center" style="border-top: 2px solid #000; border-bottom: 2px solid #000; border-right: 4px solid white; background-color: #D3D3D3;">No</th>
    <th width="10%" class="text-center" style="border-top: 2px solid #000; border-bottom: 2px solid #000; border-right: 4px solid white; background-color: #D3D3D3;">Tanggal</th>
    <th width="25%" class="text-center" style="border-top: 2px solid #000; border-bottom: 2px solid #000; border-right: 4px solid white; background-color: #D3D3D3;">Nama</th>
    <th width="25%" class="text-center" style="border-top: 2px solid #000; border-bottom: 2px solid #000; border-right: 4px solid white; background-color: #D3D3D3;">Alamat</th>
    <th width="20%" class="text-center" style="border-top: 2px solid #000; border-bottom: 2px solid #000; border-right: 4px solid white; background-color: #D3D3D3;">Jenis</th>
    <th width="20%" class="text-center" style="border-top: 2px solid #000; border-bottom: 2px solid #000; background-color: #D3D3D3;">Jumlah</th>
            </tr>
                  </thead>
          <tbody>
           <?php 
            $no=1;
            $data = mysqli_query($koneksi,"SELECT * FROM anggota_trans WHERE tanggal>='$tgl_d' and tanggal<='$tgl_s' and kdj<>'40401' ");
            while($t = mysqli_fetch_array($data)){
                $noang  =$t['angg_no'] ;
                $anggota = mysqli_query($koneksi,"select * from anggota where angg_no='$noang'");
                $a = mysqli_fetch_assoc($anggota);

                        $no_hp      =$a['hp'] ;
                        $foto_diri  =$a['foto_diri'] ;
                        $angg_id    =$a['angg_id'] ;
                        $noang      =$a['angg_no'] ;
                $nawal = mysqli_query($koneksi,"select * from nawal where noperk='$t[kdj]'");
                $n = mysqli_fetch_assoc($nawal);                        
                        
              ?>
              <tr>
                <td style="text-align:center; font-size: 11pt; font-weight:normal;"><?php echo $t['notrans']; ?></td>
                <td style="text-align:center; font-size: 11pt; font-weight:normal;"><?php echo date('d/m/Y', strtotime($t['tanggal'])); ?></td>
                <td style="text-align:left; font-size: 11pt; font-weight:normal;"><?php echo $a['nama']; ?></td>
                <td style="text-align:left; font-size: 11pt; font-weight:normal;"><?php echo $a['alamat']; ?> <?php echo $a['rt']; ?> <?php echo $a['rw']; ?> <?php echo $a['kel']; ?> <?php echo $a['kec']; ?></td>
                <td style="text-align:left; font-size: 11pt; font-weight:normal;"><?php echo $n['perk']; ?></td>
                <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$t[masuk]", 0, ",", "."); ?></td>

              </tr>
              <?php 
            }
            ?>
          </tbody>
                        <?php 
                $sql2 = mysqli_query($koneksi, "SELECT sum(masuk) AS tmasuk FROM anggota_trans WHERE tanggal>='$tgl_d' and tanggal<='$tgl_s' and kdj<>'40401' ");
                list($tmasuk) = mysqli_fetch_array($sql2);

            	        ?>						
							<tr>
						    	<td colspan="5" style="border-top: 1px solid black; border-bottom: 1px solid black; border-right: 4px solid white; text-align:center;">Total <?php echo $nama ?> </td>																																									
								<td style="border-top: 1px solid black; border-bottom: 1px solid black; text-align:right;"><?php echo "" . number_format("$tmasuk", 0, ",", "."); ?></td>								
							</tr>                 
        </table>
</body>
</html>