
<?php
ob_start();
?>

<?php include 'header.php'; ?>

<div class="container">

  <div class="my-2 border-bottom">
    <h5 class="fw-semibold fs-5">LAPORAN PERUBAHAN EKUITAS </h5>
  </div>

  <section class="content">
    <div class="row">
      <section class="col-lg-10">
         
        <div class="box box-info">
          <div class="box-header">
            <h6 class="box-title"></h6>
          </div>
          <div class="box-body">
            <?php 
            $tgl=date('Y-m-d') ;
            $bln = date('m');
            $bulan=($bln) ;
            //////////////////////////////////////////////////////////////////////////// 
        $oleh = $_GET['toleh'];
        $tabel_tujuan = "nawal_".$oleh;
        $tabel_asal = "nawal";

        $tgl_d = $_GET['xtgl_d'];
        $tgl_s = $_GET['xtgl_s'];

        $tgl_ke_1 = date('2025-01-01');
        $tgl_p = strtotime("$tgl_d");
        $tgl_lalu = date('Y-m-d', strtotime("-1 day", $tgl_p));
            //////////////////////////////////////////////////////////////////////////// 
              ?>
              <div class="row">
                <div class="col-lg-8">
                  <table class="table table-bordered">
                    <tr>
                      <th width="20%">Dari Tanggal </th>
                      <th width="1%">:</th>
                      <td><?php echo date('d-m-Y', strtotime($tgl_d)); ?></td>
                    </tr>
                    <tr>
                      <th>S/d Tanggal </th>
                      <th>:</th>
                      <td><?php echo date('d-m-Y', strtotime($tgl_s)); ?></td>
                    </tr>
                    <tr>
                      <th>Menu Lain</th>
                      <th>:</th>
                      <td>
                        
                      <a href="lap_perubahan_modal_tgl_tgl_print.php?toleh=<?php echo $oleh ?>&xtgl_d=<?php echo $tgl_d ?>&xtgl_s=<?php echo $tgl_s ?>" target="_blank" class="btn btn-warning btn-sm"><i class="bi bi-printer"></i> &nbsp Print</a>                    
                      <a href="lap_perubahan_modal_tgl_tgl_pdf.php?toleh=<?php echo $oleh ?>&xtgl_d=<?php echo $tgl_d ?>&xtgl_s=<?php echo $tgl_s ?>" target="_blank" class="btn btn-info btn-sm"><i class="bi bi-file-earmark-pdf"></i> &nbsp Print PDF</a>
<!--                        
                      <a href="lap_arus_kas_tgl_tgl_tenan_excell.php?toleh=<?php echo $oleh ?>&xtgl_d=<?php echo $tgl_d ?>&xtgl_s=<?php echo $tgl_s ?>" class="btn btn-success btn-sm"><i class="bi bi-file-word"></i> &nbsp Excell</a>
