<link href="desain/desainhalaman.css" rel="stylesheet"/>

<?php
error_reporting(E_ALL^(E_NOTICE|E_WARNING));
ini_set('display_errors',1);
error_reporting(0);
?>

<div class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-12">
       <?php 
       setlocale(LC_TIME, 'id_ID.utf8');
       function hariIndo ($hariInggris) {
  switch ($hariInggris) {
    case 'Sunday':
      return 'Minggu';
    case 'Monday':
      return 'Senin';
    case 'Tuesday':
      return 'Selasa';
    case 'Wednesday':
      return 'Rabu';
    case 'Thursday':
      return 'Kamis';
    case 'Friday':
      return 'Jumat';
    case 'Saturday':
      return 'Sabtu';
    default:
      return 'hari tidak valid';
  }
}

        $hariIndo1 = hariIndo(date('l'));
        /*https://jagongoding.com/web/php/menengah/menampilkan-nama-hari-dan-bulan-dalam-bahasa-indonesia/*/
        $hariIni = new DateTime();
       //echo $hariIndo1.",".$hariIni->format(' d F Y , H:i');?>
				<!-- <h3 class="m-0 text-dark">Selamat Datang, <?=$_SESSION['username'];?> </h3> -->



			</div><!-- /.col -->
		</div><!-- /.row -->
	</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->

<section class="content">
      <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
                 
        <?php
                include 'koneksi.php'; 
                require './kalenderhijriah.php';
                $kode= $_SESSION['kode'];
                $tgl=date('Y-m-d');
                $tglH= $hijri[2].'-'.$calendar->monthName($hijri[0]).'-'.sprintf('%02d', $hijri[1]);
                

                $kas1= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(debet-kredit)AS tkas FROM bukubesar WHERE kode_akun LIKE '%1.100.%' and kode='".$_SESSION['kode']."' ")); 
                extract($kas1);
                $kas2= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(debet-kredit)AS mkas FROM bukubesar WHERE kode_akun LIKE '%1.100.%' and kode='".$_SESSION['kode']."' ")); 
                extract($kas2);
                $bank1= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(debet-kredit)AS tbank FROM bukubesar WHERE kode_akun LIKE '%1.105.%' and kode='".$_SESSION['kode']."' ")); 
                extract($bank1);
                $bank2= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(debet-kredit)AS mbank FROM bukubesar WHERE tanggal= '$tgl' AND kode_akun LIKE '%1.105.%' and kode='".$_SESSION['kode']."' ")); 
                extract($bank2);
                  $bakidebet= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(plafond-pokok)AS bakidebet FROM angsuran  WHERE kode='$kode' ")); 
                extract($bakidebet);
                $cair1= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(debet-kredit)AS cair FROM bukubesar  WHERE kode_akun like'%1.120.%' and tanggal= '$tgl' and kode='$kode' ")); 
                extract($cair1);
                $jaminan1= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(plafond)AS plafond, COUNT(jaminan)AS jaminan FROM pinjaman WHERE tgl= '$tgl' and bakidebet >0 and kode='$kode' ")); 
                extract($jaminan1);
                $jaminan2= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(plafond)AS plafond2, COUNT(jaminan)AS totaljaminan FROM pinjaman WHERE kode='$kode' and bakidebet >0  ")); 
                extract($jaminan2);

                $mTabungan= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kredit-debet)AS mTabungan FROM mutasitabungan WHERE tgl2='$tgl'  ")); 
                extract($mTabungan);

                $akTabungan= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kredit-debet)AS akTabungan FROM mutasitabungan  ")); 
                extract($akTabungan);
                $m_syahriah= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mSyahriah FROM bulanan WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_syahriah);
                $m_syahriah2= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanSyahriah,sum(bayar-kewajiban)AS aSisaSyahriah, SUM(bayar) AS mBayar2 FROM bulanan WHERE tglmasehi<='$tglH' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_syahriah2);
                 $ak_syahriah= mysqli_fetch_array(mysqli_query($koneksi,"SELECT sum(bayar) AS aBayarSyahriah FROM bulanan WHERE tgl<='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($ak_syahriah);
                $m_kitab= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mKitab FROM kitab WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_kitab);
                 $ak_kitab= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanKitab,sum(bayar) AS aBayarKitab, sum(bayar-kewajiban)AS aSisaKitab FROM kitab WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_kitab);
                $m_imda1= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mImda1 FROM imda1 WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_imda1);
                 $ak_imda1= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanimda1,sum(bayar) AS aBayarImda1, sum(bayar-kewajiban)AS aSisaImda1 FROM imda1 WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_imda1);
                $m_imda2= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mImda2 FROM imda2 WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_imda2);
                 $ak_imda2= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanImda2,sum(bayar) AS aBayarImda2, sum(bayar-kewajiban)AS aSisaImda2 FROM imda2 WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_imda2);
                $m_imda3= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mImda3 FROM imda3 WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_imda3);
                 $ak_imda3= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanImda3,sum(bayar) AS aBayarImda3, sum(bayar-kewajiban)AS aSisaImda3 FROM imda3 WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_imda3);
                $m_iuran= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mIuran FROM iuran WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_iuran);
                 $ak_iuran= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanIuran,sum(bayar) AS aBayarIuran, sum(bayar-kewajiban)AS aSisaIuran FROM iuran WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_iuran);
                $m_ikhtibar= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mIkhtibar FROM ikhtibar WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_ikhtibar);
                 $ak_ikhtibar= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanIkhtibar,sum(bayar) AS aBayarIkhtibar, sum(bayar-kewajiban)AS aSisaIkhtibar FROM ikhtibar WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_ikhtibar);
                $m_seragam= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(bayar) AS mSeragam FROM seragam WHERE tgl='$tgl' AND kode='".$_SESSION['kode']."' ")); 
                extract($m_seragam);
                 $ak_seragam= mysqli_fetch_array(mysqli_query($koneksi,"SELECT SUM(kewajiban)AS aKewajibanSeragam,sum(bayar) AS aBayarSeragam, sum(bayar-kewajiban)AS aSisaSeragam FROM seragam WHERE kode='".$_SESSION['kode']."' ")); 
                extract($ak_seragam);

                ?>

               
                <style type="text/css">
  .jarak {
    margin-top: -19px;
    font-size: 12px;
  }
