diff --git a/htdocs/compta/facture.php3 b/htdocs/compta/facture.php3
index d1a9b158a09..630c4ef11fa 100644
--- a/htdocs/compta/facture.php3
+++ b/htdocs/compta/facture.php3
@@ -348,8 +348,12 @@ else
/* *************************************************************************** */
{
- if ($facid > 0) {
+ if ($facid > 0)
+ {
+ $fac = New Facture($db);
+ $fac->fetch($facid);
+
$sql = "SELECT s.nom as socnom, s.idp as socidp, f.facnumber, f.amount, f.total, ".$db->pdate("f.datef")." as df, f.paye, f.fk_statut as statut, f.fk_user_author, f.note";
$sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.rowid = $facid";
@@ -400,11 +404,11 @@ else
print "
| Auteur | $author->fullname | ";
print '
| Montant | ';
- print ''.price($obj->amount).' | ';
+ print ''.price($fac->total_ht).' | ';
print 'euros HT |
';
- print '| TVA | '.tva($obj->amount).' | ';
+ print '
| TVA | '.price($fac->total_tva).' | ';
print 'euros |
';
- print '| Total | '.price($obj->total).' | ';
+ print '
| Total | '.price($fac->total_ttc).' | ';
print 'euros TTC |
';
print "";
@@ -854,7 +858,7 @@ else
$sql .= " AND date_format(f.datef, '%Y') = $year";
}
- $sql .= " ORDER BY $sortfield $sortorder ";
+ $sql .= " ORDER BY $sortfield $sortorder, rowid DESC ";
$sql .= $db->plimit($limit + 1,$offset);
$result = $db->query($sql);
@@ -875,66 +879,73 @@ else
print ' | ';
print "\n";
- if ($num > 0) {
- $var=True;
- while ($i < $num) {
- $objp = $db->fetch_object( $i);
- $var=!$var;
-
- print "";
- print "| facid\">";
- if ($objp->paye)
+ if ($num > 0)
+ {
+ $var=True;
+ while ($i < min($num,$limit))
{
- print $objp->facnumber;
- }
- else
- {
- print ''.$objp->facnumber.'';
- }
- print " | \n";
- print "idp\">$objp->nom | \n";
-
- if ($objp->df > 0 ) {
- print "";
- $y = strftime("%Y",$objp->df);
- $m = strftime("%m",$objp->df);
+ $objp = $db->fetch_object( $i);
+ $var=!$var;
- print strftime("%d",$objp->df)."\n";
- print " ";
- print strftime("%B",$objp->df)."\n";
- print " ";
- print strftime("%Y",$objp->df)." | \n";
- } else {
- print "!!! | \n";
+ print "
";
+ print "| facid\">";
+ if ($objp->paye)
+ {
+ print $objp->facnumber;
+ }
+ else
+ {
+ print ''.$objp->facnumber.'';
+ }
+ print " | \n";
+ print "idp\">$objp->nom | \n";
+
+ if ($objp->df > 0 )
+ {
+ print "";
+ $y = strftime("%Y",$objp->df);
+ $m = strftime("%m",$objp->df);
+
+ print strftime("%d",$objp->df)."\n";
+ print " ";
+ print strftime("%B",$objp->df)."\n";
+ print " ";
+ print strftime("%Y",$objp->df)." | \n";
+ }
+ else
+ {
+ print "!!! | \n";
+ }
+
+ print "".price($objp->amount)." | \n";
+
+ if (! $objp->paye)
+ {
+ print 'impayée | ';
+ }
+ else
+ {
+ print ' | ';
+ }
+
+ print "
\n";
+ $i++;
+ $j++;
+
+ }
}
+ if ($i == 0) { $i=1; } if ($j == 0) { $j=1; }
- print "".price($objp->amount)." | \n";
-
- if (! $objp->paye)
- {
- print 'impayée | ';
- }
- else
- {
- print ' | ';
- }
-
- print "\n";
- $i++;
- $j++;
-
- }
+ print "";
+ $db->free();
}
- if ($i == 0) { $i=1; } if ($j == 0) { $j=1; }
-
- print "";
- $db->free();
- } else {
- print $db->error();
- }
-
+ else
+ {
+ print $db->error();
+ }
+
}
-
+
}
$db->close();