8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-30 08:32:26 +00:00
This commit is contained in:
lhark 2016-07-08 03:45:24 +02:00
commit 6a5de7bb0a
10 changed files with 292 additions and 13 deletions

View file

@ -0,0 +1,21 @@
<table class="table table-striped">
<thead>
<tr>
<th>Nom de l'article</th>
<th>Prix</th>
<th>Cotisation</th>
<th>Durée (en mois)</th>
<th></th>
</tr>
</thead>
{% for article in article_list %}
<tr>
<td>{{ article.name }}</td>
<td>{{ article.prix }}</td>
<td>{{ article.cotisation }}</td>
<td>{{ article.duration }}</td>
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:edit-article' article.id %}"><i class="glyphicon glyphicon-pushpin"></i> Editer</a></td>
</tr>
{% endfor %}
</table>

View file

@ -0,0 +1,15 @@
<table class="table table-striped">
<thead>
<tr>
<th>Banque</th>
<th></th>
</tr>
</thead>
{% for banque in banque_list %}
<tr>
<td>{{ banque.name }}</td>
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:edit-banque' banque.id %}"><i class="glyphicon glyphicon-pushpin"></i> Editer</a></td>
</tr>
{% endfor %}
</table>

View file

@ -0,0 +1,15 @@
<table class="table table-striped">
<thead>
<tr>
<th>Moyen de paiement</th>
<th></th>
</tr>
</thead>
{% for paiement in paiement_list %}
<tr>
<td>{{ paiement.moyen }}</td>
<td><a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:edit-paiement' paiement.id %}"><i class="glyphicon glyphicon-pushpin"></i> Editer</a></td>
</tr>
{% endfor %}
</table>

View file

