Skip to content

Commit

Permalink
msg option added
Browse files Browse the repository at this point in the history
  • Loading branch information
amalprasad0 committed May 31, 2022
1 parent d4ad632 commit dcc55d3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 57 deletions.
13 changes: 11 additions & 2 deletions Data Records/Vehicle.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
2022-05-24|19:01:47|KL14A1000|OUT|SABU TV|896756551|BIKE|OUTSIDE
2022-05-24|19:01:47|KL14A800|OUT|LARIN LAGI|896756551|BIKE|OUTSIDE
2022-05-26|19:15:07:PM|GJ98H457|OUT|SUNNY |994763821|TRUCK|HOME
2022-05-24|19:01:47|KL14A7000|OUT|LIBIN SABU |896756551|BIKE|OUTSIDE
2022-05-26|19:15:07:PM|ERTYUIO|OUT|SUNNY |994763821|TRUCK|HOME
2022-05-22|20:54:11|KL79G7900|OUT|AMAL PRASAD|7306557354|BIKE|MOODBIDRI
2022-05-30|14:35:24:PM|GA12H7890|IN|ADHITHYAN|9947789622|CAR|HOME
2022-05-31|22:10:40:PM|KL89H8900|OUT|ASEEL HK|1234567890|CAR|HOME
2022-05-31|22:12:26:PM|KL78Y789|IN|MELBIN B|34567890123|BIKE|TOUR
2022-06-01|00:04:35:AM|KL68H6789|OUT|AMAL PRASAD|7306557354|OUT|HOME
2022-06-01|00:06:03:AM|1234567|DFGHJ|AMAL|7306557354|ING|ZXVCBNM
2022-06-01|00:08:35:AM|KL67S67890|OUT|LIBIN SABU|8304939772|CAR|TO VISIT HOSTEL
2022-06-01|00:08:35:AM|KL67S67890|OUT|LIBIN SABU|80780775784|CAR|TO VISIT HOSTEL
2022-06-01|00:08:35:AM|KL67S67890|OUT|LIBIN SABU|7306557354|CAR|TO VISIT HOSTEL
2022-06-01|00:08:35:AM|KL67S67890|OUT|LIBIN SABU|80780775784|CAR|TO VISIT HOSTEL
2022-06-01|00:12:29:AM|TN56Y78900|OUT|PRAJWAL|7306557354|BIKE|HOME
2 changes: 2 additions & 0 deletions Data Records/sms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Download the helper library from https://www.twilio.com/docs/python/install
import twilio
72 changes: 55 additions & 17 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from datetime import date
from datetime import datetime
from time import strftime
import os
from twilio.rest import Client


from tkinter import messagebox
Expand Down Expand Up @@ -65,16 +67,42 @@ def relative_to_assets(path: str) -> Path:
def insertData():
time=vlTime.get()
date=vlDate.get()
vehiclenum=vlNum.get()
Vinout=vlInout.get()
Vowner=vlOwner.get()
Vlmob=vlMob.get()
vltyp=vlType.get()
vreason=vlReason.get()
print("Details:",time,"|",date,"|",vehiclenum,"|",Vinout,"|",Vowner,"|",Vowner,"|",Vlmob,"|",vltyp,"|",vreason)
VhlReader=open("Data Records/Vehicle.txt","a")
VhlReader.write(str(date)+"|"+time+"|"+vehiclenum+"|"+Vinout+"|"+Vowner+"|"+Vlmob+"|"+vltyp+"|"+vreason+"\n")
VhlReader.close()
vehiclenum=vlNum.get().upper()
Vinout=vlInout.get().upper()
Vowner=vlOwner.get().upper()
Vlmob=vlMob.get().upper()
vltyp=vlType.get().upper()
vreason=vlReason.get().upper()
if vehiclenum=="":
messagebox.showwarning("showwarning", "Field Is Empty")
elif Vinout=="":
messagebox.showwarning("showwarning", "Field Is Empty")
elif Vowner=="":
messagebox.showwarning("showwarning", "Field Is Empty")
elif Vlmob=="":
messagebox.showwarning("showwarning", "Field Is Empty")
elif vltyp=="":
messagebox.showwarning("showwarning", "Field Is Empty")
elif vreason=="":
messagebox.showwarning("showwarning", "Field Is Empty")
else:
print("Details:",time,"|",date,"|",vehiclenum,"|",Vinout,"|",Vowner,"|",Vowner,"|",Vlmob,"|",vltyp,"|",vreason)
VhlReader=open("Data Records/Vehicle.txt","a")
VhlReader.write(str(date)+"|"+time+"|"+vehiclenum+"|"+Vinout+"|"+Vowner+"|"+Vlmob+"|"+vltyp+"|"+vreason+"\n")
messagebox.showinfo("STATUS", "RECORD ADDED TO DATABASE")
client = Client('AC4fb3f859d841739f658840ac79a3e879', '6bbdad1b6761f73b391dae6b4c69f87f')
message = client.messages \
.create(
body="Hi "+Vowner+" \nWelcome to Yenepoya Institute of Technology"+" \nYour entering Time :"+str(time)+"\nDate:"+str(date)+"\nVehicle Number:"+vehiclenum+"\nLiqiud-Loop Gate Security System",
from_='+19403505053',
to="+91"+Vlmob
)

