diff --git a/functions/functions_livraisons.php b/functions/functions_livraisons.php index 5b2e762..d33fef6 100644 --- a/functions/functions_livraisons.php +++ b/functions/functions_livraisons.php @@ -661,9 +661,16 @@ function calcLivraisonTotalLegumes($legumes) { $tot["legumes"][$l['ref']]["quantite"] = 0.0; $tot["legumes"][$l['ref']]["montant"] = 0.0; } + + // QUANTITE $tot["legumes"][$l['ref']]["quantite"] += floatval($l["quantite"]) * floatval($p['nb']); + $tot["legumes"][$l['ref']]['quantite_print'] = floatval($tot["legumes"][$l['ref']]['quantite'])." ".$tot["legumes"][$l['ref']]['tarif_unite_acro']; + if($tot["legumes"][$l['ref']]["tarif_unite"]=="kg" && floatval($tot["legumes"][$l['ref']]["quantite"])*1000<1000) $tot["legumes"][$l['ref']]['quantite_print'] = (floatval($tot["legumes"][$l['ref']]["quantite"])*1000)." g"; + + // MONTANT $tot["legumes"][$l['ref']]["montant"] += floatval($l["tarif_prix"]) * floatval($l["quantite"]) * floatval($p['nb']); + // TOTAL $tot["montant"] += floatval($l["tarif_prix"]) * floatval($l["quantite"]) * floatval($p['nb']); } } diff --git a/public_html_admin/css/livraisons.css b/public_html_admin/css/livraisons.css index f05ecf4..f0d4677 100644 --- a/public_html_admin/css/livraisons.css +++ b/public_html_admin/css/livraisons.css @@ -104,7 +104,8 @@ .formLivraison table.panier tr.legume > td.quantite { text-align: right; width: 80px; } .formLivraison .tabLegumes table.panier tr.legume > td.quantite, -#modalViewLivraison .formLivraison table.panier tr.legume td.quantite { text-align: center; } +#modalViewLivraison .formLivraison table.panier tr.legume td.quantite, +body.print .formLivraison table.panier tr.legume td.quantite { text-align: center; } .formLivraison table.panier tr.legume td.unite { width: 40px; } diff --git a/public_html_admin/js/livraisons.js b/public_html_admin/js/livraisons.js index b6289f6..fb12230 100644 --- a/public_html_admin/js/livraisons.js +++ b/public_html_admin/js/livraisons.js @@ -498,8 +498,6 @@ function modalFormLivraison_addPanierTypeCompo(modal, datas) { thead.append(trH); table.append(thead); - btnAddLegume.click(function(e) { e.preventDefault(); $(this).blur(); modalFormLivraison_addPanierTypeCompoLegume(modal, table, "new"); }); - // LEGUMES var tbody = $(""); var trNull = $("aucun légume"); @@ -511,6 +509,13 @@ function modalFormLivraison_addPanierTypeCompo(modal, datas) { } else trNull.removeClass("hide"); + // INIT BTN ADD + btnAddLegume.click(function(e) { + e.preventDefault(); $(this).blur(); + if(tbody.find("tr.editing").length>0) return; + modalFormLivraison_addPanierTypeCompoLegume(modal, table, "new"); + }); + modal.find("div.tabCompo").append(table); } @@ -603,23 +608,21 @@ function modalFormLivraison_addPanierTypeCompoLegume(modal, panier, datas) { if(ref>0 && tarif_ref>0) { var td = ipt.parent(); var tr = td.parent(); - tr.attr("ref", ref); + tr.attr("ref", ref).removeClass("editing"); td.html( val ).attr('ref', ref); modalFormLivraison_loadPanierTypeCompoLegumeTarif(tr, tarif_ref, tarif_prix, tarif_unite); tr.find("td.quantite").dblclick(); } - else { - beep(50, 800, null, "square"); - ipt.focus(); - } } ); ipt.select(); }); tdQ.dblclick(function(e) { + e.preventDefault(); val = $(this).html(); unite = $(this).attr("unite"); if(unite in legumeTarifUnitesAccronymes) { + if($(this).parent().hasClass("editing")) return; $(this).parent().addClass("editing"); var ipt = $(""); $(this).html("").append(ipt); @@ -765,7 +768,7 @@ function modalFormLivraison_updateTotalLegumes(modal) { trL = $(""); tdNom = $("").html(l.nom); tdTarif = $("").html(number_format(l.tarif_prix,2)+" €/"+unite); - tdQ = $("").html( round_number(l.quantite,3)+" "+unite ); + tdQ = $("").html( number_format(l.quantite, 2)+" "+unite ); tdMontant = $("").html(number_format((l.quantite * l.tarif_prix),2)+" €"); trL.append(tdNom).append(tdTarif).append(tdQ).append(tdMontant);