Пример #1
0
def A5200():
    """ Arrondi de toutes les prestations et ventilations de la base de données !!! """
    from UTILS_Decimal import FloatToDecimal as FloatToDecimal
    DB = GestionDB.DB() 

    dlgAttente = wx.BusyInfo(_(u"Veuillez patienter durant la procédure... Celle-ci peut nécessiter quelques minutes..."), None)
    wx.Yield() 

    # Récupère les prestations
    req = """SELECT IDprestation, montant FROM prestations;"""
    DB.ExecuterReq(req)
    listePrestations = DB.ResultatReq() 
    
    # Récupère la ventilation
    req = """SELECT IDventilation, montant FROM ventilation;"""
    DB.ExecuterReq(req)
    listeVentilations = DB.ResultatReq() 

    # Modification des arrondis
    total = len(listePrestations) + len(listeVentilations)
    index = 0
    
    for IDprestation, montant in listePrestations :
        EcritStatusbar(_(u"Correction des arrondis... Merci de patienter...             -> %d %% effectués") % (index * 100 / total))
        DB.ReqMAJ("prestations", [("montant", FloatToDecimal(montant, plusProche=True)),], "IDprestation", IDprestation)
        index += 1
    
    for IDventilation, montant in listeVentilations :
        EcritStatusbar(_(u"Correction des arrondis... Merci de patienter...             - > %d %% effectués") % (index * 100 / total))
        DB.ReqMAJ("ventilation", [("montant", FloatToDecimal(montant, plusProche=True)),], "IDventilation", IDventilation)
        index += 1
        
    DB.Close()
    EcritStatusbar(u"")
    del dlgAttente
Пример #2
0
def A5200():
    """ Arrondi de toutes les prestations et ventilations de la base de données !!! """
    import wx.lib.agw.pybusyinfo as PBI
    from UTILS_Decimal import FloatToDecimal as FloatToDecimal
    DB = GestionDB.DB()

    dlgAttente = PBI.PyBusyInfo(_(
        u"Veuillez patienter durant la procédure... Celle-ci peut nécessiter quelques minutes..."
    ),
                                parent=None,
                                title=_(u"Veuillez patienter..."),
                                icon=wx.Bitmap(
                                    Chemins.GetStaticPath(
                                        "Images/16x16/Logo.png"),
                                    wx.BITMAP_TYPE_ANY))
    wx.Yield()

    # Récupère les prestations
    req = """SELECT IDprestation, montant FROM prestations;"""
    DB.ExecuterReq(req)
    listePrestations = DB.ResultatReq()

    # Récupère la ventilation
    req = """SELECT IDventilation, montant FROM ventilation;"""
    DB.ExecuterReq(req)
    listeVentilations = DB.ResultatReq()

    # Modification des arrondis
    total = len(listePrestations) + len(listeVentilations)
    index = 0

    for IDprestation, montant in listePrestations:
        EcritStatusbar(
            _(u"Correction des arrondis... Merci de patienter...             -> %d %% effectués"
              ) % (index * 100 / total))
        DB.ReqMAJ("prestations", [
            ("montant", FloatToDecimal(montant, plusProche=True)),
        ], "IDprestation", IDprestation)
        index += 1

    for IDventilation, montant in listeVentilations:
        EcritStatusbar(
            _(u"Correction des arrondis... Merci de patienter...             - > %d %% effectués"
              ) % (index * 100 / total))
        DB.ReqMAJ("ventilation", [
            ("montant", FloatToDecimal(montant, plusProche=True)),
        ], "IDventilation", IDventilation)
        index += 1

    DB.Close()
    EcritStatusbar(u"")
    del dlgAttente
