diff --git a/app.py b/app.py index d0b9d9a..c808d61 100644 --- a/app.py +++ b/app.py @@ -1252,14 +1252,13 @@ def jobs(): conn = get_db() jobs = conn.execute(''' SELECT j.*, c.name as client_name, m.name as material_name, - ps.status as slot_status, ps.planned_start + COALESCE(j.cout_fixe, 0) + COALESCE(j.total_marge, 0) as prix_ht_piece FROM jobs j LEFT JOIN clients c ON j.client_id=c.id LEFT JOIN materials m ON j.material_id=m.id - LEFT JOIN print_slots ps ON ps.job_id=j.id AND ps.id=( - SELECT id FROM print_slots WHERE job_id=j.id ORDER BY planned_start LIMIT 1) ORDER BY j.created_at DESC''').fetchall() + clients = conn.execute('SELECT id, name FROM clients ORDER BY name').fetchall() conn.close() - return render_template('jobs.html', jobs=jobs) + return render_template('jobs.html', jobs=jobs, clients=clients) @app.route('/jobs/new', methods=['GET','POST']) def new_job(): diff --git a/templates/job_detail.html b/templates/job_detail.html index e52d15a..fb300ad 100644 --- a/templates/job_detail.html +++ b/templates/job_detail.html @@ -82,6 +82,7 @@ {% endif %}
| Date | Nom | Client | Réf. plateau | Poids | -Durée | Design | Marge brute | Total marge | Remise | -Prix final | + | Date | +Nom | +Client | +Matiere | +Poids | +Duree | +Prix HT | +Prix final | +|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ j.created_at[:10] }} | -{{ j.name }} | -{{ j.client_name or '—' }} | -{{ j.plate_name or '—' }} | -{{ j.weight_g }} g | -{{ j.print_time_s | fmt_time }} | -×{{ j.design_multiplier }} | -{{ j.gross_margin_pct }}% | -{% if j.total_marge %}{{ '%.2f'|format(j.total_marge) }} € {% if j.marge_pct_on_ht %}{{ j.marge_pct_on_ht }}% du HT{% endif %}{% else %}—{% endif %} |
- - {% if j.discount_pct > 0 %} - -{{ j.discount_pct }}% - {% else %}—{% endif %} + {% set pieces = j.pieces_per_plate or 1 %} + {% set qty = j.order_qty or 1 %} + {% set prix_ht = j.prix_ht_piece or 0 %} + {% set poids_piece = j.weight_g / pieces %} + | |||||||||||
| {{ j.created_at[:10] }} | +
+ {{ j.name }}
+ {% if j.plate_name %} {{ j.plate_name }}{% endif %} |
- {{ j.final_price }} € | -+ | {{ j.client_name or '--' }} | ++ {% if j.material_name %}{{ j.material_name }}{% else %}--{% endif %} + | +
+ {{ j.weight_g }} g
+ {% if pieces > 1 %}
+ {{ '%.1f'|format(poids_piece) }} g/pce x{{ pieces }} + {% else %} + {{ '%.1f'|format(poids_piece) }} g/pce + {% endif %} + |
+ {{ j.print_time_s | fmt_time }} | +
+ {% if prix_ht > 0 %}
+ {{ '%.2f'|format(prix_ht) }} € /pce
+ {% if qty > 1 %}
+ {{ '%.2f'|format(prix_ht * qty) }} € x{{ qty }} + {% endif %} + {% else %}--{% endif %} + |
+
+ {{ '%.2f'|format(j.final_price or 0) }} €
+ {% if j.discount_pct and j.discount_pct > 0 %}
+ -{{ j.discount_pct }}%
+ {% endif %}
+ {% if qty > 1 %}
+ {{ '%.2f'|format((j.final_price or 0) * qty) }} € tot. + {% endif %} + |
+
{% if j.client_token %}
+ class="btn btn-sm btn-outline-success py-0" title="Portail client">
{% endif %}
- →
+ →
|
Aucune commande ne correspond aux filtres.
+Aucune commande enregistrée.
- Créer le premier calcul +Aucune commande enregistree.
+ Creer le premier calcul