Esempio n. 1
0
    def MAJ_donnees(self):
        # Recherche des dates extrêmes du mois
        dernierJourMois = calendar.monthrange(self.annee, self.mois)[1]
        date_debut = datetime.date(self.annee, self.mois, 1)
        date_fin = datetime.date(self.annee, self.mois, dernierJourMois)

        if self.IDactivite == None:
            self.IDactivite = 0

        # Recherche des contrats
        DB = GestionDB.DB()
        req = """SELECT IDcontrat, IDindividu
        FROM contrats
        WHERE type='psu' AND date_debut<='%s' AND date_fin>='%s' AND IDactivite=%d
        ;""" % (date_fin, date_debut, self.IDactivite)
        DB.ExecuterReq(req)
        listeContrats = DB.ResultatReq()

        listeIDcontrats = []
        for IDcontrat, IDindividu in listeContrats:
            listeIDcontrats.append(IDcontrat)

        # Recherche des données de chaque contrat
        self.donnees = []
        for IDcontrat in listeIDcontrats:
            clsbase = Base(IDcontrat=IDcontrat, DB=DB)
            clsbase.Calculer()

            # Recherche d'une mensualité valide
            track_mensualite = None
            liste_mensualites = clsbase.GetValeur("tracks_mensualites", [])
            for track in liste_mensualites:
                if track.mois == self.mois and track.annee == self.annee:
                    track_mensualite = track
                    break

            # Création du track
            track = Track(self.mois, self.annee, clsbase, track_mensualite)
            track.MAJ()
            self.donnees.append(track)

        DB.Close()

        # MAJ du listview
        self.MAJ()
        self.CocheListeTout()
Esempio n. 2
0
    def __init__(self, *args, **kwds):
        wx.Frame.__init__(self, *args, **kwds)
        panel = wx.Panel(self, -1)
        sizer_1 = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(panel, 1, wx.ALL | wx.EXPAND)
        self.SetSizer(sizer_1)

        # Chargement d'un contrat pour les tests
        from Dlg.DLG_Saisie_contratpsu import Base
        self.clsbase = Base(IDcontrat=8)

        self.ctrl = Panel(panel, clsbase=self.clsbase)
        self.bouton_test = wx.Button(panel, -1, "Test")
        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_2.Add(self.ctrl, 1, wx.ALL | wx.EXPAND, 4)
        sizer_2.Add(self.bouton_test, 0, wx.ALL | wx.EXPAND, 4)
        panel.SetSizer(sizer_2)
        self.Layout()
        self.CentreOnScreen()
        self.Bind(wx.EVT_BUTTON, self.OnBoutonTest, self.bouton_test)
Esempio n. 3
0
        ])
        pageCalendrier.ctrl_calendrier.Enable(False)

        # Sélectionne les unités
        listeUnites = [
            {
                "IDunite": track.IDunite,
                "options": {
                    "interdit_ajout": True,
                    "heure_debut": track.heure_debut,
                    "heure_fin": track.heure_fin,
                    "quantite": track.quantite
                }
            },
        ]
        pageCalendrier.ctrl_unites.SetDonnees(listeUnites)


if __name__ == u"__main__":
    app = wx.App(0)
    #wx.InitAllImageHandlers()
    # Importation d'un contrat pour les tests
    from Dlg.DLG_Saisie_contratpsu import Base
    clsbase = Base(IDcontrat=8)
    clsbase.Calculer()
    # Ouverture DLG
    dlg = Dialog(None, clsbase=clsbase)
    app.SetTopWindow(dlg)
    dlg.ShowModal()
    app.MainLoop()