Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change BVR to QR bills #41

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ Deployment scripts using fabric are located in the `Deployment` folder.
10. Create the database tables managed by south with `python manage.py migrate`
11. Run the development server with `python manage.py runserver`
12. Go to `http://localhost:8000/` and log in with Tequila
13. Give your user superuser rights with `echo "update users_truffeuser set is_superuser=1 where id=1;" | sqlite3 db.sqlite3`
13. Give your user superuser rights with `echo "update users_truffeuser set is_superuser=1 where id=1;" | sqlite3 db.sqlite3`

## Software dependencies
* librsvg2-bin

Large diffs are not rendered by default.

Large diffs are not rendered by default.

222 changes: 62 additions & 160 deletions truffe2/accounting_tools/models.py

Large diffs are not rendered by default.

561 changes: 561 additions & 0 deletions truffe2/accounting_tools/qrbill.py

Large diffs are not rendered by default.

270 changes: 176 additions & 94 deletions truffe2/accounting_tools/templates/accounting_tools/invoice/pdf.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,36 @@
{% block bonus_css_pdf %}
@page {
size: a4 portrait;
margin: 1cm;
margin-bottom: 2cm;
margin-top: 5cm;
@frame {
margin-left: 1cm;
margin-right: 1cm;
margin-bottom: 2cm;
margin-top: 5cm;
}

@frame footer {
-pdf-frame-content: footerContent;
bottom: 0cm;
@frame logoFrame {
-pdf-frame-content: logoFrameContent;
top: 1.0cm;
right: 1.2cm;
width: 35%;
}

@frame headerFrame {
-pdf-frame-content: headerFrameContent;
top: 1.1cm;
left: 1.2cm;
width: 50%;
}

}

@page qr {
size: a4 portrait;
@frame {
margin-left: 1cm;
margin-right: 1cm;
height: 1cm;
margin-bottom: 107.5mm;
margin-top: 5cm;
}

@frame logoFrame {
Expand All @@ -29,6 +49,23 @@
left: 1.2cm;
width: 50%;
}

@frame qr {
-pdf-frame-content: qr;
bottom: 0cm;
left: 0cm;
width: 100%;
height: 105.5mm;
}

@frame qr_comments {
-pdf-frame-content: qr_comments;
margin-left: 1cm;
margin-right: 1cm;
margin-bottom: 115.5mm;
margin-top: 5cm;
}

}

.maintable .tr-a {
Expand Down Expand Up @@ -69,6 +106,16 @@
body {
font-size: 12px;
}

#qr img {
zoom: 150%;
}

.pay_title
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est pas très consistant avec le reste (aka met le { sur la ligne d'en dessus)

-pdf-keep-with-next: true;
font-size: 120%;
}
{% endblock %}

{% block content %}
Expand All @@ -83,68 +130,80 @@
</tr>
<tr>
<td><b>G</b>énérale des</td>
<td>Fax :</td>
<td>+41 21 693 2097</td>
<td>Email :</td>
<td>[email protected]</td>
</tr>
<tr>
<td><b>E</b>tudiants de l’école</td>
<td>Email :</td>
<td>agepoly@epfl.ch</td>
<td>Web :</td>
<td>agepoly.ch</td>
</tr>
<tr>
<td><b>Poly</b>technique Fédérale</td>
<td>Web :</td>
<td>http://agepoly.epfl.ch</td>
<td>IBAN :</td>
<td>CH19&nbsp;0483&nbsp;5028&nbsp;7897&nbsp;7100&nbsp;0</td>
</tr>
<tr>
<td>de Lausanne</td>
<td>Banque :</td>
<td>Credit Suisse - Zürich</td>
<td>TVA :</td>
<td>CHE-113.397.612</td>
</tr>
<tr>
<td>CASE POSTALE 16</td>
<td>Compte :</td>
<td>0425-287897-71</td>
<td></td>
<td>Addr : </td>
<td>Case Postale 16</td>
</tr>
<tr>
<td>CH - 1015 LAUSANNE EPFL</td>
<td>TVA :</td>
<td>CHE-113.397.612</td>
<td></td>
<td></td>
<td>CH-1015 LAUSANNE EPFL</td>
</tr>
</table>
</div>

<div id="logoFrameContent">
<img src="{{MEDIA_ROOT}}img/logo_factures.png" style="text-align: right;" width="260">
<div style="font-size: 170%; text-align:right; white-space: nowrap; overflow: hidden; text-overflow: clip; ">
<b>{% if invoice.costcenter.unit.pk != 1 %}{{ invoice.costcenter.unit }}&nbsp;{% endif %}</b>
</div>
</div>

<div style="margin-left: 12cm; font-size: 140%;">

{% if invoice.add_to %}
<small>{% trans "À l'attention de" %}</small><br />
{% endif %}
{{invoice.address|linebreaksbr}}

{% if invoice.date_and_place %}
{% if invoice.address %}<br /><br />{% endif %}

{{invoice.date_and_place}}
{% endif %}
</div>
<table width="100%">
<tr>
<td width="12cm">
</td>
<td style="vertical-align: top;">
<div style="font-size: 130%;"">
{% if invoice.add_to %}
<small>{% trans "À l'attention de" %}</small><br />
{% endif %}

{{ invoice.client_name }}
<br />
{{invoice.multiline_address|linebreaksbr}}
<br />
<br />
{% if invoice.date_and_place %}
{{invoice.date_and_place}}
{% endif %}
</div>
</td>
</tr>
</table>

<h3 style="text-align: center; font-size: 20px;">{% trans "Facture" %}<br />{% trans "N°" %} <b>{{invoice.get_reference}}</b></h3>
<h3 style="text-align: center; font-size: 18px;">{% trans "Facture" %} {% trans "N°" %}<b>{{invoice.get_reference}}</b></h3>

<div style="text-align: left;">
{{invoice.preface|linebreaksbr}}
</div>

<table class="liste-c maintable">
<tr class="tr-a noright">
<td width="51%" class="noright">&nbsp;&nbsp;{% trans "Description" %}</td>
<td width="50%" class="noright">&nbsp;&nbsp;{% trans "Description" %}</td>
<td width="15%">{% trans "Prix unitaire" %}</td>
<td width="8%">{% trans "% TVA" %}</td>
<td width="15%">{% trans "TVA" %}</td>
<td width="15%">{% trans "Total" %}</td>
<td width="16%">{% trans "Total" %}</td>
</tr>
{% for line in invoice.get_lines %}
<tr>
Expand Down Expand Up @@ -174,73 +233,59 @@ <h3 style="text-align: center; font-size: 20px;">{% trans "Facture" %}<br />{% t

{% if invoice.ending %}
{{invoice.ending}}
<br /><br />
<br />
{% endif %}

{% if invoice.display_bvr %}
{% if invoice.display_qr %}
<p style="-pdf-keep-with-next: true;">
{% if invoice.delay > 0 %}
{% blocktrans with d=invoice.delay %}
Nous vous remercions de bien vouloir payer ce montant à {{d}} jours sur le compte de l'AGEPoly au moyen de bulletin de versement annexé.
{% endblocktrans %}
{% blocktrans with d=invoice.delay %}Nous vous remercions de bien vouloir payer ce montant à {{d}} jours avec les informations de paiement à la page suivante.{% endblocktrans %}
{% else %}
{% trans "Nous vous remercions de bien vouloir payer ce montant sur le compte de l'AGEPoly au moyen de bulletin de versement annexé." %}
{% trans "Nous vous remercions de bien vouloir payer ce montant avec les informations de paiement à la page suivante." %}
{% endif %}
<br /><br />
</p>
<br />

{% endif %}

{% if invoice.display_account %}
{% if invoice.display_bvr %}
{% trans "Vous pouvez aussi effectuer le paiement sur le compte suivant :" %}<br />
{% else %}

{% if not invoice.display_qr %}
<p style="-pdf-keep-with-next: true;">
{% if invoice.delay > 0 %}
{% blocktrans with d=invoice.delay %}
Nous vous remercions de bien vouloir payer ce montant à {{d}} jours sur le compte suivant :
{% endblocktrans %}
{% blocktrans with d=invoice.delay %}Nous vous remercions de bien vouloir payer ce montant à {{d}} jours sur le compte suivant :{% endblocktrans %}
{% else %}
{% trans "Nous vous remercions de bien vouloir payer ce montant sur le compte suivant :" %}
{% endif %}
{% endif %}
</p>

<br />
<br style="-pdf-keep-with-next: true;"/>

<table style="margin-left: 5.5cm;" width="50%">
<tr>
<td width="50%">{% trans "Banque" %}&nbsp;:</td>
<td>Credit&nbsp;Suisse&nbsp;-&nbsp;Zürich</td>
</tr>
<tr>
<td>CCP&nbsp;:</td>
<td>80&nbsp;500&nbsp;4</td>
</tr>
<tr>
<td>{% trans "Compte" %}&nbsp;:</td>
<td>No.&nbsp;0425-287897-71</td>
</tr>
<table width="100%" style="-pdf-keep-with-next: false;">
<tr>
<td>Clearing&nbsp;:</td>
<td>4835</td>
<td width="30%"></td>
<td width="30%">{% trans "Banque" %}&nbsp;:</td>
<td width="40%">Credit&nbsp;Suisse&nbsp;-&nbsp;Zürich</td>
</tr>
<tr>
<td></td>
<td>IBAN&nbsp;:</td>
<td>CH19&nbsp;0483&nbsp;5028&nbsp;7897&nbsp;7100&nbsp;0</td>
</tr>
<tr>
<td></td>
<td>BIC/SWIFT&nbsp;:</td>
<td>CRESCHZZ80A</td>
</tr>
<tr>
<td></td>
<td>{% trans "Mention/Référence" %}&nbsp;:</td>
<td><b>{{invoice.get_reference}}</b></td>
<td>{{invoice.get_qr_ref}}</td>
</tr>

</table>

<br /><br />

{% endif %}

{% if invoice.greetings %}
{{invoice.greetings|linebreaksbr}}
<br /><br />
Expand All @@ -262,35 +307,72 @@ <h3 style="text-align: center; font-size: 20px;">{% trans "Facture" %}<br />{% t
{% trans "Annexe(s): ment." %}
{% endif %}

{% if invoice.display_qr %}
<pdf:nexttemplate name="qr" />
<pdf:nextpage>
<div id=qr_comments>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guimmets


<div style="margin-left: 12cm; font-size: 140%;">
<p>{% trans "Facture" %} {% trans "N°" %} <b>{{invoice.get_reference}}</b></p>
</div>

<br /><br /><br />

<center>
<p class="pay_title">
<b>{% trans "Virement Bancaire" %}</b>
</p>

<br style="-pdf-keep-with-next: true;"/>

<div width="130mm" style="margin-left: 45mm;">
<table width="100%" style="text-align: left; -pdf-keep-with-next: false;">
<tr>
<td width="20%">{% trans "Banque" %}&nbsp;:</td>
<td width="80%">Credit&nbsp;Suisse&nbsp;-&nbsp;Zürich</td>
</tr>
<tr>
<td>IBAN&nbsp;:</td>
<td>CH19&nbsp;0483&nbsp;5028&nbsp;7897&nbsp;7100&nbsp;0</td>
</tr>
<tr>
<td>BIC/SWIFT&nbsp;:</td>
<td>CRESCHZZ80A</td>
</tr>
<tr>
<td>{% trans "Mention/Référence" %}&nbsp;:</td>
<td>{{invoice.get_qr_ref}}</td>
</tr>
<tr>
<td>{% trans "Adresse" %}&nbsp;:</td>
<td>Case Postale 16</td>
</tr>
<tr>
<td></td>
<td>CH-1015 LAUSANNE EPFL</td>
</tr>
</table>
</div>

<br /><br /><br /><br /><br /><br /><br /><br /><br />

<p class="pay_title">
<b>{% trans "QR Facture" %}</b>
</p>
</center>
</div>

{% if invoice.display_bvr %}
<pdf:nextpage/>

<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />

<center>
<img src="{{MEDIA_ROOT}}cache/bvr/{{invoice.pk}}.png" width="212mm">
<br />

<small>{% trans "Attention: Ce BVR ne peut pas être utilisé pour un paiement aux guichets de la poste ou d'une banque" %}</small>
</center>
<p style="color: white">This is a fake placeholder</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


<div id="qr">
<img src="{{MEDIA_ROOT}}cache/bvr/qr-{{invoice.pk}}.png">
</div>

{% endif %}
{% endlanguage %}
{% endblock %}

{% block footer %}
<div id="footerContent">{% trans "Page" %} <pdf:pagenumber/> - {% trans "Généré le" %} {{cdate|date:"d/m/Y"}} <small><small>[{{user.pk}}]</small></small></div>
{% endblock %}
Loading