-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
229 lines (220 loc) · 11.6 KB
/
profile.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php include 'includes/header.php'; ?>
<?php
IF(ISSET($_SESSION['name'])){
include "database/db_con.php";
$name=$_SESSION['name'];
$cust_id=$_SESSION['cust_id'];
$fname=" ";
$mname=" ";
$lname=" ";
$contact=" ";
$address=" ";
$username=$_SESSION['username'];
$getInfo="SELECT * FROM CUSTOMER WHERE cust_id='$cust_id'";
$cek=mysqli_query($con,$getInfo);
$count=mysqli_num_rows($cek);
$data=mysqli_fetch_array($cek);
if($count == 1){
$cust_id=$data['cust_id'];
$firstname=$data['first_name'];
$middlename=$data['middle_name'];
$lastname=$data['last_name'];
$contact=$data['contact'];
$gender=$data['gender'];
$email=$data['email'];
$address=$data['address'];
}
$countOrder=mysqli_num_rows(mysqli_query($con,"SELECT * FROM `ORDERS` WHERE `cust_id`='$cust_id'"));
$countPending=mysqli_num_rows(mysqli_query($con,"SELECT * FROM `ORDERS` WHERE `cust_id`='$cust_id' AND `order_status`='Pending'"));
$lastOrder="NO ORDER";
//$getDate=mysqli_fetch_array(mysqli_query($con,"SELECT issue_date FROM `ORDERS` WHERE `cust_id`='$cust_id' AND `order_status`='Delivered' ORDER BY issue_date desc"));
$getLast=mysqli_fetch_array(mysqli_query($con,"SELECT issue_date FROM `ORDERS` WHERE `cust_id`='$cust_id' ORDER BY issue_date desc"));
if(mysqli_num_rows(mysqli_query($con,"SELECT * FROM `ORDERS` WHERE `cust_id`='$cust_id'")) > 0){
$lastOrder=$getLast['issue_date'];
}
$totalPaid=0.00;
$query=mysqli_query($con,"SELECT PAYMENTS.amount FROM `PAYMENTS` INNER JOIN `ORDERS` ON PAYMENTS.order_id=ORDERS.order_id INNER JOIN `CUSTOMER` ON CUSTOMER.cust_id=ORDERS.cust_id WHERE CUSTOMER.cust_id='$cust_id'");
if(mysqli_num_rows($query) > 0){
while($paid=mysqli_fetch_array($query)){
$pay=$paid['amount'];
$totalPaid=$totalPaid+$pay;
}
}
$queryDue=mysqli_query($con,"SELECT DISTINCT ORDERED_ITEM.quantity,ORDERED_ITEM.price,ORDERED_ITEM.product_id, ORDERS.order_id FROM ORDERED_ITEM INNER JOIN ORDERS ON ORDERED_ITEM.order_id=ORDERS.order_id INNER JOIN PAYMENTS WHERE PAYMENTS.order_id!=ORDERS.order_id AND ORDERS.cust_id='{$cust_id}'");
$countDue=mysqli_num_rows($queryDue);
//echo $countDue;
$temp;
$due=0;
while($row=mysqli_fetch_array($queryDue)){
$temp = $row['price'] * $row['quantity'];
$due=$due+$temp;
}
}
?>
<div id="page">
<div class="container emp-profile">
<form method="post">
<div class="row">
<div class="col-md-4">
<div class="profile-img">
<?php
if($_SESSION['gender']=="Male"){
?>
<img src="image/avatar-male.jpg" alt=""/>
<?php
}else if($_SESSION['gender']=="Female"){
?>
<img src="image/avatar-female.jpg" alt=""/>
<?php
}
?>
<div class="file btn btn-lg btn-primary">
Change Photo
<input type="file" name="file"/>
</div>
</div>
</div>
<div class="col-md-6">
<div class="profile-head">
<h5>
<?=$firstname." ".$middlename." ".$lastname;?>
</h5>
<h6>
Rookie
</h6>
<p class="proile-rating">RANKINGS : <span>8/10</span></p>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">About</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Timeline</a>
</li>
</ul>
</div>
</div>
<div class="col-md-2">
<input type="submit" class="profile-edit-btn" name="btnAddMore" value="Edit Profile"/>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="profile-work">
<p>MY ACCOUNT</p>
<a href="">Change Password</a><br/>
<a href="">My Offers</a><br/>
<a href="">My Orders</a><br>
<a href="">Coupons</a><br/>
<a href="">Order Invoices</a><br/>
<a href="">Wishlist</a><br/>
<a href="">Back Orders</a><br/>
<a href="">Cancelled Orders</a><br/>
</div>
</div>
<div class="col-md-8">
<div class="tab-content profile-tab" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<div class="row">
<div class="col-md-6">
<label>User Id</label>
</div>
<div class="col-md-6">
<p><?=$cust_id;?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>User Name</label>
</div>
<div class="col-md-6">
<p><?=$username;?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Name</label>
</div>
<div class="col-md-6">
<p><?=$firstname." ".$middlename." ".$lastname;?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Email</label>
</div>
<div class="col-md-6">
<p><?=$email;?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Phone</label>
</div>
<div class="col-md-6">
<p><?=$contact;?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Address</label>
</div>
<div class="col-md-6">
<p><?=$address;?></p>
</div>
</div>
</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<div class="row">
<div class="col-md-6">
<label>Order Pending</label>
</div>
<div class="col-md-6">
<p><?=$countPending?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Payment Due</label>
</div>
<div class="col-md-6">
<p><?=$due;?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Total Order</label>
</div>
<div class="col-md-6">
<p><?=$countOrder?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Total Paid</label>
</div>
<div class="col-md-6">
<p>৳ <?=$totalPaid?></p>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Last Order</label>
</div>
<div class="col-md-6">
<p><?=$lastOrder?></p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<label>Order Information</label><br/>
<a type="button" id="ord-det" style="font-weight: 600;color: #0062cc;">Your previous order description</a>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<?php include 'includes/footer.php'; ?>