Last active
November 20, 2022 10:48
-
-
Save moussamoussa911/3f718a76e058c6e9ce12257db0da2abc to your computer and use it in GitHub Desktop.
Ordering system
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import os | |
import sqlite3 | |
import subprocess | |
import tempfile | |
import time | |
import tkinter | |
import tkinter.font | |
import tkinter.messagebox as MessageBox | |
from datetime import datetime | |
from threading import Timer | |
from tkinter import * | |
from tkinter import messagebox | |
from tkinter import ttk, Listbox | |
import pymysql | |
import pymysql as mysql | |
import tkintermapview | |
import win32api | |
import win32print | |
import wmi | |
from PIL import Image, ImageTk | |
from keyboard import press | |
from ttkwidgets.autocomplete import AutocompleteEntry | |
root = Tk() | |
root.eval('tk::PlaceWindow . center') | |
################################################ run mianloop############################################################# | |
def main() : | |
root = tfrok.Tk() | |
app = WindowsPath(root) | |
def Exit() : | |
sure = messagebox.askyesno("Exit", "Are you sure you want to exit?", parent=root) | |
if sure : | |
root.destroy() | |
######################################EXIT FUNCTION#################################################################### | |
root.protocol("WM_DELETE_WINDOW", Exit) | |
titlespace = " " | |
window_height = 900 | |
window_width = 1600 | |
screen_width = root.winfo_screenwidth() | |
screen_height = root.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
root.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
root.title(210 * titlespace + "M2 Bestellsystem") | |
root['bg'] = 'black' | |
root.resizable(False, False) | |
################################################Bilder################################################################## | |
try : | |
imag1 = Image.open('HauptBild.jpg') | |
imag1.save('1233.png') | |
imag2 = imag1.resize((1800, 1200)) | |
imag2.save('HauptBild.png') | |
if open('1233.png') : | |
os.remove('1233.png') | |
logo = tkinter.PhotoImage(file='HauptBild.png') | |
w = tkinter.Label(root, image=logo) | |
w.pack() | |
except : | |
messagebox.showinfo('HauptBild', 'Bild hinzufügen als (HauptBild)(jpg)') | |
global counter | |
global font_size | |
counter = 1 | |
################################################# Show Passwort ######################################################## | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Passwort ') | |
Passwort = cur.fetchall() | |
Passwort1 = str(Passwort) | |
Passwort2 = Passwort1.replace("(", "").replace(")", "").replace(",", "").replace("'", "").replace("[", "").replace("]", | |
"") | |
conn.commit() | |
def makevisible() : | |
Passwort23 = Label(root, text=MessageBox.showinfo('Aktueles Passwort', Passwort2), font=('Helvetica bold', 12), | |
width=5) | |
Passwort23.pack | |
return | |
btnpass = Button(root, font=('Helvetica bold', 10), bg='black', command=makevisible, bd=0) | |
btnpass.place(x=0, y=1) | |
###########################################erste seite################################################################## | |
# define login function | |
def login() : | |
style = ttk.Style(root) | |
global username_login_entry, password_login_entry, login_screen | |
login_screen = Toplevel(root) | |
login_screen.title("Login") | |
login_screen.geometry("300x250") | |
login_screen.config(bg='#344E5C') | |
window_height = 250 | |
window_width = 300 | |
screen_width = login_screen.winfo_screenwidth() | |
screen_height = login_screen.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
login_screen.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
Label(login_screen, text="Name und Passwort eingeben", bg='#344E5C', font=('Helvetica bold', 14)).pack() | |
Label(login_screen, text="", bg='#344E5C').pack() | |
global username_verify | |
global password_verify | |
username_verify = StringVar() | |
password_verify = StringVar() | |
Label(login_screen, text="Username ", bg='#344E5C', font=('Helvetica bold', 12)).pack() | |
username_login_entry = Entry(login_screen, textvariable=username_verify) | |
username_login_entry.pack() | |
Label(login_screen, text="", bg='#344E5C').pack() | |
Label(login_screen, text="Password * ", bg='#344E5C', font=('Helvetica bold', 12)).pack() | |
password_login_entry = Entry(login_screen, textvariable=password_verify, show='*') | |
password_login_entry.pack() | |
Label(login_screen, text="", bg='#344E5C').pack() | |
Button(login_screen, text="Login", width=10, height=1, command=login_verify, bg='#4AB19D', | |
font=('Helvetica bold', 13)).pack() | |
login_screen.bind('<Return>', login_verify) | |
def login_verify(e=NONE) : | |
global username_login_entry, password_login_entry, login_screen, blob, passo | |
username1 = username_verify.get() | |
password1 = password_verify.get() | |
username_login_entry.delete(0, END) | |
password_login_entry.delete(0, END) | |
conn = sqlite3.connect('Einstellung.db') | |
cus = conn.cursor() | |
cus.execute('select* from Username where Name =(?)', (username1,)) | |
blob = cus.fetchall() | |
for passo in blob : | |
if passo[2] != password1 : | |
messagebox.showerror('Passwort', 'falsches passwort') | |
elif username1 != passo[1] : | |
messagebox.showerror('username', 'username exestiert nicht ') | |
else : | |
login_screen.destroy() | |
bestellung() | |
login_screen.bind('<Return>', login_verify) | |
def bestellung() : | |
global counter | |
try : | |
subprocess.call(['C:\jAnrufmonitor\jam.exe']) | |
except : | |
messagebox.showinfo('jAnrufmonitor', 'jAnrufmonitor konnte nicht gestartet werden') | |
if counter < 3 : | |
new_window2 = Toplevel(root) | |
root.wm_state('iconic') | |
# new_window2.state(newstate=None) | |
new_window2.config(bd=2) | |
global font_size | |
font_size = ("ARIEL", 12, "bold") | |
new_window2.focus_set() | |
counter += 2 | |
titlespace = " " | |
new_window2.overrideredirect(True) | |
screen_width = new_window2.winfo_screenwidth() | |
screen_height = new_window2.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window2.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
new_window2.config(bg='dark slate gray') | |
new_window2.resizable(width=False, height=False) | |
FIRSTLABEL = Label(new_window2, text='auf Lieferung oder Abholung drücken', font=("ARIEL", 26, "bold"), | |
bg='dark slate gray') | |
FIRSTLABEL.place(x=700, y=400) | |
Mainframe1 = Frame(new_window2, bd=4, width=400, height=760, relief=RIDGE, bg='dark slate gray') | |
Mainframe1.grid() | |
Mainframe2 = Frame(new_window2, bd=4, width=1250, height=350, relief=RIDGE, bg='dark slate gray') | |
Mainframe2.grid(row=0, column=2, sticky='n') | |
Mainframe3 = Frame(new_window2, bd=4, width=1400, height=1000, relief=RIDGE, bg='white') | |
Mainframe3.place(x=400, y=350) | |
Mainframe4 = Frame(Mainframe2, bd=5, height=85, width=190, relief=RIDGE, bg='dark slate gray') | |
Mainframe4.place(x=252, y=115) | |
Mainframe5 = Frame(Mainframe2, bd=5, height=85, width=190, relief=RIDGE, bg='dark slate gray') | |
Mainframe5.place(x=252, y=235) | |
Mainframe6 = Frame(Mainframe2, bd=5, height=55, width=1160, relief=RIDGE, bg='dark slate gray') | |
Mainframe6.place(x=3, y=5) | |
Mainframe7 = Frame(Mainframe2, bd=5, height=220, width=200, relief=RIDGE, bg='dark slate gray') | |
Mainframe7.place(x=960, y=75) | |
Mainframe10 = Frame(Mainframe2, bd=5, height=65, width=176, relief=RIDGE, bg='dark slate gray') | |
Mainframe10.place(x=640, y=240) | |
Mainframe9 = Frame(Mainframe1, bd=5, height=220, width=390, relief=RIDGE, bg='dark slate gray') | |
Mainframe9.place(x=0, y=500) | |
Mainframe11 = Frame(Mainframe2, bd=5, height=40, width=176, relief=RIDGE, bg='dark slate gray') | |
Mainframe11.place(x=640, y=298) | |
Mainframe12 = Frame(new_window2, bd=5, height=120, width=398, relief=RIDGE, bg='dark slate gray') | |
Mainframe12.place(x=0, y=770) | |
# table_lable = Button(Mainframe9 ,text='Bestellungs per Stunde',bg='dark slate gray',command=showme) | |
# table_lable.place(x=0,y=100) | |
# ------------------------------------------- seite schliessen-------------------------------------------------# | |
def close() : | |
global counter | |
siko = messagebox.askyesno('Schliessen', 'Sind sie sicher') | |
if siko == 1 : | |
new_window2.destroy() | |
counter -= 2 | |
else : | |
pass | |
closebutton = Button(new_window2, text='X', bd=2, bg='red', command=close) | |
closebutton.place(x=1580, y=5) | |
######################################speisen Labels and boxes########################################################## | |
sqlCon = sqlite3.connect('speisekarte1.db') | |
cur = sqlCon.cursor() | |
kl_gr = ['Klein', 'Gross', 'Standard'] | |
global clicked | |
clicked = StringVar() | |
clicked.set('klein') | |
Numbers = StringVar() | |
global drop | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Gross ') | |
grosse = str(cur.fetchall()) | |
replace = {'[' : '', | |
']' : '', | |
'(' : '', | |
')' : '', | |
',' : ''} | |
grosse = grosse.translate(str.maketrans(replace)) | |
grosse1 = float(grosse) | |
conn.commit() | |
def gross_pizza(event=None) : | |
gorss = clicked.get() | |
if gorss == 'Gross' : | |
sacko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(0, float(sacko) + float(grosse1)) | |
else : | |
pass | |
drop = OptionMenu(Mainframe2, clicked, *kl_gr, command=gross_pizza) | |
drop.configure(font=('Helvetica bold', 12), bg="white", bd=4, width=6) | |
drop.place(x=255, y=70) | |
#############################################################Nummer einfugen####################################### | |
def resetall() : | |
entrybox4.delete(0, END) | |
entrybox4.insert(0, '1') | |
entrybox2.delete(0, END) | |
entrybox1.delete(0, END) | |
listbox3.delete(0, END) | |
listbox2.delete(0, END) | |
entrybox3.delete(0, END) | |
entrybox5.delete(0, END) | |
entrybox6.delete(0, END) | |
entrybox7.delete(0, END) | |
entrybox7.insert(0, float(0.0)) | |
entrybox8.delete(0, END) | |
entrybox8.insert(0, float(0.0)) | |
entrybox9.delete(0, END) | |
entrybox9.insert(0, float(0.0)) | |
entrybox10.delete(0, END) | |
entrybox10.insert(0, float(0.0)) | |
clicked.set('klein') | |
entrybox12.delete(0, END) | |
drop.configure(font=('Helvetica bold', 12), bg="white", bd=4, width=5) | |
liso.clear() | |
global Reset | |
Reset = Button(Mainframe2, text="Reset", bg='red', bd=2, command=resetall, height=3, width=7) | |
Reset.place(x=880, y=70) | |
def update() : | |
Uhr.config(text="new text") | |
def uhr() : | |
stunde = time.strftime("%H") | |
minute = time.strftime("%M") | |
seconde = time.strftime("%S") | |
utc = ' Uhr' | |
tag = time.strftime("%d") | |
monat = time.strftime("%m") | |
jahr = time.strftime("%y") | |
name = time.strftime("%a") | |
Uhr.config(text=stunde + ':' + minute + ':' + seconde + utc) | |
Datum.config(text=name + '.' + tag + '/' + monat + '/' + jahr) | |
Uhr.after(100, uhr) | |
##########################################Bestellung /Labels and Buttons############################################### | |
Label1 = Label(Mainframe6, text='Speise ', font=("Helvetica", 18, 'bold'), fg="black", bg="dark slate gray", | |
bd=8) | |
Label1.place(x=10, y=0) | |
# Label2 = Label(Mainframe6, text='Kl/Gr ', font=("Helvetica", 18, 'bold'), fg="black", bg="dark slate gray", bd=8) | |
# Label2.place(x=270, y=0) | |
Label3 = Label(Mainframe6, text='Mit Zutaten ', font=("Helvetica", 18, 'bold'), fg="black", | |
bg="dark slate gray", bd=8) | |
Label3.place(x=450, y=0) | |
Label4 = Label(Mainframe6, text='Anzahl ', font=("Helvetica", 18, 'bold'), fg="black", bg="dark slate gray", | |
bd=8) | |
Label4.place(x=325, y=0) | |
Label6 = Label(Mainframe6, text='Nr: ', font=("Helvetica", 18, 'bold'), fg="black", bg="dark slate gray", | |
bd=8) | |
Label6.place(x=185, y=0) | |
Label7 = Label(Mainframe4, text='Kategorie:', font=("Helvetica", 12, 'bold'), fg='black', bg="dark slate gray", | |
bd=4) | |
Label7.place(x=0, y=0) | |
Label8 = Label(Mainframe4, text='Preis:', font=("Helvetica", 12, 'bold'), fg='black', bg="dark slate gray", | |
bd=4) | |
Label8.place(x=0, y=40) | |
Label9 = Label(Mainframe4, text='€', font=("Helvetica", 12, 'bold'), fg='black', bg="dark slate gray", | |
bd=2) | |
Label9.place(x=150, y=40) | |
Label10 = Label(Mainframe6, text='Gesamt Preise', font=("Helvetica", 18, 'bold'), fg='black', | |
bg="dark slate gray", bd=8) | |
Label10.place(x=950, y=0) | |
Label11 = Label(Mainframe7, text='Brutto: ' | |
'€', font=("Helvetica", 12, 'bold'), fg='black', bg="dark slate gray", | |
bd=2) | |
Label11.place(x=5, y=5) | |
Label12 = Label(Mainframe7, text='Zuschlag: ' | |
'€', font=("Helvetica", 12, 'bold'), fg='black', | |
bg="dark slate gray", | |
bd=2) | |
Label12.place(x=5, y=45) | |
Label13 = Label(Mainframe7, text='Gutschrift: ' | |
'€', font=("Helvetica", 12, 'bold'), fg='black', | |
bg="dark slate gray", | |
bd=2) | |
Label13.place(x=5, y=85) | |
Label14 = Label(Mainframe7, text='Rabatt: ' | |
'% ', font=("Helvetica", 12, 'bold'), fg='black', | |
bg="dark slate gray", | |
bd=2) | |
Label14.place(x=5, y=125) | |
Label15 = Label(Mainframe7, text='Endpreis: ' | |
'€', font=("Helvetica", 12, 'bold'), fg='black', | |
bg="dark slate gray", | |
bd=2) | |
Label15.place(x=5, y=165) | |
Label16 = Label(Mainframe6, text='Ohne ', font=("Helvetica", 18, 'bold'), fg="black", | |
bg="dark slate gray", bd=8) | |
Label16.place(x=680, y=0) | |
Label17 = Label(Mainframe12, text='Bediener: ', font=("Helvetica", 12, 'bold'), fg="black", | |
bg="dark slate gray", bd=8) | |
Label17.place(x=0, y=0) | |
Label18 = Label(Mainframe12, text='ID nummer: ', font=("Helvetica", 12, 'bold'), fg="black", | |
bg="dark slate gray", bd=8) | |
Label18.place(x=0, y=32) | |
Label19 = Label(Mainframe12, text=passo[0], font=("Helvetica", 12, 'bold'), fg="dark slate gray", | |
bg="Black", bd=0) | |
Label19.place(x=100, y=40) | |
Label20 = Label(Mainframe12, text=passo[1], font=("Helvetica", 12, 'bold'), fg="dark slate gray", | |
bg="black", bd=0) | |
Label20.place(x=90, y=6) | |
Label21 = Label(Mainframe2, text='Kommentar ', font=("Helvetica", 14, 'bold'), fg="black", | |
bg="dark slate gray", bd=8) | |
Label21.place(x=459, y=260) | |
# -----------------------------------------------------------------------------------------------------------------# | |
entrybox1 = Entry(Mainframe2, font=("Helvetica", 12, 'bold'), width=22, bd=5) | |
entrybox1.place(x=10, y=70) | |
entrybox3 = Entry(Mainframe2, font=("Helvetica", 12, 'bold'), width=4, bd=5) | |
entrybox3.place(x=200, y=70) | |
entrybox3.configure(font=font_size) | |
entrybox4 = Entry(Mainframe2, font=("Helvetica", 12, 'bold'), width=4, bd=5, textvariable=Numbers) | |
entrybox4.place(x=360, y=70) | |
entrybox4.configure(font=font_size) | |
entrybox4.insert(0, "1") | |
entrybox5 = Entry(Mainframe4, font=("Helvetica", 12, 'bold'), width=9, bd=3, state=NORMAL) | |
entrybox5.place(x=85, y=5) | |
entrybox6 = Entry(Mainframe4, font=("Helvetica", 12, 'bold'), width=6, bd=3, ) | |
entrybox6.place(x=85, y=40) | |
entrybox7 = Entry(Mainframe7, font=("Helvetica", 12, 'bold'), width=6, bd=3, ) | |
entrybox7.place(x=95, y=5) | |
entrybox7.insert(0, float(0.0)) | |
entrybox8 = Entry(Mainframe7, font=("Helvetica", 12, 'bold'), width=6, bd=3, ) | |
entrybox8.place(x=95, y=45) | |
entrybox8.insert(0, float(0.0)) | |
entrybox9 = Entry(Mainframe7, font=("Helvetica", 12, 'bold'), width=6, bd=3, ) | |
entrybox9.place(x=95, y=85) | |
entrybox9.insert(0, float(0.0)) | |
entrybox10 = Entry(Mainframe7, font=("Helvetica", 12, 'bold'), width=6, bd=3, ) | |
entrybox10.place(x=95, y=125) | |
entrybox10.insert(0, float(0.0)) | |
entrybox11 = Entry(Mainframe7, font=("Helvetica", 12, 'bold'), width=6, bd=3, ) | |
entrybox11.place(x=95, y=165) | |
entrybox11.insert(0, float(0.0)) | |
entrybox12 = Entry(Mainframe2, font=("Helvetica", 12, 'bold'), width=18, bd=5, ) | |
entrybox12.place(x=450, y=297) | |
# ----------------------------------------------------------------------------------------------------------------# | |
listbox1 = Listbox(Mainframe2, width=25, bd=5) | |
listbox1.place(x=10, y=115) | |
listbox1.configure(font=font_size) | |
listbox2 = Listbox(Mainframe2, width=18, bd=5, height=6) | |
listbox2.place(x=450, y=115) | |
listbox2.configure(font=font_size) | |
listbox3 = Listbox(Mainframe2, width=18, bd=5, fg='red', height=8) | |
listbox3.place(x=640, y=70) | |
listbox3.configure(font=font_size) | |
# -----------------------------------------------------------------------------------------------------------------# | |
########################################################speisen liste################################################### | |
# ------------------------------------------------------Alle Straßen----------------------------------------------------# | |
with open('streets.txt', 'r', encoding='utf-8') as street : | |
Straßen = [] | |
for stre in street : | |
if not stre.isspace() : | |
streline = stre.strip() | |
Straßen.append(str(streline)) | |
# -------------------------------------------------------Enterys--------------------------------------------------------# | |
KundenidE = Entry(Mainframe1, width=6, bd=5, bg='white smoke') | |
KundenidE.place(x=0, y=28) | |
KundenidE.configure(font=font_size) | |
NameE = Entry(Mainframe1, bd=5, width=25, bg='white smoke') | |
NameE.place(x=0, y=94) | |
NameE.configure(font=font_size) | |
AdresseE = AutocompleteEntry(Mainframe1, width=30, completevalues=Straßen, font=("Helvetica", 12, 'bold')) | |
AdresseE.place(x=0, y=162) | |
HauesnrE = Entry(Mainframe1, bd=1, width=4, bg='white smoke') | |
HauesnrE.place(x=300, y=162) | |
HauesnrE.configure(font=font_size) | |
PLZE = Entry(Mainframe1, bd=5, width=7, bg='white smoke') | |
PLZE.place(x=0, y=230) | |
PLZE.configure(font=font_size) | |
ORTE = Entry(Mainframe1, bd=5, width=15, bg='white smoke') | |
ORTE.place(x=170, y=230) | |
ORTE.configure(font=font_size) | |
TelefonnummerE = Entry(Mainframe1, bd=5, width=20, bg='white smoke') | |
TelefonnummerE.place(x=160, y=28) | |
TelefonnummerE.configure(font=font_size) | |
EmailE = Entry(Mainframe1, bd=5, width=30, bg='white smoke') | |
EmailE.place(x=0, y=300) | |
EmailE.configure(font=font_size) | |
LieferE = Entry(Mainframe11, bd=5, width=5, bg='white smoke') | |
LieferE.place(x=106, y=0) | |
LieferE.configure(font=font_size) | |
in_comment = Text(Mainframe9, width=40, height=1, bd=5) | |
in_comment.place(x=0, y=30) | |
in_comment.configure(font=('14')) | |
ext_comment = Text(Mainframe9, width=40, height=1, bd=5) | |
ext_comment.place(x=0, y=89) | |
ext_comment.configure(font=('14')) | |
Note_text = Text(Mainframe2, width=14, height=3, bd=5) | |
Note_text.place(x=258, y=246) | |
Note_text.configure(font=('14'), fg='red') | |
with open('Note.txt', 'r') as file14 : | |
for e in file14 : | |
e.strip() | |
note_label = Label(Note_text, text=e, width=16, height=3, bg='white', fg='black', wraplengt=120, | |
font=("Helvetica", 12, 'bold')) | |
note_label.pack(side=TOP) | |
##################################Kunden Liste / Labels############################################################# | |
Kundenid = Label(Mainframe1, bd=0, text='Kunden/ID', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=0) | |
Name = Label(Mainframe1, bd=0, text='Name:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=65) | |
Adresse = Label(Mainframe1, bd=0, text='Straße:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=130) | |
Hausnr = Label(Mainframe1, bd=0, text='Nr:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=300, y=130) | |
PLZ = Label(Mainframe1, bd=0, text='PLZ:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=200) | |
Ort = Label(Mainframe1, bd=0, text='ORT:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=165, y=200) | |
Telefonnummer = Label(Mainframe1, bd=0, text='Telefonnummer:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=155, y=0) | |
Email = Label(Mainframe1, bd=0, text='Email:', font=('arial', 14, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=267) | |
comment_in = Label(Mainframe9, bd=0, text='intern-Info:', font=('arial', 16, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=1) | |
comment_ex = Label(Mainframe9, bd=0, text='extern-Info:(wird gedruckt)', font=('arial', 16, 'bold'), | |
bg='dark slate gray') \ | |
.place(x=0, y=60) | |
Note = Label(Mainframe2, bd=0, text='Note von Chef', font=('arial', 16, 'bold'), | |
bg='dark slate gray') \ | |
.place(x=270, y=220) | |
Uhr = Label(Mainframe10, bd=0, text='', font=('arial', 12, 'bold'), fg='black', | |
bg='dark slate gray') | |
Uhr.place(x=65, y=0) | |
Datum = Label(Mainframe10, bd=0, text='', font=('arial', 12, 'bold'), fg='black', | |
bg='dark slate gray') | |
Datum.place(x=65, y=27) | |
TelefonnummerE.focus_force() | |
# --------------------------------------------------------UHR-----------------------------------------------------------# | |
imagen = Image.open('clockpng.jpg') | |
imagser = imagen.resize((45, 45)) | |
imagser.save('clock.jpg') | |
clock = ImageTk.PhotoImage(Image.open('clock.jpg')) | |
def opencalen() : | |
os.system( | |
'start explorer shell:appsfolder\microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.calendar') | |
labelclock = Button(Mainframe10, image=clock, bg='dark slate gray', command=opencalen) | |
labelclock.place(x=5, y=1) | |
Bestell = Label(Mainframe11, bd=0, text='Lieferzeit:', font=('arial', 16, 'bold'), bg='dark slate gray') \ | |
.place(x=0, y=0) | |
uhr() | |
# -------------------------------------------------------Karte----------------------------------------------------------# | |
def maps() : | |
hob = str(AdresseE.get()) | |
nop = str(HauesnrE.get()) | |
zob = str(hob + ' ' + nop) | |
mapes = Toplevel(root) | |
root.wm_state('iconic') | |
mapes.state(newstate=None) | |
mapes.config(bd=2) | |
mapes.focus_set() | |
map = tkintermapview.TkinterMapView(mapes, width=400, height=250) | |
map.set_zoom(15) | |
map.set_tile_server("https://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga", max_zoom=22) | |
window_height = 200 | |
window_width = 260 | |
screen_width = mapes.winfo_screenwidth() | |
screen_height = mapes.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
ad2 = map.set_address(zob + ',' + '48607, Ochtrup', marker=True) | |
map.pack() | |
but = Button(Mainframe1, bg='blue', width=6, text='Karte', command=maps, ).place(x=80, y=130) | |
###############################SQL TO TEXT'######################################################################## | |
con = sqlite3.connect('speisekarte1.db', isolation_level=None) | |
custor = con.cursor() | |
custor.fetchall() | |
custor.execute('select Name from Speisen') | |
file = open('speisentabel.txt', 'w') | |
for sack in custor : | |
sacko = "'".join(sack) | |
file.write(str(sacko) + '\n') | |
file.close() | |
with open('speisentabel.txt', 'r') as file1 : | |
toppings = [] | |
for line in file1 : | |
if line != '' : | |
stripped_line = line.strip() | |
toppings.append(stripped_line) | |
######################################################################################################################## | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
cur.execute("select Zutat from zutatenpreise ") | |
maro = cur.fetchall() | |
with open("zutatenpreise.txt", 'w') as file2 : | |
for zuz in maro : | |
ziko = ",".join(zuz) | |
file2.write(str(ziko) + '\n') | |
zutatenpreise = [] | |
with open('zutatenpreise.txt', 'r') as file3 : | |
for zaro in file3 : | |
zutatenpreise.append(str(zaro) + '\n') | |
conn.commit() | |
####################################################################################################################### | |
# had to be moved here becouse of the AutocompleteEntry | |
global entrybox2 | |
entrybox2 = AutocompleteEntry(Mainframe2, font=("Helvetica", 12, 'bold'), width=18, | |
completevalues=zutatenpreise) | |
entrybox2.place(x=450, y=70) | |
entrybox2.configure(font=font_size) | |
def komment() : | |
siko = entrybox12.get() | |
listbox2.insert(0, '*' + siko) | |
entrybox12.delete(0, END) | |
kommb = Button(Mainframe2, text='ADD', bg='green', height=0, command=komment) | |
kommb.place(x=590, y=270) | |
################################################Familien Pizza Functions############################################### | |
def Familie_window() : | |
global Counter | |
global Familienpizza | |
Familienpizza = Toplevel(root) | |
root.wm_state('iconic') | |
Familienpizza.state(newstate=None) | |
Familienpizza.config(bd=2) | |
global font_size | |
font_size = ("ARIEL", 12, "bold") | |
Familienpizza.focus_set() | |
titlespace = " " | |
window_height = 200 | |
window_width = 260 | |
screen_width = Familienpizza.winfo_screenwidth() | |
screen_height = Familienpizza.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
Familienpizza.geometry( | |
"{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
Familienpizza.config(bg='dark slate gray') | |
Familienpizza.resizable(width=False, height=False) | |
voll = Button(Familienpizza, text='100%', bd=4, bg='white', width=10, command=Familiewindow1) | |
voll.place(x=15, y=20) | |
halb = Button(Familienpizza, text='2/Halb', bd=4, bg='white', width=10, command=Familiewindow2) | |
halb.place(x=160, y=20) | |
drei = Button(Familienpizza, text='3/Drittel', bd=4, bg='white', width=10, command=Familiewindow3) | |
drei.place(x=15, y=120) | |
vier = Button(Familienpizza, text='4/Viertel', bd=4, bg='white', width=10, command=Familiewindow4) | |
vier.place(x=160, y=120) | |
###############################################Familinepizza Voll####################################################### | |
def Familiewindow1() : | |
global Familiewindow1 | |
Familienpizza.destroy() | |
global Familienpizzavoll | |
Familienpizzavoll = Toplevel(root) | |
root.wm_state('iconic') | |
Familienpizzavoll.state(newstate=None) | |
Familienpizzavoll.config(bd=2) | |
Familienpizzavoll.focus_set() | |
titlespace = " " | |
window_height = 290 | |
window_width = 260 | |
screen_width = Familienpizzavoll.winfo_screenwidth() | |
screen_height = Familienpizzavoll.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
Familienpizzavoll.geometry( | |
"{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
Familienpizzavoll.config(bg='dark slate gray') | |
Familienpizzavoll.resizable(width=False, height=False) | |
# ---------------------------------------------------------------------------------------------------------# | |
def addzutatvoll() : | |
sado = str(entrybox2.get()) | |
sado1 = sado.strip() | |
listboxvoll.insert(END, sado1) | |
entrybox2.delete(0, END) | |
# ----------------------------------------------------------------------------------------------------------# | |
def fertig() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from einstellung where Name = ?', ('FamilienPizza',)) | |
nado = cur.fetchall() | |
Frei = '' | |
Preis = '' | |
for t in nado : | |
Frei = str(t[1]) | |
Preis = str(t[2]) | |
conn.commit() | |
sicko = str(listboxvoll.get(0, END)) | |
saro = sicko.strip() | |
selko = saro.replace('(', '').replace(')', '').replace(',', '').replace("'", "") | |
listbox2.insert(END, '+100% ' + str(selko)) | |
sado1 = sicko | |
soso = [] | |
for nano in sado1 : | |
soso.append(nano) | |
loko = [] | |
for t in soso : | |
loko.append(t) | |
naldo = len(loko[int(Frei[0]) :]) | |
siko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, siko + float(naldo * float(Preis[0]))) | |
Familienpizzavoll.destroy() | |
# ----------------------------------------------------------------------------------------------------------# | |
entrybox2 = AutocompleteEntry(Familienpizzavoll, font=("Helvetica", 12, 'bold'), width=18, | |
completevalues=zutatenpreise) | |
entrybox2.place(x=30, y=20) | |
einfbutton = Button(Familienpizzavoll, text='einfugen', width=6, bg='green', command=addzutatvoll) | |
einfbutton.place(x=180, y=20) | |
listboxvoll = Listbox(Familienpizzavoll, width=25, bd=5) | |
listboxvoll.place(x=30, y=60) | |
Fertigbutton = Button(Familienpizzavoll, text='fertig', width=10, bg='grey', command=fertig) | |
Fertigbutton.place(x=180, y=260) | |
###############################################Familinepizza Halb ####################################################### | |
def Familiewindow3() : | |
global Familiewindow3 | |
Familienpizza.destroy() | |
global Familienpizzadrei | |
Familienpizzadrei = Toplevel(root) | |
root.wm_state('iconic') | |
Familienpizzadrei.state(newstate=None) | |
Familienpizzadrei.config(bd=2) | |
Familienpizzadrei.focus_set() | |
titlespace = " " | |
window_height = 550 | |
window_width = 400 | |
screen_width = Familienpizzadrei.winfo_screenwidth() | |
screen_height = Familienpizzadrei.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
Familienpizzadrei.geometry( | |
"{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
Familienpizzadrei.config(bg='dark slate gray') | |
Familienpizzadrei.resizable(width=False, height=False) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatdrei() : | |
sado = str(entryboxdrei.get()) | |
sado1 = sado.strip() | |
listboxdrei.insert(END, sado1) | |
entryboxdrei.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatdrei1() : | |
sado = str(entryboxdrei1.get()) | |
sado1 = sado.strip() | |
listboxdrei1.insert(END, sado1) | |
entryboxdrei1.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatdrei2() : | |
sado = str(entryboxdrei2.get()) | |
sado1 = sado.strip() | |
listboxdrei2.insert(END, sado1) | |
entryboxdrei2.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def fertigdrei() : | |
sicko = listboxdrei.get(0, END) | |
sicko1 = ','.join(sicko) | |
soko = listboxdrei1.get(0, END) | |
soko1 = ','.join(soko) | |
soka = listboxdrei2.get(0, END) | |
soka1 = ','.join(soko) | |
listbox2.insert(END, '+ 33% ' + str(sicko1)) | |
listbox2.insert(END, '+ 33% ' + str(soko1)) | |
listbox2.insert(END, '+ 33% ' + str(soka1)) | |
sado1 = sicko + soko + soka | |
soso = [] | |
for nano in sado1 : | |
if nano not in soso : | |
soso.append(nano) | |
loko = [] | |
for t in soso : | |
loko.append(t) | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from einstellung where Name = ?', ('FamilienPizza',)) | |
nado = cur.fetchall() | |
Frei = '' | |
Preis = '' | |
for t in nado : | |
Frei = str(t[1]) | |
Preis = t[2] | |
naldo = len(loko[int(Frei[0]) :]) | |
siko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, siko + float(naldo * Preis)) | |
Familienpizzadrei.destroy() | |
# ------------------------------------------------------------------------------------------------------------------# | |
entryboxdrei = AutocompleteEntry(Familienpizzadrei, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxdrei.place(x=30, y=20) | |
entryboxdrei1 = AutocompleteEntry(Familienpizzadrei, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxdrei1.place(x=220, y=20) | |
entryboxdrei2 = AutocompleteEntry(Familienpizzadrei, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxdrei2.place(x=120, y=280) | |
einfbutton = Button(Familienpizzadrei, text='einfugen', width=6, bg='green', command=addzutatdrei) | |
einfbutton.place(x=140, y=20) | |
einfbutton1 = Button(Familienpizzadrei, text='einfugen', width=6, bg='green', command=addzutatdrei1) | |
einfbutton1.place(x=325, y=20) | |
einfbutton2 = Button(Familienpizzadrei, text='einfugen', width=6, bg='green', command=addzutatdrei2) | |
einfbutton2.place(x=230, y=280) | |
listboxdrei = Listbox(Familienpizzadrei, width=20, bd=5) | |
listboxdrei.place(x=30, y=60) | |
listboxdrei1 = Listbox(Familienpizzadrei, width=20, bd=5) | |
listboxdrei1.place(x=220, y=60) | |
listboxdrei2 = Listbox(Familienpizzadrei, width=20, bd=5) | |
listboxdrei2.place(x=120, y=320) | |
Fertigbutton = Button(Familienpizzadrei, text='fertig', width=10, bg='grey', command=fertigdrei) | |
Fertigbutton.place(x=320, y=500) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def Familiewindow2() : | |
global Familiewindow2 | |
Familienpizza.destroy() | |
global Familienpizzahalb | |
Familienpizzahalb = Toplevel(root) | |
root.wm_state('iconic') | |
Familienpizzahalb.state(newstate=None) | |
Familienpizzahalb.config(bd=2) | |
Familienpizzahalb.focus_set() | |
titlespace = " " | |
window_height = 290 | |
window_width = 400 | |
screen_width = Familienpizzahalb.winfo_screenwidth() | |
screen_height = Familienpizzahalb.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
Familienpizzahalb.geometry( | |
"{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
Familienpizzahalb.config(bg='dark slate gray') | |
Familienpizzahalb.resizable(width=False, height=False) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutathalb() : | |
sado = str(entryboxhalb.get()) | |
sado1 = sado.strip().replace(' ', '') | |
listboxhalb.insert(END, sado1) | |
entryboxhalb.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutathalb1() : | |
sado = str(entryboxhalb1.get()) | |
sado1 = sado.strip().replace(' ', '') | |
listboxhalb1.insert(END, sado1) | |
entryboxhalb1.delete(0, END) | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def fertighalb(event=None) : | |
sicko = (listboxhalb.get(0, END)) | |
soko = (listboxhalb1.get(0, END)) | |
listbox2.insert(END, | |
'+50%' + str(sicko).replace('(', '').replace(')', '').replace("'", "").replace(',', | |
'').replace( | |
' ', '')) | |
listbox2.insert(END, | |
'+50%' + str(soko).replace('(', '').replace(')', '').replace("'", "").replace(',', | |
'').replace( | |
' ', '')) | |
sado1 = sicko + soko | |
soso = [] | |
for nano in sado1 : | |
if nano not in soso : | |
soso.append(nano) | |
loko = [] | |
for t in soso : | |
loko.append(t) | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from einstellung where Name = ?', ('FamilienPizza',)) | |
nado = cur.fetchall() | |
Frei = '' | |
Preis = '' | |
for t in nado : | |
Frei = str(t[1]) | |
Preis = t[2] | |
naldo = len(loko[int(Frei[0]) :]) | |
siko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, siko + float(naldo * Preis)) | |
entryboxhalb1.delete(0, END) | |
Familienpizzahalb.destroy() | |
# ----------------------------------------------------------------------------------------------------------------------# | |
entryboxhalb = AutocompleteEntry(Familienpizzahalb, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxhalb.place(x=30, y=20) | |
einfbutton = Button(Familienpizzahalb, text='einfugen', width=6, bg='green', | |
command=addzutathalb) | |
einfbutton.place(x=140, y=20) | |
listboxhalb = Listbox(Familienpizzahalb, width=20, bd=5) | |
listboxhalb.place(x=30, y=60) | |
Fertigbutton = Button(Familienpizzahalb, text='fertig', width=10, bg='grey', command=fertighalb) | |
Fertigbutton.place(x=325, y=260) | |
entryboxhalb1 = AutocompleteEntry(Familienpizzahalb, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxhalb1.place(x=220, y=20) | |
listboxhalb1 = Listbox(Familienpizzahalb, width=20, bd=5) | |
listboxhalb1.place(x=220, y=60) | |
einfbutton1 = Button(Familienpizzahalb, text='einfugen', width=6, bg='green', | |
command=addzutathalb1) | |
einfbutton1.place(x=325, y=20) | |
#####################################FamilienPizza vier########################################################### | |
def Familiewindow4() : | |
global Familiewindow4 | |
Familienpizza.destroy() | |
global Familienpizzavier | |
Familienpizzavier = Toplevel(root) | |
root.wm_state('iconic') | |
Familienpizzavier.state(newstate=None) | |
Familienpizzavier.config(bd=2) | |
Familienpizzavier.focus_set() | |
titlespace = " " | |
window_height = 550 | |
window_width = 400 | |
screen_width = Familienpizzavier.winfo_screenwidth() | |
screen_height = Familienpizzavier.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
Familienpizzavier.geometry( | |
"{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
Familienpizzavier.config(bg='dark slate gray') | |
Familienpizzavier.resizable(width=False, height=False) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatvier() : | |
sado = str(entryboxvier.get()) | |
sado1 = sado.strip() | |
listboxvier.insert(END, sado1) | |
entryboxvier.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatvier1() : | |
sado = str(entryboxvier1.get()) | |
sado1 = sado.strip() | |
listboxvier1.insert(END, sado1) | |
entryboxvier1.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatvier3() : | |
sado = str(entryboxvier2.get()) | |
sado1 = sado.strip() | |
listboxvier2.insert(END, sado1) | |
entryboxvier2.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def addzutatvier4() : | |
sado = str(entryboxvier3.get()) | |
sado1 = sado.strip() | |
listboxvier3.insert(END, sado1) | |
entryboxvier3.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def fertigvier() : | |
sicko = listboxvier.get(0, END) | |
sicko1 = ','.join(sicko) | |
soko = listboxvier1.get(0, END) | |
soko1 = ','.join(soko) | |
soka = listboxvier2.get(0, END) | |
soka1 = ','.join(soko) | |
saka = listboxvier3.get(0, END) | |
saka1 = ','.join(soko) | |
listbox2.insert(END, '+ 25% ' + str(sicko1)) | |
listbox2.insert(END, '+ 25% ' + str(soko1)) | |
listbox2.insert(END, '+ 25% ' + str(soka1)) | |
listbox2.insert(END, '+ 25% ' + str(saka1)) | |
sado1 = sicko + soko + soka + saka | |
soso = [] | |
for nano in sado1 : | |
if nano not in soso : | |
soso.append(nano) | |
loko = [] | |
for t in soso : | |
loko.append(t) | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from einstellung where Name = ?', ('FamilienPizza',)) | |
nado = cur.fetchall() | |
Frei = '' | |
Preis = '' | |
for t in nado : | |
Frei = str(t[1]) | |
Preis = t[2] | |
naldo = len(loko[int(Frei[0]) :]) | |
siko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, siko + float(naldo * Preis)) | |
Familienpizzavier.destroy() | |
# ------------------------------------------------------------------------------------------------------------------# | |
entryboxvier = AutocompleteEntry(Familienpizzavier, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxvier.place(x=30, y=20) | |
entryboxvier1 = AutocompleteEntry(Familienpizzavier, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxvier1.place(x=220, y=20) | |
entryboxvier2 = AutocompleteEntry(Familienpizzavier, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxvier2.place(x=220, y=280) | |
entryboxvier3 = AutocompleteEntry(Familienpizzavier, font=("Helvetica", 12, 'bold'), width=14, | |
completevalues=zutatenpreise) | |
entryboxvier3.place(x=30, y=280) | |
einfbutton = Button(Familienpizzavier, text='einfugen', width=6, bg='green', command=addzutatvier) | |
einfbutton.place(x=140, y=20) | |
einfbutton1 = Button(Familienpizzavier, text='einfugen', width=6, bg='green', command=addzutatvier1) | |
einfbutton1.place(x=325, y=20) | |
einfbutton2 = Button(Familienpizzavier, text='einfugen', width=6, bg='green', command=addzutatvier3) | |
einfbutton2.place(x=325, y=280) | |
einfbutton3 = Button(Familienpizzavier, text='einfugen', width=6, bg='green', command=addzutatvier4) | |
einfbutton3.place(x=140, y=280) | |
listboxvier = Listbox(Familienpizzavier, width=20, bd=5) | |
listboxvier.place(x=30, y=60) | |
listboxvier1 = Listbox(Familienpizzavier, width=20, bd=5) | |
listboxvier1.place(x=220, y=60) | |
listboxvier3 = Listbox(Familienpizzavier, width=20, bd=5) | |
listboxvier3.place(x=30, y=320) | |
listboxvier2 = Listbox(Familienpizzavier, width=20, bd=5) | |
listboxvier2.place(x=220, y=320) | |
Fertigbutton = Button(Familienpizzavier, text='fertig', width=10, bg='grey', command=fertigvier) | |
Fertigbutton.place(x=320, y=500) | |
global liso | |
liso = [] | |
#####################################zutaten funktion############################################################## | |
def zutati(event=None) : | |
global drop, liso | |
if entrybox1 != '' : | |
nado = entrybox1.get() | |
sqlCon1 = sqlite3.connect('speisekarte1.db') | |
vur = sqlCon1.cursor() | |
nado = (entrybox1.get()) | |
vur.execute("select* from Speisen where Name=(?)", (nado,)) | |
farto = vur.fetchall() | |
zob = [] | |
drop.configure(font=('Helvetica bold', 12), bg="green", bd=4, width=6) | |
for nano in farto : | |
ziko = str(nano[2]) | |
ziko.replace("'", "").replace(",", "").replace("{", "").replace("(", "").replace(")", "").replace( | |
"}", "") | |
clicked.set(nano[4]) | |
entrybox3.delete(0, END) | |
entrybox5.delete(0, END) | |
entrybox6.delete(0, END) | |
entrybox3.insert(END, nano[1]) | |
entrybox5.insert(END, ziko) | |
entrybox6.insert(END, nano[3]) | |
listbox2.delete(0, END) | |
listbox3.delete(0, END) | |
sqlCon = sqlite3.connect('ZutatenListe.db') | |
cur = sqlCon.cursor() | |
cur.execute("select* from zutaten where SpeiseName=(?)", (nado,)) | |
arto = cur.fetchall() | |
for ziko in arto : | |
listbox2.insert(END, ziko[1]), | |
if ziko[2] != '' : | |
listbox2.insert(END, ziko[2]), | |
if ziko[3] != '' : | |
listbox2.insert(END, ziko[3]), | |
if ziko[4] != '' : | |
listbox2.insert(END, ziko[4]), | |
if ziko[5] != '' : | |
listbox2.insert(END, ziko[5]), | |
if ziko[6] != '' : | |
listbox2.insert(END, ziko[6]), | |
if ziko[7] != '' : | |
listbox2.insert(END, ziko[7]), | |
if ziko[8] != '' : | |
listbox2.insert(END, ziko[8]), | |
if ziko[9] != '' : | |
listbox2.insert(END, ziko[9]), | |
if ziko[10] != '' : | |
listbox2.insert(END, ziko[10]) | |
sqlCon.commit() | |
if nado == 'Familien Pizza' : | |
Familie_window() | |
else : | |
pass | |
con.commit() | |
entrybox1.bind('<Return>', zutati) | |
listbox1.bind('<Double-Button-1>', zutati) | |
entrybox4.bind('<Return>', zutati) | |
# ------------------------------------------------------------------------------------------------------------------# | |
# Had to be moved here to be after the function | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def Zutatinr(event=None) : | |
sqlCon = sqlite3.connect("speisekarte1.db") | |
cub = sqlCon.cursor() | |
naldo = entrybox3.get() | |
cub.execute("select * from Speisen where Nummer =(?)", (naldo,)) | |
foro = cub.fetchall() | |
for taha in foro : | |
entrybox1.delete(0, END) | |
entrybox1.insert(END, taha[0]) | |
# s_button=Button(Mainframe2,text='S',width=2,bg='blue',command=Zutatinr) | |
# s_button.place(x=230,y=70) | |
entrybox3.bind('<Return>', Zutatinr) | |
entrybox3.bind('<Return>', zutati, add="+") | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def deletezutaten(event=None) : | |
global deletezutaten, liso | |
siko = listbox2.get(ACTIVE) | |
salo = siko[0] | |
salo1 = str(siko[1 :]) | |
if salo != '+' : | |
liso.insert(0, siko) | |
sok = len(liso) | |
print(sok) | |
if salo == '+' : | |
conn = sqlite3.connect('ZutatenPreise.db') | |
cur = conn.cursor() | |
cur.execute("select* from zutatenpreise where Zutat =(?) ", (salo1,)) | |
nado = cur.fetchall() | |
for tato in nado : | |
sicko = float(entrybox6.get()) | |
nalo = (sicko - float(tato[2])) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, float(nalo)) | |
listbox2.delete(ANCHOR) | |
else : | |
listbox3.insert(END, '-' + listbox2.get(ACTIVE)) | |
listbox2.delete(ANCHOR) | |
listbox2.bind("<Delete>", deletezutaten) | |
listbox2.bind('<Double-Button-1>', deletezutaten) | |
# deletezutat = Button(Mainframe2, text='Löschen', bd=2, width=6, bg='red', command=deletezutaten) | |
# deletezutat.place(x=630, y=100) | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def addzutat(event=None) : | |
global addzutat, liso | |
liko = str(entrybox1.get()) | |
liko1 = liko.strip() | |
if liko1 == 'Familien Pizza' : | |
sado = str(entrybox2.get()) | |
sado1 = sado.strip() | |
listbox2.insert(END, ('+') + sado1) | |
conn = sqlite3.connect('ZutatenPreise.db') | |
cur = conn.cursor() | |
cur.execute('select* from zutatenpreise where Zutat =(?)', (sado1,)) | |
mako = cur.fetchall() | |
for saro in mako : | |
siko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, siko + math.floor(float(saro[2] * 2 * 100) / 100)) | |
entrybox2.delete(0, END) | |
else : | |
sado = str(entrybox2.get()) | |
sado1 = sado.strip() | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
cur.execute("select * from zutatenpreise") | |
mako = cur.fetchall() | |
countk = 0 | |
modes = len(liso) | |
num = int(modes) | |
for saro in mako : | |
if sado1 in saro : | |
entrybox2.delete(0, END) | |
listbox2.insert(END, ('+') + sado1) | |
if num > 0 : | |
liso.pop(0) | |
print(num) | |
else : | |
siko = float(entrybox6.get()) | |
entrybox6.delete(0, END) | |
entrybox6.insert(END, siko + float(saro[2])) | |
else : | |
pass | |
conn.commit() | |
global einfbutton | |
# einfbutton = Button(Mainframe2, text='einfugen', width=6, bg='green', command=addzutat) | |
# einfbutton.place(x=630, y=70) | |
entrybox2.bind('<Return>', addzutat) | |
############################################ Lieferzuschlag ############################################# | |
conn12 = sqlite3.connect('Einstellung.db') | |
global ako | |
cur12 = conn12.cursor() | |
cur12.execute(' select * from Lieferzuschlg ') | |
cob = cur12.fetchall() | |
for ido in cob : | |
for ako in ido : | |
float(ako) | |
liefer = Label(Mainframe3, text='Mindestpreise:', bg='white', font=font_size, ) | |
liefer.place(x=50, y=495) # für die lieferzuschlag oder Mindensten wert | |
liefer1 = Label(Mainframe3, text=ako + '€', bg='white', font=font_size, fg='red') | |
liefer1.place(x=165, y=495) | |
####################################Search and Autofill Functions####################################################### | |
def update(data) : | |
listbox1.delete(0, END) | |
for tata in data : | |
listbox1.insert(END, tata) | |
def fillout(e) : | |
entrybox1.delete(0, END) | |
entrybox1.insert(0, listbox1.get(ANCHOR)) | |
def check(e) : | |
typed = entrybox1.get() | |
nuym = entrybox3.get() | |
if typed == "" : | |
data = [toppings] | |
else : | |
data = [] | |
for item in toppings : | |
if typed.lower() in item.lower() : | |
data.append(item) | |
update(data) | |
update(toppings) | |
entrybox1.bind("<KeyRelease>", check) | |
listbox1.bind("<<ListboxSelect>>", fillout) | |
def Numbers_einfugen() : | |
global ako | |
solo = entrybox2.get() | |
item1 = (entrybox4.get()) | |
komm = entrybox12.get() | |
if solo != '' : | |
sicko = messagebox.showinfo('Mit Zutat', 'Bitte den Zutat mit Enter Bestätigen') | |
else : | |
if (item1.isdigit()) : | |
insertdatatree() | |
entrybox4.delete(0, END) | |
entrybox4.insert(0, '1') | |
entrybox2.delete(0, END) | |
entrybox1.delete(0, END) | |
listbox3.delete(0, END) | |
entrybox3.delete(0, END) | |
entrybox5.delete(0, END) | |
entrybox6.delete(0, END) | |
entrybox7.delete(0, END) | |
entrybox7.insert(0, float(0.0)) | |
entrybox8.delete(0, END) | |
entrybox8.insert(0, float(0.0)) | |
entrybox9.delete(0, END) | |
entrybox9.insert(0, float(0.0)) | |
entrybox10.delete(0, END) | |
entrybox10.insert(0, float(0.0)) | |
clicked.set('Klein') | |
entrybox12.delete(0, END) | |
drop.configure(font=('Helvetica bold', 12), bg="white", bd=4, width=5) | |
entrybox1.focus_force() | |
update(toppings) | |
listbox2.delete(0, END) | |
sopr = float(entrybox11.get()) | |
liso.clear() | |
if AdresseE.get() != 'ABHOLUNG' : | |
if float(sopr) > float(ako) : | |
liefer1.config(fg='green') | |
else : | |
liefer1.config(fg='red') | |
else : | |
tkinter.messagebox.showinfo("Error", "bei (Anzahl) ein nummer eingeben!!!") | |
entrybox4.delete(0, END) | |
global einfugen | |
einfugen = Button(Mainframe2, text="Nächste", bg='green', bd=2, command=Numbers_einfugen, height=3) | |
einfugen.place(x=820, y=70) | |
##################################Kunden liste Bestellung (functions)################################################### | |
def popup() : | |
response = MessageBox.showinfo("!", 'kunde existiert nicht, Bitte neu speichern ') | |
Label(new_window2, text=response) | |
# ---------------------------------------------------------------------------------------------------------------------# | |
def reset() : | |
KundenidE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
TelefonnummerE.delete(0, END) | |
in_comment.delete('1.0', END) | |
ext_comment.delete('1.0', END) | |
EmailE.delete(0, END) | |
ORTE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def search(event) : | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
ziko = TelefonnummerE.get() | |
tiko = KundenidE.get() | |
if ziko != '' and tiko == '' : | |
cur.execute("select * from pizaa1 where Telefon=%s ", ziko) | |
ar = cur.fetchall() | |
for sag in ar : | |
TelefonnummerE.delete(0, END) | |
KundenidE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
in_comment.delete(1.0, END) | |
ext_comment.delete('1.0', END) | |
EmailE.delete(0, END) | |
ORTE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
kundenid = KundenidE.insert(0, sag[0]) | |
Name = NameE.insert(0, sag[1]) | |
Addresse = AdresseE.insert(0, sag[2]) | |
Telefon = TelefonnummerE.insert(0, sag[3]) | |
int_comment = in_comment.insert("1.0", sag[4]) | |
Nr = HauesnrE.insert(0, sag[5]) | |
PLZ = PLZE.insert(0, sag[6]) | |
ORT = ORTE.insert(0, sag[7]) | |
Email = EmailE.insert(0, sag[8]) | |
elif tiko != '' : | |
cur.execute("select * from pizaa1 where kundenid=%s ", tiko) | |
ar = cur.fetchall() | |
for sag in ar : | |
TelefonnummerE.delete(0, END) | |
KundenidE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
in_comment.delete(1.0, END) | |
ext_comment.delete('1.0', END) | |
EmailE.delete(0, END) | |
ORTE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
kundenid = KundenidE.insert(0, sag[0]) | |
Name = NameE.insert(0, sag[1]) | |
Addresse = AdresseE.insert(0, sag[2]) | |
Telefon = TelefonnummerE.insert(0, sag[3]) | |
int_comment = in_comment.insert("1.0", sag[4]) | |
Nr = HauesnrE.insert(0, sag[5]) | |
PLZ = PLZE.insert(0, sag[6]) | |
ORT = ORTE.insert(0, sag[7]) | |
Email = EmailE.insert(0, sag[8]) | |
NameE.focus_force() | |
sqlCon.commit() | |
sqlCon.close() | |
TelefonnummerE.bind('<Return>', search) | |
KundenidE.bind('<Return>', search) | |
######################################################################################################################## | |
def addDATA1() : | |
maro = TelefonnummerE.get() | |
con = pymysql.connect(host="localhost", user="root", password="A773468810598a", | |
database="Kundendb") | |
custor = con.cursor() | |
if NameE.get() == "" or AdresseE.get() == "" or TelefonnummerE.get() == "" or HauesnrE.get() == "" or PLZE.get() == "" or ORTE.get() == "" : | |
tkinter.messagebox.showerror('Error', 'alle felder sind pflichtfelder ') | |
sol = "select * from pizaa1 where Telefon=%s" | |
names = (maro,) | |
result = custor.execute(sol, names) | |
if result : | |
MessageBox.showinfo("!", 'kunde exestiert Bitte auf Update Drucken') | |
else : | |
custor.execute( | |
"""insert into pizaa1 | |
(Name,Addresse,Telefon,int_comment,Nr,PLZ,ORT,Email) | |
values(%s,%s,%s,%s,%s,%s,%s,%s)""", | |
(NameE.get(), | |
AdresseE.get(), | |
TelefonnummerE.get(), | |
in_comment.get("1.0", END), | |
HauesnrE.get(), | |
PLZE.get(), | |
ORTE.get(), | |
EmailE.get(), | |
)) | |
MessageBox.showinfo("!", 'kunde gespeichert') | |
custor.execute("commit") | |
custor.close() | |
######################################################################################################################## | |
def search1(event=None) : | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
tiko = KundenidE.get() | |
if cur.execute("select * from pizaa1 where kundenid=%s ", tiko) : | |
ar = cur.fetchall() | |
KundenidE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
TelefonnummerE.delete(0, END) | |
in_comment.delete('1.0', END) | |
ext_comment.delete('1.0', END) | |
EmailE.delete(0, END) | |
ORTE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
for sag in ar : | |
kundenid = KundenidE.insert(0, sag[0]) | |
Name = NameE.insert(0, sag[1]) | |
Addresse = AdresseE.insert(0, sag[2]) | |
Telefon = TelefonnummerE.insert(0, sag[3]) | |
int_comment = in_comment.insert(1.0, sag[4]) | |
Nr = HauesnrE.insert(0, sag[5]) | |
PLZ = PLZE.insert(0, sag[6]) | |
ORT = ORTE.insert(0, sag[7]) | |
Email = EmailE.insert(0, sag[8]) | |
else : | |
popup() | |
sqlCon.commit() | |
sqlCon.close() | |
# ---------------------------------------------------------------------------------------------------------------------# | |
def search3(event) : | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
ziko = NameE.get() | |
tiko = KundenidE.get() | |
if ziko != '' and tiko == '' : | |
cur.execute("select * from pizaa1 where Name=%s ", ziko) | |
ar = cur.fetchall() | |
for sag in ar : | |
TelefonnummerE.delete(0, END) | |
KundenidE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
in_comment.delete(1.0, END) | |
ext_comment.delete('1.0', END) | |
EmailE.delete(0, END) | |
ORTE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
kundenid = KundenidE.insert(0, sag[0]) | |
Name = NameE.insert(0, sag[1]) | |
Addresse = AdresseE.insert(0, sag[2]) | |
Telefon = TelefonnummerE.insert(0, sag[3]) | |
int_comment = in_comment.insert("1.0", sag[4]) | |
Nr = HauesnrE.insert(0, sag[5]) | |
PLZ = PLZE.insert(0, sag[6]) | |
ORT = ORTE.insert(0, sag[7]) | |
Email = EmailE.insert(0, sag[8]) | |
elif tiko != '' : | |
cur.execute("select * from pizaa1 where kundenid=%s ", tiko) | |
ar = cur.fetchall() | |
for sag in ar : | |
TelefonnummerE.delete(0, END) | |
KundenidE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
in_comment.delete(1.0, END) | |
ext_comment.delete('1.0', END) | |
EmailE.delete(0, END) | |
ORTE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
kundenid = KundenidE.insert(0, sag[0]) | |
Name = NameE.insert(0, sag[1]) | |
Addresse = AdresseE.insert(0, sag[2]) | |
Telefon = TelefonnummerE.insert(0, sag[3]) | |
int_comment = in_comment.insert("1.0", sag[4]) | |
Nr = HauesnrE.insert(0, sag[5]) | |
PLZ = PLZE.insert(0, sag[6]) | |
ORT = ORTE.insert(0, sag[7]) | |
Email = EmailE.insert(0, sag[8]) | |
sqlCon.commit() | |
sqlCon.close() | |
######################################################################################################################## | |
def bestelliste() : | |
global new_window | |
font_size = ("ARIEL", 12, "bold") | |
new_window5 = Toplevel(root) | |
screen_width = new_window5.winfo_screenwidth() | |
screen_height = new_window5.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window5.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
new_window5.config(bg='dark slate gray') | |
new_window5.resizable(width=False, height=False) | |
new_window5.configure(bg='SlateGray4') | |
new_window5.title(220 * titlespace + "Liste") | |
new_window5.resizable(width=False, height=False) | |
Frame1 = Frame(new_window5, width=550, bg='white', bd=4, height=1200, relief=RIDGE) | |
Frame1.place(x=0, y=0) | |
Frame2 = Frame(new_window5, width=1050, bd=4, height=400) | |
Frame2.place(x=500, y=510) | |
Frame3 = Frame(new_window5, width=550, bg='white', bd=4, height=600, relief=RIDGE) | |
Frame3.place(x=1045, y=0) | |
# bestell_liste: Listbox=Listbox(Frame1,bd=6,width=20,height=25,bg='white') | |
# bestell_liste.place(x=35,y=65) | |
# bestell_liste.config(font=('arial', 16, 'bold')) | |
# nr_liste = Listbox(Frame1, bd=6, width=2, height=25, bg='white') | |
# nr_liste.place(x=0, y=65) | |
# nr_liste.config(font=('arial', 16, 'bold')) | |
Update = Label(Frame1, text=' Heute Bestellung ', font=font_size, bd=4, bg='SlateGray3', height=1, | |
width=48) | |
Update.place(x=0, y=0) | |
# nr = Label(Frame1, text='Nr ', font=('arial', 16, 'bold'), bd=4, bg='white', height=1, width=2) | |
# nr.place(x=0, y=35) | |
# name = Label(Frame1, text='Name ', font=('arial', 16, 'bold'), bd=4, bg='white', height=1 ) | |
# name.place(x=60, y=35) | |
KundenidE = Entry(new_window5, width=6, bd=5, bg='white smoke') | |
KundenidE.place(x=510, y=35) | |
KundenidE.configure(font=font_size) | |
NameE = Entry(new_window5, bd=5, width=25, bg='white smoke') | |
NameE.place(x=510, y=94) | |
NameE.configure(font=font_size) | |
AdresseE = Entry(new_window5, width=30, bd=5, font=("Helvetica", 12, 'bold')) | |
AdresseE.place(x=510, y=162) | |
HauesnrE = Entry(new_window5, bd=5, width=4, bg='white smoke') | |
HauesnrE.place(x=810, y=162) | |
HauesnrE.configure(font=font_size) | |
PLZE = Entry(new_window5, bd=5, width=7, bg='white smoke') | |
PLZE.place(x=510, y=230) | |
PLZE.configure(font=font_size) | |
ORTE = Entry(new_window5, bd=5, width=15, bg='white smoke') | |
ORTE.place(x=680, y=230) | |
ORTE.configure(font=font_size) | |
TelefonnummerE = Entry(new_window5, bd=5, width=20, bg='white smoke') | |
TelefonnummerE.place(x=630, y=35) | |
TelefonnummerE.configure(font=font_size) | |
EmailE = Entry(new_window5, bd=5, width=30, bg='white smoke') | |
EmailE.place(x=510, y=300) | |
EmailE.configure(font=font_size) | |
BestellzeitE = Entry(new_window5, width=20, bd=5) | |
BestellzeitE.place(x=510, y=370) | |
BestellzeitE.configure(font=font_size) | |
bedinerE = Entry(new_window5, bd=5, width=10, bg='white smoke') | |
bedinerE.place(x=610, y=410) | |
bedinerE.configure(font=font_size) | |
lieferzeitE = Entry(new_window5, bd=5, width=10, bg='white smoke') | |
lieferzeitE.place(x=610, y=453) | |
lieferzeitE.configure(font=font_size) | |
GpreisE = Entry(new_window5, bd=5, width=10, bg='white smoke') | |
GpreisE.place(x=940, y=453) | |
GpreisE.configure(font=font_size) | |
sucheE = Entry(new_window5, bd=5, width=15, bg='white smoke') | |
sucheE.place(x=170, y=510) | |
sucheE.configure(font=font_size) | |
# -------------------------------------------- Labels ------------------------------------------------------------# | |
Kundenid = Label(new_window5, bd=0, text='Kunden/ID', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=10) | |
Name = Label(new_window5, bd=0, text='Name:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=70) | |
Adresse = Label(new_window5, bd=0, text='Straße:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=135) | |
Hausnr = Label(new_window5, bd=0, text='Nr:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=810, y=135) | |
PLZ = Label(new_window5, bd=0, text='PLZ:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=205) | |
Ort = Label(new_window5, bd=0, text='ORT:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=675, y=205) | |
Telefonnummer = Label(new_window5, bd=0, text='Telefonnummer:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=630, y=10) | |
Email = Label(new_window5, bd=0, text='Email:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=272) | |
Bestellzeit = Label(new_window5, bd=0, text='Bestellzeit:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=342) | |
bediner = Label(new_window5, bd=0, text='Bediener:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=415) | |
LIEFERZEIT = Label(new_window5, bd=0, text='Lieferzet:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=455) | |
GesamtPreis = Label(new_window5, bd=0, text='Gesamte Preis:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=750, y=455) | |
suchenl = Label(new_window5, bd=0, text='Name eingeben :', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=0, y=510) | |
# ---------------------------------------------Bbestelltree---------------------------------------------------------# | |
style = ttk.Style() | |
style.theme_use("clam") | |
style.configure("Treeview", background='white', foreground="black", rowheight=25, font=("ARIEL", 9, 'bold'), | |
fieldbackground="silver") | |
style.map('Treeview', background=[('selected', 'red')]) | |
style.configure("Treeview.Heading", font=('bold', 12)) | |
style.configure("Treeview.column", font=('bold', 6)) | |
style.configure('Treeview', rowheight=40) | |
style.configure('Treeview.row', font=('bold', 20)) | |
myTree = ttk.Treeview(Frame2) | |
myTree['columns'] = ("pos", "Grosse", "Anzahl", "Nr", "Speise", "Mit", "Ohne", "Katagorie", "Preis",) | |
myTree.column("#0", width=0, stretch=NO) | |
myTree.column("pos", anchor=CENTER, width=40, stretch=TRUE, ) | |
myTree.column("Grosse", anchor=CENTER, width=80) | |
myTree.column("Anzahl", anchor=CENTER, width=35) | |
myTree.column("Nr", anchor=CENTER, width=35) | |
myTree.column("Speise", anchor=W, width=120) | |
myTree.column("Mit", anchor=W, width=430, stretch=TRUE) | |
myTree.column("Ohne", anchor=W, width=190, stretch=TRUE) | |
myTree.column("Katagorie", anchor=CENTER, width=80) | |
myTree.column("Preis", anchor=CENTER, width=80) | |
myTree.tag_configure('pos', background='gray') | |
myTree.heading("#0", text="", anchor=W) | |
myTree.heading("pos", text="pos", anchor=W) | |
myTree.heading("Grosse", text="Grosse", anchor=W) | |
myTree.heading("Anzahl", text="Anzahl", anchor=W) | |
myTree.heading("Nr", text="Nr", anchor=W) | |
myTree.heading("Speise", text="Speise", anchor=CENTER) | |
myTree.heading("Mit", text="Mit", anchor=CENTER) | |
myTree.heading("Ohne", text="Ohne", anchor=CENTER) | |
myTree.heading("Katagorie", text="Katagorie", anchor=CENTER) | |
myTree.heading("Preis", text="Preis", anchor=W) | |
myTree.pack() | |
# ------------------------------------------------------------------------------------------------------------------# | |
besteltree = ttk.Treeview(Frame1) | |
besteltree['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr") | |
besteltree.column("#0", width=0, stretch=NO) | |
besteltree.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree.column("Name", anchor=CENTER, width=120) | |
besteltree.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree.column("Straße", anchor=W, width=120) | |
besteltree.column("Haus/nr", anchor=W, width=40) | |
besteltree.tag_configure('pos', background='white') | |
besteltree.heading("#0", text="", anchor=W) | |
besteltree.heading("Nr", text="Nr", anchor=W) | |
besteltree.heading("Name", text="Name", anchor=W) | |
besteltree.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree.heading("Straße", text="Straße", anchor=W) | |
besteltree.heading("Haus/nr", text="nr", anchor=W) | |
besteltree.pack() | |
# ------------------------------------------------AbholTree---------------------------------------------------------# | |
besteltree1 = ttk.Treeview(Frame3) | |
besteltree1['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr") | |
besteltree1.column("#0", width=0, stretch=NO) | |
besteltree1.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree1.column("Name", anchor=CENTER, width=120) | |
besteltree1.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree1.column("Straße", anchor=W, width=120) | |
besteltree1.column("Haus/nr", anchor=W, width=40) | |
besteltree1.tag_configure('pos', background='white') | |
besteltree1.heading("#0", text="", anchor=W) | |
besteltree1.heading("Nr", text="Nr", anchor=W) | |
besteltree1.heading("Name", text="Name", anchor=W) | |
besteltree1.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree1.heading("Straße", text="Straße", anchor=W) | |
besteltree1.heading("Haus/nr", text="nr", anchor=W) | |
besteltree1.pack() | |
# ----------------------------------------------------------get bestelldata und insert in Tree----------------------# | |
abhol = 'ABHOLUNG' | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where kstrasse!=(?) order by ID DESC ', (abhol,)) | |
firo = cur.fetchall() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn1.cursor() | |
cur1.execute('select * from kundeinfo where kstrasse =(?) order by ID DESC ', (abhol,)) | |
firo1 = cur1.fetchall() | |
# ------------------------------------------------------------------------------------------------------------------# | |
global count | |
count = 0 | |
for ziko in firo : | |
besteltree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(ziko[0], ziko[3], ziko[10], ziko[4], ziko[5])) | |
count += 1 | |
global counts | |
counts = 0 | |
for ziko1 in firo1 : | |
besteltree1.insert(parent='', open=True, index='end', iid=counts, text='', | |
values=(ziko1[0], ziko1[3], ziko1[10], ziko1[4], ziko1[5])) | |
counts += 1 | |
# -------------------------------------------- Functions ---------------------------------------------------------# | |
def clear() : | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
bestel = ('kundeinfo') | |
cur.execute('delete from kundeinfo') | |
cur.execute('delete from sqlite_sequence where name = (?) ', (bestel,)) | |
conn.commit() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
cur1.execute('delete from speiseinfo') | |
conn1.commit() | |
new_window5.destroy() | |
openwindow6() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def bestat() : | |
sick100 = besteltree.focus() | |
times = (besteltree.item(sick100)['values'][2]) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('delete from kundeinfo where zeit=(?)', (times,)) | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
cur1.execute('delete from speiseinfo where zeit=(?)', (times,)) | |
conn.commit() | |
conn1.commit | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
new_window5.destroy() | |
openwindow6() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def clicking(e=NONE) : | |
global count | |
KundenidE.config(state=NORMAL) | |
TelefonnummerE.config(state=NORMAL) | |
NameE.config(state=NORMAL) | |
AdresseE.config(state=NORMAL) | |
ORTE.config(state=NORMAL) | |
PLZE.config(state=NORMAL) | |
EmailE.config(state=NORMAL) | |
BestellzeitE.config(state=NORMAL) | |
bedinerE.config(state=NORMAL) | |
lieferzeitE.config(state=NORMAL) | |
HauesnrE.config(state=NORMAL) | |
GpreisE.config(state=NORMAL) | |
count = 0 | |
sick100 = besteltree.focus() | |
numos = (besteltree.item(sick100)['values'][0]) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where ID =(?) order by ID DESC ', (numos,)) | |
tor = cur.fetchall() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
cur1.execute('select zeit from kundeinfo where ID =(?) order by ID DESC ', (numos,)) | |
tor1 = str(cur1.fetchall()) | |
tor1.strip() | |
tor2 = tor1.replace('[', '').replace(']', '').replace('(', '').replace(')', '').replace("'", | |
'').replace(',', | |
'') | |
for na in tor : | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
KundenidE.insert(0, na[1]) | |
TelefonnummerE.insert(0, na[2]) | |
NameE.insert(0, na[3]) | |
AdresseE.insert(0, na[4]) | |
HauesnrE.insert(0, na[5]) | |
PLZE.insert(0, na[6]) | |
ORTE.insert(0, na[7]) | |
EmailE.insert(0, na[8]) | |
BestellzeitE.insert(0, na[10]) | |
bedinerE.insert(0, na[9]) | |
GpreisE.insert(0, na[13]) | |
KundenidE.config(state=DISABLED) | |
TelefonnummerE.config(state=DISABLED) | |
NameE.config(state=DISABLED) | |
AdresseE.config(state=DISABLED) | |
ORTE.config(state=DISABLED) | |
PLZE.config(state=DISABLED) | |
EmailE.config(state=DISABLED) | |
BestellzeitE.config(state=DISABLED) | |
bedinerE.config(state=DISABLED) | |
HauesnrE.config(state=DISABLED) | |
GpreisE.config(state=DISABLED) | |
if na[11] != '' : | |
lieferzeitE.insert(0, na[11]) | |
lieferzeitE.config(state=DISABLED) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from speiseinfo where zeit =(?) ', (tor2,)) | |
cos = cur.fetchall() | |
for zol in cos : | |
myTree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(zol[1], zol[2], zol[3], | |
zol[4], zol[5], | |
zol[6], zol[7], zol[8], zol[9])) | |
count += 1 | |
# ------------------------------------------------------------------------------------------------------------------# | |
def clicking1(e=NONE) : | |
global count | |
KundenidE.config(state=NORMAL) | |
TelefonnummerE.config(state=NORMAL) | |
NameE.config(state=NORMAL) | |
AdresseE.config(state=NORMAL) | |
ORTE.config(state=NORMAL) | |
PLZE.config(state=NORMAL) | |
EmailE.config(state=NORMAL) | |
BestellzeitE.config(state=NORMAL) | |
bedinerE.config(state=NORMAL) | |
lieferzeitE.config(state=NORMAL) | |
HauesnrE.config(state=NORMAL) | |
GpreisE.config(state=NORMAL) | |
count = 0 | |
sick100 = besteltree1.focus() | |
numos = (besteltree1.item(sick100)['values'][0]) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where ID =(?) ', (numos,)) | |
tor = cur.fetchall() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
abhol = 'ABHOLUNG' | |
cur1.execute('select zeit from kundeinfo where ID =(?) ', (numos,)) | |
tor1 = str(cur1.fetchall()) | |
tor1.strip() | |
tor2 = tor1.replace('[', '').replace(']', '').replace('(', '').replace(')', '').replace("'", | |
'').replace(',', | |
'') | |
for na in tor : | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
KundenidE.insert(0, na[1]) | |
TelefonnummerE.insert(0, na[2]) | |
NameE.insert(0, na[3]) | |
AdresseE.insert(0, na[4]) | |
HauesnrE.insert(0, na[5]) | |
PLZE.insert(0, na[6]) | |
ORTE.insert(0, na[7]) | |
EmailE.insert(0, na[8]) | |
BestellzeitE.insert(0, na[10]) | |
bedinerE.insert(0, na[9]) | |
GpreisE.insert(0, na[13]) | |
KundenidE.config(state=DISABLED) | |
TelefonnummerE.config(state=DISABLED) | |
NameE.config(state=DISABLED) | |
AdresseE.config(state=DISABLED) | |
ORTE.config(state=DISABLED) | |
PLZE.config(state=DISABLED) | |
EmailE.config(state=DISABLED) | |
BestellzeitE.config(state=DISABLED) | |
bedinerE.config(state=DISABLED) | |
HauesnrE.config(state=DISABLED) | |
GpreisE.config(state=DISABLED) | |
if na[11] != '' : | |
lieferzeitE.insert(0, na[11]) | |
lieferzeitE.config(state=DISABLED) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from speiseinfo where zeit =(?) ', (tor2,)) | |
cos = cur.fetchall() | |
for zol in cos : | |
myTree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(zol[1], zol[2], zol[3], | |
zol[4], zol[5], | |
zol[6], zol[7], zol[8], zol[9])) | |
count += 1 | |
# ------------------------------------------------------------------------------------------------------------------# | |
def Reset() : | |
KundenidE.config(state=NORMAL) | |
TelefonnummerE.config(state=NORMAL) | |
NameE.config(state=NORMAL) | |
AdresseE.config(state=NORMAL) | |
ORTE.config(state=NORMAL) | |
PLZE.config(state=NORMAL) | |
EmailE.config(state=NORMAL) | |
BestellzeitE.config(state=NORMAL) | |
bedinerE.config(state=NORMAL) | |
lieferzeitE.config(state=NORMAL) | |
HauesnrE.config(state=NORMAL) | |
GpreisE.config(state=NORMAL) | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
for tom in besteltree.get_children() : | |
besteltree.delete(tom) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo ') | |
firo = cur.fetchall() | |
count = 0 | |
for ziko in firo : | |
besteltree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(ziko[0], ziko[3], ziko[10], ziko[4])) | |
count += 1 | |
# ------------------------------------------------------------------------------------------------------------------# | |
def search_data() : | |
country = 0 | |
get_record = sucheE.get() | |
for record in besteltree.get_children() : | |
besteltree.delete(record) | |
sucheE.delete(0, END) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where kname like (?) ', (get_record,)) | |
toz = cur.fetchall() | |
print(get_record) | |
for item in toz : | |
besteltree.insert(parent='', open=True, index='end', iid=country, text='', | |
values=(item[0], item[3], item[10], item[4])) | |
country += 1 | |
# ---------------------------------------------- Buttons -----------------------------------------------------------# | |
show = Button(new_window5, bd=4, text='Abrufen', width=10, height=2, bg='green', command=clicking) | |
show.place(x=100, y=442) | |
show = Button(new_window5, bd=4, text='Abrufen', width=10, height=2, bg='green', command=clicking1) | |
show.place(x=1120, y=442) | |
besteltree.bind('<Double-Button-1>', clicking) | |
reset_ = Button(new_window5, bd=4, text='Reset', width=10, height=2, bg='Blue', command=Reset) | |
reset_.place(x=200, y=442) | |
sucheb_ = Button(new_window5, bd=4, text='Suche', width=8, height=1, bg='CADET BLUE', command=search_data) | |
sucheb_.place(x=320, y=510) | |
def openwindow7() : | |
global new_window | |
font_size = ("ARIEL", 12, "bold") | |
new_window6 = Toplevel(root) | |
screen_width = new_window6.winfo_screenwidth() | |
screen_height = new_window6.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window6.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
new_window6.config(bg='dark slate gray') | |
new_window6.resizable(width=False, height=False) | |
new_window6.configure(bg='SlateGray4') | |
new_window6.title(220 * titlespace + "Liste") | |
new_window6.resizable(width=False, height=False) | |
Frame1 = Frame(new_window6, width=550, bg='white', bd=4, height=1200, relief=RIDGE) | |
Frame1.place(x=0, y=0) | |
def update1() : | |
if NameE.get() == "" or AdresseE.get() == "" or TelefonnummerE.get() == "" or HauesnrE.get() == "" or PLZE.get() == "" or ORTE.get() == "" : | |
tkinter.messagebox.showerror('Error', 'alle felder sind pflichtfelder ') | |
else : | |
miko = TelefonnummerE.get() | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
cur.execute( | |
"""update pizaa1 set Name=%s,Addresse=%s,int_comment=%s,Nr=%s,PLZ=%s,ORT=%s,Email=%s where Telefon=%s""", | |
(NameE.get(), | |
AdresseE.get(), | |
in_comment.get("1.0", END), | |
HauesnrE.get(), | |
PLZE.get(), | |
ORTE.get(), | |
EmailE.get(), | |
TelefonnummerE.get() | |
)) | |
sqlCon.commit() | |
sqlCon.close() | |
reset() | |
MessageBox.showinfo("!", 'Daten geandert') | |
######################################################################################################################## | |
def delete() : | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
cur.execute("delete from clients where kundenid=%s", KundenidE.get()) | |
sqlCon.commit() | |
reset() | |
sqlCon.close() | |
####################################Kunden listeBestellung(Buttons)##################################################### | |
# btnsearch = Button(Mainframe1, font=('arial', 7, 'bold'), text='suche', bd=4, bg='red', pady=1, | |
# padx=24, | |
# width=4, height=1, command=search) | |
# btnsearch.place(x=175,y=340) | |
global text1 | |
printframe = Frame(new_window2, width=60, height=60, bg='white') | |
scrolbar = Scrollbar(printframe) | |
scrolbar.pack(side=RIGHT, fill=Y) | |
btnspeicher = Button(Mainframe1, font=('arial', 10, 'bold'), text='Speichern', bd=4, bg='green', pady=1, | |
padx=24, | |
width=3, height=2, command=addDATA1) | |
btnspeicher.place(x=0, y=340) | |
text1 = Text(new_window2, height=40, bg='white', bd=0, font=('arial', 14, 'bold')) | |
btnsuche1 = Button(Mainframe1, font=('arial', 7, 'bold'), text='suche', bd=4, bg='red', | |
pady=1, | |
padx=24, | |
width=4, height=1, command=search3) | |
KundenidE.bind('<Return>', search1) | |
NameE.bind('<Return>', search3) | |
btnsuche1.bind('<Return>', search3) | |
btnreset = Button(Mainframe1, font=('arial', 10, 'bold'), text='Löschen', bd=4, bg='red', pady=1, | |
padx=24, | |
width=3, height=2, command=reset) | |
btnreset.place(x=90, y=340) | |
btndelet = Button(Mainframe1, font=('arial', 10, 'bold'), text='delete', bd=4, bg='red', pady=1, | |
padx=24, | |
width=3, height=2, command=delete) | |
btnupdate = Button(Mainframe1, font=('arial', 10, 'bold'), text='Update', bd=4, bg='orange', pady=1, | |
padx=24, | |
width=3, height=2, command=update1) | |
btnupdate.place(x=180, y=340) | |
btnliste = Button(Mainframe1, font=('arial', 8, 'bold'), text='', bd=0, bg='dark slate gray', pady=1, | |
padx=24, | |
width=1, height=1, command=bestelliste) | |
btnliste.place(x=50, y=200) | |
# ---------------------------------------------------------- HIDE FUNCTION --------------------------------------------# | |
def hide() : | |
global counts, text1 | |
tek = TelefonnummerE.get() | |
tik = NameE.get() | |
con = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
custor = con.cursor() | |
custor1 = con.cursor() | |
custor1.execute("select * from blacklist") | |
blacky = custor1.fetchall() | |
for tizi in blacky : | |
if tik in tizi : | |
messagebox.showwarning('Achtung', 'DIESE KUNDE STEHT AUF DIE BLACK LISTE') | |
custor.execute('select Telefon from pizaa1') | |
conlo = custor.fetchall() | |
telefon = [] | |
for holo in conlo : | |
salo = str(holo) | |
mako = salo.replace(',', '').replace("'", "").replace('(', '').replace(')', '') | |
telefon.append(mako) | |
if tek not in telefon and TelefonnummerE.get() != '' and AdresseE.get() != '' : | |
saro = messagebox.askyesno('M2 Bestellsystem', 'Kunde exestiert nicht wollen Sie speichern? ') | |
if saro == 1 : | |
addDATA1() | |
mou = AdresseE.get() | |
if mou != '' : | |
counts == 1 | |
Mainframe2.grid(row=0, column=2, sticky='n') | |
Mainframe3.place(x=400, y=350) | |
KundenidE.configure(state=DISABLED) | |
TelefonnummerE.configure(state=DISABLED) | |
NameE.configure(state=DISABLED) | |
AdresseE.configure(state=DISABLED) | |
HauesnrE.configure(state=DISABLED) | |
PLZE.configure(state=DISABLED) | |
ORTE.configure(state=DISABLED) | |
EmailE.configure(state=DISABLED) | |
text1.place_forget() | |
else : | |
messagebox.showinfo('Adresse', 'Bitte Adresse eingeben!!') | |
def hide1() : | |
global counts, text1 | |
tek = TelefonnummerE.get() | |
tik = NameE.get() | |
con = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
custor = con.cursor() | |
custor1 = con.cursor() | |
custor1.execute("select * from blacklist") | |
blacky = custor1.fetchall() | |
for tizi in blacky : | |
if tik in tizi : | |
messagebox.showwarning('Achtung', 'DIESE KUNDE STEHT AUF DIE BLACK LISTE') | |
custor.execute('select Telefon from pizaa1') | |
conlo = custor.fetchall() | |
telefon = [] | |
for holo in conlo : | |
salo = str(holo) | |
mako = salo.replace(',', '').replace("'", "").replace('(', '').replace(')', '') | |
telefon.append(mako) | |
Mainframe2.grid(row=0, column=2, sticky='n') | |
Mainframe3.place(x=400, y=350) | |
KundenidE.configure(state=DISABLED) | |
TelefonnummerE.configure(state=DISABLED) | |
NameE.configure(state=DISABLED) | |
AdresseE.delete(0, END) | |
AdresseE.insert(0, 'ABHOLUNG') | |
AdresseE.configure(state=DISABLED) | |
HauesnrE.delete(0, END) | |
HauesnrE.configure(state=DISABLED) | |
PLZE.delete(0, END) | |
PLZE.configure(state=DISABLED) | |
ORTE.delete(0, END) | |
ORTE.configure(state=DISABLED) | |
EmailE.configure(state=DISABLED) | |
text1.place_forget() | |
liefer.config(state=DISABLED) | |
liefer1.config(state=DISABLED) | |
btnüber = Button(Mainframe1, font=('arial', 10, 'bold'), text='Lieferung', bd=4, bg='RoyalBlue3', pady=1, | |
padx=24, | |
width=3, height=2, command=hide) | |
btnüber.place(x=10, y=440) | |
btnüberA = Button(Mainframe1, font=('arial', 10, 'bold'), text='Abholung', bd=4, bg='#ff512f', pady=1, | |
padx=24, | |
width=3, height=2, command=hide1) | |
btnüberA.place(x=120, y=440) | |
def neubrechnen() : | |
end = float(entrybox11.get()) | |
rabb = float(entrybox10.get()) | |
gutsch = float(entrybox9.get()) | |
if rabb != 0.0 : | |
entrybox11.delete(0, END) | |
entrybox10.config(state=DISABLED) | |
ziko = (rabb * end) / 100.0 | |
zaka = end - ziko | |
ert = (math.floor(float(zaka) * 100) / 100) | |
entrybox11.insert(0, ert) | |
elif gutsch != 0.0 : | |
entrybox11.delete(0, END) | |
entrybox9.config(state=DISABLED) | |
zazo = end - gutsch | |
erto = (math.floor(float(zazo) * 100) / 100) | |
entrybox11.insert(0, erto) | |
btnrech = Button(Mainframe2, font=('arial', 10, 'bold'), text='Berechnen', bd=4, bg='Green', pady=1, | |
padx=24, | |
width=3, height=1, command=neubrechnen) | |
btnrech.place(x=1065, y=295) | |
global call | |
global call1 | |
call = [] | |
call1 = [] | |
##################################################### Fritzcaller ##################################################### | |
def fritz() : | |
global call, call1 | |
cono = sqlite3.connect('journal.sqlite') | |
curo = cono.cursor() | |
curo.execute('select areacode,number from calls ORDER BY uuid DESC ') | |
cico = curo.fetchone() | |
call1.clear() | |
sarmi = str(cico).replace('(', '').replace("'", "").replace(' ', '').replace(')', '').replace(',', '') | |
call1.append(sarmi) | |
if call != call1 : | |
for saro in call1 : | |
TelefonnummerE.insert(0, '0' + saro) | |
TelefonnummerE.focus_force() | |
press('enter') | |
call1.clear() | |
call.clear() | |
call1.append(saro) | |
call.append(saro) | |
Timer(5, fritz).start() | |
else : | |
Timer(5, fritz).start() | |
fritz() | |
# isdn = Button(Mainframe1, text='ISDN', bg='blue', font=("ARIEL", 8, 'bold'), command=fritz) | |
# isdn.place(x=120, y=10) | |
##################################################### Tree view Bestellung ############################################ | |
style = ttk.Style() | |
style.theme_use("clam") | |
style.configure("Treeview", background='white', foreground="black", rowheight=25, font=("ARIEL", 9, 'bold'), | |
fieldbackground="silver") | |
style.map('Treeview', background=[('selected', 'red')]) | |
style.configure("Treeview.Heading", font=('bold', 12)) | |
style.configure("Treeview.column", font=('bold', 6)) | |
style.configure('Treeview', rowheight=40) | |
style.configure('Treeview.row', font=('bold', 20)) | |
BestellTree = ttk.Treeview(Mainframe3) | |
BestellTree['columns'] = ("pos", "Grosse", "Anzahl", "Nr", "Speise", "Mit", "Ohne", "Katagorie", "Preis",) | |
BestellTree.column("#0", width=0, stretch=NO) | |
BestellTree.column("pos", anchor=CENTER, width=40, stretch=TRUE, ) | |
BestellTree.column("Grosse", anchor=CENTER, width=80) | |
BestellTree.column("Anzahl", anchor=CENTER, width=35) | |
BestellTree.column("Nr", anchor=CENTER, width=35) | |
BestellTree.column("Speise", anchor=W, width=140) | |
BestellTree.column("Mit", anchor=W, width=500, stretch=TRUE) | |
BestellTree.column("Ohne", anchor=W, width=180, stretch=TRUE) | |
BestellTree.column("Katagorie", anchor=CENTER, width=100) | |
BestellTree.column("Preis", anchor=CENTER, width=60) | |
BestellTree.tag_configure('pos', background='gray') | |
BestellTree.heading("#0", text="", anchor=W) | |
BestellTree.heading("pos", text="pos", anchor=W) | |
BestellTree.heading("Grosse", text="Grosse", anchor=W) | |
BestellTree.heading("Anzahl", text="Anzahl", anchor=W) | |
BestellTree.heading("Nr", text="Nr", anchor=W) | |
BestellTree.heading("Speise", text="Speise", anchor=CENTER) | |
BestellTree.heading("Mit", text="Mit", anchor=CENTER) | |
BestellTree.heading("Ohne", text="Ohne", anchor=CENTER) | |
BestellTree.heading("Katagorie", text="Katagorie", anchor=CENTER) | |
BestellTree.heading("Preis", text="Preis", anchor=W) | |
# ################################ Delete all Data ######################################################## | |
def remove_all1() : | |
global count | |
update(toppings) | |
mos = 0 | |
miko = messagebox.askyesno('Abbrechen', 'wollen sie wirklich abbrechen') | |
for i in BestellTree.get_children() : | |
if not BestellTree.item(i, "values") : | |
mos = 0 | |
else : | |
mos = 1 | |
if miko == 1 : | |
if mos == 0 : | |
resetall() | |
entrybox1.delete(0, END) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, 0.0) | |
count = 0 | |
Mainframe2.grid_forget() | |
Mainframe3.place_forget() | |
KundenidE.configure(state=NORMAL) | |
TelefonnummerE.configure(state=NORMAL) | |
NameE.configure(state=NORMAL) | |
AdresseE.configure(state=NORMAL) | |
HauesnrE.configure(state=NORMAL) | |
PLZE.configure(state=NORMAL) | |
ORTE.configure(state=NORMAL) | |
EmailE.configure(state=NORMAL) | |
liefer.config(state=NORMAL) | |
liefer1.config(state=NORMAL) | |
reset() | |
elif mos != 0 : | |
for record in BestellTree.get_children() : | |
BestellTree.delete(record) | |
resetall() | |
entrybox1.delete(0, END) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, 0.0) | |
count = 0 | |
Mainframe2.grid_forget() | |
Mainframe3.place_forget() | |
KundenidE.configure(state=NORMAL) | |
TelefonnummerE.configure(state=NORMAL) | |
NameE.configure(state=NORMAL) | |
AdresseE.configure(state=NORMAL) | |
HauesnrE.configure(state=NORMAL) | |
PLZE.configure(state=NORMAL) | |
ORTE.configure(state=NORMAL) | |
EmailE.configure(state=NORMAL) | |
reset() | |
else : | |
pass | |
# ----------------------------------------------------------------------------------------------------------------# | |
def remove_all() : | |
global count, mos | |
update(toppings) | |
mos = 0 | |
for i in BestellTree.get_children() : | |
if not BestellTree.item(i, "values") : | |
mos = 0 | |
else : | |
mos = 1 | |
if mos == 0 : | |
resetall() | |
entrybox1.delete(0, END) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, 0.0) | |
count = 0 | |
Mainframe2.grid_forget() | |
Mainframe3.place_forget() | |
KundenidE.configure(state=NORMAL) | |
TelefonnummerE.configure(state=NORMAL) | |
NameE.configure(state=NORMAL) | |
AdresseE.configure(state=NORMAL) | |
HauesnrE.configure(state=NORMAL) | |
PLZE.configure(state=NORMAL) | |
ORTE.configure(state=NORMAL) | |
EmailE.configure(state=NORMAL) | |
reset() | |
elif mos != 0 : | |
for record in BestellTree.get_children() : | |
BestellTree.delete(record) | |
resetall() | |
entrybox1.delete(0, END) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, 0.0) | |
count = 0 | |
Mainframe2.grid_forget() | |
Mainframe3.place_forget() | |
KundenidE.configure(state=NORMAL) | |
TelefonnummerE.configure(state=NORMAL) | |
NameE.configure(state=NORMAL) | |
AdresseE.configure(state=NORMAL) | |
HauesnrE.configure(state=NORMAL) | |
PLZE.configure(state=NORMAL) | |
ORTE.configure(state=NORMAL) | |
EmailE.configure(state=NORMAL) | |
reset() | |
else : | |
pass | |
Bestellungabb = Button(Mainframe3, font=("Helvetica", 11 | |
, 'bold'), text='Bestellung abbrechen', bd=4, bg='red', | |
command=remove_all1) | |
Bestellungabb.place(x=20, y=5) | |
# ################################ eine Speise HInzüfugen #################################################### | |
global count, pos | |
global counts | |
count = 0 | |
counts = 1 | |
pos = 1 | |
def insertdatatree() : | |
global counts | |
global clicked | |
global count | |
global pos | |
global sop | |
global labo | |
global tako | |
global lop | |
global sip | |
count += 1 | |
nop = [] | |
sop = [] | |
lop = [] | |
kom = [] | |
sip = (listbox2.get(0, END)) | |
ton = clicked.get() | |
fibo = entrybox1.get() | |
komm = entrybox12.get() | |
for i in sip : | |
o = str(i) | |
o.replace("'", ' ') | |
try : | |
if o[0] == '+' : | |
sop.append(o) | |
elif o[0] == '*' : | |
kom.append(o) | |
else : | |
lop.append(o) | |
except : | |
pass | |
tip = listbox3.get(0, END) | |
for he in tip : | |
hes = str(he) | |
hes.strip() | |
hes.split() | |
hos = hes.replace('{', '').replace('}', '').replace('/', '').replace('(', '').replace(')', '').replace( | |
"'", '').replace("'", '') | |
if hos != '' : | |
nop.append(hos) | |
nip = ' '.join(nop) | |
ohne = str(nip) | |
labo = (float(entrybox6.get())) | |
tako = (float(entrybox11.get())) | |
entrybox11.delete(0, END) | |
mado = int(entrybox4.get()) | |
kat = str(entrybox5.get()) | |
kat.strip() | |
mido = labo * mado | |
tiko = (math.floor(float(mido) * 100) / 100) | |
BestellTree.insert(parent='', open=False, index='end', iid=counts, text='', | |
values=(count, ton, entrybox4.get(), | |
entrybox3.get(), entrybox1.get(), | |
sop + kom, ohne, kat, tiko)) | |
pos += 1 | |
if komm != '' : | |
BestellTree.insert(counts, index=counts, | |
values=('', '', '', '', '', komm)) | |
counts += 1 | |
entrybox11.insert(0, math.floor(float(mido + tako) * 100) / 100) | |
entrybox12.delete(0, END) | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def bestätigens() : | |
global counts | |
global posent | |
global bestätigen | |
global clicked | |
global count | |
global pos | |
global labo | |
global tako | |
global lop | |
global sip | |
global sop | |
global nop | |
entrybox1.config(state=NORMAL) | |
entrybox3.config(state=NORMAL) | |
selected = BestellTree.focus() | |
values = BestellTree.item(selected, 'values') | |
one = posent.get() | |
nop = [] | |
sop = [] | |
lop = [] | |
hob = [] | |
kommk = [] | |
komm = entrybox12.get() | |
sip = (listbox2.get(0, END)) | |
ton = clicked.get() | |
for i in sip : | |
o = str(i) | |
o.replace("'", '') | |
try : | |
if o[0] == '+' : | |
sop.append(o) | |
elif o[0] == '*' : | |
kommk.append(o) | |
else : | |
lop.append(o) | |
except : | |
pass | |
tip = listbox3.get(0, END) | |
tip = listbox3.get(0, END) | |
for he in tip : | |
hes = str(he) | |
hes.strip() | |
if hes != '' : | |
nop.insert(0, hes) | |
for tiz in nop : | |
tiz.strip() | |
labo = (float(entrybox6.get())) | |
tako = (float(entrybox11.get())) | |
entrybox11.delete(0, END) | |
mado = int(entrybox4.get()) | |
mido = labo * mado | |
tiko = (math.floor(float(mido) * 100) / 100) | |
BestellTree.item(selected, text='', values=(one, ton, entrybox4.get(), | |
entrybox3.get(), entrybox1.get(), | |
sop + kommk, nop, entrybox5.get(), tiko)) | |
if komm != '' : | |
BestellTree.insert(counts, index=counts, | |
values=('', '', '', '', '', komm)) | |
entrybox11.insert(0, math.floor((mido + tako) * 100) / 100) | |
counts += 1 | |
einfugen['state'] = ACTIVE | |
Reset['state'] = ACTIVE | |
bestätigen.destroy() | |
posent.destroy() | |
entrybox4.delete(0, END) | |
entrybox4.insert(0, '1') | |
entrybox2.delete(0, END) | |
entrybox1.delete(0, END) | |
listbox3.delete(0, END) | |
listbox2.delete(0, END) | |
entrybox3.delete(0, END) | |
entrybox5.delete(0, END) | |
entrybox6.delete(0, END) | |
entrybox12.delete(0, END) | |
clicked.set('klein') | |
for i in BestellTree.selection() : | |
BestellTree.selection_remove(i) | |
# ################################# eine speise bearbeiten ############################################### | |
def speisebearbeiten() : | |
global counts | |
global lop | |
global nop | |
global bestätigen | |
global sop | |
global einfugen | |
global Reset | |
global posent | |
siko = BestellTree.get_children() | |
zablo = len(siko) | |
if zablo == 0 : | |
messagebox.showerror('Error', 'diese action ist nicht gültig') | |
else : | |
nop = [] | |
counts -= 1 | |
einfugen['state'] = DISABLED | |
Reset['state'] = DISABLED | |
bestätigen = Button(Mainframe3, text='Bestätigen', font=font_size, bd=4, bg='green', | |
command=bestätigens) | |
bestätigen.place(x=660, y=5) | |
posent = Entry(Mainframe3, width=3, bd=4, font=font_size) | |
posent.place(x=580, y=5) | |
resetall() | |
selected = BestellTree.focus() | |
values = BestellTree.item(selected, 'values') | |
alo = BestellTree.get_children(selected) | |
child = BestellTree.item(alo, 'values') | |
entrybox12.delete(0, END) | |
entrybox4.delete(0, END) | |
entrybox4.insert(0, values[2]) | |
entrybox3.insert(0, values[3]) | |
entrybox3.config(state=DISABLED) | |
entrybox1.insert(0, values[4]) | |
entrybox1.config(state=DISABLED) | |
sqlCon1 = sqlite3.connect('ZutatenListe.db') | |
vur = sqlCon1.cursor() | |
nado = values[4] | |
solo = [values[6]] | |
for i in solo : | |
nop.insert(0, i) | |
for to in nop : | |
sopo = ''.join(to).split() | |
for sipo in sopo : | |
listbox3.insert(0, sipo) | |
soso = solo[1 :] | |
vur.execute("select* from zutaten where SpeiseName=(?)", (nado,)) | |
farto = vur.fetchall() | |
for ziko in farto : | |
if (ziko[1] != '') and (ziko[1] not in sopo) : | |
listbox2.insert(END, ziko[1]), | |
if (ziko[2] != '') and (ziko[2] not in sopo) : | |
listbox2.insert(END, ziko[2]), | |
if (ziko[3] != '') and (ziko[3] not in sopo) : | |
listbox2.insert(END, ziko[3]), | |
if (ziko[4] != '') and (ziko[4] not in sopo) : | |
listbox2.insert(END, ziko[4]), | |
if (ziko[5] != '') and (ziko[5] not in sopo) : | |
listbox2.insert(END, ziko[5]), | |
if (ziko[6] != '') and (ziko[6] not in sopo) : | |
listbox2.insert(END, ziko[6]), | |
if (ziko[7] != '') and (ziko[7] not in sopo) : | |
listbox2.insert(END, ziko[7]), | |
if (ziko[8] != '') and (ziko[8] not in sopo) : | |
listbox2.insert(END, ziko[8]), | |
if (ziko[9] != '') and (ziko[9] not in sopo) : | |
listbox2.insert(END, ziko[9]), | |
if (ziko[10] != '') and (ziko[10] not in sopo) : | |
listbox2.insert(END, ziko[10]) | |
if child != '' : | |
entrybox12.insert(0, child[5]) | |
posent.insert(0, values[0]) | |
salo = [values[5]] | |
for izo in salo : | |
izoz = ''.join(izo).split() | |
for oko in izoz : | |
listbox2.insert(END, oko) | |
entrybox5.insert(0, values[7]) | |
selko = float(values[8]) | |
felko = float(values[2]) | |
niko = selko / felko | |
entrybox6.insert(0, niko) | |
num = float(entrybox11.get()) | |
neu = float(num) - float(values[8]) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, math.floor(float(neu) * 100) / 100) | |
clicked.set(values[1]) | |
bearbeiten = Button(Mainframe3, text='Bearbeiten', font=font_size, bd=4, bg='grey', command=speisebearbeiten) | |
bearbeiten.place(x=450, y=5) | |
BestellTree.pack(pady=50) | |
Mainframe2.grid_forget() | |
Mainframe3.place_forget() | |
# ------------------------------------- eine Speise Löschen ---------------------------------------------# | |
def speiselöschen() : | |
global counts | |
global count | |
siko = BestellTree.get_children() | |
zablo = len(siko) | |
if zablo == 0 : | |
messagebox.showerror('Error', 'diese action ist nicht gültig') | |
else : | |
selected = BestellTree.focus() | |
values = BestellTree.item(selected, 'values') | |
bako = float(entrybox11.get()) | |
nako = float(values[8]) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, math.floor((bako - nako) * 100) / 100) | |
one = BestellTree.selection()[0] | |
BestellTree.delete(one) | |
speiselösch = Button(Mainframe3, font=("Helvetica", 12, 'bold'), text=' Speise Löschen', bd=4, bg='orange', | |
command=speiselöschen) | |
speiselösch.place(x=300, y=5) | |
# ----------------------------------------------- Berchnen ABBRECHEN ---------------------------------------------------# | |
def berechabbrech() : | |
entrybox10.config(state=NORMAL) | |
entrybox9.config(state=NORMAL) | |
entrybox8.config(state=NORMAL) | |
entrybox10.delete(0, END) | |
entrybox9.delete(0, END) | |
entrybox8.delete(0, END) | |
entrybox10.insert(0, float(0.0)) | |
entrybox9.insert(0, float(0.0)) | |
entrybox8.insert(0, float(0.0)) | |
floats = [] | |
for line in BestellTree.get_children() : | |
sick108 = (BestellTree.item(line[0])['values'][8]) | |
floats.insert(0, float(sick108)) | |
total = math.fsum(floats) | |
entrybox11.delete(0, END) | |
entrybox11.insert(0, total) | |
btnrechab = Button(Mainframe2, font=('arial', 10, 'bold'), text='Abbrechen', bd=4, bg='red', pady=1, | |
padx=24, | |
width=3, height=1, command=berechabbrech) | |
btnrechab.place(x=972, y=295) | |
##################################### Bestellung Data und Drücken ########################################### | |
def addbestellungdata() : | |
global text1, coto | |
mos = 0 | |
for i in BestellTree.get_children() : | |
if not BestellTree.item(i, "values") : | |
mos = 0 | |
else : | |
mos = 1 | |
if mos == 0 : | |
messagebox.showerror('ERROR', 'Bitte Mindesten eine Speise Aüswahlen') | |
else : | |
conn12 = sqlite3.connect('Einstellung.db') | |
cur12 = conn12.cursor() | |
cur12.execute(' select * from Lieferzuschlg ') | |
cob = cur12.fetchall() | |
for ido in cob : | |
for ako in ido : | |
float(ako) | |
floats = [] | |
moks = [] | |
for line in BestellTree.get_children() : | |
sick108 = (BestellTree.item(line[0])['values'][8]) | |
floats.insert(0, float(sick108)) | |
total = math.fsum(floats) | |
if float(total) < float(ako) : | |
mok = messagebox.askyesno("Lieferzuschlag", "soll lieferzuschlag gerechnet werden ?") | |
if mok == 1 : | |
sos = entrybox11.get() | |
entrybox11.delete(0, END) | |
schlag = float(ako) - float(sos) | |
moks.append(schlag) | |
entrybox11.insert(0, float(ako)) | |
else : | |
moks.insert(0, 0) | |
sick1 = KundenidE.get() | |
sick2 = TelefonnummerE.get() | |
sick3 = NameE.get() | |
sick4 = AdresseE.get() | |
sick5 = HauesnrE.get() | |
sick6 = PLZE.get() | |
sick7 = ORTE.get() | |
sick8 = EmailE.get() | |
sick9 = passo[1] | |
comment = ext_comment.get(1.0, END) | |
timed = datetime.now().strftime("%d-%m-%y %H:%M:%S") + ' Uhr' | |
moss = (BestellTree.get_children()) | |
long = (len(moss)) | |
sol = [] | |
entrybox10.config(state=NORMAL) | |
entrybox9.config(state=NORMAL) | |
entrybox8.config(state=NORMAL) | |
entrybox7.config(state=NORMAL) | |
for line in BestellTree.get_children() : | |
sick100 = (BestellTree.item(line[0])['values'][0]) | |
sick101 = (BestellTree.item(line[0])['values'][1]) | |
sick102 = (BestellTree.item(line[0])['values'][2]) | |
sick103 = (BestellTree.item(line[0])['values'][3]) | |
sick104 = (BestellTree.item(line[0])['values'][4]) | |
sick105 = (BestellTree.item(line[0])['values'][5]) | |
sick106 = (BestellTree.item(line[0])['values'][6]) | |
sick107 = (BestellTree.item(line[0])['values'][7]) | |
sick108 = (BestellTree.item(line[0])['values'][8]) | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn1.cursor() | |
cur1.execute("""INSERT into speiseinfo (zeit,pos,grosse,anzahl,nr,speise,mit,ohne,katagorie,preis,name)VALUES(:zeit, | |
:pos,:grosse,:anzahl,:nr, | |
:speise,:mit,:ohne,:katagorie,:preis,:name)""", { | |
'zeit' : timed, | |
'pos' : sick100, | |
'grosse' : sick101, | |
'anzahl' : sick102, | |
'nr' : sick103, | |
'speise' : sick104, | |
'mit' : sick105 + ' ', | |
'ohne' : sick106, | |
'katagorie' : sick107, | |
'preis' : sick108, | |
'name' : sick3 | |
}) | |
conn1.commit() | |
sick11 = entrybox11.get() | |
sick12 = LieferE.get() | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute("""INSERT into kundeinfo (ID,kid,ktelefonnummer,kname,kstrasse,khausnr, | |
kplz,kort,kemail,bediener,zeit,bestellzeit,externinfo,gesamtepreis) | |
VALUES(NULL,?,?,?,?,?,?,?,?,?,?,?,?,?)""", | |
(sick1, | |
sick2, | |
sick3, | |
sick4, | |
sick5, | |
sick6, | |
sick7, | |
sick8, | |
sick9, | |
timed, | |
sick12, | |
comment, | |
sick11 | |
)) | |
conn.commit() | |
cur.execute('select* from kundeinfo') | |
cur1.execute('select* from speiseinfo where zeit=(?) ', (timed,)) | |
zob = cur1.fetchall() | |
hob = cur.fetchall() | |
hib = len(hob) | |
hub = hib + 1 | |
sor = (BestellTree.get_children()) | |
coto = 0 | |
def printing101() : | |
global logo1, coto, text1, mok, imag12, imag13, iamg14 | |
mit = [] | |
alle = [] | |
mab = [] | |
gesamt = [] | |
lon = [] | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Katagorie ') | |
fur = cur.fetchall() | |
for kat in fur : | |
top = str(kat) | |
replace = {'[' : '', | |
']' : '', | |
'(' : '', | |
')' : '', | |
',' : '', | |
"'" : ''} | |
tops = top.translate(str.maketrans(replace)) | |
alle.insert(0, tops) | |
sicked = BestellTree.get_children() | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
mab.insert(0, sick107) | |
text1.delete(1.0, END) | |
text1.insert(END, f'\t \n') | |
try : | |
imag12 = Image.open('DruckerBild.jpg') | |
imag12.save('12345.jpg') | |
imag13 = imag12.resize((200, 120)) | |
imag14 = imag13.convert('L') | |
imag14.save('DruckerBild12.png') | |
logo1 = PhotoImage(file='DruckerBild12.png') | |
text1.image_create(1.22, image=logo1) | |
except : | |
messagebox.showinfo('Drucker', 'Foto für den Drucker hinzufugen (DruckerBild)(jpg)') | |
text1.insert(END, f'\n\t--BISTRORANT PAPRIKA-- \n') | |
text1.insert(END, f'\n===================================') | |
text1.insert(END, f'\n{timed}\t\t\tBes_nr:{hub}') | |
text1.insert(END, f'\n\n\n kd:{sick1}\t\ttel:{sick2}') | |
text1.insert(END, f'\n{sick3}') | |
text1.insert(END, f'\n{sick4}\t\t{sick5}') | |
text1.insert(END, f'\n{sick6}\t\t{sick7}') | |
text1.insert(END, f'\n===================================') | |
if alle[0] in mab : | |
sob = mab.count(alle[0]) | |
text1.insert(END, f'\n\t------------{alle[0]}------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[0] : | |
text1.insert(END, f'\n{sick102}x)\t{sick104}\t({sick101}) {sick108}€') | |
if sick105 != "" : | |
text1.config(font=('arial', 10, 'bold')) | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
if alle[1] in mab : | |
sob = mab.count(alle[1]) | |
text1.insert(END, f'\n\t---------------{alle[1]}----------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[1] : | |
text1.insert(END, f'\n{sick102}x)\t{sick104}\t({sick101}) {sick108}€') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
if alle[2] in mab : | |
sob = mab.count(alle[2]) | |
text1.insert(END, f'\n\t-----------------{alle[2]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[2] : | |
text1.insert(END, f'\n\t{sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
try : | |
if alle[3] in mab : | |
sob = mab.count(alle[3]) | |
text1.insert(END, f'\n\t-----------------{alle[3]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[3] : | |
text1.insert(END, f'\n\t{sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
except : | |
pass | |
try : | |
if alle[4] in mab : | |
sob = mab.count(alle[4]) | |
text1.insert(END, f'\n\t-----------------{alle[4]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[4] : | |
text1.insert(END, f'\n\t {sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
except : | |
pass | |
text1.insert(END, f"\n===================================") | |
text1.insert(END, f"\n\t\t Gesamtpreis:\t{sick11}€") | |
for ito in moks : | |
if int(ito) > 1 : | |
text1.insert(END, f"\n\t\t Lieferzuschlag:\t{str(ito).replace('[', '').replace(']', '')}€") | |
label = Label(new_window2, bg='white', text='howdy', bd=0, font=('arial', 10, 'bold')) | |
text1.place(x=1140, y=28) | |
coto += 1 | |
if AdresseE.get() != 'ABHOLUNG' : | |
liefer1.config(fg='red') | |
liefer1.config(state=NORMAL) | |
liefer.config(state=NORMAL) | |
q = text1.get("1.0", "end-1c") | |
print(q) | |
filename = tempfile.mktemp(".txt") | |
open(filename, 'w').write(q) | |
os.startfile(filename, "print") | |
def printing() : | |
global logo1, coto, text1, mok, imag12, imag13, iamg14 | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from printer1') | |
mik = cur.fetchall() | |
listi = [] | |
listo = [] | |
for ray in mik : | |
if ray[0] != '' : | |
listo.insert(0, ray[0]) | |
if ray[1] != '' or [] : | |
listo.insert(0, ray[1]) | |
if ray[2] != '' or [] : | |
listo.insert(0, ray[2]) | |
if ray[3] != '' or [] : | |
listo.insert(0, ray[3]) | |
if ray[4] != '' or [] : | |
listo.insert(0, ray[4]) | |
if ray[5] != '' or [] : | |
listo.insert(0, ray[5]) | |
if ray[6] != '' or [] : | |
listo.insert(0, ray[6]) | |
if ray[7] != '' or [] : | |
listo.insert(0, ray[7]) | |
if ray[8] != '' : | |
listo.insert(0, ray[8]) | |
if ray[9] != '' : | |
listo.insert(0, ray[9]) | |
if ray[10] != '' : | |
listo.insert(0, ray[10]) | |
for iop in listo : | |
result = str(iop).replace('[', '').replace(']', '').replace('(', '').replace(')', | |
'').replace( | |
',', '').replace("'", "").replace(' ', '') | |
if result != '' : | |
listi.insert(0, result) | |
print(listi) | |
mit = [] | |
alle = [] | |
mab = [] | |
gesamt = [] | |
lon = [] | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Katagorie ') | |
fur = cur.fetchall() | |
for kat in fur : | |
top = str(kat) | |
replace = {'[' : '', | |
']' : '', | |
'(' : '', | |
')' : '', | |
',' : '', | |
"'" : ''} | |
tops = top.translate(str.maketrans(replace)) | |
if tops in listi : | |
alle.insert(0, tops) | |
tol = len(alle) | |
print(alle) | |
print(tol) | |
if tol < 1 : | |
pass | |
else : | |
sicked = BestellTree.get_children() | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
mab.insert(0, sick107) | |
text1.delete(1.0, END) | |
text1.insert(END, f'\t \n') | |
try : | |
imag12 = Image.open('DruckerBild.jpg') | |
imag12.save('12345.jpg') | |
imag13 = imag12.resize((200, 120)) | |
imag14 = imag13.convert('L') | |
imag14.save('DruckerBild12.png') | |
logo1 = PhotoImage(file='DruckerBild12.png') | |
text1.image_create(1.22, image=logo1) | |
except : | |
messagebox.showinfo('Drucker', 'Foto für den Drucker hinzufugen (DruckerBild)(jpg)') | |
text1.insert(END, f'\n\t--BISTRORANT PAPRIKA-- \n') | |
text1.insert(END, f'\n===================================') | |
text1.insert(END, f'\n{timed}\t\t\tBes_nr:{hub}') | |
text1.insert(END, f'\n\n\n kd:{sick1}\t\ttel:{sick2}') | |
text1.insert(END, f'\n{sick3}') | |
text1.insert(END, f'\n{sick4}\t\t{sick5}') | |
text1.insert(END, f'\n{sick6}\t\t{sick7}') | |
text1.insert(END, f'\n===================================') | |
if alle[0] in mab : | |
sob = mab.count(alle[0]) | |
text1.insert(END, f'\n\t------------{alle[0]}------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[0] : | |
text1.insert(END, f'\n{sick102}x)\t{sick104}\t({sick101}) {sick108}€') | |
if sick105 != "" : | |
text1.config(font=('arial', 10, 'bold')) | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
if tol > 1 : | |
if alle[1] in mab : | |
sob = mab.count(alle[1]) | |
text1.insert(END, f'\n\t---------------{alle[1]}----------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[1] : | |
text1.insert(END, f'\n{sick102}x)\t{sick104}\t({sick101}) {sick108}€') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
else : | |
pass | |
if tol > 2 : | |
if alle[2] in mab : | |
sob = mab.count(alle[2]) | |
text1.insert(END, f'\n\t-----------------{alle[2]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[2] : | |
text1.insert(END, f'\n\t{sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
else : | |
pass | |
try : | |
if alle[3] in mab : | |
sob = mab.count(alle[3]) | |
text1.insert(END, f'\n\t-----------------{alle[3]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[3] : | |
text1.insert(END, f'\n\t{sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
except : | |
pass | |
try : | |
if alle[4] in mab : | |
sob = mab.count(alle[4]) | |
text1.insert(END, f'\n\t-----------------{alle[4]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[4] : | |
text1.insert(END, f'\n\t {sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
except : | |
pass | |
text1.insert(END, f"\n===================================") | |
text1.insert(END, f"\n\t\t Gesamtpreis:\t{sick11}€") | |
for ito in moks : | |
if int(ito) > 1 : | |
text1.insert(END, | |
f"\n\t\t Lieferzuschlag:\t{str(ito).replace('[', '').replace(']', '')}€") | |
label = Label(new_window2, bg='white', text='howdy', bd=0, font=('arial', 10, 'bold')) | |
text1.place(x=1140, y=28) | |
coto += 1 | |
if AdresseE.get() != 'ABHOLUNG' : | |
liefer1.config(fg='red') | |
liefer1.config(state=NORMAL) | |
liefer.config(state=NORMAL) | |
printerdef = StringVar() | |
printerdef = str(listi[0]) | |
def zobli() : | |
q = text1.get("1.0", "end-1c") | |
print(q) | |
filename = tempfile.mktemp(".txt") | |
open(filename, 'w').write(q) | |
p = win32print.OpenPrinter(printerdef) | |
job = win32print.StartDocPrinter(p, 1, (filename, None, "RAW")) | |
win32print.StartPagePrinter(p) | |
win32print.WritePrinter(p, q.encode()) | |
win32print.EndPagePrinter(p) | |
filename = tempfile.mktemp(".txt") | |
zobli() | |
def printing1() : | |
global logo1, coto, text1, mok, imag12, imag13, iamg14 | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from printer2') | |
mik = cur.fetchall() | |
listi = [] | |
listo = [] | |
for ray in mik : | |
if ray[0] != '' : | |
listo.insert(0, ray[0]) | |
if ray[1] != '' or [] : | |
listo.insert(0, ray[1]) | |
if ray[2] != '' or [] : | |
listo.insert(0, ray[2]) | |
if ray[3] != '' or [] : | |
listo.insert(0, ray[3]) | |
if ray[4] != '' or [] : | |
listo.insert(0, ray[4]) | |
if ray[5] != '' or [] : | |
listo.insert(0, ray[5]) | |
if ray[6] != '' or [] : | |
listo.insert(0, ray[6]) | |
if ray[7] != '' or [] : | |
listo.insert(0, ray[7]) | |
if ray[8] != '' : | |
listo.insert(0, ray[8]) | |
if ray[9] != '' : | |
listo.insert(0, ray[9]) | |
if ray[10] != '' : | |
listo.insert(0, ray[10]) | |
for iop in listo : | |
result = str(iop).replace('[', '').replace(']', '').replace('(', '').replace(')', | |
'').replace( | |
',', '').replace("'", "").replace(' ', '') | |
if result != '' : | |
listi.insert(0, result) | |
print(listi) | |
mit = [] | |
alle = [] | |
mab = [] | |
gesamt = [] | |
lon = [] | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Katagorie ') | |
fur = cur.fetchall() | |
for kat in fur : | |
top = str(kat) | |
replace = {'[' : '', | |
']' : '', | |
'(' : '', | |
')' : '', | |
',' : '', | |
"'" : ''} | |
tops = top.translate(str.maketrans(replace)) | |
if tops in listi : | |
alle.insert(0, tops) | |
tol = len(alle) | |
if tol < 1 : | |
pass | |
else : | |
sicked = BestellTree.get_children() | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
mab.insert(0, sick107) | |
text1.delete(1.0, END) | |
text1.insert(END, f'\t \n') | |
try : | |
imag12 = Image.open('DruckerBild.jpg') | |
imag12.save('12345.jpg') | |
imag13 = imag12.resize((200, 120)) | |
imag14 = imag13.convert('L') | |
imag14.save('DruckerBild12.png') | |
logo1 = PhotoImage(file='DruckerBild12.png') | |
text1.image_create(1.22, image=logo1) | |
except : | |
messagebox.showinfo('Drucker', 'Foto für den Drucker hinzufugen (DruckerBild)(jpg)') | |
text1.insert(END, f'\n\t--BISTRORANT PAPRIKA-- \n') | |
text1.insert(END, f'\n===================================') | |
text1.insert(END, f'\n{timed}\t\t\tBes_nr:{hub}') | |
text1.insert(END, f'\n\n\n kd:{sick1}\t\ttel:{sick2}') | |
text1.insert(END, f'\n{sick3}') | |
text1.insert(END, f'\n{sick4}\t\t{sick5}') | |
text1.insert(END, f'\n{sick6}\t\t{sick7}') | |
text1.insert(END, f'\n===================================') | |
if alle[0] in mab : | |
sob = mab.count(alle[0]) | |
text1.insert(END, f'\n\t------------{alle[0]}------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[0] : | |
text1.insert(END, f'\n{sick102}x)\t{sick104}\t({sick101}) {sick108}€') | |
if sick105 != "" : | |
text1.config(font=('arial', 10, 'bold')) | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
if tol > 2 : | |
if alle[1] in mab : | |
sob = mab.count(alle[1]) | |
text1.insert(END, f'\n\t---------------{alle[1]}----------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[1] : | |
text1.insert(END, f'\n{sick102}x)\t{sick104}\t({sick101}) {sick108}€') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
else : | |
pass | |
if tol > 2 : | |
if alle[2] in mab : | |
sob = mab.count(alle[2]) | |
text1.insert(END, f'\n\t-----------------{alle[2]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[2] : | |
text1.insert(END, f'\n\t{sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
else : | |
pass | |
try : | |
if alle[3] in mab : | |
sob = mab.count(alle[3]) | |
text1.insert(END, f'\n\t-----------------{alle[3]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[3] : | |
text1.insert(END, f'\n\t{sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
except : | |
pass | |
try : | |
if alle[4] in mab : | |
sob = mab.count(alle[4]) | |
text1.insert(END, f'\n\t-----------------{alle[4]}---------{sob}--') | |
for tom in BestellTree.get_children() : | |
sick100 = (BestellTree.item(tom[0])['values'][0]) | |
sick101 = (BestellTree.item(tom[0])['values'][1]) | |
sick102 = (BestellTree.item(tom[0])['values'][2]) | |
sick103 = (BestellTree.item(tom[0])['values'][3]) | |
sick104 = (BestellTree.item(tom[0])['values'][4]) | |
sick105 = (BestellTree.item(tom[0])['values'][5]) | |
sick106 = (BestellTree.item(tom[0])['values'][6]) | |
sick107 = (BestellTree.item(tom[0])['values'][7]) | |
sick108 = (BestellTree.item(tom[0])['values'][8]) | |
if sick107 == alle[4] : | |
text1.insert(END, f'\n\t {sick102}x\t{sick104}\t({sick101}) {sick108} €') | |
if sick105 != "" : | |
for izo in [sick105] : | |
hozo = str(izo).split(' ') | |
mit.append(hozo) | |
for azo in mit : | |
for tizo in azo : | |
text1.insert(END, f'\n\t{tizo}') | |
mit.clear() | |
text1.insert(END, f'\n\t{sick106}\n') | |
except : | |
pass | |
text1.insert(END, f"\n===================================") | |
text1.insert(END, f"\n\t\t Gesamtpreis:\t{sick11}€") | |
for ito in moks : | |
if int(ito) > 1 : | |
text1.insert(END, | |
f"\n\t\t Lieferzuschlag:\t{str(ito).replace('[', '').replace(']', '')}€") | |
label = Label(new_window2, bg='white', text='howdy', bd=0, font=('arial', 10, 'bold')) | |
text1.place(x=1140, y=28) | |
coto += 1 | |
if AdresseE.get() != 'ABHOLUNG' : | |
liefer1.config(fg='red') | |
liefer1.config(state=NORMAL) | |
liefer.config(state=NORMAL) | |
printerdef = StringVar() | |
printerdef = str(listi[0]) | |
def zobli() : | |
q = text1.get("1.0", "end-1c") | |
print(q) | |
filename = tempfile.mktemp(".txt") | |
open(filename, 'w').write(q) | |
p = win32print.OpenPrinter(printerdef) | |
job = win32print.StartDocPrinter(p, 1, (filename, None, "RAW")) | |
win32print.StartPagePrinter(p) | |
win32print.WritePrinter(p, q.encode()) | |
win32print.EndPagePrinter(p) | |
filename = tempfile.mktemp(".txt") | |
open(filename, "w").write(q) | |
win32api.ShellExecute( | |
0, | |
"print", | |
filename, | |
# | |
# If this is None, the default printer will | |
# be used anyway. | |
# | |
'/d:"%s"' % win32print.GetDefaultPrinter(), | |
".", | |
0 | |
) | |
zobli() | |
printing101() | |
printing() | |
printing1() | |
update(toppings) | |
remove_all() | |
TelefonnummerE.focus_force() | |
end = Button(Mainframe3, text='Drucken', width=8, bg='green', height=2, command=addbestellungdata).place(x=1100, | |
y=490) | |
liefer = Label(Mainframe3, text='Mindestpreise :', bg='white', font=font_size, bd=2) | |
mainloop() | |
######################################################################################################################## | |
frame2 = Frame(bd=4, bg='#315668', width=380, height=121) | |
frame2.place(x=25, y=250) | |
btn = Button(frame2, text="BESTELLUNG", activebackground="blue", bd=12, bg="#183C47", width=20, height=2, | |
font=('Helvetica', 20, | |
"italic bold"), relief=GROOVE, fg="black", command=login) | |
btn.pack(padx=10, pady=10) | |
btn.place(x=0, y=2) | |
############################################seite 2 chef einsetllung################################################################################################################################## | |
def openwindow1() : | |
font_size = ("ARIEL", 10, "bold") | |
global new_window | |
root.wm_state('iconic') | |
global new_window | |
new_window = Toplevel(root) | |
screen_width = root.winfo_screenwidth() | |
screen_height = root.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
new_window.config(bg='#344e5c') | |
lbl = Label(new_window, text="EINSTELLUNG", font=("Ariel", 16, "bold")) | |
Kunden = Button(new_window, text=('Kunden'), bd=12, bg='DarkSlateGray4', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=kundendata) | |
Kunden.grid(column=1, row=1, padx=105, pady=90) | |
Bestellung = Button(new_window, text=('Bestellung'), bd=12, bg='#19596C', width=30, height=6, command=openwindow2, | |
fg="black", | |
relief=GROOVE, activebackground='red', font=font_size) | |
Bestellung.grid(column=2, row=1, padx=105, pady=90) | |
Lieferant = Button(new_window, text=('Zutaten'), bd=12, bg='dark slate grey', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow3) | |
Lieferant.grid(column=3, row=1, padx=105, pady=90) | |
Zutaten_Preise = Button(new_window, text=('Zutaten preise'), bd=12, bg='DarkSlateGray4', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow4) | |
Zutaten_Preise.grid(column=1, row=2, padx=105, pady=90) | |
Diverse_Einstellung = Button(new_window, text=('Diverse Einstellung'), bd=12, bg='#19596C', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow5) | |
Diverse_Einstellung.grid(column=2, row=2, padx=105, pady=90) | |
Bestellung_liste = Button(new_window, text=('Bestellung Liste'), bd=12, bg='dark slate grey', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow6) | |
Bestellung_liste.grid(column=3, row=2, padx=105, pady=90) | |
Liefrante = Button(new_window, text=('Liefranten'), bd=12, bg='#19596C', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow7) | |
Liefrante.grid(column=2, row=3, padx=105, pady=90) | |
Drucker = Button(new_window, text=('Drucker'), bd=12, bg='dark slate grey', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow8) | |
Drucker.grid(column=3, row=3, padx=105, pady=90) | |
Freiezutaten = Button(new_window, text=('Freiezutataen'), bd=12, bg='DarkSlateGray4', width=30, height=6, | |
fg="black", font=font_size, | |
relief=GROOVE, activebackground='red', command=openwindow9) | |
Freiezutaten.grid(column=1, row=3, padx=105, pady=90) | |
firstlabel = Label(new_window, text='-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-', bg='DarkSlateGray4') | |
firstlabel1 = Label(new_window, text='-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-', bg='#19596C') | |
firstlabel2 = Label(new_window, text='-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-', bg='dark slate grey') | |
firstlabel3 = Label(new_window, text='-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-', bg='#19596C') | |
firstlabel.place(x=230, y=223) | |
firstlabel1.place(x=730, y=220) | |
firstlabel2.place(x=1200, y=220) | |
firstlabel3.place(x=730, y=530) | |
######################################### Passwort zu Chef mit functions ############################################ | |
def closepopup() : | |
top.destroy() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def passwortget(event=None) : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Passwort ') | |
Passwort = cur.fetchall() | |
Passwort1 = str(Passwort) | |
Passwort2 = Passwort1.replace("(", "").replace(")", "").replace(",", "").replace("'", "").replace("[", "").replace( | |
"]", "") | |
conn.commit() | |
Password = Passwort2 | |
passwordE = entery.get() | |
if passwordE != Password : | |
MessageBox.showerror("Erorr", "Passwort Falsh") | |
entery.delete(0, END) | |
elif passwordE == Password : | |
openwindow1() | |
closepopup() | |
else : | |
closepopup() | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def popupwin(event=None) : | |
global top | |
top = Toplevel(root) | |
w13 = 350 | |
h13 = 100 | |
top.geometry(f"{w13}x{h13}+{1200}+{400}") | |
top.config(bg='dark slate grey') | |
top.title('CHEF Passwort') | |
global entery | |
entery = Entry(top, show="*", width=25) | |
label1 = Label(top, text="Passwort eingeben", font=("Ariel", 12), bg='dark slate grey') | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def password_enter(e) : | |
passwortget() | |
# ----------------------------------------------------------------------------------------------------------------------# | |
label1.pack() | |
entery.pack() | |
Button1 = Button(top, text="Ok", width=10, command=passwortget) | |
Button2 = Button(top, text="Quit", width=10, command=closepopup) | |
Button1.place(x=40, y=60) | |
Button2.place(x=185, y=60) | |
top.bind("<Return>", passwortget) | |
###################################CHEF SEITE ########################################################################## | |
def kundendata() : | |
roots = Toplevel(root) | |
titlespace = " " | |
roots.title("Kundnen Liste") | |
screen_width = root.winfo_screenwidth() | |
screen_height = root.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
roots.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
###################################################Buttons############################################################# | |
Mainfram = Frame(roots, bd=10, width=1800, height=1800, bg='grey') | |
Mainfram.place(x=0, y=0) | |
Titlefram = Frame(Mainfram, bd=10, width=1200, height=1200, bg='grey') | |
Titlefram.place(x=0, y=0) | |
Topframe = Frame(Titlefram, bd=10, width=1200, height=1200, bg='dark slate grey') | |
Topframe.place(x=0, y=0) | |
Leftframe = Frame(Titlefram, bd=10, width=1200, height=1200, relief=RIDGE, bg='grey') | |
Leftframe.place(x=8, y=340) | |
Leftframe1 = Frame(Mainfram, bd=10, width=1200, height=1200, relief=RIDGE, bg='cadet blue') | |
Leftframe1.place(x=15, y=15) | |
Rightframe = Frame(Mainfram, bd=10, width=1200, height=1200, relief=RIDGE, bg='grey') | |
Rightframe.place(x=1150, y=10) | |
Rightfram1 = Frame(Mainfram, bd=10, width=1200, height=1200, bg='cadet blue', relief=RIDGE) | |
Rightfram1.place(x=890, y=350) | |
###############################################Labels################################################################### | |
lbtitle = Label(Titlefram, font=('arial', 20, 'bold'), text="Kunden Liste", bd=7, bg='grey') | |
lbtitle.place(x=620, y=0) | |
kundenid = Label(Leftframe1, font=('arial', 12, 'bold'), text="Kunden Nummer", bd=7, bg='cadet blue') | |
kundenid.grid(row=1, column=0, sticky='w', padx=5) | |
kundenEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=kundenid, state='normal') | |
kundenEnt.grid(row=1, column=1, sticky='w', padx=5) | |
Name = Label(Leftframe1, font=('arial', 12, 'bold'), text="Vor/Nachname", bd=7, bg='cadet blue') | |
Name.grid(row=2, column=0, sticky='w', padx=5) | |
NameEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', textvariable=Name) | |
NameEnt.grid(row=2, column=1, sticky='w', padx=5) | |
Addresse = Label(Leftframe1, font=('arial', 12, 'bold'), text="Addresse", bd=7, bg='cadet blue') | |
Addresse.grid(row=3, column=0, sticky='w', padx=5) | |
AddresseEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=Addresse) | |
AddresseEnt.grid(row=3, column=1, sticky='w', padx=5) | |
Telefon = Label(Leftframe1, font=('arial', 12, 'bold'), text="Telefonnummer", bd=7, bg='cadet blue') | |
Telefon.grid(row=4, column=0, sticky='w', padx=5) | |
TelefonEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=Telefon) | |
TelefonEnt.grid(row=4, column=1, sticky='w', padx=5) | |
Hausnr = Label(Leftframe1, font=('arial', 12, 'bold'), text="Nr", bd=7, bg='cadet blue') | |
Hausnr.grid(row=5, column=0, sticky='w', padx=5) | |
HausnrEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=Hausnr) | |
HausnrEnt.grid(row=5, column=1, sticky='w', padx=5) | |
PLZ = Label(Leftframe1, font=('arial', 12, 'bold'), text="PLZ", bd=7, bg='cadet blue') | |
PLZ.grid(row=6, column=0, sticky='w', padx=5) | |
PLZEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=PLZ) | |
PLZEnt.grid(row=6, column=1, sticky='w', padx=5) | |
ORT = Label(Leftframe1, font=('arial', 12, 'bold'), text="ORT", bd=7, bg='cadet blue') | |
ORT.grid(row=7, column=0, sticky='w', padx=5) | |
ORTEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=ORT) | |
ORTEnt.grid(row=7, column=1, sticky='w', padx=5) | |
Email = Label(Leftframe1, font=('arial', 12, 'bold'), text="Email", bd=7, bg='cadet blue') | |
Email.grid(row=8, column=0, sticky='w', padx=5) | |
comment = Label(Leftframe1, font=('arial', 12, 'bold'), text="comment", bd=7, bg='cadet blue') | |
comment.grid(row=9, column=0, sticky='w', padx=5) | |
EmailEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=Email) | |
EmailEnt.grid(row=8, column=1, sticky='w', padx=5) | |
CommentEnt = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', | |
textvariable=comment) | |
CommentEnt.grid(row=9, column=1, sticky='w', padx=5) | |
schwarzliste = Label(Rightframe, font=('arial', 16, 'bold'), text="SchwarzeListe", bd=7, bg='dark slate grey', | |
width=20) | |
schwarzliste.place(x=45, y=0) | |
schwarzname = Label(Rightframe, font=('arial', 16, 'bold'), text="Name", bd=7, | |
bg='dark slate grey', ) | |
schwarzname.place(x=40, y=55) | |
schwarztel = Label(Rightframe, font=('arial', 16, 'bold'), text="Tele", bd=7, | |
bg='dark slate grey', ) | |
schwarztel.place(x=240, y=55) | |
schwarzlisteboxn = Listbox(Rightframe, width=15, height=30, bg='#232323', font=('arial', 16, 'bold'), bd=4, | |
fg='white') | |
schwarzlisteboxn.place(x=5, y=90) | |
schwarzlisteboxt = Listbox(Rightframe, width=15, height=30, bg='#232323', font=('arial', 16, 'bold'), bd=4, | |
fg='white') | |
schwarzlisteboxt.place(x=200, y=90) | |
#########################################################Variabels###################################################### | |
kundenid = StringVar() | |
Name = StringVar() | |
Addresse = StringVar() | |
Telefon = StringVar() | |
###############################################kunden liste chef(functions)############################################# | |
def iExit() : | |
iExit = tkinter.messagebox.askyesno("KundenListe", "Sind SIE SICHER") | |
if iExit > 0 : | |
root.destroy() | |
return | |
# ------------------------------------------------------------------------------------------------------------------# | |
def Reset() : | |
kundenEnt.delete(0, END) | |
NameEnt.delete(0, END) | |
AddresseEnt.delete(0, END) | |
TelefonEnt.delete(0, END) | |
HausnrEnt.delete(0, END) | |
PLZEnt.delete(0, END) | |
ORTEnt.delete(0, END) | |
EmailEnt.delete(0, END) | |
CommentEnt.delete(0, END) | |
######################################################################################################################## | |
def addDATA() : | |
con = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
custor = con.cursor() | |
if NameEnt.get() == "" or AddresseEnt.get() == "" or TelefonEnt.get() == "" : | |
tkinter.messagebox.showerror('Error', 'alle felder sind pflichtfelder ') | |
elif NameEnt.get() == "" or AddresseEnt.get() == "" or TelefonEnt.get() == "" in custor : | |
tkinter.messagebox.showerror('kunde exestiert ') | |
else : | |
custor.execute( | |
"insert into Pizaa1(Name,Addresse,Telefon,Nr,PLZ,ORT,Email,int_comment) values(%s,%s,%s,%s,%s,%s,%s,%s)", | |
(NameEnt.get(), | |
AddresseEnt.get(), | |
TelefonEnt.get(), | |
HausnrEnt.get(), | |
PLZEnt.get(), | |
ORTEnt.get(), | |
EmailEnt.get(), | |
CommentEnt.get() | |
)) | |
custor.execute("commit") | |
custor.close() | |
MessageBox.showinfo("!", 'Kunde geschpeichert') | |
Reset() | |
######################################################################################################################## | |
def displaydata() : | |
con = mysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
custor = con.cursor() | |
custor1 = con.cursor() | |
custor1.execute("select * from blacklist") | |
custor.execute("select * from pizaa1") | |
black = custor1.fetchall() | |
schwarzlisteboxn.delete(0, END) | |
schwarzlisteboxt.delete(0, END) | |
for blacks in black : | |
schwarzlisteboxn.insert(0, blacks[1]) | |
schwarzlisteboxt.insert(0, blacks[3]) | |
result = custor.fetchall() | |
if "-" * len(result) != 0 : | |
KUNDENliste.delete(*KUNDENliste.get_children()) | |
for row in result : | |
KUNDENliste.insert('', END, values=row) | |
con.commit() | |
con.close() | |
######################################################################################################################## | |
def TraineeInfo(ev) : | |
viewInfo = KUNDENliste.focus() | |
lerandata = KUNDENliste.item(viewInfo) | |
Reset() | |
row = lerandata['values'] | |
kundenid = kundenEnt.insert(0, row[0]) | |
Name = NameEnt.insert(0, row[1]) | |
Addresse = AddresseEnt.insert(0, row[2]) | |
Telefon = TelefonEnt.insert(0, row[3]) | |
Nr = HausnrEnt.insert(0, row[5]) | |
PLZ = PLZEnt.insert(0, row[6]) | |
ORT = ORTEnt.insert(0, row[7]) | |
Email = EmailEnt.insert(0, row[8]) | |
cmnt = CommentEnt.insert(0, row[4]) | |
######################################################################################################################## | |
def update() : | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
cur.execute( | |
"update pizaa1 set Name=%s,Addresse=%s,Telefon=%s,Nr=%s,PLZ=%s,ORT=%s,Email=%s,int_comment=%s where kundenid=%s ", | |
(NameEnt.get(), | |
AddresseEnt.get(), | |
TelefonEnt.get(), | |
HausnrEnt.get(), | |
PLZEnt.get(), | |
ORTEnt.get(), | |
EmailEnt.get(), | |
CommentEnt.get(), | |
kundenEnt.get() | |
)) | |
sqlCon.commit() | |
sqlCon.close() | |
MessageBox.showinfo("!", 'Daten geandert') | |
######################################################################################################################## | |
def delete() : | |
sqlCon = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
cur.execute("delete from pizaa1 where kundenid=%s", kundenEnt.get()) | |
sqlCon.commit() | |
displaydata() | |
sqlCon.close() | |
Reset() | |
######################################################################################################################## | |
def suche(event=None) : | |
sqlCon = pymysql.connect(host="localhost", user="root", | |
password="A773468810598a", database="Kundendb") | |
cur = sqlCon.cursor() | |
cur.execute("select * from pizaa1 where kundenid=%s ", kundenEnt.get()) | |
kundenEnt.delete(0, END) | |
NameEnt.delete(0, END) | |
AddresseEnt.delete(0, END) | |
TelefonEnt.delete(0, END) | |
HausnrEnt.delete(0, END) | |
PLZEnt.delete(0, END) | |
ORTEnt.delete(0, END) | |
EmailEnt.delete(0, END) | |
CommentEnt.delete(0, END) | |
ar = cur.fetchall() | |
for sag in ar : | |
Kundenid = kundenEnt.insert(0, sag[0]) | |
Name = NameEnt.insert(0, sag[1]) | |
Addresse = AddresseEnt.insert(0, sag[2]) | |
Telefon = TelefonEnt.insert(0, sag[3]) | |
Nr = HausnrEnt.insert(0, sag[5]) | |
PLZ = PLZEnt.insert(0, sag[6]) | |
ORT = ORTEnt.insert(0, sag[7]) | |
Email = EmailEnt.insert(0, sag[8]) | |
CommentEnt.insert(0, row[4]) | |
kundenEnt.configure(state=NORMAL) | |
sqlCon.commit() | |
sqlCon.close() | |
######################################################################################################################## | |
def AddBlackList() : | |
con = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
custor = con.cursor() | |
custor.execute( | |
"insert into blacklist(Name,Addresse,Telefon) values(%s,%s,%s)", | |
(NameEnt.get(), | |
AddresseEnt.get(), | |
TelefonEnt.get(), | |
)) | |
custor.execute("commit") | |
custor.close() | |
MessageBox.showinfo("!", 'Kunde zu BlackList Hinzufügt') | |
Reset() | |
addblacklistB = Button(Titlefram, text='Blacklisten', bg='#232323', fg='white', bd=4, command=AddBlackList) | |
addblacklistB.place(x=600, y=100) | |
######################################################################################################################## | |
def Unlisten() : | |
con = pymysql.connect(host="localhost", user="root", password="A773468810598a", database="Kundendb") | |
custor = con.cursor() | |
arsa = str(schwarzlisteboxn.get(ACTIVE)) | |
print(arsa) | |
custor.execute( | |
"delete from blacklist where Name =%s ", | |
(arsa,)) | |
schwarzlisteboxn.delete(0, END) | |
schwarzlisteboxt.delete(0, END) | |
custor.execute("commit") | |
custor.close() | |
displaydata() | |
unblacklistB = Button(Titlefram, text='unlisten', bg='white', fg='black', bd=4, command=Unlisten) | |
unblacklistB.place(x=1080, y=120) | |
######################################################################################################################## | |
# -------------------------------------------Treeview-----------------------------------------------------# | |
scroll_y = Scrollbar(Leftframe, orient=VERTICAL) | |
KUNDENliste = ttk.Treeview(Leftframe, height=25, columns=( | |
"kundenid", "Name", "Addresse", "Telefon", "cmnt", "HausNr", "PLZ", "ORT", "Email") | |
, yscrollcommand=scroll_y.set) | |
scroll_y.pack(side=RIGHT, fill=Y) | |
KUNDENliste.heading('kundenid', text='Kundenid') | |
KUNDENliste.heading('Name', text='Name') | |
KUNDENliste.heading('Addresse', text='Adresse') | |
KUNDENliste.heading('Telefon', text='Telefon') | |
KUNDENliste.heading('cmnt', text='cmnt') | |
KUNDENliste.heading('HausNr', text='HausNr') | |
KUNDENliste.heading('PLZ', text='PLZ') | |
KUNDENliste.heading('ORT', text='ORT') | |
KUNDENliste.heading('Email', text='Email') | |
KUNDENliste['show'] = 'headings' | |
KUNDENliste.column('kundenid', width=40) | |
KUNDENliste.column('Name', width=120) | |
KUNDENliste.column('Addresse', width=120) | |
KUNDENliste.column('Telefon', width=140) | |
KUNDENliste.column('cmnt', width=0) | |
KUNDENliste.column('HausNr', width=50) | |
KUNDENliste.column('PLZ', width=60) | |
KUNDENliste.column('ORT', width=80) | |
KUNDENliste.column('Email', width=220) | |
KUNDENliste.pack(fill=BOTH, expand=1) | |
KUNDENliste.bind("<Double-Button-1>", TraineeInfo) | |
######################################kunden liste chef (Buttons####################################################### | |
btnHinz = Button(Rightfram1, font=('arial', 12, 'bold'), text='Hinzufügen', bd=4, bg='cadet blue', | |
width=8, height=3, command=addDATA, ) | |
btnHinz.grid(row=0, column=0) | |
btnlösch = Button(Rightfram1, font=('arial', 12, 'bold'), text='Löschen', bd=4, bg='cadet blue', | |
width=8, height=3, command=delete) | |
btnlösch.grid(row=1, column=0) | |
btnupd = Button(Rightfram1, font=('arial', 12, 'bold'), text='update', bd=4, bg='cadet blue', | |
width=8, height=3, command=update) | |
btnupd.grid(row=2, column=0) | |
btnsuche = Button(Rightfram1, font=('arial', 12, 'bold'), text='Suchen', bd=4, bg='cadet blue', | |
width=8, height=3, command=suche) | |
btnsuche.grid(row=3, column=0) | |
btnres = Button(Rightfram1, font=('arial', 12, 'bold'), text='reset', bd=4, bg='cadet blue', | |
width=8, height=3, command=Reset) | |
btnres.grid(row=4, column=0) | |
btnbeen = Button(Rightfram1, font=('arial', 12, 'bold'), text='beenden', bd=4, bg='cadet blue', width=8, height=3, | |
command=iExit) | |
btnbeen.grid(row=5, column=0) | |
btndisplay = Button(Rightfram1, font=('arial', 12, 'bold'), text='Display', bd=4, bg='cadet blue', pady=1, | |
padx=24, | |
width=8, height=3, command=displaydata) | |
btndisplay.grid(row=6, column=0) | |
####################################### Speise liste chef ########################################################### | |
def openwindow2() : | |
new_window2 = Toplevel(root) | |
screen_width = 500 | |
screen_height = 1000 | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window2.geometry("850x700") | |
titlespace = " " | |
new_window2.title(210 * titlespace + "Speisen") | |
new_window2.resizable(width=False, height=False) | |
Mainframe = Frame(new_window2, bd=4, width=None, height=None, relief=RIDGE, bg='#2E424D') | |
Mainframe.place(x=6, y=0) | |
Titlefram = Frame(Mainframe, bd=10, width=None, height=None, relief=RIDGE) | |
Titlefram.grid(row=0, column=0) | |
Topframe = Frame(Mainframe, bd=10, width=None, height=None, relief=RIDGE) | |
Topframe.grid(row=1, column=0) | |
Leftframe = Frame(Topframe, bd=10, width=None, height=None, padx=2, relief=RIDGE, bg='SlateGray4') | |
Leftframe.pack(side=LEFT, expand=True, fill=BOTH) | |
Leftframe1 = Frame(Leftframe, bd=10, width=None, height=None, relief=RIDGE, bg='SlateGray4') | |
Leftframe1.pack(side=TOP, padx=0, pady=0, expand=True, fill=BOTH) | |
Rightfram1 = Frame(Topframe, bd=10, width=None, height=None, bg='SlateGray4', ) | |
Rightfram1.pack(side=RIGHT, expand=True, fill=BOTH) | |
Name = StringVar() | |
Nummer = StringVar() | |
Kategorie = StringVar() | |
Preis = StringVar() | |
k_g = StringVar() | |
conn = sqlite3.connect('speisekarte1.db') | |
cur = conn.cursor() | |
##################################speise liste chef(Funktions)###################################################### | |
def addspeisen() : | |
siko = PreisE.get() | |
if NameE.get() == ('') or Nummer1.get() == ('') or clicked.get() == ('') or PreisE.get() == ( | |
'') or K_G2.get() == ('') : | |
tkinter.messagebox.showerror('Erorr', 'Alle felder sind pflicht') | |
elif ',' in siko : | |
messagebox.showerror('Error', 'beim Preis muss ein Punkt sein und nicht ein comma') | |
PreisE.delete(0, END) | |
else : | |
conn = sqlite3.connect('speisekarte1.db') | |
cur = conn.cursor() | |
saldo = str(NameE.get()) | |
saldo1 = saldo.strip() | |
sako = clicked.get() | |
cur.execute( | |
"insert into Speisen values(?,?,?,?,?)", | |
(saldo1, | |
Nummer1.get(), | |
sako, | |
PreisE.get(), | |
K_G2.get() | |
)) | |
reset1() | |
conn.commit() | |
conn.close() | |
######################################################################################################################## | |
conn = sqlite3.connect('speisekarte1.db') | |
cur = conn.cursor() | |
cur.execute("DELETE FROM Speisen WHERE Name IS NULL OR trim(Name) = ''") | |
conn.commit() | |
def displaydata1() : | |
con = sqlite3.connect('speisekarte1.db') | |
custor = con.cursor() | |
custor.execute( | |
"SELECT * FROM Speisen") | |
result = custor.fetchall() | |
if "-" * len(result) != 0 : | |
speiseliste.delete(*speiseliste.get_children()) | |
for row in result : | |
speiseliste.insert('', END, values=row) | |
con.commit() | |
con.close() | |
######################################################################################################################## | |
def suche1() : | |
sqlCon = sqlite3.connect('speisekarte1.db') | |
cur = sqlCon.cursor() | |
nada = Nummer1.get() | |
cur.execute("select * from Speisen where Nummer = " + nada) | |
ars = cur.fetchall() | |
for sags in ars : | |
Name = NameE.insert(0, sags[0]) | |
KategorieE.insert(0, sags[2]) | |
PreisE.insert(0, sags[3]), | |
K_G2.set(sags[4]) | |
sqlCon.commit() | |
######################################################################################################################## | |
def update1() : | |
sqlCon = sqlite3.connect('speisekarte1.db') | |
cur = sqlCon.cursor() | |
cur.execute( | |
"""update Speisen set | |
Name = :Name, | |
Nummer = :Nummer, | |
Kategorie = :Kategorie, | |
Preis = :Preis, | |
K_G = :K_G | |
where Name = :Name """, | |
{'Name' : NameE.get(), | |
'Nummer' : Nummer1.get(), | |
'Kategorie' : clicked.get(), | |
'Preis' : PreisE.get(), | |
'K_G' : K_G2.get() | |
}) | |
sqlCon.commit() | |
sqlCon.close() | |
reset1() | |
#################################################################################################################### | |
def reset1() : | |
NameE.delete(0, END), | |
Nummer1.delete(0, END), | |
clicked.set('Auswählen') | |
PreisE.delete(0, END), | |
K_G2.set("") | |
######################################################################################################################## | |
def delet1() : | |
sqlCon = sqlite3.connect('speisekarte1.db') | |
cur = sqlCon.cursor() | |
nada1 = Nummer1.get() | |
cur.execute("delete from Speisen where Nummer = " | |
+ nada1) | |
sqlCon.commit() | |
displaydata1() | |
sqlCon.close() | |
reset1() | |
####################################################################################################################### | |
def deletall() : | |
sqlCon = sqlite3.connect('speisekarte1.db') | |
cur = sqlCon.cursor() | |
cur.execute("delete from Speisen") | |
sqlCon.commit() | |
displaydata1() | |
sqlCon.close() | |
reset1() | |
###################################################################################################################### | |
def speisenInfo(ev) : | |
viewInfo = speiseliste.focus() | |
lerandata = speiseliste.item(viewInfo) | |
reset1() | |
row = lerandata['values'] | |
Name = NameE.insert(0, row[0]) | |
Nummer = Nummer1.insert(0, row[1]) | |
Kategorie = clicked.set(row[2]) | |
Preis = PreisE.insert(0, row[3]) | |
K_G = K_G2.set(row[4]) | |
######################################## Autocomplete for Zutaten ############################################### | |
conn = sqlite3.connect('ZutatenListe.db') | |
cur = conn.cursor() | |
cur.execute('select SpeiseName from zutaten') | |
baro = cur.fetchall() | |
with open('zutatenliste.txt', 'w') as file1 : | |
for naro in baro : | |
ziko = ",".join(naro) | |
file1.write(str(ziko) + '\n') | |
zutatenliste = [] | |
with open('zutatenliste.txt', 'r') as fsrg : | |
for ziz in fsrg : | |
zutatenliste.append(str(ziz)) | |
conn.commit() | |
# ----------------------------------Speisen Liste Labels and Enterys----------------------------------------------------# | |
lbtitle = Label(Titlefram, font=('arial', 40, 'bold'), text="Speise karte bearbeiten", bd=7) | |
lbtitle.grid(row=0, column=0, padx=132) | |
Name = Label(Leftframe1, font=('arial', 12, 'bold'), text="Name", bd=5, bg='SlateGray4') | |
Name.grid(row=1, column=0, sticky='w', padx=5) | |
NameE = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
completevalues=zutatenliste, textvariable=Name) | |
NameE.grid(row=1, column=1, sticky='w', padx=5) | |
Nummer = Label(Leftframe1, font=('arial', 12, 'bold'), text="Nummer", bd=7, bg='SlateGray4') | |
Nummer.grid(row=2, column=0, sticky='w', padx=5) | |
Nummer1 = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', textvariable=Nummer) | |
Nummer1.grid(row=2, column=1, sticky='w', padx=5) | |
Kategorie = Label(Leftframe1, font=('arial', 12, 'bold'), text="Kategorie", bd=7, bg='SlateGray4') | |
Kategorie.grid(row=3, column=0, sticky='w', padx=5) | |
# ------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Katagorie ') | |
nado = cur.fetchall() | |
alle = [] | |
for t in nado : | |
top = str(t) | |
replace = {'[' : '', | |
']' : '', | |
'(' : '', | |
')' : '', | |
',' : '', | |
"'" : ''} | |
tops = top.translate(str.maketrans(replace)) | |
alle.insert(0, tops) | |
conn.commit() | |
# -----------------------------------------# | |
clicked = StringVar() | |
clicked.set("Auswählen") | |
KategorieE = OptionMenu(Leftframe1, clicked, *alle, ) | |
KategorieE.place(x=108, y=67) | |
KategorieE.configure(font=('arial', 12, 'bold'), bg="SlateGray4", bd=2, width=10) | |
Preis = Label(Leftframe1, font=('arial', 12, 'bold'), text="Preis", bd=7, bg='SlateGray4') | |
Preis.grid(row=5, column=0, sticky='w', padx=5) | |
PreisE = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=10, justify='left', textvariable=Preis) | |
PreisE.place(x=105, y=104) | |
Labeleuro = Label(Leftframe1, font=('arial', 12, 'bold'), text='€', bd=5, bg='SlateGray4') | |
Labeleuro.place(x=210, y=105) | |
K_G1 = Label(Leftframe1, font=('arial', 12, 'bold'), text='K_G', bd=5, bg='SlateGray4') | |
K_G1.grid(row=6, column=0, padx=5) | |
K_G2 = ttk.Combobox(Leftframe1, font=('arial', 12, 'bold'), width=5, state='readonly') | |
K_G2['values'] = ('', 'Klein', 'Gross', 'Standard') | |
K_G2.current(0) | |
K_G2.grid(row=6, column=1, sticky='W') | |
####################################### speiseliste tree view ######################################################## | |
scroll_y = Scrollbar(Leftframe, orient=VERTICAL) | |
speiseliste = ttk.Treeview(Leftframe, height=16, columns=("Name", "Nummer", "Kategorie", "Preis", "Kl_Gr") | |
, yscrollcommand=scroll_y.set) | |
scroll_y.pack(side=RIGHT, fill=Y) | |
speiseliste.heading('Name', text='Name') | |
speiseliste.heading('Nummer', text='Nummer') | |
speiseliste.heading('Kategorie', text='Kategorie') | |
speiseliste.heading('Preis', text='Preis') | |
speiseliste.heading('Kl_Gr', text='Kl_Gr') | |
speiseliste['show'] = 'headings' | |
speiseliste.column('Name', width=80) | |
speiseliste.column('Nummer', width=60) | |
speiseliste.column('Kategorie', width=80) | |
speiseliste.column('Preis', width=60) | |
speiseliste.column('Kl_Gr', width=60) | |
speiseliste.pack(fill=BOTH, expand=1) | |
speiseliste.bind("<ButtonRelease>", speisenInfo) | |
################################ speise liste buttons ################################################################ | |
btnspei = Button(Rightfram1, font=('arial', 12, 'bold'), text='Hinzufügen', bd=4, bg='#98DAD9', pady=1, padx=24, | |
width=8, height=3, command=addspeisen) | |
btnspei.grid(row=0, column=0, padx=1) | |
btndel = Button(Rightfram1, font=('arial', 12, 'bold'), text='Löschen', bd=4, bg='#98DAD9', pady=1, | |
padx=24, | |
width=8, height=3, command=delet1) | |
btndel.grid(row=1, column=0, padx=1) | |
btnand = Button(Rightfram1, font=('arial', 12, 'bold'), text='update', bd=4, bg='#98DAD9', pady=1, | |
padx=24, | |
width=8, height=3, command=update1) | |
btnand.grid(row=2, column=0, padx=1) | |
btnsear = Button(Rightfram1, font=('arial', 12, 'bold'), text='Suchen', bd=4, bg='#98DAD9', pady=1, | |
padx=24, | |
width=8, height=3, command=suche1) | |
btnsear.grid(row=3, column=0, padx=1) | |
btnreset = Button(Rightfram1, font=('arial', 12, 'bold'), text='reset', bd=4, bg='#98DAD9', pady=1, | |
padx=24, | |
width=8, height=3, command=reset1) | |
btnreset.grid(row=4, column=0, padx=1) | |
btnexit = Button(Rightfram1, font=('arial', 12, 'bold'), text='beenden', bd=4, bg='#98DAD9', pady=1, | |
padx=24, width=8, height=3, command=deletall) | |
btnexit.grid(row=5, column=0, padx=1) | |
btndishow = Button(Rightfram1, font=('arial', 12, 'bold'), text='Display', bd=4, bg='#98DAD9', pady=1, | |
padx=24, | |
width=8, height=3, command=displaydata1) | |
btndishow.grid(row=6, column=0, padx=1) | |
mainloop() | |
###################################### seite 2 button ################################################################ | |
frame1 = Frame(bd=4, bg='#183C47', width=379, height=119) | |
frame1.place(x=25, y=450) | |
btn2 = Button(frame1, text=("Chef",), bd=12, bg='#40A9DC', height=2, width=20, fg="black", command=popupwin, | |
font=('Helvetica', 20, | |
"italic bold"), | |
relief=GROOVE, activebackground='blue') | |
btn2.pack(padx=10, pady=10) | |
btn2.place(x=0, y=1) | |
############################################# Zutaten Liste ########################################################## | |
def openwindow3() : | |
new_window3 = Toplevel(root) | |
w12 = 1600 | |
h12 = 900 | |
new_window3.geometry("1700x700") | |
new_window3.configure(bg='blue') | |
new_window3.title(210 * titlespace + "Zutaten") | |
new_window3.resizable(width=False, height=False) | |
Mainframe = Frame(new_window3, bd=4, width=650, height=450, relief=RIDGE, bg='SlateGray4') | |
Mainframe.place(x=6, y=0) | |
Titlefram = Frame(Mainframe, bd=10, width=800, height=150, relief=RIDGE) | |
Titlefram.grid(row=0, column=0) | |
Topframe = Frame(Mainframe, bd=10, width=800, height=600, relief=RIDGE) | |
Topframe.grid(row=1, column=0) | |
Leftframe = Frame(Topframe, bd=10, width=800, height=500, padx=2, relief=RIDGE, bg='SlateGray4') | |
Leftframe.pack(side=LEFT, expand=True, fill=BOTH) | |
Leftframe1 = Frame(Leftframe, bd=10, width=500, height=600, relief=RIDGE, bg='SlateGray4') | |
Leftframe1.pack(side=LEFT, expand=True, fill=BOTH) | |
Rightframe = Frame(Topframe, bd=10, width=350, height=600, relief=RIDGE, bg='SlateGray4') | |
Rightframe.pack(side=RIGHT, expand=True, fill=BOTH) | |
Rightfram1 = Frame(Rightframe, bd=10, width=350, height=600, relief=RIDGE, bg='SlateGray4') | |
Rightfram1.pack(side=TOP, expand=True, fill=BOTH) | |
################################## Zutaten liste chef(Funktions) ################################################### | |
def addZutaten() : | |
conn = sqlite3.connect('ZutatenListe.db') | |
cur = conn.cursor() | |
karo = str(Zutaten1E.get(), ) | |
naldo = str(Zutaten2E.get(), ) | |
saldo = str(Zutaten3E.get(), ) | |
ziko = str(Zutaten4E.get(), ) | |
fiko = str(Zutaten5E.get(), ) | |
tiko = str(Zutaten6E.get(), ) | |
hiko = str(Zutaten7E.get(), ) | |
aiko = str(Zutaten8E.get(), ) | |
biko = str(Zutaten9E.get(), ) | |
niko = str(Zutaten10E.get(), ) | |
karo1 = karo.strip() | |
naldo1 = naldo.strip() | |
saldo1 = saldo.strip() | |
ziko1 = ziko.strip() | |
fiko1 = fiko.strip() | |
tiko1 = tiko.strip() | |
hiko1 = hiko.strip() | |
aiko1 = aiko.strip() | |
biko1 = biko.strip() | |
niko1 = niko.strip() | |
cur.execute( | |
"insert into zutaten values(?,?,?,?,?,?,?,?,?,?,?)", | |
(SpeiseNameE.get(), | |
karo1, | |
naldo1, | |
saldo1, | |
ziko1, | |
fiko1, | |
tiko1, | |
hiko1, | |
aiko1, | |
biko1, | |
niko1 | |
)) | |
cur.execute("update zutaten set SpeiseName= LTRIM(RTRIM(SpeiseName))") | |
resetZutaten() | |
conn.commit() | |
conn.close() | |
#################################################################################################################### | |
def displayZutaten() : | |
con = sqlite3.connect('ZutatenListe.db') | |
custor = con.cursor() | |
custor.execute( | |
"SELECT * FROM zutaten") | |
result = custor.fetchall() | |
if "-" * len(result) != 0 : | |
ZutatenListe.delete(*ZutatenListe.get_children()) | |
for row in result : | |
ZutatenListe.insert('', END, values=row) | |
con.commit() | |
con.close() | |
#################################################################################################################### | |
def sucheZutaten() : | |
sqlCon = sqlite3.connect('ZutatenListe.db') | |
cur = sqlCon.cursor() | |
nado = SpeiseNameE.get() | |
cur.execute("select * from zutaten where SpeiseName = (?)", (nado,)) | |
ars = cur.fetchall() | |
for sags in ars : | |
SpeiseNameE.delete(0, END) | |
SpeiseName = SpeiseNameE.insert(0, sags[0]) | |
Zutaten1E.insert(0, sags[1]), | |
Zutaten2E.insert(0, sags[2]), | |
Zutaten3E.insert(0, sags[3]), | |
Zutaten4E.insert(0, sags[4]), | |
Zutaten5E.insert(0, sags[5]), | |
Zutaten6E.insert(0, sags[6]), | |
Zutaten7E.insert(0, sags[7]), | |
Zutaten8E.insert(0, sags[8]), | |
Zutaten9E.insert(0, sags[9]), | |
Zutaten10E.insert(0, sags[10]), | |
sqlCon.commit() | |
#################################################################################################################### | |
def updateZutaten() : | |
sqlCon = sqlite3.connect('ZutatenListe.db') | |
cur = sqlCon.cursor() | |
cur.execute( | |
"""update zutaten set | |
SpeiseName = :SpeiseName, | |
Zutaten1 = :Zutaten1 , | |
Zutaten2 = :Zutaten2 , | |
Zutaten3 = :Zutaten3 , | |
Zutaten4 = :Zutaten4 , | |
Zutaten5 = :Zutaten5 , | |
Zutaten6 = :Zutaten6 , | |
Zutaten7 = :Zutaten7 , | |
Zutaten8 = :Zutaten8 , | |
Zutaten9 = :Zutaten9 , | |
Zutaten10 = :Zutaten10 | |
where SpeiseName = :SpeiseName """, | |
{'SpeiseName' : SpeiseNameE.get(), | |
'Zutaten1' : Zutaten1E.get(), | |
'Zutaten2' : Zutaten2E.get(), | |
'Zutaten3' : Zutaten3E.get(), | |
'Zutaten4' : Zutaten4E.get(), | |
'Zutaten5' : Zutaten5E.get(), | |
'Zutaten6' : Zutaten6E.get(), | |
'Zutaten7' : Zutaten7E.get(), | |
'Zutaten8' : Zutaten8E.get(), | |
'Zutaten9' : Zutaten9E.get(), | |
'Zutaten10' : Zutaten10E.get() | |
}) | |
sqlCon.commit() | |
sqlCon.close() | |
resetZutaten() | |
displayZutaten() | |
#################################################################################################################### | |
def resetZutaten() : | |
SpeiseNameE.delete(0, END), | |
Zutaten1E.delete(0, END), | |
Zutaten2E.delete(0, END), | |
Zutaten3E.delete(0, END), | |
Zutaten4E.delete(0, END), | |
Zutaten5E.delete(0, END), | |
Zutaten6E.delete(0, END), | |
Zutaten7E.delete(0, END), | |
Zutaten8E.delete(0, END), | |
Zutaten9E.delete(0, END), | |
Zutaten10E.delete(0, END) | |
#################################################################################################################### | |
def deletZutaten() : | |
sqlCon = sqlite3.connect('ZutatenListe.db') | |
cur = sqlCon.cursor() | |
nada3 = SpeiseNameE.get() | |
cur.execute("delete from zutaten where SpeiseName =?", | |
(nada3,)) | |
sqlCon.commit() | |
displayZutaten() | |
sqlCon.close() | |
resetZutaten() | |
# ################################################################################################################## | |
def deletallZutaten() : | |
message = messagebox.askyesno("Achtung", "SIND SIE SICHER ,ALLES lÖSCHEN", ) | |
label = Label(new_window3, text=message).pack() | |
if message == 1 : | |
sqlCon = sqlite3.connect('ZutatenListe.db') | |
cur = sqlCon.cursor() | |
cur.execute("delete from zutaten") | |
sqlCon.commit() | |
displayZutaten() | |
sqlCon.close() | |
resetZutaten() | |
messagebox.showinfo("ACHTUNG", "ALLES GELÖSCHT") | |
else : | |
pass | |
#################################################################################################################### | |
def ZutatenInfo(ev) : | |
viewInfo = ZutatenListe.focus() | |
lerandata = ZutatenListe.item(viewInfo) | |
resetZutaten() | |
row = lerandata['values'] | |
SpeiseName = SpeiseNameE.insert(0, row[0]) | |
Zutaten1 = Zutaten1E.insert(0, row[1]) | |
Zutaten2 = Zutaten2E.insert(0, row[2]) | |
Zutaten3 = Zutaten3E.insert(0, row[3]) | |
Zutaten4 = Zutaten4E.insert(0, row[4]) | |
Zutaten5 = Zutaten5E.insert(0, row[5]) | |
Zutaten6 = Zutaten6E.insert(0, row[6]) | |
Zutaten7 = Zutaten7E.insert(0, row[7]) | |
Zutaten8 = Zutaten8E.insert(0, row[8]) | |
Zutaten9 = Zutaten9E.insert(0, row[9]) | |
Zutaten10 = Zutaten10E.insert(0, row[10]) | |
######################################## Autocomplete function for Zutaten ######################################### | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
cur.execute("select trim(Zutat) from zutatenpreise ") | |
maro = cur.fetchall() | |
with open("zutatenpreise.txt", 'w') as file2 : | |
for zuz in maro : | |
ziko = ",".join(zuz) | |
ziko.strip() | |
ziko.split() | |
file2.write(str(ziko) + '\n') | |
zutatenpreise = [] | |
with open('zutatenpreise.txt', 'r') as file3 : | |
for zaro in file3 : | |
zaro = zaro.rstrip() | |
zutatenpreise.append(str(zaro) + '\n') | |
conn.commit() | |
######################################## Zutaten liste chef (Buttons\Labells) ###################################### | |
lbtitle = Label(Titlefram, font=('arial', 40, 'bold'), text="Zutaten Liste bearbeiten", bd=7) | |
lbtitle.grid(row=0, column=0, padx=132) | |
SpeiseName = Label(Leftframe1, font=('arial', 12, 'bold'), text="SpeiseName", bd=7, bg='SlateGray4') | |
SpeiseName.grid(row=1, column=0, sticky='w', padx=5) | |
SpeiseNameE = Entry(Leftframe1, font=('arial', 12, 'bold'), bd=5, width=44, justify='left', textvariable=SpeiseName) | |
SpeiseNameE.grid(row=1, column=1, sticky='w', padx=5) | |
Zutaten1 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten1", bd=7, bg='SlateGray4') | |
Zutaten1.grid(row=2, column=0, sticky='w', padx=5) | |
Zutaten1E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten1, completevalues=zutatenpreise) | |
Zutaten1E.grid(row=2, column=1, sticky='w', padx=5) | |
Zutaten2 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten2", bd=7, bg='SlateGray4') | |
Zutaten2.grid(row=3, column=0, sticky='w', padx=5) | |
Zutaten2E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten2, completevalues=zutatenpreise) | |
Zutaten2E.grid(row=3, column=1, sticky='w', padx=5) | |
Zutaten3 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten3", bd=7, bg='SlateGray4') | |
Zutaten3.grid(row=4, column=0, sticky='w', padx=5) | |
Zutaten3E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten3, completevalues=zutatenpreise) | |
Zutaten3E.grid(row=4, column=1, sticky='w', padx=5) | |
Zutaten4 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten4", bd=7, bg='SlateGray4') | |
Zutaten4.grid(row=5, column=0, sticky='w', padx=5) | |
Zutaten4E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten4, completevalues=zutatenpreise) | |
Zutaten4E.grid(row=5, column=1, sticky='w', padx=5) | |
Zutaten5 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten5", bd=7, bg='SlateGray4') | |
Zutaten5.grid(row=6, column=0, sticky='w', padx=5) | |
Zutaten5E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten5, completevalues=zutatenpreise) | |
Zutaten5E.grid(row=6, column=1, sticky='w', padx=5) | |
Zutaten6 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten6", bd=7, bg='SlateGray4') | |
Zutaten6.grid(row=7, column=0, sticky='w', padx=5) | |
Zutaten6E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten6, completevalues=zutatenpreise) | |
Zutaten6E.grid(row=7, column=1, sticky='w', padx=5) | |
Zutaten7 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten7", bd=7, bg='SlateGray4') | |
Zutaten7.grid(row=8, column=0, sticky='w', padx=5) | |
Zutaten7E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten7, completevalues=zutatenpreise) | |
Zutaten7E.grid(row=8, column=1, sticky='w', padx=5) | |
Zutaten8 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten8", bd=7, bg='SlateGray4') | |
Zutaten8.grid(row=9, column=0, sticky='w', padx=5) | |
Zutaten8E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten8, completevalues=zutatenpreise) | |
Zutaten8E.grid(row=9, column=1, sticky='w', padx=5) | |
Zutaten9 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten9", bd=7, bg='SlateGray4') | |
Zutaten9.grid(row=10, column=0, sticky='w', padx=5) | |
Zutaten9E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten9, completevalues=zutatenpreise) | |
Zutaten9E.grid(row=10, column=1, sticky='w', padx=5) | |
Zutaten10 = Label(Leftframe1, font=('arial', 12, 'bold'), text="Zutaten10", bd=7, bg='SlateGray4') | |
Zutaten10.grid(row=11, column=0, sticky='w', padx=5) | |
Zutaten10E = AutocompleteEntry(Leftframe1, font=('arial', 12, 'bold'), width=44, justify='left', | |
textvariable=Zutaten10, completevalues=zutatenpreise) | |
Zutaten10E.grid(row=11, column=1, sticky='w', padx=5) | |
####################################### ZUTATENLISTE tree view ##################################################### | |
scroll_y = Scrollbar(Leftframe, orient=VERTICAL) | |
ZutatenListe = ttk.Treeview(Leftframe, height=16, | |
columns=("SpeiseName", "Zutaten1", "Zutaten2", "Zutaten3", "Zutaten4", "Zutaten5", | |
"Zutaten6", "Zutaten7", "Zutaten8", "Zutaten9", "Zutaten10") | |
, yscrollcommand=scroll_y.set) | |
scroll_y.pack(side=RIGHT, expand=True, fill=BOTH) | |
ZutatenListe.heading('SpeiseName', text='SpeiseName') | |
ZutatenListe.heading('Zutaten1', text='Zutaten1') | |
ZutatenListe.heading('Zutaten2', text='Zutaten2') | |
ZutatenListe.heading('Zutaten3', text='Zutaten3') | |
ZutatenListe.heading('Zutaten4', text='Zutaten4') | |
ZutatenListe.heading('Zutaten5', text='Zutaten5') | |
ZutatenListe.heading('Zutaten6', text='Zutaten6') | |
ZutatenListe.heading('Zutaten7', text='Zutaten7') | |
ZutatenListe.heading('Zutaten8', text='Zutaten8') | |
ZutatenListe.heading('Zutaten9', text='Zutaten9') | |
ZutatenListe.heading('Zutaten10', text='Zutaten10') | |
ZutatenListe['show'] = 'headings' | |
ZutatenListe.column('SpeiseName', width=80) | |
ZutatenListe.column('Zutaten1', width=80) | |
ZutatenListe.column('Zutaten2', width=80) | |
ZutatenListe.column('Zutaten3', width=80) | |
ZutatenListe.column('Zutaten4', width=80) | |
ZutatenListe.column('Zutaten5', width=80) | |
ZutatenListe.column('Zutaten6', width=80) | |
ZutatenListe.column('Zutaten7', width=80) | |
ZutatenListe.column('Zutaten8', width=80) | |
ZutatenListe.column('Zutaten9', width=80) | |
ZutatenListe.column('Zutaten10', width=80) | |
ZutatenListe.pack(expand=True, fill=BOTH) | |
ZutatenListe.bind("<ButtonRelease>", ZutatenInfo) | |
############################### speise liste buttons ############################################################### | |
btnspei = Button(Rightfram1, font=('arial', 12, 'bold'), text='Hinzufügen', bd=4, bg='SlateGray2', pady=1, padx=24, | |
width=8, height=3, command=addZutaten) | |
btnspei.grid(row=0, column=0, padx=1) | |
btndel = Button(Rightfram1, font=('arial', 12, 'bold'), text='Löschen', bd=4, bg='SlateGray2', pady=1, | |
padx=24, | |
width=8, height=3, command=deletZutaten) | |
btndel.grid(row=1, column=0, padx=1) | |
btnand = Button(Rightfram1, font=('arial', 12, 'bold'), text='update', bd=4, bg='SlateGray2', pady=1, | |
padx=24, | |
width=8, height=3, command=updateZutaten) | |
btnand.grid(row=2, column=0, padx=1) | |
btnsear = Button(Rightfram1, font=('arial', 12, 'bold'), text='Suchen', bd=4, bg='SlateGray2', pady=1, | |
padx=24, | |
width=8, height=3, command=sucheZutaten) | |
btnsear.grid(row=3, column=0, padx=1) | |
btnreset = Button(Rightfram1, font=('arial', 12, 'bold'), text='reset', bd=4, bg='SlateGray2', pady=1, | |
padx=24, | |
width=8, height=3, command=resetZutaten) | |
btnreset.grid(row=4, column=0, padx=1) | |
btnexit = Button(Rightfram1, font=('arial', 12, 'bold'), text='Alle Löschen', bd=4, bg='SlateGray2', pady=1, | |
padx=24, width=8, height=3, command=deletallZutaten) | |
btnexit.grid(row=5, column=0, padx=1) | |
btndishow = Button(Rightfram1, font=('arial', 12, 'bold'), text='Display', bd=4, bg='SlateGray2', pady=1, | |
padx=24, | |
width=8, height=3, command=displayZutaten) | |
btndishow.grid(row=6, column=0, padx=1) | |
############################################## Zutate Preise ########################################################### | |
def openwindow4() : | |
new_window4 = Toplevel(root) | |
new_window4.geometry("750x750") | |
new_window4.configure(bg='SlateGray4') | |
new_window4.title(100 * titlespace + "Zutaten Preise") | |
new_window4.resizable(width=False, height=False) | |
Frame1 = Frame(new_window4, width=450, bg='SlateGray4', bd=4, height=800, relief=RIDGE) | |
Frame1.place(x=0, y=0) | |
Frame2 = Frame(new_window4, width=250, bg='DarkSlateGray4', bd=4, height=780, relief=RIDGE, padx=2) | |
Frame2.place(x=610, y=0) | |
Frame3 = Frame(new_window4, width=450, bg='white', height=3000, relief=RIDGE) | |
Frame3.place(x=40, y=110) | |
########################################## Labels Zutaten Preise ##################################################### | |
font_ = ("ARIEL", 13, "bold") | |
Zutat = Label(Frame1, text='Zutat', width=15, font=("arial", 16, "bold"), bd=4, bg='SlateGray4') | |
Zutat.grid(row=1, column=2) | |
ZutatE = Entry(Frame1, width=20, bd=4, font=font_) | |
ZutatE.grid(row=2, column=2) | |
Preis = Label(Frame1, text='Preis/€', width=15, font=("arial", 16, "bold"), bd=4, bg='SlateGray4') | |
Preis.grid(row=1, column=3) | |
PreisE = Entry(Frame1, width=8, bd=4, font=font_) | |
PreisE.grid(row=2, column=3) | |
Nummer = Label(Frame1, text='Nummer', width=15, font=("arial", 16, "bold"), bd=4, bg='SlateGray4') | |
Nummer.grid(row=1, column=1) | |
NummerE = Entry(Frame1, width=4, bd=4, font=font_) | |
NummerE.grid(row=2, column=1) | |
########################################## zutatenPreise Functions #################################################### | |
kol = [] | |
# -------------------------------------------Speise Nummer rausholen------------------------------------------------# | |
def numm() : | |
conn = sqlite3.connect('ZutatenPreise.db') | |
cur = conn.cursor() | |
cur.execute('select * from zutatenpreise') | |
fet = cur.fetchall() | |
NummerE.delete(0, END) | |
for izo in fet : | |
kol.insert(0, izo) | |
hob = len(kol) | |
NummerE.insert(0, hob + 1) | |
NummerE.config(state=DISABLED) | |
kol.clear() | |
numm() | |
# ----------------------------------------------- Speise Nummer Frei stellen ---------------------------------------# | |
def frei() : | |
NummerE.config(state=NORMAL) | |
NummerE.delete(0, END) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def Speicher_zutat() : | |
NummerE.config(state=NORMAL) | |
siko = PreisE.get() | |
soko = ZutatE.get() | |
if ' ' in soko : | |
messagebox.showerror('Error', 'kein leere tasten') | |
else : | |
if ',' in siko : | |
MessageBox.showerror('Error', 'es muss ein punkt sein und nicht ein komma') | |
else : | |
numb = NummerE.get() | |
conn1 = sqlite3.connect("ZutatenPreise.db") | |
cur1 = conn1.cursor() | |
cur1.execute('select Nummer from zutatenpreise') | |
ford = cur1.fetchall() | |
for ido in ford : | |
sol = str(ido).replace(')', '').replace('(', '').replace(',', '') | |
if numb in sol : | |
messagebox.showerror('Nummer vergeben ', 'diese Nummer exestiert schon ') | |
else : | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
saldo = str(ZutatE.get()) | |
cur.execute("insert into zutatenpreise values(?,?,?)", | |
(NummerE.get(), | |
saldo.strip(), | |
PreisE.get() | |
)) | |
Displayzutat() | |
Reseten() | |
conn.commit() | |
conn.close() | |
numm() | |
# --------------------------------------------------------------------------------------------------------------# | |
def Reseten() : | |
NummerE.delete(0, END) | |
ZutatE.delete(0, END) | |
PreisE.delete(0, END) | |
# --------------------------------------------------------------------------------------------------------------# | |
def suchenzutat() : | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
ziko = NummerE.get() | |
cur.execute("select* from zutatenpreise where Nummer=(?)", (ziko,)) | |
arko = cur.fetchall() | |
for tiko in arko : | |
Reseten() | |
NummerE.insert(END, tiko[0]) | |
ZutatE.insert(END, tiko[1]) | |
PreisE.insert(END, tiko[2]) | |
conn.commit() | |
conn.close() | |
# --------------------------------------------------------------------------------------------------------------# | |
def deletezutat() : | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
nido = ZutatE.get() | |
cur.execute("delete from zutatenpreise where Zutat=(?)", (nido,)) | |
Reseten() | |
Displayzutat() | |
conn.commit() | |
conn.close() | |
# --------------------------------------------------------------------------------------------------------------# | |
def Displayzutat() : | |
conn = sqlite3.connect('ZutatenPreise.db') | |
cur = conn.cursor() | |
cur.execute( | |
"SELECT * FROM zutatenpreise") | |
result = cur.fetchall() | |
if "-" * len(result) != 0 : | |
ZutatenPreise.delete(*ZutatenPreise.get_children()) | |
for row in result : | |
ZutatenPreise.insert('', END, values=row) | |
conn.commit() | |
conn.close() | |
# --------------------------------------------------------------------------------------------------------------# | |
def ZutatenpreiseInfo(ev) : | |
viewInfo = ZutatenPreise.focus() | |
lerandata = ZutatenPreise.item(viewInfo) | |
Reseten() | |
row = lerandata['values'] | |
Nummer = NummerE.insert(0, row[0]) | |
Zutat = ZutatE.insert(0, row[1]) | |
Preis = PreisE.insert(0, row[2]) | |
# --------------------------------------------------------------------------------------------------------------# | |
def updatezutat() : | |
conn = sqlite3.connect("ZutatenPreise.db") | |
cur = conn.cursor() | |
cur.execute(""" | |
update zutatenpreise set | |
Nummer = :Nummer, | |
Zutat = :Zutat , | |
Preis€=:Preis€ | |
where Nummer = :Nummer """, | |
{'Nummer' : NummerE.get(), | |
'Zutat' : ZutatE.get(), | |
'Preis€' : PreisE.get(), | |
}) | |
Reseten() | |
Displayzutat() | |
conn.commit() | |
conn.close() | |
########################################## zutatenPreise Buttons ###################################################### | |
SpeicherButton = Button(new_window4, text='Speichern', font=font_, width=12, height=2, bd=2, bg='grey' | |
, activebackground='red', command=Speicher_zutat) | |
SpeicherButton.place(x=617, y=20) | |
UpdateButton = Button(new_window4, text='Update', font=font_, width=12, height=2, bd=2, bg='grey' | |
, activebackground='red', command=updatezutat) | |
UpdateButton.place(x=617, y=90) | |
LöschenButton = Button(new_window4, text='Löschen', font=font_, width=12, height=2, bd=2, bg='grey' | |
, activebackground='red', command=deletezutat) | |
LöschenButton.place(x=617, y=160) | |
SucheButton = Button(new_window4, text='Suchen', font=font_, width=12, height=2, bd=2, bg='grey' | |
, activebackground='red', command=suchenzutat) | |
SucheButton.place(x=617, y=230) | |
ResetButton = Button(new_window4, text='Reset', font=font_, width=12, height=2, bd=2, bg='grey' | |
, activebackground='red', command=Reseten) | |
ResetButton.place(x=617, y=300) | |
DisplayButton = Button(new_window4, text='Display', font=font_, width=12, height=2, bd=2, bg='grey' | |
, activebackground='red', command=Displayzutat) | |
DisplayButton.place(x=617, y=370) | |
frei_schalten = Button(Frame1, text='F', width=3, font=("arial", 8, "bold"), bd=4, bg='darkSlateGray4', | |
command=frei) | |
frei_schalten.place(x=5, y=5) | |
######################################### Tree view zuztatenpreise ##################################################### | |
scroll_y = Scrollbar(Frame3, orient=VERTICAL) | |
ZutatenPreise = ttk.Treeview(Frame3, height=30, | |
columns=("Nummer", "Zutat", "Preis/€",) | |
, yscrollcommand=scroll_y.set) | |
scroll_y.pack(side=RIGHT, fill=Y) | |
ZutatenPreise.heading('Nummer', text='Nummer') | |
ZutatenPreise.heading('Zutat', text='Zutat') | |
ZutatenPreise.heading('Preis/€', text='Preis/€') | |
ZutatenPreise['show'] = 'headings' | |
ZutatenPreise.column('Nummer', width=160) | |
ZutatenPreise.column('Zutat', width=160) | |
ZutatenPreise.column('Preis/€', width=160) | |
ZutatenPreise.pack(fill=BOTH, expand=1) | |
ZutatenPreise.bind("<ButtonRelease>", ZutatenpreiseInfo) | |
###################################### Diverse Einstellung ############################################################# | |
def openwindow5() : | |
global new_window | |
font_size = ("ARIEL", 12, "bold") | |
new_window4 = Toplevel(root) | |
new_window4.geometry("850x900") | |
new_window4.configure(bg='SlateGray4') | |
new_window4.title(100 * titlespace + "Einsetllung") | |
new_window4.resizable(width=False, height=False) | |
Frame1 = Frame(new_window4, width=500, bg='white', bd=4, height=900, relief=RIDGE) | |
Frame1.place(x=0, y=0) | |
Update = Label(Frame1, text='Update ', font=font_size, bd=4, bg='SlateGray3', height=1, width=48) | |
Update.place(x=0, y=0) | |
Aktuell = Label(new_window4, text='Aktuell ', font=font_size, bd=4, bg='SlateGray2', height=1, width=35) | |
Aktuell.place(x=500, y=0) | |
# --------------------------------------------Familien Pizza ----------------------------------------------------------## | |
def Update1() : | |
freit = Familien_FreiE.get() | |
preist = Familien_PreisE.get() | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
Familie = 'FamilienPizza' | |
cur.execute(""" | |
update einstellung set | |
Name = :Name, | |
einstellung1 = :einstellung1 , | |
einstellung2=:einstellung2 | |
where Name = :Name """, | |
{'Name' : Familie, | |
'einstellung1' : freit, | |
'einstellung2' : preist, | |
}) | |
conn.commit() | |
conn.close() | |
Familien_FreiE.delete(0, END) | |
Familien_PreisE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# --------------------------------------------------------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from einstellung where Name = ?', ('FamilienPizza',)) | |
nado = cur.fetchall() | |
frei = '' | |
preis = '' | |
for t in nado : | |
frei = t[1] | |
preis = t[2] | |
print((preis)) | |
conn.commit() | |
# -------------------------------------------------------------------------------------------------------# | |
Familien_ = Label(Frame1, text='Familien Pizza ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Familien_.place(x=0, y=35) | |
Familien_Frei = Label(Frame1, text='Anzahl Freie zutaten :', font=font_size, bd=4, bg='white', height=1) | |
Familien_Frei.place(x=0, y=65) | |
Familien_FreiE = Entry(Frame1, width=3, bd=4, font=font_size) | |
Familien_FreiE.place(x=180, y=65) | |
Familien_Preis = Label(Frame1, text='Preis :', font=font_size, bd=4, bg='white', height=1) | |
Familien_Preis.place(x=230, y=65) | |
Familien_euro = Label(Frame1, text='€', font=font_size, bd=4, bg='white', height=1) | |
Familien_euro.place(x=340, y=65) | |
Familien_PreisE = Entry(Frame1, width=3, bd=4, font=font_size) | |
Familien_PreisE.place(x=300, y=65) | |
Familien_Button = Button(Frame1, text='Update', width=8, height=1, command=Update1) | |
Familien_Button.place(x=380, y=65) | |
Familien_A = Label(new_window4, text='Familien Pizza ', font=font_size, bd=4, bg='SlateGray3', height=1, width=35) | |
Familien_A.place(x=500, y=39) | |
Familien_Frei = Label(new_window4, text='Anzahl Freie zutaten :', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Familien_Frei.place(x=500, y=70) | |
Familien_F = Label(new_window4, text=frei, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Familien_F.place(x=680, y=70) | |
Familien_Preis = Label(new_window4, text='Preis :', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Familien_Preis.place(x=720, y=70) | |
Familien_P = Label(new_window4, text=preis, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Familien_P.place(x=780, y=70) | |
Familien_euro = Label(new_window4, text='€', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Familien_euro.place(x=795, y=70) | |
############################################# Katagorie ################################################################ | |
def addkatagorie() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
siko = str(Katagorie_NameE.get()) | |
if siko == '' : | |
messagebox.showerror('Katagorie', 'Entry darf nicht leer sein') | |
else : | |
siko.strip() | |
cur.execute('INSERT INTO Katagorie values (?)', (siko,)) | |
conn.commit() | |
Katagorie_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def deletekatagorie() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
siko = Katagorie_NameE.get() | |
cur.execute('delete from Katagorie where Name=(?)', (siko,)) | |
conn.commit() | |
Katagorie_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Katagorie ') | |
nado = cur.fetchall() | |
alle = [] | |
for t in nado : | |
top = str(t) | |
replace = {'[' : '', | |
']' : '', | |
'(' : '', | |
')' : '', | |
',' : '', | |
"'" : ''} | |
tops = top.translate(str.maketrans(replace)) | |
alle.insert(0, tops) | |
conn.commit() | |
# ------------------------------------------------------------------------------------------------------------------# | |
Katagorie_ = Label(Frame1, text='Katagorie ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Katagorie_.place(x=0, y=100) | |
Katagorie_Name = Label(Frame1, text=' Katagorie Typ :', font=font_size, bd=4, bg='white', height=1) | |
Katagorie_Name.place(x=0, y=135) | |
Katagorie_NameE = Entry(Frame1, width=18, bd=4, font=font_size) | |
Katagorie_NameE.place(x=150, y=135) | |
Katagorie_Button = Button(Frame1, text='Speichern', width=8, height=1, command=addkatagorie) | |
Katagorie_Button.place(x=330, y=135) | |
Katagorie_Button1 = Button(Frame1, text='Löschen', width=8, height=1, bg='red', command=deletekatagorie) | |
Katagorie_Button1.place(x=410, y=135) | |
Katagorie_ = Label(new_window4, text='Katagorie ', font=font_size, bd=4, bg='SlateGray1', height=1, width=35) | |
Katagorie_.place(x=500, y=103) | |
Katagorie_Name = Label(new_window4, text=' Katagorie Typ :', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Katagorie_Name.place(x=500, y=135) | |
clicked = StringVar() | |
clicked.set("Auswählen") | |
drop = OptionMenu(new_window4, clicked, *alle, ) | |
drop.place(x=630, y=135) | |
drop.configure(font=font_size, bg="SlateGray4", bd=2, width=10) | |
################################################ Lieferzuschlag ####################################################### | |
def addLieferzuschlag() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
sika = Lieferzuschlag_NameE.get() | |
if sika == '' : | |
messagebox.showerror('Lieferzuschlag', 'Entry darf nicht leer sein') | |
else : | |
cur.execute('INSERT INTO Lieferzuschlg values (?)', (sika,)) | |
conn.commit() | |
Lieferzuschlag_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def Update_Liefer() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
siko = Lieferzuschlag_NameE.get() | |
if siko == '' : | |
messagebox.showerror('Lieferzuschlag', 'Entry darf nicht leer sein') | |
else : | |
cur.execute('Update Lieferzuschlg set Name =(?)', (siko,)) | |
conn.commit() | |
conn.close() | |
Lieferzuschlag_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Lieferzuschlg ') | |
Lieferpreis = cur.fetchall() | |
conn.commit() | |
# -----------------------------------------------------------------------------------------------------------------# | |
Lieferzuschlag_ = Label(Frame1, text='Lieferzuschlag ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Lieferzuschlag_.place(x=0, y=165) | |
Lieferzuschlag_Name = Label(Frame1, text=' Lieferzuschlag ab :', font=font_size, bd=4, bg='white', height=1) | |
Lieferzuschlag_Name.place(x=0, y=200) | |
Lieferzuschlag_Euro = Label(Frame1, text=' € ', font=font_size, bd=4, bg='white', height=1) | |
Lieferzuschlag_Euro.place(x=240, y=200) | |
Lieferzuschlag_NameE = Entry(Frame1, width=8, bd=4, font=font_size) | |
Lieferzuschlag_NameE.place(x=165, y=200) | |
Lieferzuschlag_Button = Button(Frame1, text='Speichern', width=8, height=1, command=Update_Liefer) | |
Lieferzuschlag_Button.place(x=265, y=200) | |
Lieferzuschlag_ = Label(new_window4, text='Lieferzuschlag ', font=font_size, bd=4, bg='SlateGray1', height=1, | |
width=35) | |
Lieferzuschlag_.place(x=500, y=168) | |
Lieferzuschlag_Name = Label(new_window4, text=' Lieferzuschlag ab:', font=font_size, bd=4, bg='SlateGray4', | |
height=1) | |
Lieferzuschlag_Name.place(x=500, y=202) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table Lieferzuschlg ( Name TEXT ) """) | |
# conn.commit() | |
Lieferzuschlag_P = Label(new_window4, text=Lieferpreis, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Lieferzuschlag_P.place(x=655, y=202) | |
Lieferzuschlag_Euro = Label(new_window4, text=' € ', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Lieferzuschlag_Euro.place(x=679, y=202) | |
########################################## Passwort #################################################################### | |
def addPasswort() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
sika = Passwort_NameE.get() | |
if sika == '' : | |
messagebox.showerror('PASSWORT', 'Entry darf nicht leer sein') | |
else : | |
cur.execute('Update Passwort set Name =(?)', (sika,)) | |
conn.commit() | |
Passwort_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Passwort ') | |
Passwort = cur.fetchall() | |
conn.commit() | |
# ------------------------------------------------------------------------------------------------------------------# | |
Passwort_ = Label(Frame1, text='Passwort ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Passwort_.place(x=0, y=230) | |
Passwort_Name = Label(Frame1, text=' Neue Passwort :', font=font_size, bd=4, bg='white', height=1) | |
Passwort_Name.place(x=0, y=260) | |
Passwort_NameE = Entry(Frame1, width=5, bd=4, font=font_size) | |
Passwort_NameE.place(x=160, y=260) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table Passwort( Name TEXT ) """) | |
# conn.commit() | |
Passwort_Button = Button(Frame1, text='Speichern', width=8, height=1, command=addPasswort) | |
Passwort_Button.place(x=265, y=260) | |
Passwort_ = Label(new_window4, text='Passwort ', font=font_size, bd=4, bg='SlateGray1', height=1, | |
width=35) | |
Passwort_.place(x=500, y=238) | |
Passwort_Name = Label(new_window4, text=' Aktueles Passwort:', font=font_size, bd=4, bg='SlateGray4', | |
height=1) | |
Passwort_Name.place(x=500, y=270) | |
Passwort_P = Label(new_window4, text=Passwort, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Passwort_P.place(x=655, y=270) | |
# -----------------------------------------------------------------------------------------------------------------# | |
def Gross_preise() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
sika = Gross_NameE.get() | |
if sika == '' : | |
messagebox.showerror('Gross', 'Entry darf nicht leer sein') | |
else : | |
cur.execute('update Gross set Name= (?)', (sika,)) | |
conn.commit() | |
Gross_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from Gross ') | |
gross = cur.fetchall() | |
conn.commit() | |
Gross_ = Label(Frame1, text='Grosse preise ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Gross_.place(x=0, y=295) | |
Gross_Name = Label(Frame1, text=' zuschlag Grosse :', font=font_size, bd=4, bg='white', height=1) | |
Gross_Name.place(x=0, y=325) | |
Gross_NameE = Entry(Frame1, width=10, bd=4, font=font_size) | |
Gross_NameE.place(x=160, y=325) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table Gross ( Name INTEGER ) """) | |
# conn.commit() | |
Gross_Button = Button(Frame1, text='Speichern', width=8, height=1, command=Gross_preise) | |
Gross_Button.place(x=265, y=325) | |
Gross__ = Label(new_window4, text='Grosse Preise ', font=font_size, bd=4, bg='SlateGray1', height=1, | |
width=35) | |
Gross__.place(x=500, y=298) | |
Gross__Name = Label(new_window4, text=' Aktueles Preis:', font=font_size, bd=4, bg='SlateGray4', | |
height=1) | |
Gross__Name.place(x=500, y=335) | |
Gross__P = Label(new_window4, text=gross, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Gross__P.place(x=645, y=335) | |
Gross_Euro = Label(new_window4, text=' € ', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Gross_Euro.place(x=680, y=335) | |
######################################################################################################################## | |
def Note() : | |
conn = sqlite3.connect('Einstellung.db') | |
cub = conn.cursor() | |
sikp = Note_NameE.get() | |
if sikp == '' : | |
messagebox.showerror('Note', 'Note darf nicht leer sein') | |
else : | |
cub.execute('update Note set Name= (?)', (sikp,)) | |
conn.commit() | |
Note_NameE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cub = conn.cursor() | |
cub.execute('select* from Note ') | |
noties = cub.fetchall() | |
with open("Note.txt", 'w') as file13 : | |
for zuz in noties : | |
ziko = ",".join(zuz) | |
ziko.strip() | |
# ziko.split() | |
file13.write(str(ziko)) | |
with open('Note.txt', 'r') as file14 : | |
for i in file14 : | |
i.strip() | |
conn.commit() | |
Note_ = Label(Frame1, text='Note von Chef ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Note_.place(x=0, y=360) | |
Note_Name = Label(Frame1, text=' Note :', font=font_size, bd=4, bg='white', height=1) | |
Note_Name.place(x=0, y=390) | |
Note_NameE = Entry(Frame1, width=30, bd=4, font=font_size) | |
Note_NameE.place(x=100, y=390) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table Note( Name TEXT ) """) | |
# conn.commit() | |
Note_Button = Button(Frame1, text='Speichern', width=8, height=1, command=Note) | |
Note_Button.place(x=390, y=390) | |
Note__ = Label(new_window4, text='Note von chef ', font=font_size, bd=4, bg='SlateGray1', height=1, | |
width=35) | |
Note__.place(x=500, y=365) | |
Note__Name = Label(new_window4, text=' Aktueles Note:', font=font_size, bd=4, bg='SlateGray4', | |
height=1) | |
Note__Name.place(x=500, y=400) | |
Note__P = Label(new_window4, text=i, font=font_size, bd=0, bg='SlateGray4', height=2, wraplengt=120) | |
Note__P.place(x=645, y=410) | |
######################################################################################################################## | |
def add_name() : | |
conn = sqlite3.connect('Einstellung.db') | |
cub = conn.cursor() | |
sikol = Login_nameE.get() | |
sikola = Login_passwortE.get() | |
if sikol == '' or sikola == '' : | |
messagebox.showerror('username', 'Entery darf nicht leer sein') | |
else : | |
cub.execute('insert into Username VALUES(Null,?,?)', | |
( | |
sikol, | |
sikola)) | |
conn.commit() | |
Login_nameE.delete(0, END) | |
Login_passwortE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def delete_name() : | |
conn = sqlite3.connect('Einstellung.db') | |
cub = conn.cursor() | |
sikon = IDE.get() | |
if sikon == '' : | |
messagebox.showerror('username', 'Entery darf nicht leer sein') | |
else : | |
cub.execute('delete from Username where ID=(?)', (sikon,)) | |
conn.commit() | |
IDE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# -------------------------------------------------------------------------------------------------------------------# | |
Login_ = Label(Frame1, text='Username ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Login_.place(x=0, y=452) | |
Login_name = Label(Frame1, text='Name :', font=font_size, bd=4, bg='white', height=1) | |
Login_name.place(x=0, y=490) | |
ID_name = Label(Frame1, text='ID :', font=font_size, bd=4, bg='white', height=1) | |
ID_name.place(x=0, y=540) | |
Login_nameE = Entry(Frame1, width=11, bd=4, font=font_size) | |
Login_nameE.place(x=65, y=490) | |
IDE = Entry(Frame1, width=6, bd=4, font=font_size) | |
IDE.place(x=65, y=540) | |
Login_passwort = Label(Frame1, text='Passwort :', font=font_size, bd=4, bg='white', height=1) | |
Login_passwort.place(x=190, y=490) | |
Login_passwortE = Entry(Frame1, width=10, bd=4, font=font_size) | |
Login_passwortE.place(x=280, y=490) | |
Add_Button = Button(Frame1, text='Add', width=8, height=1, command=add_name) | |
Add_Button.place(x=400, y=490) | |
LOSCHEN_Button = Button(Frame1, text='löschen', width=8, height=1, bg='red', command=delete_name) | |
LOSCHEN_Button.place(x=160, y=540) | |
Login_A = Label(new_window4, text='Usernames ', font=font_size, bd=4, bg='SlateGray3', height=1, width=35) | |
Login_A.place(x=500, y=460) | |
Login_names = Label(new_window4, text='Username ', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Login_names.place(x=515, y=500) | |
Login_F = Label(new_window4, text=frei, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Login_F.place(x=680, y=70) | |
Login_Pass = Label(new_window4, text='ID ', font=font_size, bd=4, bg='SlateGray4', height=1) | |
Login_Pass.place(x=710, y=500) | |
Login_P = Label(new_window4, text=preis, font=font_size, bd=4, bg='SlateGray4', height=1) | |
Login_P.place(x=780, y=70) | |
Preis_er = Label(new_window4, text='Preise Erhöhen ', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Preis_er.place(x=0, y=580) | |
um_ = Label(new_window4, text='Um ', font=font_size, bd=4, bg='white', height=1) | |
um_.place(x=180, y=620) | |
preosE = Entry(new_window4, width=4, bd=4, font=font_size) | |
preosE.place(x=225, y=620) | |
um_er = Label(new_window4, text='Erhöhen ', font=font_size, bd=4, bg='white', height=1) | |
um_er.place(x=290, y=620) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table Username(ID integer primary key AUTOINCREMENT, Name TEXT, Passwort TEXT ) """) | |
# conn.commit() | |
userlist = Listbox(new_window4, bd=0, width=13, height=6, bg='white') | |
userlist.place(x=520, y=540) | |
IDlist = Listbox(new_window4, bd=0, width=5, height=6, bg='white') | |
IDlist.place(x=690, y=540) | |
IDlist.config(font=font_size, bg='SlateGray4') | |
userlist.config(font=font_size, bg='SlateGray4') | |
conn = sqlite3.connect('Einstellung.db') | |
cus = conn.cursor() | |
cus.execute('select Name from Username ') | |
blob = cus.fetchall() | |
for user in blob : | |
userlist.insert(END, user) | |
cus.execute('select ID from Username ') | |
blob = cus.fetchall() | |
for IDES in blob : | |
IDlist.insert(END, IDES) | |
################################### Preise Erhohen ############################################################### | |
clicked1 = StringVar() | |
clicked1.set("Auswählen") | |
drop1 = OptionMenu(new_window4, clicked1, *alle, ) | |
drop1.place(x=10, y=620) | |
drop1.configure(font=font_size, bg="SlateGray2", bd=2, width=10) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def preise_erhöhen() : | |
soso = clicked1.get() | |
sisi = preosE.get() | |
sqlCon = sqlite3.connect('speisekarte1.db') | |
cur = sqlCon.cursor() | |
cur.execute('update Speisen set Preis = Preis +(?) where Kategorie like (?) ', (sisi, soso,)) | |
sqlCon.commit() | |
new_window4.destroy() | |
openwindow5() | |
er_Button = Button(new_window4, text='Speichern', width=8, height=1, command=preise_erhöhen) | |
er_Button.place(x=380, y=620) | |
# --------------------------------------------- fRITZBOX Passwort-------------------------------------------------------# | |
Fritzbox_ = Label(new_window4, text='Fritz Box', font=font_size, bd=4, bg='SlateGray1', height=1, width=48) | |
Fritzbox_.place(x=0, y=680) | |
Fritzboxf_ = Label(new_window4, text='FritzBox Passwort', font=font_size, bd=4, bg='SlateGray2', height=1, width=33) | |
Fritzboxf_.place(x=530, y=680) | |
passwortE = Entry(new_window4, width=16, bd=4, font=font_size) | |
passwortE.place(x=140, y=720) | |
Passwotl = Label(Frame1, text='Passwort:', font=font_size, bd=4, bg='white', height=1) | |
Passwotl.place(x=2, y=720) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table FritzBox( Passwort TEXT ) """) | |
# conn.commit() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def FritzPasswort() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
sika = passwortE.get() | |
if sika == '' : | |
messagebox.showerror('PASSWORT', 'Entry darf nicht leer sein') | |
else : | |
cur.execute('Update FritzBox set passwort =(?)', (sika,)) | |
# cur.execute('insert into FritzBox VALUES(?)', (sika,)) | |
conn.commit() | |
passwortE.delete(0, END) | |
new_window4.destroy() | |
openwindow5() | |
# ------------------------------------------------------------------------------------------------------------------# | |
ser_Button = Button(new_window4, text='Speichern', width=8, height=1, command=FritzPasswort) | |
ser_Button.place(x=320, y=720) | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from FritzBox') | |
sol = cur.fetchall() | |
for izo in sol : | |
sazo = str(izo).replace("'", "").replace(',', '').replace(')', '').replace('(', '') | |
Passwotln = Label(new_window4, text=sazo, font=font_size, bd=4, bg='SlateGray1', height=1) | |
Passwotln.place(x=620, y=720) | |
# ------------------------------------------------------------------------------------------------------------------# | |
# data=subprocess.check_output(['wmic','printer','list','brief']).decode('utf-8').split('\r\r\n') | |
# print(data) | |
# | |
# btn1=Button(new_window4,text='select printer',width=8,bg='grey',command=openfile) | |
# btn1.place(x=650,y=790) | |
################################################## Bestellungs Liste ################################################## | |
def openwindow6() : | |
global new_window | |
font_size = ("ARIEL", 12, "bold") | |
new_window5 = Toplevel(root) | |
screen_width = new_window5.winfo_screenwidth() | |
screen_height = new_window5.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window5.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
new_window5.config(bg='dark slate gray') | |
new_window5.resizable(width=False, height=False) | |
new_window5.configure(bg='SlateGray4') | |
new_window5.title(220 * titlespace + "Liste") | |
new_window5.resizable(width=False, height=False) | |
Frame12 = Frame(new_window5, width=550, bg='white', bd=4, height=1200) | |
Frame12.place(x=0, y=0) | |
Frame22 = Frame(new_window5, width=1050, bd=4, height=400) | |
Frame22.place(x=500, y=510) | |
Frame32 = Frame(new_window5, width=550, bg='white', bd=4, height=600) | |
Frame32.place(x=1045, y=0) | |
# bestell_liste: Listbox=Listbox(Frame1,bd=6,width=20,height=25,bg='white') | |
# bestell_liste.place(x=35,y=65) | |
# bestell_liste.config(font=('arial', 16, 'bold')) | |
# nr_liste = Listbox(Frame1, bd=6, width=2, height=25, bg='white') | |
# nr_liste.place(x=0, y=65) | |
# nr_liste.config(font=('arial', 16, 'bold')) | |
Update = Label(Frame12, text=' Heute Bestellung ', font=font_size, bd=4, bg='SlateGray3', height=1, width=48) | |
Update.place(x=0, y=0) | |
# nr = Label(Frame1, text='Nr ', font=('arial', 16, 'bold'), bd=4, bg='white', height=1, width=2) | |
# nr.place(x=0, y=35) | |
# name = Label(Frame1, text='Name ', font=('arial', 16, 'bold'), bd=4, bg='white', height=1 ) | |
# name.place(x=60, y=35) | |
KundenidE = Entry(new_window5, width=6, bd=5, bg='white smoke') | |
KundenidE.place(x=510, y=35) | |
KundenidE.configure(font=font_size) | |
NameE = Entry(new_window5, bd=5, width=25, bg='white smoke') | |
NameE.place(x=510, y=94) | |
NameE.configure(font=font_size) | |
AdresseE = Entry(new_window5, width=30, bd=5, font=("Helvetica", 12, 'bold')) | |
AdresseE.place(x=510, y=162) | |
HauesnrE = Entry(new_window5, bd=5, width=4, bg='white smoke') | |
HauesnrE.place(x=810, y=162) | |
HauesnrE.configure(font=font_size) | |
PLZE = Entry(new_window5, bd=5, width=7, bg='white smoke') | |
PLZE.place(x=510, y=230) | |
PLZE.configure(font=font_size) | |
ORTE = Entry(new_window5, bd=5, width=15, bg='white smoke') | |
ORTE.place(x=680, y=230) | |
ORTE.configure(font=font_size) | |
TelefonnummerE = Entry(new_window5, bd=5, width=20, bg='white smoke') | |
TelefonnummerE.place(x=630, y=35) | |
TelefonnummerE.configure(font=font_size) | |
EmailE = Entry(new_window5, bd=5, width=30, bg='white smoke') | |
EmailE.place(x=510, y=300) | |
EmailE.configure(font=font_size) | |
BestellzeitE = Entry(new_window5, width=20, bd=5) | |
BestellzeitE.place(x=510, y=370) | |
BestellzeitE.configure(font=font_size) | |
bedinerE = Entry(new_window5, bd=5, width=10, bg='white smoke') | |
bedinerE.place(x=610, y=410) | |
bedinerE.configure(font=font_size) | |
lieferzeitE = Entry(new_window5, bd=5, width=10, bg='white smoke') | |
lieferzeitE.place(x=610, y=453) | |
lieferzeitE.configure(font=font_size) | |
GpreisE = Entry(new_window5, bd=5, width=10, bg='white smoke') | |
GpreisE.place(x=940, y=453) | |
GpreisE.configure(font=font_size) | |
sucheE = Entry(new_window5, bd=5, width=15, bg='white smoke') | |
sucheE.place(x=170, y=510) | |
sucheE.configure(font=font_size) | |
# -------------------------------------------- Labels ------------------------------------------------------------# | |
Kundenid = Label(new_window5, bd=0, text='Kunden/ID', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=10) | |
Name = Label(new_window5, bd=0, text='Name:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=70) | |
Adresse = Label(new_window5, bd=0, text='Straße:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=135) | |
Hausnr = Label(new_window5, bd=0, text='Nr:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=810, y=135) | |
PLZ = Label(new_window5, bd=0, text='PLZ:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=205) | |
Ort = Label(new_window5, bd=0, text='ORT:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=675, y=205) | |
Telefonnummer = Label(new_window5, bd=0, text='Telefonnummer:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=630, y=10) | |
Email = Label(new_window5, bd=0, text='Email:', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=272) | |
Bestellzeit = Label(new_window5, bd=0, text='Bestellzeit:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=342) | |
bediner = Label(new_window5, bd=0, text='Bediener:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=415) | |
LIEFERZEIT = Label(new_window5, bd=0, text='Lieferzet:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=510, y=455) | |
GesamtPreis = Label(new_window5, bd=0, text='Gesamte Preis:', font=('arial', 16, 'bold'), bg='SlateGray4') \ | |
.place(x=750, y=455) | |
suchenl = Label(new_window5, bd=0, text='Name eingeben :', font=('arial', 14, 'bold'), bg='SlateGray4') \ | |
.place(x=0, y=510) | |
Lieferungl = Label(new_window5, bd=0, text='Lieferung ', font=('arial', 20, 'bold'), bg='SlateGray4') \ | |
.place(x=345, y=440) | |
Abholungl = Label(new_window5, bd=0, text='Abholung ', font=('arial', 20, 'bold'), bg='SlateGray4') \ | |
.place(x=1400, y=440) | |
# ---------------------------------------------Bbestelltree---------------------------------------------------------# | |
style = ttk.Style() | |
style.theme_use("clam") | |
style.configure("Treeview", background='white', foreground="black", rowheight=25, font=("ARIEL", 9, 'bold'), | |
fieldbackground="silver", width=None, height=None) | |
style.map('Treeview', background=[('selected', 'red')]) | |
style.configure("Treeview.Heading", font=('bold', 12)) | |
style.configure("Treeview.column", font=('bold', 6)) | |
style.configure('Treeview', rowheight=40) | |
style.configure('Treeview.row', font=('bold', 20)) | |
myTree = ttk.Treeview(Frame22) | |
myTree['columns'] = ("pos", "Grosse", "Anzahl", "Nr", "Speise", "Mit", "Ohne", "Katagorie", "Preis",) | |
myTree.column("#0", width=0, stretch=NO) | |
myTree.column("pos", anchor=CENTER, width=40, stretch=TRUE, ) | |
myTree.column("Grosse", anchor=CENTER, width=80) | |
myTree.column("Anzahl", anchor=CENTER, width=35) | |
myTree.column("Nr", anchor=CENTER, width=35) | |
myTree.column("Speise", anchor=W, width=120) | |
myTree.column("Mit", anchor=W, width=430, stretch=TRUE) | |
myTree.column("Ohne", anchor=W, width=190, stretch=TRUE) | |
myTree.column("Katagorie", anchor=CENTER, width=80) | |
myTree.column("Preis", anchor=CENTER, width=80) | |
myTree.tag_configure('pos', background='gray') | |
myTree.heading("#0", text="", anchor=W) | |
myTree.heading("pos", text="pos", anchor=W) | |
myTree.heading("Grosse", text="Grosse", anchor=W) | |
myTree.heading("Anzahl", text="Anzahl", anchor=W) | |
myTree.heading("Nr", text="Nr", anchor=W) | |
myTree.heading("Speise", text="Speise", anchor=CENTER) | |
myTree.heading("Mit", text="Mit", anchor=CENTER) | |
myTree.heading("Ohne", text="Ohne", anchor=CENTER) | |
myTree.heading("Katagorie", text="Katagorie", anchor=CENTER) | |
myTree.heading("Preis", text="Preis", anchor=W) | |
myTree.pack() | |
# ------------------------------------------------------------------------------------------------------------------# | |
besteltree = ttk.Treeview(Frame12) | |
besteltree['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr") | |
besteltree.column("#0", width=0, stretch=NO) | |
besteltree.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree.column("Name", anchor=CENTER, width=120) | |
besteltree.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree.column("Straße", anchor=W, width=120) | |
besteltree.column("Haus/nr", anchor=W, width=40) | |
besteltree.tag_configure('pos', background='white') | |
besteltree.heading("#0", text="", anchor=W) | |
besteltree.heading("Nr", text="Nr", anchor=W) | |
besteltree.heading("Name", text="Name", anchor=W) | |
besteltree.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree.heading("Straße", text="Straße", anchor=W) | |
besteltree.heading("Haus/nr", text="nr", anchor=W) | |
besteltree.pack() | |
# ------------------------------------------------AbholTree---------------------------------------------------------# | |
besteltree1 = ttk.Treeview(Frame32) | |
besteltree1['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr") | |
besteltree1.column("#0", width=0, stretch=NO) | |
besteltree1.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree1.column("Name", anchor=CENTER, width=120) | |
besteltree1.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree1.column("Straße", anchor=W, width=120) | |
besteltree1.column("Haus/nr", anchor=W, width=40) | |
besteltree1.tag_configure('pos', background='white') | |
besteltree1.heading("#0", text="", anchor=W) | |
besteltree1.heading("Nr", text="Nr", anchor=W) | |
besteltree1.heading("Name", text="Name", anchor=W) | |
besteltree1.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree1.heading("Straße", text="Straße", anchor=W) | |
besteltree1.heading("Haus/nr", text="nr", anchor=W) | |
besteltree1.pack() | |
# ----------------------------------------------------------get bestelldata und insert in Tree----------------------# | |
abhol = 'ABHOLUNG' | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where kstrasse!=(?) order by ID DESC ', (abhol,)) | |
firo = cur.fetchall() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn1.cursor() | |
cur1.execute('select * from kundeinfo where kstrasse =(?) order by ID DESC ', (abhol,)) | |
firo1 = cur1.fetchall() | |
# ------------------------------------------------------------------------------------------------------------------# | |
global count | |
count = 0 | |
for ziko in firo : | |
besteltree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(ziko[0], ziko[3], ziko[10], ziko[4], ziko[5])) | |
count += 1 | |
global counts | |
counts = 0 | |
for ziko1 in firo1 : | |
besteltree1.insert(parent='', open=True, index='end', iid=counts, text='', | |
values=(ziko1[0], ziko1[3], ziko1[10], ziko1[4], ziko1[5])) | |
counts += 1 | |
# -------------------------------------------- Functions ---------------------------------------------------------# | |
# ------------------------------------------------------ Bestellung aus der Data base Löschen ----------------------# | |
def clear() : | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
bestel = ('kundeinfo') | |
cur.execute('delete from kundeinfo') | |
cur.execute('delete from sqlite_sequence where name = (?)', (bestel,)) | |
conn.commit() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
cur1.execute('delete from speiseinfo') | |
conn1.commit() | |
new_window5.destroy() | |
openwindow6() | |
# ------------------------------------------------------------------------------------------------------------------# | |
def bestat() : | |
sick100 = besteltree.focus() | |
times = (besteltree.item(sick100)['values'][2]) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('delete from kundeinfo where zeit=(?)', (times,)) | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
cur1.execute('delete from speiseinfo where zeit=(?)', (times,)) | |
conn.commit() | |
conn1.commit | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
new_window5.destroy() | |
openwindow6() | |
# ------------------------------------------------------------------------------------------------------------------# | |
# ---------------------------------------------- Bestellung Abrufen (Lieferung) ------------------------------------# | |
def clicking(e=NONE) : | |
global count | |
KundenidE.config(state=NORMAL) | |
TelefonnummerE.config(state=NORMAL) | |
NameE.config(state=NORMAL) | |
AdresseE.config(state=NORMAL) | |
ORTE.config(state=NORMAL) | |
PLZE.config(state=NORMAL) | |
EmailE.config(state=NORMAL) | |
BestellzeitE.config(state=NORMAL) | |
bedinerE.config(state=NORMAL) | |
lieferzeitE.config(state=NORMAL) | |
HauesnrE.config(state=NORMAL) | |
GpreisE.config(state=NORMAL) | |
count = 0 | |
sick100 = besteltree.focus() | |
numos = (besteltree.item(sick100)['values'][0]) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where ID =(?) ', (numos,)) | |
tor = cur.fetchall() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
cur1.execute('select zeit from kundeinfo where ID =(?) ', (numos,)) | |
tor1 = str(cur1.fetchall()) | |
tor1.strip() | |
tor2 = tor1.replace('[', '').replace(']', '').replace('(', '').replace(')', '').replace("'", '').replace(',', | |
'') | |
for na in tor : | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
KundenidE.insert(0, na[1]) | |
TelefonnummerE.insert(0, na[2]) | |
NameE.insert(0, na[3]) | |
AdresseE.insert(0, na[4]) | |
HauesnrE.insert(0, na[5]) | |
PLZE.insert(0, na[6]) | |
ORTE.insert(0, na[7]) | |
EmailE.insert(0, na[8]) | |
BestellzeitE.insert(0, na[10]) | |
bedinerE.insert(0, na[9]) | |
GpreisE.insert(0, na[13]) | |
KundenidE.config(state=DISABLED) | |
TelefonnummerE.config(state=DISABLED) | |
NameE.config(state=DISABLED) | |
AdresseE.config(state=DISABLED) | |
ORTE.config(state=DISABLED) | |
PLZE.config(state=DISABLED) | |
EmailE.config(state=DISABLED) | |
BestellzeitE.config(state=DISABLED) | |
bedinerE.config(state=DISABLED) | |
HauesnrE.config(state=DISABLED) | |
GpreisE.config(state=DISABLED) | |
if na[11] != '' : | |
lieferzeitE.insert(0, na[11]) | |
lieferzeitE.config(state=DISABLED) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from speiseinfo where zeit =(?) ', (tor2,)) | |
cos = cur.fetchall() | |
for zol in cos : | |
myTree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(zol[1], zol[2], zol[3], | |
zol[4], zol[5], | |
zol[6], zol[7], zol[8], zol[9])) | |
count += 1 | |
# ------------------------------------------------------------------------------------------------------------------# | |
# --------------------------------------------Bestellunh Abrufen (Abholung)-----------------------------------------# | |
def clicking1(e=NONE) : | |
global count | |
KundenidE.config(state=NORMAL) | |
TelefonnummerE.config(state=NORMAL) | |
NameE.config(state=NORMAL) | |
AdresseE.config(state=NORMAL) | |
ORTE.config(state=NORMAL) | |
PLZE.config(state=NORMAL) | |
EmailE.config(state=NORMAL) | |
BestellzeitE.config(state=NORMAL) | |
bedinerE.config(state=NORMAL) | |
lieferzeitE.config(state=NORMAL) | |
HauesnrE.config(state=NORMAL) | |
GpreisE.config(state=NORMAL) | |
count = 0 | |
sick100 = besteltree1.focus() | |
numos = (besteltree1.item(sick100)['values'][0]) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where ID =(?) ', (numos,)) | |
tor = cur.fetchall() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn.cursor() | |
abhol = 'ABHOLUNG' | |
cur1.execute('select zeit from kundeinfo where ID =(?) ', (numos,)) | |
tor1 = str(cur1.fetchall()) | |
tor1.strip() | |
tor2 = tor1.replace('[', '').replace(']', '').replace('(', '').replace(')', '').replace("'", '').replace(',', | |
'') | |
for na in tor : | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
KundenidE.insert(0, na[1]) | |
TelefonnummerE.insert(0, na[2]) | |
NameE.insert(0, na[3]) | |
AdresseE.insert(0, na[4]) | |
HauesnrE.insert(0, na[5]) | |
PLZE.insert(0, na[6]) | |
ORTE.insert(0, na[7]) | |
EmailE.insert(0, na[8]) | |
BestellzeitE.insert(0, na[10]) | |
bedinerE.insert(0, na[9]) | |
GpreisE.insert(0, na[13]) | |
KundenidE.config(state=DISABLED) | |
TelefonnummerE.config(state=DISABLED) | |
NameE.config(state=DISABLED) | |
AdresseE.config(state=DISABLED) | |
ORTE.config(state=DISABLED) | |
PLZE.config(state=DISABLED) | |
EmailE.config(state=DISABLED) | |
BestellzeitE.config(state=DISABLED) | |
bedinerE.config(state=DISABLED) | |
HauesnrE.config(state=DISABLED) | |
GpreisE.config(state=DISABLED) | |
if na[11] != '' : | |
lieferzeitE.insert(0, na[11]) | |
lieferzeitE.config(state=DISABLED) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from speiseinfo where zeit =(?) ', (tor2,)) | |
cos = cur.fetchall() | |
for zol in cos : | |
myTree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(zol[1], zol[2], zol[3], | |
zol[4], zol[5], | |
zol[6], zol[7], zol[8], zol[9])) | |
count += 1 | |
# ------------------------------------------------------------------------------------------------------------------# | |
def Reset() : | |
KundenidE.config(state=NORMAL) | |
TelefonnummerE.config(state=NORMAL) | |
NameE.config(state=NORMAL) | |
AdresseE.config(state=NORMAL) | |
ORTE.config(state=NORMAL) | |
PLZE.config(state=NORMAL) | |
EmailE.config(state=NORMAL) | |
BestellzeitE.config(state=NORMAL) | |
bedinerE.config(state=NORMAL) | |
lieferzeitE.config(state=NORMAL) | |
HauesnrE.config(state=NORMAL) | |
GpreisE.config(state=NORMAL) | |
KundenidE.delete(0, END) | |
for record in myTree.get_children() : | |
myTree.delete(record) | |
for tom in besteltree.get_children() : | |
besteltree.delete(tom) | |
TelefonnummerE.delete(0, END) | |
NameE.delete(0, END) | |
AdresseE.delete(0, END) | |
HauesnrE.delete(0, END) | |
PLZE.delete(0, END) | |
ORTE.delete(0, END) | |
EmailE.delete(0, END) | |
lieferzeitE.delete(0, END) | |
bedinerE.delete(0, END) | |
BestellzeitE.delete(0, END) | |
GpreisE.delete(0, END) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo ') | |
firo = cur.fetchall() | |
count = 0 | |
for ziko in firo : | |
besteltree.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(ziko[0], ziko[3], ziko[10], ziko[4])) | |
count += 1 | |
# ------------------------------------------------------------------------------------------------------------------# | |
def search_data() : | |
country = 0 | |
get_record = sucheE.get() | |
for record in besteltree.get_children() : | |
besteltree.delete(record) | |
sucheE.delete(0, END) | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select * from kundeinfo where kname like (?) ', (get_record,)) | |
toz = cur.fetchall() | |
print(get_record) | |
for item in toz : | |
besteltree.insert(parent='', open=True, index='end', iid=country, text='', | |
values=(item[0], item[3], item[10], item[4])) | |
country += 1 | |
# ---------------------------------------------- Buttons -----------------------------------------------------------# | |
show = Button(new_window5, bd=4, text='Abrufen', width=10, height=2, bg='green', command=clicking) | |
show.place(x=100, y=442) | |
show = Button(new_window5, bd=4, text='Abrufen', width=10, height=2, bg='green', command=clicking1) | |
show.place(x=1120, y=442) | |
besteltree.bind('<Double-Button-1>', clicking) | |
delete_ = Button(new_window5, bd=4, text='Alles Löschen', width=10, height=2, bg='red', command=clear) | |
delete_.place(x=0, y=442) | |
# buchen = Button(new_window5, bd=4, text='Büchen', width=10, height=2, bg='cadetblue', command=bestat) | |
# buchen.place(x=1200, y=50) | |
reset_ = Button(new_window5, bd=4, text='Reset', width=10, height=2, bg='Blue', command=Reset) | |
reset_.place(x=200, y=442) | |
sucheb_ = Button(new_window5, bd=4, text='Suche', width=8, height=1, bg='CADET BLUE', command=search_data) | |
sucheb_.place(x=320, y=510) | |
# -------------------------------------------------- Liefranet _ Rechunung---------------------------------------------- | |
def openwindow7() : | |
global new_window | |
font_size = ("ARIEL", 12, "bold") | |
new_window6 = Toplevel(root) | |
screen_width = new_window6.winfo_screenwidth() | |
screen_height = new_window6.winfo_screenheight() | |
x_cordinate = int((screen_width / 2) - (window_width / 2)) | |
y_cordinate = int((screen_height / 2) - (window_height / 2)) | |
new_window6.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate)) | |
new_window6.resizable(width=False, height=False) | |
new_window6.configure(bg='cadet blue') | |
new_window6.title(220 * titlespace + "Liste") | |
new_window6.resizable(width=False, height=False) | |
Frame1 = Frame(new_window6, width=300, bg='SlateGray4', bd=4, height=459, relief=RIDGE) | |
Frame1.place(x=0, y=0) | |
Frame6 = Frame(new_window6, width=300, bg='SlateGray4', bd=4, height=140, relief=RIDGE) | |
Frame6.place(x=0, y=500) | |
Frame2 = Frame(new_window6, width=450, bg='grey', bd=4, height=400, relief=RIDGE) | |
Frame2.place(x=300, y=60) | |
Frame3 = Frame(new_window6, width=560, bg='grey', bd=4, height=750, relief=RIDGE) | |
Frame3.place(x=1050, y=60) | |
Frame4 = Frame(new_window6, width=450, bg='grey', bd=4, height=400, relief=RIDGE) | |
Frame4.place(x=300, y=500) | |
# Frame6 = Frame(new_window6, width=600, bg='white', bd=4, height=260, relief=RIDGE) | |
# Frame6.place(x=0, y=650) | |
Frame5 = Frame(new_window6, width=600, bg='SlateGray4', bd=4, height=240, relief=RIDGE) | |
Frame5.place(x=5, y=650) | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute("""Create Table Lieferanten ( ID integer primary key AUTOINCREMENT, Name TEXT ) """) | |
# conn.commit() | |
# ------------------------------------------------ functions--------------------------------------------------------# | |
def name_speich() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
siko = NameE.get() | |
cur.execute('insert into Lieferanten values(Null,?)', (siko,)) | |
conn.commit() | |
NameE.delete(0, END) | |
new_window6.destroy() | |
openwindow7() | |
# ------------------------------------------------Labels------------------------------------------------------------# | |
fahrerl = Label(Frame1, text='Fahrer erstellen ', bg='cadet blue', bd=0, relief=RIDGE, font=font_size, width=28) | |
fahrerl.place(x=0, y=5) | |
Namel = Label(Frame1, text='Name:', bg='SlateGray4', bd=0, font=font_size) | |
Namel.place(x=0, y=35) | |
fahrerlo = Label(Frame1, text='Fahrer Löschen ', bg='cadet blue', bd=0, relief=RIDGE, font=font_size, width=28) | |
fahrerlo.place(x=0, y=65) | |
fahrerlis = Label(Frame1, text='Fahrer Liste', bg='cadet blue', bd=0, relief=RIDGE, font=font_size, width=28) | |
fahrerlis.place(x=0, y=140) | |
namel = Label(Frame1, text='Namen', bg='SlateGray4', bd=0, relief=RIDGE, font=font_size, width=10) | |
namel.place(x=0, y=165) | |
namef = Label(Frame6, text='Fahrer', bg='SlateGray4', bd=0, relief=RIDGE, font=('arial', 16, 'bold')) | |
namef.place(x=15, y=5) | |
nummer = Label(new_window6, text=' BestellungsNr:', bg='cadet blue', bd=0, font=('arial', 16, 'bold')) | |
nummer.place(x=600, y=20) | |
ofennebes = Label(new_window6, text=' Offene Bestellung:', bg='cadet blue', bd=0, font=('arial', 16, 'bold')) | |
ofennebes.place(x=1200, y=20) | |
pendingl = Label(new_window6, text=' Pending', bg='cadet blue', bd=0, font=('arial', 16, 'bold')) | |
pendingl.place(x=470, y=470) | |
Anzahl = Label(Frame5, text=' Anzahl/B', bg='SlateGray4', bd=0, font=('arial', 16, 'bold')) | |
Anzahl.place(x=175, y=10) | |
Datum = Label(Frame5, text=' Datum', bg='SlateGray4', bd=0, font=('arial', 16, 'bold')) | |
Datum.place(x=290, y=10) | |
GPreis = Label(Frame5, text=' Gesamt preis', bg='SlateGray4', bd=0, font=('arial', 16, 'bold')) | |
GPreis.place(x=390, y=10) | |
ffahrer = Label(Frame5, text=' Fahrer', bg='SlateGray4', bd=0, font=('arial', 16, 'bold')) | |
ffahrer.place(x=20, y=10) | |
# -----------------------------------------------------------Enetry_Liste----------------------------------------------# | |
NameE = Entry(Frame1, width=15, font=font_size, bd=3, ) | |
NameE.place(x=60, y=35) | |
Fahreliste = Listbox(Frame1, width=20, height=10, font=font_size, bd=0) | |
Fahreliste.place(x=10, y=195) | |
nummerL = Listbox(new_window6, width=3, height=0, font=font_size) | |
nummerL.place(x=1400, y=20) | |
nummerE = Entry(new_window6, width=3, font=font_size, bd=3) | |
nummerE.place(x=760, y=20) | |
AnzE = Entry(Frame5, width=3, font=font_size, bd=3) | |
AnzE.place(x=195, y=40) | |
DatE = Entry(Frame5, width=9, font=font_size, bd=3) | |
DatE.place(x=290, y=40) | |
GesE = Entry(Frame5, width=9, font=font_size, bd=3) | |
GesE.place(x=410, y=40) | |
# -----------------------------------------------------------DropBox----------------------------------------------------# | |
options = [] | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select Name from Lieferanten ') | |
siko = cur.fetchall() | |
for ido in siko : | |
options.insert(0, ido) | |
clicked = StringVar() | |
clicked1 = StringVar() | |
clicked2 = StringVar() | |
drop = OptionMenu(Frame1, clicked, *options) | |
clicked.set(ido[0]) | |
drop.configure(width=15, bd=0, bg='grey', font=font_size) | |
drop.place(x=0, y=95) | |
drop1 = OptionMenu(Frame6, clicked1, *options) | |
drop1.configure(width=10, bd=0, bg='grey', font=('arial', 16, 'bold')) | |
drop1.place(x=0, y=30) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def name_lösch() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
siko = clicked.get() | |
soko = siko.replace("'", "").replace('(', '').replace(')', '').replace(',', '').replace('"', '') | |
cur.execute('delete from Lieferanten where name =(?)', (soko,)) | |
conn.commit() | |
new_window6.destroy() | |
openwindow7() | |
# ----------------------------------------------------------# | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select Name from Lieferanten ') | |
conn.commit() | |
miko = cur.fetchall() | |
for zabir in miko : | |
Fahreliste.insert(0, zabir) | |
# ---------------------------------------------------------------Buttons------------------------------------------------# | |
NameB = Button(Frame1, text='speichern', bd=4, bg='green', command=name_speich).place(x=210, y=33) | |
loschenB = Button(Frame1, text='Löschen', bd=4, bg='red', command=name_lösch) | |
loschenB.place(x=200, y=93) | |
# conn = sqlite3.connect('Einstellung.db') | |
# cur = conn.cursor() | |
# cur.execute("""Create Table Rechnung ( Nr INTEGER, Name TEXT,Datum TEXT, Stasse TEXT, Hnr TEXT,Preis INTEGER ,Fahrer TEXT ) """) | |
# conn.commit() | |
# ------------------------------------------------------Tree1---------------------------------------------------------# | |
style = ttk.Style() | |
style.theme_use("clam") | |
style.configure("Treeview", background='white', foreground="black", rowheight=20, font=("ARIEL", 9, 'bold'), | |
fieldbackground="silver") | |
style.map('Treeview', background=[('selected', 'red')]) | |
style.configure("Treeview.Heading", font=('bold', 12)) | |
style.configure("Treeview.column", font=('bold', 6)) | |
style.configure('Treeview', rowheight=20) | |
style.configure('Treeview.row', font=('bold', 20)) | |
besteltree = ttk.Treeview(Frame2, height=18) | |
besteltree['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr", "Preis") | |
besteltree.column("#0", width=0, stretch=NO) | |
besteltree.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree.column("Name", anchor=CENTER, width=120) | |
besteltree.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree.column("Straße", anchor=W, width=120) | |
besteltree.column("Haus/nr", anchor=W, width=40) | |
besteltree.column("Preis", anchor=W, width=60) | |
besteltree.tag_configure('pos', background='white') | |
besteltree.heading("#0", text="", anchor=W) | |
besteltree.heading("Nr", text="Nr", anchor=W) | |
besteltree.heading("Name", text="Name", anchor=W) | |
besteltree.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree.heading("Straße", text="Straße", anchor=W) | |
besteltree.heading("Haus/nr", text="nr", anchor=W) | |
besteltree.heading("Preis", text="Preis", anchor=W) | |
besteltree.pack() | |
# ------------------------------------------------------- Tree2---------------------------------------------------------# | |
besteltree1 = ttk.Treeview(Frame3, height=27) | |
besteltree1['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr", "Preis") | |
besteltree1.column("#0", width=0, stretch=NO) | |
besteltree1.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree1.column("Name", anchor=CENTER, width=120) | |
besteltree1.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree1.column("Straße", anchor=W, width=120) | |
besteltree1.column("Haus/nr", anchor=W, width=40) | |
besteltree1.column("Preis", anchor=W, width=60) | |
besteltree1.tag_configure('pos', background='white') | |
besteltree1.heading("#0", text="", anchor=W) | |
besteltree1.heading("Nr", text="Nr", anchor=W) | |
besteltree1.heading("Name", text="Name", anchor=W) | |
besteltree1.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree1.heading("Straße", text="Straße", anchor=W) | |
besteltree1.heading("Haus/nr", text="nr", anchor=W) | |
besteltree1.heading("Preis", text="Preis", anchor=W) | |
besteltree1.pack() | |
# ----------------------------------------------------- Tree 3 ---------------------------------------------------------# | |
besteltree2 = ttk.Treeview(Frame4, height=5) | |
besteltree2['columns'] = ("Nr", "Name", "Datum/Uhrzeit", "Straße", "Haus/nr", "Preis") | |
besteltree2.column("#0", width=0, stretch=NO) | |
besteltree2.column("Nr", anchor=CENTER, width=40, stretch=TRUE, ) | |
besteltree2.column("Name", anchor=CENTER, width=120) | |
besteltree2.column("Datum/Uhrzeit", anchor=W, width=160) | |
besteltree2.column("Straße", anchor=W, width=120) | |
besteltree2.column("Haus/nr", anchor=W, width=40) | |
besteltree2.column("Preis", anchor=W, width=60) | |
besteltree2.tag_configure('pos', background='white') | |
besteltree2.heading("#0", text="", anchor=W) | |
besteltree2.heading("Nr", text="Nr", anchor=W) | |
besteltree2.heading("Name", text="Name", anchor=W) | |
besteltree2.heading("Datum/Uhrzeit", text="Datum/Uhrzeit", anchor=W) | |
besteltree2.heading("Straße", text="Straße", anchor=W) | |
besteltree2.heading("Haus/nr", text="nr", anchor=W) | |
besteltree2.heading("Preis", text="Preis", anchor=W) | |
besteltree2.pack() | |
# -------------------------------------------- Tress Functions ---------------------------------------------------------# | |
def besteliste() : | |
for record in besteltree1.get_children() : | |
besteltree1.delete(record) | |
count = 0 | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn1.cursor() | |
cur1.execute('select * from kundeinfo ') | |
firo = cur1.fetchall() | |
for ziko in firo : | |
besteltree1.insert(parent='', open=True, index='end', iid=count, text='', | |
values=(ziko[0], ziko[3], ziko[10], ziko[4], ziko[5], ziko[13])) | |
count += 1 | |
zuzu = besteltree1.get_children() | |
moso = len(zuzu) | |
nummerL.delete(0, END) | |
nummerL.insert(0, moso) | |
besteliste() | |
global zaro | |
zaro = 0 | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def add_fun() : | |
global zaro | |
zopl = nummerE.get() | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select* from kundeinfo where ID=(?)', (zopl,)) | |
bol = cur.fetchall() | |
for opo in bol : | |
besteltree.insert(parent='', open=True, index='end', iid=zaro, text='', | |
values=(opo[0], opo[3], opo[10], opo[4], opo[5], opo[13])) | |
zaro += 1 | |
cur.execute('delete from kundeinfo where ID=(?)', (zopl,)) | |
conn.commit() | |
nummerE.delete(0, END) | |
besteliste() | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def add_abhol() : | |
global zaro | |
zopl = 'ABHOLUNG' | |
conn = sqlite3.connect('OrderData.db') | |
cur = conn.cursor() | |
cur.execute('select* from kundeinfo where kstrasse =(?)', (zopl,)) | |
bol = cur.fetchall() | |
for opo in bol : | |
besteltree.insert(parent='', open=True, index='end', iid=zaro, text='', | |
values=(opo[0], opo[3], opo[10], opo[4], opo[5], opo[13])) | |
zaro += 1 | |
cur.execute('delete from kundeinfo WHERE kstrasse =(?)', (zopl,)) | |
conn.commit() | |
nummerE.delete(0, END) | |
besteliste() | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def pending() : | |
global zazo | |
selected = besteltree.selection()[0] | |
values = besteltree.item(selected, 'values') | |
besteltree.delete(selected) | |
countss = 0 | |
besteltree2.insert(parent='', open=True, index='end', text='', | |
values=(values[0], values[1], values[2], values[3], values[4], values[5])) | |
countss += 1 | |
# ------------------------------------------------- Tree Buttons -------------------------------------------------------# | |
add = Button(new_window6, text='Add', bg='green', width=4, bd=4, command=add_fun, state=DISABLED) | |
add.place(x=800, y=20) | |
pend = Button(new_window6, text='Pend', bg='red', width=7, bd=4, command=pending, state=DISABLED) | |
pend.place(x=860, y=20) | |
addabh = Button(new_window6, text='Alle Abholung', bg='green', width=11, bd=4, command=add_abhol, state=DISABLED) | |
addabh.place(x=1480, y=20) | |
# ----------------------------------------------------------------------------------------------------------------------# | |
def Speichern() : | |
siko = str(clicked1.get()) | |
soko = siko.replace("'", "").replace('(', '').replace(')', '').replace(',', '').replace('"', '') | |
print(soko) | |
solo = besteltree.get_children() | |
for line in solo : | |
sick100 = (besteltree.item(line)['values'][0]) | |
sick101 = (besteltree.item(line)['values'][1]) | |
sick102 = (besteltree.item(line)['values'][2]) | |
sick103 = (besteltree.item(line)['values'][3]) | |
sick104 = (besteltree.item(line)['values'][4]) | |
sick105 = (besteltree.item(line)['values'][5]) | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute( | |
""" insert into Rechnung (Nr,Name,Datum,stasse,Hnr,Preis,Fahrer)values(:Nr,:Name,:Datum,:stasse,:Hnr,:Preis,:Fahrer)""", | |
{'Nr' : sick100, | |
'Name' : sick101, | |
'Datum' : sick102, | |
'stasse' : sick103, | |
'Hnr' : sick104, | |
'Preis' : sick105, | |
'Fahrer' : soko | |
}) | |
conn.commit() | |
for record in besteltree.get_children() : | |
besteltree.delete(record) | |
new_window6.overrideredirect(False) | |
drop1.config(state=ACTIVE) | |
clicked1.set('') | |
Strat.config(state=ACTIVE) | |
add.config(state=DISABLED) | |
pend.config(state=DISABLED) | |
Done = Button(new_window6, text='Fertig', font=font_size, bg='red', width=5, height=1, bd=6, | |
command=Speichern, state=DISABLED) | |
Done.place(x=850, y=410) | |
# ---------------------------------------- Straten Abrechnung ------------------------------------------------------# | |
def abrechnung() : | |
sok = clicked1.get() | |
sol = len(sok) | |
if sol < 3 : | |
messagebox.showerror('Error', 'Fahrer aussuchen') | |
else : | |
drop1.config(state=DISABLED) | |
add.config(state=ACTIVE) | |
pend.config(state=ACTIVE) | |
addabh.config(state=ACTIVE) | |
new_window6.overrideredirect(True) | |
Strat.config(state=DISABLED) | |
Done.config(state=ACTIVE) | |
Strat = Button(Frame6, text='Abrechnung', font=font_size, bg='blue', bd=6, command=abrechnung) | |
Strat.place(x=170, y=84) | |
# --------------------------------- jeder Fahrer Rechnung(summe) --------------------------------------------------# | |
def fahrer(e=None) : | |
count = 0 | |
soko = str(clicked2.get()) | |
siko = soko.replace("'", "").replace('(', '').replace(')', '').replace(',', '').replace('"', '') | |
conn = sqlite3.connect("Einstellung.db") | |
cur = conn.cursor() | |
cur1 = conn.cursor() | |
cur2 = conn.cursor() | |
cur.execute('select * from Rechnung ') | |
cur2.execute('select ROUND (SUM(Preis),0) from Rechnung Where Fahrer =(?)', (siko,)) | |
cur1.execute('select count(*) from Rechnung Where Fahrer =(?)', (siko,)) | |
tol = cur1.fetchall() | |
zoro = cur2.fetchall() | |
fob = cur.fetchall() | |
conn.commit() | |
conn.close() | |
datum = datetime.now().strftime("%d.%m.%Y") | |
for ziko in fob : | |
print(ziko) | |
anzahl = ziko[0] | |
AnzE.delete(0, END) | |
DatE.delete(0, END) | |
GesE.delete(0, END) | |
AnzE.insert(0, tol) | |
GesE.insert(0, zoro) | |
DatE.insert(0, datum) | |
drop2 = OptionMenu(Frame5, clicked2, *options, command=fahrer) | |
drop2.configure(width=10, bd=0, bg='grey', font=('arial', 16, 'bold')) | |
drop2.place(x=0, y=45) | |
# ------------------------------------------------------------------------------------------------------------------# | |
def unpending() : | |
selected = besteltree2.selection()[0] | |
values = besteltree2.item(selected, 'values') | |
besteltree2.delete(selected) | |
zazo = 0 | |
besteltree.insert(parent='', open=True, index='end', text='', | |
values=(values[0], values[1], values[2], values[3], values[4], values[5])) | |
unpend = Button(new_window6, text='Unpend', font=font_size, bg='green', bd=6, command=unpending) | |
unpend.place(x=850, y=500) | |
conn = sqlite3.connect('Pending.db') | |
cur = conn.cursor() | |
conn.commit() | |
############################################# Alle Rechnung von Alle Fahrer########################################## | |
def fahreren() : | |
fa = clicked2.get() | |
siko = fa.replace("'", "").replace('(', '').replace(')', '').replace(',', '').replace('"', '') | |
an = AnzE.get() | |
da = DatE.get() | |
ge = GesE.get() | |
conn = sqlite3.connect('Pending.db') | |
cur = conn.cursor() | |
cur.execute('Insert into pending (Anzahl,Datum,Gesamt,Fahrer) values(?,?,?,?)', (an, da, ge, siko)) | |
conn.commit() | |
conn1 = sqlite3.connect('Einstellung.db') | |
cur1 = conn1.cursor() | |
cur1.execute('delete from Rechnung where fahrer =(?)', (siko,)) | |
conn1.commit() | |
new_window6.destroy() | |
openwindow7() | |
dru = Button(Frame5, text='Drucken', bg='green', font=font_size, bd=2, command=fahreren) | |
dru.place(x=500, y=195) | |
# liefer = Label(Frame5, text='Mindestpreise :', bg='white', font=font_size, bd=2) | |
# liefer.place(x=50, y=195) | |
# liefer = Label(Frame5, text='Mindestpreise :', bg='white', font=font_size, bd=2) | |
# liefer.place(x=50, y=195) | |
####-------------------------------------- FIERAMT -------------------------------------------------------# | |
def fieramt() : | |
ask = messagebox.askyesno('Fieramt', 'Sind Sie sicher') | |
if ask == 1 : | |
os.remove('Pending.db') | |
os.remove('OrderData.db') | |
conn = sqlite3.connect('Pending.db') | |
cur = conn.cursor() | |
cur.execute('Create Table pending (Anzahl INTEGER , Datum INTEGER, Gesamt INTEGER ,Fahrer TEXT)') | |
conn.commit() | |
conn1 = sqlite3.connect('OrderData.db') | |
cur1 = conn1 | |
cur1.execute("""Create Table kundeinfo( | |
ID integer primary key AUTOINCREMENT UNIQUE, | |
kid INTEGER, | |
ktelefonnummer INTEGER, | |
kname TEXT, | |
kstrasse TEXT, | |
khausnr INTEGER, | |
kplz INTEGER, | |
kort TEXT, | |
kemail TEXT, | |
bediener TEXT, | |
zeit INTEGER, | |
bestellzeit INTEGER, | |
externinfo TEXT, | |
gesamtepreis INTEGER)""") | |
cur1.execute("""Create Table speiseinfo( | |
zeit INTEGER, | |
pos INTEGER, | |
grosse TEXT, | |
anzahl INTEGER, | |
nr INTEGER, | |
speise TEXT, | |
mit TEXT, | |
ohne TEXT, | |
katagorie TEXT, | |
preis INTEGER, | |
name TEXT )""") | |
cur1.commit() | |
conn2 = sqlite3.connect('Einstellung.db') | |
cur2 = conn2.cursor() | |
cur2.execute('delete from Rechnung ') | |
conn2.commit() | |
root.destroy() | |
ti = 0 | |
# This variable stores the name | |
# of the process we are terminating | |
# The extension should also be | |
# included in the name | |
name = 'Firefox' | |
# Initializing the wmi object | |
f = wmi.WMI() | |
# Iterating through all the | |
# running processes | |
for process in f.Win32_Process() : | |
# Checking whether the process | |
# name matches our specified name | |
if process.name == name : | |
# If the name matches, | |
# terminate the process | |
process.Terminate() | |
# This increment would acknowledge | |
# about the termination of the | |
# Processes, and would serve as | |
# a counter of the number of processes | |
# terminated under the same name | |
ti += 1 | |
else : | |
pass | |
fierB = Button(new_window6, text='Fieramt', bd=4, font=font_size, height=3, bg='red', command=fieramt) | |
fierB.place(x=1510, y=820) | |
def openwindow8() : | |
global font_size | |
def installed_printer() : | |
printers = win32print.EnumPrinters(2) | |
for p in printers : | |
return (p) | |
printerdef = '' | |
# connec=sqlite3.connect('Einstellung.db') | |
# cur=connec.cursor() | |
# cur.execute("""create Table printer3 (printer TEXT,Kat1 TEXT,Kat2 TEXT, | |
# Kat3 TEXT,Kat4 TEXT,Kat5 TEXT,Kat6 TEXT,Kat7 TEXT,Kat8 TEXT,Kat9 TEXT,Kat10 TEXT)""") | |
# connec.commit() | |
def locprinter() : | |
pt = Toplevel() | |
pt.geometry("250x250") | |
pt.title("choose printer") | |
var1 = StringVar() | |
LABEL = Label(pt, text="select Printer").pack() | |
PRCOMBO = ttk.Combobox(pt, width=35, textvariable=var1) | |
print_list = [] | |
printers = list(win32print.EnumPrinters(2)) | |
for i in printers : | |
print_list.append(i[2]) | |
# Put printers in combobox | |
PRCOMBO['values'] = print_list | |
PRCOMBO.pack() | |
def select() : | |
global printerdef | |
printerdef = PRCOMBO.get() | |
pt.destroy() | |
BUTTON = ttk.Button(pt, text="Done", command=select).pack() | |
r = tkinter.Toplevel() | |
r.title("printer selection in tkinter") | |
r.geometry("1200x600") | |
#####################################################Frames and Labels ############################################# | |
Frame1 = Frame(r, width=620, height=500, bg='grey', bd=4) | |
Frame1.place(x=10, y=80) | |
Frame2 = Frame(r, width=210, height=500, bg='azure2', bd=4) | |
Frame2.place(x=660, y=1) | |
Frame3 = Frame(r, width=210, height=500, bg='light grey', bd=4) | |
Frame3.place(x=900, y=1) | |
Label1 = Label(r, text='Aktuell', font=('arial', 20, 'bold'), bg='azure2') | |
Label1.place(x=290, y=30) | |
s = ttk.Style() | |
s.theme_use('clam') | |
# Configure the style of Heading in Treeview widget | |
s.configure('printtree.Heading', background="green3") | |
s.configure("printtree", background='red', foreground="black", rowheight=25, font=("ARIEL", 9, 'bold'), | |
fieldbackground="black") | |
s.map('printtree', background=[('selected', 'red')]) | |
s.configure("printtreeHeading", font=('bold', 12)) | |
s.configure("printtree.column", font=('bold', 6)) | |
s.configure('printtree', rowheight=40) | |
s.configure('printtree.row', font=('bold', 20)) | |
s.configure('Red.TCheckbutton', background='azure2') | |
s.configure('yellow.TCheckbutton', background='light grey') | |
printtree = ttk.Treeview(Frame1, height=10) | |
printtree['columns'] = ("Drucker", "Kat1", "Kat2", "Kat3", "Kat4", "Kat5", "Kat6", "Kat7", "Kat8") | |
printtree.column("#0", width=0, stretch=NO) | |
printtree.column("Drucker", anchor=CENTER, width=120, stretch=TRUE, ) | |
printtree.column("Kat1", anchor=CENTER, width=60) | |
printtree.column("Kat2", anchor=W, width=60) | |
printtree.column("Kat3", anchor=W, width=60) | |
printtree.column("Kat4", anchor=W, width=60) | |
printtree.column("Kat5", anchor=W, width=60) | |
printtree.column("Kat6", anchor=W, width=60) | |
printtree.column("Kat7", anchor=W, width=60) | |
printtree.column("Kat8", anchor=W, width=60) | |
printtree.heading("#0", text="", anchor=W) | |
printtree.heading("Drucker", text="Drucker", anchor=W) | |
printtree.heading("Kat1", text="Kat1", anchor=W) | |
printtree.heading("Kat2", text="Kat2", anchor=W) | |
printtree.heading("Kat3", text="Kat3", anchor=W) | |
printtree.heading("Kat4", text="Kat4", anchor=W) | |
printtree.heading("Kat5", text="Kat5", anchor=W) | |
printtree.heading("Kat6", text="Kat6", anchor=W) | |
printtree.heading("Kat7", text="Kat7", anchor=W) | |
printtree.heading("Kat8", text="Kat8", anchor=W) | |
# printtree.place(x=0,y=60) | |
printtree.pack() | |
#################################################### SQLDATA ####################################################### | |
conn = sqlite3.connect('Einstellung.db') | |
katlist = [] | |
cur = conn.cursor() | |
cur.execute('select* from Katagorie ') | |
sor = cur.fetchall() | |
for izo in sor : | |
katlist.insert(0, izo) | |
lon = len(katlist) | |
print(lon) | |
var = StringVar() | |
var5 = StringVar() | |
var6 = StringVar() | |
var7 = StringVar() | |
var8 = StringVar() | |
var9 = StringVar() | |
var10 = StringVar() | |
var11 = StringVar() | |
var12 = StringVar() | |
varb = StringVar() | |
varb5 = StringVar() | |
varb6 = StringVar() | |
varb7 = StringVar() | |
varb8 = StringVar() | |
varb9 = StringVar() | |
varb10 = StringVar() | |
varb11 = StringVar() | |
varb12 = StringVar() | |
#####################################################Drucker auswahlen ############################################# | |
# Label11 = Label(Frame2, text="select Printer") | |
# Label11.place(x=80,y=50) | |
var1 = StringVar() | |
Combo1 = ttk.Combobox(Frame2, width=25, textvariable=var1) | |
Combo1.set('Drucker 1') | |
print_list = [] | |
printers = list(win32print.EnumPrinters(2)) | |
for i in printers : | |
print_list.append(i[2]) | |
# Put printers in combobox | |
Combo1['values'] = print_list | |
Combo1.place(x=5, y=5) | |
listo = [] | |
listob = [] | |
def fargini1() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from printer2') | |
mik = cur.fetchall() | |
for ray in mik : | |
if ray[0] != '' : | |
listob.insert(0, ray[0]) | |
if ray[1] != '' or [] : | |
listob.insert(0, ray[1]) | |
if ray[2] != '' or [] : | |
listob.insert(0, ray[2]) | |
if ray[3] != '' or [] : | |
listob.insert(0, ray[3]) | |
if ray[4] != '' or [] : | |
listob.insert(0, ray[4]) | |
if ray[5] != '' or [] : | |
listob.insert(0, ray[5]) | |
if ray[6] != '' or [] : | |
listob.insert(0, ray[6]) | |
if ray[7] != '' or [] : | |
listob.insert(0, ray[7]) | |
if ray[8] != '' : | |
listob.insert(0, ray[8]) | |
if ray[9] != '' : | |
listob.insert(0, ray[9]) | |
if ray[10] != '' : | |
listob.insert(0, ray[10]) | |
for iop in listob : | |
result = str(iop).replace('[', '').replace(']', '').replace('(', '').replace(')', '').replace(',', | |
'').replace( | |
"'", "") | |
# if result!='': | |
# listbox1.insert(0,result) | |
def fargini() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from printer1') | |
mik = cur.fetchall() | |
for ray in mik : | |
if ray[0] != '' : | |
listo.insert(0, ray[0]) | |
if ray[1] != '' or [] : | |
listo.insert(0, ray[1]) | |
if ray[2] != '' or [] : | |
listo.insert(0, ray[2]) | |
if ray[3] != '' or [] : | |
listo.insert(0, ray[3]) | |
if ray[4] != '' or [] : | |
listo.insert(0, ray[4]) | |
if ray[5] != '' or [] : | |
listo.insert(0, ray[5]) | |
if ray[6] != '' or [] : | |
listo.insert(0, ray[6]) | |
if ray[7] != '' or [] : | |
listo.insert(0, ray[7]) | |
if ray[8] != '' : | |
listo.insert(0, ray[8]) | |
if ray[9] != '' : | |
listo.insert(0, ray[9]) | |
if ray[10] != '' : | |
listo.insert(0, ray[10]) | |
for iop in listo : | |
result = str(iop).replace('[', '').replace(']', '').replace('(', '').replace(')', '').replace(',', | |
'').replace( | |
"'", "") | |
# if result!='': | |
# listbox1.insert(0,result) | |
################################################# | |
var2 = StringVar() | |
Combo2 = ttk.Combobox(Frame3, width=25, textvariable=var2) | |
Combo2.set('Drucker 2') | |
print_list1 = [''] | |
kol = [''] | |
kol1 = [''] | |
kol2 = [''] | |
kol3 = [''] | |
kol4 = [''] | |
kol5 = [''] | |
kol6 = [''] | |
kol7 = [''] | |
kol8 = [''] | |
kol9 = [''] | |
kol10 = [''] | |
kolb = [''] | |
kolb1 = [''] | |
kolb2 = [''] | |
kolb3 = [''] | |
kolb4 = [''] | |
kolb5 = [''] | |
kolb6 = [''] | |
kolb7 = [''] | |
kolb8 = [''] | |
kolb9 = [''] | |
kolb10 = [''] | |
printers1 = list(win32print.EnumPrinters(2)) | |
for ip in printers1 : | |
print_list1.append(ip[2]) | |
c1 = ttk.Checkbutton(Frame2, text=katlist[0], variable=var, cursor="cross", style='Red.TCheckbutton') | |
c1.place(x=5, y=40) | |
if lon > 1 : | |
c2 = ttk.Checkbutton(Frame2, text=katlist[1], variable=var5, style='Red.TCheckbutton') | |
c2.place(x=5, y=60) | |
else : | |
pass | |
if lon > 2 : | |
c3 = ttk.Checkbutton(Frame2, text=katlist[2], variable=var6, style='Red.TCheckbutton') | |
c3.place(x=5, y=80) | |
else : | |
pass | |
if lon > 3 : | |
c4 = ttk.Checkbutton(Frame2, text=katlist[3], variable=var7, style='Red.TCheckbutton') | |
c4.place(x=5, y=100) | |
else : | |
pass | |
if lon > 4 : | |
c5 = ttk.Checkbutton(Frame2, text=katlist[4], variable=var8, style='Red.TCheckbutton') | |
c5.place(x=5, y=120) | |
else : | |
pass | |
if lon > 5 : | |
c6 = ttk.Checkbutton(Frame2, text=katlist[5], variable=var9, style='Red.TCheckbutton') | |
c6.place(x=5, y=140) | |
else : | |
pass | |
if lon > 6 : | |
c7 = ttk.Checkbutton(Frame2, text=katlist[6], variable=var10, style='Red.TCheckbutton') | |
c7.place(x=5, y=160) | |
else : | |
pass | |
if lon > 7 : | |
c8 = ttk.Checkbutton(Frame2, text=katlist[7], variable=var11, style='Red.TCheckbutton') | |
c8.place(x=5, y=180) | |
else : | |
pass | |
b1 = ttk.Checkbutton(Frame3, text=katlist[0], variable=varb, cursor="cross", style='yellow.TCheckbutton') | |
b1.place(x=5, y=40) | |
if lon > 1 : | |
b2 = ttk.Checkbutton(Frame3, text=katlist[1], variable=varb5, style='yellow.TCheckbutton') | |
b2.place(x=5, y=60) | |
else : | |
pass | |
if lon > 2 : | |
b3 = ttk.Checkbutton(Frame3, text=katlist[2], variable=varb6, style='yellow.TCheckbutton') | |
b3.place(x=5, y=80) | |
else : | |
pass | |
if lon > 3 : | |
b4 = ttk.Checkbutton(Frame3, text=katlist[3], variable=varb7, style='yellow.TCheckbutton') | |
b4.place(x=5, y=100) | |
else : | |
pass | |
if lon > 4 : | |
b5 = ttk.Checkbutton(Frame3, text=katlist[4], variable=varb8, style='yellow.TCheckbutton') | |
b5.place(x=5, y=120) | |
else : | |
pass | |
if lon > 5 : | |
b6 = ttk.Checkbutton(Frame3, text=katlist[5], variable=varb9, style='yellow.TCheckbutton') | |
b6.place(x=5, y=140) | |
else : | |
pass | |
if lon > 6 : | |
b7 = ttk.Checkbutton(Frame3, text=katlist[6], variable=varb10, style='yellow.TCheckbutton') | |
b7.place(x=5, y=160) | |
else : | |
pass | |
if lon > 7 : | |
b8 = ttk.Checkbutton(Frame3, text=katlist[7], variable=varb11, style='yellow.TCheckbutton') | |
b8.place(x=5, y=180) | |
else : | |
pass | |
def show() : | |
listo.clear() | |
value1 = Combo1.get() | |
kol.insert(0, str(value1)) | |
conno = sqlite3.connect('Einstellung.db') | |
curo = conno.cursor() | |
curo.execute('delete from printer1') | |
conno.commit() | |
printername = var2.get() | |
if lon > 0 : | |
first = c1.state() | |
if 'selected' in first : | |
kol3.insert(0, katlist[0]) | |
c1.invoke() | |
else : | |
pass | |
if lon > 1 : | |
second = c2.state() | |
if 'selected' in second : | |
kol4.insert(0, katlist[1]) | |
c2.invoke() | |
if lon > 2 : | |
third = c3.state() | |
if 'selected' in third : | |
kol5.insert(0, katlist[2]) | |
c3.invoke() | |
else : | |
pass | |
if lon > 3 : | |
fourth = c4.state() | |
if 'selected' in fourth : | |
kol6.insert(0, katlist[3]) | |
c4.invoke() | |
else : | |
pass | |
if lon > 4 : | |
fifth = c5.state() | |
if 'selected' in fifth : | |
kol7.insert(0, katlist[4]) | |
c5.invoke() | |
else : | |
pass | |
if lon > 5 : | |
six = c6.state() | |
if 'selected' in six : | |
kol8.insert(0, katlist[5]) | |
c6.invoke() | |
else : | |
pass | |
if lon > 6 : | |
seven = c7.state() | |
if 'selected' in seven : | |
kol9.insert(0, katlist[6]) | |
c7.invoke() | |
else : | |
pass | |
if lon > 7 : | |
eighth = c8.state() | |
if 'selected' in eighth : | |
kol10.insert(0, katlist[7]) | |
c8.invoke() | |
else : | |
pass | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute("""insert into printer1 (printer,kat1,kat2,kat3,kat4,kat5,kat6,kat7, | |
kat8,kat9,kat10) values (?,?,?,?,?,?,?,?,?,?,?)""", | |
(str(kol), str(kol1), str(kol2), str(kol3), str(kol4), str(kol5), str(kol6), str(kol7), | |
str(kol8), str(kol9), str(kol10),)) | |
conn.commit() | |
Combo1.set('Drucker 1') | |
def show1() : | |
listo.clear() | |
value1 = Combo2.get() | |
kolb.insert(0, str(value1)) | |
conno = sqlite3.connect('Einstellung.db') | |
curo = conno.cursor() | |
curo.execute('delete from printer2') | |
conno.commit() | |
printername = var1.get() | |
if lon > 0 : | |
first = b1.state() | |
if 'selected' in first : | |
kolb3.insert(0, katlist[0]) | |
b1.invoke() | |
else : | |
pass | |
if lon > 1 : | |
second = b2.state() | |
if 'selected' in second : | |
kolb4.insert(0, katlist[1]) | |
b2.invoke() | |
if lon > 2 : | |
third = b3.state() | |
if 'selected' in third : | |
kolb5.insert(0, katlist[2]) | |
b3.invoke() | |
else : | |
pass | |
if lon > 3 : | |
fourth = b4.state() | |
if 'selected' in fourth : | |
kolb6.insert(0, katlist[3]) | |
b4.invoke() | |
else : | |
pass | |
if lon > 4 : | |
fifth = b5.state() | |
if 'selected' in fifth : | |
kolb7.insert(0, katlist[4]) | |
b5.invoke() | |
else : | |
pass | |
if lon > 5 : | |
six = b6.state() | |
if 'selected' in six : | |
kolb8.insert(0, katlist[5]) | |
b6.invoke() | |
else : | |
pass | |
if lon > 6 : | |
seven = b7.state() | |
if 'selected' in seven : | |
kolb9.insert(0, katlist[6]) | |
b7.invoke() | |
else : | |
pass | |
if lon > 7 : | |
eighth = b8.state() | |
if 'selected' in eighth : | |
kolb10.insert(0, katlist[7]) | |
b8.invoke() | |
else : | |
pass | |
Combo1.set('Drucker 1') | |
Combo2.set('Drucker 2') | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute("""insert into printer2 (printer,kat1,kat2,kat3,kat4,kat5,kat6,kat7, | |
kat8,kat9,kat10) values (?,?,?,?,?,?,?,?,?,?,?)""", | |
(str(kolb), str(kolb1), str(kolb2), str(kolb3), str(kolb4), str(kolb5), str(kolb6), str(kolb7), | |
str(kolb8), str(kolb9), str(kolb10),)) | |
conn.commit() | |
# Put printers in combobox | |
Combo2['values'] = print_list1 | |
Combo2.place(x=5, y=5) | |
menubar = Menu(root) | |
root.config(menu=menubar) | |
file_menu = Menu(menubar) | |
menubar.add_cascade(label="File", menu=file_menu) | |
file_menu.add_command(label="printer", command=locprinter) | |
def shows() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from printer1 ') | |
bol = cur.fetchall() | |
zaro = 0 | |
for opo in bol : | |
printtree.insert(parent='', open=True, index='end', iid=zaro, text='', | |
values=( | |
str(opo[0]).replace('[', '').replace(']', '').replace("'", "").replace(',', | |
'').replace( | |
')', '').replace('(', ''), | |
opo[1].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[2].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[3].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[4].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[5].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[6].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[7].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[8].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''),)) | |
zaro += 1 | |
def shows1() : | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select* from printer2 ') | |
bol = cur.fetchall() | |
zaro = 1 | |
for opo in bol : | |
printtree.insert(parent='', open=True, index='end', iid=zaro, text='', | |
values=( | |
str(opo[0]).replace('[', '').replace(']', '').replace("'", "").replace(',', | |
'').replace( | |
')', '').replace('(', ''), | |
opo[1].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[2].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[3].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[4].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[5].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[6].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[7].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''), | |
opo[8].replace('[', '').replace(']', '').replace("'", "").replace(',', '').replace(')', | |
'').replace( | |
'(', ''))) | |
zaro += 1 | |
shows() | |
shows1() | |
LAB = Label(root, text="Comment") | |
# T2 = Text(root, width=40, height=10, wrap=WORD) | |
hpeichern = Button(Frame2, text='Speichern', command=show, width=10) | |
hpeichern.place(x=125, y=470) | |
hpeichern1 = Button(Frame3, text='Speichern', command=show1, width=10) | |
hpeichern1.place(x=125, y=470) | |
# zieg = Button(Frame1, text='zeigen', command=fargini,width=20) | |
# zieg.place(x=250,y=250) | |
# zieg1 = Button(Frame1, text='zeigen', command=fargini1, width=20) | |
# zieg1.place(x=500, y=250) | |
def openwindow9() : | |
r = tkinter.Toplevel() | |
r.titel = 'Freie zutaten' | |
r.geometry('1400x900') | |
################### speiseliste | |
name = StringVar | |
conn = sqlite3.connect('ZutatenListe.db') | |
cur = conn.cursor() | |
cur.execute('select SpeiseName from zutaten') | |
baro = cur.fetchall() | |
with open('zutatenliste.txt', 'w') as file1 : | |
for naro in baro : | |
ziko = ",".join(naro) | |
file1.write(str(ziko) + '\n') | |
zutatenliste = [] | |
with open('zutatenliste.txt', 'r') as fsrg : | |
for ziz in fsrg : | |
zutatenliste.append(str(ziz)) | |
conn.commit() | |
# conn=sqlite3.connect('Einstellung.db') | |
# cur=conn.cursor() | |
# cur.execute('create table Freiezutaten(Speisename text, Anzahl int)') | |
# conn.commit() | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from Freiezutaten') | |
mor = cur.fetchall() | |
###################Frames | |
frame1 = Frame(r, bd=4, width=650, height=850, bg='#73675f') | |
frame1.place(x=10, y=20) | |
frame2 = Frame(r, bd=4, width=650, height=850, bg='#4f4e4c') | |
frame2.place(x=735, y=20) | |
frame3 = Frame(frame2, bd=4, width=350, height=400, bg='#4f4e4c') | |
frame3.place(x=10, y=20) | |
###################Tree view | |
s = ttk.Style() | |
s.theme_use('clam') | |
# Configure the style of Heading in Treeview widget | |
s.configure('printtree.Heading', background="green3") | |
s.configure("printtree", background='red', foreground="black", rowheight=25, font=("ARIEL", 16, 'bold'), | |
fieldbackground="black") | |
s.map('zutattree', background=[('selected', 'red')]) | |
s.configure("zutattreeHeading", font=('bold', 16)) | |
s.configure("zutattree.column", font=('bold', 16)) | |
s.configure('zutattree', rowheight=40) | |
s.configure('zutattree.row', font=('bold', 20)) | |
s.configure('Red.TCheckbutton', background='azure2') | |
s.configure('yellow.TCheckbutton', background='light grey') | |
zutattree = ttk.Treeview(frame1, height=15) | |
zutattree['columns'] = ("Speisename", "Anzahl",) | |
zutattree.column("#0", width=0, stretch=NO) | |
zutattree.column("Speisename", anchor=CENTER, width=120, stretch=TRUE, ) | |
zutattree.column("Anzahl", anchor=CENTER, width=60) | |
zutattree.heading("#0", text="", anchor=W) | |
zutattree.heading("Speisename", text="Speisename", anchor=W) | |
zutattree.heading("Anzahl", text="Anzahl", anchor=W) | |
zutattree.place(x=10, y=200) | |
################### functions | |
def show() : | |
for item in zutattree.get_children() : | |
zutattree.delete(item) | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
cur.execute('select * from Freiezutaten') | |
mor = cur.fetchall() | |
for izo in mor : | |
zazo = 0 | |
zutattree.insert(parent='', open=True, index='end', text='', | |
values=(izo[0], izo[1])) | |
def speichern() : | |
name = entery1.get() | |
anzahl = entery2.get() | |
conn = sqlite3.connect('Einstellung.db') | |
cur = conn.cursor() | |
for izo in mor : | |
print(izo) | |
if name in izo : | |
cur.execute('UPDATE Freiezutaten SET Anzahl = (?) where Speisename=(?)', (anzahl, name)) | |
else : | |
cur.execute('insert or replace into Freiezutaten (Speisename,Anzahl) values (?,?)', (name, anzahl)) | |
conn.commit() | |
entery1.delete(0, END) | |
entery2.delete(0, END) | |
show() | |
################### Labels,Buttons,Entterys | |
label1 = Label(frame1, text='Speisen Mit Freizutaten', bg='#4f4e4c', font=('arial', 20, 'bold')) | |
label1.place(x=140, y=10) | |
label2 = Label(frame1, text='Speisename:', bg='#73675f', font=('arial', 16, 'bold')) | |
label2.place(x=10, y=80) | |
label3 = Label(frame1, text='Anzahl:', bg='#73675f', font=('arial', 16, 'bold')) | |
label3.place(x=210, y=80) | |
entery1 = AutocompleteEntry(frame1, width=15, font=('arial', 15, 'bold'), completevalues=zutatenliste, | |
textvariable=name) | |
entery1.place(x=5, y=120) | |
entery2 = Entry(frame1, width=5, font=('arial', 15, 'bold')) | |
entery2.place(x=210, y=120) | |
buttn1 = Button(frame1, text='speichern', font=('arial', 12, 'bold'), bg='#4f4e4c', command=speichern) | |
buttn1.place(x=320, y=120) | |
#################### insert into Treeview | |
show() | |
######################################################################################################################## | |
mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment