def __init__(self,
                 dictValeurs={},
                 dictOptions={},
                 IDmodele=None,
                 ouverture=True,
                 nomFichier=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions

        # Initialisation du document
        if nomFichier == None:
            nomDoc = FonctionsPerso.GenerationNomDoc("LOCATIONS", "pdf")
        else:
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        # ----------- Insertion du contenu des frames --------------
        listeLabels = []
        for IDlocation, dictValeur in dictValeurs.iteritems():
            listeLabels.append((dictValeur["{FAMILLE_NOM}"], IDlocation))
        listeLabels.sort()

        for labelDoc, IDlocation in listeLabels:
            dictValeur = dictValeurs[IDlocation]
            if dictValeur["select"] == True:

                story.append(DocAssign("IDlocation", IDlocation))
                nomSansCivilite = dictValeur["{FAMILLE_NOM}"]
                story.append(Bookmark(nomSansCivilite, str(IDlocation)))

                # Saut de page
                story.append(PageBreak())

        # Finalisation du PDF
        doc.build(story)

        # Ouverture du PDF
        if ouverture == True:
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self, dictValeurs={}, dictOptions={}, IDmodele=None, ouverture=True, nomFichier=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions
        
        # Initialisation du document
        if nomFichier == None :
            nomDoc = FonctionsPerso.GenerationNomDoc("LOCATIONS", "pdf")
        else :
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)
        
        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc
        
        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        
        # ----------- Insertion du contenu des frames --------------
        listeLabels = []
        for IDlocation, dictValeur in dictValeurs.iteritems() :
            listeLabels.append((dictValeur["{FAMILLE_NOM}"], IDlocation))
        listeLabels.sort() 
        
        for labelDoc, IDlocation in listeLabels :
            dictValeur = dictValeurs[IDlocation]
            if dictValeur["select"] == True :
                
                story.append(DocAssign("IDlocation", IDlocation))
                nomSansCivilite = dictValeur["{FAMILLE_NOM}"]
                story.append(Bookmark(nomSansCivilite, str(IDlocation)))

                # Saut de page
                story.append(PageBreak())
        
        # Finalisation du PDF
        doc.build(story)
        
        # Ouverture du PDF
        if ouverture == True :
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self,
                 dictValeurs={},
                 dictOptions={},
                 IDmodele=None,
                 ouverture=True,
                 nomFichier=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions

        # Initialisation du document
        if nomFichier == None:
            nomDoc = FonctionsPerso.GenerationNomDoc("INSCRIPTIONS", "pdf")
        else:
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        # ----------- Insertion du contenu des frames --------------
        listeLabels = []
        for IDinscription, dictValeur in dictValeurs.items():
            listeLabels.append((dictValeur["{FAMILLE_NOM}"], IDinscription))
        listeLabels.sort()

        for labelDoc, IDinscription in listeLabels:
            dictValeur = dictValeurs[IDinscription]
            if dictValeur["select"] == True:
                story.append(DocAssign("IDinscription", IDinscription))
                nomSansCivilite = dictValeur["{FAMILLE_NOM}"]
                story.append(Bookmark(nomSansCivilite, str(IDinscription)))

                # ----------- Insertion du cadre principal --------------
                cadre_principal = doc.modeleDoc.FindObjet("cadre_principal")
                if cadre_principal != None:

                    if "intro" in DICT_OPTIONS and DICT_OPTIONS[
                            "intro"] != None or "tableau" in DICT_OPTIONS and DICT_VALEURS[
                                "tableau"] == True:
                        # ------------------- TITRE -----------------
                        dataTableau = []
                        largeursColonnes = [
                            TAILLE_CADRE_CONTENU[2],
                        ]
                        dataTableau.append(
                            (_(u"Confirmation d'inscription"), ))
                        dataTableau.append((u"", ))
                        style = TableStyle([
                            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                            ('FONT', (0, 0), (0, 0), "Helvetica-Bold", 19),
                            ('FONT', (0, 1), (0, 1), "Helvetica", 8),
                            ('LINEBELOW', (0, 0), (0, 0), 0.25, colors.black),
                            ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
                        ])
                        tableau = Table(dataTableau, largeursColonnes)
                        tableau.setStyle(style)
                        story.append(tableau)
                        story.append(Spacer(0, 10))

                        # TEXTE D'INTRODUCTION
                        paraStyleIntro = ParagraphStyle(
                            name="intro",
                            fontName="Helvetica",
                            fontSize=11,
                            leading=14,
                            spaceBefore=0,
                            spaceafter=0,
                            leftIndent=0,
                            rightIndent=0,
                            alignment=0,
                        )

                    if "intro" in DICT_OPTIONS and DICT_OPTIONS[
                            "intro"] != None:
                        texteIntro = DICT_VALEURS["intro"]
                        story.append(
                            Paragraph(u"<i>%s</i>" % texteIntro,
                                      paraStyleIntro))
                        story.append(Spacer(0, 20))

                    if "tableau" in DICT_OPTIONS and DICT_OPTIONS[
                            "tableau"] == True:
                        # ------------------- TABLEAU CONTENU -----------------
                        dataTableau = []
                        largeursColonnes = [80, 280]
                        paraStyle = ParagraphStyle(
                            name="detail",
                            fontName="Helvetica-Bold",
                            fontSize=9,
                        )
                        dataTableau.append(
                            (_(u"Nom"),
                             Paragraph(DICT_VALEURS["{INDIVIDU_NOM}"],
                                       paraStyle)))
                        dataTableau.append(
                            (_(u"Prénom"),
                             Paragraph(DICT_VALEURS["{INDIVIDU_PRENOM}"],
                                       paraStyle)))
                        dataTableau.append(
                            (_(u"Activité"),
                             Paragraph(DICT_VALEURS["{ACTIVITE_NOM_LONG}"],
                                       paraStyle)))
                        dataTableau.append(
                            (_(u"Groupe"),
                             Paragraph(DICT_VALEURS["{GROUPE_NOM_LONG}"],
                                       paraStyle)))
                        dataTableau.append(
                            (_(u"Catégorie"),
                             Paragraph(DICT_VALEURS["{NOM_CATEGORIE_TARIF}"],
                                       paraStyle)))

                        style = TableStyle([
                            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                            ('FONT', (0, 0), (0, -1), "Helvetica", 9),
                            ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                            ('ALIGN', (0, 0), (0, -1), 'RIGHT'),
                        ])
                        tableau = Table(dataTableau, largeursColonnes)
                        tableau.setStyle(style)
                        story.append(tableau)

                # Saut de page
                story.append(PageBreak())

        # Finalisation du PDF
        doc.build(story)

        # Ouverture du PDF
        if ouverture == True:
            FonctionsPerso.LanceFichierExterne(nomDoc)
示例#4
0
    def __init__(self, dictValeurs={}, dictOptions={}, IDmodele=None, mode="facture", ouverture=True, nomFichier=None, titre=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions
        self.mode = mode
        
        detail = 0
        if dictOptions["affichage_prestations"] != None :
            detail = dictOptions["affichage_prestations"]
        
        # Initialisation du document
        if nomFichier == None :
            nomDoc = _(u"Temp/%ss_%s.pdf") % (mode, FonctionsPerso.GenerationIDdoc())
        else :
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)
        
        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None :
            raise Exception("Votre modèle de document doit obligatoirement comporter un cadre principal. Retournez dans l'éditeur de document et utilisez pour votre modèle la commande 'Insérer un objet spécial > Insérer le cadre principal'.")
        
        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        
##        # Définit le template des pages suivantes
##        story.append(NextPageTemplate("suivante"))
        
        
        # ----------- Insertion du contenu des frames --------------
        listeNomsSansCivilite = []
        for IDcompte_payeur, dictValeur in dictValeurs.iteritems() :
            listeNomsSansCivilite.append((dictValeur["nomSansCivilite"], IDcompte_payeur))
        listeNomsSansCivilite.sort() 
        
        for nomSansCivilite, IDcompte_payeur in listeNomsSansCivilite :
            dictValeur = dictValeurs[IDcompte_payeur]
            if dictValeur["select"] == True :
                
                story.append(DocAssign("IDcompte_payeur", IDcompte_payeur))
                nomSansCivilite = dictValeur["nomSansCivilite"]
                story.append(Bookmark(nomSansCivilite, str(IDcompte_payeur)))
                
                # ------------------- TITRE -----------------
                if dictOptions["afficher_titre"] == True :
                    if titre == None :
                        if mode == "facture" : titre = _(u"Facture")
                        if mode == "attestation" : titre = _(u"Attestation de présence")
                        if dictValeur.has_key("texte_titre") : 
                            titre = dictValeur["texte_titre"]
                    dataTableau = []
                    largeursColonnes = [ CADRE_CONTENU[2], ]
                    dataTableau.append((titre,))
                    texteDateDebut = DateEngFr(str(dictValeur["date_debut"]))
                    texteDateFin = DateEngFr(str(dictValeur["date_fin"]))
                    if dictOptions["afficher_periode"] == True :
                        dataTableau.append((_(u"Période du %s au %s") % (texteDateDebut, texteDateFin),))
                    styles = [
                            ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), 
                            ('FONT',(0,0),(0,0), "Helvetica-Bold", dictOptions["taille_texte_titre"]), 
                            ('LINEBELOW', (0,0), (0,0), 0.25, colors.black), 
                            ('ALIGN', (0,0), (-1,-1), 'LEFT'), 
                            ]
                    
                    if dictOptions["afficher_periode"] == True :
                        styles.append(('FONT',(0,1),(0,1), "Helvetica", dictOptions["taille_texte_periode"]))
                    tableau = Table(dataTableau, largeursColonnes)
                    tableau.setStyle(TableStyle(styles))
                    story.append(tableau)
                    story.append(Spacer(0,20))
                
                # TEXTE D'INTRODUCTION pour Attestation
