<?php  
// fungsi untuk pengecekan tampilan form
// jika form add data yang dipilih
if ($_GET['form']=='addZ') { ?> 
  <!-- tampilan form add data -->
	<!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      <i class="fa fa-edit icon-title"></i> Tambah Ibadah
    </h1>

  </section>

  <!-- Main content -->
  <section class="content">
    <div class="row">
      <div class="col-md-12">
        <div class="box box-primary">
          <!-- form start -->
          
            <div class="box-body">
				<br>
            <form action="modules/ibadah/proses.php?act=tambahIbadah" name="formSaya" method="post">
                <label>Lokasi</label>
                <select name="lokasi" class="form-control">
                          <?php
                          $pilihpabrik = mysqli_query($mysqli, "SELECT *,(select nama from is_sektor where id = is_lokasi.sektor) as namasektor  
																from is_lokasi where id in ($_SESSION[loc]) and status = 'Y'");
                          while ($fetcharray = mysqli_fetch_array($pilihpabrik)) {
                            $lokasi = $fetcharray['nama']." - ".$fetcharray['namasektor'];
                            $id = $fetcharray['id'];
                            $selected = ($id == $lokasi) ? "selected" : "";
                            ?>
                            <option value="<?= $id; ?>" <?= $selected ?>>
                              <?= $lokasi; ?>
                            </option>
                            <?php
                          }
                          ?>
                </select>
                <br>
                <label>Tanggal</label>
                <div class="input-group">
                    <input type="date" class="form-control" name="tanggal" value="<?php echo date('Y-m-d'); ?>" >
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>    
                    </div>
                </div> 
                <br>
                <label>Dilaki</label>
                <div class="input-group">
                    <input type="number" class="form-control" name="lk" onkeyup="calc()" required>
                    <div class="input-group-addon">
                        <b>Org</b>   
                    </div>
                </div>
				<br>
                <label>Diberu</label>
                <div class="input-group">
                    <input type="number" class="form-control" name="pr" onkeyup="calc()" required>
                    <div class="input-group-addon">
                        <b>Org</b>   
                    </div>
                </div>
                <br>
				<label>Kolekte</label>
                <div class="input-group">
                    <div class="input-group-addon">
                        <b>Rp</b> 
                    </div>
                        <input type="text" class="form-control" name="kolekte">
                    </div>
				<br>
				<label>Perpuluhen</label>
                <div class="input-group">
                    <div class="input-group-addon">
                        <b>Rp</b> 
                    </div>
                        <input type="text" class="form-control" name="perpuluhan">
                    </div>
				<br>
				<label>Tanda Meriah Ukur</label>
                <div class="input-group">
                    <div class="input-group-addon">
                        <b>Rp</b> 
                    </div>
                        <input type="text" class="form-control" name="syukur">
                    </div>
				
				<br>
                <label>PJJ Senin Sireh</label>
                <div class="input-group">
                    <input type="date" class="form-control" name="tglpelayan" value="<?php echo date('Y-m-d'); ?>" required>
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>    
                    </div>
                </div> 
				<br>
                <label>Ingan Pulung I Rumah</label>
                    <input type="text" class="form-control" name="pic" required>
				<br>
                <label>Alamat</label>
                    <input type="text" class="form-control" name="alamat" required>
				<br>
				<label>Keterangan</label>
                    <input type="text" class="form-control" name="ket" >
				<br>
				     
					 <div class="box-footer">
					  <div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
						  <input type="submit" class="btn btn-primary btn-submit" name="submit" value="Simpan">
						  <a href="?module=ibadah" class="btn btn-default btn-reset">Batal</a>
						</div>
					  </div>
					</div><!-- /.box footer -->
			
				
			
                <br>
                <br>
                <br>
            </form> 
			  

            </div><!-- /.box body -->

            
        </div><!-- /.box -->
      </div><!--/.col -->
    </div>   <!-- /.row -->
  </section><!-- /.content -->
<?php
}

elseif ($_GET['form']=='add') { ?> 
  <!-- tampilan form add data -->
	<!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      <i class="fa fa-edit icon-title"></i> Tambah Ibadah
    </h1>

  </section>

  <!-- Main content -->
  <section class="content">
    <div class="row">
      <div class="col-md-12">
        <div class="box box-primary">
          <!-- form start -->
          
            <div class="box-body">
				<br>
            <form action="modules/ibadah/proses.php?act=tambahIbadah" name="formSaya" method="post">
                <label>Lokasi</label>
                <select name="lokasi" class="form-control">
                          <?php
                          $pilihpabrik = mysqli_query($mysqli, "SELECT *,(select nama from is_sektor where id = is_lokasi.sektor) as namasektor  
																from is_lokasi where id in ($_SESSION[loc]) and status = 'Y'");
                          while ($fetcharray = mysqli_fetch_array($pilihpabrik)) {
                            $lokasi = $fetcharray['nama']." - ".$fetcharray['namasektor'];
                            $id = $fetcharray['id'];
                            $selected = ($id == $lokasi) ? "selected" : "";
                            ?>
                            <option value="<?= $id; ?>" <?= $selected ?>>
                              <?= $lokasi; ?>
                            </option>
                            <?php
                          }
                          ?>
                </select>
                <br>
                <label>Tanggal</label>
                <div class="input-group">
                    <input type="date" class="form-control" name="tanggal" value="<?php echo date('Y-m-d'); ?>" >
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>    
                    </div>
                </div> 
                <br>
                <label>Dilaki</label>
                <div class="input-group">
                    <input type="number" class="form-control" name="lk" onkeyup="calc()" required>
                    <div class="input-group-addon">
                        <b>Org</b>   
                    </div>
                </div>
				<br>
                <label>Diberu</label>
                <div class="input-group">
                    <input type="number" class="form-control" name="pr" onkeyup="calc()" required>
                    <div class="input-group-addon">
                        <b>Org</b>   
                    </div>
                </div>
                <br>
                
                
				
                <label>PJJ Senin Sireh</label>
                <div class="input-group">
                    <input type="date" class="form-control" name="tglpelayan" value="<?php echo date('Y-m-d'); ?>" required>
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>    
                    </div>
                </div> 
				<br>
                <label>Ingan Pulung I Rumah</label>
                    <input type="text" class="form-control" name="pic" required>
				<br>
                <label>Alamat</label>
                    <input type="text" class="form-control" name="alamat" required>
				<br>
				<label>Keterangan</label>
                    <input type="text" class="form-control" name="ket" >
				<br>
				     
					 <div class="box-footer">
					  <div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
						  <input type="submit" class="btn btn-primary btn-submit" name="submit" value="Simpan">
						  <a href="?module=ibadah" class="btn btn-default btn-reset">Batal</a>
						</div>
					  </div>
					</div><!-- /.box footer -->
			
				
			
                <br>
                <br>
                <br>
            </form> 
			  

            </div><!-- /.box body -->

            
        </div><!-- /.box -->
      </div><!--/.col -->
    </div>   <!-- /.row -->
  </section><!-- /.content -->
<?php
}elseif ($_GET['form']=='edit') { 

	  if (isset($_GET['id'])) {
      // fungsi query untuk menampilkan data dari tabel obat
      $query = mysqli_query($mysqli, "SELECT * 
											,(select nama from is_lokasi where id = ibadah.lokasi)as namalokasi 
											,(select nama from is_sektor where id=(select sektor from is_lokasi where id = ibadah.lokasi))as namasektor 
											,(select sum(total)  from dana where ibadah = ibadah.id and status <>'N' and jenis =1)as jlhkolekte
											,(select sum(total)  from dana where ibadah = ibadah.id and status <>'N' and jenis =2)as jlhperpuluhan
											,(select sum(total)  from dana where ibadah = ibadah.id and status <>'N' and jenis =3)as jlhsyukur
											FROM ibadah  WHERE id='$_GET[id]'") 
                                      or die('Ada kesalahan pada query tampil : '.mysqli_error($mysqli));
      $data  = mysqli_fetch_assoc($query);
	  $id = $_GET['id'];
	  $lokasi = $data['namalokasi'];
	  $sektor = $data['namasektor'];
	  $tanggal = $data['tanggal'];
	  $tglpelayan = $data['tglpelayan'];
	  $lk = $data['lk'];
	  $pr = $data['pr'];
	  $ket = $data['ket'];
	  $kolekte = number_format($data['jlhkolekte'],0);
	  $perpuluhan = number_format($data['jlhperpuluhan'],0);
	  $syukur = number_format($data['jlhsyukur'],0);
	  $pic = $data['pic'];  
	  $alamat = $data['alamat'];  
	  $app = $data['status'];  
    }
?> 
  <!-- tampilan form add data -->
	<!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      <i class="fa fa-edit icon-title"></i> Edit Ibadah #<?=$id;?>
    </h1>

  </section>

  <!-- Main content -->
  <section class="content">
    <div class="row">
      <div class="col-md-6">
        <div class="box box-primary">
          <!-- form start -->
          
            <div class="box-body">
            <form action="modules/ibadah/proses.php?act=editIbadah&id=<?=$id;?>" name="formSaya" method="post">
			<input type="hidden" class="form-control" name="id" value="<?=$id;?>">
                <label>Lokasi</label>
                <select name="lokasi" class="form-control">
                          <?php
                          $pilihpabrik = mysqli_query($mysqli, "SELECT *
																	,(select nama from is_sektor where id = is_lokasi.sektor) as namasektor  
																from is_lokasi where id in ($_SESSION[loc]) and status = 'Y'");
                          while ($fetcharray = mysqli_fetch_array($pilihpabrik)) {
                            $lokasi = $fetcharray['nama']." - ".$fetcharray['namasektor'];
                            $id = $fetcharray['id'];
                            $selected = ($id == $lokasi) ? "selected" : "";
                            ?>
                            <option value="<?= $id; ?>" <?= $selected ?>>
                              <?= $lokasi; ?>
                            </option>
                            <?php
                          }
                          ?>
                </select>
                <br>
                <label>Tanggal</label>
                <div class="input-group">
                    <input type="date" class="form-control" name="tanggal" value="<?php echo date('Y-m-d',strtotime($tanggal)); ?>" >
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>    
                    </div>
                </div> 
                <br>
                <label>Dilaki</label>
                <div class="input-group">
                    <input type="number" class="form-control" name="lk" value="<?=$lk;?>" required>
                    <div class="input-group-addon">
                        <b>Org</b>   
                    </div>
                </div>
				<br>
                <label>Diberu</label>
                <div class="input-group">
                    <input type="number" class="form-control" name="pr" value="<?=$pr;?>" required>
                    <div class="input-group-addon">
                        <b>Org</b>   
                    </div>
                </div>
                <br>
                
                
				
                <label>PJJ Senin Sireh</label>
                <div class="input-group">
                    <input type="date" class="form-control" name="tglpelayan" value="<?php echo date('Y-m-d',strtotime($tglpelayan)); ?>" required>
                    <div class="input-group-addon">
                        <i class="fa fa-calendar"></i>    
                    </div>
                </div> 
				<br>
                <label>Ingan Pulung I Rumah</label>
                    <input type="text" class="form-control" name="pic" value="<?=$pic;?>" required>
				<br>
                <label>Alamat</label>
                    <input type="text" class="form-control" name="alamat"  value="<?=$alamat;?>" required>
				<br>
				<label>Keterangan</label>
                    <input type="text" class="form-control" name="ket" value="<?=$ket;?>" >
				<br>
				     
					<?php
					if($app=="Y"){
					?>
					 <div class="box-footer">
					  <div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
						  <input type="submit" class="btn btn-primary btn-submit" name="submit" value="Simpan">
						  <a href="?module=ibadah" class="btn btn-default btn-reset">Batal</a>
						</div>
					  </div>
					</div><!-- /.box footer -->
					<?php
					}
					?>
				
			
                <br>
                <br>
                <br>
            </form> 
			  

            </div><!-- /.box body -->

            
        </div><!-- /.box -->
      </div><!--/.col -->
	  
	  
	  <div class="col-md-6">
        <div class="box box-primary">
          <!-- form start -->
          
            <div class="box-body">
				<h3>Kolekte (<?php echo"$kolekte"; ?>)</h3>
			<?php
			if($app=="Y"){
			?>
            <form action="modules/ibadah/proses.php?act=addkolekte&id=<?php echo"$_GET[id]";?>" method="post">
				

				<div class="col-md-10">
					<label>Total</label>
                    <input type="number" class="form-control" name="total"  required>
                </div>
				
                

						<div class="col-md-2">
						  <label>&nbsp;</label>
						  <input type="submit" class="btn btn-primary form-control" name="submit" value="+">
						</div>

	

                <br>
                <br>

                <br>
            </form>
			<?php
			}
			?>			
			
			
			<table id="myTable" class="table table-primary table-striped">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Total</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $queryD = mysqli_query($mysqli, "SELECT * 
													from dana
													where ibadah = $_GET[id] and jenis = 1 and status <> 'N'")
													or die('Ada kesalahan pada query tampil Data : '.mysqli_error($mysqli));
 
								$no=0;
                                if (mysqli_num_rows($queryD) > 0) {
                                    foreach ($queryD as $dana) { 
										$no++;
									?>
                                        <tr>
                                            <td><?= $no ?></td>
                                            <td><?= number_format($dana['total'],0); ?></td>
                                            <td>
                                                <a href='modules/ibadah/proses.php?act=deldana&id=<?=$_GET['id'];?>&danaid=<?=$dana['id'];?>'  class="btn btn-danger"><i class="fa fa-trash"></i></a>
											</td>
                                        </tr>
                                <?php }
                                }
                                ?>
								</tbody>
								</table>
			  

            </div><!-- /.box body -->

            
        </div><!-- /.box -->
		
		<div class="box box-primary">
          <!-- form start -->
          
            <div class="box-body">
				<h3>Perpuluhen (<?php echo"$perpuluhan"; ?>)</h3>
			<?php
			if($app=="Y"){
			?>
            <form action="modules/ibadah/proses.php?act=addperpuluhan&id=<?php echo"$_GET[id]";?>" method="post">
				
                <div class="col-md-5">
					<label>Nama</label>
                    <input type="text" class="form-control" name="nama"  required>
				</div>
				<div class="col-md-5">
					<label>Total</label>
                    <input type="number" class="form-control" name="total"  required>
                </div>
				
                

						<div class="col-md-2">
						  <label>&nbsp;</label>
						  <input type="submit" class="btn btn-primary form-control" name="submit" value="+">
						</div>

	

                <br>
                <br>

                <br>
            </form> 
			<?php
			}
			?>
			
			
			<table id="myTable" class="table table-primary table-striped">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Nama</th>
                                    <th>Total</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $queryD = mysqli_query($mysqli, "SELECT * 
													from dana
													where ibadah = $_GET[id] and jenis = 2 and status <> 'N'")
													or die('Ada kesalahan pada query tampil Data : '.mysqli_error($mysqli));
 
								$no=0;
                                if (mysqli_num_rows($queryD) > 0) {
                                    foreach ($queryD as $dana) { 
										$no++;
									?>
                                        <tr>
                                            <td><?= $no ?></td>
                                            <td><?= $dana['nama'] ?></td>
                                            <td><?= number_format($dana['total'],0); ?></td>
                                            <td>
                                                <a href='modules/ibadah/proses.php?act=deldana&id=<?=$_GET['id'];?>&danaid=<?=$dana['id'];?>'  class="btn btn-danger"><i class="fa fa-trash"></i></a>
											</td>
                                        </tr>
                                <?php }
                                }
                                ?>
								</tbody>
								</table>
			  

            </div><!-- /.box body -->

            
        </div><!-- /.box -->
		
		<div class="box box-primary">
          <!-- form start -->
          
            <div class="box-body">
				<h3>Tanda Meriah Ukur (<?php echo"$syukur"; ?>)</h3>
			<?php
			if($app=="Y"){
			?>
            <form action="modules/ibadah/proses.php?act=addsyukur&id=<?php echo"$_GET[id]";?>" method="post">
				
                <div class="col-md-3">
					<label>Nama</label>
                    <input type="text" class="form-control" name="nama"  required>
				</div>
				

                <div class="col-sm-4">
					<label>Tujuan</label>
                  <select class="chosen-select" name="tujuan" data-placeholder="-- Pilih --" autocomplete="off" required>
					<option value=''></option>
					<?php
						$user = $_SESSION['id_user'];
						$query2 = mysqli_query($mysqli, "SELECT * FROM danatujuan where status='Y'  ORDER BY nama asc")
                                            or die('Ada kesalahan pada query tampil: '.mysqli_error($mysqli));

						// tampilkan data
						while ($data2 = mysqli_fetch_assoc($query2)) { 
							echo"<option value='$data2[id]'>$data2[nama]</option>";
						}
						
						?>
                  </select>
                </div>

			  
			  
				<div class="col-md-4">
					<label>Total</label>
                    <input type="number" class="form-control" name="total"  required>
                </div>
				
                

						<div class="col-md-1">
						  <label>&nbsp;</label>
						  <input type="submit" class="btn btn-primary form-control" name="submit" value="+">
						</div>

	

                <br>
                <br>

                <br>
            </form> 
			<?php
			}
			?>
			
			
			<table id="myTable" class="table table-primary table-striped">
                            <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Nama</th>
                                    <th>Total</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $queryD = mysqli_query($mysqli, "SELECT nama, sum(total) as tot 
													from dana
													where ibadah = $_GET[id] and jenis = 3 and status <> 'N' group by nama")
													or die('Ada kesalahan pada query tampil Data : '.mysqli_error($mysqli));
 
								$no=0;
                                if (mysqli_num_rows($queryD) > 0) {
                                    foreach ($queryD as $dana) { 
										$no++;
										
									?>
                                        <tr>
                                            <td><?= $no ?></td>
                                            <td><?= $dana['nama'] ?></td>
                                            <td></td>
                                            <td>
                                                <?= number_format($dana['tot'],0); ?>
											</td>
                                        </tr>
										<?php
										$queryDet = mysqli_query($mysqli, "SELECT *,(select nama from danatujuan where id = dana.tujuan) as namatujuan
																			from dana
																			where ibadah = $_GET[id] and jenis = 3 and status <> 'N' and nama = '$dana[nama]'")
																			or die('Ada kesalahan pada query tampil Data : '.mysqli_error($mysqli));
										if (mysqli_num_rows($queryDet) > 0) {
											foreach ($queryDet as $danadetail) { 
												$totdetail = number_format($danadetail['total'],0);
												echo"
													<tr>
														<td>&nbsp; </td>
														<td>** <a href='modules/ibadah/proses.php?act=deldana&id=$_GET[id]&danaid=$danadetail[id]'  class='btn btn-danger'><i class='fa fa-trash'></i></a> $danadetail[namatujuan]</td>
														<td>$totdetail</td>
														<td>
															
														</td>
													</tr>
												
												";												
											}
										}
										?>
										
                                <?php }
                                }
                                ?>
								</tbody>
								</table>
			  

            </div><!-- /.box body -->

            
        </div><!-- /.box -->
		
      </div><!--/.col -->
	  
	  
	  
    </div>   <!-- /.row -->
  </section><!-- /.content -->
<?php
}
// jika form edit data yang dipilih
// isset : cek data ada / tidak
elseif ($_GET['form']=='ZZ') { 
  if (isset($_GET['id'])) {
      // fungsi query untuk menampilkan data dari tabel obat
      $query = mysqli_query($mysqli, "SELECT *,(select category_name from categorybiaya where category_id = biaya.kategori) as category_name  FROM biaya  WHERE id='$_GET[id]'") 
                                      or die('Ada kesalahan pada query tampil : '.mysqli_error($mysqli));
      $data  = mysqli_fetch_assoc($query);
	  $images = $data['images'];
    }
?>
  <!-- tampilan form edit data -->
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      <i class="fa fa-edit icon-title"></i> Edit Biaya
    </h1>

  </section>

  <!-- Main content -->
  <section class="content">
    <div class="row">
      <div class="col-md-12">
        <div class="box box-primary">
          <!-- form start -->
          <form role="form" class="form-horizontal" action="modules/biaya/proses.php?act=update" method="POST" name="formBiaya"   enctype="multipart/form-data">
            <div class="box-body">
              <input type="text" class="form-control" style="display:none;" name="id" value="<?php echo $data['id']; ?>" required>
              <div class="form-group">
                <label class="col-sm-2 control-label">Tanggal</label>
                <div class="col-sm-5">
                  <input type="text" class="form-control date-picker" data-date-format="dd-mm-yyyy" name="tanggal" autocomplete="off" value="<?php echo date("d-m-Y",strtotime($data['billdate'])); ?>" required>
                </div>
              </div>
			  
			  
			   <div class="form-group">
                <label class="col-sm-2 control-label">Kategori</label>
                <div class="col-sm-5">
                  <select class="chosen-select" name="kategori" data-placeholder="-- Pilih --" autocomplete="off" required>
					<option value="<?php echo $data['kategori']; ?>"><?php echo $data['category_name']; ?></option>
					<?php
						$user = $_SESSION['id_user'];
						$query2 = mysqli_query($mysqli, "SELECT * FROM categorybiaya where category_status='Y'  ORDER BY category_name asc")
                                            or die('Ada kesalahan pada query tampil: '.mysqli_error($mysqli));

						// tampilkan data
						while ($data2 = mysqli_fetch_assoc($query2)) { 
							echo"<option value='$data2[category_id]'>$data2[category_name]</option>";
						}
						
						?>
                  </select>
                </div>
              </div>
			  
			  
			  
    

              <div class="form-group">
                <label class="col-sm-2 control-label">Keterangan</label>
                <div class="col-sm-5">
                  <input type="text" class="form-control" name="name" value="<?php echo $data['ket']; ?>" autocomplete="off" required>
                </div>
              </div>
			  
			  
			  <div class="form-group">
                <label class="col-sm-2 control-label">Jenis</label>
                <div class="col-sm-5">
                  <select class="chosen-select" name="jenis" data-placeholder="-- Pilih --" autocomplete="off" required>
					<?php
							echo"<option value='$data[jenis]'>$data[jenis]</option>";
							echo"<option value='kredit'>Kredit</option>";
							echo"<option value='debet'>Debet</option>";
						
						?>
                  </select>
                </div>
              </div>
			  
			  <div class="form-group">
                <label class="col-sm-2 control-label">Qty</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" id="harga_beli" name="qty" autocomplete="off" value="<?php echo $data['qty']; ?>" onkeyup="hitung_total_stok(this)" onKeyPress="return goodchars(event,'0123456789',this)" >
                </div>
              </div>
			  
			  
			  <div class="form-group">
                <label class="col-sm-2 control-label">Harga</label>
                <div class="col-sm-5">
                  <div class="input-group">
                    <span class="input-group-addon">Rp.</span>
                    <input type="text" class="form-control" id="harga_jual" name="total"  value="<?php echo $data['harga']; ?>" onkeyup="hitung_total_stok(this)" autocomplete="off" onKeyPress="return goodchars(event,'0123456789',this)" >
                  </div>
                </div>
              </div>
			  
			  
			  <div class="form-group">
                <label class="col-sm-2 control-label">Total</label>
                <div class="col-sm-5">
                  <div class="input-group">
                    <span class="input-group-addon">Rp.</span>
                    <input type="text" class="form-control" id="total_stok" name="total_stok" value="<?php $tot = $data['harga'] * $data['qty']; echo "$tot"; ?>" autocomplete="off" onKeyPress="return goodchars(event,'0123456789',this)"  readonly>
                  </div>
                </div>
              </div>
			  
			  <div class="form-group">
                <label class="col-sm-2 control-label">Image</label>
                <div class="col-sm-5">
                  <input type="file" name="foto">
                  <br/>
                <?php  
                if ($data['images']=="") { ?>
                  <img style="border:1px solid #eaeaea;border-radius:5px;" src="images/user/noimg.jpg" width="128">
                <?php
                }
                else { 
					if(substr($data['images'],-3) == "pdf"){?>
						<a href="images/user/<?php echo $data['images']; ?>"><img style="border:1px solid #eaeaea;border-radius:5px;"  src="images/user/pdf.jpg" width="128"></a>
					<?php
					}else{
					?>
						<img style="border:1px solid #eaeaea;border-radius:5px;" data-toggle='modal' data-target='#myModal' src="images/user/<?php echo $data['images']; ?>" width="128">
					
                <?php
					}
                }
                ?>
                </div>
              </div>





            </div><!-- /.box body -->

            <div class="box-footer">
              <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                  <input type="submit" class="btn btn-primary btn-submit" name="simpan" value="Simpan">
                  <a href="?module=biaya" class="btn btn-default btn-reset">Batal</a>
                </div>
              </div>
            </div><!-- /.box footer -->
          </form>
		  
		  
		  
		   <?php
			echo"							
				<div id='myModal' class='modal fade' tabindex='-1' role='dialog'>
				  <div class='modal-dialog'>
					<div class='modal-content'>
						<div class='modal-body'>
							<img src='images/user/$images' class='img-responsive'>
						</div>
					</div>
				  </div>
				</div>";
				
		?>
        </div><!-- /.box -->
      </div><!--/.col -->
    </div>   <!-- /.row -->
  </section><!-- /.content -->
<?php
}
?>


<script type="text/javascript">

  function hitung_total_stok() {
    bil1 = document.formBiaya.qty.value;
    bil2 = document.formBiaya.total.value;
	
	bil1 = bil1.replace(".","");
	bil2 = bil2.replace(".","");

    if (bil2 == "") {
      var hasil = "";
    }
    else {
      var hasil = eval(bil1.replace(".","")) * eval(bil2.replace(".",""));
    }

    document.formBiaya.total_stok.value = (hasil.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
  }
</script>
