def saisir_facture(self): for widget in self.frame_menu.winfo_children(): widget.pack_forget() def valider(): #date du jour Connexion.saisie_facture(self.entree_date.get(), self.entree_client.get(), self.entree_facture.get(), self.entree_produit.get(), self.entree_quantite.get()) self.entrees_frame = tk.Frame(self.frame_menu, bg=color_ids['Bleu']) self.entrees_frame.pack() self.facture_frame = tk.Frame(self.frame_menu, bg=color_ids['Bleu']) self.facture_frame.pack() self.entree_facture = ttk.Combobox(self.entrees_frame, values=list(Connexion.lister_factures()), state="normal") self.entree_facture.grid(row = 0 , column = 0, padx=20, pady=30) self.entree_client = ttk.Combobox(self.entrees_frame, values=list(Connexion.get_clients()), state="readonly") self.entree_client.grid(row = 0 , column = 1, padx=20, pady=30) self.entree_produit = ttk.Combobox(self.entrees_frame, values=list(Connexion.get_produits()), state="readonly") self.entree_produit.grid(row = 0 , column = 2, padx=20, pady=30) self.entree_quantite = tk.Entry(self.entrees_frame, bg='white', width=20, justify='center', font=('Helvetica', '10')) self.entree_quantite.grid(row = 0 , column = 3, padx=20, pady=30) self.entree_date = tk.Entry(self.entrees_frame, bg='white', width=20, justify='center', font=('Helvetica', '10')) self.entree_date.grid(row = 0 , column = 4, padx=20, pady=30) self.now = datetime.date.today() self.date_facture = self.now.strftime("%Y-%m-%d") self.entree_date.insert(0, self.date_facture) self.boutton_factures = tk.Button(self.entrees_frame, height=2, width=13, bg=color_ids['Jaune'], bd=0, font=('Helvetica', '11'), text="Valider", command=valider) self.boutton_factures.grid(row = 0 , column = 5, padx=20, pady=30)
def afficher_facture(self): for widget in self.frame_menu.winfo_children(): widget.pack_forget() def remplir_entree_date(self): dates = Connexion.get_date_factures(entree_client.get()) if len(dates) > 0: entree_date.set('Choisir une date') else: entree_date.set('Aucune factures') entree_date.configure(values=dates) def afficher(): for widget in facture_frame.winfo_children(): widget.grid_forget() result = Connexion.get_facture( entree_client.get(), entree_date.get()) produit_label = tk.Label(facture_frame, text="Produits", bg=color_ids['Bleu'], font=( 'Helvetica', '20', 'underline')) sites_label = tk.Label(facture_frame, text="Quantités", bg=color_ids['Bleu'], font=( 'Helvetica', '20', 'underline')) produit_label.grid(row=0, column=0, padx=50) sites_label.grid(row=0, column=1, padx=50) for i, values in enumerate(result, 1): produit_label = tk.Label(facture_frame, font=( 'Helvetica', '13'), bg=color_ids['Bleu'], text=values[0]) produit_label.grid(row=i, column=0) quantite_label = tk.Label(facture_frame, font=( 'Helvetica', '13'), bg=color_ids['Bleu'], text=values[1]) quantite_label.grid(row=i, column=1) entrees_frame = tk.Frame(self.frame_menu, bg=color_ids['Bleu']) entrees_frame.pack() facture_frame = tk.Frame(self.frame_menu, bg=color_ids['Bleu']) facture_frame.pack() entree_client = ttk.Combobox(entrees_frame, width=50, values=list( Connexion.get_clients()), state="readonly") entree_client.set('Chosir un client') entree_client.bind('<<ComboboxSelected>>', remplir_entree_date) entree_client.grid(row=0, column=0, padx=20, pady=30) entree_date = ttk.Combobox(entrees_frame, state="readonly") entree_date.grid(row=0, column=1, padx=20, pady=30) boutton_factures = tk.Button(entrees_frame, height=2, width=13, bg=color_ids['Jaune'], bd=0, font=( 'Helvetica', '11'), text="Afficher", command=afficher) boutton_factures.grid(row=0, column=2, padx=20, pady=30)