##                if mode == "attestation" and dictValeur["intro"] != None :
##                    texteIntro = dictValeur["intro"]
##                    paraStyle = ParagraphStyle(name="intro",
##                                          fontName="Helvetica",
##                                          fontSize=9,
##                                          leading=14,
##                                          spaceBefore=0,
##                                          spaceafter=0,
##                                          leftIndent=20,
##                                          rightIndent=20,
##                                          alignment=1,
##                                        )
##                    story.append(Paragraph(u"<i>%s</i>" % texteIntro, paraStyle))
##                    story.append(Spacer(0,20))

                if dictOptions["texte_introduction"] != "" :
                    paraStyle = ParagraphStyle(name="introduction",
                                          fontName="Helvetica",
                                          fontSize=dictOptions["taille_texte_introduction"],
                                          leading=14,
                                          spaceBefore=0,
                                          spaceafter=0,
                                          leftIndent=5,
                                          rightIndent=5,
                                          alignment=dictOptions["alignement_texte_introduction"],
                                          backColor=ConvertCouleurWXpourPDF(dictOptions["couleur_fond_introduction"]),
                                          borderColor=ConvertCouleurWXpourPDF(dictOptions["couleur_bord_introduction"]),
                                          borderWidth=0.5,
                                          borderPadding=5,
                                        )
                    texte = dictValeur["texte_introduction"].replace("\\n", "<br/>")
                    if dictOptions["style_texte_introduction"] == 0 : texte = u"<para>%s</para>" % texte
                    if dictOptions["style_texte_introduction"] == 1 : texte = u"<para><i>%s</i></para>" % texte
                    if dictOptions["style_texte_introduction"] == 2 : texte = u"<para><b>%s</b></para>" % texte
                    if dictOptions["style_texte_introduction"] == 3 : texte = u"<para><i><b>%s</b></i></para>" % texte
                    story.append(Paragraph(texte, paraStyle))
                    story.append(Spacer(0,20))

                    
                couleurFond = ConvertCouleurWXpourPDF(dictOptions["couleur_fond_1"]) # (0.8, 0.8, 1)
                couleurFondActivite = ConvertCouleurWXpourPDF(dictOptions["couleur_fond_2"]) # (0.92, 0.92, 1)

                # ------------------- TABLEAU CONTENU -----------------
                montantPeriode = FloatToDecimal(0.0)
                montantVentilation = FloatToDecimal(0.0)

                # Recherche si TVA utilisée
                activeTVA = False
                for IDindividu, dictIndividus in dictValeur["individus"].iteritems() :
                    for IDactivite, dictActivites in dictIndividus["activites"].iteritems() :
                        for date, dictDates in dictActivites["presences"].iteritems() :
                            for dictPrestation in dictDates["unites"] :
                                if dictPrestation["tva"] != None and dictPrestation["tva"] != 0.0 :
                                    activeTVA = True

                # Remplissage
                for IDindividu, dictIndividus in dictValeur["individus"].iteritems() :
                    
                    if dictIndividus["select"] == True :
                        
                        listeIndexActivites = []
                        montantPeriode += dictIndividus["total"]
                        montantVentilation += dictIndividus["ventilation"]
                        
                        # Initialisation des largeurs de tableau
                        largeurColonneDate = dictOptions["largeur_colonne_date"]
                        largeurColonneMontantHT = dictOptions["largeur_colonne_montant_ht"]
                        largeurColonneTVA = dictOptions["largeur_colonne_montant_tva"]
                        largeurColonneMontantTTC = dictOptions["largeur_colonne_montant_ttc"]
                        largeurColonneBaseTTC = largeurColonneMontantTTC
                        
                        if activeTVA == True and detail == 0 :
                            largeurColonneIntitule = CADRE_CONTENU[2] - largeurColonneDate - largeurColonneMontantHT - largeurColonneTVA - largeurColonneMontantTTC
                            largeursColonnes = [ largeurColonneDate, largeurColonneIntitule, largeurColonneMontantHT, largeurColonneTVA, largeurColonneMontantTTC]
                        else :
                            if detail != 0 :
                                largeurColonneIntitule = CADRE_CONTENU[2] - largeurColonneDate - largeurColonneBaseTTC - largeurColonneMontantTTC
                                largeursColonnes = [ largeurColonneDate, largeurColonneIntitule, largeurColonneBaseTTC, largeurColonneMontantTTC]
                            else :
                                largeurColonneIntitule = CADRE_CONTENU[2] - largeurColonneDate - largeurColonneMontantTTC
                                largeursColonnes = [ largeurColonneDate, largeurColonneIntitule, largeurColonneMontantTTC]
                        
                        # Insertion du nom de l'individu
                        paraStyle = ParagraphStyle(name="individu",
                                              fontName="Helvetica",
                                              fontSize=dictOptions["taille_texte_individu"],
                                              leading=dictOptions["taille_texte_individu"],
                                              spaceBefore=0,
                                              spaceafter=0,
                                            )
                        texteIndividu = Paragraph(dictIndividus["texte"], paraStyle)
                        dataTableau = []
                        dataTableau.append([texteIndividu,])
                        tableau = Table(dataTableau, [CADRE_CONTENU[2],])
                        listeStyles = [
                                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                                ('FONT', (0, 0), (-1, -1), "Helvetica", dictOptions["taille_texte_individu"]), 
                                ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                                ('BACKGROUND', (0, 0), (-1, 0), couleurFond),
                                ]
                        tableau.setStyle(TableStyle(listeStyles))
                        story.append(tableau)
                        
                        # Insertion du nom de l'activité
                        for IDactivite, dictActivites in dictIndividus["activites"].iteritems() :
                            texteActivite = dictActivites["texte"]
                            if texteActivite != None :
                                dataTableau = []
                                dataTableau.append([texteActivite,])
                                tableau = Table(dataTableau, [CADRE_CONTENU[2],])
                                listeStyles = [
                                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                                    ('FONT', (0, 0), (-1, -1), "Helvetica", dictOptions["taille_texte_activite"]),
                                    ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                                    ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
                                    ('BACKGROUND', (0, 0), (-1, 0), couleurFondActivite),
                                    ]
                                tableau.setStyle(TableStyle(listeStyles))
                                story.append(tableau)

                            # Style de paragraphe normal
                            paraStyle = ParagraphStyle(name="prestation",
                                          fontName="Helvetica",
                                          fontSize=dictOptions["taille_texte_prestation"],
                                          leading=dictOptions["taille_texte_prestation"],
                                          spaceBefore=0,
                                          spaceAfter=0,
                                          )

                            paraLabelsColonnes = ParagraphStyle(name="paraLabelsColonnes",
                                          fontName="Helvetica",
                                          fontSize=dictOptions["taille_texte_noms_colonnes"],
                                          leading=dictOptions["taille_texte_noms_colonnes"],
                                          spaceBefore=0,
                                          spaceAfter=0,
                                          )
                                

                            if detail != 0 :
                                
                                # -------------- MODE REGROUPE ----------------
                                
                                # Regroupement par prestations identiques
                                dictRegroupement = {}
                                for date, dictDates in dictActivites["presences"].iteritems() :
                                    total = dictDates["total"]
                                    for dictPrestation in dictDates["unites"] :
                                        label = dictPrestation["label"]
                                        listeDatesUnite = GetDatesListes(dictPrestation["listeDatesConso"])
                                        montant = dictPrestation["montant"]
                                        deductions = dictPrestation["deductions"]
                                        tva = dictPrestation["tva"]
                                        
                                        if detail == 1 : labelkey = label
                                        if detail == 2 : labelkey = label + " P.U. " + "%.2f %s" % (montant, SYMBOLE)
                                            
                                        if dictRegroupement.has_key(labelkey) == False :
                                            dictRegroupement[labelkey] = {"labelpresta" : label, "total" : 0, "nbre" : 0, "base" : 0, "dates_forfait" : None}
                                            dictRegroupement[labelkey]["base"] = montant
                                        
                                        dictRegroupement[labelkey]["total"] += montant
                                        dictRegroupement[labelkey]["nbre"] += 1
                                        
                                        if detail == 1 :
                                            dictRegroupement[labelkey]["base"] = dictRegroupement[labelkey]["total"] / dictRegroupement[labelkey]["nbre"]
 
                                        if len(listeDatesUnite) > 1 :
                                            listeDatesUnite.sort()
                                            date_debut = listeDatesUnite[0]
                                            date_fin = listeDatesUnite[-1]
                                            nbreDates = len(listeDatesUnite)
                                            dictRegroupement[labelkey]["dates_forfait"] = _(u"<BR/><font size=5>Du %s au %s soit %d jours</font>") % (DateEngFr(str(date_debut)), DateEngFr(str(date_fin)), nbreDates)
        
                                # Insertion des prestations regroupées
                                listeLabels = dictRegroupement.keys() 
                                listeLabels.sort() 

                                dataTableau = [(
                                    Paragraph(_(u"<para align='center'>Quantité</para>"), paraLabelsColonnes), 
                                    Paragraph(_(u"<para align='center'>Prestation</para>"), paraLabelsColonnes),
                                    Paragraph(_(u"<para align='center'>Base</para>"), paraLabelsColonnes),
                                    Paragraph(_(u"<para align='center'>Montant</para>"), paraLabelsColonnes), 
                                    ),]

                                for labelkey in listeLabels :
                                    label = dictRegroupement[labelkey]["labelpresta"]
                                    nbre = dictRegroupement[labelkey]["nbre"]
                                    total = dictRegroupement[labelkey]["total"]
                                    base = dictRegroupement[labelkey]["base"]

                                    # recherche d'un commentaire
                                    if dictOptions.has_key("dictCommentaires") :
                                        key = (label, IDactivite)
                                        if dictOptions["dictCommentaires"].has_key(key) :
                                            commentaire = dictOptions["dictCommentaires"][key]
                                            label = "%s <i><font color='#939393'>%s</font></i>" % (label, commentaire)
                                            
                                    # Formatage du label
                                    intitule = Paragraph(label, paraStyle)
                                    
                                    # Rajout des dates de forfait
                                    #dates_forfait = dictRegroupement[label]["dates_forfait"]
                                    #if dates_forfait != None :
                                    #    intitule = [intitule, Paragraph(dates_forfait, paraStyle)]

                                    dataTableau.append([Paragraph(u"<para align='center'>%d</para>" % nbre, paraStyle), intitule, Paragraph(u"<para align='center'>%.02f %s</para>" % (base, SYMBOLE), paraStyle), Paragraph(u"<para align='center'>%.02f %s</para>" % (total, SYMBOLE), paraStyle)])
 
                            else :
                                
                                # -------------------------------------------------------------- MODE DETAILLE ------------------------------------------------------------------


                                # Insertion de la date
                                listeDates = []
                                for date, dictDates in dictActivites["presences"].iteritems() :
                                    listeDates.append(date)
                                listeDates.sort() 
                                
                                paraStyle = ParagraphStyle(name="prestation",
                                              fontName="Helvetica",
                                              fontSize=dictOptions["taille_texte_prestation"],
                                              leading=dictOptions["taille_texte_prestation"],
                                              spaceBefore=0,
                                              spaceAfter=0,
                                              )

                                dataTableau = []

                                if activeTVA == True :
                                    dataTableau.append([
                                        Paragraph(_(u"<para align='center'>Date</para>"), paraLabelsColonnes), 
                                        Paragraph(_(u"<para align='center'>Prestation</para>"), paraLabelsColonnes), 
                                        Paragraph(_(u"<para align='center'>Montant HT</para>"), paraLabelsColonnes), 
                                        Paragraph(_(u"<para align='center'>Taux TVA</para>"), paraLabelsColonnes), 
                                        Paragraph(_(u"<para align='center'>Montant TTC</para>"), paraLabelsColonnes), 
                                        ])

                                for date in listeDates :
                                    dictDates = dictActivites["presences"][date]
                                    
                                    date = dictDates["texte"]
                                    prestations = dictDates["unites"]
                                    
                                    # Insertion des unités de présence
                                    listeIntitules = []
                                    listeMontantsHT = []
                                    listeTVA = []
                                    listeMontantsTTC = []
                                    texteIntitules = u""
                                    texteMontantsHT = u""
                                    texteTVA = u""
                                    texteMontantsTTC = u""
                                    
                                    for dictPrestation in prestations :
                                        label = dictPrestation["label"]
                                        listeDatesUnite = GetDatesListes(dictPrestation["listeDatesConso"])
                                        montant_initial = dictPrestation["montant_initial"]
                                        montant = dictPrestation["montant"]
                                        deductions = dictPrestation["deductions"]
                                        tva = dictPrestation["tva"]

                                        # Date
                                        texteDate = Paragraph("<para align='center'>%s</para>" % date, paraStyle)
                                        
                                        # recherche d'un commentaire
                                        if dictOptions.has_key("dictCommentaires") :
                                            key = (label, IDactivite)
                                            if dictOptions["dictCommentaires"].has_key(key) :
                                                commentaire = dictOptions["dictCommentaires"][key]
                                                label = "%s <i><font color='#939393'>%s</font></i>" % (label, commentaire)

                                        # Affiche le Label de la prestation
                                        listeIntitules.append(Paragraph(label, paraStyle)) 
                                        
                                        # Recherche si c'est un forfait
                                        if len(listeDatesUnite) > 1 :
                                            listeDatesUnite.sort()
                                            date_debut = listeDatesUnite[0]
                                            date_fin = listeDatesUnite[-1]
                                            nbreDates = len(listeDatesUnite)
                                            label = _(u"<BR/><font size=5>Du %s au %s soit %d jours</font>") % (DateEngFr(str(date_debut)), DateEngFr(str(date_fin)), nbreDates)
                                            listeIntitules.append(Paragraph(label, paraStyle)) 
                                                                                
                                        # TVA
                                        if activeTVA == True :
                                            if tva == None : tva = 0.0
                                            montantHT = (100.0 * float(montant)) / (100 + float(tva)) #montant - montant * 1.0 * float(tva) / 100
                                            listeMontantsHT.append(Paragraph(u"<para align='center'>%.02f %s</para>" % (montantHT, SYMBOLE), paraStyle))
                                            listeTVA.append(Paragraph(u"<para align='center'>%.02f %%</para>" % tva, paraStyle))
                                        else :
                                            listeMontantsHT.append("")
                                            listeTVA.append("")
                                            
                                        # Affiche total
                                        listeMontantsTTC.append(Paragraph(u"<para align='center'>%.02f %s</para>" % (montant, SYMBOLE), paraStyle)) 
                                    
                                        # Déductions
                                        if len(deductions) > 0 :
                                            for dictDeduction in deductions :
                                                listeIntitules.append(Paragraph(u"<para align='left'><font size=5 color='#939393'>- %.02f %s : %s</font></para>" % (dictDeduction["montant"], SYMBOLE, dictDeduction["label"]), paraStyle))
                                                #listeIntitules.append(Paragraph(u"<para align='left'><font size=5 color='#939393'>%s</font></para>" % dictDeduction["label"], paraStyle))
                                                listeMontantsHT.append(Paragraph("&nbsp;", paraStyle))
                                                listeTVA.append(Paragraph("&nbsp;", paraStyle))
                                                listeMontantsTTC.append(Paragraph("&nbsp;", paraStyle))
                                                #listeMontantsTTC.append(Paragraph(u"<para align='center'><font size=5 color='#939393'>- %.02f %s</font></para>" % (dictDeduction["montant"], SYMBOLE), paraStyle)) 
                                                
                                        
                                    if len(listeIntitules) == 1 :
                                        texteIntitules = listeIntitules[0]
                                        texteMontantsHT = listeMontantsHT[0]
                                        texteTVA = listeTVA[0]
                                        texteMontantsTTC = listeMontantsTTC[0]
                                    if len(listeIntitules) > 1 :
                                        texteIntitules = listeIntitules
                                        texteMontantsHT = listeMontantsHT
                                        texteTVA = listeTVA
                                        texteMontantsTTC = listeMontantsTTC
                                                                        
                                    if activeTVA == True :
                                        dataTableau.append([texteDate, texteIntitules, texteMontantsHT, texteTVA, texteMontantsTTC])
                                    else :
                                        dataTableau.append([texteDate, texteIntitules, texteMontantsTTC])
                                    
                            # Style du tableau des prestations
                            tableau = Table(dataTableau, largeursColonnes)
                            listeStyles = [
                                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                                ('FONT', (0, 0), (-1, -1), "Helvetica", dictOptions["taille_texte_prestation"]), 
                                ('GRID', (0, 0), (-1,-1), 0.25, colors.black), 
                                ('ALIGN', (0, 0), (-1, -1), 'CENTRE'),
                                ('ALIGN', (1, 0), (1, -1), 'LEFT'),
                                ('TOPPADDING', (0, 0), (-1, -1), 1), 
                                ('BOTTOMPADDING', (0, 0), (-1, -1), 3), 
                                ]
                            tableau.setStyle(TableStyle(listeStyles))
                            story.append(tableau)
                        
                        # Insertion des totaux
                        dataTableau = []
                        if activeTVA == True and detail == 0 :
                            dataTableau.append(["", "", "", "", Paragraph("<para align='center'>%.02f %s</para>" % (dictIndividus["total"], SYMBOLE) , paraStyle)])
                        else :
                            if detail != 0 :
                                dataTableau.append(["", "", "", Paragraph("<para align='center'>%.02f %s</para>" % (dictIndividus["total"], SYMBOLE) , paraStyle)])
                            else :
                                dataTableau.append(["", "", Paragraph("<para align='center'>%.02f %s</para>" % (dictIndividus["total"], SYMBOLE) , paraStyle)])
                        
                        listeStyles = [
                                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                                ('FONT', (0, 0), (-1, -1), "Helvetica", dictOptions["taille_texte_prestation"]), 
                                ('GRID', (-1, -1), (-1,-1), 0.25, colors.black), 
                                ('ALIGN', (-1, -1), (-1, -1), 'CENTRE'),
                                ('BACKGROUND', (-1, -1), (-1, -1), couleurFond), 
                                ('TOPPADDING', (0, 0), (-1, -1), 1), 
                                ('BOTTOMPADDING', (0, 0), (-1, -1), 3), 
                                ]
                            
                        # Création du tableau
                        tableau = Table(dataTableau, largeursColonnes)
                        tableau.setStyle(TableStyle(listeStyles))
                        story.append(tableau)
                        story.append(Spacer(0, 10))
                
                # Intégration des messages, des reports et des qf
                listeMessages = []
                paraStyle = ParagraphStyle(name="message",
                                          fontName="Helvetica",
                                          fontSize=dictOptions["taille_texte_messages"],
                                          leading=dictOptions["taille_texte_messages"],
                                          #spaceBefore=0,
                                          spaceAfter=2,
                                        )
                
                # Date d'échéance
