0% found this document useful (0 votes)
11 views

Cs Project

Class 12 project on fee management system

Uploaded by

xefoy97182
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Cs Project

Class 12 project on fee management system

Uploaded by

xefoy97182
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

What is the School Fee Management System?

The School Fee Management System is a user-friendly software application


designed to simplify and automate the management of student fees in
educational institutions. The system caters to both administrators and
students, offering a comprehensive solution to track, update, and report fee-
related information efficiently.

Uses of the School Fee Management System

For Administrators:

- Efficient Student Management: Easily add, update, and view student records.
- Fee Tracking: Monitor unpaid fees across the school, by class, or section.
- Payment Management: Record and track fee payments, update balances, and
maintain accurate records.
- Reporting: Generate detailed reports on unpaid fees, fee payments, and other
financial data.

For Students:

- Personal Fee Management: View personal fee details, including total fees, fees
paid, and balance.
- Payment History: Access a history of past fee payments.
- Fee Payments: Pay fees online and receive immediate updates on their account.
Functionality of the School Fee
Management System

Administrator Functions:

1. Add Student: Administrators can input new student details, including name,
grade, section, and fees information.
2. View Student Records: Access comprehensive student records, filterable by
class or section.
3. Manage Unpaid Fees: View students with outstanding fees, generate reports
for different classes or sections.
4. Record Payments: Update fee payments, manage student balances, and track
payment history.
5. Generate Reports: Create detailed reports to monitor fee payments, unpaid
balances, and other financial aspects.

Student Functions:

1. View Personal Details: Check personal details, including fee structure, amount
paid, and balance.
2. View Fee Breakdown: Access a detailed breakdown of total fees, fees paid,and
remaining balance.
3. Review Payment History: View a log of past fee payments.
4. Pay Fees: Make payments online and update account balances instantly.
-- Create the database

CREATE DATABASE school_fee_system;

-- Use the database

USE school_fee_system;

-- Create the students table

CREATE TABLE students (

student_id INT PRIMARY KEY,

name VARCHAR(50),

grade VARCHAR(10),

section VARCHAR(10),

total_fees DECIMAL(10, 2),

fees_paid DECIMAL(10, 2) DEFAULT 0.00,

balance DECIMAL(10, 2)

);

-- Create the payments table

CREATE TABLE payments (

payment_id INT PRIMARY KEY,

student_id INT,

amount_paid DECIMAL(10, 2));


PYTHON PROGRAM CODE
import mysql.connector

# Connect to MySQL Database

def connect_to_db():

