Browse Source

Tweak invoice and payment howto for ARN

Alexandre Aubin 7 years ago
parent
commit
5de6062041

+ 77 - 0
arn/templates/billing/invoice.html

@@ -0,0 +1,77 @@
+{% extends "base.html" %}
+
+{% block content %}
+<div class="row">
+    <div class="large-8 columns">
+        <h2>Facture N°{{ invoice.number }}</h2>
+        <p>Émise le {{ invoice.date }}</p>
+    </div>
+    <div class="large-4 columns">
+        {% if invoice.validated %}<a href="{% url 'billing:invoice_pdf' id=invoice.number %}" target="_blank" class="button expand"><i class="fa fa-file-pdf-o"></i> Télécharger en PDF</a>{% endif %}
+    </div>
+</div>
+
+<table id="invoice_details" class="invoice-table full-width">
+    <thead>
+        <tr>
+            <th></th>
+            <th>Quantité</th>
+            <th>PU</th>
+            <th class="total">Total TTC</th>
+        </tr>
+    </thead>
+    <tbody>
+        {% for detail in invoice.details.all %}
+        <tr>
+            <td>{{ detail.label }}
+                {% if detail.period_from and detail.period_to %}<br/><span class="period">Pour la période du {{ detail.period_from }} au {{ detail.period_to }}{% endif %}</span></td>
+            <td>{{ detail.quantity }}</td>
+            <td>{{ detail.amount }}€</td>
+            <td class="total">{{ detail.total }}€</td>
+        </tr>
+        {% endfor %}
+        <tr class="total">
+            <td class="" colspan="3">Total TTC</td>
+            <td class="total">{{ invoice.amount }}€</td>
+        </tr>
+    </tbody>
+</table>
+
+<p>
+  Facture à payer avant le {{ invoice.date_due }}.
+</p>
+
+<h3>Règlement</h3>
+
+{% if invoice.payments.exists %}
+    <table id="invoice-payments" class="invoice-table full-width">
+        <thead>
+            <tr>
+                <th>Type de paiement</th>
+                <th>Date</th>
+                <th class="total">Montant</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for payment in invoice.payments.all %}
+            <tr class="payment">
+                <td>{{ payment.get_payment_mean_display }}</td>
+                <td>{{ payment.date }}</td>
+                <td class="total">-{{ payment.amount }}€</td>
+            </tr>
+            {% endfor %}
+            <tr class="total">
+                <td class="" colspan="2">Reste à payer</td>
+                <td class="total">{{ invoice.amount_remaining_to_pay }}€</td>
+            </tr>
+        </tbody>
+    </table>
+{% endif %}
+
+{% if invoice.amount_remaining_to_pay > 0 %}
+    <div id="payment-howto" class="panel">
+        {% include "billing/payment_howto.html" %}
+    </div>
+{% endif %}
+
+{% endblock %}

+ 234 - 0
arn/templates/billing/invoice_pdf.html