##                if dictOptions["echeance"] != None :
##                    listeMessages.append(Paragraph(dictOptions["echeance"], paraStyle))

               # QF aux dates de facture
                if mode == "facture" and dictOptions["afficher_qf_dates"] == True :
                    dictQfdates = dictValeur["qfdates"]
                    listeDates = dictQfdates.keys() 
                    listeDates.sort() 
                    if len(listeDates) > 0 :
                        for dates in listeDates :
                            texteQf = _(u"--- Votre QF %s : <b>%s</b> ---") % (dates, dictQfdates[dates])
                            listeMessages.append(Paragraph(texteQf, paraStyle))
                
                
                # Reports
                if mode == "facture" and dictOptions["afficher_impayes"] == True :
                    dictReports = dictValeur["reports"]
                    listePeriodes = dictReports.keys() 
                    listePeriodes.sort() 
                    if len(listePeriodes) > 0 :
                        texteReport = _(u"<b>Impayés : </b>Merci de bien vouloir nous retourner également le règlement des prestations antérieures : ")
                        for periode in listePeriodes :
                            annee, mois = periode
                            nomPeriode = PeriodeComplete(mois, annee)
                            montant_impaye = dictReports[periode]
                            texteReport += u"%s (%.02f %s), " % (nomPeriode, montant_impaye, SYMBOLE)
                        texteReport = texteReport[:-2] + u"."
                        listeMessages.append(Paragraph(texteReport, paraStyle))
                
                # Messages
                if mode == "facture" :
                    if dictOptions["afficher_messages"] == True :
                        for message in dictOptions["messages"] :
                            listeMessages.append(Paragraph(message, paraStyle))
                        
                        for message_familial in dictValeur["messages_familiaux"] :
                            texte = message_familial["texte"]
                            if len(texte) > 0 and texte[-1] not in ".!?" : 
                                texte = texte + u"."
                            texte = _(u"<b>Message : </b>%s") % texte
                            listeMessages.append(Paragraph(texte, paraStyle))
                            
                if len(listeMessages) > 0 :
                    listeMessages.insert(0, Paragraph(_(u"<u>Informations :</u>"), paraStyle))
                
                # ------------------ CADRE TOTAUX ------------------------
                dataTableau = []
                largeurColonneLabel = 110
                largeursColonnes = [ CADRE_CONTENU[2] - largeurColonneMontantTTC - largeurColonneLabel, largeurColonneLabel, largeurColonneMontantTTC]

                dataTableau.append((listeMessages, _(u"TOTAL période:"), u"%.02f %s" % (dictValeur["total"], SYMBOLE)))
                dataTableau.append(("", _(u"Montant déjà réglé :"), u"%.02f %s" % (dictValeur["ventilation"], SYMBOLE)))
                dataTableau.append(("", _(u"Reste à régler :"), u"%.02f %s" % (dictValeur["solde"], SYMBOLE) ))

                style = [
                        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), 
                        ('FONT', (1, 0), (1, -1), "Helvetica-Bold", dictOptions["taille_texte_labels_totaux"]), 
                        ('FONT', (2, 0), (2, -1), "Helvetica-Bold", dictOptions["taille_texte_montants_totaux"]), 
                        
                        ('GRID', (2, 0), (2, 0), 0.25, colors.black),
                        ('GRID', (2, 1), (2, 1), 0.25, colors.black),
                        ('GRID', (2, 2), (2, 2), 0.25, colors.black),
                        
                        ('ALIGN', (1, 0), (1, -1), 'RIGHT'),
                        ('ALIGN', (2, 0), (2, -1), 'CENTRE'), 
                        ('BACKGROUND', (2, 2), (2, 2), couleurFond),
                        
                        ('SPAN', (0, 0), (0, -1)), 
                        ]
                
                if mode == "facture" and len(listeMessages) > 0 :
                    #style.append( ('BACKGROUND', (0, 0), (0, 0), couleurFondActivite) )
                    style.append( ('FONT', (0, 0), (0, -1), "Helvetica", 8)  )
                    style.append( ('VALIGN', (0, 0), (0, -1), 'TOP') )
                    
                tableau = Table(dataTableau, largeursColonnes, rowHeights=[18, 18, None])
                tableau.setStyle(TableStyle(style))
                story.append(tableau)
                
                # ------------------------- PRELEVEMENTS --------------------
                if dictOptions.has_key("afficher_avis_prelevements") and dictValeur.has_key("prelevement") :
                    if dictValeur["prelevement"] != None and dictOptions["afficher_avis_prelevements"] == True :
                        paraStyle = ParagraphStyle(name="intro",
                              fontName="Helvetica",
                              fontSize=8,
                              leading=11,
                              spaceBefore=2,
                              spaceafter=2,
                              alignment=1,
                              backColor=couleurFondActivite,
                            )
                        story.append(Spacer(0,20))
                        story.append(Paragraph(u"<para align='center'><i>%s</i></para>" % dictValeur["prelevement"], paraStyle))
                
                # Texte conclusion
                if dictOptions["texte_conclusion"] != "" :
                    story.append(Spacer(0,20))
                    paraStyle = ParagraphStyle(name="conclusion",
                                          fontName="Helvetica",
                                          fontSize=dictOptions["taille_texte_conclusion"],
                                          leading=14,
                                          spaceBefore=0,
                                          spaceafter=0,
                                          leftIndent=5,
                                          rightIndent=5,
                                          alignment=dictOptions["alignement_texte_conclusion"],
                                          backColor=ConvertCouleurWXpourPDF(dictOptions["couleur_fond_conclusion"]),
                                          borderColor=ConvertCouleurWXpourPDF(dictOptions["couleur_bord_conclusion"]),
                                          borderWidth=0.5,
                                          borderPadding=5,
                                        )
            
                    texte = dictValeur["texte_conclusion"].replace("\\n", "<br/>")
                    if dictOptions["style_texte_conclusion"] == 0 : texte = u"<para>%s</para>" % texte
                    if dictOptions["style_texte_conclusion"] == 1 : texte = u"<para><i>%s</i></para>" % texte
                    if dictOptions["style_texte_conclusion"] == 2 : texte = u"<para><b>%s</b></para>" % texte
                    if dictOptions["style_texte_conclusion"] == 3 : texte = u"<para><i><b>%s</b></i></para>" % texte
                    story.append(Paragraph(texte, paraStyle))
                    
                # Image signature
                if dictOptions["image_signature"] != "" :
                    cheminImage = dictOptions["image_signature"]
                    if os.path.isfile(cheminImage) :
                        img = Image(cheminImage)
                        largeur, hauteur = int(img.drawWidth * 1.0 * dictOptions["taille_image_signature"] / 100.0), int(img.drawHeight * 1.0 * dictOptions["taille_image_signature"] / 100.0)
                        if largeur > CADRE_CONTENU[2] or hauteur > CADRE_CONTENU[3] :
                            raise Exception(_(u"L'image de signature est trop grande. Veuillez diminuer sa taille avec le parametre Taille."))
                        img.drawWidth, img.drawHeight = largeur, hauteur
                        if dictOptions["alignement_image_signature"] == 0 : img.hAlign = "LEFT"
                        if dictOptions["alignement_image_signature"] == 1 : img.hAlign = "CENTER"
                        if dictOptions["alignement_image_signature"] == 2 : img.hAlign = "RIGHT"
                        story.append(Spacer(0,20))
                        story.append(img)
                        


                # Saut de page
                story.append(PageBreak())

        # Finalisation du PDF
