Upload New File

parent 2da78b68
<?php
session_start();
include('../config.php');
include('function.php');
// include("../common/dbconfig.php");
include("template/header.php");
include("../common/function.php");
open_page("Daftar Pembayaran");
if(! isset($_SESSION['is_login']))
{
header('location:../index.php');
}
if (!isset($_SESSION["username"])){
// echo "<script>alert('Login terlebih dahulu');window.location='../index.php';</script>";
// exit;
echo "Anda harus login dulu <br><a href='../index.php'>Klik disini</a>";
exit;
}
$role = $_SESSION["role"];
if($role != "admin"){
echo "<script>alert('Anda bukan admin');window.location='../index.php';</script>";
exit;
}
$id_akun = $_SESSION["id_akun"];
$nama = $_SESSION["nama"];
$username = $_SESSION["username"];
$data = query("SELECT p_pembayaran.id_pembayaran, p_pembayaran.kode_pembayaran, t_tiketsdia.harga, pmt_tiket.j_pemesanan, pmt_tiket.via_pembayaran, p_pembayaran.status, t_tiketsdia.kode_tiket, log_akun.username, log_akun.nama
FROM ((pt_kategori INNER JOIN pt_trans ON pt_kategori.id_kategori = pt_trans.kategori_id) INNER JOIN (destinasi INNER JOIN t_tiketsdia ON destinasi.id_destinasi = t_tiketsdia.t_destinasi) ON pt_trans.id_transp = t_tiketsdia.t_kendaraan) INNER JOIN ((log_akun INNER JOIN pmt_tiket ON log_akun.id_akun = pmt_tiket.akun_id) INNER JOIN p_pembayaran ON pmt_tiket.id_pemesanan = p_pembayaran.id_ptiket) ON t_tiketsdia.ID = pmt_tiket.tiket_id
WHERE status = 'Menunggu'");
$data2 = query("SELECT p_pembayaran.id_pembayaran, p_pembayaran.kode_pembayaran, t_tiketsdia.harga, pmt_tiket.j_pemesanan, pmt_tiket.via_pembayaran, p_pembayaran.status, t_tiketsdia.kode_tiket, log_akun.username, log_akun.nama
FROM ((pt_kategori INNER JOIN pt_trans ON pt_kategori.id_kategori = pt_trans.kategori_id) INNER JOIN (destinasi INNER JOIN t_tiketsdia ON destinasi.id_destinasi = t_tiketsdia.t_destinasi) ON pt_trans.id_transp = t_tiketsdia.t_kendaraan) INNER JOIN ((log_akun INNER JOIN pmt_tiket ON log_akun.id_akun = pmt_tiket.akun_id) INNER JOIN p_pembayaran ON pmt_tiket.id_pemesanan = p_pembayaran.id_ptiket) ON t_tiketsdia.ID = pmt_tiket.tiket_id
WHERE status = 'Transaksi Berhasil'");
?>
<div class="container mt-2 ml-2">
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Daftar Pembayaran Tiket</h2>
</div>
</div>
</section>
<!-- End Breadcrumbs -->
<!-- Start Content -->
<table class="table table-bordered mt-3 mb-2">
<thead class="thead-dark">
<h4>Daftar Pembayaar - Menunggu</h4>
<tr align="center">
<th scope="col">Nama Pemesan</th>
<th scope="col">Kode Pembayaran</th>
<th scope="col">Kode Tiket</th>
<th scope="col">Harga Tiket</th>
<th scope="col">Jumlah Tiket</th>
<th scope="col">Via Pembayaran</th>
<th scope="col">Status Pembayaran</th>
</tr>
</thead>
<?php
foreach($data as $list_bayar) { ?>
<tr align="center">
<td ><?=$list_bayar['nama']?>(<?=$list_bayar['username']?>)</td>
<td ><?=$list_bayar['kode_pembayaran']?></td>
<td ><?=$list_bayar['kode_tiket']?></td>
<td ><?=$list_bayar['harga']?></td>
<td ><?=$list_bayar['j_pemesanan']?></td>
<td ><?=$list_bayar['via_pembayaran']?></td>
<td>
<?=$list_bayar['status']?>
<a href="validasi.php?id_pembayaran=<?=$list_bayar['id_pembayaran']?>" class="badge badge-primary">Validasi</a>
</td>
</tr>
<?php } ?>
</table>
<table class="table table-bordered mt-3 mb-2">
<thead class="thead-dark">
<h4>Daftar Pembayaar - Berhasil</h4>
<tr align="center">
<th scope="col">Nama Pemesan</th>
<th scope="col">Kode Pembayaran</th>
<th scope="col">Kode Tiket</th>
<th scope="col">Harga Tiket</th>
<th scope="col">Jumlah Tiket</th>
<th scope="col">Via Pembayaran</th>
<th scope="col">Status Pembayaran</th>
</tr>
</thead>
<?php
foreach($data2 as $list_bayar2) { ?>
<tr align="center">
<td ><?=$list_bayar2['nama']?>(<?=$list_bayar2['username']?>)</td>
<td ><?=$list_bayar2['kode_pembayaran']?></td>
<td ><?=$list_bayar2['kode_tiket']?></td>
<td ><?=$list_bayar2['harga']?></td>
<td ><?=$list_bayar2['j_pemesanan']?></td>
<td ><?=$list_bayar2['via_pembayaran']?></td>
<td><?=$list_bayar2['status']?></td>
</tr>
<?php } ?>
</table>
<div style="width: 800px;margin: 0px auto;">
<h1>Grafik Status Pembayaran Tiket <span>Travel OK</span> </h1>
<canvas id="myChart"></canvas>
</div>
</div>
<!-- End Content -->
<!-- Chart -->
<script>
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Menunggu", "Berhasil"],
datasets: [{
label: '',
data: [
<?php
$jumlah_menunggu = mysqli_query($koneksi,"select * from p_pembayaran where status='Menunggu'");
echo mysqli_num_rows($jumlah_menunggu);
?>,
<?php
$jumlah_berhasil = mysqli_query($koneksi,"select * from p_pembayaran where status='Transaksi Berhasil'");
echo mysqli_num_rows($jumlah_berhasil);
?>
],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(0, 255, 9, 0.2)'
],
borderColor: [
'rgba(255,230,0,1)',
'rgba(0, 34, 255, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
</script>
<!-- End -->
<?php
include("template/footer.php")
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment