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 ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + 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 ''; } else { - print "\n"; + print '\n"; } - print ''; - print ''; + print ''; + + print '\n"; + + print ''; + if ($objp->remise_percent > 0) { print '\n"; @@ -253,13 +266,15 @@ if ($_GET["id"] > 0) { print ''; } - print '\n"; + + print '\n"; + print ''; - print ""; + print ''; $i++; } - $db->free($result); + $db->free($resql); } else {
'.$langs->trans("Description").''.$langs->trans("VAT").''.$langs->trans("Qty").''.$langs->trans("Discount").''.$langs->trans("PriceU").'  '.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('Qty').''.$langs->trans('Discount').''.$langs->trans('AmountHT').'  
'; - print ''.img_object($langs->trans("ShowProduct"),"product").' '.stripslashes(nl2br($objp->description)).''; + 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 '
".stripslashes(nl2br($objp->description))."'.stripslashes(nl2br($objp->description)); + print "'.$objp->tva_tx.'%'.$objp->qty.''.$objp->tva_tx.'%'.price($objp->subprice)."'.$objp->qty.''.$objp->remise_percent."% '.price($objp->subprice)."'.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."