##        try :
        doc.build(story)
##        except Exception, err :
##            print "Erreur dans ouverture PDF :", err
##            if "Permission denied" in err :
##                dlg = wx.MessageDialog(None, _(u"Noethys ne peut pas créer le PDF.\n\nVeuillez vérifier qu'un autre PDF n'est pas déjà ouvert en arrière-plan..."), _(u"Erreur d'édition"), wx.OK | wx.ICON_ERROR)
##                dlg.ShowModal()
##                dlg.Destroy()
##                return
        
        # Ouverture du PDF
        if ouverture == True :
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self, dictValeurs={}, IDmodele=None, nomDoc=FonctionsPerso.GenerationNomDoc("INSCRIPTION", "pdf"), afficherDoc=True):
        """ Impression """
        global DICT_VALEURS
        DICT_VALEURS = dictValeurs
        
        # Initialisation du document
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)
        
        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc
        
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        couleurFond = (0.8, 0.8, 1)
        
        # ----------- Insertion du contenu des frames --------------
        cadre_principal = doc.modeleDoc.FindObjet("cadre_principal")
        if cadre_principal != None :
            
            if DICT_VALEURS["intro"] != None or DICT_VALEURS["tableau"] == True :
            
                # ------------------- TITRE -----------------
                dataTableau = []
                largeursColonnes = [ TAILLE_CADRE_CONTENU[2], ]
                dataTableau.append((_(u"Confirmation d'inscription"),))
                dataTableau.append((u"",))
                style = TableStyle([
                        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), 
                        ('FONT',(0,0),(0,0), "Helvetica-Bold", 19), 
                        ('FONT',(0,1),(0,1), "Helvetica", 8), 
                        ('LINEBELOW', (0,0), (0,0), 0.25, colors.black), 
                        ('ALIGN', (0,0), (-1,-1), 'LEFT'), 
                        ])
                tableau = Table(dataTableau, largeursColonnes)
                tableau.setStyle(style)
                story.append(tableau)
                story.append(Spacer(0, 10))
                
                # TEXTE D'INTRODUCTION
                paraStyleIntro = ParagraphStyle(name="intro",
                                      fontName="Helvetica",
                                      fontSize=11,
                                      leading=14,
                                      spaceBefore=0,
                                      spaceafter=0,
                                      leftIndent=0,
                                      rightIndent=0,
                                      alignment=0,
                                    )

            if DICT_VALEURS["intro"] != None :
                texteIntro = DICT_VALEURS["intro"]
                story.append(Paragraph(u"<i>%s</i>" % texteIntro, paraStyleIntro))
                story.append(Spacer(0,20))
                
            
            if DICT_VALEURS["tableau"] == True :
                
                # ------------------- TABLEAU CONTENU -----------------
                dataTableau = []
                largeursColonnes = [ 80, 280]
                paraStyle = ParagraphStyle(name="detail",
                                          fontName="Helvetica-Bold",
                                          fontSize=9,
                                        )
                dataTableau.append( (_(u"Nom"), Paragraph(DICT_VALEURS["{INDIVIDU_NOM}"], paraStyle)) )
                dataTableau.append( (_(u"Prénom"), Paragraph(DICT_VALEURS["{INDIVIDU_PRENOM}"], paraStyle)) )
                dataTableau.append( (_(u"Activité"), Paragraph(DICT_VALEURS["{ACTIVITE_NOM_LONG}"], paraStyle)) )
                dataTableau.append( (_(u"Groupe"), Paragraph(DICT_VALEURS["{GROUPE_NOM_LONG}"], paraStyle)) )
                dataTableau.append( (_(u"Catégorie"), Paragraph(DICT_VALEURS["{NOM_CATEGORIE_TARIF}"], paraStyle)) )

                
                style = TableStyle([
                        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), 
                        ('FONT', (0, 0), (0, -1), "Helvetica", 9), 
                        ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                        ('ALIGN', (0, 0), (0, -1), 'RIGHT'),
                        ])
                tableau = Table(dataTableau, largeursColonnes)
                tableau.setStyle(style)
                story.append(tableau)
        
        # Si aucune frame principale
        if len(story) == 0 :
            story.append(Spacer(0,20))
        
        # Enregistrement et ouverture du PDF
        try :
            doc.build(story)
        except Exception, err :
            print "Erreur dans ouverture PDF :", err
            if "Permission denied" in err :
                dlg = wx.MessageDialog(None, _(u"Noethys ne peut pas créer le PDF.\n\nVeuillez vérifier qu'un autre PDF n'est pas déjà ouvert en arrière-plan..."), _(u"Erreur d'édition"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
    def __init__(self,
                 dictValeurs={},
                 IDmodele=None,
                 nomDoc=FonctionsPerso.GenerationNomDoc(
                     "RECU_REGLEMENT", "pdf"),
                 afficherDoc=True):
        """ Impression """
        global DICT_VALEURS
        DICT_VALEURS = dictValeurs

        # Initialisation du document
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None:
            raise Exception(
                "Votre modele de document doit obligatoirement comporter un cadre principal. Retournez dans l'editeur de document et utilisez pour votre modele la commande 'Inserer un objet special > Inserer le cadre principal'."
            )

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        ##        # Définit le template des pages suivantes
        ##        story.append(NextPageTemplate("suivante"))

        # ----------- Insertion du contenu des frames --------------

        # ------------------- TITRE -----------------
        dataTableau = []
        largeursColonnes = [
            TAILLE_CADRE_CONTENU[2],
        ]
        dataTableau.append((_(u"Reçu de règlement"), ))
        dataTableau.append((u"", ))
        style = TableStyle([
            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
            ('FONT', (0, 0), (0, 0), "Helvetica-Bold", 19),
            ('FONT', (0, 1), (0, 1), "Helvetica", 8),
            ('LINEBELOW', (0, 0), (0, 0), 0.25, colors.black),
            ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
        ])
        tableau = Table(dataTableau, largeursColonnes)
        tableau.setStyle(style)
        story.append(tableau)
        story.append(Spacer(0, 10))

        # TEXTE D'INTRODUCTION
        paraStyleIntro = ParagraphStyle(
            name="intro",
            fontName="Helvetica",
            fontSize=11,
            leading=14,
            spaceBefore=0,
            spaceafter=0,
            leftIndent=0,
            rightIndent=0,
            alignment=0,
        )

        if DICT_VALEURS["intro"] != None:
            texteIntro = DICT_VALEURS["intro"]
            story.append(Paragraph(u"<i>%s</i>" % texteIntro, paraStyleIntro))
            story.append(Spacer(0, 20))

        couleurFond = (0.8, 0.8, 1)

        # ------------------- TABLEAU CONTENU -----------------

        dataTableau = []
        largeursColonnes = [120, 280]

        paraStyle = ParagraphStyle(
            name="detail",
            fontName="Helvetica-Bold",
            fontSize=9,
        )
        dataTableau.append((_(u"Caractéristiques du règlement"), ""))
        montantEnLettres = UTILS_Conversion.trad(DICT_VALEURS["montant"],
                                                 MONNAIE_SINGULIER,
                                                 MONNAIE_DIVISION).strip()
        dataTableau.append((_(u"Montant du règlement :"),
                            Paragraph(montantEnLettres.capitalize(),
                                      paraStyle)))
        dataTableau.append((_(u"Mode de règlement :"),
                            Paragraph(DICT_VALEURS["nomMode"], paraStyle)))
        dataTableau.append((_(u"Nom du payeur :"),
                            Paragraph(DICT_VALEURS["nomPayeur"], paraStyle)))
        if DICT_VALEURS["nomEmetteur"] != None:
            dataTableau.append((_(u"Nom de l'émetteur :"),
                                Paragraph(DICT_VALEURS["nomEmetteur"],
                                          paraStyle)))
        if DICT_VALEURS["numPiece"] not in ("", None):
            dataTableau.append((_(u"Numéro de pièce :"),
                                Paragraph(DICT_VALEURS["numPiece"],
                                          paraStyle)))

        style = TableStyle([
            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
            ('FONT', (0, 0), (0, -1), "Helvetica", 9),
            ('FONT', (1, 0), (1, -1), "Helvetica-Bold", 9),
            ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
            ('ALIGN', (0, 1), (0, -1), 'RIGHT'),
            ('ALIGN', (1, 1), (1, -1), 'LEFT'),
            ('FONT', (0, 0), (0, 0), "Helvetica", 7),
            ('SPAN', (0, 0), (-1, 0)),
            ('BACKGROUND', (0, 0), (-1, 0), couleurFond),
        ])
        tableau = Table(dataTableau, largeursColonnes)
        tableau.setStyle(style)
        story.append(tableau)

        # --------------------- LISTE DES PRESTATIONS ----------------
        listePrestations = dictValeurs["prestations"]
        if len(listePrestations) > 0:

            story.append(Spacer(0, 20))
            textePrestations = _(u"En paiement des prestations suivantes :")
            story.append(
                Paragraph(u"<i>%s</i>" % textePrestations, paraStyleIntro))
            story.append(Spacer(0, 20))

            dataTableau = [
                (_(u"Date"), _(u"Activité"), _(u"Individu"), _(u"Intitulé"),
                 _(u"Part utilisée")),
            ]
            largeursColonnes = [50, 95, 70, 135, 50]

            paraStyle = ParagraphStyle(
                name="detail",
                fontName="Helvetica",
                fontSize=7,
                leading=7,
                spaceBefore=0,
                spaceAfter=0,
            )

            for dictPrestation in listePrestations:
                date = UTILS_Dates.DateDDEnFr(dictPrestation["date"])
                activite = dictPrestation["nomActivite"]
                individu = dictPrestation["prenomIndividu"]
                label = dictPrestation["label"]
                montant = dictPrestation["montant"]
                ventilation = dictPrestation["ventilation"]

                dataTableau.append((
                    Paragraph(u"<para align='center'>%s</para>" % date,
                              paraStyle),
                    Paragraph(activite, paraStyle),
                    Paragraph(individu, paraStyle),
                    Paragraph(label, paraStyle),
                    Paragraph(
                        u"<para align='right'>%.2f %s</para>" %
                        (ventilation, SYMBOLE), paraStyle),
                ))

            style = TableStyle([
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                ('FONT', (0, 0), (-1, -1), "Helvetica", 7),
                ('TOPPADDING', (0, 1), (-1, -1), 1),
                ('BOTTOMPADDING', (0, 1), (-1, -1), 3),

                # Ligne Entetes
                ('FONT', (0, 0), (-1, 0), "Helvetica", 7),
                ('BACKGROUND', (0, 0), (-1, 0), couleurFond),
                ('ALIGN', (0, 0), (-1, 0), 'CENTER'),
            ])
            tableau = Table(dataTableau, largeursColonnes)
            tableau.setStyle(style)
            story.append(tableau)

        # Enregistrement et ouverture du PDF
        try:
            doc.build(story)
        except Exception, err:
            print "Erreur dans ouverture PDF :", err
            if "Permission denied" in err:
                dlg = wx.MessageDialog(
                    None,
                    _(u"Noethys ne peut pas créer le PDF.\n\nVeuillez vérifier qu'un autre PDF n'est pas déjà ouvert en arrière-plan..."
                      ), _(u"Erreur d'édition"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
示例#7
0
    def __init__(self, dictValeurs={}, IDmodele=None, nomDoc=FonctionsPerso.GenerationNomDoc("RECU_REGLEMENT", "pdf"), afficherDoc=True):
        """ Impression """
        global DICT_VALEURS
        DICT_VALEURS = dictValeurs
        
        # Initialisation du document
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None :
            raise Exception("Votre modele de document doit obligatoirement comporter un cadre principal. Retournez dans l'editeur de document et utilisez pour votre modele la commande 'Inserer un objet special > Inserer le cadre principal'.")

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc
        
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        
##        # Définit le template des pages suivantes
##        story.append(NextPageTemplate("suivante"))
        
        
        # ----------- Insertion du contenu des frames --------------
        
        # ------------------- TITRE -----------------
        dataTableau = []
        largeursColonnes = [ TAILLE_CADRE_CONTENU[2], ]
        dataTableau.append((_(u"Reçu de règlement"),))
        dataTableau.append((u"",))
        style = TableStyle([
                ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), 
                ('FONT',(0,0),(0,0), "Helvetica-Bold", 19), 
                ('FONT',(0,1),(0,1), "Helvetica", 8), 
                ('LINEBELOW', (0,0), (0,0), 0.25, colors.black), 
                ('ALIGN', (0,0), (-1,-1), 'LEFT'), 
                ])
        tableau = Table(dataTableau, largeursColonnes)
        tableau.setStyle(style)
        story.append(tableau)
        story.append(Spacer(0, 10))
        
        # TEXTE D'INTRODUCTION
        paraStyleIntro = ParagraphStyle(name="intro",
                              fontName="Helvetica",
                              fontSize=11,
                              leading=14,
                              spaceBefore=0,
                              spaceafter=0,
                              leftIndent=0,
                              rightIndent=0,
                              alignment=0,
                            )

        if DICT_VALEURS["intro"] != None :
            texteIntro = DICT_VALEURS["intro"]
            story.append(Paragraph(u"<i>%s</i>" % texteIntro, paraStyleIntro))
            story.append(Spacer(0,20))
            
            
        couleurFond = (0.8, 0.8, 1)
                
        # ------------------- TABLEAU CONTENU -----------------
        
        dataTableau = []
        largeursColonnes = [ 120, 280]
        
        paraStyle = ParagraphStyle(name="detail",
                                  fontName="Helvetica-Bold",
                                  fontSize=9,
                                )
        dataTableau.append( (_(u"Caractéristiques du règlement"), "") )
        montantEnLettres = UTILS_Conversion.trad(DICT_VALEURS["montant"], MONNAIE_SINGULIER, MONNAIE_DIVISION).strip() 
        dataTableau.append( (_(u"Montant du règlement :"), Paragraph(montantEnLettres.capitalize(), paraStyle) ) )
        dataTableau.append( (_(u"Mode de règlement :"), Paragraph(DICT_VALEURS["nomMode"], paraStyle) ) )
        dataTableau.append( (_(u"Nom du payeur :"), Paragraph(DICT_VALEURS["nomPayeur"], paraStyle) ) )
        if DICT_VALEURS["nomEmetteur"] != None : dataTableau.append( (_(u"Nom de l'émetteur :"), Paragraph(DICT_VALEURS["nomEmetteur"], paraStyle) ) )
        if DICT_VALEURS["numPiece"] not in ("", None) : dataTableau.append( (_(u"Numéro de pièce :"), Paragraph(DICT_VALEURS["numPiece"], paraStyle) ) )
        if DICT_VALEURS["date_differe"] not in ("", None): dataTableau.append((_(u"Encaissement différé :"), Paragraph(_(u"A partir du %s") % DICT_VALEURS["{DATE_DIFFERE}"], paraStyle)))
        
        style = TableStyle([
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), 
                ('FONT', (0, 0), (0, -1), "Helvetica", 9), 
                ('FONT', (1, 0), (1, -1), "Helvetica-Bold", 9), 
                ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                ('ALIGN', (0, 1), (0, -1), 'RIGHT'),
                ('ALIGN', (1, 1), (1, -1), 'LEFT'), 
                
                ('FONT', (0, 0), (0, 0), "Helvetica", 7), 
                ('SPAN', (0, 0), (-1, 0)), 
                ('BACKGROUND', (0, 0), (-1, 0), couleurFond),
                
                ])
        tableau = Table(dataTableau, largeursColonnes)
        tableau.setStyle(style)
        story.append(tableau)
        
        # --------------------- LISTE DES PRESTATIONS ----------------
        listePrestations = dictValeurs["prestations"]
        if len(listePrestations) > 0 :
            
            story.append(Spacer(0,20))
            textePrestations = _(u"En paiement des prestations suivantes :")
            story.append(Paragraph(u"<i>%s</i>" % textePrestations, paraStyleIntro))
            story.append(Spacer(0,20))

            dataTableau = [(_(u"Date"), _(u"Activité"), _(u"Individu"), _(u"Intitulé"), _(u"Part utilisée")),]
            largeursColonnes = [50, 95, 70, 135, 50]

            paraStyle = ParagraphStyle(name="detail",
                                      fontName="Helvetica",
                                      fontSize=7,
                                      leading=7,
                                      spaceBefore=0,
                                      spaceAfter=0,
                                      )

            for dictPrestation in listePrestations :
                date = UTILS_Dates.DateDDEnFr(dictPrestation["date"])
                activite = dictPrestation["nomActivite"]
                individu = dictPrestation["prenomIndividu"]
                label = dictPrestation["label"]
                montant = dictPrestation["montant"]
                ventilation = dictPrestation["ventilation"]
                
                dataTableau.append((
                    Paragraph(u"<para align='center'>%s</para>"% date, paraStyle), 
                    Paragraph(activite, paraStyle),  
                    Paragraph(individu, paraStyle),  
                    Paragraph(label, paraStyle), 
                    Paragraph(u"<para align='right'>%.2f %s</para>" % (ventilation, SYMBOLE), paraStyle), 
                    ))
                        
            style = TableStyle([
                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), 
                    ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                    ('FONT', (0, 0), (-1, -1), "Helvetica", 7), 

                    ('TOPPADDING', (0, 1), (-1, -1), 1), 
                    ('BOTTOMPADDING', (0, 1), (-1, -1), 3), 
        
                    # Ligne Entetes
                    ('FONT', (0, 0), (-1, 0), "Helvetica", 7), 
                    ('BACKGROUND', (0, 0), (-1, 0), couleurFond),
                    ('ALIGN', (0, 0), (-1, 0), 'CENTER'),
                    
                    ])
            tableau = Table(dataTableau, largeursColonnes)
            tableau.setStyle(style)
            story.append(tableau)

        
        # Enregistrement et ouverture du PDF
        try :
            doc.build(story)
        except Exception, err :
            print "Erreur dans ouverture PDF :", err
            if "Permission denied" in err :
                dlg = wx.MessageDialog(None, _(u"Noethys ne peut pas créer le PDF.\n\nVeuillez vérifier qu'un autre PDF n'est pas déjà ouvert en arrière-plan..."), _(u"Erreur d'édition"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
    def __init__(self,
                 dictComptes={},
                 dictOptions={},
                 IDmodele=None,
                 ouverture=True,
                 nomFichier=None):
        """ Impression """
        global DICT_COMPTES, DICT_OPTIONS
        DICT_COMPTES = dictComptes
        DICT_OPTIONS = dictOptions

        # Initialisation du document
        if nomFichier == None:
            nomDoc = FonctionsPerso.GenerationNomDoc("RAPPELS", "pdf")
        else:
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None:
            raise Exception(
                "Votre modele de document doit obligatoirement comporter un cadre principal. Retournez dans l'editeur de document et utilisez pour votre modele la commande 'Inserer un objet special > Inserer le cadre principal'."
            )

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        ##        # Définit le template des pages suivantes
        ##        story.append(NextPageTemplate("suivante"))

        # ----------- Insertion du contenu des frames --------------
        listeNomsSansCivilite = []
        for IDcompte_payeur, dictCompte in dictComptes.items():
            listeNomsSansCivilite.append(
                (dictCompte["nomSansCivilite"], IDcompte_payeur))
        listeNomsSansCivilite.sort()

        for nomSansCivilite, IDcompte_payeur in listeNomsSansCivilite:
            dictCompte = dictComptes[IDcompte_payeur]
            if dictCompte["select"] == True:

                story.append(DocAssign("IDcompte_payeur", IDcompte_payeur))
                nomSansCivilite = dictCompte["nomSansCivilite"]
                story.append(Bookmark(nomSansCivilite, str(IDcompte_payeur)))

                # ------------------- TITRE -----------------
                dataTableau = []
                largeursColonnes = [
                    TAILLE_CADRE_CONTENU[2],
                ]
                dataTableau.append((dictCompte["titre"], ))
                texteDateReference = DateEngFr(str(datetime.date.today()))
                dataTableau.append(
                    (_(u"Situation au %s") % texteDateReference, ))
                style = TableStyle([
                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                    ('FONT', (0, 0), (0, 0), "Helvetica-Bold", 19),
                    ('FONT', (0, 1), (0, 1), "Helvetica", 8),
                    ('LINEBELOW', (0, 0), (0, 0), 0.25, colors.black),
                    ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
                ])
                tableau = Table(dataTableau, largeursColonnes)
                tableau.setStyle(style)
                story.append(tableau)
                story.append(Spacer(0, 30))

                couleurFond = (0.8, 0.8, 1)
                couleurFondActivite = (0.92, 0.92, 1)

                # TEXTE CONTENU
                paraStyle = ParagraphStyle(
                    name="contenu",
                    fontName="Helvetica",
                    fontSize=11,
                    #leading=7,
                    spaceBefore=0,
                    spaceafter=0,
                    leftIndent=6,
                    rightIndent=6,
                )

                texte = dictCompte["texte"]
                listeParagraphes = texte.split("</para>")
                for paragraphe in listeParagraphes:
                    if "<para" in paragraphe:
                        paragraphe = u"%s</para>" % paragraphe
                        textePara = Paragraph(paragraphe, paraStyle)
                        story.append(textePara)
                        if "> </para" in paragraphe:
                            story.append(Spacer(0, 13))

                # Saut de page
                story.append(PageBreak())

        # Finalisation du PDF
        doc.build(story)

        # Ouverture du PDF
        if ouverture == True:
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self, dictComptes={}, dictOptions={}, IDmodele=None, ouverture=True, nomFichier=None):
        """ Impression """
        global DICT_COMPTES, DICT_OPTIONS
        DICT_COMPTES = dictComptes
        DICT_OPTIONS = dictOptions
        
        # Initialisation du document
        if nomFichier == None :
            nomDoc = FonctionsPerso.GenerationNomDoc("ATTESTATIONS_FISCALES", "pdf")
        else :
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None :
            raise Exception("Votre modele de document doit obligatoirement comporter un cadre principal. Retournez dans l'editeur de document et utilisez pour votre modele la commande 'Inserer un objet special > Inserer le cadre principal'.")

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc
        
        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        
##        # Définit le template des pages suivantes
##        story.append(NextPageTemplate("suivante"))
        
        
        # ----------- Insertion du contenu des frames --------------
        listeNomsSansCivilite = []
        for IDcompte_payeur, dictCompte in dictComptes.iteritems() :
            listeNomsSansCivilite.append((dictCompte["{FAMILLE_NOM}"], IDcompte_payeur))
        listeNomsSansCivilite.sort() 
        
        for nomSansCivilite, IDcompte_payeur in listeNomsSansCivilite :
            dictCompte = dictComptes[IDcompte_payeur]
                
            story.append(DocAssign("IDcompte_payeur", IDcompte_payeur))
            nomSansCivilite = dictCompte["{FAMILLE_NOM}"]
            story.append(Bookmark(nomSansCivilite, str(IDcompte_payeur)))
            
            # ------------------- TITRE -----------------
            dataTableau = []
            largeursColonnes = [ TAILLE_CADRE_CONTENU[2], ]
            dataTableau.append((dictOptions["titre"],))
            texteDateReference = UTILS_Dates.DateEngFr(str(datetime.date.today()))
            dataTableau.append((_(u"Période du %s au %s") % (UTILS_Dates.DateDDEnFr(dictOptions["date_debut"]), UTILS_Dates.DateDDEnFr(dictOptions["date_fin"])),))
            style = TableStyle([
                    ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), 
                    ('FONT',(0,0),(0,0), "Helvetica-Bold", 19), 
                    ('FONT',(0,1),(0,1), "Helvetica", 8), 
                    ('LINEBELOW', (0,0), (0,0), 0.25, colors.black), 
                    ('ALIGN', (0,0), (-1,-1), 'LEFT'), 
                    ])
            tableau = Table(dataTableau, largeursColonnes)
            tableau.setStyle(style)
            story.append(tableau)
            story.append(Spacer(0, 30))
            
                
            couleurFond = (0.8, 0.8, 1)
            couleurFondActivite = (0.92, 0.92, 1)
                    
            # TEXTE CONTENU
            paraStyle = ParagraphStyle(name="contenu",
                          fontName="Helvetica",
                          fontSize=11,
                          leading=16,
                          spaceBefore=0,
                          spaceafter=0,
                          leftIndent=6,
                          rightIndent=6,
                        )
            
            # INTRO
            texte = dictCompte["{INTRO}"]
            if texte != "" :
                listeParagraphes = texte.split("</para>")
                for paragraphe in listeParagraphes :
                    textePara = Paragraph(u"%s" % paragraphe, paraStyle)
                    story.append(textePara)
                
                story.append(Spacer(0, 25))
            
            # DETAIL par enfant
            dataTableau = [(_(u"Nom et prénom"), _(u"Date de naissance"), _(u"Montant")),]
            largeursColonnes = [ 220, 80, 80]
            
            paraStyle = ParagraphStyle(name="detail",
                                      fontName="Helvetica-Bold",
                                      fontSize=9,
                                    )
            
            for nomCompletIndividu, dictIndividu in dictCompte["individus"] :
                dataTableau.append( (nomCompletIndividu, dictIndividu["date_naiss"],  u"%.2f %s" % (dictIndividu["regle"], SYMBOLE)) )
            
            dataTableau.append( ("", "Total :",  dictCompte["{MONTANT_REGLE}"]) )
            
            style = TableStyle([
                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'), 
                    ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
                    ('GRID', (0, 0), (-1, -2), 0.25, colors.black),
                    ('FONT', (0, 0), (-1, 0), "Helvetica", 6), 
                    ('FONT', (0, 1), (-1, -1), "Helvetica", 10), 

                    ('TOPPADDING', (0, 1), (-1, -2), 10), 
                    ('BOTTOMPADDING', (0, 1), (-1, -2), 10), 
                    
                    ('GRID', (-1, -1), (-1, -1), 0.25, colors.black),
                    ('FONT', (-1, -1), (-1, -1), "Helvetica-Bold", 10), 
                    
                    ('ALIGN', (-2, -1), (-2, -1), 'RIGHT'),
                    ('FONT', (-2, -1), (-2, -1), "Helvetica", 6), 
                    ])
            tableau = Table(dataTableau, largeursColonnes)
            tableau.setStyle(style)
            story.append(tableau)

            # Saut de page
            story.append(PageBreak())
        
        # Finalisation du PDF
        doc.build(story)
        
        # Ouverture du PDF
        if ouverture == True :
            FonctionsPerso.LanceFichierExterne(nomDoc)
示例#10
0
    def __init__(self,
                 dictValeurs={},
                 IDmodele=None,
                 nomDoc=FonctionsPerso.GenerationNomDoc("INSCRIPTION", "pdf"),
                 afficherDoc=True):
        """ Impression """
        global DICT_VALEURS
        DICT_VALEURS = dictValeurs

        # Initialisation du document
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        couleurFond = (0.8, 0.8, 1)

        # ----------- Insertion du contenu des frames --------------
        cadre_principal = doc.modeleDoc.FindObjet("cadre_principal")
        if cadre_principal != None:

            if DICT_VALEURS["intro"] != None or DICT_VALEURS["tableau"] == True:

                # ------------------- TITRE -----------------
                dataTableau = []
                largeursColonnes = [
                    TAILLE_CADRE_CONTENU[2],
                ]
                dataTableau.append((_(u"Confirmation d'inscription"), ))
                dataTableau.append((u"", ))
                style = TableStyle([
                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                    ('FONT', (0, 0), (0, 0), "Helvetica-Bold", 19),
                    ('FONT', (0, 1), (0, 1), "Helvetica", 8),
                    ('LINEBELOW', (0, 0), (0, 0), 0.25, colors.black),
                    ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
                ])
                tableau = Table(dataTableau, largeursColonnes)
                tableau.setStyle(style)
                story.append(tableau)
                story.append(Spacer(0, 10))

                # TEXTE D'INTRODUCTION
                paraStyleIntro = ParagraphStyle(
                    name="intro",
                    fontName="Helvetica",
                    fontSize=11,
                    leading=14,
                    spaceBefore=0,
                    spaceafter=0,
                    leftIndent=0,
                    rightIndent=0,
                    alignment=0,
                )

            if DICT_VALEURS["intro"] != None:
                texteIntro = DICT_VALEURS["intro"]
                story.append(
                    Paragraph(u"<i>%s</i>" % texteIntro, paraStyleIntro))
                story.append(Spacer(0, 20))

            if DICT_VALEURS["tableau"] == True:

                # ------------------- TABLEAU CONTENU -----------------
                dataTableau = []
                largeursColonnes = [80, 280]
                paraStyle = ParagraphStyle(
                    name="detail",
                    fontName="Helvetica-Bold",
                    fontSize=9,
                )
                dataTableau.append((_(u"Nom"),
                                    Paragraph(DICT_VALEURS["{INDIVIDU_NOM}"],
                                              paraStyle)))
                dataTableau.append(
                    (_(u"Prénom"),
                     Paragraph(DICT_VALEURS["{INDIVIDU_PRENOM}"], paraStyle)))
                dataTableau.append(
                    (_(u"Activité"),
                     Paragraph(DICT_VALEURS["{ACTIVITE_NOM_LONG}"],
                               paraStyle)))
                dataTableau.append(
                    (_(u"Groupe"),
                     Paragraph(DICT_VALEURS["{GROUPE_NOM_LONG}"], paraStyle)))
                dataTableau.append(
                    (_(u"Catégorie"),
                     Paragraph(DICT_VALEURS["{NOM_CATEGORIE_TARIF}"],
                               paraStyle)))

                style = TableStyle([
                    ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                    ('FONT', (0, 0), (0, -1), "Helvetica", 9),
                    ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                    ('ALIGN', (0, 0), (0, -1), 'RIGHT'),
                ])
                tableau = Table(dataTableau, largeursColonnes)
                tableau.setStyle(style)
                story.append(tableau)

        # Si aucune frame principale
        if len(story) == 0:
            story.append(Spacer(0, 20))

        # Enregistrement et ouverture du PDF
        try:
            doc.build(story)
        except Exception, err:
            print "Erreur dans ouverture PDF :", err
            if "Permission denied" in err:
                dlg = wx.MessageDialog(
                    None,
                    _(u"Noethys ne peut pas créer le PDF.\n\nVeuillez vérifier qu'un autre PDF n'est pas déjà ouvert en arrière-plan..."
                      ), _(u"Erreur d'édition"), wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
    def __init__(self,
                 dictValeurs={},
                 dictOptions={},
                 IDmodele=None,
                 ouverture=True,
                 nomFichier=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions

        # Initialisation du document
        if nomFichier == None:
            nomDoc = FonctionsPerso.GenerationNomDoc("COTISATIONS", "pdf")
        else:
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        # ----------- Insertion du contenu des frames --------------
        listeLabels = []
        for IDcotisation, dictValeur in dictValeurs.iteritems():
            listeLabels.append((dictValeur["{FAMILLE_NOM}"], IDcotisation))
        listeLabels.sort()

        for labelDoc, IDcotisation in listeLabels:
            dictValeur = dictValeurs[IDcotisation]
            if dictValeur["select"] == True:

                story.append(DocAssign("IDcotisation", IDcotisation))
                nomSansCivilite = dictValeur["{FAMILLE_NOM}"]
                story.append(Bookmark(nomSansCivilite, str(IDcotisation)))

                ##                # ------------------- TITRE -----------------
                ##                dataTableau = []
                ##                largeursColonnes = [ TAILLE_CADRE_CONTENU[2], ]
                ##                dataTableau.append((dictCompte["titre"],))
                ##                texteDateReference = UTILS_Dates.DateEngFr(str(datetime.date.today()))
                ##                dataTableau.append((_(u"Situation au %s") % texteDateReference,))
                ##                style = TableStyle([
                ##                        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
                ##                        ('FONT',(0,0),(0,0), "Helvetica-Bold", 19),
                ##                        ('FONT',(0,1),(0,1), "Helvetica", 8),
                ##                        ('LINEBELOW', (0,0), (0,0), 0.25, colors.black),
                ##                        ('ALIGN', (0,0), (-1,-1), 'LEFT'),
                ##                        ])
                ##                tableau = Table(dataTableau, largeursColonnes)
                ##                tableau.setStyle(style)
                ##                story.append(tableau)
                ##                story.append(Spacer(0,30))
                ##
                ##
                ##                couleurFond = (0.8, 0.8, 1)
                ##                couleurFondActivite = (0.92, 0.92, 1)
                ##
                ##                # TEXTE CONTENU
                ##                paraStyle = ParagraphStyle(name="contenu",
                ##                              fontName="Helvetica",
                ##                              fontSize=11,
                ##                              #leading=7,
                ##                              spaceBefore=0,
                ##                              spaceafter=0,
                ##                              leftIndent=6,
                ##                              rightIndent=6,
                ##                            )
                ##
                ##                texte = dictCompte["texte"]
                ##                listeParagraphes = texte.split("</para>")
                ##                for paragraphe in listeParagraphes :
                ##                    textePara = Paragraph(u"%s</para>" % paragraphe, paraStyle)
                ##                    story.append(textePara)

                # Saut de page
                story.append(PageBreak())

        # Finalisation du PDF
        doc.build(story)

        # Ouverture du PDF
        if ouverture == True:
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self, dictComptes={}, dictOptions={}, IDmodele=None, ouverture=True, nomFichier=None):
        """ Impression """
        global DICT_COMPTES, DICT_OPTIONS
        DICT_COMPTES = dictComptes
        DICT_OPTIONS = dictOptions
        
        # Initialisation du document
        if nomFichier == None :
            nomDoc = "Temp/RAPPELS%s.pdf" % FonctionsPerso.GenerationIDdoc() 
        else :
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)
        
        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None :
            raise Exception("Votre modèle de document doit obligatoirement comporter un cadre principal. Retournez dans l'éditeur de document et utilisez pour votre modèle la commande 'Insérer un objet spécial > Insérer le cadre principal'.")

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        
##        # Définit le template des pages suivantes
##        story.append(NextPageTemplate("suivante"))
        
        
        # ----------- Insertion du contenu des frames --------------
        listeNomsSansCivilite = []
        for IDcompte_payeur, dictCompte in dictComptes.iteritems() :
            listeNomsSansCivilite.append((dictCompte["nomSansCivilite"], IDcompte_payeur))
        listeNomsSansCivilite.sort() 
        
        for nomSansCivilite, IDcompte_payeur in listeNomsSansCivilite :
            dictCompte = dictComptes[IDcompte_payeur]
            if dictCompte["select"] == True :
                
                story.append(DocAssign("IDcompte_payeur", IDcompte_payeur))
                nomSansCivilite = dictCompte["nomSansCivilite"]
                story.append(Bookmark(nomSansCivilite, str(IDcompte_payeur)))
                
                # ------------------- TITRE -----------------
                dataTableau = []
                largeursColonnes = [ TAILLE_CADRE_CONTENU[2], ]
                dataTableau.append((dictCompte["titre"],))
                texteDateReference = DateEngFr(str(datetime.date.today()))
                dataTableau.append((_(u"Situation au %s") % texteDateReference,))
                style = TableStyle([
                        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), 
                        ('FONT',(0,0),(0,0), "Helvetica-Bold", 19), 
                        ('FONT',(0,1),(0,1), "Helvetica", 8), 
                        ('LINEBELOW', (0,0), (0,0), 0.25, colors.black), 
                        ('ALIGN', (0,0), (-1,-1), 'LEFT'), 
                        ])
                tableau = Table(dataTableau, largeursColonnes)
                tableau.setStyle(style)
                story.append(tableau)
                story.append(Spacer(0,30))
                
                couleurFond = (0.8, 0.8, 1)
                couleurFondActivite = (0.92, 0.92, 1)
                        
                # TEXTE CONTENU
                paraStyle = ParagraphStyle(name="contenu",
                              fontName="Helvetica",
                              fontSize=11,
                              #leading=7,
                              spaceBefore=0,
                              spaceafter=0,
                              leftIndent=6,
                              rightIndent=6,
                            )
                
                texte = dictCompte["texte"]
                listeParagraphes = texte.split("</para>")
                for paragraphe in listeParagraphes :
                    paragraphe = u"%s</para>" % paragraphe
                    textePara = Paragraph(paragraphe, paraStyle)
                    story.append(textePara)
                    if "> </para" in paragraphe :
                        story.append(Spacer(0, 13))
                
                # Saut de page
                story.append(PageBreak())
        
        # Finalisation du PDF
        doc.build(story)
        
        # Ouverture du PDF
        if ouverture == True :
            FonctionsPerso.LanceFichierExterne(nomDoc)
