Nouveau fichier
This commit is contained in:
parent
f48d62244f
commit
d68be0ad69
171
htdocs/contrat/liste.php
Normal file
171
htdocs/contrat/liste.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\file htdocs/contrat/contrat.class.php
|
||||||
|
\ingroup contrat
|
||||||
|
\brief Page liste des contrats
|
||||||
|
\version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
$langs->load("products");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
|
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
||||||
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
||||||
|
$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
|
||||||
|
|
||||||
|
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
|
||||||
|
$socid=$_GET["socid"];
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sécurité accés client
|
||||||
|
*/
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($page == -1) { $page = 0 ; }
|
||||||
|
|
||||||
|
$limit = $conf->liste_limit;
|
||||||
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
|
if ($sortfield == "")
|
||||||
|
{
|
||||||
|
$sortfield="c.tms";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sortorder == "")
|
||||||
|
{
|
||||||
|
$sortorder="DESC";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT c.rowid as cid, c.statut, ".$db->pdate("c.fin_validite")." as fin_validite, c.fin_validite-sysdate() as delairestant, s.nom, s.idp as sidp";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
$sql .= " WHERE c.fk_soc = s.idp ";
|
||||||
|
if ($socid > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND s.idp = $socid";
|
||||||
|
}
|
||||||
|
$sql .= " ORDER BY $sortfield $sortorder, delairestant";
|
||||||
|
$sql .= $db->plimit($limit + 1 ,$offset);
|
||||||
|
|
||||||
|
if ( $db->query($sql) )
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
|
||||||
|
print_barre_liste("Liste des contrats", $page, "index.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num);
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans("Ref"),"index.php", "c.rowid","","","",$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Label"),"index.php", "p.label","","","",$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Company"),"index.php", "s.nom","","","",$sortfield);
|
||||||
|
print_liste_field_titre($langs->trans("Status"),"index.php", "c.statut","","",'align="center"',$sortfield);
|
||||||
|
print_liste_field_titre("Date Fin","index.php", "c.fin_validite","","",'align="center"',$sortfield);
|
||||||
|
print '<td>'.$langs->trans("Action").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$now=mktime();
|
||||||
|
$var=True;
|
||||||
|
while ($i < min($num,$limit))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object();
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print "<td><a href=\"fiche.php?id=$obj->cid\">";
|
||||||
|
print img_file();
|
||||||
|
print "</a> <a href=\"fiche.php?id=$obj->cid\">$obj->cid</a></td>\n";
|
||||||
|
print "<td><a href=\"../product/fiche.php?id=$obj->pid\">$obj->label</a></td>\n";
|
||||||
|
print "<td><a href=\"../comm/fiche.php?socid=$obj->sidp\">$obj->nom</a></td>\n";
|
||||||
|
|
||||||
|
// Affiche statut contrat
|
||||||
|
if ($obj->statut == 1)
|
||||||
|
{
|
||||||
|
if (! $obj->fin_validite || $obj->fin_validite >= $now) {
|
||||||
|
$class = 'normal';
|
||||||
|
$statut= $langs->trans("ContractStatusRunning");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$class = 'error';
|
||||||
|
$statut= $langs->trans("ContractStatusRunning").', '.img_warning().' '.$langs->trans("ContractStatusExpired");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($obj->statut == 2)
|
||||||
|
{
|
||||||
|
$class = "normal";
|
||||||
|
$statut= $langs->trans("Closed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$class = "warning";
|
||||||
|
$statut= $langs->trans("ContractStatusToRun");
|
||||||
|
}
|
||||||
|
print "<td align=\"center\" class=\"$class\">";
|
||||||
|
print "$statut";
|
||||||
|
print "</td>";
|
||||||
|
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
if ($obj->statut > 0) {
|
||||||
|
print dolibarr_print_date($obj->fin_validite);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print " ";
|
||||||
|
}
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
// \todo Créer action "Renouveler"
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free();
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
?>
|
||||||
32
mysql/tables/llx_contratdet_log.sql
Normal file
32
mysql/tables/llx_contratdet_log.sql
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program; if not, write to the Free Software
|
||||||
|
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- $Source$
|
||||||
|
--
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
create table llx_contratdet_log
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_contratdet integer NOT NULL,
|
||||||
|
statut smallint NOT NULL,
|
||||||
|
fk_user_author integer NOT NULL,
|
||||||
|
commentaire text
|
||||||
|
|
||||||
|
)type=innodb;
|
||||||
Loading…
Reference in New Issue
Block a user