-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpass-print-ticket.php
executable file
·147 lines (142 loc) · 5.72 KB
/
pass-print-ticket.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
session_start();
include('assets/inc/config.php');
include('assets/inc/checklogin.php');
check_login();
$aid=$_SESSION['pass_id'];
?>
<!DOCTYPE html>
<html lang="en">
<!--Head-->
<?php include('assets/inc/head.php');?>
<!--End Head-->
<body>
<div class="be-wrapper be-fixed-sidebar">
<!--Nav Bar-->
<?php include('assets/inc/navbar.php');?>
<!--End Navbar-->
<!--Sidebar-->
<?php include('assets/inc/sidebar.php');?>
<!--End Sidebar-->
<div class="be-content">
<div class="page-head">
<h2 class="page-head-title">Train Ticket</h2>
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb page-head-nav">
<li class="breadcrumb-item"><a href="#">Dashbaord</a></li>
<li class="breadcrumb-item"><a href="#">Tickets</a></li>
<li class="breadcrumb-item active">Print</li>
</ol>
</nav>
</div>
<?php
/**
*Server side code to get details of single passenger using id
*/
$aid=$_SESSION['pass_id'];
$ret="select * from orrs_passenger where pass_id=?";//fetch details of pasenger
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<!--get details of logged in user-->
<div class="main-content container-fluid">
<div class="row">
<div class="col-lg-12">
<!--Train Details-->
<div id='printReceipt' class="invoice">
<div class="row invoice-header">
<div class="col-sm-7">
<div class="invoice-logo"></div>
</div>
<div class="col-sm-5 invoice-order"><span class="invoice-id">Train Ticket For</span><span class="incoice-date"><?php echo $row->pass_fname;?> <?php echo $row->pass_lname;?></span></div>
</div>
<div class="row invoice-data">
<div class="col-sm-5 invoice-person"><span class="name"><?php echo $row->pass_fname;?> <?php echo $row->pass_lname;?></span><span><?php echo $row->pass_email;?></span><span><?php echo $row->pass_addr;?></span></div>
<div class="col-sm-2 invoice-payment-direction"></div>
</div>
<div class="row">
<div class="col-lg-12">
<table class="invoice-details" >
<thead>
<tr>
<th>Train Number</th>
<th>Train Name</th>
<th>Departure Station</th>
<th>Arrival Station</th>
<th>Departure Time</th>
<th>Fare</th>
</tr>
</thead>
<tbody>
<?php
/**
*Lets select train booking details of logged in user using PASSENGER ID as the session
*/
//$aid=$_SESSION['pass_id'];
$ret="select * from orrs_passenger where pass_id=?";//sql to get details of our user
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<tr>
<td><?php echo $row->pass_train_number;?></td>
<td><?php echo $row->pass_train_name;?></td>
<td><?php echo $row->pass_dep_station;?></td>
<td><?php echo $row->pass_arr_station;?></td>
<td><?php echo $row->pass_dep_time;?></td>
<td><span class="badge badge-pill badge-success">Ksh<?php echo $row->pass_train_fare;?></span></td>
</tr>
<hr>
<?php }?>
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="row invoice-footer">
<div class="col-lg-12">
<button id="print" onclick="printContent('printReceipt');" class="btn btn-lg btn-space btn-secondary">Print</button>
</div>
</div>
</div>
</div>
</div>
<!--Close logged in user instance-->
<?php }?>
<!--footer-->
<?php include('assets/inc/footer.php');?>
<!--end footer-->
</div>
</div>
<script src="assets/lib/jquery/jquery.min.js" type="text/javascript"></script>
<script src="assets/lib/perfect-scrollbar/js/perfect-scrollbar.min.js" type="text/javascript"></script>
<script src="assets/lib/bootstrap/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="assets/js/app.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
//-initialize the javascript
App.init();
});
</script>
<!--print train ticket js-->
<script>
function printContent(el){
var restorepage = $('body').html();
var printcontent = $('#' + el).clone();
$('body').empty().html(printcontent);
window.print();
$('body').html(restorepage);
}
</script>
</body>
</html>