[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
05122024
/
htdocs
/
simkeu
/
sia
/
[
Home
]
File: EditPengeluaran.inc.php
<?php $id = ""; $uraian = ""; $nominal = ""; $tgl = ""; $buton = "Simpan"; $u_pswd = "-"; $u_name = "-"; $nominal = "-"; $ktp = "-"; $kota_asal = "-"; $alamat = "-"; $tgl = "-"; $uraian = "-"; if(isset($_GET["deleteID"])) { $sql = "delete from keu_pengeluaran where id = ".$_GET["deleteID"]; if (mysqli_query($conn, $sql)) { echo "<script>window.alert('Data Sudah Terhapus');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } if(isset($_GET["editID"])) { $sql = "SELECT * FROM keu_pengeluaran where id = ".$_GET["editID"]." order by id desc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $id = $row['id']; $uraian = $row['uraian']; $nominal = $row['nominal']; $id_jenispengeluaran = $row['id_jenispengeluaran']; $tgl = $row['tgl']; $buton = "Koreksi"; } } } if(isset($_POST["Simpan"]) || isset($_POST["Koreksi"])) { if(isset($_POST["nominal"])) $nominal = $_POST["nominal"]; if(isset($_POST["tgl"])) $tgl = $_POST["tgl"]; if(isset($_POST["uraian"])) $uraian = $_POST["uraian"]; if(isset($_POST["id"])) $id = $_POST["id"]; if(isset($_POST["id_jenispengeluaran"])) $id_jenispengeluaran = $_POST["id_jenispengeluaran"]; $tbField[0] = "uraian"; $tbField[1] = "nominal"; $tbField[2] = "tgl"; $tbField[3] = "id_jenispengeluaran"; $tbIsi[0] = "'".$uraian."'"; $tbIsi[1] = "'".$nominal."'"; $tbIsi[2] = "'".($tgl)."'"; $tbIsi[3] = "'".($id_jenispengeluaran)."'"; if(isset($_POST["Simpan"])) { $nmField = compile_array($tbField); $isiField = compile_array($tbIsi); $sql = "insert into keu_pengeluaran (".$nmField.") values (".$isiField.")"; $notif = $ssm; } if(isset($_POST["Koreksi"])) { $compileSet = compile_array2($tbField,$tbIsi); $sql = "update keu_pengeluaran set ".$compileSet." where id = ".$id; $notif = $sum; } if (mysqli_query($conn, $sql)) { echo "<script>window.alert('".$notif."');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } ?> <div class="container-fluid"> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">Entry Data </h6> </div> <div class="card-body"> <form class="user" action="dashboard.php?EditPengeluaran" accept-charset="utf-8" method="post"> <div class="col m6"> <div class="row"> <div class="input-field col m6 s12"> <table border="0" width="100%" cellspacing="1" cellpadding="1"> <tr> <td width="30%">Uraian/Keterangan</td> <td width="70%"> <input value="<?php echo $id;?>" name="id" type="hidden"> <input value="<?php echo $uraian;?>" name="uraian" type="text" class="form-control" id="exampleFirstName" placeholder="Username Feeder"> </td> </tr> <tr> <td>Kategori</td> <td> <select name="id_jenispengeluaran" type="text" class="form-control" id="id_jenispengeluaran"> <option value=0>-- Pilih --</option> <?php $sql = "SELECT * FROM keu_jpengeluaran order by jenis_pengeluaran asc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { ?> <option value="<?php echo $row["id"];?>" <?php if($id_jenispengeluaran == $row["id"]) echo "selected";?>><?php echo $row["jenis_pengeluaran"];?></option> <?php } } ?> </select> </td> </tr> <tr> <td>Nominal</td> <td> <input value="<?php echo $nominal;?>" name="nominal" type="text" class="form-control" id="nominal" placeholder=""> </td> </tr> <tr> <td>Tanggal</td> <td> <input value="<?php echo $tgl;?>" name="tgl" type="date" class="form-control" id="var" placeholder="uraian periode masuk"> </td> </tr> <?php if(isset($_GET["editID"])) { ?> <tr> <td> </td> <td> <div class="form-group row"> <div class="col-sm-3 mb-3 mb-sm-0"> <button name="<?php echo $buton;?>" type="submit" class="btn btn-primary btn-block"><?php echo $buton;?></button> </div> <div class="col-sm-3"> <button name="Cancel" type="submit" class="btn btn-primary btn-block">Cancel</button> </div> </div> </td> </tr> <?php } ?> </table> </div> </div> </div> </div> </div> </div> </form> <div class="container-fluid"> <!-- Page Heading --> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary">DataTables</h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th>Aksi</th> <th>Tanggal</th> <th>Kategori</th> <th>Uraian</th> <th>Nominal</th> </tr> </thead> <tfoot> <tr> <th>Aksi</th> <th>Tanggal</th> <th>Kategori</th> <th>Uraian</th> <th>Nominal</th> </tr> </tfoot> <tbody> <?php $sql = "SELECT a.id,a.tgl,b.jenis_pengeluaran,a.uraian,a.nominal FROM keu_pengeluaran a left join keu_jpengeluaran b on a.id_jenispengeluaran = b.id order by tgl desc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { ?> <tr> <td> <!--a class="btn btn-primary btn-danger" href="dashboard.php?EditPengeluaran&deleteID=<?php echo $row['id'];?>"><i class="fas fa-trash"></i></a--> <a class="btn btn-primary btn-warning" href="dashboard.php?EditPengeluaran&editID=<?php echo $row['id'];?>"><i class="fas fa-edit"></i></a> </td> <td><?php echo $row['tgl'];?></td> <td><?php echo $row['jenis_pengeluaran'];?></td> <td><?php echo $row['uraian'];?></td> <td align="right">Rp. <?php echo format_currency($row['nominal']);?></td> </tr> <?php } } ?> </tbody> </table> </div> </div> </div> </div>