Example #1
0
    def Modifier(self, event):
        if len(self.Selection()) == 0:
            dlg = wx.MessageDialog(
                self,
                _(u"Vous n'avez sélectionné aucune déduction à modifier dans la liste !"
                  ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        IDdeduction = self.Selection()[0].IDdeduction
        label = self.Selection()[0].label
        montant = self.Selection()[0].montant
        IDprestation = self.Selection()[0].IDprestation

        from Dlg import DLG_Saisie_deduction
        dlg = DLG_Saisie_deduction.Dialog(self, IDdeduction=IDdeduction)
        dlg.SetLabel(label)
        dlg.SetMontant(montant)
        if dlg.ShowModal() == wx.ID_OK:
            newLabel = dlg.GetLabel()
            newMontant = dlg.GetMontant()
            DB = GestionDB.DB()
            listeDonnees = [
                ("label", newLabel),
                ("montant", newMontant),
            ]
            DB.ReqMAJ("deductions", listeDonnees, "IDdeduction", IDdeduction)
            DB.Close()
            self.MAJ(date_debut=self.date_debut,
                     date_fin=self.date_fin,
                     listeActivites=self.listeActivites,
                     filtres=self.filtres,
                     ID=IDdeduction)
        dlg.Destroy()
Example #2
0
    def Modifier(self, event):
        if len(self.Selection()) == 0:
            dlg = wx.MessageDialog(
                self,
                _(u"Vous n'avez sélectionné aucune déduction à modifier dans la liste !"
                  ), _(u"Erreur de saisie"), wx.OK | wx.ICON_EXCLAMATION)
            dlg.ShowModal()
            dlg.Destroy()
            return
        IDdeduction = self.Selection()[0].IDdeduction
        label = self.Selection()[0].label
        montant = self.Selection()[0].montant
        IDprestation = self.Selection()[0].IDprestation

        from Dlg import DLG_Saisie_deduction
        dlg = DLG_Saisie_deduction.Dialog(self, IDdeduction=IDdeduction)
        dlg.SetLabel(label)
        dlg.SetMontant(montant)
        if dlg.ShowModal() == wx.ID_OK:
            newLabel = dlg.GetLabel()
            newMontant = dlg.GetMontant()
            if self.modificationsVirtuelles == False:
                # Modification directes dans la base de données
                DB = GestionDB.DB()
                listeDonnees = [
                    ("label", newLabel),
                    ("montant", newMontant),
                ]
                DB.ReqMAJ("deductions", listeDonnees, "IDdeduction",
                          IDdeduction)
                DB.Close()
            else:
                # Modifications virtuelles
                self.dictDeductions[IDdeduction]["label"] = newLabel
                self.dictDeductions[IDdeduction]["montant"] = newMontant
                self.dictDeductions[IDdeduction]["etat"] = "MODIF"

            # MAJ du montant de la prestation
            self.MAJ_montant_prestation(montant - newMontant, IDprestation)

        dlg.Destroy()

        # MAJ du contrôle
        self.MAJ(IDdeduction)
Example #3
0
    def Ajouter(self, event):
        from Dlg import DLG_Saisie_deduction
        dlg = DLG_Saisie_deduction.Dialog(self, IDdeduction=None)
        if dlg.ShowModal() == wx.ID_OK:
            newLabel = dlg.GetLabel()
            newMontant = dlg.GetMontant()
            if self.modificationsVirtuelles == False:
                # Ajout direct dans la base de données
                DB = GestionDB.DB()
                listeDonnees = [
                    ("IDprestation", self.IDprestation),
                    ("IDcompte_payeur", self.IDcompte_payeur),
                    ("date", str(datetime.date.today())),
                    ("label", newLabel),
                    ("montant", newMontant),
                    ("IDaide", None),
                ]
                IDdeduction = DB.ReqInsert("deductions", listeDonnees)
                DB.Close()
            else:
                # Modifications virtuelles
                IDdeduction = self.prochainIDdeduction
                self.dictDeductions[IDdeduction] = {"IDdeduction": IDdeduction}
                self.dictDeductions[IDdeduction][
                    "IDprestation"] = self.IDprestation
                self.dictDeductions[IDdeduction][
                    "IDcompte_payeur"] = self.IDcompte_payeur
                self.dictDeductions[IDdeduction]["date"] = str(
                    datetime.date.today())
                self.dictDeductions[IDdeduction]["label"] = newLabel
                self.dictDeductions[IDdeduction]["montant"] = newMontant
                self.dictDeductions[IDdeduction]["IDaide"] = None
                self.dictDeductions[IDdeduction]["etat"] = "AJOUT"
                self.prochainIDdeduction -= 1

            # MAJ du contrôle
            self.MAJ(IDdeduction)

            # MAJ du montant de la prestation
            self.MAJ_montant_prestation(-newMontant)

        dlg.Destroy()