@@ -0,0 +1,234 @@
+{% load static isptags %}
+<html>
+<head>
+  <title>Facture N°{{ invoice.number }}</title>
+
+  <style>
+  @page {
+    margin: 0; padding: 40pt;
+  }
+
+  html {
+    box-sizing: border-box;
+  }
+  *, *:before, *:after {
+    box-sizing: inherit;
+  }
+
+  body {
+    font-size: 9pt;
+    font-family: sans-serif;
+    color: #111;
+    padding: 0;
+  }
+  a {
+    color: #111;
+    text-decoration: none;
+  }
+
+  p {
+    margin: 0;
+  }
+  p + p {
+    margin-top: 10pt;
+  }
+  table {
+    border-collapse: collapse;
+    width: 100%;
+    margin: 40pt 0;
+  }
+
+  h1 {
+    font-size: 12pt;
+  }
+
+  #header {
+    margin: 0 0 60pt 0;
+    border: none;
+  }
+
+  #header .logo {
+    height: 35pt;
+    margin: 0 auto 20pt;
+  }
+
+  #header .header-left {
+    text-align: left;
+  }
+
+  #header .header-right {
+    text-align: right;
+  }
+
+  footer {
+    position: fixed;
+    bottom: 0;
+    width: 100%;
+  }
+
+  footer .logo {
+    height: 20pt;
+  }
+
+  #coordonnees {}
+
+  #coordonnees td {
+    width: 50%;
+    vertical-align: top;
+  }
+
+  #details {}
+
+  #details th,
+  #details td {
+    padding: 5pt;
+    border:1px solid #ddd;
+  }
+  #details th.cell--empty,
+  #details td.cell--empty {border: 0;}
+
+  /* details cell layout */
+  .cell-label {width: 70%;}
+  .cell-quantity {width: 5%;}
+  .cell-amount {width: 10%;}
+  .cell-tax {width: 5%;}
+  .cell-total {width: 15%;}
+
+  /* details cell style */
+  .cell-result {
+    font-weight: bold;
+  }
+  .cell-quantity {
+    text-align: center;
+  }
+  .cell--money,
+  .cell-tax {
+    text-align: right;
+    white-space: nowrap;
+  }
+
+  .cell-label p + p {
+    margin-top: 5pt;
+  }
+  .period {
+    color:#888;
+  }
+
+  #paiements {
+    margin-top: 40pt;
+    background-color: #f0f0f0;
+    padding: 10pt;
+    font-size: x-small;
+  }
+
+  footer {
+    font-size: xx-small;
+  }
+  .pagination {
+    float: right;
+  }
+  </style>
+</head>
+<body>
+
+  <table id="header">
+      <tr>
+          <td class="header-left">
+              <img class="logo" src="{{ branding.logoURL }}" />
+          </td>
+          <td class="header-right">
+              <h1>Facture N°{{ invoice.number }}</h1>
+              <p>Date : {{ invoice.date }}</p>
+          </td>
+      </tr>
+  </table>
+
+  <table id="coordonnees">
+    <tr>
+      <td id="coordonnees_isp">
+        <p>
+        {% multiline_isp_addr branding %}
+        </p>
+        <p>
+        <a href="mailto:{{ branding.email }}">{{ branding.email }}</a><br/>
+        <a href="{{ branding.website }}">{{ branding.website }}</a><br />
+        {{ branding.phone_number }}<br />
+        SIRET : {{ branding.registeredoffice.siret }}
+        </p>
+      </td>
+      <td id="coordonnees_client">
+        <p>
+        <strong>Facturé à</strong><br/>
+        {% with member=invoice.member %}
+        {{ member.last_name }} {{ member.first_name }}<br />
+        {% if member.organization_name != "" %}{{ member.organization_name }}<br />{% endif %}
+        {% if member.address %}{{member.address}}<br />{% endif %}
+        {% if member.postal_code and member.city %}
+        {{ member.postal_code }} {{ member.city }}
+        {% endif %}
+        {% endwith %}
+        </p>
+      </td>
+    </tr>
+  </table>
+
+  <table id="details" repeat="1">
+    <thead>
+      <tr>
+        <th class="cell-label cell--empty"></th>
+        <th class="cell-quantity">Quantité</th>
+        <th class="cell-amount cell--money">PU (HT)</th>
+        <th class="cell-label cell-tax">TVA</th>
+        <th class="cell-total cell--money">Total</th>
+      </tr>
+    </thead>
+    <tbody>
+      {% for detail in invoice.details.all %}
+      <tr>
+        <td class="cell-label">
+          <p>
+          {{ detail.label }}
+          {% if detail.offersubscription %}
+            <br/>
+            <span class="subscription">{{ detail.offersubscription.offer.name }}
+            {% if detail.offersubscription.offer.reference %} ({{ detail.offersubscription.get_subscription_reference }}){% endif %}
+            </span>
+          {% endif %}
+          </p>
+          {% if detail.period_from and detail.period_to %}
+          <p class="period">Pour la période du {{ detail.period_from }} au {{ detail.period_to }}</p>
+          {% endif %}
+        </td>
+        <td class="cell-quantity">{{ detail.quantity }}</td>
+        <td class="cell-amount cell--money">{{ detail.amount }}€</td>
+        <td class="cell-tax">{{ detail.tax }}%</td>
+        <td class="cell-total cell--money">{{ detail.total }}€</td>
+      </tr>
+      {% endfor %}
+
+      <tr>
+        <td class="cell-result cell--empty"></td>
+        <td class="result-label " colspan="3">Total HT</td>
+        <td class="cell--money ">{{ invoice.amount_before_tax }}€</td>
+      </tr>
+      <tr>
+        <td class="cell-result cell--empty"></td>
+        <td class="cell-result result-label" colspan="3">Total TTC</td>
+        <td class="cell-result result-total cell--money">{{ invoice.amount }}€</td>
+      </tr>
+
+    </tbody>
+  </table>
+
+  <p>À payer avant le {{ invoice.date_due }}.</p>
+
+  <div id="paiements">
+  {% include "billing/payment_howto.html" %}
+  </div>
+
+  <footer>
+    <p class="pagination"><pdf:pagenumber>/<pdf:pagecount></p>
+    <p>{{ branding.shortname|upper }} est une association de droit local alsacien-mosellan à but non lucratif.</p>
+  </footer>
+</body>
+</html>

