ryxeo-glpi-git / front / report.contract.list.php @ b67d8923
Historique | Voir | Annoter | Télécharger (6,04 ko)
1 |
<?php
|
---|---|
2 |
/*
|
3 |
* @version $Id: report.contract.list.php 7763 2009-01-06 18:44:50Z moyo $
|
4 |
-------------------------------------------------------------------------
|
5 |
GLPI - Gestionnaire Libre de Parc Informatique
|
6 |
Copyright (C) 2003-2009 by the INDEPNET Development Team.
|
7 |
|
8 |
http://indepnet.net/ http://glpi-project.org
|
9 |
-------------------------------------------------------------------------
|
10 |
|
11 |
LICENSE
|
12 |
|
13 |
This file is part of GLPI.
|
14 |
|
15 |
GLPI is free software; you can redistribute it and/or modify
|
16 |
it under the terms of the GNU General Public License as published by
|
17 |
the Free Software Foundation; either version 2 of the License, or
|
18 |
(at your option) any later version.
|
19 |
|
20 |
GLPI is distributed in the hope that it will be useful,
|
21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
GNU General Public License for more details.
|
24 |
|
25 |
You should have received a copy of the GNU General Public License
|
26 |
along with GLPI; if not, write to the Free Software
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
--------------------------------------------------------------------------
|
29 |
*/
|
30 |
|
31 |
// ----------------------------------------------------------------------
|
32 |
// Original Author of file:
|
33 |
// Purpose of file:
|
34 |
// ----------------------------------------------------------------------
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
$NEEDED_ITEMS=array("contract","infocom"); |
40 |
|
41 |
define('GLPI_ROOT', '..'); |
42 |
include (GLPI_ROOT . "/inc/includes.php"); |
43 |
|
44 |
checkRight("reports","r"); |
45 |
|
46 |
commonHeader($LANG["Menu"][6],$_SERVER['PHP_SELF'],"utils","report"); |
47 |
|
48 |
$items=array(COMPUTER_TYPE,PRINTER_TYPE,MONITOR_TYPE,NETWORKING_TYPE,PERIPHERAL_TYPE,SOFTWARE_TYPE,PHONE_TYPE); |
49 |
# Titre
|
50 |
echo "<div align='center'><big><strong>".$LANG["reports"][4]."</strong></big><br><br>"; |
51 |
|
52 |
# Request All
|
53 |
if((isset($_POST["item_type"][0])&&$_POST["item_type"][0] == '0')||!isset($_POST["item_type"])){ |
54 |
$_POST["item_type"]=$items; |
55 |
} |
56 |
|
57 |
if (isset($_POST["item_type"])&&is_array($_POST["item_type"])){ |
58 |
$query=array(); |
59 |
foreach ($_POST["item_type"] as $key => $val) |
60 |
if (in_array($val,$items)){ |
61 |
$query[$val] = "SELECT ".$LINK_ID_TABLE[$val].".name AS itemname, ".$LINK_ID_TABLE[$val].".deleted AS itemdeleted, "; |
62 |
$query[$val].= " glpi_dropdown_locations.completename AS location, glpi_dropdown_contract_type.name AS type, glpi_infocoms.buy_date, glpi_infocoms.warranty_duration, glpi_contracts.begin_date, glpi_contracts.duration, glpi_entities.completename as entname, glpi_entities.ID as entID "; |
63 |
$query[$val].= " FROM glpi_contract_device "; |
64 |
$query[$val].= " INNER JOIN glpi_contracts ON (glpi_contract_device.FK_contract=glpi_contracts.ID) "; |
65 |
$query[$val].= " INNER JOIN ".$LINK_ID_TABLE[$val]." ON (glpi_contract_device.device_type='$val' AND ".$LINK_ID_TABLE[$val].".ID = glpi_contract_device.FK_device )"; |
66 |
$query[$val].= " LEFT JOIN glpi_infocoms ON ( glpi_infocoms.device_type = '$val' AND ".$LINK_ID_TABLE[$val].".ID = glpi_infocoms.FK_device ) "; |
67 |
$query[$val].= " LEFT JOIN glpi_dropdown_contract_type ON (glpi_contracts.contract_type = glpi_dropdown_contract_type.ID) "; |
68 |
$query[$val].= " LEFT JOIN glpi_dropdown_locations ON (".$LINK_ID_TABLE[$val].".location = glpi_dropdown_locations.ID) "; |
69 |
$query[$val].= " LEFT JOIN glpi_entities ON (".$LINK_ID_TABLE[$val].".FK_entities = glpi_entities.ID) "; |
70 |
|
71 |
$query[$val].=" WHERE ".$LINK_ID_TABLE[$val].".is_template ='0' "; |
72 |
$query[$val].=getEntitiesRestrictRequest("AND",$LINK_ID_TABLE[$val]); |
73 |
if(isset($_POST["annee"][0])&&$_POST["annee"][0] != 'toutes') |
74 |
{ |
75 |
$query[$val].=" AND ( "; |
76 |
$first=true; |
77 |
foreach ($_POST["annee"] as $key2 => $val2){ |
78 |
if (!$first) $query[$val].=" OR "; |
79 |
else $first=false; |
80 |
$query[$val].= " YEAR(glpi_infocoms.buy_date) = '".$val2."'"; |
81 |
$query[$val].= " OR YEAR(glpi_contracts.begin_date) = '".$val2."'"; |
82 |
} |
83 |
$query[$val].= ")"; |
84 |
} |
85 |
$query[$val].=" ORDER BY entname ASC, itemdeleted DESC, itemname ASC"; |
86 |
} |
87 |
} |
88 |
|
89 |
$display_entity=isMultiEntitiesMode();
|
90 |
|
91 |
$ci=new CommonItem(); |
92 |
if (isset($query)&&count($query)){ |
93 |
foreach ($query as $key => $val){ |
94 |
$result = $DB->query($val); |
95 |
if ($result&&$DB->numrows($result)){ |
96 |
$ci->setType($key); |
97 |
echo " <div align='center'><strong>".$ci->getType()."</strong>"; |
98 |
echo "<table class='tab_cadre_report'>"; |
99 |
echo "<tr> "; |
100 |
echo "<th>".$LANG["common"][16]."</th>"; |
101 |
echo "<th>".$LANG["common"][28]."</th>"; |
102 |
if ($display_entity){ |
103 |
echo "<th>".$LANG["entity"][0]."</th>"; |
104 |
} |
105 |
echo "<th>".$LANG["common"][15]."</th>"; |
106 |
echo "<th>".$LANG["financial"][14]."</th>"; |
107 |
echo "<th>".$LANG["financial"][80]."</th>"; |
108 |
echo "<th>".$LANG["financial"][6]."</th>"; |
109 |
echo "<th>".$LANG["search"][8]."</th>"; |
110 |
echo "<th>".$LANG["search"][9]."</th>"; |
111 |
echo "</tr>"; |
112 |
while( $data = $DB->fetch_array($result)){ |
113 |
echo "<tr class='tab_bg_1'>"; |
114 |
if($data['itemname']) { |
115 |
echo "<td> ".$data['itemname']." </td>"; |
116 |
} else {
|
117 |
echo "<td> N/A </td>"; |
118 |
} |
119 |
|
120 |
echo "<td> ".getYesNo($data['itemdeleted'])." </td>"; |
121 |
|
122 |
if ($display_entity){ |
123 |
if ($data['entID']==0){ |
124 |
echo "<td>".$LANG["entity"][2]."</td>"; |
125 |
} else {
|
126 |
echo "<td>".$data['entname']."</td>"; |
127 |
} |
128 |
} |
129 |
|
130 |
if($data['location']) { |
131 |
echo "<td> ".$data['location']." </td>"; |
132 |
} else {
|
133 |
echo "<td> N/A </td>"; |
134 |
} |
135 |
|
136 |
if($data['buy_date']) { |
137 |
echo "<td> ".convDate($data['buy_date'])." </td>"; |
138 |
if($data["warranty_duration"]) { |
139 |
echo "<td> ".getWarrantyExpir($data["buy_date"],$data["warranty_duration"])." </td>"; |
140 |
} else {
|
141 |
echo "<td> N/A </td>"; |
142 |
} |
143 |
} else {
|
144 |
echo "<td> N/A </td><td> N/A </td>"; |
145 |
} |
146 |
if($data['type']) { |
147 |
echo "<td> ".$data['type']." </td>"; |
148 |
} else {
|
149 |
echo "<td> N/A </td>"; |
150 |
} |
151 |
|
152 |
if($data['begin_date']) { |
153 |
echo "<td> ".convDate($data['begin_date'])." </td>"; |
154 |
if($data["duration"]) { |
155 |
echo "<td> ".getWarrantyExpir($data["begin_date"],$data["duration"])." </td>"; |
156 |
} else {
|
157 |
echo "<td> N/A </td>"; |
158 |
} |
159 |
} else {
|
160 |
echo "<td> N/A </td><td> N/A </td>"; |
161 |
} |
162 |
|
163 |
echo "</tr>\n"; |
164 |
} |
165 |
echo "</table></div><br><hr><br>"; |
166 |
} |
167 |
} |
168 |
} |
169 |
|
170 |
echo "</div>"; |
171 |
|
172 |
commonFooter(); |
173 |
?>
|