feat: add plate_name and total_marge/marge_pct_on_ht columns to jobs list
Deploy via Portainer / deploy (push) Successful in 0s

This commit is contained in:
Jo
2026-07-07 13:46:34 +02:00
parent f51a78940f
commit b4debbd6a0
2 changed files with 8 additions and 8 deletions
+3 -2
View File
@@ -269,6 +269,7 @@ def init_db():
'ALTER TABLE materials ADD COLUMN total_wasted_g REAL DEFAULT 0',
'ALTER TABLE jobs ADD COLUMN client_token TEXT DEFAULT NULL',
'ALTER TABLE jobs ADD COLUMN plate_name TEXT DEFAULT ""',
'ALTER TABLE jobs ADD COLUMN marge_pct_on_ht REAL DEFAULT 0',
'ALTER TABLE printers ADD COLUMN ha_entity_prefix TEXT DEFAULT ""',
'ALTER TABLE print_slots ADD COLUMN pieces_ignored INTEGER DEFAULT 0',
'ALTER TABLE print_slots ADD COLUMN pieces_override INTEGER DEFAULT NULL',
@@ -1249,7 +1250,7 @@ def new_job():
weight_g,print_time_s,design_multiplier,gross_margin_pct,discount_pct,
pieces_per_plate,order_qty,
material_cost,material_margin,design_cost,handling_cost,wear_cost,electricity_cost,
cout_fixe,total_marge,subtotal,margin_amount,
cout_fixe,total_marge,subtotal,margin_amount,marge_pct_on_ht,
cotisations_amount,vfl_amount,tva_amount,other_taxes_amount,tax_amount,
price_per_piece,final_price,notes)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
@@ -1259,7 +1260,7 @@ def new_job():
pieces_per_plate,order_qty,
r['material_cost'],r['material_margin'],r['design_cost'],r['handling_cost'],
r['wear_cost'],r['electricity_cost'],
r['cout_fixe'],r['total_marge'],r['subtotal'],r['margin_amount'],
r['cout_fixe'],r['total_marge'],r['subtotal'],r['margin_amount'],r['marge_pct_on_ht'],
r['cotisations_amount'],r['vfl_amount'],r['tva_amount'],r['other_taxes_amount'],
r['tax_amount'],r['final_price'],round(r['final_price'],2),
request.form.get('notes','')))
+5 -6
View File
@@ -21,8 +21,8 @@
<table class="table table-hover mb-0">
<thead class="table-light">
<tr>
<th>Date</th><th>Nom</th><th>Client</th><th>Poids</th>
<th>Durée</th><th>Design</th><th>Marge</th><th>Remise</th>
<th>Date</th><th>Nom</th><th>Client</th><th>Réf. plateau</th><th>Poids</th>
<th>Durée</th><th>Design</th><th>Marge brute</th><th>Total marge</th><th>Remise</th>
<th class="text-end">Prix final</th><th></th>
</tr>
</thead>
@@ -32,10 +32,12 @@
<td class="text-muted small">{{ j.created_at[:10] }}</td>
<td><a href="{{ url_for('job_detail', id=j.id) }}" class="text-decoration-none fw-semibold">{{ j.name }}</a></td>
<td>{{ j.client_name or '—' }}</td>
<td class="text-muted small">{{ j.plate_name or '—' }}</td>
<td>{{ j.weight_g }} g</td>
<td>{{ j.print_time_s | fmt_time }}</td>
<td><span class="badge bg-light text-dark">×{{ j.design_multiplier }}</span></td>
<td><span class="badge bg-light text-dark">{{ j.gross_margin_pct }}%</span></td>
<td class="text-nowrap small">{% if j.total_marge %}{{ '%.2f'|format(j.total_marge) }} €<br><span class="text-muted">{% if j.marge_pct_on_ht %}{{ j.marge_pct_on_ht }}% du HT{% endif %}</span>{% else %}—{% endif %}</td>
<td>
{% if j.discount_pct > 0 %}
<span class="badge bg-danger">-{{ j.discount_pct }}%</span>
@@ -69,7 +71,4 @@
<p class="mt-2">Aucune commande enregistrée.</p>
<a href="{{ url_for('new_job') }}" class="btn btn-sm" style="background:#ff6b35;color:#fff">Créer le premier calcul</a>
</div>
{% endif %}
</div>
</div>
{% endblock %}