-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
221 lines (170 loc) · 5.86 KB
/
Copy pathprocess.php
File metadata and controls
221 lines (170 loc) · 5.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
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
<?php
//start session
session_start();
require_once('database.php');
$action = $_GET['action'];
switch($action) {
case 'add-cons':
addCons();
break;
case 'add-ref':
addRef();
break;
case 'add-reg':
addReg();
break;
case 'approved':
markApproved();
break;
case 'add-office':
addNewOffice();
break;
case 'add-manager':
addManager();
break;
case 'update-status':
updateStatus();
break;
case 'change-pass':
changePass();
break;
case 'logOut':
logOut();
break;
case 'delete':
delete();
break;
}//switch
function addCons(){
$Clientname = $_POST['Clientname'];
$Clientphone = $_POST['Clientphone'];
$Clientaddress = $_POST['Clientaddress'];
$Officername = $_POST['Officername'];
$Officerphone = $_POST['Officerphone'];
$Officeraddress = $_POST['Officeraddress'];
$ConsignmentNo = $_POST['ConsignmentNo'];
$Instype = $_POST['Instype'];
$Amount = $_POST['Amount'];
$Invoiceno = $_POST['Invoiceno'];
$Indnbr = $_POST['Indnbr'];
$Bookingmode = $_POST['Bookingmode'];
$Vat = $_POST['Vat'];
$Mode = $_POST['Mode'];
$Issueddate = $_POST['Issueddate'];
$Expireddate = $_POST['Expireddate'];
$Time = $_POST['Time'];
$Status = $_POST['Status'];
$Comments = $_POST['Comments'];
$sql = "INSERT INTO tbl_clients (cons_no, clnt_name, clnt_phone, clnt_add, off_name, off_phone, off_add, type, amount, invoice_no, ind_nbr, book_mode, vat, mode, iss_date, exp_date, time, status, comments, book_date )
VALUES('$ConsignmentNo', '$Clientname','$Clientphone', '$Clientaddress', '$Officername','$Officerphone','$Officeraddress', '$Instype','$Amount' , '$Invoiceno', $Indnbr, '$Bookingmode', '$Vat', '$Mode', '$Issueddate', '$Expireddate','$Time', '$Status', '$Comments', NOW())";
//echo $sql;
dbQuery($sql);
header('Location: insurance-add-success.php');
//echo $Ship;
}//addCons
function addReg() {
$Clientname = $_POST['Clientname'];
$Clientphone = $_POST['Clientphone'];
$Clientaddress = $_POST['Clientaddress'];
$ConsignmentNo = $_POST['ConsignmentNo'];
$Instype = $_POST['Instype'];
$Amount = $_POST['Amount'];
$Indnbr = $_POST['Indnbr'];
$Bookingmode = $_POST['Bookingmode'];
$Vat = $_POST['Vat'];
$Mode = $_POST['Mode'];
$Issueddate = $_POST['Issueddate'];
$Expireddate = $_POST['Expireddate'];
$Time = $_POST['Time'];
$Status = $_POST['Status'];
$Comments = $_POST['Comments'];
$sql = "INSERT INTO tbl_clients (cons_no, clnt_name, clnt_phone, clnt_add, type, amount, ind_nbr, book_mode, vat, mode, iss_date, exp_date, time, status, comments, book_date )
VALUES('$ConsignmentNo', '$Clientname','$Clientphone', '$Clientaddress', '$Instype', '$Amount', $Indnbr, '$Bookingmode', '$Vat', '$Mode', '$Issueddate', '$Expireddate','$Time', '$Status', '$Comments', NOW())";
dbQuery($sql);
header('Location: reg-add-success.php');
}
function markApproved() {
$cid = (int)$_GET['cid'];
$sql = "UPDATE tbl_clients
SET status = 'Approved'
WHERE cid= $cid";
dbQuery($sql);
header('Location: delivered-success.php');
}//markDelivered();
function addNewOffice() {
$OfficeName = $_POST['OfficeName'];
$OfficeAddress = $_POST['OfficeAddress'];
$City = $_POST['City'];
$PhoneNo = $_POST['PhoneNo'];
$OfficeTiming = $_POST['OfficeTiming'];
$ContactPerson = $_POST['ContactPerson'];
$sql = "INSERT INTO tbl_offices (off_name, address, city, ph_no, office_time, contact_person)
VALUES ('$OfficeName', '$OfficeAddress', '$City', '$PhoneNo', '$OfficeTiming', '$ContactPerson')";
dbQuery($sql);
header('Location: office-add-success.php');
}//addNewOffice
function addManager() {
$ManagerName = $_POST['ManagerName'];
$Password = $_POST['Password'];
$Address = $_POST['Address'];
$Email = $_POST['Email'];
$PhoneNo = $_POST['PhoneNo'];
$OfficeName = $_POST['OfficeName'];
$sql = "INSERT INTO tbl_ins_officers (officer_name, off_pwd, address, email, ph_no, office, reg_date)
VALUES ('$ManagerName', '$Password', '$Address', '$Email', '$PhoneNo', '$OfficeName', NOW())";
dbQuery($sql);
header('Location: manager-add-success.php');
}//addNewOffice
function updateStatus() {
$OfficeName = $_POST['OfficeName'];
$status = $_POST['status'];
$comments = $_POST['comments'];
$cid = (int)$_POST['cid'];
$cons_no = $_POST['cons_no'];
//$OfficeName = $_POST['OfficeName'];
$sql = "INSERT INTO tbl_track (cid, cons_no, current_city, status, comments, bk_time)
VALUES ($cid, '$cons_no', '$OfficeName', '$status', '$comments', NOW())";
dbQuery($sql);
$sql_1 = "UPDATE tbl_clients
SET status = '$status'
WHERE cid = $cid
AND cons_no = '$cons_no'";
dbQuery($sql_1);
header('Location: update-success.php');
}//addNewOffice
function logOut(){
if(isset($_SESSION['user_name'])){
unset($_SESSION['user_name']);
}
if(isset($_SESSION['user_type'])){
unset($_SESSION['user_type']);
}
session_destroy();
header('Location: login.php');
}//logOut
function delete() {
$cid = (int)$_GET['cid'];
$sql = "delete from tbl_clients WHERE cid= $cid";
dbQuery($sql);
header('Location: deleted-success.php'); }
function addRef()
{
$cons = $_POST['Consignment'];
$ref = $_POST ['Refnmber'];
$SQL = "SELECT cons_no FROM tbl_clients WHERE cons_no ='$cons'";
$q = mysql_query($SQL);
if(mysql_num_rows($q) > 0){
$SQL1 = "UPDATE tbl_clients SET Reference_Number='$ref' WHERE cons_no='$cons'";
dbQuery($SQL1);
header('Location: insurance-add-success.php');
}
else
die("Cons not found in the system");
//$Cons = $_POST['Consignment'];
//$refnb = $_POST['Refnmbr'];
//$result22 = mysql_query("SELECT * FROM clients WHERE cons_no = '$cons'");
//if($result22){
//$SQL = "INSERT INTO clients (Reference_Number) VALUES ('$refnb')";
//$result = mysql_query($SQL);
}
?>