-->
                      <a href="javascript:history.go(-1)" class="btn btn-primary btn-sm"><i class="bi bi-reply-all"></i> &nbsp Kembali</a> 
                      </td>
                    </tr>   
                  </table>
                </div>
              </div>

              <div class="table-responsive">
                <table class="table table-bordered table-striped" id="table-datatable1">
                  <thead>
              <thead>
            <tr>
            	<th style="text-align:center; vertical-align: middle; background-color: #D3D3D3;" colspan="3" rowspan="2">Keterangan</th>
                <th Style="text-align:center; vertical-align: middle; background-color: #D3D3D3;" colspan="2" bgcolor="#DCDCDC">Modal </th>
                <th Style="text-align:center; vertical-align: middle; background-color: #D3D3D3;" colspan="2" bgcolor="#DCDCDC">Cadangan </th>
                <th style="text-align:center; vertical-align: middle; background-color: #D3D3D3;" colspan="1"; rowspan="2"; bgcolor="#D3D3D3">Ekuitas Lain</th>                
                <th style="text-align:center; vertical-align: middle; background-color: #D3D3D3;" colspan="1"; rowspan="2"; bgcolor="#D3D3D3">SHU</th>
                <th style="text-align:center; vertical-align: middle; background-color: #D3D3D3;" colspan="1"; rowspan="2"; bgcolor="#D3D3D3">TOTAL</th>
            </tr>     
            <tr>
                <th Style="text-align:center; background-color: #D3D3D3;">Simp Pokok </th>
                <th Style="text-align:center; background-color: #D3D3D3;">Simp Wajib </th>
                <th Style="text-align:center; background-color: #D3D3D3;">Umum </th>
                <th Style="text-align:center; background-color: #D3D3D3;">Resiko </th>                
            </tr>                
                  </thead>
          <tbody>
            <?php
                $sqlxp = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_pokok FROM $tabel_tujuan WHERE noperk='31101' limit 1 ");
                list($so_awal_pokok) = mysqli_fetch_array($sqlxp);
                $sqlxw = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_wajib FROM $tabel_tujuan WHERE noperk='31102' limit 1 ");
                list($so_awal_wajib) = mysqli_fetch_array($sqlxw);
                $sqlxc1 = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_c1 FROM $tabel_tujuan WHERE noperk='31201' limit 1 ");
                list($so_awal_c1) = mysqli_fetch_array($sqlxc1);
                $sqlxc2 = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_c2 FROM $tabel_tujuan WHERE noperk='31202' limit 1 ");
                list($so_awal_c2) = mysqli_fetch_array($sqlxc2);
                $sqlxel = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_el FROM $tabel_tujuan WHERE noperk='31103' limit 1 ");
                list($so_awal_el) = mysqli_fetch_array($sqlxel);
                $sqlxel2 = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_el2 FROM $tabel_tujuan WHERE noperk='32101' limit 1 ");
                list($so_awal_el2) = mysqli_fetch_array($sqlxel2);
                	$so_awal_elain=$so_awal_el+$so_awal_el2 ;
                $sqlxshu = mysqli_query($koneksi, "SELECT sum(awalk) AS so_awal_shu FROM $tabel_tujuan WHERE noperk>='33101' and noperk<='39101'");
                list($so_awal_shu) = mysqli_fetch_array($sqlxshu);
                $total_awal=$so_awal_pokok+$so_awal_wajib+$so_awal_c1+$so_awal_c2+$so_awal_el+$so_awal_shu ;
            ?>          	
                <tr>
                    <td align='right' style="font-weight: bold;">1. </td>
                    <td colspan="2" style="font-weight: bold;text-align: left;">Saldo Awal Per : <?php echo date('d-m-Y', strtotime($tgl_d)); ?> </td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_awal_pokok", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_awal_wajib", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_awal_c1", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_awal_c2", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_awal_elain", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_awal_shu", 0, ",", "."); ?></td>   
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$total_awal", 0, ",", "."); ?></td>                  
                </tr>          	

            <?php
                $sqlxp = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_pokok FROM $tabel_tujuan WHERE noperk='31101' limit 1 ");
                list($so_mt_pokok) = mysqli_fetch_array($sqlxp);
                $sqlxw = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_wajib FROM $tabel_tujuan WHERE noperk='31102' limit 1 ");
                list($so_mt_wajib) = mysqli_fetch_array($sqlxw);
                $sqlxc1 = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_c1 FROM $tabel_tujuan WHERE noperk='31201' limit 1 ");
                list($so_mt_c1) = mysqli_fetch_array($sqlxc1);
                $sqlxc2 = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_c2 FROM $tabel_tujuan WHERE noperk='31202' limit 1 ");
                list($so_mt_c2) = mysqli_fetch_array($sqlxc2);
                $sqlxel = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_el FROM $tabel_tujuan WHERE noperk='31103' limit 1 ");
                list($so_mt_el) = mysqli_fetch_array($sqlxel);
                $sqlxel2 = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_el2 FROM $tabel_tujuan WHERE noperk='32101' limit 1 ");
                list($so_mt_el2) = mysqli_fetch_array($sqlxel2);
                	$so_mt_elain=$so_mt_el+$so_mt_el2 ;
                $sqlxshu = mysqli_query($koneksi, "SELECT sum(mutasik) AS so_mt_shu FROM $tabel_tujuan WHERE noperk>='33101' and noperk<='39101'");
                list($so_mt_shu) = mysqli_fetch_array($sqlxshu);
                $total_mt=$so_mt_pokok+$so_mt_wajib+$so_mt_c1+$so_mt_c2+$so_mt_el+$so_mt_shu ;
            ?>          	
                <tr>
                    <td align='right' style="font-weight: bold;">2.</td>
                    <td colspan="2" style="font-weight: bold;text-align: left;">P e n a m b a h a n </td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mt_pokok", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mt_wajib", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mt_c1", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mt_c2", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mt_elain", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mt_shu", 0, ",", "."); ?></td>   
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$total_mt", 0, ",", "."); ?></td>                  
                </tr>                     

            <?php
                $so_jm_pokok=$so_awal_pokok+$so_mt_pokok;
                $so_jm_wajib=$so_awal_wajib+$so_mt_wajib;
                $so_jm_c1=$so_awal_c1+$so_mt_c1;
                $so_jm_c2=$so_awal_c2+$so_mt_c2;
                $so_jm_elain=$so_awal_elain+$so_mt_elain;
                $so_jm_shu=$so_awal_shu+$so_mt_shu;
                $total_jm=$total_awal+$total_mt ;
            ?>          	
                <tr>
                    <td align='right' style="font-weight: bold;"><?php echo ""?></td>
                    <td colspan="2" style="font-weight: bold;text-align: center;">J u m l a h </td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_jm_pokok", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_jm_wajib", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_jm_c1", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_jm_c2", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_jm_elain", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_jm_shu", 0, ",", "."); ?></td>   
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$total_jm", 0, ",", "."); ?></td>                  
                </tr>  

            <?php
                $sqlxp = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mk_pokok FROM $tabel_tujuan WHERE noperk='31101' limit 1 ");
                list($so_mk_pokok) = mysqli_fetch_array($sqlxp);
                $sqlxw = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mk_wajib FROM $tabel_tujuan WHERE noperk='31102' limit 1 ");
                list($so_mk_wajib) = mysqli_fetch_array($sqlxw);
                $sqlxc1 = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mk_c1 FROM $tabel_tujuan WHERE noperk='31201' limit 1 ");
                list($so_mk_c1) = mysqli_fetch_array($sqlxc1);
                $sqlxc2 = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mk_c2 FROM $tabel_tujuan WHERE noperk='31202' limit 1 ");
                list($so_mk_c2) = mysqli_fetch_array($sqlxc2);
                $sqlxel = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mk_el FROM $tabel_tujuan WHERE noperk='31103' limit 1 ");
                list($so_mk_el) = mysqli_fetch_array($sqlxel);
                $sqlxel2 = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mk_el2 FROM $tabel_tujuan WHERE noperk='32101' limit 1 ");
                list($so_mk_el2) = mysqli_fetch_array($sqlxel2);
                	$so_mk_elain=$so_mk_el+$so_mk_el2 ;
                $sqlxshu = mysqli_query($koneksi, "SELECT sum(mutasid) AS so_mt_shu FROM $tabel_tujuan WHERE noperk>='32101' and noperk<='32901' limit 1 ");
                list($so_mt_shu) = mysqli_fetch_array($sqlxshu);
                $total_mk=$so_mk_pokok+$so_mk_wajib+$so_mk_c1+$so_mk_c2+$so_mk_el+$so_mk_shu ;
            ?>          	
                <tr>
                    <td align='right' style="font-weight: bold;">3. </td>
                    <td colspan="2" style="font-weight: bold;text-align: left;">P e n g u r a n g a n </td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mk_pokok", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mk_wajib", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mk_c1", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mk_c2", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mk_elain", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_mk_shu", 0, ",", "."); ?></td>   
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$total_mk", 0, ",", "."); ?></td>                  
                </tr>         
            <?php
                $so_ak_pokok=$so_jm_pokok-$so_mk_pokok;
                $so_ak_wajib=$so_jm_wajib-$so_mk_wajib;
                $so_ak_c1=$so_jm_c1-$so_mk_c1;
                $so_jm_c2-$so_mk_c2;
                $so_ak_elain=$so_jm_elain-$so_mk_elain;
                $so_ak_shu=$so_jm_shu-$so_mk_shu;
                $total_ak=$total_jm-$total_mk ;
            ?>          	
                <tr>
                    <td align='right' style="font-weight: bold;">4. </td>
                    <td colspan="2" style="font-weight: bold;text-align: left;">Saldo Akhir Per : <?php echo date('d-m-Y', strtotime($tgl_s)); ?> </td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_ak_pokok", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_ak_wajib", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_ak_c1", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_ak_c2", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_ak_elain", 0, ",", "."); ?></td>
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$so_ak_shu", 0, ",", "."); ?></td>   
                    <td style="text-align:right; font-size: 11pt; font-weight:normal;"><?php echo "" . number_format("$total_ak", 0, ",", "."); ?></td>                  
                </tr>  









          </tbody>
        </table>
              </div>

              <?php 

            ?>

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

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