diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index aeb14010ab0..e120cacdb79 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1466,7 +1466,7 @@ else
}
print '';
print '
';
- print $html->select_tva("tva_tx",$objp->tva_taux);
+ print $html->select_tva('tva_tx',$objp->tva_taux);
print ' | ';
print ' | ';
print ' | ';
@@ -1661,7 +1661,6 @@ else
$i = 0; $total = 0;
print '
';
print_titre($langs->trans('RelatedCommercialProposals'));
-
print '';
print '';
print '| '.$langs->trans('Ref').' | ';
@@ -1690,7 +1689,54 @@ else
{
dolibarr_print_error($db);
}
+ print '';
+ /*
+ * Commandes rattachées
+ */
+ if($conf->commande->enabled)
+ {
+ $sql = 'SELECT '.$db->pdate('c.date_commande').' as date_commande, c.total_ht, c.ref, c.ref_client, c.rowid as id';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'co_fa as co_fa WHERE co_fa.fk_commande = c.rowid AND co_fa.fk_facture = '.$fac->id;
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ if ($num)
+ {
+ $i = 0; $total = 0;
+ print ' ';
+ print_titre($langs->trans('RelatedOrders'));
+ print '';
+ print '';
+ print '| '.$langs->trans('Ref').' | ';
+ print ''.$langs->trans('RefCdeClient').' | ';
+ print ''.$langs->trans('Date').' | ';
+ print ''.$langs->trans('AmountHT').' | ';
+ print ' ';
+ $var=true;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+ $var=!$var;
+ print '| ';
+ print ''.img_object($langs->trans('ShowOrder'), 'order').' '.$objp->ref." | \n";
+ print ''.$objp->ref_client.' | ';
+ print ''.dolibarr_print_date($objp->date_commande).' | ';
+ print ''.price($objp->total_ht).' | ';
+ print " \n";
+ $total = $total + $objp->total_ht;
+ $i++;
+ }
+ print '| | | '.$langs->trans('TotalHT').' | '.price($total).' | ';
+ print ' ';
+ }
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+ }
print ' | ';
/*
|