diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 4546a0a727f..dc77ef21ec9 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -580,10 +580,6 @@ else
print '
'.$langs->trans("Currency".$conf->monnaie).' | ';
print '
';
- if ($commande->brouillon == 1 && $user->rights->commande->creer)
- {
- print '';
- }
/*
* Lignes de commandes
diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php
index e14162d824d..84a884fddb2 100644
--- a/htdocs/compta/commande/fiche.php
+++ b/htdocs/compta/commande/fiche.php
@@ -18,7 +18,6 @@
*
* $Id$
* $Source$
- *
*/
/**
@@ -191,60 +190,74 @@ if ($_GET["id"] > 0)
print ''.$langs->trans("Currency".$conf->monnaie).' | ';
print '| '.$langs->trans("GlobalDiscount").' | ';
- print $commande->remise_percent.' % | ';
+ print $commande->remise_percent.'% | ';
print ' |
';
print '| '.$langs->trans("VAT").' | '.price($commande->total_tva).' | ';
print ''.$langs->trans("Currency".$conf->monnaie).' |
';
print '| '.$langs->trans("TotalTTC").' | '.price($commande->total_ttc).' | ';
print ''.$langs->trans("Currency".$conf->monnaie).' |
';
- print "\n";
+
+ print '
';
/*
* Lignes de commandes
*
*/
- echo '
';
+ $sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,';
+ $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
+ $sql.= ' FROM '.MAIN_DB_PREFIX."commandedet as l";
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
+ $sql.= " WHERE l.fk_commande = ".$commande->id;
+ $sql.= " ORDER BY l.rowid";
- $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice";
- $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l WHERE l.fk_commande =".$commande->id." ORDER BY l.rowid";
-
- $result = $db->query($sql);
- if ($result)
+ $resql = $db->query($sql);
+ if ($resql)
{
- $num = $db->num_rows($result);
+ $num = $db->num_rows($resql);
$i = 0; $total = 0;
+ print '';
if ($num)
{
print '';
- print '| '.$langs->trans("Description").' | ';
- print ''.$langs->trans("VAT").' | ';
- print ''.$langs->trans("Qty").' | ';
- print ''.$langs->trans("Discount").' | ';
- print ''.$langs->trans("PriceU").' | ';
- print ' | | ';
+ print ''.$langs->trans('Description').' | ';
+ print ''.$langs->trans('VAT').' | ';
+ print ''.$langs->trans('PriceUHT').' | ';
+ print ''.$langs->trans('Qty').' | ';
+ print ''.$langs->trans('Discount').' | ';
+ print ''.$langs->trans('AmountHT').' | ';
+ print ' | | ';
print "
\n";
}
$var=true;
while ($i < $num)
{
- $objp = $db->fetch_object($result);
+ $objp = $db->fetch_object($resql);
$var=!$var;
- print "";
+ print '
';
if ($objp->fk_product > 0)
{
- print '| ';
- print ''.img_object($langs->trans("ShowProduct"),"product").' '.stripslashes(nl2br($objp->description)).' | ';
+ print '';
+ if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
+ else print img_object($langs->trans('ShowProduct'),'product');
+ print ' '.$objp->ref.' - '.stripslashes(nl2br($objp->product));
+ print ($objp->description && $objp->description!=$objp->product)?' '.$objp->description:'';
+ print ' | ';
}
else
{
- print "".stripslashes(nl2br($objp->description))." | \n";
+ print ''.stripslashes(nl2br($objp->description));
+ print " | \n";
}
- print ''.$objp->tva_tx.'% | ';
- print ''.$objp->qty.' | ';
+ print ''.$objp->tva_tx.'% | ';
+
+ print ''.price($objp->subprice)." | \n";
+
+ print ''.$objp->qty.' | ';
+
if ($objp->remise_percent > 0)
{
print ''.$objp->remise_percent."% | \n";
@@ -253,13 +266,15 @@ if ($_GET["id"] > 0)
{
print ' | ';
}
- print ''.price($objp->subprice)." | \n";
+
+ print ''.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)." | \n";
+
print ' | | ';
- print "
";
+ print '';
$i++;
}
- $db->free($result);
+ $db->free($resql);
}
else
{