</style>



  <div class="row">
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-money-check-alt" style="font-size: 40px; margin-right: 10px; color: brown;"></i>
        <div>
          <p style="font-size: 18px;">Kas</p>
          <p class="jarak"><?php echo "Mutasi Rp. " . number_format($mkas, 0); ?></p>
          <p class="jarak"><?php echo "Total Rp. " . number_format($tkas, 0); ?></p>
        </div>
      </div>
    </div>

    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-money-check" style="font-size: 40px; margin-right: 10px; color: green;"></i>
        <div>
          <p style="font-size: 18px;">Tabungan</p>
          <p class="jarak"><?php echo "Mutasi = " . number_format($mTabungan, 0); ?></p>
          <p class="jarak"><?php echo "Total = " . number_format($akTabungan, 0); ?></p>
        </div>
      </div>
    </div>

    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-money-check" style="font-size: 40px; margin-right: 10px; color: green;"></i>
        <div>
        <p style="font-size: 18px;">Syahriah</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mSyahriah, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanSyahriah, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($mBayar2, 0); ?></p>
        <p class="jarak"><?php echo "Total Bayar = " . number_format($aBayarSyahriah, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaSyahriah, 0); ?></p>
        
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-money-check" style="font-size: 40px; margin-right: 10px; color: green;"></i>
        <div>
        <p style="font-size: 18px;">Ikhtibar</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mIkhtibar, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanIkhtibar, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarIkhtibar, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaIkhtibar, 0); ?></p>
        </div>
      </div>
    </div>

  </div>



  <div class="row">
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-cart" style="font-size: 46px; margin-right: 10px; color: blueviolet;"></i>
        <div>
        <p style="font-size: 18px;">Kitab</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mKitab, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanKitab, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarKitab, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaKitab, 0); ?></p>
        </div>
      </div>
    </div>
    

    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-cart" style="font-size: 53px; margin-right: 10px; color: royalblue;"></i>
        <div>
        <p style="font-size: 18px;">Seragam</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mSeragam, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanSeragam, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarSeragam, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaSeragam, 0); ?></p>
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-cart" style="font-size: 53px; margin-right: 10px; color: royalblue;"></i>
        <div>
        <p style="font-size: 18px;">Maulid</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mIuran, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanIuran, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarIuran, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaIuran, 0); ?></p>
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-bag" style="font-size: 53px; margin-right: 10px; color: red;"></i>
        <div>
        <p style="font-size: 18px;">Imni</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mImni, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanImni, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarImni, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaImni, 0); ?></p>
        </div>
      </div>
    </div>
    
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-bag" style="font-size: 53px; margin-right: 10px; color: primary;"></i>
        <div>
        <p style="font-size: 18px;">Imda1</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mImda1, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanimda1, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarImda1, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaImda1, 0); ?></p>
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-bag" style="font-size: 53px; margin-right: 10px; color:primary ;"></i>
        <div>
        <p style="font-size: 18px;">Imda2</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mImda2, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanImda2, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarImda2, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaImda2, 0); ?></p>
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="d-flex align-items-center">
        <i class="fas fa-shopping-bag" style="font-size: 53px; margin-right: 10px; color: primary;"></i>
        <div>
        <p style="font-size: 18px;">Imda3</p>
        <p class="jarak"><?php echo "Hari ini = " . number_format($mImda3, 0); ?></p>
        <p class="jarak"><?php echo "Tagihan = " . number_format($aKewajibanImda3, 0); ?></p>
        <p class="jarak"><?php echo "Bayar = " . number_format($aBayarImda3, 0); ?></p>
        <p class="jarak"><?php echo "Sisa = " . number_format($aSisaImda3, 0); ?></p>
        </div>
      </div>
    </div>

  </div>

 <div class="row">
    <div class="col-md-6 ">
      <p> </p>
      </div>
    
    

    <div class="col-md-6">
      <p></p>
    </div>

  </div>
     
	
</div>
<section>
	<!-- /.row -->
<!-- https://kursuswebdesign.org/cara-membuat-login-form-dengan-background-image-di-bootstrap/ -->
<style type="text/css">
body { 
 background: url(./img/background.jpg) no-repeat center center fixed; 
 -webkit-background-size: cover;
 -moz-background-size: cover;
 -o-background-size: cover;
 background-size: cover;
}
.container{
  opacity: 0.9; /*untuk tranpran*/
    position: absolute;
    left: 40%;
    top: 50%;
    transform: translate(-50%,-50%);
    padding: 20px 25px;
    width: 50px;
    /*background-color: rgba(0,0,0,.7);
    box-shadow: 0 0 10px rgba(255,255,255,.3);
    http://abdulrazaknaufal.com/panduan-membuat-form-login-dengan-html-dan-css/
    */
}
</style>