@ -0,0 +1,124 @@
{% load i18n %}
{% language 'fr' %}
\nonstopmode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Invoice Template
% LaTeX Template
% Version 1.0 (3/11/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Trey Hunner (http://www.treyhunner.com/)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
% Important note:
% This template requires the invoice.cls file to be in the same directory as
% the .tex file. The invoice.cls file provides the style used for structuring the
% document.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% DOCUMENT CONFIGURATION
%----------------------------------------------------------------------------------------
\documentclass[12pt]{article} % Use the custom invoice class (invoice.cls)
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{eurosym}
\usepackage{tabularx}
\usepackage[letterpaper,hmargin=0.79in,vmargin=0.79in]{geometry}
\usepackage[parfill]{parskip} % Do not indent paragraphs
\usepackage{fp} % Fixed-point arithmetic
\usepackage{calc} % Counters for totaling hours and cost
\usepackage{longtable}
\usepackage{graphicx}
\usepackage[absolute]{textpos}
\usepackage{calc}
\usepackage{xparse}
\pagestyle{empty} % No page numbers
\linespread{1.5} % Line spacing
\setlength{\doublerulesep}{\arrayrulewidth} % Double rules look like one thick one
\def \tab {\hspace*{3ex}} % Define \tab to create some horizontal white space
\begin{document}
%\newcommand{\product}[5][0][0][0][0][0]{
%\setlength{ptotal}{#3*\real{#4}}
%\addtolength{total}{#3*\real{#4}}
\DeclareDocumentCommand{\product}{ O{0} O{0} O{0} O{0} O{0} }{
#1 & #2 & #3 & #4 & #5 \\
\hline
}
%----------------------------------------------------------------------------------------
% HEADING SECTION
%----------------------------------------------------------------------------------------
\begin{titlepage}
\begin{textblock*}{4cm}(20mm,5mm)
%\includegraphics[scale=0.3]{% templatetag openbrace %}{{tpl_path}}/logo.png}
\end{textblock*}
\end{titlepage}
\hfil{\Huge\bf ReZo Metz}\hfil % Company providing the invoice
\bigskip\break % Whitespace
\hrule % Horizontal line
2 rue Edouard Belin \\ % Your address and contact information
57070 Metz \hfill augustin.lemesle@supelec.fr \\
Siret :
\\ \\
{\bf À :} \tab {{f.user.name}} {{f.user.surname}} \\ % Invoice recipient
{\bf Date:} \tab {{DATE}} \\ % Invoice date
{\bf Facture \no:} \tab {{fid}} \\ % Invoice number
%----------------------------------------------------------------------------------------
% TABLE OF EXPENSES
%----------------------------------------------------------------------------------------
\begin{tabularx}{\textwidth}{|l|X|r|r|r|}
\hline
\textbf{Code} & \textbf{Désignation} & \textbf{Qté.} & \textbf{Prix Unit.} \euro & \textbf{Prix Tot.} \euro\\
\hline
{% for a in f.article %}
\product[{{a.code}}][{{a.designation}}][{{a.nombre}}][{{a.pu|floatformat:2}}][{{a.ptotal|floatformat:2}}]
{% endfor %}
\hline
\end{tabularx}
%\setcounter{paid}{0}
%\setcounter{topay}{\real{\value{total}}-\value{paid}}
\hfill
\begin{tabular}{|l|r|}
\hline
\textbf{Total} & {{total|floatformat:2}}\euro \\
\textbf{Votre règlement} & {{paid|floatformat:2}}\euro \\
\hline
\textbf{À PAYER} & {{topay|floatformat:2}}\euro \\
\hline
\hline
\end{tabular}
\vspace{1.5cm} % Whitespace
\hrule % Horizontal line
\footnotesize{TVA non applicable, art. 293 B du CGI}
{% endlanguage %}
%----------------------------------------------------------------------------------------
\end{document}

View file

@ -0,0 +1,15 @@
{% extends "cotisations/sidebar.html" %}
{% load bootstrap3 %}
{% block title %}Articles{% endblock %}
{% block content %}
<h2>Liste des types d'articles</h2>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-article' %}"><i class="glyphicon glyphicon-plus"></i> Ajouter un type d'articles</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:del-article' %}"><i class="glyphicon glyphicon-trash"></i> Supprimer un ou plusieurs types d'articles</a>
{% include "cotisations/aff_article.html" with article_list=article_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -0,0 +1,15 @@
{% extends "cotisations/sidebar.html" %}
{% load bootstrap3 %}
{% block title %}Banques{% endblock %}
{% block content %}
<h2>Liste des banques</h2>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-banque' %}"><i class="glyphicon glyphicon-plus"></i> Ajouter une banque</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:del-banque' %}"><i class="glyphicon glyphicon-trash"></i> Supprimer une ou plusieurs banques</a>
{% include "cotisations/aff_banque.html" with banque_list=banque_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -0,0 +1,15 @@
{% extends "cotisations/sidebar.html" %}
{% load bootstrap3 %}
{% block title %}Paiements{% endblock %}
{% block content %}
<h2>Liste des types de paiements</h2>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-paiement' %}"><i class="glyphicon glyphicon-plus"></i> Ajouter un type de paiement</a>
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:del-paiement' %}"><i class="glyphicon glyphicon-trash"></i> Supprimer un ou plusieurs types de paiements</a>
{% include "cotisations/aff_paiement.html" with paiement_list=paiement_list %}
<br />
<br />
<br />
{% endblock %}

View file

@ -2,10 +2,7 @@
{% block sidebar %}
<p><a href="{% url "cotisations:index" %}">Liste des factures</a></p>
<p><a href="{% url "cotisations:add-article" %}">Ajouter un article</a></p>
<p><a href="{% url "cotisations:del-article" %}">Retirer un article</a></p>
<p><a href="{% url "cotisations:add-paiement" %}">Ajouter un moyen de paiement</a></p>
<p><a href="{% url "cotisations:del-paiement" %}">Retirer un moyen de paiement</a></p>
<p><a href="{% url "cotisations:add-banque" %}">Ajouter une banque</a></p>
<p><a href="{% url "cotisations:del-banque" %}">Retirer une banque</a></p>
<p><a href="{% url "cotisations:index-article" %}">Liste des articles en vente</a></p>
<p><a href="{% url "cotisations:index-banque" %}">Liste des banques</a></p>
<p><a href="{% url "cotisations:index-paiement" %}">Liste des moyens de paiement</a></p>
{% endblock %}

View file

@ -5,12 +5,19 @@ from . import views
urlpatterns = [
url(r'^new_facture/(?P<userid>[0-9]+)$', views.new_facture, name='new-facture'),
url(r'^edit_facture/(?P<factureid>[0-9]+)$', views.edit_facture, name='edit-facture'),
url(r'^new_facture_pdf/$', views.new_facture_pdf, name='new-facture-pdf'),
url(r'^add_article/$', views.add_article, name='add-article'),
url(r'^edit_article/(?P<articleid>[0-9]+)$', views.edit_article, name='edit-article'),
url(r'^del_article/$', views.del_article, name='del-article'),
url(r'^add_paiement/$', views.add_paiement, name='add-paiement'),
url(r'^edit_paiement/(?P<paiementid>[0-9]+)$', views.edit_paiement, name='edit-paiement'),
url(r'^del_paiement/$', views.del_paiement, name='del-paiement'),
url(r'^add_banque/$', views.add_banque, name='add-banque'),
url(r'^edit_banque/(?P<banqueid>[0-9]+)$', views.edit_banque, name='edit-banque'),
url(r'^del_banque/$', views.del_banque, name='del-banque'),
url(r'^index_article/$', views.index_article, name='index-article'),
url(r'^index_banque/$', views.index_banque, name='index-banque'),
url(r'^index_paiement/$', views.index_paiement, name='index-paiement'),
url(r'^$', views.index, name='index'),
]

View file

@ -8,9 +8,10 @@ from django.template import Context, RequestContext, loader
from django.contrib import messages
from django.db.models import Max, ProtectedError
from .models import Facture, Article, Cotisation, Article
from .models import Facture, Article, Cotisation, Paiement, Banque
from .forms import NewFactureForm, EditFactureForm, ArticleForm, DelArticleForm, PaiementForm, DelPaiementForm, BanqueForm, DelBanqueForm
from users.models import User
from .tex import render_tex
from dateutil.relativedelta import relativedelta
from django.utils import timezone
@ -69,6 +70,9 @@ def new_facture(request, userid):
return redirect("/users/profil/" + userid)
return form({'factureform': facture_form}, 'cotisations/facture.html', request)
def new_facture_pdf(request):
return render_tex(request, 'cotisations/factures.tex', {'DATE':None})
def edit_facture(request, factureid):
try:
facture = Facture.objects.get(pk=factureid)
@ -87,7 +91,20 @@ def add_article(request):
if article.is_valid():
article.save()
messages.success(request, "L'article a été ajouté")
return redirect("/cotisations/")
return redirect("/cotisations/index_article/")
return form({'factureform': article}, 'cotisations/facture.html', request)
def edit_article(request, articleid):
try:
article_instance = Article.objects.get(pk=articleid)
except Article.DoesNotExist:
messages.error(request, u"Entrée inexistante" )
return redirect("/cotisations/index_article/")
article = ArticleForm(request.POST or None, instance=article_instance)
if article.is_valid():
article.save()
messages.success(request, "Type d'article modifié")
return redirect("/cotisations/index_article/")
return form({'factureform': article}, 'cotisations/facture.html', request)
def del_article(request):
@ -96,7 +113,7 @@ def del_article(request):
article_del = article.cleaned_data['articles']
article_del.delete()
messages.success(request, "Le/les articles ont été supprimé")
return redirect("/cotisations/")
return redirect("/cotisations/index_article")
return form({'factureform': article}, 'cotisations/facture.html', request)
def add_paiement(request):
@ -104,7 +121,20 @@ def add_paiement(request):
if paiement.is_valid():
paiement.save()
messages.success(request, "Le moyen de paiement a été ajouté")
return redirect("/cotisations/")
return redirect("/cotisations/index_paiement/")
return form({'factureform': paiement}, 'cotisations/facture.html', request)
def edit_paiement(request, paiementid):
try:
paiement_instance = Paiement.objects.get(pk=paiementid)
except Paiement.DoesNotExist:
messages.error(request, u"Entrée inexistante" )
return redirect("/cotisations/index_paiement/")
paiement = PaiementForm(request.POST or None, instance=paiement_instance)
if paiement.is_valid():
paiement.save()
messages.success(request, "Type de paiement modifié")
return redirect("/cotisations/index_paiement/")
return form({'factureform': paiement}, 'cotisations/facture.html', request)
def del_paiement(request):
@ -117,7 +147,7 @@ def del_paiement(request):
messages.success(request, "Le moyen de paiement a été supprimé")
except ProtectedError:
messages.error(request, "Le moyen de paiement %s est affecté à au moins une facture, vous ne pouvez pas le supprimer" % paiement_del)
return redirect("/cotisations/")
return redirect("/cotisations/index_paiement/")
return form({'factureform': paiement}, 'cotisations/facture.html', request)
def add_banque(request):
@ -125,7 +155,20 @@ def add_banque(request):
if banque.is_valid():
banque.save()
messages.success(request, "La banque a été ajoutée")
return redirect("/cotisations/")
return redirect("/cotisations/index_banque/")
return form({'factureform': banque}, 'cotisations/facture.html', request)
def edit_banque(request, banqueid):
try:
banque_instance = Article.objects.get(pk=banqueid)
except Banque.DoesNotExist:
messages.error(request, u"Entrée inexistante" )
return redirect("/cotisations/index_banque/")
banque = BanqueForm(request.POST or None, instance=banque_instance)
if banque.is_valid():
banque.save()
messages.success(request, "Banque modifiée")
return redirect("/cotisations/index_banque/")
return form({'factureform': banque}, 'cotisations/facture.html', request)
def del_banque(request):
@ -138,9 +181,21 @@ def del_banque(request):
messages.success(request, "La banque a été supprimée")
except ProtectedError:
messages.error(request, "La banque %s est affectée à au moins une facture, vous ne pouvez pas la supprimer" % banque_del)
return redirect("/cotisations/")
return redirect("/cotisations/index_banque/")
return form({'factureform': banque}, 'cotisations/facture.html', request)
def index_article(request):
article_list = Article.objects.order_by('name')
return render(request, 'cotisations/index_article.html', {'article_list':article_list})
def index_paiement(request):
paiement_list = Paiement.objects.order_by('moyen')
return render(request, 'cotisations/index_paiement.html', {'paiement_list':paiement_list})
def index_banque(request):
banque_list = Banque.objects.order_by('name')
return render(request, 'cotisations/index_banque.html', {'banque_list':banque_list})
def index(request):
facture_list = Facture.objects.order_by('date').reverse()
return render(request, 'cotisations/index.html', {'facture_list': facture_list})