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 ''; @@ -1690,7 +1689,54 @@ else { dolibarr_print_error($db); } + print '
'.$langs->trans('Ref').''; + /* + * 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 ''; + print ''; + print ''; + print ''; + print ''; + $var=true; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print '\n"; + print ''; + print ''; + print ''; + print "\n"; + $total = $total + $objp->total_ht; + $i++; + } + print ''; + print '
'.$langs->trans('Ref').''.$langs->trans('RefCdeClient').''.$langs->trans('Date').''.$langs->trans('AmountHT').'
'; + print ''.img_object($langs->trans('ShowOrder'), 'order').' '.$objp->ref."'.$objp->ref_client.''.dolibarr_print_date($objp->date_commande).''.price($objp->total_ht).'
  '.$langs->trans('TotalHT').''.price($total).'
'; + } + } + else + { + dolibarr_print_error($db); + } + } print '
'; /*