1 |
<?php |
<?php |
2 |
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> |
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> |
3 |
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> |
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> |
4 |
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> |
5 |
* |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
360 |
$sql = "SELECT l.ref, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; |
$sql = "SELECT l.ref, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice"; |
361 |
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l "; |
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l "; |
362 |
$sql .= " WHERE l.fk_commande = $commande->id ORDER BY l.rowid"; |
$sql .= " WHERE l.fk_commande = $commande->id ORDER BY l.rowid"; |
363 |
|
|
364 |
$resql = $db->query($sql); |
$resql = $db->query($sql); |
365 |
if ($resql) |
if ($resql) |
366 |
{ |
{ |
448 |
if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer) |
if ($_GET["action"] <> 'valid' && $commande->statut == 0 && $user->rights->fournisseur->commande->creer) |
449 |
{ |
{ |
450 |
$sql = "SELECT p.rowid,p.label,p.ref "; |
$sql = "SELECT p.rowid,p.label,p.ref "; |
451 |
$sql .=" , pf.price"; |
$sql .=" , (pf.price / pf.quantity) as priceunit"; |
452 |
$sql .= " FROM ".MAIN_DB_PREFIX."product as p "; |
$sql .= " FROM ".MAIN_DB_PREFIX."product as p "; |
453 |
$sql .= " , ".MAIN_DB_PREFIX."product_fournisseur_price as pf "; |
$sql .= " , ".MAIN_DB_PREFIX."product_fournisseur_price as pf "; |
454 |
$sql .= " WHERE p.rowid = pf.fk_product AND pf.fk_soc = ".$commande->fourn_id; |
$sql .= " WHERE p.rowid = pf.fk_product AND pf.fk_soc = ".$commande->fourn_id; |
|
$sql .= " AND quantity = 1"; |
|
455 |
$sql .= " ORDER BY p.ref "; |
$sql .= " ORDER BY p.ref "; |
456 |
$resql = $db->query($sql); |
$resql = $db->query($sql); |
457 |
if ($resql) |
if ($resql) |
464 |
while ($i < $num) |
while ($i < $num) |
465 |
{ |
{ |
466 |
$objp = $db->fetch_object($resql); |
$objp = $db->fetch_object($resql); |
467 |
$opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->price</option>\n"; |
$opt .= "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->priceunit</option>\n"; |
468 |
$i++; |
$i++; |
469 |
} |
} |
470 |
} |
} |