-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallanForm.php
149 lines (144 loc) · 5.15 KB
/
challanForm.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
<html>
<?php
session_start();
if($_SESSION['STATUS']!="Online")
header('Location: login.php');
?>
<?php
error_reporting(E_ERROR | E_PARSE);
$value=false;
session_start();
$vehicle= $_SESSION['vehicleName'];
$amount=$_SESSION['amount'];
$id= $_SESSION['user_id'];
$host="localhost";
$username="root";
$password="";
$dbname="dbs";
$conn = mysqli_connect($host, $username, $password,$dbname);
$query="
select *
from e_user
where User_ID=(
select User_ID
from vehicle
where Vehicle_No='$vehicle'
)
";
$result=mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result);
$name=$row['User_Name'];
$email=$row['E_mail'];
$query="select * from area where Area_Code=(
select Area_Code
from e_user
where User_ID=$id
) ";
$result=mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result);
$areacode=$row['Area_code'];
$areaname=$row['Area_Name'];
if($_REQUEST["btnG"])
{
$query="
INSERT INTO challan (Challan_No, Amount, Issue_Date, Due_Date, User_ID, Vehicle_No, C_status) VALUES (NULL, '$amount', sysdate(), adddate(sysdate(),interval 14 day), '$id', '$vehicle', 'UnPaid')";
$result=mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result);
$is_d=$row['Issue_Date'];
$du_d=$row['Due_Date'];
$value=true;
$to = $email;
$subject = "Challan";
$amount=$_SESSION['amount'] ;
$message = "
Hello ,".$name .".This mail is to inform you that RS".$amount." challan has been generated against yout Vehicle Number ".$vehicle.".You have to pay your challan within 14 days.Kindly pay it before Due_Date to avoid license cancelation.
DUE Date is".$du_d."and ISSUE Date is".$is_d."
<br>Regards: Team Shield ";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
mail($to,$subject,$message,$headers);
}
?>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style>
table{
margin-top: 0px;
}
h2{
font-family: sans-serif;
text-align: center;
padding-top: 10px;
font-size: 40px;
}
#centerdiv tr td{
font-size: 20px;
font-family:serif;
}
#leftdiv {
background-color: transparent;
}
form{
border: none;
padding-top: 400px;
}
form input{
float: left;
margin-top: 5px;
}
</style>
</head>
<body>
<div id="menu">
<img src="logo.PNG" >
<nav>
<a href="wardon.php">Home</a>
<a>About</a>
<a href="profile.php">Profile</a>
<a href="login.php">Log Out</a>
</nav>
</div>
<div id="leftdiv">
</div>
<div id="centerdiv">
<h2>Challan Form</h2>
<?php
session_start();
echo "<table>
<tr>
<td id='usertable'>"."Vehicle Number : "."</td>
<td id='usertable'>". $vehicle ."</td>
</tr>
<br>
<tr>
<td id='usertable'>"."Vehicle owner : "."</td>
<td id='usertable'>". $name ."</td>
</tr>
<br>
<tr>
<td id='usertable'>"."Wardon Name : "."</td>
<td id='usertable'>". $_SESSION['user_name'] ."</td>
</tr>
<br>
<tr>
<td id='usertable'>"."Voilation Area : "."</td>
<td id='usertable'>". $areaname ."</td>
</tr>
<br>
<tr>
<td id='usertable'>"."Amount : "."</td>
<td id='usertable'> RS ". $_SESSION['amount'] ."</td>
</tr>
</table>";
?>
<form id="formForButton" method="post" >
<input type="submit" name="btnG" value="Generate and Email Challan">
<br>
<?php
if($value)
echo "<p >Challan Generated</p>";
?>
</form>
</div>
</body>
</html>