New: Met en évidence les contrats expirés.
This commit is contained in:
parent
e082ccae4c
commit
75906451ed
@ -171,16 +171,31 @@ else
|
|||||||
print '<td>Société</td><td colspan="3">'.$contrat->societe->nom_url.'</td></tr>';
|
print '<td>Société</td><td colspan="3">'.$contrat->societe->nom_url.'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>Statut</td><td colspan="3">';
|
// Affiche statut contrat
|
||||||
if ($contrat->enservice)
|
$now=mktime();
|
||||||
{
|
if ($contrat->enservice == 1)
|
||||||
print "En service";
|
{
|
||||||
}
|
if (! $contrat->date_fin_validite || $contrat->date_fin_validite >= $now) {
|
||||||
else
|
$class = "normal";
|
||||||
{
|
$statut="En service";
|
||||||
print "<b>Ce contrat n'est pas en service</b>";
|
}
|
||||||
}
|
else {
|
||||||
print "</td></tr>\n";
|
$class = "error";
|
||||||
|
$statut="<b>En service, expiré</b>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($contrat->enservice == 2)
|
||||||
|
{
|
||||||
|
$class = "normal";
|
||||||
|
$statut= "Cloturé";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$class = "warning";
|
||||||
|
$statut= "<b>Ce contrat n'est pas en service</b>";
|
||||||
|
}
|
||||||
|
print "<tr><td>Statut</td><td colspan=\"3\" class=\"$class\">$statut</td></tr>\n";
|
||||||
|
|
||||||
if ($request == 'miseenservice')
|
if ($request == 'miseenservice')
|
||||||
{
|
{
|
||||||
// Si contrat lié à une ligne de facture, on recherche date debut et fin de la ligne
|
// Si contrat lié à une ligne de facture, on recherche date debut et fin de la ligne
|
||||||
|
|||||||
@ -49,7 +49,7 @@ if ($sortorder == "")
|
|||||||
$sortorder="DESC";
|
$sortorder="DESC";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT c.rowid as cid, c.enservice, c.fin_validite, p.label, p.rowid as pid, s.nom, s.idp as sidp";
|
$sql = "SELECT c.rowid as cid, c.enservice, ".$db->pdate("c.fin_validite")." as fin_validite, p.label, p.rowid as pid, s.nom, s.idp as sidp";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_product = p.rowid";
|
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_product = p.rowid";
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
@ -80,11 +80,12 @@ if ( $db->query($sql) )
|
|||||||
print_liste_field_titre("Statut",$PHP_SELF, "c.enservice");
|
print_liste_field_titre("Statut",$PHP_SELF, "c.enservice");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</td><td align="center">';
|
print '</td><td align="center">';
|
||||||
print_liste_field_titre("Fin",$PHP_SELF, "c.fin_validite");
|
print_liste_field_titre("Date Fin",$PHP_SELF, "c.fin_validite");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
|
$now=mktime();
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object( $i);
|
$obj = $db->fetch_object( $i);
|
||||||
@ -97,8 +98,14 @@ if ( $db->query($sql) )
|
|||||||
// Affiche statut contrat
|
// Affiche statut contrat
|
||||||
if ($obj->enservice == 1)
|
if ($obj->enservice == 1)
|
||||||
{
|
{
|
||||||
$class = "impayee";
|
if (! $obj->fin_validite || $obj->fin_validite >= $now) {
|
||||||
$statut="En service";
|
$class = "normal";
|
||||||
|
$statut="En service";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$class = "error";
|
||||||
|
$statut="<b>En service, expiré</b>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif($obj->enservice == 2)
|
elseif($obj->enservice == 2)
|
||||||
{
|
{
|
||||||
@ -115,8 +122,7 @@ if ( $db->query($sql) )
|
|||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
|
|
||||||
if ($obj->enservice > 0) {
|
if ($obj->enservice > 0) {
|
||||||
$time=strtotime($obj->fin_validite);
|
print dolibarr_print_date($obj->fin_validite);
|
||||||
print dolibarr_print_date($time);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print " ";
|
print " ";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user