0% found this document useful (0 votes)
75 views18 pages

Electricity Bill

This document contains source code for an electricity billing system project in Python. The code imports necessary modules, connects to a MySQL database, defines functions for user authentication, account creation, viewing bills, and generating a graph. It allows new users to register, existing users to access account settings like adding customers, viewing transactions, and makes payments.

Uploaded by

AKris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views18 pages

Electricity Bill

This document contains source code for an electricity billing system project in Python. The code imports necessary modules, connects to a MySQL database, defines functions for user authentication, account creation, viewing bills, and generating a graph. It allows new users to register, existing users to access account settings like adding customers, viewing transactions, and makes payments.

Uploaded by

AKris
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Vidhya Parthi National Academy Senior

Secondary School, Seelapadi, Dindigul


Computer Science Project
Telephone Directory

Submitted By: -
Name – Sharan.J
Class – “XII-A”
Roll No – 05
Subject – Computer Science

Certificate of Accomplishment

This is to certify that SHARAN.J, a student


of class “XII-A”(Vidhya Parthi National
Academy), has successfully completed the
project on the topic “History of
Mathematicians”.

Sign -

Acknowledgement

I would like to express my special


thanks of gratitude to my subject
teacher who gave me the golden
opportunity to do this wonderful
project on the topic of “Electricity
Bill” which also helped me in doing
lot of research. I came to know
about many things and I’m really
very much thankful to her.

Secondly, I would also like to thank


my parents and my friends who
helped me a lot in finishing this
project within the limited time.
They really co-operated and helped
me in the completion of my project.

This project helps me in enhancing


my knowledge about my topic. I
have highly benefitted by this and
I’m glad because it helped me to
grasp a lot of new knowledge.
Package or Module used in the Project
Short Description of the module

✓ Random Module
✓ Pyplot Module
✓ MySQL. Connector Module
✓ Date Time Module
Functions Used in the Project
✓ Cursor()
✓ Date.Today()
✓ Execute()
✓ Fetchall()
✓ Random.Randint()
✓ Title()
Uses of Functions
Cursor():
→It is a special control structure
that facilitates the row-by-row
processing of records in the result set.
Date.Today():
→It returns the current date in the
system.
Execute():
→This function is used to execute the
sql query and retrive records using
python.
FetchallI():
→This function will return all the
rows from the result set in the form of a
tuple containing the records.
Random.Randint():
→This function returns a random
integer number between the desired
range or from all the numbers.
Title():
→This function makes the sentence’s
all fist letter as capital

