Stock Management System In Python With Source Code
The Stock Management System In Python was developed using python programming, this project created using Graphical User Interface (GUI), and this project also good for the beginners or the students who wants to learn programming specially python.
A Stock Management System having database implemented in SQLite3 and GUI implemented in PyQt5. this project has a Admin log in page. it also have Create, Read, Update and Delete (CRUD) features.
This Python Project also includes a downloadable Python Project With Source Code for free, just find the downloadable source code below and click to start downloading.
By the way if you are new to python programming and you don’t know what would be the the Python IDE to use, I have here a list ofBest Python IDE for Windows, Linux, Mac OSthat will suit for you. I also have hereHow to Download and Install Latest Version of Python on Windows.
To start executingStock Management System In Python With Source Code, make sure that you haveinstalledPython3.9 andPyCharmin your computer.
Stock Management System In Python With Source Code : Steps on how to run the project
Time needed:5 minutes.
These are the steps on how to run Stock Management System In Python With Source Code
Step 1: Download the given source code below.
First, download the given source code below and unzip the source code.
Step 2: Import the project to your PyCharm IDE.
Next, import the source code you’ve download to your PyCharm IDE.
Step 3: Run the project.
last, run the project with the command “py main.py”
from PyQt5 import QtWidgetsimport osimport datetimeimport manipulation as mpfrom PyQt5.QtCore import QRectfrom PyQt5.QtWidgets import QTabWidgetfrom PyQt5.QtWidgets import QTableWidgetfrom PyQt5.QtWidgets import QTableWidgetItemfrom PyQt5.QtWidgets import QVBoxLayoutfrom PyQt5.QtGui import QIconfrom PyQt5.QtWidgets import QFormLayoutfrom PyQt5.QtWidgets import QLabelfrom PyQt5.QtWidgets import QLineEditfrom PyQt5.QtWidgets import QListWidgetfrom PyQt5.QtWidgets import QStackedWidgetfrom PyQt5.QtWidgets import (QWidget, QPushButton,QMainWindow, QHBoxLayout, QAction)import sqlite3try: conn = sqlite3.connect('stock.db') c = conn.cursor() c.execute("""CREATE TABLE stock ( name text, quantity integer, cost integer ) """) conn.commit()except Exception: print('DB exists')class Login(QtWidgets.QDialog): def __init__(self, parent=None): super(Login, self).__init__(parent) self.textName = QtWidgets.QLineEdit(self) self.textPass = QtWidgets.QLineEdit(self) self.buttonLogin = QtWidgets.QPushButton('Admin Login', self) self.buttonLogin.clicked.connect(self.handleLogin) layout = QtWidgets.QVBoxLayout(self) layout.addWidget(self.textName) layout.addWidget(self.textPass) layout.addWidget(self.buttonLogin) def handleLogin(self): if (self.textName.text() == 'Admin' and self.textPass.text() == '1234'): self.accept() else: QtWidgets.QMessageBox.warning( self, 'Error', 'Bad user or password')class Example(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): self.st = stackedExample() exitAct = QAction(QIcon('exit_icon.png'), 'Exit', self) exitAct.setShortcut('Ctrl+Q') exitAct.setStatusTip('Exit application') exitAct.triggered.connect(self.close) self.statusBar() toolbar = self.addToolBar('Exit') toolbar.addAction(exitAct) self.setCentralWidget(self.st) self.show()class stackedExample(QWidget): def __init__(self): super(stackedExample, self).__init__() self.leftlist = QListWidget() self.leftlist.setFixedWidth(250) self.leftlist.insertItem(0, 'Add Stock') self.leftlist.insertItem(1, 'Manage Stock') self.leftlist.insertItem(2, 'View Stock') self.leftlist.insertItem(3, 'View Transaction History') self.stack1 = QWidget() self.stack2 = QWidget() self.stack3 = QWidget() self.stack4 = QWidget() self.stack1UI() self.stack2UI() self.stack3UI() self.stack4UI() self.Stack = QStackedWidget(self) self.Stack.addWidget(self.stack1) self.Stack.addWidget(self.stack2) self.Stack.addWidget(self.stack3) self.Stack.addWidget(self.stack4) hbox = QHBoxLayout(self) hbox.addWidget(self.leftlist) hbox.addWidget(self.Stack) self.setLayout(hbox) self.leftlist.currentRowChanged.connect(self.display) self.setGeometry(500,350, 200, 200) self.setWindowTitle('Stock Management') self.show() def stack1UI(self): layout = QFormLayout() self.ok = QPushButton('Add Stock', self) cancel = QPushButton('Cancel', self) self.stock_name = QLineEdit() layout.addRow("Stock Name", self.stock_name) self.stock_count = QLineEdit() layout.addRow("Quantity", self.stock_count) self.stock_cost = QLineEdit() layout.addRow("Cost of Stock (per item)", self.stock_cost) layout.addWidget(self.ok) layout.addWidget(cancel) self.ok.clicked.connect(self.on_click) cancel.clicked.connect(self.stock_name.clear) cancel.clicked.connect(self.stock_cost.clear) cancel.clicked.connect(self.stock_count.clear) self.stack1.setLayout(layout) def on_click(self): now = datetime.datetime.now() stock_name_inp = self.stock_name.text().replace(' ','_').lower() stock_count_inp = int(self.stock_count.text()) stock_cost_inp = int(self.stock_cost.text()) #print(stock_name_inp,stock_count_inp,stock_cost_inp) stock_add_date_time = now.strftime("%Y-%m-%d %H:%M") d = mp.insert_prod(stock_name_inp,stock_count_inp,stock_cost_inp,stock_add_date_time) print(d) #Need to add the above details to table def stack2UI(self): layout = QHBoxLayout() layout.setGeometry(QRect(0,300,1150,500)) tabs = QTabWidget() self.tab1 = QWidget() self.tab2 = QWidget() self.tab3 = QWidget() tabs.addTab(self.tab1, 'Add Quantity') tabs.addTab(self.tab2, 'Reduce Quantity') tabs.addTab(self.tab3, 'Delete Stock') self.tab1UI() self.tab2UI() self.tab3UI() layout.addWidget(tabs) self.stack2.setLayout(layout) def tab1UI(self): layout = QFormLayout() self.ok_add = QPushButton('Add Stock', self) cancel = QPushButton('Cancel', self) self.stock_name_add = QLineEdit() layout.addRow("Stock Name", self.stock_name_add) self.stock_count_add = QLineEdit() layout.addRow("Quantity to add", self.stock_count_add) layout.addWidget(self.ok_add) layout.addWidget(cancel) self.tab1.setLayout(layout) self.ok_add.clicked.connect(self.call_add) #need to write function to add quantity cancel.clicked.connect(self.stock_name_add.clear) cancel.clicked.connect(self.stock_count_add.clear) def tab2UI(self): layout = QFormLayout() self.ok_red = QPushButton('Reduce Stock', self) cancel = QPushButton('Cancel', self) self.stock_name_red = QLineEdit() layout.addRow("Stock Name", self.stock_name_red) self.stock_count_red = QLineEdit() layout.addRow("Quantity to reduce", self.stock_count_red) layout.addWidget(self.ok_red) layout.addWidget(cancel) self.tab2.setLayout(layout) self.ok_red.clicked.connect(self.call_red) # need to write function to reduce quantity cancel.clicked.connect(self.stock_name_red.clear) cancel.clicked.connect(self.stock_count_red.clear) def tab3UI(self): layout = QFormLayout() self.ok_del = QPushButton('Delete Stock', self) cancel = QPushButton('Cancel', self) self.stock_name_del = QLineEdit() layout.addRow("Stock Name", self.stock_name_del) layout.addWidget(self.ok_del) layout.addWidget(cancel) self.tab3.setLayout(layout) self.ok_del.clicked.connect(self.call_del) # need to write function to delete stock cancel.clicked.connect(self.stock_name_del.clear) def call_del(self): now = datetime.datetime.now() stock_del_date_time = now.strftime("%Y-%m-%d %H:%M") stock_name = self.stock_name_del.text().replace(' ','_').lower() mp.remove_stock(stock_name,stock_del_date_time) def call_red(self): now = datetime.datetime.now() stock_red_date_time = now.strftime("%Y-%m-%d %H:%M") stock_name = self.stock_name_red.text().replace(' ','_').lower() try: stock_val = -(int(self.stock_count_red.text())) print(stock_val) print(type(stock_val)) mp.update_quantity(stock_name, stock_val, stock_red_date_time) except Exception: print('Exception') def call_add(self): now = datetime.datetime.now() stock_call_add_date_time = now.strftime("%Y-%m-%d %H:%M") stock_name = self.stock_name_add.text().replace(' ','_').lower() stock_val = int(self.stock_count_add.text()) mp.update_quantity(stock_name, stock_val, stock_call_add_date_time) def stack3UI(self): table = mp.show_stock() print('show') print(table) layout = QVBoxLayout() self.srb = QPushButton() self.srb.setText("Get Search Result.") self.View = QTableWidget() self.lbl3 = QLabel() self.lbl_conf_text = QLabel() self.lbl_conf_text.setText("Enter the search keyword:") self.conf_text = QLineEdit() self.View.setColumnCount(3) self.View.setColumnWidth(0, 250) self.View.setColumnWidth(1, 250) self.View.setColumnWidth(2, 200) self.View.insertRow(0) self.View.setItem(0, 0, QTableWidgetItem('Stock Name')) self.View.setItem(0, 1, QTableWidgetItem('Quantity')) self.View.setItem(0, 2, QTableWidgetItem('Cost(Per Unit)')) layout.addWidget(self.View) layout.addWidget(self.lbl_conf_text) layout.addWidget(self.conf_text) layout.addWidget(self.srb) layout.addWidget(self.lbl3) self.srb.clicked.connect(self.show_search) self.stack3.setLayout(layout) def show_search(self): if self.View.rowCount()>1: for i in range(1,self.View.rowCount()): self.View.removeRow(1) x_act = mp.show_stock() x = [] if self.conf_text.text() != '': for i in range(0,len(x_act)): a = list(x_act[i]) if self.conf_text.text().lower() in a[0].lower(): x.append(a) else: x = mp.show_stock() if len(x)!=0: for i in range(1,len(x)+1): self.View.insertRow(i) a = list(x[i-1]) self.View.setItem(i, 0, QTableWidgetItem(a[0].replace('_',' ').upper())) self.View.setItem(i, 1, QTableWidgetItem(str(a[1]))) self.View.setItem(i, 2, QTableWidgetItem(str(a[2]))) self.View.setRowHeight(i, 50) self.lbl3.setText('Viewing Stock Database.') else: self.lbl3.setText('No valid information in database.') def stack4UI(self): layout = QVBoxLayout() self.srt = QPushButton() self.srt.setText("Get Transaction History.") self.Trans = QTableWidget() self.lbl4 = QLabel() self.lbl_trans_text = QLabel() self.lbl_trans_text.setText("Enter the search keyword:") self.trans_text = QLineEdit() self.Trans.setColumnCount(6) self.Trans.setColumnWidth(0, 150) self.Trans.setColumnWidth(1, 150) self.Trans.setColumnWidth(2, 150) self.Trans.setColumnWidth(3, 100) self.Trans.setColumnWidth(4, 100) self.Trans.setColumnWidth(5, 500) self.Trans.insertRow(0) self.Trans.setItem(0, 0, QTableWidgetItem('Transaction ID')) self.Trans.setItem(0, 1, QTableWidgetItem('Stock Name')) self.Trans.setItem(0, 2, QTableWidgetItem('Transaction Type')) self.Trans.setItem(0, 3, QTableWidgetItem('Date')) self.Trans.setItem(0, 4, QTableWidgetItem('Time')) self.Trans.setItem(0, 5, QTableWidgetItem('Transaction Specific')) self.Trans.setRowHeight(0, 50) layout.addWidget(self.Trans) layout.addWidget(self.lbl_trans_text) layout.addWidget(self.trans_text) layout.addWidget(self.srt) layout.addWidget(self.lbl4) self.srt.clicked.connect(self.show_trans_history) self.stack4.setLayout(layout) def show_trans_history(self): if self.Trans.rowCount()>1: for i in range(1,self.Trans.rowCount()): self.Trans.removeRow(1) path = os.path.join(os.path.dirname(os.path.realpath(__file__)),'transaction.txt') if os.path.exists(path): tsearch = open(path, 'r') x_c = tsearch.readlines() tsearch.close() x = [] if self.trans_text.text() != '': key = self.trans_text.text() for i in range(0,len(x_c)): a = x_c[i].split(" ") name = a[0] action = a[-2] if (key.lower() in name.lower()) or (key.lower() in action.lower()) : x.append(a) else: x = x_c.copy() for i in range(0,len(x)): x.sort(key=lambda a: a[4]) #print(x) tid = 1900001 for i in range(1,len(x)+1): self.Trans.insertRow(i) a = x[i-1].split(" ") if a[-2] == 'UPDATE': p = 'Quantity of Stock Changed from '+a[1]+' to '+a[2] elif a[-2] == 'INSERT': p = 'Stock added with Quantity : '+a[1]+' and Cost(Per Unit in Rs.) : '+a[2] elif a[-2] == 'REMOVE': p = 'Stock information deleted.' else: p = 'None' self.Trans.setItem(i, 0, QTableWidgetItem(str(tid))) self.Trans.setItem(i, 1, QTableWidgetItem(a[0].replace('_',' '))) self.Trans.setItem(i, 2, QTableWidgetItem(a[-2])) self.Trans.setItem(i, 3, QTableWidgetItem(a[3])) self.Trans.setItem(i, 4, QTableWidgetItem(a[4])) self.Trans.setItem(i, 5, QTableWidgetItem(p)) self.Trans.setRowHeight(i, 50) tid += 1 self.lbl4.setText('Transaction History.') else: self.lbl4.setText('No valid information found.') def display(self, i): self.Stack.setCurrentIndex(i)if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) login = Login() if login.exec_() == QtWidgets.QDialog.Accepted: window = Example() sys.exit(app.exec_())
Output
Download Source Code below
DOWNLOAD
Username: Admin
Password: 1234
Summary
The Project is written in Python using Tkinter.The project It’s an inventory management system created using python having database implemented in SQLite3 and GUI implemented in PyQt5. this project has a Admin log in page. it also have Create, Read, Update and Delete (CRUD) features.
Related Articles
Code For Game inPython:PythonGame Projects With Source Code
BestPythonProjects With Source Code 2020 FREE DOWNLOAD
How to Make a Point of Sale InPythonWith Source Code 2021
PythonCode For Food Ordering System | FREE DOWNLOAD | 2020
Inventory Management System Project inPythonWith Source Code
Inquiries
If you have any questions or suggestions aboutStock Management System In Python With Source Code, please feel free to leave a comment below.
There are several steps involved in this process. That's why how to make inventory management software is so important. ... Common Features of the Inventory Management System
SQL Inventory Manager offers an organized web-based dashboard that captures core information about the entire inventory of SQL Servers across the environment. View all SQL Servers: Know what you have where and who owns it. Automatically discover new servers installed to better manage sprawl.
Add/Remove/Edit book: To add, remove or modify a book or book item. Search catalog: To search books by title, author, subject or publication date. Register new account/cancel membership: To add a new member or cancel the membership of an existing member. Check-out book: To borrow a book from the library.
Create a step-by-step algorithm to approximate a complex system. Design and run a real-world simulation in Python with simpy. ... To recap, here are the three steps to running a simulation in Python:
With integrated tools, features, and formulas to make spreadsheets more dynamic and interactive, Excel is also capable of handling basic inventory management for small businesses. While not ideal for a medium or large sized inventory, Excel is cost-effective or, if you use it in OneDrive, even free.
SQL databases offer analysts the ability to not only collect and store information and data but also work with business intelligence and data visualization tools that create valuable financial models and predictions.
In this article we'll dive into the three most common inventory management strategies that most manufacturers operate by: the pull strategy, the push strategy, and the just in time (JIT) strategy.
Businesses can choose from either of the three inventory systems: manual, periodic, and perpetual. Let's take a look at each one of these systems and find out how they are different from one another.
The golden rule of stock control is to get the quantity and the frequency of re-stocking activities right, keeping costs as low as possible without compromising profitability and growth.
LIFO and FIFO are methods to determine the cost of goods. FIFO, or first-in, first-out, assumes the older inventory is sold first in order to keep inventory fresh. LIFO, or last-in, first-out, assumes the newer inventory is typically sold first to prevent inventory from going bad.
What are the three most common inventory control models? Three of the most popular inventory control models are Economic Order Quantity (EOQ), Inventory Production Quantity, and ABC Analysis. Each inventory model has a different approach to help you know how much inventory you should have in stock.
The best way to keep track of inventory is with an easy-to-use, robust inventory management software system. With inventory management software, you can get real-time alerts, add meaningful pictures to your inventory list, and utilize barcodes and QR codes to automate otherwise tedious, error-prone processes.
You can manage your investment account on your own or hire a professional to handle the task for you. There are also automated portfolio management services, or robo-advisors, in industry parlance.
Investing.com. Investing.com is a financial plan of action and stock news corner, one of the well-known three worldwide financial websites globally. ...
You can use Python to create arcade games, adventure games, and puzzle games that you can deploy within a few hours. You can also code classic games, such as hangman, tic-tac-toe, rock paper scissors, and more with your newly acquired programming skills.
What is the easiest Python web framework? Bottle is a Python framework that's easiest to start for beginners. It is because Bottle implements everything in a single source file and has no dependencies besides the Python standard library.
The py_compile module provides a function to generate a byte-code file from a source file, and another function used when the module source file is invoked as a script.
Python program runs directly from the source code . so, Python will fall under byte code interpreted. The . py source code is first compiled to byte code as .
In general, Python developers can expect to earn salaries in the range of ₹4,00,000 to ₹8,00,000 per year, but they are depending upon their experience and skills.
In general, it takes around two to six months to learn the fundamentals of Python. But you can learn enough to write your first short program in a matter of minutes. Developing mastery of Python's vast array of libraries can take months or years.
Yes, it's absolutely possible to learn Python on your own. Although it might affect the amount of time you need to take to learn Python, there are plenty of free online courses, video tips, and other interactive resources to help anyone learn to program with Python.
Whenever you want to create a package, then you have to include __init__.py file in the directory. You can write code inside or leave it as blank as your wish. It doesn't bothers Python. Create a directory and include a __init__.py file in it to tell Python that the current directory is a package.
The library management model is built based on data mining technology and clustering algorithm, and the hybrid clustering algorithm in the data mining platform Weka is used for library data mining.
Library Management System is implemented using linked list in C programming language. The main operation involves issuing books, returning the issued books and maintaining records of the issued books.
You can use Python and the PySimpleGUI package to create nice-looking user interfaces that you and your users will enjoy! PySimpleGUI is a new Python GUI library that has been gaining a lot of interest recently.
On Windows, bring up the command prompt and type "py", or start an interactive Python session by selecting "Python (command line)", "IDLE", or similar program from the task bar / app menu. IDLE is a GUI which includes both an interactive mode and options to edit and run files.
The objective of coding is to identify goods in a unique way (there can't be two products with the same code). Warehouse management systems (WMSs) play a key role in this process.
Python can be utilized to create incredibly scalable and secure banking software solutions. Python is utilized in the banking industry to power both online and offline applications. Python has been used to create and maintain a large number of payment gateways.
First off, what industries use Python? Because of its high level of functionality, many industries can't do without it, including: web development, data science and data analysis, machine learning, startups, and the finance industry, among others.
The four types of inventory management are just-in-time management (JIT), materials requirement planning (MRP), economic order quantity (EOQ) , and days sales of inventory (DSI). Each inventory management style works better for different businesses, and there are pros and cons to each type.
Zoho Inventory is an online inventory management software with a robust free version and affordable paid plans. For small businesses or start-ups, Zoho Inventory lets you add items, fulfill orders and view inventory from any device, making it the best free option.
A web based expense tracker app with user authentication which contains CRUD operation made with the help of the django framework it takes input from user and shows the expenses to the user and analyse expense with the help of matplotlib library. python django expense-tracker sqllite3. Updated on Aug 4, 2022. Python.
Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.
We notice you're using an ad blocker
Without advertising income, we can't keep making this site awesome for you.