Manu 1 2 4 5 7 fini avec combo année
This commit is contained in:
@@ -35,12 +35,58 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3">
|
||||
<!-- Bloc droite : Sélecteur d'année (Plus-value), Sélecteur de société, Boutons -->
|
||||
<div class="flex items-center gap-4">
|
||||
<!-- Formulaire combiné / Filtre Année + Société -->
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ url_for('main.gestion_ordres') }}"
|
||||
class="flex items-center gap-2 m-0"
|
||||
>
|
||||
<!-- Conserver la société active lors du changement d'année -->
|
||||
<input
|
||||
type="hidden"
|
||||
name="societe_id"
|
||||
value="{{ selected_societe_id }}"
|
||||
/>
|
||||
|
||||
<!-- Combo des Années + Total -->
|
||||
<div
|
||||
class="bg-gray-950 border border-gray-800 px-3 py-1.5 rounded-lg text-xs flex items-center gap-2"
|
||||
>
|
||||
<span class="text-gray-400">P.V. (</span>
|
||||
<select
|
||||
name="annee"
|
||||
class="bg-gray-800 border border-gray-700 text-white text-xs rounded px-2 py-1 focus:outline-none focus:border-blue-500 font-semibold"
|
||||
onchange="this.form.submit()"
|
||||
>
|
||||
<!-- prettier-ignore -->
|
||||
<option value="tout" {% if not selected_annee or selected_annee|string == "tout" %}selected{% endif %}>Tout</option>
|
||||
{% for an in range(2020, 2041) %}
|
||||
<!-- prettier-ignore -->
|
||||
<option value="{{ an }}" {% if selected_annee|string == an|string %}selected{% endif %}>{{ an }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<span class="text-gray-400">) :</span>
|
||||
<span
|
||||
class="font-bold {% if total_plus_value_globale >= 0 %}text-emerald-400{% else %}text-rose-400{% endif %}"
|
||||
>
|
||||
{{ "{:,.2f}".format(total_plus_value_globale or 0) }} €
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ url_for('main.gestion_ordres') }}"
|
||||
class="m-0"
|
||||
>
|
||||
<!-- Conserver l'année active lors du changement de société -->
|
||||
<input
|
||||
type="hidden"
|
||||
name="annee"
|
||||
value="{{ selected_annee if selected_annee else 'tout' }}"
|
||||
/>
|
||||
<select
|
||||
name="societe_id"
|
||||
class="bg-gray-800 border border-gray-700 text-white text-sm rounded-lg px-3 py-2 focus:outline-none focus:border-blue-500"
|
||||
@@ -158,10 +204,10 @@
|
||||
</td>
|
||||
|
||||
{% if groupe.total_quantite != 0 %} {% set total_prix_net_moyen =
|
||||
groupe.total_eng_net / groupe.total_quantite %} {% set
|
||||
total_prix_brut_moyen = groupe.total_eng_brut /
|
||||
groupe.total_quantite %} {% set total_frais_moyen =
|
||||
total_prix_net_moyen - total_prix_brut_moyen %}
|
||||
(groupe.total_eng_net / groupe.total_quantite) | abs %} {% set
|
||||
total_prix_brut_moyen = (groupe.total_eng_brut /
|
||||
groupe.total_quantite) | abs %} {% set total_frais_moyen =
|
||||
(total_prix_net_moyen - total_prix_brut_moyen) | abs %}
|
||||
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(total_prix_brut_moyen) }}
|
||||
@@ -173,23 +219,23 @@
|
||||
{{ "{:,.3f}".format(total_prix_net_moyen) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut) }}
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net) }}
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net | abs) }}
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">-</td>
|
||||
<td class="py-2.5 px-3">
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut) }}
|
||||
{{ "{:,.3f}".format(groupe.total_eng_brut | abs) }}
|
||||
</td>
|
||||
<td class="py-2.5 px-3">
|
||||
<span
|
||||
class="{% if groupe.total_eng_net >= 0 %}text-emerald-400{% else %}text-rose-400{% endif %}"
|
||||
>
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net) }}
|
||||
{{ "{:,.3f}".format(groupe.total_eng_net | abs) }}
|
||||
</span>
|
||||
</td>
|
||||
{% endif %}
|
||||
@@ -239,6 +285,13 @@
|
||||
action="{{ url_for('main.creer_ordre_traitement') }}"
|
||||
class="space-y-4"
|
||||
>
|
||||
<!-- Transmettre dynamiquement l'année active dans le formulaire de la modale -->
|
||||
<input
|
||||
type="hidden"
|
||||
name="annee"
|
||||
value="{{ selected_annee if selected_annee else 'tout' }}"
|
||||
/>
|
||||
|
||||
<!-- Bloc ISIN -->
|
||||
<div>
|
||||
<label class="text-xs text-gray-400">Code ISIN</label>
|
||||
@@ -366,18 +419,24 @@
|
||||
|
||||
<!-- Aperçu dynamique des calculs en temps réel -->
|
||||
<div
|
||||
class="bg-gray-950 p-3 rounded-xl border border-gray-800 text-xs grid grid-cols-2 gap-2 text-gray-300"
|
||||
class="bg-gray-950 p-3 rounded-xl border border-gray-800 text-xs grid grid-cols-3 gap-2 text-gray-300"
|
||||
>
|
||||
<div>
|
||||
Total Frais :
|
||||
<span id="apercu-frais" class="text-amber-400 font-semibold"
|
||||
>0.000</span
|
||||
>0.0000</span
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
Prix Net :
|
||||
<span id="apercu-prix-net" class="text-emerald-400 font-semibold"
|
||||
>0.000</span
|
||||
>0.0000</span
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
Eng. Net :
|
||||
<span id="apercu-eng-net" class="text-blue-400 font-semibold"
|
||||
>0.00</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -453,7 +512,7 @@
|
||||
calculerTotauxModal();
|
||||
});
|
||||
|
||||
// Calcul dynamique : Prix Net unitaire = Prix Brut + Frais Totaux
|
||||
// Calcul dynamique : Prix Net unitaire = Prix Brut +/- Frais Totaux
|
||||
function calculerTotauxModal() {
|
||||
const quantite =
|
||||
parseFloat(document.getElementById("input-quantite").value) || 0;
|
||||
@@ -483,7 +542,7 @@
|
||||
// Engagement Net = Prix Net * Quantité
|
||||
const engNet = quantite * prixNet;
|
||||
|
||||
// Mise à jour des éléments dans le DOM (adaptez les IDs selon vos balises HTML)
|
||||
// Mise à jour des éléments dans le DOM
|
||||
document.getElementById("apercu-frais").textContent = totalFrais.toFixed(4);
|
||||
document.getElementById("apercu-prix-net").textContent = prixNet.toFixed(4);
|
||||
const apercuEngNet = document.getElementById("apercu-eng-net");
|
||||
@@ -552,7 +611,8 @@
|
||||
const btnValider = document.getElementById("btn-valider");
|
||||
|
||||
modal.classList.remove("hidden");
|
||||
form.action = `/ordre/${ordreId}/ajouter-ligne`;
|
||||
const anneeActive = "{{ selected_annee if selected_annee else 'tout' }}";
|
||||
form.action = `/ordre/${ordreId}/ajouter-ligne?annee=${anneeActive}`;
|
||||
title.innerHTML =
|
||||
'<i class="fa-solid fa-plus text-emerald-500"></i> Ajouter une ligne à l\'ordre';
|
||||
|
||||
@@ -603,7 +663,8 @@
|
||||
const btnValider = document.getElementById("btn-valider");
|
||||
|
||||
modal.classList.remove("hidden");
|
||||
form.action = `/modifier-ligne-ordre/${piedId}`;
|
||||
const anneeActive = "{{ selected_annee if selected_annee else 'tout' }}";
|
||||
form.action = `/modifier-ligne-ordre/${piedId}?annee=${anneeActive}`;
|
||||
title.innerHTML =
|
||||
'<i class="fa-solid fa-pen text-blue-500"></i> Modifier la ligne d\'ordre';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user