-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocessHistory.php
125 lines (119 loc) · 4.92 KB
/
processHistory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
session_start();
require 'db.php';
require 'loginControl.php';
$activePage = "history";
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Transaction History</title>
<link rel="icon" type="image/x-icon" href="./Public/img/favicon.png">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<!-- Datatables için gerekli cdnler-->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/1.13.7/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<link href="https://cdn.datatables.net/buttons/2.4.2/css/buttons.bootstrap5.min.css" rel="stylesheet">
</head>
<body>
<?php require 'navbar.php';?>
<div class="container">
<div class="row">
<div class='row justify-content-center text-center'>
<div class="col-sm-4 col-md-6 col-lg-8">
<h1 class='alert alert-primary mt-2'>Transaction History</h1>
</div>
</div>
<div class='row justify-content-start text-center'>
<h2 class="text-warning mt-3">Welcome</h2>
<h3 class="text-info mb-3">Name: <?php echo $_SESSION['adsoyad'] ?></h3>
</div>
<div>
<!-- İşlem geçmişini listeleme -->
<table id="example" class="table table-bordered table-striped" style="width:100%">
<thead>
<tr>
<th>Process İd</th>
<th>Sender</th>
<th>Reciver</th>
<th>Transaction Amount</th>
<th>Process Time</th>
</tr>
</thead>
<tbody>
</div>
<!-- Göndericinin yada alıcının id bilgisine göre işlem geçmişi listeleme -->
<?php
require_once 'db.php';
$sql = "SELECT * FROM transactions where senderid = :idUser or reciverid = :idUser";
$SORGU = $DB->prepare($sql);
$SORGU->bindParam(':idUser', $_SESSION['id']);
$SORGU->execute();
$transactions = $SORGU->fetchAll(PDO::FETCH_ASSOC);
foreach ($transactions as $transaction) {
$processtime = new DateTime($transaction['processtime']);
$formattedProcesstime = $processtime->format('d-m-Y H:i:s'); // İstediğiniz formatta tarih ve saat
// Eğer session ID, işlemi gerçekleştirenin ID'sine eşitse
if ($_SESSION['id'] == $transaction['senderid']) {
//!Para gönderdiği için - işareti şeklinde gösterilmesi
$companyBalanceDisplay = "-{$transaction['companybalance']}₺";
//!Para aldığı için + işareti şeklinde gösterilmesi
} else {
$companyBalanceDisplay = "+{$transaction['companybalance']}₺";
}
echo "
<tr>
<th>{$transaction['id']}</th>
<td>{$transaction['sender']}</td>
<td>{$transaction['reciver']}</td>
<td>{$companyBalanceDisplay}</td>
<td>{$formattedProcesstime}</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
<a href="index.php" class="btn btn-warning">Back To Home</a>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<!-- Datatables için gerekli cdnler-->
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.7/js/dataTables.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.bootstrap5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.print.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.colVis.min.js"></script>
<script>
//! Datatablestaki export butonlarının düzenlenmesi
$(document).ready(function() {
var table = $('#example').DataTable( {
lengthChange: false,
dom: 'lBfrtip',
buttons: {
buttons: [
{ extend: 'pageLength', className: 'btn-primary'},
{ extend: 'copy', className: 'btn btn-dark'},
{ extend: 'excel', className: 'btn btn-success'},
{ extend: 'csv', className: 'btn btn-danger' },
{ extend: 'pdf', className: 'btn btn-warning' },
{ extend: 'print', className: 'btn btn-secondary' },
{ extend: 'colvis', className: 'btn btn-info' }
]
}
} );
table.buttons().container()
.appendTo( '#example_wrapper .col-md-6:eq(0)' );
} );
/* buttons: [ 'copy', 'excel','csv', 'pdf', 'colvis' ] */
</script>
</body>
</html>