-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpos_system.py
64 lines (57 loc) · 1.76 KB
/
pos_system.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import time
import datetime
import sqlite3
import controller
import products_controller
import colorama
from controller import color
from controller import clear
from selling_section import selling_section
# Enable Terminal Colorization in the terminal.
colorama.init()
def main():
'''
Default section of POS System where all kinds of features resides in.
This is like the ui for the system for you to interact with.
'''
clear()
print(f"Date: {color.red(datetime.datetime.now())}")
if controller.get_item_list_size() <= 0:
print(color.yellow("There's no item on the list."))
else:
print(color.magenta(controller.get_item_list()))
print("1. Selling Section")
print("2. Search Products")
print("3. Add Products")
print("4. Update Product")
print("5. Delete Product")
print("-----------")
print("6. Logout")
try:
answer = int(input("Option -> "))
if answer == 1:
selling_section()
elif answer == 2:
products_controller.search_products()
elif answer == 3:
products_controller.add_product()
elif answer == 4:
products_controller.update_product()
elif answer == 5:
products_controller.delete_product()
else:
print(controller.error_message("%s is not an option." % answer))
time.sleep(1.5)
main()
except KeyboardInterrupt:
clear()
controller.bye_message()
time.sleep(1.5)
clear()
exit(0)
if __name__ == "__main__":
if controller.create_configuration() == True:
controller.con = sqlite3.connect("./pos.db")
main()
else:
main()