

<?php 
    session_start();
    include 'header.php'; 

    $kdk = $_GET['kdk'];
    $kab = $_GET['kab'];

    $tgl_ini=date('d-m-Y') ;
    $tgl_ini2=date('Y-m-d') ; 
    
    $oleh=$_SESSION['id_kar'];
    $kdc=$_SESSION['kdc'];
?>            
<div class="container">

  <div class="my-4 border-bottom">
    <h4 class="fw-semibold fs-4">Daftar Transaksi Penerimaan Zakat
    </h4>  
  </div>
  <section class="content">
    <div class="row">
      <section class="col-lg-14">
        <div class="box box-info">
          <div class="box-header">
          <div class="box-body">
            <form method="get" action="">
              <div class="row">
                <div class="col-md-2">
                  <div class="form-group">
                    <label>Dari</label>
                    <input type="date" class="form-control" name="tanggal_d" required="required" placeholder="Tanggal dari ..">
                  </div>
                </div>

                <div class="col-md-2">
                  <div class="form-group">
                    <label>Sampai</label>
                    <input type="date" class="form-control" name="tanggal_s" required="required" placeholder="Sampai tanggal ..">
                  </div>
                </div>

                <div class="col-md-2">
                  <div class="form-group">
                    <br/>
                    <input type="submit" value="TAMPILKAN LAPORAN" class="btn btn-sm btn-primary">
                  </div>
                </div>
              </div>
            </form>
          </div>
        </div>
        
        <div class="box box-info">
          <div class="box-header">
            <h6 class="box-title"></h6>
          </div>
          <div class="box-body">
            <?php 
            if(isset($_GET['tanggal_s']) && isset($_GET['tanggal_d'])){
              $tgl_d = $_GET['tanggal_d'];
              $tgl_s = $_GET['tanggal_s'];
              
              $tgl_pertama    =strtotime("$tgl_d");
              $tgl_kemarin    =date('Y-m-d', strtotime("-1 day", $tgl_pertama));       
            } else { ;
                $tgl_d    = '2025-01-01';
                $tgl_s    = $_SESSION['tgl_sd'];
            }
              ?>

              <div class="row">
                <div class="col-lg-10">
                  <table class="table table-bordered">
                    <tr>
                      <th width="30%">DARI TANGGAL</th>
                      <th width="1%">:</th>
                      <td><?php echo date('d-m-Y', strtotime($tgl_d)); ?></td>
                    </tr>
                    <tr>
                      <th>SAMPAI TANGGAL</th>
                      <th>:</th>
                      <td><?php echo date('d-m-Y', strtotime($tgl_s)); ?></td>
                    </tr>
                    <tr>
                      <th>Menu Lanjutan </th>
                      <th>:</th>
                      <td>
                          <a href="@_angg_trans_zakat_tgl_sd_tgl_print.php?tgl_dr=<?php echo date('Y-m-d', strtotime($tgl_d)); ?>&tgl_sd=<?php echo date('Y-m-d', strtotime($tgl_s)); ?>" target="_blank" class="btn btn-warning btn-sm"><i class="bi bi-printer"></i> &nbsp Print</a>
                          <a href="@_angg_trans_zakat_tgl_sd_tgl_excell.php?tgl_dr=<?php echo date('Y-m-d', strtotime($tgl_d)); ?>&tgl_sd=<?php echo date('Y-m-d', strtotime($tgl_s)); ?>" class="btn btn-success btn-sm"><i class="bi bi-file-word"></i> &nbsp Excell</a>
                          <a href="@_angg_trans_tgl_sd_tgl.php?tgl_dr=<?php echo date('Y-m-d', strtotime($tgl_d)); ?>&tgl_sd=<?php echo date('Y-m-d', strtotime($tgl_s)); ?>" class="btn btn-primary btn-sm"><i class="bi bi-eye"></i> &nbsp Lihat SEMUA</a>
                          <a href="@_angg_trans_nonzakat_tgl_sd_tgl.php?tgl_dr=<?php echo date('Y-m-d', strtotime($tgl_d)); ?>&tgl_sd=<?php echo date('Y-m-d', strtotime($tgl_s)); ?>" class="btn btn-secondary btn-sm"><i class="bi bi-eye"></i> &nbsp Lihat yg Non Zakat</a>
                          <a href="@_angg_tgl_sd_tgl.php?tgl_dr=<?php echo date('Y-m-d', strtotime($tgl_d)); ?>&tgl_sd=<?php echo date('Y-m-d', strtotime($tgl_s)); ?>" class="btn btn-info btn-sm pull-right"><i class="bi bi-reply"></i> &nbsp; Kembali</a> 
                      </td>
                    </tr>                       
                  </table>
                </div>
              </div>

        </div>
              <div class="table-responsive">
                <table class="table table-bordered table-striped" id="table-datatable">
          <thead>
            <tr>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">No</th>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Tanggal</th> 
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">NoTrans</th>              
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Foto</th>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">NoAng</th>
              <th width="10%" class="text-center">NAMA</th>
              <th width="15%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Alamat</th>
              <th width="10%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Jenis</th>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Jumlah</th>              
              <th width="8%" class="text-center">OPSI</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><?php echo $no++; ?></td>
                <td style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo date('d/m/Y', strtotime($t['tanggal'])); ?></td>
                <td style="text-align:center; font-size: 9pt; font-weight:normal;"><?php echo $t['notrans']; ?></td>
                <td>
                  <center>
                    <a href="angg_foto_diri.php?id=<?php echo $angg_id ?>&no=<?php echo $noang ?>" data-placement='top' title='Lihat Detail & Foto <?php echo $d['angg_no'] ?> a/n <?php echo $d['nama']; ?>' >								    
                        <?php if($foto_diri == ""){ ?>
                          <img src="../gambar/user.png" style="width: 20px;height: auto">  
                        <?php }else{ ?>
                          <img src="../gambar/diri/<?php echo $foto_diri ?>" style="width: 20px;height: auto">
                        <?php } ?>                    
                    </a>                                   
                  </center>         
                </td>                 
                <td style="text-align:left; font-size: 8pt; font-weight:normal;"><a data-toggle='tooltip' data-placement='top' title='Lihat Kartu Anggota <?php echo $a['nama']; ?>' style='margin-right:3px' class="btn btn-warning btn-sm" href="angg_kartu.php?id=<?php echo $t['angg_id']; ?>"><?php echo $t['angg_no'] ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $a['nama']; ?></td>
                <td style="text-align:left; font-size: 9pt; 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: 9pt; font-weight:normal;"><?php echo $n['perk']; ?></td>
                <td style="text-align:right; font-size: 10pt; font-weight:normal;"><?php echo "" . number_format("$t[masuk]", 0, ",", "."); ?></td>
                <td>    
                
                  <a onclick="return confirm('Yakin ingin hapus data No <?php echo $t['notrans']; ?> a/n <?php echo $a['nama']; ?> - <?php echo $a['alamat']; ?> ?')" class="btn btn-danger btn-sm" href="@_angg_hapus_donasi.php?id=<?php echo $t['notrans'] ?>&oleh=<?php echo $oleh ?>&tgl_dr=<?php echo $tgl_d ?>&tgl_sd=<?php echo $tgl_s ?>">
                    <i class="bi bi-trash"></i>
                  </a>
                <a data-toggle='tooltip' data-placement='top' title='Cetak kuitansi <?php echo $t['notrans'] ?> a/n <?php echo $a['nama']; ?>' style='margin-right:3px' class="btn btn-primary btn-sm" href="@_angg_kuitansi.php?tid=<?php echo $t['notrans'] ?>&angg_no=<?php echo $noang ?>" target="_blank" ><i class="bi bi-aspect-ratio"></i></a>
                <a data-toggle='tooltip' data-placement='top' title='Kirim WA Ucapan Terimakasih <?php echo $a['angg_no'] ?> a/n <?php echo $a['nama']; ?>' style='margin-right:3px' class="btn btn-secondary btn-sm" href="@_angg_wa_terimakasih.php?notrans=<?php echo $t['notrans'] ?>&id=<?php echo $a['angg_id'] ?>&hp=<?php echo $a['hp'] ?>"><i class="bi bi-box-arrow-up-right"></i></a>
                </td>
              </tr>
              <?php 
            }
            ?>
          </tbody>
        
        </table>
        
        
              </div>

          </div>
        </div>
      </section>
    </div>
  </section>

</div>
<?php include 'footer.php'; ?>