Online Electricity Billing System
Introduction
The digital age has revolutionized many aspects of our daily lives, including how we manage and pay for utilities. Our Electricity Billing System Project aims to simplify the process of electricity bill management and payment. Gone are the days of paper bills and manual calculations. With this system, you can view your electricity bill online and pay it instantly, all from the comfort of your home.
Features
Admin Login
- The admin has the ability to view and manage user accounts.
- Electricity usage data for each user is input by the admin.
- The system automatically calculates the electricity bill based on the usage data.
User Login
- Users can log in to view their monthly electricity bill.
- The bill can be paid online via credit card before the end of the month.
- If the bill is not paid on time, the system calculates a fine for each subsequent day.
Advantages
- Electronic Record-Keeping: All records are stored electronically, eliminating the need for paper bills.
- Automated Calculations: The system takes care of all calculations, reducing the chance of errors.
- Convenience: Users can pay their bills online, without the need to visit an office.
- Resource-Efficient: The system negates the need for a delivery person to distribute paper bills, saving both time and resources.
Disadvantages
- A reliable internet connection is required for both admin and users.
- The system lacks a human interaction component for customer inquiries.
Technologies Used
- Backend: Python for bill calculations
- Frontend: Web-based user interface
- Payment Gateway: Secure credit card transactions
Conclusion
Our Electricity Billing System Project is a step towards making utility management more efficient and user-friendly. It not only saves time but also resources, making it a sustainable choice for the future of electricity bill management.
Sample Code
First, install the required packages if you haven’t already:
pip install Flask
pip install Flask-SQLAlchemy
from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'
db = SQLAlchemy(app)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(50), nullable=False)
electricity_usage = db.Column(db.Float, nullable=False)
bill = db.Column(db.Float, nullable=False)
@app.route('/')
def index():
all_users = User.query.all()
return render_template('index.html', users=all_users)
@app.route('/add_user', methods=['POST'])
def add_user():
username = request.form.get('username')
electricity_usage = float(request.form.get('electricity_usage'))
bill = electricity_usage * 0.12 # Assuming 0.12$ per unit
new_user = User(username=username, electricity_usage=electricity_usage, bill=bill)
db.session.add(new_user)
db.session.commit()
return redirect(url_for('index'))
@app.route('/pay_bill/<int:id>')
def pay_bill(id):
user = User.query.get(id)
user.bill = 0
db.session.commit()
return redirect(url_for('index'))
if __name__ == '__main__':
db.create_all()
app.run(debug=True)
And for the HTML (‘templates/index.html
‘):
<!DOCTYPE html>
<html>
<head>
<title>Electricity Billing System</title>
</head>
<body>
<h1>Electricity Billing System</h1>
<form method="post" action="/add_user">
Username: <input type="text" name="username"><br>
Electricity Usage: <input type="number" name="electricity_usage"><br>
<input type="submit" value="Add User">
</form>
<hr>
<h2>Users</h2>
<ul>
{% for user in users %}
<li>
{{ user.username }} - Bill: ${{ user.bill }}
<a href="{{ url_for('pay_bill', id=user.id) }}">Pay Bill</a>
</li>
{% endfor %}
</ul>
</body>
</html>
In order to download the PDF, You must follow on Youtube. Once done, Click on Submit
Follow On YoutubeSubscribed? Click on Confirm