-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.php
152 lines (152 loc) · 5.43 KB
/
invoice.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
148
149
150
151
152
<?php
include_once 'database.php';
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM tbl_orders_a176607_pt2, tbl_staffs_a176607_pt2, tbl_customers_a176607_pt2, tbl_orders_details_a176607_pt2 WHERE tbl_orders_a176607_pt2.fld_staff_id = tbl_staffs_a176607_pt2.fld_staff_id AND tbl_orders_a176607_pt2.fld_customer_id = tbl_customers_a176607_pt2.fld_customer_id AND tbl_orders_a176607_pt2.fld_order_id = tbl_orders_details_a176607_pt2.fld_order_id AND tbl_orders_a176607_pt2.fld_order_id = :oid");
$stmt->bindParam(':oid', $oid, PDO::PARAM_STR);
$oid = $_GET['oid'];
$stmt->execute();
$readrow = $stmt->fetch(PDO::FETCH_ASSOC);
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
$conn = null;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JM Computer SDN BHD : Invoice</title>
<link rel="icon" type="image/x-icon" href="products/JM_Computer_SDN_BHD_Favicon.png">
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="row">
<div class="col-xs-6 text-center">
<br>
<img src="products/JM_Computer_SDN_BHD.png" width="60%" height="60%">
</div>
<div class="col-xs-6 text-right">
<h1>INVOICE</h1>
<h5>Order: <?php echo $readrow['fld_order_id'] ?></h5>
<h5>Date: <?php echo $readrow['fld_order_date'] ?></h5>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-5">
<div class="panel panel-default">
<div class="panel-heading">
<h4>From: JM Computer Sdn. Bhd.</h4>
</div>
<div class="panel-body">
<p>
Skudai <br>
Johor Bahru <br>
81300 <br>
Johor <br>
</p>
</div>
</div>
</div>
<div class="col-xs-5 col-xs-offset-2 text-right">
<div class="panel panel-default">
<div class="panel-heading">
<h4>To : <?php echo $readrow['fld_customer_name'] ?></h4>
</div>
<div class="panel-body">
<p>
Universiti Kebangsaan Malaysia <br>
Bangi <br>
43600 <br>
Selangor <br>
</p>
</div>
</div>
</div>
</div>
<table class="table table-bordered">
<tr>
<th>No.</th>
<th>Product</th>
<th class="text-right">Quantity</th>
<th class="text-right">Price/Unit($)</th>
<th class="text-right">Total($)</th>
</tr>
<?php
$grandtotal = 0;
$counter = 1;
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM tbl_orders_details_a176607_pt2, tbl_products_a176607_pt2 where tbl_orders_details_a176607_pt2.fld_product_id = tbl_products_a176607_pt2.fld_product_id AND fld_order_id = :oid");
$stmt->bindParam(':oid', $oid, PDO::PARAM_STR);
$oid = $_GET['oid'];
$stmt->execute();
$result = $stmt->fetchAll();
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
foreach($result as $detailrow) {
?>
<tr>
<td><?php echo $counter; ?></td>
<td><?php echo $detailrow['fld_product_name']; ?></td>
<td class="text-right"><?php echo $detailrow['fld_order_detail_quantity']; ?></td>
<td class="text-right"><?php echo $detailrow['fld_product_price']; ?></td>
<td class="text-right"><?php echo $detailrow['fld_product_price']*$detailrow['fld_order_detail_quantity']; ?></td>
</tr>
<?php
$grandtotal = $grandtotal + $detailrow['fld_product_price']*$detailrow['fld_order_detail_quantity'];
$counter++;
}
$conn = null;
?>
<tr>
<td colspan="4" align="right">Grand Total</td>
<td class="text-right"><?php echo $grandtotal ?></td>
</tr>
</table>
<div class="row">
<div class="col-xs-5">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Bank Details</h4>
</div>
<div class="panel-body">
<p>Your Name : </p>
<p>Bank Name : </p>
<p>SWIFT : </p>
<p>Account Number : </p>
<p>IBAN : </p>
</div>
</div>
</div>
<div class="col-xs-7">
<div class="span7">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Contact Details</h4>
</div>
<div class="panel-body">
<p> Staff : <?php echo $readrow['fld_staff_name'] ?> </p>
<p> Email Address : <?php echo $readrow['fld_staff_email'] ?> </p>
<p>
<br>
</p>
<p>
<br>
</p>
<p>Computer-generated invoice. No signature is required.</p>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>