-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_invoice.php
More file actions
97 lines (85 loc) · 2.86 KB
/
get_invoice.php
File metadata and controls
97 lines (85 loc) · 2.86 KB
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
<html>
<head>
<style>
body{
background-color: rgb(208,240,192);
}
.styled-table{
border-collapse: collapse;
margin: 25px 0;
font-size: 0.9em;
font-family: sans-serif;
min-width: 400px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.30);
}
.styled-table th {
background-color: #009879;
color: #ffffff;
text-align: left;
}
.styled-table th,
.styled-table td {
padding: 12px 15px;
}
.styled-table tbody tr {
border-bottom: 1px solid #dddddd;
}
.styled-table tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
.styled-table tbody tr:nth-of-type(odd) {
background-color: rgb(211,211,211);
}
.styled-table tbody tr:last-of-type {
border-bottom: 2px solid #009879;
}
.styled-table tbody tr.active-row {
font-weight: bold;
color: #009879;
}
</style>
</head>
<body>
<center> <button onclick="window.print()">PRINT INVOICE</button></center>
</body>
</html>
<?php
session_start();
if(isset($_SESSION['IS_AUTHENTICATED']) && $_SESSION['IS_AUTHENTICATED'] ==1){
if($_POST['transaction_id']) {
require('menu.php');
$link=mysqli_connect('localhost','root','');
if(!$link){
die("Unable to connect ".mysqli_error());
}
$db=mysqli_select_db($link,'test');
if(!$db){
die('Unable to select database');
}
$transaction_id= $_POST['transaction_id'];
$qry="SELECT transaction_id,customer_name,product_name,quantity,amount,date FROM sales,customer where transaction_id=$transaction_id and sales.customer_id=customer.customer_id";
$result=mysqli_query($link,$qry);
echo '<center><h2>INVOICE</h2></center>';
echo '<center>';
echo '<table class="styled-table" >
<tr>
</tr></thead><tbody>';
while($row=mysqli_fetch_assoc($result)){
echo '
<tr><th>Transaction Id</th><td>'.$row['transaction_id'].'</td></tr>
<tr><th>Customer Name</th><td>'.$row['customer_name'].'</td></tr>
<tr><th>Product Name</th><td>'.$row['product_name'].'</td> </tr>
<tr><th>Quantity</th><td>'.$row['quantity'].'</td> </tr>
<tr><th>Amount</th><td>'.$row['amount'].'</td> </tr>
<tr><th>Date</th><td>'.$row['date'].'</td> </tr>';
}
echo"</tbody>";
echo '</table>';
echo '</center>';
}
}
else{
header('location:login_modified.php');
exit();
}
?>