print(message.sid)



VhlReader.close()
# variables for vhl search->
s_date=StringVar()
s_num=StringVar()
Expand All @@ -99,13 +127,11 @@ def vehlsearch():
# print(temp)
nl=line.split("|")
temp.append(nl)

for i in range(0,len(temp)):
if temp[i][2]==vnum:

treev.insert("", 'end', text ="L"+str(i),values =(temp[i][0],temp[i][1],temp[i][2],temp[i][3],temp[i][4],temp[i][5],temp[i][6],temp[i][7]))
else:
messagebox.showerror("INFO", "Record Not Found in DB")
exit

# else:
# for i in range(0,len(temp)):
# treev.insert("", 'end', text ="L"+str(i),values =(temp[i][0],temp[i][1],temp[i][2],temp[i][3],temp[i][4],temp[i][5],temp[i][6],temp[i][7]))
Expand Down Expand Up @@ -202,6 +228,7 @@ def update():
if line.startswith(temp_list[0]):
nl=line.split("|")
if nl[1]==temp_list[1]:
index=lines.index(line)
print("up to",nl)
up_record=[]
up_record.append(nl[0])
Expand All @@ -217,13 +244,17 @@ def update():
update_file="|".join(up_record)
# print(update_file)

INDEX=lines.index(line)
lines[INDEX]=update_file
# INDEX=lines.index(line)
lines[index]=update_file
print(lines)


filereader2=open("Data Records/Vehicle.txt","w+")
for i in lines:
filereader2.write(i)
u_name=up_name.set("")
u_num=up_num.set("")
u_mob=up_mob.set("")
filereader2.close()
update_section.mainloop()

Expand All @@ -234,6 +265,8 @@ def update():
# print("Up:",temp)

# date of vhl
vdate = Label(update_section,text = "Date:",bg="#FFFFFF").place(x = 20,y = 70)

vdate = Entry(update_section,
bd=0,
bg="#C4C4C4",
Expand All @@ -248,6 +281,7 @@ def update():
)

# vhl number
vhlnum = Label(update_section,text = "Vehicle Number:",bg="#FFFFFF").place(x = 250,y = 70)
vhlnum = Entry(update_section,
bd=0,
bg="#C4C4C4",
Expand All @@ -266,7 +300,7 @@ def update():
highlightthickness=0,
command=updateData,
relief="flat",
text="UPDATE"
text="View"
)
addbtn.place(
x=470.0,
Expand All @@ -275,6 +309,7 @@ def update():
height=50.0
)
# vhl owner name
u_name = Label(update_section,text = "Owner:",bg="#FFFFFF").place(x = 20,y = 455)
u_name = Entry(update_section,
bd=0,
bg="#C4C4C4",
Expand All @@ -288,6 +323,8 @@ def update():
height=48.0
)
# Vehicle number
vhlnum = Label(update_section,text = "Vehicle Number:",bg="#FFFFFF").place(x = 247,y = 455)

vhlnum = Entry(update_section,
bd=0,
bg="#C4C4C4",
Expand All @@ -300,6 +337,7 @@ def update():
width=182.0,
height=48.0
)
mob= Label(update_section,text = "Mobile:",bg="#FFFFFF").place(x = 473,y = 455)
mob = Entry(update_section,
bd=0,
bg="#C4C4C4",
Expand Down
38 changes: 0 additions & 38 deletions sample.py

This file was deleted.

0 comments on commit dcc55d3

Please sign in to comment.