mirror of https://github.com/nanoy42/coope
committed by
GitHub
47 changed files with 1094 additions and 122 deletions
@ -0,0 +1,7 @@ |
|||
import math |
|||
|
|||
def compute_price(price, a, b, c, alpha): |
|||
if price < alpha: |
|||
return float(price) * (1 + float(a) + float(b) * math.exp(-c/(price-alpha)**2)) |
|||
else: |
|||
return price * (1 + a) |
|||
@ -0,0 +1,43 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 14:23 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('gestion', '0009_auto_20190506_0939'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='historicalkeg', |
|||
name='name', |
|||
field=models.CharField(db_index=True, max_length=255, verbose_name='Nom'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='historicalproduct', |
|||
name='barcode', |
|||
field=models.CharField(db_index=True, max_length=255, verbose_name='Code barre'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='historicalproduct', |
|||
name='name', |
|||
field=models.CharField(db_index=True, max_length=255, verbose_name='Nom'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='keg', |
|||
name='name', |
|||
field=models.CharField(max_length=255, unique=True, verbose_name='Nom'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='product', |
|||
name='barcode', |
|||
field=models.CharField(max_length=255, unique=True, verbose_name='Code barre'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='product', |
|||
name='name', |
|||
field=models.CharField(max_length=255, unique=True, verbose_name='Nom'), |
|||
), |
|||
] |
|||
@ -0,0 +1,37 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 14:40 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('gestion', '0010_auto_20190623_1623'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RemoveField( |
|||
model_name='historicalkeg', |
|||
name='barcode', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='historicalmenu', |
|||
name='barcode', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='historicalproduct', |
|||
name='barcode', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='keg', |
|||
name='barcode', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='menu', |
|||
name='barcode', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='product', |
|||
name='barcode', |
|||
), |
|||
] |
|||
@ -0,0 +1,77 @@ |
|||
{% extends 'base.html' %} |
|||
{% block entete %}Répartition des cotisations{% endblock %} |
|||
{% block navbar %} |
|||
<ul> |
|||
<li><a href="#first">Répartition des cotisations</a></li> |
|||
<li><a href="#second">Historique des répartitions</a></li> |
|||
</ul> |
|||
{% endblock %} |
|||
{% block content %} |
|||
<section id="first" class="main"> |
|||
<header class="major"> |
|||
<h2>Répartition des cotisations</h2> |
|||
</header> |
|||
<section> |
|||
<div class="table-wrapper"> |
|||
<table> |
|||
<thead> |
|||
<tr> |
|||
<th>Champ</th> |
|||
<th>Valeur</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td>Nombre de cotisations non réparties</td> |
|||
<td>{{total_cotisations}}</td> |
|||
</tr> |
|||
<tr> |
|||
<td>Valeur totale des cotisations non réparties</td> |
|||
<td>{{total_amount}} €</td> |
|||
</tr> |
|||
<tr> |
|||
<td>Valeur à donner au Club Phœnix Technopôle Metz</td> |
|||
<td>{{total_amount_ptm}} €</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
<form action="" method="post"> |
|||
{% csrf_token %} |
|||
<button type="submit"><i class="fa fa-hand-holding-usd"></i> Répartir</button> |
|||
</form> |
|||
<p>Attention, cliquer sur ce bouton marquera toutes les cotisations actuellement non réparties comme réparties. L'historique de cette action n'est pas simple à obtenir et l'action peut être considérée comme irreversible.</p> |
|||
</section> |
|||
</section> |
|||
<section id="second" class="main"> |
|||
<header class="major"> |
|||
<h2>Historique des répartitions</h2> |
|||
</header> |
|||
<section> |
|||
<div class="table-wrapper"> |
|||
<table> |
|||
<thead> |
|||
<tr> |
|||
<th>Date</th> |
|||
<th>Nombre de cotisations</th> |
|||
<th>Montant des cotisations</th> |
|||
<th>Montant des cotisations pourle Phœnix</th> |
|||
<th>Coopeman</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{% for divide_history in divide_histories %} |
|||
<tr> |
|||
<td>{{ divide_history.date }}</td> |
|||
<td>{{ divide_history.total_cotisations }}</td> |
|||
<td>{{ divide_history.total_cotisations_amount }} €</td> |
|||
<td>{{ divide_history.total_ptm_amount }} €</td> |
|||
<td>{{ divide_history.coopeman }}</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</section> |
|||
</section> |
|||
{% endblock %} |
|||
@ -0,0 +1,100 @@ |
|||
\documentclass[french,11pt]{article} |
|||
\usepackage{babel} |
|||
\usepackage[T1]{fontenc} |
|||
\usepackage[utf8]{inputenc} |
|||
\usepackage[a4paper]{geometry} |
|||
\usepackage{units} |
|||
\usepackage{graphicx} |
|||
\usepackage{fancyhdr} |
|||
\usepackage{fp} |
|||
\usepackage{float} |
|||
\usepackage{eurosym} |
|||
\def\FactureDate { {{- invoice_date -}} } |
|||
\def\FactureNum { {{- invoice_number -}} } |
|||
\def\FactureAcquittee {non} |
|||
\def\FactureLieu { {{- invoice_place -}} } |
|||
\def\FactureObjet { {{- invoice_object -}} } |
|||
\def\FactureDescr { |
|||
{{- invoice_description -}} |
|||
} |
|||
|
|||
\def\ClientNom{ {{- client_name -}} } |
|||
\def\ClientAdresse{ |
|||
{{- client_address_first_line -}}\newline |
|||
{{ client_address_second_line }} |
|||
} |
|||
|
|||
\geometry{verbose,tmargin=4em,bmargin=8em,lmargin=6em,rmargin=6em} |
|||
\setlength{\parindent}{0pt} |
|||
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex} |
|||
|
|||
\thispagestyle{fancy} |
|||
\pagestyle{fancy} |
|||
\setlength{\parindent}{0pt} |
|||
|
|||
\renewcommand{\headrulewidth}{0pt} |
|||
\cfoot{ |
|||
\small{ |
|||
Coopé Technopôle Metz (CTM)\\ |
|||
Adresse mail : coopemetz@gmail.com\\} |
|||
\tiny{ |
|||
Inscrite au registre des associations du tribunal d’instance de Metz |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
\begin{document} |
|||
|
|||
\begin{figure}[H] |
|||
\includegraphics[scale=0.3]{ {{- path -}} } |
|||
\end{figure} |
|||
Coopé Technopôle Metz\\ |
|||
4 place Édouard Branly\\ |
|||
57070 Metz |
|||
|
|||
Facture FE\FactureNum |
|||
|
|||
{\addtolength{\leftskip}{10.5cm} |
|||
\textbf{\ClientNom} \\ |
|||
\ClientAdresse \\ |
|||
|
|||
} |
|||
|
|||
\hspace*{10.5cm} |
|||
\FactureLieu, le \FactureDate |
|||
|
|||
~\\~\\ |
|||
|
|||
\textbf{Objet : \FactureObjet \\} |
|||
|
|||
\textnormal{\FactureDescr} |
|||
|
|||
\vspace{10mm} |
|||
|
|||
\begin{center} |
|||
\begin{tabular}{lrrr} |
|||
\textbf{Désignation ~~~~~~} & \textbf{Prix unitaire} & \textbf{Quantité} & \textbf{Montant (EUR)} \\ |
|||
\hline |
|||
{% for product in products %} |
|||
{{- product.0 -}} & {{- product.1 -}} \euro{} & {{- product.2 -}} & {{- product.3 -}} \euro{}\\ |
|||
{% endfor %} |
|||
\hline |
|||
\textbf{Total HT} & & & {{- total -}} \euro{} |
|||
\end{tabular} |
|||
\end{center} |
|||
|
|||
\vfill |
|||
À régler par chèque, espèces ou par virement bancaire : |
|||
\begin{center} |
|||
\begin{tabular}{|c c c c|} |
|||
\hline \textbf{Code banque} & \textbf{Code guichet}& \textbf{Nº de Compte} & \textbf{Clé RIB} \\ |
|||
20041 & 01010 & 1074350Z031 & 48 \\ |
|||
\hline \textbf{IBAN Nº} & \multicolumn{3}{|l|}{ FR82 2004 1010 1010 7435 0Z03 148 } \\ |
|||
\hline \textbf{BIC} & \multicolumn{3}{|l|}{ PSSTFRPPNCY }\\ |
|||
\hline \textbf{Domiciliation} & \multicolumn{3}{|l|}{La Banque Postale - Centre Financier - 54900 Nancy CEDEX 9}\\ |
|||
\hline \textbf{Titulaire} & \multicolumn{3}{|l|}{ASSO COOPE TECHNOPOLE METZ}\\ |
|||
\hline |
|||
\end{tabular} |
|||
\end{center} |
|||
\end{document} |
|||
@ -0,0 +1,23 @@ |
|||
# Generated by Django 2.1 on 2019-06-22 21:34 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('preferences', '0012_auto_20190428_1327'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='cotisation', |
|||
name='amount_ptm', |
|||
field=models.DecimalField(decimal_places=2, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='historicalcotisation', |
|||
name='amount_ptm', |
|||
field=models.DecimalField(decimal_places=2, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), |
|||
), |
|||
] |
|||
@ -0,0 +1,17 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 07:57 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('preferences', '0013_auto_20190622_2334'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterModelOptions( |
|||
name='cotisation', |
|||
options={'permissions': (('can_divide', 'Can divide money for cotisation'),)}, |
|||
), |
|||
] |
|||
@ -0,0 +1,30 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 08:49 |
|||
|
|||
from django.conf import settings |
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
|||
('preferences', '0014_auto_20190623_0957'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='DivideHistory', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('date', models.DateTimeField(auto_now_add=True)), |
|||
('total_cotisations', models.IntegerField(verbose_name='Nombre de cotisations')), |
|||
('total_cotisations_amount', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='Montant total des cotisations')), |
|||
('total_ptm_amount', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='Montant donné au Phœnix Technopôle Metz')), |
|||
('coopeman', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='divide_realized', to=settings.AUTH_USER_MODEL)), |
|||
], |
|||
options={ |
|||
'verbose_name': 'Historique répartition', |
|||
}, |
|||
), |
|||
] |
|||
@ -0,0 +1,25 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 12:37 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('preferences', '0015_dividehistory'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='PriceProfile', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('name', models.CharField(max_length=255)), |
|||
('a', models.DecimalField(decimal_places=2, max_digits=3, verbose_name='Marge constante')), |
|||
('b', models.DecimalField(decimal_places=2, max_digits=3, verbose_name='Marge constante')), |
|||
('c', models.DecimalField(decimal_places=2, max_digits=4, verbose_name='Marge constante')), |
|||
('alpha', models.DecimalField(decimal_places=2, max_digits=4, verbose_name='Marge constante')), |
|||
('use_for_draft', models.BooleanField(default=False)), |
|||
], |
|||
), |
|||
] |
|||
@ -0,0 +1,38 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 12:53 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('preferences', '0016_priceprofile'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name='priceprofile', |
|||
name='alpha', |
|||
field=models.DecimalField(decimal_places=2, max_digits=4, verbose_name='Étendue'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='priceprofile', |
|||
name='b', |
|||
field=models.DecimalField(decimal_places=2, max_digits=3, verbose_name='Marge variable'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='priceprofile', |
|||
name='c', |
|||
field=models.DecimalField(decimal_places=2, max_digits=4, verbose_name='Paramètre de forme'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='priceprofile', |
|||
name='name', |
|||
field=models.CharField(max_length=255, verbose_name='Nom'), |
|||
), |
|||
migrations.AlterField( |
|||
model_name='priceprofile', |
|||
name='use_for_draft', |
|||
field=models.BooleanField(default=False, verbose_name='Utiliser pour les pressions ?'), |
|||
), |
|||
] |
|||
@ -0,0 +1,45 @@ |
|||
{% extends "base.html" %} |
|||
{% block entete %}Gestion des profils de prix{% endblock %} |
|||
{% block navbar %} |
|||
<ul> |
|||
<li><a href="#first">Liste des profils de prix</a></li> |
|||
</ul> |
|||
{% endblock %} |
|||
{% block content %} |
|||
<section id="first" class="main"> |
|||
<header class="major"> |
|||
<h2>Liste des profils de prix</h2> |
|||
</header> |
|||
{% if perms.preferences.add_priceprofile %} |
|||
<a class="button" href="{% url 'preferences:addPriceProfile' %}"><i class="fa fa-plus-square"></i> Créer un profil de prix</a><br><br> |
|||
{% endif %} |
|||
<div class="table-wrapper"> |
|||
<table> |
|||
<thead> |
|||
<tr> |
|||
<th>Nom</th> |
|||
<th>a (marge constante)</th> |
|||
<th>b (marge variable)</th> |
|||
<th>c (paramètre de forme)</th> |
|||
<th>alpha (étendue)</th> |
|||
<th>Pression ?</th> |
|||
<th>Administration</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{% for pp in price_profiles %} |
|||
<tr> |
|||
<td>{{ pp.name }} </td> |
|||
<td>{{ pp.a }}</td> |
|||
<td>{{ pp.b }}</td> |
|||
<td>{{ pp.c }}</td> |
|||
<td>{{ pp.alpha }}</td> |
|||
<td>{{ pp.use_for_draft | yesno:"Oui,Non"}}</td> |
|||
<td>{% if perms.preferences.change_priceprofile %}<a class="button small" href="{% url 'preferences:editPriceProfile' pp.pk %}"><i class="fa fa-pencil-alt"></i> Modifier</a> {% endif %}{% if perms.preferences.delete_priceprofile %}<a class="button small" href="{% url 'preferences:deletePriceProfile' pp.pk %}"><i class="fa fa-trash"></i> Supprimer</a>{% endif %}</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</section> |
|||
{% endblock %} |
|||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
@ -0,0 +1,38 @@ |
|||
# Generated by Django 2.1 on 2019-06-10 23:05 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
def update(apps, schema_editor): |
|||
db_alias = schema_editor.connection.alias |
|||
users = apps.get_model('auth', 'User').objects.using(db_alias).all() |
|||
for user in users: |
|||
consumptions = apps.get_model('gestion', 'ConsumptionHistory').objects.using(db_alias).filter(customer=user).select_related('product') |
|||
alcohol = 0 |
|||
for consumption in consumptions: |
|||
product = consumption.product |
|||
alcohol += consumption.quantity * float(product.deg) * product.volume * 0.79 /10 /1000 |
|||
user.profile.alcohol = alcohol |
|||
user.profile.save() |
|||
|
|||
def reverse_update(apps, schema_editor): |
|||
pass |
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('users', '0005_auto_20190227_0859'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='historicalprofile', |
|||
name='alcohol', |
|||
field=models.DecimalField(decimal_places=2, default=0, max_digits=5, null=True), |
|||
), |
|||
migrations.AddField( |
|||
model_name='profile', |
|||
name='alcohol', |
|||
field=models.DecimalField(decimal_places=2, default=0, max_digits=5, null=True), |
|||
), |
|||
migrations.RunPython(update, reverse_update) |
|||
] |
|||
@ -0,0 +1,42 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 07:57 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
def update(apps, schema_editor): |
|||
CotisationHistory = apps.get_model('users', 'CotisationHistory') |
|||
for cotisation_history in CotisationHistory.objects.all(): |
|||
cotisation_history.amount_ptm = cotisation_history.cotisation.amount_ptm |
|||
cotisation_history.save() |
|||
|
|||
def reverse_update(apps, schema_editor): |
|||
pass |
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('users', '0006_auto_20190611_0105'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='cotisationhistory', |
|||
name='amount_ptm', |
|||
field=models.DecimalField(decimal_places=2, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='cotisationhistory', |
|||
name='divided', |
|||
field=models.BooleanField(default=False, verbose_name='Répartition'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='historicalcotisationhistory', |
|||
name='amount_ptm', |
|||
field=models.DecimalField(decimal_places=2, max_digits=5, null=True, verbose_name='Montant pour le club Phœnix Technopôle Metz'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='historicalcotisationhistory', |
|||
name='divided', |
|||
field=models.BooleanField(default=False, verbose_name='Répartition'), |
|||
), |
|||
migrations.RunPython(update, reverse_update) |
|||
] |
|||
@ -0,0 +1,23 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 09:05 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('users', '0007_auto_20190623_0957'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='historicalwhitelisthistory', |
|||
name='reason', |
|||
field=models.CharField(blank=True, max_length=255, verbose_name='Raison'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='whitelisthistory', |
|||
name='reason', |
|||
field=models.CharField(blank=True, max_length=255, verbose_name='Raison'), |
|||
), |
|||
] |
|||
@ -0,0 +1,17 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 12:37 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('users', '0008_auto_20190623_1105'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterModelOptions( |
|||
name='profile', |
|||
options={'permissions': (('can_generate_invoices', 'Can generate invocies'),), 'verbose_name': 'Profil'}, |
|||
), |
|||
] |
|||
@ -0,0 +1,34 @@ |
|||
# Generated by Django 2.1 on 2019-06-23 14:56 |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
def update(apps, schema_editor): |
|||
User = apps.get_model('auth', 'User') |
|||
ConsumptionHistory = apps.get_model('gestion', 'ConsumptionHistory') |
|||
for u in User.objects.all(): |
|||
chs = ConsumptionHistory.objects.filter(customer=u).filter(paymentMethod__affect_balance=False) |
|||
u.profile.direct_debit = sum([x.amount for x in chs]) |
|||
u.profile.save() |
|||
|
|||
def reverse(apps, schema_editor): |
|||
pass |
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('users', '0009_auto_20190623_1437'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name='historicalprofile', |
|||
name='direct_debit', |
|||
field=models.DecimalField(decimal_places=2, default=0, max_digits=7, verbose_name='Débit (non compte)'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='profile', |
|||
name='direct_debit', |
|||
field=models.DecimalField(decimal_places=2, default=0, max_digits=7, verbose_name='Débit (non compte)'), |
|||
), |
|||
migrations.RunPython(update, reverse) |
|||
] |
|||
Loading…
Reference in new issue