def OnValider(self, event): date_debut = self.datepicker_date_debut.GetValue() date_fin = self.datepicker_date_fin.GetValue() date_debut_dt = datetime.date(date_debut.GetYear(), date_debut.GetMonth()+1, date_debut.GetDay()) date_fin_dt = datetime.date(date_fin.GetYear(), date_fin.GetMonth()+1, date_fin.GetDay()) try: exercice = Exercice.select().where(((Exercice.date_debut <= date_fin_dt) & (Exercice.date_fin >= date_debut_dt))).get() if exercice == self.exercice: raise DoesNotExist wx.MessageBox(u"Les dates indiquées chevauchent l'exercice '%s'" % exercice.nom, "Erreur") except DoesNotExist: if self.Validate(): self.exercice.nom = self.text_ctrl_nom.GetValue() self.exercice.date_debut = date_debut_dt self.exercice.date_fin = date_fin_dt with DATABASE.transaction(): self.exercice.save() EXERCICE_EN_COURS = Exercice.en_cours() event.Skip()
def OnEnregistre(self, event): if self.Validate(): self.produit.nom = self.text_Nom.GetValue() self.produit.fournisseur = self.combo_box_Fournisseur.GetClientData(self.combo_box_Fournisseur.GetSelection()) self.produit.ref_fournisseur = self.text_RefFournisseur.GetValue() self.produit.origine = self.text_Origine.GetValue() self.produit.vrac = self.radio_box_TypeVente.GetSelection() self.produit.liquide = self.radio_box_UniteMesure.GetSelection() if self.produit.vrac: self.produit.poids_volume = int(float(self.text_PoidsVolume.GetValue())*1000) else: self.produit.poids_volume = self.text_PoidsVolume.GetValue() self.produit.conditionnement = self.text_Conditionnement.GetValue() self.produit.tva = self.combo_box_TVA.GetClientData(self.combo_box_TVA.GetSelection()) self.produit.prix_achat_HT = self.text_PrixAchat.GetValue() self.produit.retrait = self.checkbox_RetraitProduit.IsChecked() self.produit.motif_retrait = self.text_MotifRetrait.GetValue() if (self.produit.retrait == False): self.produit.a_etiquetter = True else: self.produit.a_etiquetter = False with DATABASE.transaction(): self.produit.save() event.Skip()
def OnVerifiee(self, event): if self.commande: commande_verifiee = True for lc in self.liste_lignes_commande.GetObjects(): if not lc.is_verifiee: commande_verifiee = False if commande_verifiee: dlg = wx.MessageDialog(parent=None, message=u"La livraison a bien été vérifiée ?", caption=u"Vérification de la livraison", style=wx.YES_NO|wx.ICON_QUESTION) if dlg.ShowModal() == wx.ID_YES: for lc in self.liste_lignes_commande.GetObjects(): lc.save() self.commande.statut = 3 self.commande.save() self.liste_commandes.RefreshObject(self.commande) self.OnSelectionCommande(None) with DATABASE.transaction(): DATABASE.commit() dlg.Destroy() else: wx.MessageBox(u"La livraison n'a pas encoré été entièrement vérifiée", "Erreur", style=wx.ICON_ERROR)
def OnEnregistre(self, event): if self.Validate(): self.produit.nom = self.text_Nom.GetValue() self.produit.fournisseur = self.combo_box_Fournisseur.GetClientData( self.combo_box_Fournisseur.GetSelection()) self.produit.ref_fournisseur = self.text_RefFournisseur.GetValue() self.produit.origine = self.text_Origine.GetValue() self.produit.vrac = self.radio_box_TypeVente.GetSelection() self.produit.liquide = self.radio_box_UniteMesure.GetSelection() if self.produit.vrac: self.produit.poids_volume = int( float(self.text_PoidsVolume.GetValue()) * 1000) else: self.produit.poids_volume = self.text_PoidsVolume.GetValue() self.produit.conditionnement = self.text_Conditionnement.GetValue() self.produit.tva = self.combo_box_TVA.GetClientData( self.combo_box_TVA.GetSelection()) self.produit.prix_achat_HT = self.text_PrixAchat.GetValue() self.produit.retrait = self.checkbox_RetraitProduit.IsChecked() self.produit.motif_retrait = self.text_MotifRetrait.GetValue() if (self.produit.retrait == False): self.produit.a_etiquetter = True else: self.produit.a_etiquetter = False with DATABASE.transaction(): self.produit.save() event.Skip()
def OnValider(self, event): if self.Validate(): self.adhesion_type.nom = self.text_ctrl_Nom.GetValue() self.adhesion_type.prix = self.text_ctrl_Prix.GetValue() with DATABASE.transaction(): self.adhesion_type.save() event.Skip()
def OnEnregistre(self, event): if self.Validate(): self.tva.taux = self.text_TauxTVA.GetValue() with DATABASE.transaction(): self.tva.save() event.Skip()
def OnSuppressionInventaire(self, event): inventaire = self.liste_inventaires.GetSelectedObject() msgbox = wx.MessageBox(u"Supprimer l'inventaire du %s ?" % inventaire.date.strftime("%d/%m/%y"), "Suppression", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: with DATABASE.transaction(): inventaire.delete_instance(recursive=True) self.liste_inventaires.RemoveObject(inventaire)
def OnSupprimeAdhesion(self, event): adhesion = self.liste_adhesions.GetSelectedObject() msgbox = wx.MessageBox(u"Supprimer l'adhésion du %s ?" % adhesion.date.strftime("%d/%m/%y"), "Suppression", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: with DATABASE.transaction(): adhesion.delete_instance() self.liste_adhesions.RemoveObject(adhesion)
def OnSupprimeTypeCotisation(self, event): cotisation_type = self.liste_cotisation_types.GetSelectedObject() if cotisation_type.adherents.count() == 0: msgbox = wx.MessageBox(u"Supprimer le type de cotisation '%s'?" % cotisation_type.nom, "Suppression", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: with DATABASE.transaction(): cotisation_type.delete_instance() self.liste_cotisation_types.RemoveObject(cotisation_type)
def OnEnregistrer(self, event): if self.Validate(): msgbox = wx.MessageBox(u"Sauvegarder l'inventaire ?", u"Confirmation", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: self.inventaire.date = date.today() self.inventaire.commentaire = self.text_commentaire.GetValue() with DATABASE.transaction(): self.inventaire.save() event.Skip()
def OnEnregistre(self, event): if self.Validate(): self.categorie.nom = self.text_NomCategorie.GetValue() with DATABASE.transaction(): if not self.categorie.get_id(): self.categorie.set_id(int(self.combo_box_IDCategorie.GetValue())) self.categorie.insert(**dict(self.categorie._data)).execute() else: self.categorie.save() event.Skip()
def OnSuppressionInventaire(self, event): inventaire = self.liste_inventaires.GetSelectedObject() msgbox = wx.MessageBox( u"Supprimer l'inventaire du %s ?" % inventaire.date.strftime("%d/%m/%y"), "Suppression", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: with DATABASE.transaction(): inventaire.delete_instance(recursive=True) self.liste_inventaires.RemoveObject(inventaire)
def OnSupprimeAdhesion(self, event): adhesion = self.liste_adhesions.GetSelectedObject() msgbox = wx.MessageBox( u"Supprimer l'adhésion du %s ?" % adhesion.date.strftime("%d/%m/%y"), "Suppression", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: with DATABASE.transaction(): adhesion.delete_instance() self.liste_adhesions.RemoveObject(adhesion)
def OnEnregistre(self, event): if self.Validate(): self.categorie.nom = self.text_NomCategorie.GetValue() with DATABASE.transaction(): if not self.categorie.get_id(): self.categorie.set_id( int(self.combo_box_IDCategorie.GetValue())) self.categorie.insert( **dict(self.categorie._data)).execute() else: self.categorie.save() event.Skip()
def OnValider(self, event): if self.Validate() and self.inventaire.pret_a_valider(): msgbox = wx.MessageBox(u"Valider l'inventaire ? Il ne sera plus modifiable.", u"Confirmation", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: self.inventaire.is_valide = True self.inventaire.date = date.today() with DATABASE.transaction(): self.inventaire.validation() self.inventaire.save() self.__set_properties() event.Skip()
def Enregistre(self): if self.Validate(): self.fournisseur.nom = self.text_Nom.GetValue() self.fournisseur.adresse = self.text_Adresse.GetValue() self.fournisseur.code_postal = self.text_CodePostal.GetValue() self.fournisseur.ville = self.text_Ville.GetValue() self.fournisseur.telephone_fixe = self.text_TelephoneFixe.GetValue() self.fournisseur.telephone_portable = self.text_TelephonePortable.GetValue() self.fournisseur.email = self.text_Email.GetValue() self.fournisseur.nom_contact = self.text_NomContact.GetValue() self.fournisseur.remarques = self.text_Remarques.GetValue() self.fournisseur.couleur = self.text_Couleur.GetValue() with DATABASE.transaction(): self.fournisseur.save()
def OnValider(self, event): if self.Validate(): msgbox = wx.MessageBox(u"Sauvegarder l'adhésion ?", u"Confirmation", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: date_adhesion = self.datepicker_date_adhesion.GetValue() self.adhesion.date = datetime(date_adhesion.GetYear(), date_adhesion.GetMonth()+1, date_adhesion.GetDay()) self.adhesion.adhesion_type = self.combo_box_adhesion_type.GetClientData(self.combo_box_adhesion_type.GetSelection()) self.adhesion.montant = self.adhesion.adhesion_type.prix self.adhesion.cheque = self.text_ctrl_cheque.GetValue() with DATABASE.transaction(): self.adhesion.save() event.Skip()
def OnSauvegarde(self, event): with DATABASE.transaction(): self.SMTP_serveur.value = self.tc_serveur.GetValue() self.SMTP_serveurport = self.tc_port.GetValue() self.SMTP_serveursecurite = self.cb_securite.GetSelection() self.SMTP_login = self.tc_login.GetValue() self.SMTP_motdepasse = self.tc_mdp.GetValue() self.SMTP_serveur.save() self.SMTP_serveurport.save() self.SMTP_serveursecurite.save() self.SMTP_login.save() self.SMTP_motdepasse.save() self.bouton_sauvegarder.Disable()
def OnModifInfos(self, event): self.ASSO_nom.valeur = self.text_ctrl_nom.GetValue() self.ASSO_adresse.valeur = self.text_ctrl_adresse.GetValue() self.ASSO_codepostal.valeur = self.text_ctrl_code_postal.GetValue() self.ASSO_ville.valeur = self.text_ctrl_ville.GetValue() self.ASSO_telephone.valeur = self.text_ctrl_telephone.GetValue() self.ASSO_email.valeur = self.text_ctrl_email.GetValue() self.ASSO_typeadhesion.valeur = str(self.radio_box_type_adhesion.GetSelection()) with DATABASE.transaction(): self.ASSO_nom.save() self.ASSO_adresse.save() self.ASSO_codepostal.save() self.ASSO_ville.save() self.ASSO_telephone.save() self.ASSO_email.save() self.ASSO_typeadhesion.save()
def Enregistre(self): if self.Validate(): self.fournisseur.nom = self.text_Nom.GetValue() self.fournisseur.adresse = self.text_Adresse.GetValue() self.fournisseur.code_postal = self.text_CodePostal.GetValue() self.fournisseur.ville = self.text_Ville.GetValue() self.fournisseur.telephone_fixe = self.text_TelephoneFixe.GetValue( ) self.fournisseur.telephone_portable = self.text_TelephonePortable.GetValue( ) self.fournisseur.email = self.text_Email.GetValue() self.fournisseur.nom_contact = self.text_NomContact.GetValue() self.fournisseur.remarques = self.text_Remarques.GetValue() self.fournisseur.couleur = self.text_Couleur.GetValue() with DATABASE.transaction(): self.fournisseur.save()
def OnEnregistre(self, event): if self.Validate(): self.adherent.nom = self.notebook_p1.text_Nom.GetValue() self.adherent.prenom = self.notebook_p1.text_Prenom.GetValue() self.adherent.adresse = self.notebook_p1.text_Adresse.GetValue() self.adherent.code_postal = self.notebook_p1.text_CodePostal.GetValue() self.adherent.ville = self.notebook_p1.text_Ville.GetValue() self.adherent.telephone_fixe = self.notebook_p1.text_TelephoneFixe.GetValue() self.adherent.telephone_portable = self.notebook_p1.text_TelephonePortable.GetValue() self.adherent.email = self.notebook_p1.text_Email.GetValue() self.adherent.cotisation_type = self.notebook_p1.combo_box_CotisationTypes.GetClientData(self.notebook_p1.combo_box_CotisationTypes.GetSelection()) self.adherent.login = self.notebook_p1.text_Login.GetValue() if self.notebook_p1.text_Motdepasse.GetValue() != '': self.adherent.mot_de_passe = self.notebook_p1.text_Motdepasse.GetValue() with DATABASE.transaction(): self.adherent.save() event.Skip()
def OnValider(self, event): if self.Validate(): msgbox = wx.MessageBox(u"Sauvegarder l'adhésion ?", u"Confirmation", wx.YES_NO | wx.ICON_QUESTION) if msgbox == wx.YES: date_adhesion = self.datepicker_date_adhesion.GetValue() self.adhesion.date = datetime(date_adhesion.GetYear(), date_adhesion.GetMonth() + 1, date_adhesion.GetDay()) self.adhesion.adhesion_type = self.combo_box_adhesion_type.GetClientData( self.combo_box_adhesion_type.GetSelection()) self.adhesion.montant = self.adhesion.adhesion_type.prix self.adhesion.cheque = self.text_ctrl_cheque.GetValue() with DATABASE.transaction(): self.adhesion.save() event.Skip()