示例#13
0
    def __init__(self,
                 dictComptes={},
                 dictOptions={},
                 IDmodele=None,
                 ouverture=True,
                 nomFichier=None):
        """ Impression """
        global DICT_COMPTES, DICT_OPTIONS
        DICT_COMPTES = dictComptes
        DICT_OPTIONS = dictOptions

        # Initialisation du document
        if nomFichier == None:
            nomDoc = FonctionsPerso.GenerationNomDoc("ATTESTATIONS_FISCALES",
                                                     "pdf")
        else:
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Vérifie qu'un cadre principal existe bien dans le document
        if doc.modeleDoc.FindObjet("cadre_principal") == None:
            raise Exception(
                "Votre modele de document doit obligatoirement comporter un cadre principal. Retournez dans l'editeur de document et utilisez pour votre modele la commande 'Inserer un objet special > Inserer le cadre principal'."
            )

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        ##        # Définit le template des pages suivantes
        ##        story.append(NextPageTemplate("suivante"))

        # ----------- Insertion du contenu des frames --------------
        listeNomsSansCivilite = []
        for IDcompte_payeur, dictCompte in dictComptes.items():
            listeNomsSansCivilite.append(
                (dictCompte["{FAMILLE_NOM}"], IDcompte_payeur))
        listeNomsSansCivilite.sort()

        for nomSansCivilite, IDcompte_payeur in listeNomsSansCivilite:
            dictCompte = dictComptes[IDcompte_payeur]

            story.append(DocAssign("IDcompte_payeur", IDcompte_payeur))
            nomSansCivilite = dictCompte["{FAMILLE_NOM}"]
            story.append(Bookmark(nomSansCivilite, str(IDcompte_payeur)))

            # ------------------- TITRE -----------------
            dataTableau = []
            largeursColonnes = [
                TAILLE_CADRE_CONTENU[2],
            ]
            dataTableau.append((dictOptions["titre"], ))
            texteDateReference = UTILS_Dates.DateEngFr(
                str(datetime.date.today()))
            dataTableau.append(
                (_(u"Période du %s au %s") %
                 (UTILS_Dates.DateDDEnFr(dictOptions["date_debut"]),
                  UTILS_Dates.DateDDEnFr(dictOptions["date_fin"])), ))
            style = TableStyle([
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                ('FONT', (0, 0), (0, 0), "Helvetica-Bold", 19),
                ('FONT', (0, 1), (0, 1), "Helvetica", 8),
                ('LINEBELOW', (0, 0), (0, 0), 0.25, colors.black),
                ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
            ])
            tableau = Table(dataTableau, largeursColonnes)
            tableau.setStyle(style)
            story.append(tableau)
            story.append(Spacer(0, 30))

            couleurFond = (0.8, 0.8, 1)
            couleurFondActivite = (0.92, 0.92, 1)

            # TEXTE CONTENU
            paraStyle = ParagraphStyle(
                name="contenu",
                fontName="Helvetica",
                fontSize=11,
                leading=16,
                spaceBefore=0,
                spaceafter=0,
                leftIndent=6,
                rightIndent=6,
            )

            # INTRO
            texte = dictCompte["{INTRO}"]
            if texte != "":
                listeParagraphes = texte.split("</para>")
                for paragraphe in listeParagraphes:
                    textePara = Paragraph(u"%s" % paragraphe, paraStyle)
                    story.append(textePara)

                story.append(Spacer(0, 25))

            # DETAIL par enfant
            dataTableau = [
                (_(u"Nom et prénom"), _(u"Date de naissance"), _(u"Montant")),
            ]
            largeursColonnes = [220, 80, 80]

            paraStyle = ParagraphStyle(
                name="detail",
                fontName="Helvetica-Bold",
                fontSize=9,
            )

            for nomCompletIndividu, dictIndividu in dictCompte["individus"]:
                dataTableau.append(
                    (nomCompletIndividu, dictIndividu["date_naiss"],
                     u"%.2f %s" % (dictIndividu["regle"], SYMBOLE)))

            dataTableau.append(("", "Total :", dictCompte["{MONTANT_REGLE}"]))

            style = TableStyle([
                ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
                ('GRID', (0, 0), (-1, -2), 0.25, colors.black),
                ('FONT', (0, 0), (-1, 0), "Helvetica", 6),
                ('FONT', (0, 1), (-1, -1), "Helvetica", 10),
                ('TOPPADDING', (0, 1), (-1, -2), 10),
                ('BOTTOMPADDING', (0, 1), (-1, -2), 10),
                ('GRID', (-1, -1), (-1, -1), 0.25, colors.black),
                ('FONT', (-1, -1), (-1, -1), "Helvetica-Bold", 10),
                ('ALIGN', (-2, -1), (-2, -1), 'RIGHT'),
                ('FONT', (-2, -1), (-2, -1), "Helvetica", 6),
            ])
            tableau = Table(dataTableau, largeursColonnes)
            tableau.setStyle(style)
            story.append(tableau)

            # Saut de page
            story.append(PageBreak())

        # Finalisation du PDF
        doc.build(story)

        # Ouverture du PDF
        if ouverture == True:
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self, dictValeurs={}, dictOptions={}, IDmodele=None, ouverture=True, nomFichier=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions
        
        # Initialisation du document
        if nomFichier == None :
            nomDoc = FonctionsPerso.GenerationNomDoc("COTISATIONS", "pdf")
        else :
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)
        
        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc
        
        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))
        
        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText'] 
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12
        
        # ----------- Insertion du contenu des frames --------------
        listeLabels = []
        for IDcotisation, dictValeur in dictValeurs.iteritems() :
            listeLabels.append((dictValeur["{FAMILLE_NOM}"], IDcotisation))
        listeLabels.sort() 
        
        for labelDoc, IDcotisation in listeLabels :
            dictValeur = dictValeurs[IDcotisation]
            if dictValeur["select"] == True :
                
                story.append(DocAssign("IDcotisation", IDcotisation))
                nomSansCivilite = dictValeur["{FAMILLE_NOM}"]
                story.append(Bookmark(nomSansCivilite, str(IDcotisation)))
                
