├── .gitignore ├── temp.py ├── __pycache__ ├── bank.cpython-310.pyc ├── customer.cpython-310.pyc ├── database.cpython-310.pyc └── register.cpython-310.pyc ├── Bank Management System FlowChat.pdf ├── customer.py ├── database.py ├── register.py ├── main.py ├── README.md └── bank.py /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ -------------------------------------------------------------------------------- /temp.py: -------------------------------------------------------------------------------- 1 | import random 2 | print(random.randint(10000000, 99999999)) -------------------------------------------------------------------------------- /__pycache__/bank.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohitprajapat2001/Python-Bank-Project/HEAD/__pycache__/bank.cpython-310.pyc -------------------------------------------------------------------------------- /Bank Management System FlowChat.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohitprajapat2001/Python-Bank-Project/HEAD/Bank Management System FlowChat.pdf -------------------------------------------------------------------------------- /__pycache__/customer.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohitprajapat2001/Python-Bank-Project/HEAD/__pycache__/customer.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/database.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohitprajapat2001/Python-Bank-Project/HEAD/__pycache__/database.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/register.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohitprajapat2001/Python-Bank-Project/HEAD/__pycache__/register.cpython-310.pyc -------------------------------------------------------------------------------- /customer.py: -------------------------------------------------------------------------------- 1 | #Customer Details 2 | from database import * 3 | class Customer: 4 | 5 | def __init__(self, username, password, name, age, city, account_number): 6 | self.__username = username 7 | self.__password = password 8 | self.__name = name 9 | self.__age = age 10 | self.__city = city 11 | self.__account_number = account_number 12 | 13 | def createuser(self): 14 | db_query(f"INSERT INTO customers VALUES ('{self.__username}', '{self.__password}', '{self.__name}', '{self.__age}', '{self.__city}', 0 , '{self.__account_number}', 1 );") 15 | mydb.commit() -------------------------------------------------------------------------------- /database.py: -------------------------------------------------------------------------------- 1 | #Database Management Banking 2 | import mysql.connector as sql 3 | 4 | mydb = sql.connect( 5 | host="localhost", 6 | user="root", 7 | passwd="7877", 8 | database="bank" 9 | ) 10 | 11 | cursor = mydb.cursor() 12 | 13 | def db_query(str): 14 | cursor.execute(str) 15 | result = cursor.fetchall() 16 | return result 17 | 18 | def createcustomertable(): 19 | cursor.execute(''' 20 | CREATE TABLE IF NOT EXISTS customers 21 | (username VARCHAR(20) NOT NULL, 22 | password VARCHAR(20) NOT NULL, 23 | name varchar(20) NOT NULL, 24 | age INTEGER NOT NULL, 25 | city VARCHAR(20) NOT NULL, 26 | balance INTEGER NOT NULL, 27 | account_number INTEGER NOT NULL, 28 | status BOOLEAN NOT NULL) 29 | ''') 30 | 31 | mydb.commit() 32 | 33 | if __name__ == "__main__": 34 | createcustomertable() -------------------------------------------------------------------------------- /register.py: -------------------------------------------------------------------------------- 1 | #User Registration Signin Signup 2 | from customer import * 3 | from bank import Bank 4 | import random 5 | 6 | def SignUp(): 7 | username = input("Create Username: ") 8 | temp = db_query(f"SELECT username FROM customers where username = '{username}';") 9 | if temp: 10 | print("Username Already Exists") 11 | SignUp() 12 | else: 13 | print("Username is Available Please Proceed") 14 | password = input("Enter Your Password: ") 15 | name = input("Enter Your Name: ") 16 | age = input("Enter Your Age: ") 17 | city = input("Enter Your City: ") 18 | while True: 19 | account_number = int(random.randint(10000000, 99999999)) 20 | temp = db_query(f"SELECT account_number FROM customers WHERE account_number = '{account_number}';") 21 | if temp: 22 | continue 23 | else: 24 | print("Your Account Number",account_number) 25 | break 26 | cobj = Customer(username, password, name, age, city, account_number) 27 | cobj.createuser() 28 | bobj = Bank(username, account_number) 29 | bobj.create_transaction_table() 30 | def SignIn(): 31 | username = input("Enter Username: ") 32 | temp = db_query(f"SELECT username FROM customers where username = '{username}';") 33 | if temp: 34 | while True: 35 | password = input(f"Welcome {username.capitalize()} Enter Password: ") 36 | temp = db_query(f"SELECT password FROM customers where username = '{username}';") 37 | # print(temp[0][0]) 38 | if temp[0][0] == password: 39 | print("Sign IN Succesfully") 40 | return username 41 | else: 42 | print("Wrong Password Try Again") 43 | continue 44 | else: 45 | print("Enter Correct Username") 46 | SignIn() 47 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from register import * 2 | from bank import * 3 | 4 | status = False 5 | print("Welcome to Mohit Banking Project") 6 | while True: 7 | try: 8 | register = int(input("1. SignUp\n" 9 | "2. SignIn")) 10 | if register == 1 or register == 2: 11 | if register == 1: 12 | SignUp() 13 | if register == 2: 14 | user = SignIn() 15 | status = True 16 | break 17 | else: 18 | print("Please Enter Valid Input From Options") 19 | 20 | except ValueError: 21 | print("Invalid Input Try Again with Numbers") 22 | 23 | account_number = db_query( 24 | f"SELECT account_number FROM customers WHERE username = '{user}';") 25 | 26 | while status: 27 | print(f"Welcome {user.capitalize()} Choose Your Banking Service\n") 28 | try: 29 | facility = int(input("1. Balance Enquiry\n" 30 | "2. Cash Deposit\n" 31 | "3. Cash Withdraw\n" 32 | "4. Fund Transfer\n" 33 | "5. Exit\n " 34 | )) 35 | if facility >= 1 and facility <= 5: 36 | if facility == 1: 37 | bobj = Bank(user, account_number[0][0]) 38 | bobj.balanceequiry() 39 | elif facility == 2: 40 | while True: 41 | try: 42 | amount = int(input("Enter Amount to Deposit")) 43 | bobj = Bank(user, account_number[0][0]) 44 | bobj.deposit(amount) 45 | mydb.commit() 46 | break 47 | except ValueError: 48 | print("Enter Valid Input ie. Number") 49 | continue 50 | 51 | elif facility == 3: 52 | while True: 53 | try: 54 | amount = int(input("Enter Amount to Withdraw")) 55 | bobj = Bank(user, account_number[0][0]) 56 | bobj.withdraw(amount) 57 | mydb.commit() 58 | break 59 | except ValueError: 60 | print("Enter Valid Input ie. Number") 61 | continue 62 | elif facility == 4: 63 | while True: 64 | try: 65 | receive = int(input("Enter Receiver Account Number")) 66 | amount = int(input("Enter Money to Transfer")) 67 | bobj = Bank(user, account_number[0][0]) 68 | bobj.fundtransfer(receive, amount) 69 | mydb.commit() 70 | break 71 | except ValueError: 72 | print("Enter Valid Input ie. Number") 73 | continue 74 | elif facility == 5: 75 | print("Thanks For Using Banking Services") 76 | status = False 77 | else: 78 | print("Please Enter Valid Input From Options") 79 | continue 80 | 81 | except ValueError: 82 | print("Invalid Input Try Again with Numbers") 83 | continue 84 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bank Management System 2 | 3 | Welcome to the Bank Management System, a Python-based command-line application designed to manage bank accounts efficiently. This system allows users to sign in, sign up, manage their accounts, perform transactions, and check their account details. 4 | 5 | ## Features 6 | 7 | - **Sign In / Sign Up** 8 | - Check if User is Registered 9 | - No User Registration 10 | 11 | - **Account Management** 12 | - Same Account 13 | - Credit / Withdraw 14 | - Send Money to Another Account 15 | - Account Details Update 16 | - Transaction History 17 | 18 | - **Banking Facilities** 19 | - Account Details 20 | - Registration 21 | - Account Management 22 | - Transaction History 23 | - Balance Enquiry 24 | - Credit / Withdraw 25 | - Funds Transfer 26 | - Date/Time Functions 27 | - OOPs Implementation 28 | - Separate Account Number 29 | 30 | ## Getting Started 31 | 32 | ### Prerequisites 33 | 34 | Ensure you have Python installed on your system. You can download it from [python.org](https://www.python.org/downloads/). 35 | 36 | ### Installation 37 | 1. Install MySQL Connector: 38 | ```bash 39 | pip install mysql-connector-python 40 | ``` 41 | 2. Clone the repository: 42 | ```bash 43 | git clone https://github.com/mohitprajapat2001/Python-Bank-Project 44 | ``` 45 | 3. Navigate to the project directory: 46 | ```bash 47 | cd Python-Bank-Project 48 | ``` 49 | 50 | ### Usage 51 | 1. Run the Database File Once to Create Required Tables: 52 | ```bash 53 | python database.py 54 | ``` 55 | 2. Run the application: 56 | ```bash 57 | python main.py 58 | ``` 59 | 3. Follow the on-screen instructions to navigate through the menu and use the various features of the bank management system. 60 | 61 | ## Detailed Features 62 | 63 | ### Registration 64 | 65 | - New users can register by providing personal details and creating an account. 66 | 67 | ### Sign In / Sign Up 68 | 69 | - Users can sign in using their account credentials. 70 | - New users can sign up and create a new account. 71 | 72 | ### Account Management 73 | 74 | - Update account details. 75 | - View and manage the transaction history. 76 | - Enquire about account balance. 77 | 78 | ### Transactions 79 | 80 | - Credit or withdraw money from the account. 81 | - Transfer funds to another account. 82 | 83 | ### Banking Facilities 84 | 85 | - Provides various banking functionalities like balance enquiry, funds transfer, and viewing transaction history. 86 | - Implements object-oriented programming (OOP) for better code management and scalability. 87 | - Each account has a unique account number. 88 | 89 | ### Date/Time Functions 90 | 91 | - Utilizes date and time functions to keep track of transactions and account activities. 92 | 93 | ## Contributing 94 | 95 | We welcome contributions to enhance the features and improve the system. Feel free to fork the repository and create a pull request with your changes. 96 | 97 | ## License 98 | 99 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 100 | 101 | ## Contact 102 | 103 | For any queries or issues, please reach out to us through our social media channels: 104 | 105 | - [YouTube](https://www.youtube.com/@itsmohitcodes) 106 | - [Telegram](https://t.me/itsmohitcodes) 107 | - [Instagram](https://www.instagram.com/itsmohit.codes) 108 | - [LinkedIn](https://www.linkedin.com/in/itsmohitprajapat/) 109 | 110 | Thank you for using the Bank Management System! We hope it helps you manage your bank accounts effectively. 111 | -------------------------------------------------------------------------------- /bank.py: -------------------------------------------------------------------------------- 1 | # Bank Services 2 | from database import * 3 | import datetime 4 | 5 | 6 | class Bank: 7 | def __init__(self, username, account_number): 8 | self.__username = username 9 | self.__account_number = account_number 10 | 11 | def create_transaction_table(self): 12 | db_query(f"CREATE TABLE IF NOT EXISTS {self.__username}_transaction " 13 | f"( timedate VARCHAR(30)," 14 | f"account_number INTEGER," 15 | f"remarks VARCHAR(30)," 16 | f"amount INTEGER )") 17 | 18 | def balanceequiry(self): 19 | temp = db_query( 20 | f"SELECT balance FROM customers WHERE username = '{self.__username}';") 21 | print(f"{self.__username} Balance is {temp[0][0]}") 22 | 23 | def deposit(self, amount): 24 | temp = db_query( 25 | f"SELECT balance FROM customers WHERE username = '{self.__username}';") 26 | test = amount + temp[0][0] 27 | db_query( 28 | f"UPDATE customers SET balance = '{test}' WHERE username = '{self.__username}'; ") 29 | self.balanceequiry() 30 | db_query(f"INSERT INTO {self.__username}_transaction VALUES (" 31 | f"'{datetime.datetime.now()}'," 32 | f"'{self.__account_number}'," 33 | f"'Amount Deposit'," 34 | f"'{amount}'" 35 | f")") 36 | print(f"{self.__username} Amount is Sucessfully Depositted into Your Account {self.__account_number}") 37 | 38 | def withdraw(self, amount): 39 | temp = db_query( 40 | f"SELECT balance FROM customers WHERE username = '{self.__username}';") 41 | if amount > temp[0][0]: 42 | print("Insufficient Balance Please Deposit Money") 43 | else: 44 | test = temp[0][0] - amount 45 | db_query( 46 | f"UPDATE customers SET balance = '{test}' WHERE username = '{self.__username}'; ") 47 | self.balanceequiry() 48 | db_query(f"INSERT INTO {self.__username}_transaction VALUES (" 49 | f"'{datetime.datetime.now()}'," 50 | f"'{self.__account_number}'," 51 | f"'Amount Withdraw'," 52 | f"'{amount}'" 53 | f")") 54 | print( 55 | f"{self.__username} Amount is Sucessfully Withdraw from Your Account {self.__account_number}") 56 | 57 | def fundtransfer(self, receive, amount): 58 | temp = db_query( 59 | f"SELECT balance FROM customers WHERE username = '{self.__username}';") 60 | if amount > temp[0][0]: 61 | print("Insufficient Balance Please Deposit Money") 62 | else: 63 | temp2 = db_query( 64 | f"SELECT balance FROM customers WHERE account_number = '{receive}';") 65 | if temp2 == []: 66 | print("Account Number Does not Exists") 67 | else: 68 | test1 = temp[0][0] - amount 69 | test2 = amount + temp2[0][0] 70 | db_query( 71 | f"UPDATE customers SET balance = '{test1}' WHERE username = '{self.__username}'; ") 72 | db_query( 73 | f"UPDATE customers SET balance = '{test2}' WHERE account_number = '{receive}'; ") 74 | receiver_username = db_query( 75 | f"SELECT username FROM customers where account_number = '{receive}';") 76 | self.balanceequiry() 77 | db_query(f"INSERT INTO {receiver_username[0][0]}_transaction VALUES (" 78 | f"'{datetime.datetime.now()}'," 79 | f"'{self.__account_number}'," 80 | f"'Fund Transfer From {self.__account_number}'," 81 | f"'{amount}'" 82 | f")") 83 | db_query(f"INSERT INTO {self.__username}_transaction VALUES (" 84 | f"'{datetime.datetime.now()}'," 85 | f"'{self.__account_number}'," 86 | f"'Fund Transfer -> {receive}'," 87 | f"'{amount}'" 88 | f")") 89 | print( 90 | f"{self.__username} Amount is Sucessfully Transaction from Your Account {self.__account_number}") 91 | --------------------------------------------------------------------------------