99 lines
2.7 KiB
PHP
99 lines
2.7 KiB
PHP
<?php
|
|
include '../../config.php'; // Sesuaikan dengan koneksi database
|
|
|
|
if (!isset($_GET['id'])) {
|
|
echo "<script>alert('ID pemasok tidak ditemukan!');window.close();</script>";
|
|
exit;
|
|
}
|
|
|
|
$id_pemasok = $_GET['id'];
|
|
$query = mysqli_query($conn, "SELECT * FROM pemasok WHERE id_pemasok = '$id_pemasok'");
|
|
$pemasok = mysqli_fetch_assoc($query);
|
|
|
|
if (!$pemasok) {
|
|
echo "<script>alert('Data pemasok tidak ditemukan!');window.close();</script>";
|
|
exit;
|
|
}
|
|
|
|
$total_harga = $pemasok['harga_beli'] * $pemasok['berat'];
|
|
$tanggal_transaksi = date('d-m-Y', strtotime($pemasok['tanggal'])); // Format Tanggal
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Nota Pemasok</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
text-align: center;
|
|
margin: 20px;
|
|
}
|
|
.container {
|
|
width: 80%;
|
|
margin: auto;
|
|
padding: 20px;
|
|
border: 1px solid #000;
|
|
}
|
|
h2 {
|
|
margin-bottom: 20px;
|
|
}
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 20px;
|
|
}
|
|
table, th, td {
|
|
border: 1px solid black;
|
|
}
|
|
th, td {
|
|
padding: 10px;
|
|
text-align: center;
|
|
}
|
|
.print-button {
|
|
margin-top: 20px;
|
|
}
|
|
@media print {
|
|
.print-button {
|
|
display: none;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<h2>Nota Pemasok</h2>
|
|
<p><strong>Tanggal Transaksi:</strong> <?= date('d F Y', strtotime($pemasok['tanggal'])); ?></p>
|
|
<p><strong>Nama Pemasok:</strong> <?= $pemasok['nama_pemasok']; ?></p>
|
|
<p><strong>No HP:</strong> <?= $pemasok['no_hp']; ?></p>
|
|
|
|
<h3>Detail Pembelian</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Harga Beli per kg</th>
|
|
<th>Berat Total</th>
|
|
<th>Total Harga</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Rp<?= number_format($pemasok['harga_beli'], 0, ',', '.'); ?></td>
|
|
<td><?= $pemasok['berat']; ?> kg</td>
|
|
<td><strong>Rp<?= number_format($total_harga, 0, ',', '.'); ?></strong></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<h3>Total Pembayaran: <strong>Rp<?= number_format($total_harga, 0, ',', '.'); ?></strong></h3>
|
|
|
|
<button class="print-button" onclick="window.print()">Cetak</button>
|
|
<button class="print-button" onclick="window.close()">Tutup</button>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|