diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 382367fac4c..a7394b7f934 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -77,7 +77,8 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece $prod = "product_".$reg[1]; $qty = "qty_".$reg[1]; $ent = "entrepot_".$reg[1]; - $result = $commande->DispatchProduct($user, $_POST[$prod], $_POST[$qty], $_POST[$ent]); + $pu = "pu_".$reg[1]; + $result = $commande->DispatchProduct($user, $_POST[$prod], $_POST[$qty], $_POST[$ent], $_POST[$pu]); } } @@ -205,7 +206,7 @@ if ($id > 0) $db->free($resql); } - $sql = "SELECT l.ref,l.fk_product,l.description,l.price,sum(l.qty) as qty"; + $sql = "SELECT l.ref,l.fk_product,l.description,(sum(l.price * l.qty) / sum(l.qty)) as price, sum(l.qty) as qty"; $sql.= ", l.rowid"; $sql.= ", p.label"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; @@ -244,6 +245,7 @@ if ($id > 0) print ' - '.$objp->label; if ($objp->description) print '
'.nl2br($objp->description); print ''; + print ''; print "\n"; print ''.$objp->qty.'';