1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
### titre des colonnes
columns = [
'Code','Produit','Achat','M.Achat','Vente',
'M.CA','Marge','%CA','Stock'
]
fonts = {
'normal': 'arial 9',
'bold': 'arial 9 bold',
'titre': 'Helvetica 10 bold',
'titrepage': 'arial 30'
}
def open_toplevelpar():
w = Toplevel()
w.focus_force()
label = tk.Label(w, text="Stock", font=fonts['titrepage'])
label.grid(row=0,column=0,columnspan=len(entetecolon),sticky=tk.W+tk.E)
###selection de produit
def do_select(event):
global current_selection
widget = event.widget
infos = widget.grid_info()
row = infos['row']
master = infos['in']
if current_selection is not None and current_selection != row:
for w in master.grid_slaves(row=current_selection):
w.configure(font=fonts['normal'])
for w in master.grid_slaves(row=row):
w.configure(font=fonts['bold'])
current_selection = row
def stockss1():
def mon_traitementstoc():
global nb1
code=[]
produit=[]
achat=[]
machat=[]
vente=[]
mca=[]
marge=[]
pourcenca=[]
stock=[]
tab=[]
stocku = askstring('Stock', 'Entrer votre valeur de Stock')
stocku=int(stocku)
feuille = load_workbook(chemin1)
feuille_calc = feuille.active
a3 = feuille_calc.cell(row=2, column=8)
a4=feuille_calc.cell(row=2, column=2)
stock=feuille_calc.cell(row=2, column=9)
c=0
while feuille_calc.cell(row=2+c, column=2).value != None:
if stock.value > stocku:
c=c+1
else :
print (feuille_calc.cell(row=2+c, column=2).value)
print (feuille_calc.cell(row=2+c, column=1).value)
code=code+[(feuille_calc.cell(row=2+c, column=1)).value]
produit=produit+[(feuille_calc.cell(row=2+c, column=2)).value]
achat=achat+[(feuille_calc.cell(row=2+c, column=3)).value]
machat=machat+[(feuille_calc.cell(row=2+c, column=4)).value]
vente=vente+[(feuille_calc.cell(row=2+c, column=5)).value]
mca=mca+[(feuille_calc.cell(row=2+c, column=6)).value]
marge=marge+[(feuille_calc.cell(row=2+c, column=7)).value]
pourcenca=pourcenca+[(feuille_calc.cell(row=2+c, column=8)).value]
stock=stock+[(feuille_calc.cell(row=2+c, column=9)).value]
c=c+1
tab.append(code)
tab.append(produit)
tab.append(achat)
tab.append(machat)
tab.append(vente)
tab.append(mca)
tab.append(marge)
tab.append(pourcenca)
tab.append(stock)
w = Toplevel()#w c'est la nouvelle fenetre ouverte après coût
w.focus_force()
label = tk.Label(w, text="Gestion des Stocks", font=fonts['titrepage'])
label.grid(row=0,column=0,columnspan=len(columns),sticky=tk.W+tk.E)
for i in range(len(columns)):
label = tk.Label(w, text=columns[i], font=fonts['titre'])
label.grid(row=1, column=i, padx=0)
for k in range(0,len(columns)):
for j in range(0,len(tab)):
color = ['grey75', 'white'][j % 2]
label = tk.Label(w, text="%s" % (tab[k][j]),
bg=color, width=20, anchor='w',
font=fonts['normal'])
label.grid(row=j, column=i, padx=0)
w.bind('<1>', do_select)
nb1=c
return mon_traitementstoc
#fenetre principale
Mafenetre = Tk()
Mafenetre.title("Gestion des Stocks")
menubar = Menu(Mafenetre)
#menu fonction
menufonction = Menu(menubar,tearoff=0)
"""menufonction.add_command(label="paretto",command=paretto())"""
menufonction.add_command(label="stockdesécurité1",command=stockss1())
menubar.add_cascade(label="fonction", menu=menufonction)
Mafenetre.config(menu=menubar)
#====Frames===#
# frame 1
l = LabelFrame(Mafenetre, text="Gestion des Stocks V1.3", padx=17, pady=17)
l.pack(fill="both", expand="yes")
# frame 2
#===Boutons===#
button_choice = Button(l, text='Magasin 1', command=ouvrir)
button_choice.pack() |
Partager