return mysql.connector.connect(

host="localhost",

user="root",

password="1234",

database="school_fee_system"

# Administrator Functions

def admin_view():

while True:

print("\n--- Administrator View ---")

print("1. Add Student")

print("2. View All Students")

print("3. View Students by Class")

print("4. View Students with Unpaid Fees (Whole School)")

print("5. View Students with Unpaid Fees by Class")

print("6. View Students with Unpaid Fees by Class and Section")

print("7. View Students Who Have Paid Their Fees")


print("8. Logout")

choice = input("Enter your choice: ")

if choice == "1":

add_student()

elif choice == "2":

view_all_students()

elif choice == "3":

view_students_by_class()

elif choice == "4":

view_unpaid_fees()

elif choice == "5":

view_unpaid_fees_by_class()

elif choice == "6":

view_unpaid_fees_by_class_and_section()

elif choice == "7":

view_students_paid_fees()

elif choice == "8":

break

else:

print("Invalid choice. Please try again.")

def add_student():
name = input("Enter student's name: ")

grade = input("Enter student's class (e.g., 11): ")

section = input("Enter student's section (e.g., A): ")

total_fees = float(input("Enter total fees: "))

db = connect_to_db()

cursor = db.cursor()

query = "INSERT INTO students (name, grade, section, total_fees, balance)


VALUES (%s, %s, %s, %s, %s)"

values = (name, grade, section, total_fees, total_fees)

cursor.execute(query, values)

db.commit()

db.close()

print("Student added successfully!")

def view_all_students():

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT * FROM students")

students = cursor.fetchall()

print("\n--- Student List ---")


print(f"{'ID':<5} {'Name':<20} {'Class':<10} {'Section':<10} {'Total Fees':<12}
{'Fees Paid':<10} {'Balance':<10}")

print("-" * 67)

for student in students:

print(f"{student[0]:<5} {student[1]:<20} {student[2]:<10} {student[3]:<10}


{student[4]:<12.2f} {student[5]:<10.2f} {student[6]:<10.2f}")

db.close()

def view_students_by_class():

grade = input("Enter the class to view (e.g., 11): ")

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT * FROM students WHERE grade = %s", (grade,))

students = cursor.fetchall()

print(f"\n--- Students in Class {grade} ---")

print(f"{'ID':<5} {'Name':<20} {'Section':<10} {'Total Fees':<12} {'Fees Paid':<10}


{'Balance':<10}")

print("-" * 57)

for student in students:

print(f"{student[0]:<5} {student[1]:<20} {student[3]:<10} {student[4]:<12.2f}


{student[5]:<10.2f} {student[6]:<10.2f}")
db.close()

def view_unpaid_fees():

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT * FROM students WHERE balance > 0")

students = cursor.fetchall()

print("\n--- Students with Unpaid Fees ---")

print(f"{'ID':<5} {'Name':<20} {'Class':<10} {'Section':<10} {'Balance':<10}")

print("-" * 45)

for student in students:

print(f"{student[0]:<5} {student[1]:<20} {student[2]:<10} {student[3]:<10}


{student[6]:<10.2f}")

db.close()

def view_unpaid_fees_by_class():

grade = input("Enter the class to view unpaid fees (e.g., 11): ")

db = connect_to_db()

cursor = db.cursor()
cursor.execute("SELECT * FROM students WHERE grade = %s AND balance > 0",
(grade,))

students = cursor.fetchall()

print(f"\n--- Students with Unpaid Fees in Class {grade} ---")

print(f"{'ID':<5} {'Name':<20} {'Section':<10} {'Balance':<10}")

print("-" * 35)

for student in students:

print(f"{student[0]:<5} {student[1]:<20} {student[3]:<10} {student[6]:<10.2f}")

db.close()

def view_unpaid_fees_by_class_and_section():

grade = input("Enter the class to view (e.g., 11): ")

section = input("Enter the section to view (e.g., A): ")

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT * FROM students WHERE grade = %s AND section = %s


AND balance > 0", (grade, section))

students = cursor.fetchall()

print(f"\n--- Students with Unpaid Fees in Class {grade}, Section {section} ---")
print(f"{'ID':<5} {'Name':<20} {'Balance':<10}")

print("-" * 30)

for student in students:

print(f"{student[0]:<5} {student[1]:<20} {student[6]:<10.2f}")

db.close()

def view_students_paid_fees():

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT * FROM students WHERE fees_paid > 0")

students = cursor.fetchall()

print("\n--- Students Who Have Paid Their Fees ---")

print(f"{'ID':<5} {'Name':<20} {'Class':<10} {'Section':<10} {'Total Fees':<12}


{'Fees Paid':<10}")

print("-" * 67)

for student in students:

print(f"{student[0]:<5} {student[1]:<20} {student[2]:<10} {student[3]:<10}


{student[4]:<12.2f} {student[5]:<10.2f}")

db.close()

# Student Functions
def student_view():

student_id = input("Enter your student ID: ")

db = connect_to_db()

cursor = db.cursor()

query = "SELECT * FROM students WHERE student_id = %s"

cursor.execute(query, (student_id,))

student = cursor.fetchone()

if student:

while True:

print("\n--- Student View ---")

print("1. View Personal Details")

print("2. View Fee Breakdown")

print("3. View Payment History")

print("4. Pay Fees")

print("5. Update Personal Details")

print("6. Logout")

choice = input("Enter your choice: ")

if choice == "1":

view_personal_details(student)

elif choice == "2":


view_fee_breakdown(student)

elif choice == "3":

view_payment_history(student_id)

elif choice == "4":

pay_fees(student_id)

elif choice == "5":

update_personal_details(student_id)

elif choice == "6":

break

else:

print("Invalid choice. Please try again.")

else:

print("Student not found.")

db.close()

def view_personal_details(student):

print("\n--- Personal Details ---")

print(f"{'ID:':<15} {student[0]}")

print(f"{'Name:':<15} {student[1]}")

print(f"{'Class:':<15} {student[2]}")

print(f"{'Section:':<15} {student[3]}")

print(f"{'Total Fees:':<15} {student[4]:.2f}")


print(f"{'Fees Paid:':<15} {student[5]:.2f}")

print(f"{'Balance:':<15} {student[6]:.2f}")

print("------------------------")

def view_fee_breakdown(student):

print("\n--- Fee Breakdown ---")

print(f"{'Total Fees:':<15} {student[4]:.2f}")

print(f"{'Fees Paid:':<15} {student[5]:.2f}")

print(f"{'Balance:':<15} {student[6]:.2f}")

print("------------------------")

def view_payment_history(student_id):

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT * FROM payments WHERE student_id = %s",


(student_id,))

payments = cursor.fetchall()

print("\n--- Payment History ---")

print(f"{'Payment ID':<12} {'Amount Paid':<12} {'Date of Payment':<20}")

print("-" * 44)

for payment in payments:


print(f"{payment[0]:<12} {payment[2]:<12.2f} {payment[3]:<20}")

db.close()

def pay_fees(student_id):

amount = float(input("Enter the amount to pay: "))

db = connect_to_db()

cursor = db.cursor()

cursor.execute("SELECT total_fees, fees_paid, balance FROM students WHERE


student_id = %s", (student_id,))

result = cursor.fetchone()

if result:

total_fees = float(result[0])

fees_paid = float(result[1])

current_balance = float(result[2])

new_fees_paid = fees_paid + amount

new_balance = total_fees - new_fees_paid

if new_balance < 0:

new_balance = 0.00
update_query = "UPDATE students SET fees_paid = %s, balance = %s WHERE
student_id = %s"

cursor.execute(update_query, (new_fees_paid, new_balance, student_id))

cursor.execute("INSERT INTO payments (student_id, amount_paid) VALUES


(%s, %s)", (student_id, amount))

db.commit()

print("Fees paid successfully!")

else:

print("Student not found.")

db.close()

def update_personal_details(student_id):

name = input("Enter new name (or press Enter to skip): ")

grade = input("Enter new class (or press Enter to skip): ")

section = input("Enter new section (or press Enter to skip): ")

email = input("Enter new email (or press Enter to skip): ")

phone = input("Enter new phone number (or press Enter to skip): ")

db = connect_to_db()

cursor = db.cursor()
update_query = "UPDATE students SET "

fields = []

values = []

if name:

fields.append("name = %s")

values.append(name)

if grade:

fields.append("grade = %s")

values.append(grade)

if section:

fields.append("section = %s")

values.append(section)

if email:

fields.append("email = %s")

values.append(email)

if phone:

fields.append("phone = %s")

values.append(phone)

if fields:

update_query += ", ".join(fields) + " WHERE student_id = %s"

values.append(student_id)
cursor.execute(update_query, tuple(values))

db.commit()

print("Personal details updated successfully!")

else:

print("No details to update.")

db.close()

# Main Execution

if __name__ == "__main__":

while True:

print("\n--- School Fee Payment System ---")

print("1. Administrator Login")

print("2. Student Login")

print("3. Exit")

choice = input("Enter your choice: ")

if choice == "1":

password = input("Enter administrator password: ")

if password == "admin123":

admin_view()

else:

print("Incorrect password.")
elif choice == "2":

student_view()

elif choice == "3":

break

else:

print("Invalid choice. Please try again.")

OUTPUT IMAGES
ADMINISTRATOR WINDOW
STUDENT VIEW OUTPUTS
MYSQL QUERY OUTPUT

You might also like