Пример #3
0
 def FacturesErronees(self):
     labelProbleme = _(u"Factures erronées")
     labelCorrection = _(u"Recalculer le montant des factures")
     # Recherche des factures
     req = """SELECT factures.IDfacture, factures.numero, factures.IDcompte_payeur, comptes_payeurs.IDfamille,
     factures.total, factures.regle, factures.solde
     FROM factures
     LEFT JOIN comptes_payeurs ON comptes_payeurs.IDcompte_payeur = factures.IDcompte_payeur
     LEFT JOIN familles ON familles.IDfamille = comptes_payeurs.IDfamille
     WHERE etat <> "annulation"
     ORDER BY factures.date_edition;"""
     self.DB.ExecuterReq(req)
     listeFactures = self.DB.ResultatReq()
     # Recherche des prestations
     req = """SELECT IDprestation, montant, IDfacture
     FROM prestations;"""
     self.DB.ExecuterReq(req)
     listePrestations = self.DB.ResultatReq()
     dictPrestationsFacture = {}
     for IDprestation, montant, IDfacture in listePrestations :
         if dictPrestationsFacture.has_key(IDfacture) == False :
             dictPrestationsFacture[IDfacture] = []
         dictPrestationsFacture[IDfacture].append({"IDprestation":IDprestation, "montant" : FloatToDecimal(montant)})
     # Analyse
     listeTemp = []
     for IDfacture, numeroFacture, IDcompte_payeur, IDfamille, totalFacture, regleFacture, soldeFacture in listeFactures :
         totalFacture = FloatToDecimal(totalFacture)
         regleFacture = FloatToDecimal(regleFacture)
         soldeFacture = FloatToDecimal(soldeFacture)
         if dictPrestationsFacture.has_key(IDfacture) :
             listePrestationsFacture = dictPrestationsFacture[IDfacture]
         else :
             listePrestationsFacture = []
         montantTotalPrestations = FloatToDecimal(0.0)
         for dictTemp in listePrestationsFacture :
             montantTotalPrestations += dictTemp["montant"]
         if montantTotalPrestations != FloatToDecimal(totalFacture) :
             # Si la facture n'a pas de famille rattachée
             if IDfamille == None : 
                 label = _(u"Facture ID%d : Famille inconnue") % IDfacture
                 listeTemp.append(FacturesAsupprimer(label=label, IDfacture=IDfacture))
             elif len(listePrestationsFacture) == 0 :
                 label = _(u"Facture ID%d : Aucune prestation correspondante") % IDfacture
                 listeTemp.append(FacturesAsupprimer(label=label, IDfacture=IDfacture))
             elif montantTotalPrestations == FloatToDecimal(0.0) :
                 label = _(u"Facture ID%d : Montant de la facture égal à 0") % IDfacture
                 listeTemp.append(FacturesAsupprimer(label=label, IDfacture=IDfacture))
             else :
                 label = _(u"Facture ID%d : Total à recalculer") % IDfacture
                 listeTemp.append(FacturesRecalcul(label=label, IDfacture=IDfacture, totalFacture=totalFacture, regleFacture=regleFacture, soldeFacture=soldeFacture, montantTotalPrestations=montantTotalPrestations))
     self.listeResultats.append((labelProbleme, labelCorrection, listeTemp))
