Adaptation PDF indemnisation

This commit is contained in:
Claude Paroz 2022-08-24 14:57:31 +02:00
parent 9fe46d2174
commit 92036f13c9
8 changed files with 38 additions and 19 deletions

View file

@ -245,6 +245,7 @@ class CorpContactAdmin(admin.ModelAdmin):
fields = (('civility', 'last_name', 'first_name'),
('street', 'pcode', 'city'),
('birth_date', 'nation'),
('etat_civil', 'etat_depuis'),
('permis_sejour', 'date_validite'),
('corporation',),
('sections', 'is_main', 'always_cc', 'archived'),

View file

@ -0,0 +1,21 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stages', '0035_contact_permis_sejour'),
]
operations = [
migrations.AddField(
model_name='corpcontact',
name='etat_civil',
field=models.CharField(blank=True, max_length=20, verbose_name='État-civil'),
),
migrations.AddField(
model_name='corpcontact',
name='etat_depuis',
field=models.DateField(blank=True, null=True, verbose_name='Depuis le'),
),
]

View file

@ -485,6 +485,8 @@ class CorpContact(models.Model):
last_name = models.CharField(max_length=40, verbose_name='Nom')
birth_date = models.DateField(blank=True, null=True, verbose_name='Date de naissance')
nation = models.CharField("Nationalité", max_length=40, blank=True)
etat_civil = models.CharField("État-civil", max_length=20, blank=True)
etat_depuis = models.DateField("Depuis le", blank=True, null=True)
role = models.CharField(max_length=40, blank=True, verbose_name='Fonction')
street = models.CharField(max_length=100, blank=True, verbose_name='Rue')
pcode = models.CharField(max_length=4, blank=True, verbose_name='Code postal')

View file