SOURCE CODE
**import mysql.connector as sql , random , datetime as
dt
import matplotlib.pyplot as plt
conn=sql.connect(host='localhost',user='root',passwd='
mc.la.ren',database='EBS')
if conn.is_connected():
print("successfully connected")
c='YES' or "yes" or 'Yes'
V='YES' or "yes" or 'Yes'
c1=conn.cursor()
while c=='YES' or "yes" or 'Yes':
print('************************WELCOME TO
ELECTRICITY BILLING
SYSTEM************************')
print(dt.datetime.now())
print('1.NEW USER')
print('2.EXISTING USER')
print('3.EXIT')
choice1=int(input('ENTER YOUR CHOICE:'))
if choice1==1:
username=input("Enter your username number :")
password=input("Enter your password:")
confirmpasswd=input("Confirm your password:")
if password==confirmpasswd:
info1="insert into newuser
values('{}','{}','{}')".format(username,password,confirm
passwd)
c1.execute(info1)
conn.commit()
c=input("do you want to continue?(yes or no)")
else:
print('your confirm password is incorrect')
print('Try again')
c=input("do you want to continue?(yes or no)")
elif choice1==2:
username=input('Enter your username:')
password=input('Enter your password:')
info2="select * from newuser where username='{}'
and password='{}'".format(username,password)
c1.execute(info2)
data=c1.fetchall()
while V=='YES' or "yes" or 'Yes':
if any(data):
print('************************WELCOME
TO ELECTRICITY BILLING
SYSTEM************************')
print("1.ACCOUNT SETTINGS")
print("2.TRANSACTION")
print("3.VIEW CUSTOMER DETAILS")
print("4.GRAPHICAL REPRESENTATION")
print('5.EXIT')
choice2=int(input('ENTER YOUR CHOICE'))
if choice2==1:
print('1.NEW CUSTOMER')
print('2.DELETE EXISTING ACCOUNT')
choice12=int(input('ENTER YOUR
CHOICE:'))
if choice12==1:

accountno=random.randrange(1000000,9999999,10)
print("your accountno is",accountno)
boxid=input("enter your mete box ID:")
bankname=input('Enter your BANK
NAME :')
bankbranch=input('Enter your BANK
BRANCH :')
name=input('Enter your name :')
address=input('Enter your address :')
areacode=int(input('Enter your area
PIN CODE :'))
phoneno=int(input('Enter your PHONE
NUMBER :'))
email=input('Enter your email :')
info2="insert into AddNewCustomer
values({},'{}','{}','{}','{}',{},{},'{}','{}')".format(accountno
,bankname,bankbranch,name,address,areacode,phoneno,
email,boxid)
c1.execute(info2)
conn.commit()
V=input("do you want to continue?(yes
or no)")
if V=='yes':
continue
else:
break
elif choice12==2:
acc=input("ENTER YOUR ACCOUNT
NUMBER:")
use=input("ENTER YOUR USERNAME:")
info6=c1.execute("delete from
Transaction where accountno='{}'".format(acc))
info7=c1.execute("delete from
AddNewCustomer where accountno='{}'".format(acc))
info8=c1.execute("delete from newuser
where username='{}'".format(use))
c1.execute(info6)
c1.execute(info7)
c1.execute(info8)
conn.commit()
print("THANK YOU FOR USING OUR
SOFTWARE,YOUR ACCOUNT IS SUCCESFULLY
DELETED")
V=input("do you want to continue?(yes
or no)")
if V=='yes':
continue
else:
break

elif choice2==2:
accountno=int(input('Enter your account
number :'))
info10="select * from Transaction where
accountno="+str(accountno)
c1.execute(info10)
data3=c1.fetchall()
for row in data3:
paid=row[6]
if paid=='yes':
print('you have already paid the bill')
break
else:
unit=random.randint(0,101)
print('Dear customer, you have used
',unit,'units of electricity.')
print('One unit of curent is 150
ruppees')
amount=150*unit
toda=dt.date.today()
deadline=dt.date(2020,1,30)
if deadline<toda:
fine=(toda-deadline)*30
totamt=amount+fine
print('you have dealyed for ',toda-
deadline,'days.The fine per day is 30 rupees.')
GST=(15/100)*totamt
totalamt=totamt+GST
print('Pleae payup ',totalamt,'rupees
inclding GST')
p=input("Please Enter YES to
transact")
if p=="YES"or 'Yes'or'yes':
print("Transaction successful")
print("You have paid the bill")
else:
print('plz pay the bill sooner')
else:
totamt=0
GST=(15/100)*amount
totalamt=amount+GST
print('Pleae payup ',totalamt,'rupees
inclding GST')
p=input("Please Enter YES to
transact")
if p=="YES":
print("Transaction successful")
print("You have paid the bill")
else:
print('plz pay the bill sooner')
info3="insert into Transaction
values({},{},'{}',{},{},{},'{}')".format(accountno,unit,toda,
totamt,GST,totalamt,p)
c1.execute(info3)
conn.commit()
V=input("do you want to continue?(yes
or no)")
if V=='yes':
continue
else:
break
elif choice2==3:
accountno=int(input('Enter your account
number :'))
info4="select * from AddNewCustomer
where accountno=" + str(accountno)
c1.execute(info4)
data1=c1.fetchall()
for row in data1:
print(" Account Number: ", row[0])
print("bankname:",row[1])
print("bankbranch:",row[2])
print("Person name:",row[3])
print("Your meter device ID=",row[8])
print("Residential address:",row[4])
print("area code:",row[5])
print("phone number:",row[6])
print("email:",row[7])
info5="select * from Transaction where
accountno=" + str(accountno)
c1.execute(info5)
data2=c1.fetchall()
for row in data2:

print(" Unit : ",row[1])


print(" paid on:",row[2])
print("amount to be paid without
GST:",row[3])
print("GST=",row[4])
print("amount to be paid including
GST:",row[5])
V=input("do you want to continue?(yes or
no)")
if V=='yes':
continue
else:
break
elif choice2==4:
info9="select accountno,totalamt from
Transaction"
c1.execute(info9)
L1,L2,=[],[]
for i in c1.fetchall():
L1.append(i[0])
L2.append(i[1])
plt.plot(L1,L2)
plt.title("GRAPH")
plt.show()
V=input("do you want to continue?(yes or
no)")
if V=='yes':
continue
else:
break
elif choice2==5:
print("THANK YOU!!!! VISIT AGAIN!!!!")
break
c='yes'

else:
print('username / password is incorrect')
break
c=input("do you want to try again?(yes or
no)")

else:
print("THANK YOU!!!! VISIT AGAIN!!!!")
V='no'

elif choice1==3:
print("THANK YOU!!!! VISIT AGAIN!!!!")
c='no'
break
else:
print("invalid choice")
c=input("do you want to try again?(yes or no)")
else:
print("THANK YOU!!!! VISIT AGAIN!!!!")

c='no'*

BIBILOGRAPHY
We used many references to develop
this project and those are:-
✓ Computer Book Class XII-Sumit
Arora
✓ WWW.Stackoverflow.com

THANKING
YOU

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy