81 lines
3.0 KiB
PHP
81 lines
3.0 KiB
PHP
<?php
|
|
include '../template/template1.php';
|
|
include '../template/header.php';
|
|
include '../template/sidebar.php';
|
|
?>
|
|
|
|
<main id="main" class="main">
|
|
<div class="pagetitle">
|
|
<h1>Daftar Pemasok</h1>
|
|
<nav>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="../index.php">Home</a></li>
|
|
<li class="breadcrumb-item active">Pemasok</li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
|
|
<div class="card mt-2">
|
|
<div class="card-body">
|
|
<a href="tambah.php" class="btn btn-primary mb-3 mt-3">Tambah Pemasok</a>
|
|
<table class="table datatable">
|
|
<thead>
|
|
<tr>
|
|
<th>No</th>
|
|
<th>Nama</th>
|
|
<th>No HP</th>
|
|
<th>Harga Beli</th>
|
|
<th>Berat (kg)</th>
|
|
<th>Jumlah</th>
|
|
<th>Tanggal</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$no = 1;
|
|
$result = mysqli_query($conn, "SELECT * FROM pemasok");
|
|
while ($row = mysqli_fetch_assoc($result)) :
|
|
?>
|
|
<tr>
|
|
<td><?= $no++; ?></td>
|
|
<td><?= $row['nama_pemasok']; ?></td>
|
|
<td><?= $row['no_hp']; ?></td>
|
|
<td>Rp <?= number_format($row['harga_beli'], 0, ',', '.'); ?></td>
|
|
<td><?= number_format($row['berat'], 2, ',', '.'); ?> kg</td>
|
|
<td><?= $row['jumlah']; ?></td>
|
|
<td><?= date('d-m-Y', strtotime($row['tanggal'])); ?></td>
|
|
<td>
|
|
<a href="edit.php?id=<?= $row['id_pemasok']; ?>" class="btn btn-warning btn-sm">Edit</a>
|
|
<a href="javascript:void(0)" class="btn btn-danger btn-sm" onclick="konfirmasiHapus(<?= $row['id_pemasok']; ?>)">Hapus</a>
|
|
<a href="cetak.php?id=<?= $row['id_pemasok']; ?>" target="_blank" class="btn btn-success btn-sm">Cetak Nota</a>
|
|
</td>
|
|
</tr>
|
|
<?php endwhile; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
function konfirmasiHapus(id) {
|
|
Swal.fire({
|
|
title: 'Yakin ingin menghapus?',
|
|
text: "Data pemasok akan dihapus secara permanen!",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#d33',
|
|
cancelButtonColor: '#6c757d',
|
|
confirmButtonText: 'Ya, hapus!'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
window.location.href = 'hapus.php?id=' + id;
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<?php include '../template/footer.php'; ?>
|
|
<?php include '../template/template2.php'; ?>
|