##                # ------------------- TITRE -----------------
##                dataTableau = []
##                largeursColonnes = [ TAILLE_CADRE_CONTENU[2], ]
##                dataTableau.append((dictCompte["titre"],))
##                texteDateReference = UTILS_Dates.DateEngFr(str(datetime.date.today()))
##                dataTableau.append((_(u"Situation au %s") % texteDateReference,))
##                style = TableStyle([
##                        ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), 
##                        ('FONT',(0,0),(0,0), "Helvetica-Bold", 19), 
##                        ('FONT',(0,1),(0,1), "Helvetica", 8), 
##                        ('LINEBELOW', (0,0), (0,0), 0.25, colors.black), 
##                        ('ALIGN', (0,0), (-1,-1), 'LEFT'), 
##                        ])
##                tableau = Table(dataTableau, largeursColonnes)
##                tableau.setStyle(style)
##                story.append(tableau)
##                story.append(Spacer(0,30))
##                
##                    
##                couleurFond = (0.8, 0.8, 1)
##                couleurFondActivite = (0.92, 0.92, 1)
##                        
##                # TEXTE CONTENU
##                paraStyle = ParagraphStyle(name="contenu",
##                              fontName="Helvetica",
##                              fontSize=11,
##                              #leading=7,
##                              spaceBefore=0,
##                              spaceafter=0,
##                              leftIndent=6,
##                              rightIndent=6,
##                            )
##                
##                texte = dictCompte["texte"]
##                listeParagraphes = texte.split("</para>")
##                for paragraphe in listeParagraphes :
##                    textePara = Paragraph(u"%s</para>" % paragraphe, paraStyle)
##                    story.append(textePara)
                
                # Saut de page
                story.append(PageBreak())
        
        # Finalisation du PDF
        doc.build(story)
        
        # Ouverture du PDF
        if ouverture == True :
            FonctionsPerso.LanceFichierExterne(nomDoc)
    def __init__(self, dictValeurs={}, dictOptions={}, IDmodele=None, ouverture=True, nomFichier=None):
        """ Impression """
        global DICT_VALEURS, DICT_OPTIONS
        DICT_VALEURS = dictValeurs
        DICT_OPTIONS = dictOptions

        # Initialisation du document
        if nomFichier == None:
            nomDoc = FonctionsPerso.GenerationNomDoc("INSCRIPTIONS", "pdf")
        else:
            nomDoc = nomFichier
        doc = BaseDocTemplate(nomDoc, pagesize=TAILLE_PAGE, showBoundary=False)

        # Mémorise le ID du modèle
        modeleDoc = DLG_Noedoc.ModeleDoc(IDmodele=IDmodele)
        doc.modeleDoc = modeleDoc

        # Importe le template de la première page
        doc.addPageTemplates(MyPageTemplate(pageSize=TAILLE_PAGE, doc=doc))

        story = []
        styleSheet = getSampleStyleSheet()
        h3 = styleSheet['Heading3']
        styleTexte = styleSheet['BodyText']
        styleTexte.fontName = "Helvetica"
        styleTexte.fontSize = 9
        styleTexte.borderPadding = 9
        styleTexte.leading = 12

        # ----------- Insertion du contenu des frames --------------
        listeLabels = []
        for IDinscription, dictValeur in dictValeurs.iteritems():
            listeLabels.append((dictValeur["{FAMILLE_NOM}"], IDinscription))
        listeLabels.sort()

        for labelDoc, IDinscription in listeLabels:
            dictValeur = dictValeurs[IDinscription]
            if dictValeur["select"] == True:
                story.append(DocAssign("IDinscription", IDinscription))
                nomSansCivilite = dictValeur["{FAMILLE_NOM}"]
                story.append(Bookmark(nomSansCivilite, str(IDinscription)))

                # ----------- Insertion du cadre principal --------------
                cadre_principal = doc.modeleDoc.FindObjet("cadre_principal")
                if cadre_principal != None:

                    if DICT_OPTIONS.has_key("intro") and DICT_OPTIONS["intro"] != None or DICT_OPTIONS.has_key("tableau" ) and DICT_VALEURS["tableau"] == True:
                        # ------------------- TITRE -----------------
                        dataTableau = []
                        largeursColonnes = [TAILLE_CADRE_CONTENU[2], ]
                        dataTableau.append((_(u"Confirmation d'inscription"),))
                        dataTableau.append((u"",))
                        style = TableStyle([
                            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                            ('FONT', (0, 0), (0, 0), "Helvetica-Bold", 19),
                            ('FONT', (0, 1), (0, 1), "Helvetica", 8),
                            ('LINEBELOW', (0, 0), (0, 0), 0.25, colors.black),
                            ('ALIGN', (0, 0), (-1, -1), 'LEFT'),
                        ])
                        tableau = Table(dataTableau, largeursColonnes)
                        tableau.setStyle(style)
                        story.append(tableau)
                        story.append(Spacer(0, 10))

                        # TEXTE D'INTRODUCTION
                        paraStyleIntro = ParagraphStyle(name="intro",
                                                        fontName="Helvetica",
                                                        fontSize=11,
                                                        leading=14,
                                                        spaceBefore=0,
                                                        spaceafter=0,
                                                        leftIndent=0,
                                                        rightIndent=0,
                                                        alignment=0,
                                                        )

                    if DICT_OPTIONS.has_key("intro") and DICT_OPTIONS["intro"] != None:
                        texteIntro = DICT_VALEURS["intro"]
                        story.append(Paragraph(u"<i>%s</i>" % texteIntro, paraStyleIntro))
                        story.append(Spacer(0, 20))

                    if DICT_OPTIONS.has_key("tableau") and DICT_OPTIONS["tableau"] == True:
                        # ------------------- TABLEAU CONTENU -----------------
                        dataTableau = []
                        largeursColonnes = [80, 280]
                        paraStyle = ParagraphStyle(name="detail",
                                                   fontName="Helvetica-Bold",
                                                   fontSize=9,
                                                   )
                        dataTableau.append((_(u"Nom"), Paragraph(DICT_VALEURS["{INDIVIDU_NOM}"], paraStyle)))
                        dataTableau.append((_(u"Prénom"), Paragraph(DICT_VALEURS["{INDIVIDU_PRENOM}"], paraStyle)))
                        dataTableau.append((_(u"Activité"), Paragraph(DICT_VALEURS["{ACTIVITE_NOM_LONG}"], paraStyle)))
                        dataTableau.append((_(u"Groupe"), Paragraph(DICT_VALEURS["{GROUPE_NOM_LONG}"], paraStyle)))
                        dataTableau.append((_(u"Catégorie"), Paragraph(DICT_VALEURS["{NOM_CATEGORIE_TARIF}"], paraStyle)))

                        style = TableStyle([
                            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
                            ('FONT', (0, 0), (0, -1), "Helvetica", 9),
                            ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                            ('ALIGN', (0, 0), (0, -1), 'RIGHT'),
                        ])
                        tableau = Table(dataTableau, largeursColonnes)
                        tableau.setStyle(style)
                        story.append(tableau)

                # Saut de page
                story.append(PageBreak())

        # Finalisation du PDF
        doc.build(story)

        # Ouverture du PDF
        if ouverture == True:
            FonctionsPerso.LanceFichierExterne(nomDoc)