diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index f31c3b57936..46e9fb50e38 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -20,6 +20,7 @@
*
*/
require("./pre.inc.php");
+require("./paiementfourn.class.php");
/*
* Sécurité accés client
@@ -44,6 +45,17 @@ if ($action == 'payed')
$result = $db->query( $sql);
}
+if($_GET["action"] == 'deletepaiement')
+{
+ $facfou = new FactureFourn($db);
+ $facfou->fetch($_GET["facid"]);
+ if ($facfou->statut == 1 && $facfou->paye == 0 && $user->societe_id == 0)
+ {
+ $paiementfourn = new PaiementFourn($db);
+ $paiementfourn->delete($_GET["paiement_id"]);
+ }
+}
+
if ($HTTP_POST_VARS["action"] == 'modif_libelle')
{
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn set libelle = '$form_libelle' WHERE rowid = $facid ;";
@@ -407,28 +419,43 @@ else
print "
";
print "| Date | ";
print "Type | ";
- print "Montant | | ";
- print "
\n";
+
+ if ($obj->statut == 1 && $obj->paye == 0 && $user->societe_id == 0)
+ {
+ $tdsup=' colspan="2"';
+ }
+ print "Montant | | ";
+ print "\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object( $i);
$var=!$var;
- print "";
- print "| ".strftime("%d %B %Y",$objp->dp)." | \n";
- print "$objp->paiement_type $objp->num_paiement | \n";
- print "".price($objp->amount)." | $_MONNAIE | \n";
+ print "
";
+ print "| ".strftime("%d %B %Y",$objp->dp)." | \n";
+ print "$objp->paiement_type $objp->num_paiement | \n";
+ print "".price($objp->amount)." | $_MONNAIE | \n";
+
+ if ($obj->statut == 1 && $obj->paye == 0 && $user->societe_id == 0)
+ {
+ print '';
+ print '';
+ print img_delete();
+ print ' | ';
+ }
+
print "
";
$total = $total + $objp->amount;
$i++;
}
- print "| Total : | ".price($total)." | $_MONNAIE |
\n";
+ print "| Total : | ".price($total)." | $_MONNAIE |
\n";
- $resteapayer = $fac->total_ttc - $total;
+ $resteapayer = abs($fac->total_ttc - $total);
print "| Reste a payer : | ";
- print ''.price($resteapayer)." | $_MONNAIE |
\n";
+ print ''.price($resteapayer)." | $_MONNAIE | ";
+ print "\n";
print "";
$db->free();
@@ -502,9 +529,9 @@ else
print '- | ';
}
- if ($obj->statut == 1 && abs(round($resteapayer == 0)) && $obj->paye == 0 && $user->societe_id == 0)
+ if ($obj->statut == 1 && round($resteapayer) == 0 && $obj->paye == 0 && $user->societe_id == 0)
{
- print "Classer 'Payée' | ";
+ print "Classer 'Payée' | ";
}
else
{