Пример #4
0
def A8956():
    """ Réparation des factures : Rapprochement des factures et des prestations détachées """
    from UTILS_Decimal import FloatToDecimal
    import UTILS_Dates
    import copy

    DB = GestionDB.DB()

    # Lecture des prestations
    req = """SELECT IDprestation, IDcompte_payeur, date, montant, IDfacture
    FROM prestations
    ;"""
    DB.ExecuterReq(req)
    listeDonnees = DB.ResultatReq()
    dictPrestations = {}
    dictPrestationsFactures = {}
    for IDprestation, IDcompte_payeur, date, montant, IDfacture in listeDonnees :
        montant = FloatToDecimal(montant)
        date = UTILS_Dates.DateEngEnDateDD(date)
        dictTemp = {"IDprestation":IDprestation, "IDcompte_payeur":IDcompte_payeur, "date":date, "montant":montant, "IDfacture":IDfacture}

        if dictPrestations.has_key(IDcompte_payeur) == False :
            dictPrestations[IDcompte_payeur] = []
        dictPrestations[IDcompte_payeur].append(dictTemp)

        if dictPrestationsFactures.has_key(IDfacture) == False :
            dictPrestationsFactures[IDfacture] = {"total" : FloatToDecimal(0.0), "prestations" : []}
        dictPrestationsFactures[IDfacture]["prestations"].append(dictTemp)
        dictPrestationsFactures[IDfacture]["total"] += montant

    # Lecture des factures
    req = """SELECT IDfacture, IDcompte_payeur, date_debut, date_fin, total
    FROM factures
    ;"""
    DB.ExecuterReq(req)
    listeDonnees = DB.ResultatReq()
    listePrestationsReparees = []
    listeFacturesReparees = []
    for IDfacture, IDcompte_payeur, date_debut, date_fin, total_facture in listeDonnees :
        date_debut = UTILS_Dates.DateEngEnDateDD(date_debut)
        date_fin = UTILS_Dates.DateEngEnDateDD(date_fin)
        total_facture = FloatToDecimal(total_facture)

        # Vérifie si le total des prestations correspond bien au total de la facture
        if dictPrestationsFactures.has_key(IDfacture):
            total_prestations = dictPrestationsFactures[IDfacture]["total"]
        else :
            total_prestations = FloatToDecimal(0.0)

        if total_prestations < total_facture :
            #print "PROBLEME : ", IDcompte_payeur, IDfacture, total_prestations, total_facture

            # Recherche les possibles prestations à rattacher
            listePrestationsTrouvees = []
            totalPrestationsTrouvees = copy.copy(total_prestations)
            if dictPrestations.has_key(IDcompte_payeur) :
                for dictPrestation in dictPrestations[IDcompte_payeur] :
                    if dictPrestation["IDfacture"] == None and dictPrestation["date"] >= date_debut and dictPrestation["date"] <= date_fin :
                        listePrestationsTrouvees.append(dictPrestation)
                        totalPrestationsTrouvees += dictPrestation["montant"]

                # Si la liste des prestations correspond bien aux prestations manquantes de la facture, on les associe
                if total_facture == totalPrestationsTrouvees :
                    for dictPrestation in listePrestationsTrouvees :
                        DB.ReqMAJ("prestations", [("IDfacture", IDfacture),], "IDprestation", dictPrestation["IDprestation"])
                        listePrestationsReparees.append(dictPrestation)
                        if IDfacture not in listeFacturesReparees :
                            listeFacturesReparees.append(IDfacture)

    DB.Close()

    # Message de fin
    dlg = wx.MessageDialog(None, _(u"Résultats :\n\nNombre de factures réparées = %d\nNombre de prestations réparées = %d" % (len(listeFacturesReparees), len(listePrestationsReparees))), _(u"Fin de la procédure"), wx.OK | wx.ICON_INFORMATION)
    dlg.ShowModal()
    dlg.Destroy()
    def GetDonneesImpression(self, tracks=[], dictOptions={}):
        """ Impression des factures """
        dlgAttente = PBI.PyBusyInfo(_(u"Recherche des données..."), parent=None, title=_(u"Veuillez patienter..."), icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"), wx.BITMAP_TYPE_ANY))
        wx.Yield() 
        
        dictDonnees = {}
        dictChampsFusion = {}
        for track in tracks :
            IDfamille = track.IDfamille 
            IDcompte_payeur = track.IDcompte_payeur
            
            # Regroupement des enfants
            dictEnfants = {}
            for prestation in track.listePrestations :
                IDindividu = prestation["IDindividu"]
                if dictEnfants.has_key(IDindividu) == False : 
                    if prestation["prenom"] == None : 
                        prenom = ""
                    else :
                        prenom = prestation["prenom"]
                    if prestation["date_naiss"] == None : 
                        date_naiss = ""
                    else :
                        date_naiss = UTILS_Dates.DateEngFr(prestation["date_naiss"])
                    genre = ""
                    if prestation["IDcivilite"] != None :
                        sexe = DICT_CIVILITES[prestation["IDcivilite"]]["sexe"]
                        if sexe == "F" :
                            genre = "e"
                    nomComplet = u"%s %s" % (prestation["nom"], prenom)
                    dictEnfants[IDindividu] = {"nomComplet" : nomComplet, "nom" : prestation["nom"], "prenom" : prenom, "date_naiss" : date_naiss, "genre" : genre, "regle" : FloatToDecimal(0.0)}
                dictEnfants[IDindividu]["regle"] += prestation["regle"]
            
            listeIndividus = []
            for IDindividu, dictTemp in dictEnfants.iteritems() :
                listeIndividus.append((dictTemp["nomComplet"], dictTemp))
            listeIndividus.sort() 
                            
            # Formatage du texte d'intro
            textIntro = ""
            if dictOptions["intro"] != None :
                textIntro = dictOptions["intro"]
                textIntro = textIntro.replace("{GENRE}", dictOptions["signataire"]["genre"])
                textIntro = textIntro.replace("{NOM}", dictOptions["signataire"]["nom"])
                textIntro = textIntro.replace("{FONCTION}", dictOptions["signataire"]["fonction"])
                textIntro = textIntro.replace("{DATE_DEBUT}", UTILS_Dates.DateEngFr(str(dictOptions["date_debut"])))
                textIntro = textIntro.replace("{DATE_FIN}", UTILS_Dates.DateEngFr(str(dictOptions["date_fin"])))
            
            # Mémorisation des données
            dictDonnee = {
                "{ORGANISATEUR_NOM}" : self.dictOrganisme["nom"],
                "{ORGANISATEUR_RUE}" : self.dictOrganisme["rue"],
                "{ORGANISATEUR_CP}" : self.dictOrganisme["cp"],
                "{ORGANISATEUR_VILLE}" : self.dictOrganisme["ville"],
                "{ORGANISATEUR_TEL}" : self.dictOrganisme["tel"],
                "{ORGANISATEUR_FAX}" : self.dictOrganisme["fax"],
                "{ORGANISATEUR_MAIL}" : self.dictOrganisme["mail"],
                "{ORGANISATEUR_SITE}" : self.dictOrganisme["site"],
                "{ORGANISATEUR_AGREMENT}" : self.dictOrganisme["num_agrement"],
                "{ORGANISATEUR_SIRET}" : self.dictOrganisme["num_siret"],
                "{ORGANISATEUR_APE}" : self.dictOrganisme["code_ape"],

                "{IDFAMILLE}" : str(track.IDfamille),
                "{IDCOMPTE_PAYEUR}" : str(track.IDcompte_payeur),
                "{FAMILLE_NOM}" :  track.nomsTitulairesSansCivilite,
                "{FAMILLE_RUE}" : track.rue_resid,
                "{FAMILLE_CP}" : track.cp_resid,
                "{FAMILLE_VILLE}" : track.ville_resid,
                
                "{DATE_EDITION_COURT}" : UTILS_Dates.DateDDEnFr(datetime.date.today()),
                "{DATE_EDITION_LONG}" : UTILS_Dates.DateComplete(datetime.date.today()),
                "{DATE_DEBUT}" : UTILS_Dates.DateDDEnFr(dictOptions["date_debut"]),
                "{DATE_FIN}" : UTILS_Dates.DateDDEnFr(dictOptions["date_fin"]),

                "{MONTANT_FACTURE}" : u"%.2f %s" % (track.montant_total, SYMBOLE),
                "{MONTANT_REGLE}" : u"%.2f %s" % (track.montant_regle, SYMBOLE),
                "{MONTANT_IMPAYE}" : u"%.2f %s" % (track.montant_impaye, SYMBOLE),
                
                "{MONTANT_FACTURE_LETTRES}" : UTILS_Conversion.trad(track.montant_total, MONNAIE_SINGULIER, MONNAIE_DIVISION),
                "{MONTANT_REGLE_LETTRES}" : UTILS_Conversion.trad(track.montant_regle, MONNAIE_SINGULIER, MONNAIE_DIVISION),
                "{MONTANT_IMPAYE_LETTRES}" : UTILS_Conversion.trad(track.montant_impaye, MONNAIE_SINGULIER, MONNAIE_DIVISION),
                 
                "{INTRO}" : textIntro,
                "TXT_ENFANT_1" : "",
                "TXT_ENFANT_2" : "",
                "TXT_ENFANT_3" : "",
                "TXT_ENFANT_4" : "",
                "TXT_ENFANT_5" : "",
                "TXT_ENFANT_6" : "",
                
                "individus" : listeIndividus,
                }
            
            # Ajoute les infos de base familles
            dictDonnee.update(self.infosIndividus.GetDictValeurs(mode="famille", ID=IDfamille, formatChamp=True))
            
            # Insertion des enfants
            index = 1
            for nomCompletIndividu, dictIndividu in listeIndividus :
                dictDonnee["TXT_ENFANT_%d" % index] = _(u"%.2f %s pour %s né%s le %s") % (dictIndividu["regle"], SYMBOLE, nomCompletIndividu, dictIndividu["genre"], dictIndividu["date_naiss"])
                index += 1
                
            # Ajoute les réponses des questionnaires
            for dictReponse in self.Questionnaires.GetDonnees(IDfamille) :
                dictDonnee[dictReponse["champ"]] = dictReponse["reponse"]
                if dictReponse["controle"] == "codebarres" :
                    dictDonnee["{CODEBARRES_QUESTION_%d}" % dictReponse["IDquestion"]] = dictReponse["reponse"]
            
            dictDonnees[IDcompte_payeur] = dictDonnee
            
            # Champs de fusion pour Email
            dictChampsFusion[IDcompte_payeur] = {}
            for key, valeur in dictDonnee.iteritems() :
                if key[0] == "{" :
                    dictChampsFusion[IDcompte_payeur][key] = valeur

        del dlgAttente      
        return dictDonnees, dictChampsFusion
Пример #6
0
    def GetDonneesImpression(self, listeCotisations=[]):
        """ Impression des factures """
        dlgAttente = PBI.PyBusyInfo(
            _(u"Recherche des données..."),
            parent=None,
            title=_(u"Veuillez patienter..."),
            icon=wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Logo.png"),
                           wx.BITMAP_TYPE_ANY))
        wx.Yield()

        # Récupère les données de la facture
        if len(listeCotisations) == 0: conditions = "()"
        elif len(listeCotisations) == 1:
            conditions = "(%d)" % listeCotisations[0]
        else:
            conditions = str(tuple(listeCotisations))

        DB = GestionDB.DB()

        # Récupération des activités
        req = """SELECT IDactivite, nom, abrege
        FROM activites
        ORDER BY date_fin DESC;"""
        DB.ExecuterReq(req)
        listeTemp = DB.ResultatReq()
        dictActivites = {}
        for IDactivite, nom, abrege in listeTemp:
            dictTemp = {"IDactivite": IDactivite, "nom": nom, "abrege": abrege}
            dictActivites[IDactivite] = dictTemp

        # Récupère les prestations
        dictFacturation = {}
        req = """SELECT IDcotisation, SUM(montant)
        FROM prestations
        LEFT JOIN cotisations ON cotisations.IDprestation = prestations.IDprestation
        WHERE cotisations.IDcotisation IN %s 
        GROUP BY cotisations.IDcotisation;""" % conditions
        DB.ExecuterReq(req)
        listePrestations = DB.ResultatReq()
        for IDcotisation, montant in listePrestations:
            dictFacturation[IDcotisation] = {
                "montant": montant,
                "ventilation": 0.0,
                "dateReglement": None,
                "modeReglement": None
            }

        # Récupère la ventilation
        req = """SELECT IDcotisation, SUM(ventilation.montant), MIN(reglements.date), MIN(modes_reglements.label)
        FROM ventilation
        LEFT JOIN prestations ON prestations.IDprestation = ventilation.IDprestation
        LEFT JOIN cotisations ON cotisations.IDprestation = ventilation.IDprestation
        LEFT JOIN reglements ON reglements.IDreglement = ventilation.IDreglement
        LEFT JOIN modes_reglements ON modes_reglements.IDmode = reglements.IDmode
        WHERE cotisations.IDcotisation IN %s 
        GROUP BY cotisations.IDcotisation;""" % conditions
        DB.ExecuterReq(req)
        listeVentilations = DB.ResultatReq()
        for IDcotisation, ventilation, dateReglement, modeReglement in listeVentilations:
            if dictFacturation.has_key(IDcotisation):
                dictFacturation[IDcotisation]["ventilation"] = ventilation
                dictFacturation[IDcotisation]["dateReglement"] = dateReglement
                dictFacturation[IDcotisation]["modeReglement"] = modeReglement

        # Recherche les cotisations
        req = """
        SELECT 
        cotisations.IDcotisation, 
        cotisations.IDfamille, cotisations.IDindividu, cotisations.IDtype_cotisation, cotisations.IDunite_cotisation,
        cotisations.date_saisie, cotisations.IDutilisateur, cotisations.date_creation_carte, cotisations.numero,
        cotisations.IDdepot_cotisation, cotisations.date_debut, cotisations.date_fin, cotisations.IDprestation, 
        types_cotisations.nom, types_cotisations.type, types_cotisations.carte,
        unites_cotisations.nom, comptes_payeurs.IDcompte_payeur, cotisations.observations, cotisations.activites
        FROM cotisations 
        LEFT JOIN types_cotisations ON types_cotisations.IDtype_cotisation = cotisations.IDtype_cotisation
        LEFT JOIN unites_cotisations ON unites_cotisations.IDunite_cotisation = cotisations.IDunite_cotisation
        LEFT JOIN comptes_payeurs ON comptes_payeurs.IDfamille = cotisations.IDfamille
        WHERE cotisations.IDcotisation IN %s 
        ORDER BY cotisations.date_saisie
        ;""" % conditions
        DB.ExecuterReq(req)
        listeDonnees = DB.ResultatReq()
        DB.Close()
        if len(listeDonnees) == 0:
            del dlgAttente
            return False

        # Création des dictRappels
        dictDonnees = {}
        dictChampsFusion = {}
        for item in listeDonnees:

            IDcotisation = item[0]
            IDfamille = item[1]
            IDindividu = item[2]
            IDtype_cotisation = item[3]
            IDunite_cotisation = item[4]
            date_saisie = UTILS_Dates.DateEngEnDateDD(item[5])
            IDutilisateur = item[6]
            date_creation_carte = item[7]
            numero = item[8]
            IDdepot_cotisation = item[9]
            date_debut = UTILS_Dates.DateEngEnDateDD(item[10])
            date_fin = UTILS_Dates.DateEngEnDateDD(item[11])
            IDprestation = item[12]
            nomTypeCotisation = item[13]
            typeTypeCotisation = item[14]
            typeHasCarte = item[15]
            nomUniteCotisation = item[16]
            IDcompte_payeur = item[17]
            observations = item[18]
            activites = item[19]
            if activites == None:
                activites = ""

            # Activités
            texte = ""
            if len(activites) > 0:
                listeTemp = []
                listeIDactivites = UTILS_Divers.ConvertChaineEnListe(activites)
                for IDactivite in listeIDactivites:
                    if dictActivites.has_key(IDactivite):
                        nomActivite = dictActivites[IDactivite]["nom"]
                        listeTemp.append(nomActivite)
                if len(listeTemp) > 0:
                    texte = ", ".join(listeTemp)
            activites = texte

            nomCotisation = u"%s - %s" % (nomTypeCotisation,
                                          nomUniteCotisation)

            # Type
            if typeTypeCotisation == "famille":
                typeStr = _(u"Cotisation familiale")
            else:
                typeStr = _(u"Cotisation individuelle")

            # Dépôt
            if IDdepot_cotisation == None:
                depotStr = _(u"Non déposée")
            else:
                depotStr = _(u"Dépôt n°%d") % IDdepot_cotisation

            # Nom des titulaires de famille
            beneficiaires = ""
            rue = ""
            cp = ""
            ville = ""

            if IDfamille != None:
                beneficiaires = self.dictTitulaires[IDfamille][
                    "titulairesAvecCivilite"]
                rue = self.dictTitulaires[IDfamille]["adresse"]["rue"]
                cp = self.dictTitulaires[IDfamille]["adresse"]["cp"]
                ville = self.dictTitulaires[IDfamille]["adresse"]["ville"]

            if IDindividu != None and self.dictIndividus.has_key(IDindividu):
                beneficiaires = self.dictIndividus[IDindividu]["nom_complet"]
                rue = self.dictIndividus[IDindividu]["rue"]
                cp = self.dictIndividus[IDindividu]["cp"]
                ville = self.dictIndividus[IDindividu]["ville"]

            # Famille
            if IDfamille != None:
                nomTitulaires = self.dictTitulaires[IDfamille][
                    "titulairesAvecCivilite"]
                famille_rue = self.dictTitulaires[IDfamille]["adresse"]["rue"]
                famille_cp = self.dictTitulaires[IDfamille]["adresse"]["cp"]
                famille_ville = self.dictTitulaires[IDfamille]["adresse"][
                    "ville"]
            else:
                nomTitulaires = "Famille inconnue"
                famille_rue = ""
                famille_cp = ""
                famille_ville = ""

            # Facturation
            montant = 0.0
            ventilation = 0.0
            dateReglement = None
            modeReglement = None

            if dictFacturation.has_key(IDcotisation):
                montant = dictFacturation[IDcotisation]["montant"]
                ventilation = dictFacturation[IDcotisation]["ventilation"]
                dateReglement = dictFacturation[IDcotisation]["dateReglement"]
                modeReglement = dictFacturation[IDcotisation]["modeReglement"]

            solde = float(
                FloatToDecimal(montant) - FloatToDecimal(ventilation))

            montantStr = u"%.02f %s" % (montant, SYMBOLE)
            regleStr = u"%.02f %s" % (ventilation, SYMBOLE)
            soldeStr = u"%.02f %s" % (solde, SYMBOLE)
            montantStrLettres = UTILS_Conversion.trad(montant,
                                                      MONNAIE_SINGULIER,
                                                      MONNAIE_DIVISION)
            regleStrLettres = UTILS_Conversion.trad(ventilation,
                                                    MONNAIE_SINGULIER,
                                                    MONNAIE_DIVISION)
            soldeStrLettres = UTILS_Conversion.trad(solde, MONNAIE_SINGULIER,
                                                    MONNAIE_DIVISION)

            # Mémorisation des données
            dictDonnee = {
                "select":
                True,
                "{IDCOTISATION}":
                str(IDcotisation),
                "{IDTYPE_COTISATION}":
                str(IDtype_cotisation),
                "{IDUNITE_COTISATION}":
                str(IDunite_cotisation),
                "{DATE_SAISIE}":
                UTILS_Dates.DateDDEnFr(date_saisie),
                "{IDUTILISATEUR}":
                str(IDutilisateur),
                "{DATE_CREATION_CARTE}":
                UTILS_Dates.DateDDEnFr(date_creation_carte),
                "{NUMERO_CARTE}":
                numero,
                "{IDDEPOT_COTISATION}":
                str(IDdepot_cotisation),
                "{DATE_DEBUT}":
                UTILS_Dates.DateDDEnFr(date_debut),
                "{DATE_FIN}":
                UTILS_Dates.DateDDEnFr(date_fin),
                "{IDPRESTATION}":
                str(IDprestation),
                "{NOM_TYPE_COTISATION}":
                nomTypeCotisation,
                "{NOM_UNITE_COTISATION}":
                nomUniteCotisation,
                "{COTISATION_FAM_IND}":
                typeStr,
                "{IDCOMPTE_PAYEUR}":
                str(IDcompte_payeur),
                "{NOM_COTISATION}":
                nomCotisation,
                "{NOM_DEPOT}":
                depotStr,
                "{MONTANT_FACTURE}":
                montantStr,
                "{MONTANT_REGLE}":
                regleStr,
                "{SOLDE_ACTUEL}":
                soldeStr,
                "{MONTANT_FACTURE_LETTRES}":
                montantStrLettres.capitalize(),
                "{MONTANT_REGLE_LETTRES}":
                regleStrLettres.capitalize(),
                "{SOLDE_ACTUEL_LETTRES}":
                soldeStrLettres.capitalize(),
                "{DATE_REGLEMENT}":
                UTILS_Dates.DateDDEnFr(dateReglement),
                "{MODE_REGLEMENT}":
                modeReglement,
                "{ACTIVITES}":
                activites,
                "{NOTES}":
                observations,
                "{IDINDIVIDU}":
                IDindividu,
                "{BENEFICIAIRE_NOM}":
                beneficiaires,
                "{BENEFICIAIRE_RUE}":
                rue,
                "{BENEFICIAIRE_CP}":
                cp,
                "{BENEFICIAIRE_VILLE}":
                ville,
                "{IDFAMILLE}":
                str(IDfamille),
                "{FAMILLE_NOM}":
                nomTitulaires,
                "{FAMILLE_RUE}":
                famille_rue,
                "{FAMILLE_CP}":
                famille_cp,
                "{FAMILLE_VILLE}":
                famille_ville,
                "{ORGANISATEUR_NOM}":
                self.dictOrganisme["nom"],
                "{ORGANISATEUR_RUE}":
                self.dictOrganisme["rue"],
                "{ORGANISATEUR_CP}":
                self.dictOrganisme["cp"],
                "{ORGANISATEUR_VILLE}":
                self.dictOrganisme["ville"],
                "{ORGANISATEUR_TEL}":
                self.dictOrganisme["tel"],
                "{ORGANISATEUR_FAX}":
                self.dictOrganisme["fax"],
                "{ORGANISATEUR_MAIL}":
                self.dictOrganisme["mail"],
                "{ORGANISATEUR_SITE}":
                self.dictOrganisme["site"],
                "{ORGANISATEUR_AGREMENT}":
                self.dictOrganisme["num_agrement"],
                "{ORGANISATEUR_SIRET}":
                self.dictOrganisme["num_siret"],
                "{ORGANISATEUR_APE}":
                self.dictOrganisme["code_ape"],
                "{DATE_EDITION_COURT}":
                UTILS_Dates.DateDDEnFr(datetime.date.today()),
                "{DATE_EDITION_LONG}":
                UTILS_Dates.DateComplete(datetime.date.today()),
            }

            # Ajoute les informations de base individus et familles
            if IDindividu != None:
                dictDonnee.update(
                    self.infosIndividus.GetDictValeurs(mode="individu",
                                                       ID=IDindividu,
                                                       formatChamp=True))
            if IDfamille != None:
                dictDonnee.update(
                    self.infosIndividus.GetDictValeurs(mode="famille",
                                                       ID=IDfamille,
                                                       formatChamp=True))

            # Ajoute les réponses des questionnaires
            for dictReponse in self.Questionnaires.GetDonnees(IDfamille):
                dictDonnee[dictReponse["champ"]] = dictReponse["reponse"]
                if dictReponse["controle"] == "codebarres":
                    dictDonnee[
                        "{CODEBARRES_QUESTION_%d}" %
                        dictReponse["IDquestion"]] = dictReponse["reponse"]

            dictDonnees[IDcotisation] = dictDonnee

            # Champs de fusion pour Email
            dictChampsFusion[IDcotisation] = {}
            for key, valeur in dictDonnee.iteritems():
                if key[0] == "{":
                    dictChampsFusion[IDcotisation][key] = valeur

        del dlgAttente
        return dictDonnees, dictChampsFusion