New: Possibilité de trier sur tous les champs du tableau pour l'écran de liste des charges sociales.

New: La colonne payé/non payé s'affiche en rouge si impayé (comme les factures).
New: Le type et libellé séparé en 2 colonnes distinctes plutot qu'une commune contenant 2 valeurs l'une à côté de l'autre.
This commit is contained in:
Laurent Destailleur 2004-05-02 13:49:15 +00:00
parent c81bccc751
commit fe7555d242

View File

@ -64,12 +64,8 @@ if ($_GET["action"] == 'del')
} }
} }
if ($_GET["action"] == 'edit') $year=$_GET["year"];
{ $filtre=$_GET["filtre"];
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. * Affichage liste et formulaire des charges.
@ -77,20 +73,36 @@ if ($_GET["action"] == 'edit')
print_titre("Charges sociales $year"); print_titre("Charges sociales $year");
print "<br>\n";
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">"; print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td>Echeance/Date</td><td>Période</td><td colspan="2" align="left">'; print '<td>';
print_liste_field_titre("Libellé",$PHP_SELF,"c.libelle"); print_liste_field_titre("Echéance/Date",$PHP_SELF,"de");
print '</td><td align="right">Montant</td><td align="center">Payé</td><td>&nbsp;</td>'; print '</td><td>';
print_liste_field_titre("Période",$PHP_SELF,"periode");
print '</td><td align="left">';
print_liste_field_titre("Type",$PHP_SELF,"type");
print '</td><td align="left">';
print_liste_field_titre("Libellé",$PHP_SELF,"s.libelle");
print '</td><td align="right">';
print_liste_field_titre("Montant",$PHP_SELF,"s.amount");
print '</td><td align="center">';
print_liste_field_titre("Payé",$PHP_SELF,"s.paye");
print '</td><td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$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 = "SELECT s.rowid as id, c.libelle as type, 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 .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
$sql .= " WHERE s.fk_type = c.id"; $sql .= " WHERE s.fk_type = c.id";
if ($year > 0) if ($year > 0)
{ {
$sql .= " AND date_format(s.periode, '%Y') = $year"; $sql .= " AND date_format(s.periode, '%Y') = $year";
}
if ($filtre) {
$filtre=ereg_replace(":","=",$filtre);
$sql .= " AND $filtre";
} }
$sql .= " ORDER BY lower(s.date_ech) DESC"; $sql .= " ORDER BY lower(s.date_ech) DESC";
@ -102,6 +114,7 @@ if ( $db->query($sql) )
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object( $i); $obj = $db->fetch_object( $i);
$var = !$var; $var = !$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.strftime("%d %b %y",$obj->de).'</td>'; print '<td>'.strftime("%d %b %y",$obj->de).'</td>';
@ -112,16 +125,16 @@ if ( $db->query($sql) )
print '&nbsp;'; print '&nbsp;';
} }
print '</td>'; print '</td>';
print '<td>'.$obj->nom.'</td><td>'.$obj->libelle.'</td>'; print '<td>'.$obj->type.'</td><td>'.$obj->libelle.'</td>';
print '<td align="right">'.price($obj->amount).'</td>'; print '<td align="right">'.price($obj->amount).'</td>';
if ($obj->paye) if ($obj->paye)
{ {
print '<td align="center">'.strftime("%d/%m/%y",$obj->dp).'</td>'; print '<td align="center" class="normal">'.strftime("%d/%m/%y",$obj->dp).'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} else { } else {
print '<td align="center">Non</td>'; print '<td align="center"><a class="impayee" href="'.$PHP_SELF.'?filtre=paye:0">Non</a></td>';
print '<td align="center"><a href="'.$PHP_SELF.'?action=edit&id='.$obj->id.'">'.img_edit().'</a>'; print '<td align="center"><a href="charges.php?id='.$obj->id.'">'.img_edit().'</a>';
print ' &nbsp; <a href="'.$PHP_SELF.'?action=del&id='.$obj->id.'">'.img_delete().'</a></td>'; print ' &nbsp; <a href="'.$PHP_SELF.'?action=del&id='.$obj->id.'">'.img_delete().'</a></td>';
} }
print '</tr>'; print '</tr>';
@ -132,9 +145,9 @@ else
{ {
print $db->error(); print $db->error();
} }
/* /*
* * Forumalaire d'ajout d'une charge
*
* *
*/ */
print '<tr class="form"><form method="post" action="index.php">'; print '<tr class="form"><form method="post" action="index.php">';
@ -142,10 +155,9 @@ print '<input type="hidden" name="action" value="add">';
print '<td><input type="text" size="8" name="date"> YYYYMMDD</td>'; print '<td><input type="text" size="8" name="date"> YYYYMMDD</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td colspan="2" align="left"><select name="type">'; print '<td align="left"><select name="type">';
$sql = "SELECT c.id, c.libelle as type FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql = "SELECT c.id, c.libelle as nom FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql .= " ORDER BY lower(c.libelle) ASC"; $sql .= " ORDER BY lower(c.libelle) ASC";
if ( $db->query($sql) ) if ( $db->query($sql) )
@ -156,13 +168,13 @@ if ( $db->query($sql) )
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object( $i); $obj = $db->fetch_object( $i);
print '<option value="'.$obj->id.'">'.$obj->nom; print '<option value="'.$obj->id.'">'.$obj->type;
$i++; $i++;
} }
} }
print '</select>'; print '</select>';
print '</td>';
print '<input type="text" size="20" name="libelle"></td>'; print '<td align="left"><input type="text" size="20" name="libelle"></td>';
print '<td align="right"><input type="text" size="6" name="amount"></td>'; print '<td align="right"><input type="text" size="6" name="amount"></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';