+ 25 - 0
arn/templates/billing/payment_howto.html

@@ -0,0 +1,25 @@
+{% load isptags %}
+
+<p>
+    <strong>Merci de payer par virement bancaire</strong><br />
+    <br>
+    Titulaire du compte : {% firstof branding.shortname branding.name %}<br/>
+    IBAN : {{ branding.bankinfo.iban|pretty_iban }}<br />
+    {% if branding.bankinfo.bic %}
+    BIC : {{ branding.bankinfo.bic }}<br />
+    {% endif %}
+
+    <br>
+
+    {% if invoice %}
+    <strong>Prière de faire figurer la reference suivante sur vos virement :</strong><br />
+    {% with member=invoice.member %}
+        ID {{ member.pk }} et ou {{ member.username }} <br />
+    {% endwith %}
+    {% endif %}
+
+    {% if member %}
+    <strong>Prière de faire figurer la reference suivante sur vos virement :</strong><br />
+        ID {{ member.pk }} et ou {{ member.username }} <br />
+    {% endif %}
+</p>

+ 5 - 5
coin/billing/create_subscriptions_invoices.py

@@ -139,11 +139,11 @@ def create_member_invoice_for_a_period(member, date):
                 # Ajout l'item de l'offre correspondant à l'abonnement
                 # Ajout l'item de l'offre correspondant à l'abonnement
                 # à la facture
                 # à la facture
                 label = offer.name
                 label = offer.name
-                try:
-                    if (offer_subscription.configuration.comment):
-                        label += " (%s)" % offer_subscription.configuration.comment
-                except ObjectDoesNotExist:
-                    pass
+                #try:
+                #    if (offer_subscription.configuration.comment):
+                #        label += " (%s)" % offer_subscription.configuration.comment
+                #except ObjectDoesNotExist:
+                #    pass
 
 
                 invoice.details.create(label=label,
                 invoice.details.create(label=label,
                                        amount=offer.period_fees,
                                        amount=offer.period_fees,

+ 2 - 1
coin/members/views.py

@@ -58,7 +58,8 @@ def invoices(request):
     return render(request, 'members/invoices.html',
     return render(request, 'members/invoices.html',
                               {'balance' : balance,
                               {'balance' : balance,
                                'invoices': invoices,
                                'invoices': invoices,
-                               'payments': payments})
+                               'payments': payments,
+                               'member': request.user})
 
 
 
 
 @login_required
 @login_required

+ 1 - 1
coin/settings_base.py

@@ -137,7 +137,7 @@ TEMPLATE_DIRS = (
     os.path.join(PROJECT_PATH, 'templates/'),
     os.path.join(PROJECT_PATH, 'templates/'),
 )
 )
 
 
-EXTRA_TEMPLATE_DIRS = tuple()
+EXTRA_TEMPLATE_DIRS = ('./arn/templates',)
 
 
 INSTALLED_APPS = (
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.auth',