@ -29,9 +29,7 @@ style_smallx = PS(name='CORPS', fontName="Helvetica-BoldOblique", fontSize=6, al
LOGO_EPC = find('img/logo_EPC.png')
LOGO_ESNE = find('img/logo_ESNE.png')
LOGO_EPC_LONG = find('img/header.gif')
LOGO_CIFOM = find('img/logo_CIFOM.png')
LOGO_CPLN = find('img/logo_CPLN.jpg')
LOGO_CPMB = find('img/logo_CPMB.png')
LOGO_CPNE = find('img/logo_CPNE.jpg')
class HorLine(Flowable):
@ -55,10 +53,10 @@ class EpcBaseDocTemplate(SimpleDocTemplate):
super().__init__(
filelike,
pagesize=A4,
lefMargin=2.5 * cm, bottomMargin=1 * cm, topMargin=1 * cm, rightMargin=2.5 * cm
lefMargin=2.5 * cm, bottomMargin=1 * cm, topMargin=0 * cm, rightMargin=2.5 * cm
)
self.page_frame = Frame(
self.leftMargin, self.bottomMargin, self.width - 2.5, self.height - 3 * cm,
self.leftMargin, self.bottomMargin, self.width - 2.5, self.height - 2.15 * cm,
id='first_table', showBoundary=0, leftPadding=0 * cm
)
self.story = []
@ -80,18 +78,12 @@ class EpcBaseDocTemplate(SimpleDocTemplate):
footer.drawOn(canvas, doc.leftMargin, h)
canvas.restoreState()
def header_cifom(self, canvas, doc):
def header_cpne(self, canvas, doc):
canvas.saveState()
top = doc.height - 1.5 * cm
logo_height = 1.5 * cm
canvas.drawImage(
LOGO_CIFOM, doc.leftMargin, top, 1.7 * cm, logo_height, preserveAspectRatio=True
)
canvas.drawImage(
LOGO_CPLN, doc.leftMargin + 2.4 * cm, top, 1.5 * cm, logo_height, preserveAspectRatio=True
)
canvas.drawImage(
LOGO_CPMB, doc.leftMargin + 4.6 * cm, top, 3.6 * cm, logo_height, preserveAspectRatio=True
LOGO_CPNE, doc.leftMargin, top, 7.5 * cm, logo_height, preserveAspectRatio=True
)
canvas.restoreState()
@ -301,7 +293,7 @@ class CompensationForm:
self.story.append(Spacer(0, 0.2 * cm))
quest_url = 'https://edus2.rpn.ch/DocumentsRHPersonnelEcolesPro/Formulaire%20imp%C3%B4t%20%C3%A0%20la%20source%202021.pdf'
data = [
[self.formating('CENTRE/ECOLE :', style=style_normal), 'École Santé-social Pierre-Coullery', '', ''],
[self.formating('LE :', style=style_normal), 'École Santé-social Pierre-Coullery', '', ''],
[Paragraph('<u>COORDONNÉES PERSONNELLES </u>:', style=style_bold_italic), '', '', ''],
[self.formating('Nom : '), person.last_name or self.points, self.formating('N° de téléphone :'), person.tel or ''],
[self.formating('Prénom :'), person.first_name or self.points, self.formating('N° AVS :'), person.avs or ''],
@ -312,7 +304,8 @@ class CompensationForm:
[
self.formating('Date de naissance :'),
django_format(person.birth_date, 'j F Y') if person.birth_date else '',
self.formating('État civil :'), self.formating('Depuis le :'),
self.formating(f'État civil : {person.etat_civil or ""}'),
self.formating(f'Depuis le : %s' % django_format(person.etat_depuis, 'j F Y') if person.etat_depuis else ''),
],
[
self.formating('Nationalité :'), person.nation or '',
@ -328,8 +321,8 @@ class CompensationForm:
style=style_bold_italic), '', '', ''],
[Paragraph('<u>COORDONNÉES DE PAIEMENT</u> :', style=style_bold_italic), '', '', ''],
[Paragraph('N° de ccp ou compte bancaire (IBAN) :', style_normal), person.iban or '', '', ''],
[Paragraph('Si banque, nom et adresse de celle-ci :', style_normal), person.bank or '', '', ''],
[Paragraph('N° de ccp ou compte bancaire (IBAN) :', style_normal), '', person.iban or ''],
[Paragraph('Si banque, nom et adresse de celle-ci :', style_normal), '', person.bank or ''],
]
t = Table(data, colWidths=[3.5 * cm, 4 * cm, 3 * cm, 5.5 * cm], hAlign=TA_LEFT)
@ -347,6 +340,8 @@ class CompensationForm:
('SPAN', (0, 11), (-1, 11)), # infos permis
('SPAN', (0, 12), (-1, 12)), # coord paiement
('TOPPADDING', (0, 12), (-1, 12), 14), # coord paiement
('SPAN', (0, 13), (1, 13)), # ccp/IBAN
('SPAN', (0, 14), (1, 14)), # banque
]))
self.story.append(t)
self.story.append(Spacer(0, 0.5 * cm))
@ -426,7 +421,7 @@ class ExpertEdeLetterPdf(CompensationForm, EpcBaseDocTemplate):
super().__init__(out)
self.addPageTemplates([
PageTemplate(id='FirstPage', frames=[self.page_frame], onPage=self.header),
PageTemplate(id='ISOPage', frames=[self.page_frame], onPage=self.header_cifom),
PageTemplate(id='ISOPage', frames=[self.page_frame], onPage=self.header_cpne),
])
def exam_data(self):
@ -527,7 +522,7 @@ class CompensationPDFForm(CompensationForm, EpcBaseDocTemplate):
def __init__(self, out, *args, **kwargs):
super().__init__(out, *args, **kwargs)
self.addPageTemplates([
PageTemplate(id='FirstPage', frames=[self.page_frame], onPage=self.header_cifom)
PageTemplate(id='FirstPage', frames=[self.page_frame], onPage=self.header_cpne)
])
def produce(self):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB