Skip to content

Commit

Permalink
New Version with Modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanBaig authored Aug 10, 2023
1 parent 0840da9 commit 6583033
Show file tree
Hide file tree
Showing 8 changed files with 1,433 additions and 1,391 deletions.
1,348 changes: 674 additions & 674 deletions LICENSE.txt

Large diffs are not rendered by default.

91 changes: 46 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
# ICE POS
## ICE POS (Point of Sale) Type thing I made for my Father's Business
### Features:
- [x] Submission for Data (Submission Tab)
- [x] Retrieval of Data through another Tab in the Tkinter Window (Answers Tab)
- [x] Printing of the Data
- [x] Custom Identifier Key (Consign Key) for shipment identification
### Modules Used:
- [x] Tkinter ([messagebox](https://docs.python.org/3.9/library/tkinter.messagebox.html), [ttk](https://docs.python.org/3.9/library/tkinter.ttk.html), [filedialog](https://docs.python.org/3.9/library/dialog.html), StringVar)
- [x] [Sqlite3](https://docs.python.org/3.9/library/sqlite3.html)
- [x] pywin32 ([win32print](http://timgolden.me.uk/pywin32-docs/win32print.html), [win32ui](http://timgolden.me.uk/pywin32-docs/win32ui.html))
- [x] PIL aka Pillow ([Image](https://pillow.readthedocs.io/en/stable/reference/Image.html), [ImageDraw](https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html), [ImageFont](https://pillow.readthedocs.io/en/stable/reference/ImageFont.html))
- [x] Screeninfo (couldn't find the documentation sorry)
- [x] [OS](https://docs.python.org/3/library/os.html)
### Functions: (This will be a very long list)
#### [**icepos.py:**](https://github.com/RyanGamingYT/ICEPOS/blob/master/icepos.py)
- [x] close_connection (To close the connection for the database when the main window is closed Too.)
- [x] create_formatted_image (To create the formatted image for printing.)
- [x] display_selected_answer (To display the answers in the text widget in **Answers Tab**)
- [x] exit_win (To exit the program using ESC key.)
- [x] print_formatted_image (To create and print the formatted image using both the print_image and
create_formatted_image functions)
- [x] print_image (To print the previously create image)
- [x] refresh_dropdown (To refresh the dropdown in **Answers Tab** To check for new submissions)
- [x] refresh_dropdown_and_text (To display the answers in the text widget in **Answers Tab**)
- [x] reset (To reset/clear all submissions by deleting and creating a new sqlite database)
- [x] submit (To submit the answers)
- [x] toggle_fullscreen (to Toggle fullscreen through keybind (F11) or the butTon in Top-right corner)
- [x] update_dropdown_with_data (adds support for the dropdown being used more than once)
- [x] close_menu (close the sidebar/menu and works with toggle_menu)
- [x] generate_consign_key (to generate a special key to differentiate between different shipments)
- [x] load_last_consign_key (self-explanatory and works with generate_consign_key)
- [x] toggle_menu (to toggle the sidebar/menu and uses close_menu)
#### [**database_functions.py:**](https://github.com/RyanGamingYT/blob/master/database_functions.py)
- [x] create_db (To create the new database for the reset function)
- [x] db_To_dict (converts the submissions stored in the database inTo a dictionary To easily display the information)
- [x] delete_db (To delete the database for the reset function)
### Screenshots:

![Submission Tab (Sidebar Closed)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Submission%20Tab%20(Sidebar%20Closed).JPG)

![Submission Tab (Sidebar Open)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Submission%20Tab%20(Sidebar%20Open).JPG)

![Answers Tab (No Answer Selected)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Answers%20Tab%20(No%20Answer%20Selected).JPG)

# ICE POS
## ICE POS (Point of Sale) Type thing I made for my Father's Business
### Features:
- [x] Submission for Data (Submission Tab)
- [x] Retrieval of Data through another Tab in the Tkinter Window (Answers Tab)
- [x] Printing of the Data
- [x] Custom Identifier Key (Consign Key) for shipment identification
### Modules Used:
- [x] Tkinter ([messagebox](https://docs.python.org/3.9/library/tkinter.messagebox.html), [ttk](https://docs.python.org/3.9/library/tkinter.ttk.html), [filedialog](https://docs.python.org/3.9/library/dialog.html), StringVar)
- [x] [Sqlite3](https://docs.python.org/3.9/library/sqlite3.html)
- [x] pywin32 ([win32print](http://timgolden.me.uk/pywin32-docs/win32print.html), [win32ui](http://timgolden.me.uk/pywin32-docs/win32ui.html))
- [x] PIL aka Pillow ([Image](https://pillow.readthedocs.io/en/stable/reference/Image.html), [ImageDraw](https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html), [ImageFont](https://pillow.readthedocs.io/en/stable/reference/ImageFont.html))
- [x] Screeninfo (couldn't find the documentation sorry)
- [x] [OS](https://docs.python.org/3/library/os.html)
### Functions: (This will be a very long list)
#### [**icepos.py:**](https://github.com/RyanGamingYT/ICEPOS/blob/master/icepos.py)
- [x] close_connection (To close the connection for the database when the main window is closed Too.)
- [x] create_formatted_image (To create the formatted image for printing.)
- [x] display_selected_answer (To display the answers in the text widget in **Answers Tab**)
- [x] exit_win (To exit the program using ESC key.)
- [x] print_formatted_image (To create and print the formatted image using both the print_image and
create_formatted_image functions)
- [x] print_image (To print the previously create image)
- [x] refresh_dropdown (To refresh the dropdown in **Answers Tab** To check for new submissions)
- [x] refresh_dropdown_and_text (To display the answers in the text widget in **Answers Tab**)
- [x] reset (To reset/clear all submissions by deleting and creating a new sqlite database)
- [x] submit (To submit the answers)
- [x] toggle_fullscreen (to Toggle fullscreen through keybind (F11) or the butTon in Top-right corner)
- [x] update_dropdown_with_data (adds support for the dropdown being used more than once)
- [x] close_menu (close the sidebar/menu and works with toggle_menu)
- [x] generate_consign_key (to generate a special key to differentiate between different shipments)
- [x] load_last_consign_key (self-explanatory and works with generate_consign_key)
- [x] display_consign_key (displays the last-used consign key using the information messagebox. Made for the button in sidebar.)
- [x] toggle_menu (to toggle the sidebar/menu and uses close_menu)
#### [**database_functions.py:**](https://github.com/RyanGamingYT/blob/master/database_functions.py)
- [x] create_db (To create the new database for the reset function)
- [x] db_To_dict (converts the submissions stored in the database inTo a dictionary To easily display the information)
- [x] delete_db (To delete the database for the reset function)
### Screenshots:

![Submission Tab (Sidebar Closed)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Submission%20Tab%20(Sidebar%20Closed).JPG)

![Submission Tab (Sidebar Open)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Submission%20Tab%20(Sidebar%20Open).JPG)

![Answers Tab (No Answer Selected)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Answers%20Tab%20(No%20Answer%20Selected).JPG)

![Answers Tab (Sample Answer Selected)](https://github.com/RyanGamingYT/ICEPOS/blob/master/media/screenshots/Answers%20Tab%20(Sample%20Answer%20Selected).JPG)
3 changes: 3 additions & 0 deletions other/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pywin32==306
Pillow==10.0.0
screeninfo==0.8.1
1 change: 1 addition & 0 deletions run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python scripts\\run.py
Binary file not shown.
188 changes: 94 additions & 94 deletions scripts/database_functions.py
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
import os
import sqlite3


def create_db():
# Create a connection to the SQLite database or create a new one if it doesn't exist
conn = sqlite3.connect('C:\\Users\\Hp\\PycharmProjects\\ICEPOS\\other\\ice-answers.db')

# Create a cursor object from the connection to execute SQL commands
cursor = conn.cursor()

# Define the SQL command to create the table with the specified columns
create_table_query = """
CREATE TABLE IF NOT EXISTS answers (
shipper_name TEXT,
shipper_address TEXT,
shipper_contact INTEGER,
shipment_description TEXT,
shipment_destination TEXT,
shipment_service TEXT,
receiver_name TEXT,
receiver_address TEXT,
rec_contact INTEGER,
receiver_zipcode INTEGER,
weight TEXT,
charges TEXT,
no_of_pieces INTEGER,
date DATE,
consign_identifier TEXT PRIMARY KEY
);
"""

# Execute the create table command
cursor.execute(create_table_query)

# Commit the changes and close the connection
conn.commit()
conn.close()

print("SQLite Database and Table Created Successfully.")


def db_to_dict(fields):
# Create a connection to the SQLite database or create a new one if it doesn't exist
conn = sqlite3.connect('C:\\Users\\Hp\\PycharmProjects\\ICEPOS\\other\\ice-answers.db')

# Create a cursor object from the connection to execute SQL commands
cursor = conn.cursor()

# Now the main part
cursor.execute('SELECT * FROM answers')
rows = cursor.fetchall()

ans = {}
for row in rows:
# Create a key using the combination of shipper_name and receiver_name
key = f"{row[0]} - {row[6]}"
ans[key] = {
"date": row[13],
"consign_key": row[14],
"------": "-----",
"shipper_name": row[0],
"shipper_address": row[1],
"shipper_contact": row[2],
"-----": "-----",
"receiver_name": row[6],
"receiver_address": row[7],
"rec_contact": row[8],
"receiver_zipcode": row[9],
"-------": "-----",
"shipment_description": row[3],
"shipment_destination": row[4],
"shipment_service": row[5],
"no_of_pieces": row[12],
"shipment_weight": row[10],
"shipment_charges": row[11]
}
return ans


def delete_db():
import os
# Create a connection to the SQLite database or create a new one if it doesn't exist
conn = sqlite3.connect('../ice-answers.db')

# Create a cursor object from the connection to execute SQL commands
cursor = conn.cursor()

# Now the main part
cursor.execute('DROP TABLE answers')
conn.commit()
conn.close()
os.remove("../ice-answers.db")
print("SQLite Database and Table Deleted Successfully")
import os
import sqlite3


def create_db():
# Create a connection to the SQLite database or create a new one if it doesn't exist
conn = sqlite3.connect('other\\ice-answers.db')

# Create a cursor object from the connection to execute SQL commands
cursor = conn.cursor()

# Define the SQL command to create the table with the specified columns
create_table_query = """
CREATE TABLE IF NOT EXISTS answers (
shipper_name TEXT,
shipper_address TEXT,
shipper_contact INTEGER,
shipment_description TEXT,
shipment_destination TEXT,
shipment_service TEXT,
receiver_name TEXT,
receiver_address TEXT,
rec_contact INTEGER,
receiver_zipcode INTEGER,
weight TEXT,
charges TEXT,
no_of_pieces INTEGER,
date DATE,
consign_identifier TEXT PRIMARY KEY
);
"""

# Execute the create table command
cursor.execute(create_table_query)

# Commit the changes and close the connection
conn.commit()
conn.close()

print("SQLite Database and Table Created Successfully.")


def db_to_dict(fields):
# Create a connection to the SQLite database or create a new one if it doesn't exist
conn = sqlite3.connect('other\\ice-answers.db')

# Create a cursor object from the connection to execute SQL commands
cursor = conn.cursor()

# Now the main part
cursor.execute('SELECT * FROM answers')
rows = cursor.fetchall()

ans = {}
for row in rows:
# Create a key using the combination of shipper_name and receiver_name
key = f"{row[0]} - {row[6]}"
ans[key] = {
"date": row[13],
"consign_key": row[14],
"------": "-----",
"shipper_name": row[0],
"shipper_address": row[1],
"shipper_contact": row[2],
"-----": "-----",
"receiver_name": row[6],
"receiver_address": row[7],
"rec_contact": row[8],
"receiver_zipcode": row[9],
"-------": "-----",
"shipment_description": row[3],
"shipment_destination": row[4],
"shipment_service": row[5],
"no_of_pieces": row[12],
"shipment_weight": row[10],
"shipment_charges": row[11]
}
return ans


def delete_db():
import os
# Create a connection to the SQLite database or create a new one if it doesn't exist
conn = sqlite3.connect('other\\ice-answers.db')

# Create a cursor object from the connection to execute SQL commands
cursor = conn.cursor()

# Now the main part
cursor.execute('DROP TABLE answers')
conn.commit()
conn.close()
os.remove("../ice-answers.db")
print("SQLite Database and Table Deleted Successfully")
Loading

0 comments on commit 6583033

Please sign in to comment.