diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php
index d0cd508be9b..4f8fca43f72 100644
--- a/htdocs/compta/sociales/index.php
+++ b/htdocs/compta/sociales/index.php
@@ -37,13 +37,15 @@ function valeur($sql)
}
return $valeur;
}
+
+
/*
*
*/
if ($action == 'add')
{
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech,amount) ";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, amount) ";
$sql .= " VALUES ($type,'$libelle','$date',$amount);";
if (! $db->query($sql) )
@@ -52,22 +54,38 @@ if ($action == 'add')
}
}
-print_titre("Charges sociales $year");
+if ($_GET["action"] == 'del')
+{
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$_GET["id"]."'";
+
+ if (! $db->query($sql) )
+ {
+ print $db->error();
+ }
+}
+
+if ($_GET["action"] == 'edit')
+{
+ print "La modification est le paiement des charges n'est pas encore disponible.\nSeule leur saisie est possible, sans interaction avec le compte pour l'instant.\n";
+}
+
+
/*
- *
- *
+ * Affichage liste et formulaire des charges.
*/
-print "
";
-print "";
-print '| Echeance | Période | ';
-print_liste_field_titre("Charges",$PHP_SELF,"c.libelle");
-print ' | Montant | | ';
-print "
\n";
+print_titre("Charges sociales $year");
+
+print "";
+print "";
+print '| Echeance/Date | Période | ';
+print_liste_field_titre("Libellé",$PHP_SELF,"c.libelle");
+print ' | Montant | Payé | | ';
+print "
\n";
-$sql = "SELECT c.libelle as nom, s.amount,".$db->pdate("s.date_ech")." as de, s.date_pai, s.libelle, s.paye,".$db->pdate("s.periode")." as periode,".$db->pdate("s.date_pai")." as dp";
+$sql = "SELECT s.rowid as id, c.libelle as nom, s.amount,".$db->pdate("s.date_ech")." as de, s.date_pai, s.libelle, s.paye,".$db->pdate("s.periode")." as periode,".$db->pdate("s.date_pai")." as dp";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
$sql .= " WHERE s.fk_type = c.id";
if ($year > 0)
@@ -87,16 +105,24 @@ if ( $db->query($sql) )
$var = !$var;
print "";
print '| '.strftime("%d %b %y",$obj->de).' | ';
- print 'periode).'">'.strftime("%Y",$obj->periode).' | ';
+ print '';
+ if ($obj->periode) {
+ print 'periode).'">'.strftime("%Y",$obj->periode).'';
+ } else {
+ print ' ';
+ }
+ print ' | ';
print ''.$obj->nom.' | '.$obj->libelle.' | ';
print ''.price($obj->amount).' | ';
if ($obj->paye)
{
- print ''.strftime("%d/%m/%y",$obj->dp).' | ';
+ print ''.strftime("%d/%m/%y",$obj->dp).' | ';
+ print ' | ';
} else {
- print ' | ';
- print ' | ';
+ print 'Non | ';
+ print ''.img_edit().'';
+ print ' '.img_delete().' | ';
}
print '
';
$i++;
@@ -113,9 +139,10 @@ else
*/
print '|
';