ryxeo-glpi-git / front / report.year.list.php @ b67d8923
Historique | Voir | Annoter | Télécharger (6,08 ko)
1 | b67d8923 | Eric Seigne | <?php
|
---|---|---|---|
2 | /*
|
||
3 | * @version $Id: report.year.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 | |||
45 | checkRight("reports","r"); |
||
46 | |||
47 | commonHeader($LANG["Menu"][6],$_SERVER['PHP_SELF'],"utils","report"); |
||
48 | |||
49 | $items=array(COMPUTER_TYPE,PRINTER_TYPE,MONITOR_TYPE,NETWORKING_TYPE,PERIPHERAL_TYPE,SOFTWARE_TYPE,PHONE_TYPE); |
||
50 | |||
51 | # Titre
|
||
52 | echo "<div align='center'><big><strong>".$LANG["reports"][57]."</strong></big><br><br>"; |
||
53 | |||
54 | # Request All
|
||
55 | if((isset($_POST["item_type"][0])&&$_POST["item_type"][0] == '0')||!isset($_POST["item_type"])){ |
||
56 | $_POST["item_type"]=$items; |
||
57 | } |
||
58 | |||
59 | if (isset($_POST["item_type"])&&is_array($_POST["item_type"])){ |
||
60 | $query=array(); |
||
61 | foreach ($_POST["item_type"] as $key => $val) |
||
62 | if (in_array($val,$items)){ |
||
63 | $query[$val] = "SELECT ".$LINK_ID_TABLE[$val].".name AS itemname, ".$LINK_ID_TABLE[$val].".deleted AS itemdeleted, "; |
||
64 | $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 "; |
||
65 | $query[$val].= " FROM ".$LINK_ID_TABLE[$val]." "; |
||
66 | $query[$val].= " LEFT JOIN glpi_contract_device ON glpi_contract_device.device_type='$val' AND ".$LINK_ID_TABLE[$val].".ID = glpi_contract_device.FK_device "; |
||
67 | $query[$val].= " LEFT JOIN glpi_contracts ON glpi_contract_device.FK_contract=glpi_contracts.ID AND glpi_contract_device.FK_contract IS NOT NULL "; |
||
68 | $query[$val].= " LEFT JOIN glpi_infocoms ON glpi_infocoms.device_type='$val' AND ".$LINK_ID_TABLE[$val].".ID = glpi_infocoms.FK_device "; |
||
69 | $query[$val].= " LEFT JOIN glpi_dropdown_contract_type ON (glpi_contracts.contract_type = glpi_dropdown_contract_type.ID) "; |
||
70 | $query[$val].= " LEFT JOIN glpi_dropdown_locations ON (".$LINK_ID_TABLE[$val].".location = glpi_dropdown_locations.ID) "; |
||
71 | $query[$val].= " LEFT JOIN glpi_entities ON (".$LINK_ID_TABLE[$val].".FK_entities = glpi_entities.ID) "; |
||
72 | |||
73 | $query[$val].=" WHERE ".$LINK_ID_TABLE[$val].".is_template ='0' "; |
||
74 | $query[$val].= getEntitiesRestrictRequest("AND",$LINK_ID_TABLE[$val]); |
||
75 | |||
76 | if(isset($_POST["annee"][0])&&$_POST["annee"][0] != 'toutes') |
||
77 | { |
||
78 | $query[$val].=" AND ( "; |
||
79 | $first=true; |
||
80 | foreach ($_POST["annee"] as $key2 => $val2){ |
||
81 | if (!$first) $query[$val].=" OR "; |
||
82 | else $first=false; |
||
83 | |||
84 | $query[$val].= " YEAR(glpi_infocoms.buy_date) = '".$val2."'"; |
||
85 | $query[$val].= " OR YEAR(glpi_contracts.begin_date) = '".$val2."'"; |
||
86 | } |
||
87 | $query[$val].=")"; |
||
88 | } |
||
89 | $query[$val].=" ORDER BY entname ASC, itemdeleted DESC, itemname ASC"; |
||
90 | } |
||
91 | } |
||
92 | $display_entity=isMultiEntitiesMode();
|
||
93 | |||
94 | $ci=new CommonItem(); |
||
95 | if (isset($query)&&count($query)){ |
||
96 | foreach ($query as $key => $val){ |
||
97 | $result = $DB->query($val); |
||
98 | if ($result&&$DB->numrows($result)){ |
||
99 | $ci->setType($key); |
||
100 | echo " <div align='center'><strong>".$ci->getType()."</strong>"; |
||
101 | echo "<table class='tab_cadre_report'>"; |
||
102 | echo "<tr> "; |
||
103 | echo "<th>".$LANG["common"][16]."</th>"; |
||
104 | echo "<th>".$LANG["common"][28]."</th>"; |
||
105 | if ($display_entity){ |
||
106 | echo "<th>".$LANG["entity"][0]."</th>"; |
||
107 | } |
||
108 | |||
109 | echo "<th>".$LANG["common"][15]."</th>"; |
||
110 | echo "<th>".$LANG["financial"][14]."</th>"; |
||
111 | echo "<th>".$LANG["financial"][80]."</th>"; |
||
112 | echo "<th>".$LANG["financial"][6]."</th>"; |
||
113 | echo "<th>".$LANG["search"][8]."</th>"; |
||
114 | echo "<th>".$LANG["search"][9]."</th>"; |
||
115 | echo "</tr>"; |
||
116 | while( $data = $DB->fetch_array($result)){ |
||
117 | echo "<tr class='tab_bg_1'>"; |
||
118 | if($data['itemname']) { |
||
119 | echo "<td> ".$data['itemname']." </td>"; |
||
120 | } else {
|
||
121 | echo "<td> N/A </td>"; |
||
122 | } |
||
123 | echo "<td> ".getYesNo($data['itemdeleted'])." </td>"; |
||
124 | |||
125 | if ($display_entity){ |
||
126 | if ($data['entID']==0){ |
||
127 | echo "<td>".$LANG["entity"][2]."</td>"; |
||
128 | } else {
|
||
129 | echo "<td>".$data['entname']."</td>"; |
||
130 | } |
||
131 | } |
||
132 | |||
133 | if($data['location']) { |
||
134 | echo "<td> ".$data['location']." </td>"; |
||
135 | } else {
|
||
136 | echo "<td> N/A </td>"; |
||
137 | } |
||
138 | |||
139 | if($data['buy_date']) { |
||
140 | echo "<td> ".convDate($data['buy_date'])." </td>"; |
||
141 | if($data["warranty_duration"]) { |
||
142 | echo "<td> ".getWarrantyExpir($data["buy_date"],$data["warranty_duration"])." </td>"; |
||
143 | } else {
|
||
144 | echo "<td> N/A </td>"; |
||
145 | } |
||
146 | } else {
|
||
147 | echo "<td> N/A </td><td> N/A </td>"; |
||
148 | } |
||
149 | if($data['type']) { |
||
150 | echo "<td> ".$data['type']." </td>"; |
||
151 | } else {
|
||
152 | echo "<td> N/A </td>"; |
||
153 | } |
||
154 | |||
155 | if($data['begin_date']) { |
||
156 | echo "<td> ".convDate($data['begin_date'])." </td>"; |
||
157 | if($data["duration"]) { |
||
158 | echo "<td> ".getWarrantyExpir($data["begin_date"],$data["duration"])." </td>"; |
||
159 | } else {
|
||
160 | echo "<td> N/A </td>"; |
||
161 | } |
||
162 | } else {
|
||
163 | echo "<td> N/A </td><td> N/A </td>"; |
||
164 | } |
||
165 | |||
166 | echo "</tr>\n"; |
||
167 | } |
||
168 | echo "</table></div><br><hr><br>"; |
||
169 | } |
||
170 | } |
||
171 | } |
||
172 | |||
173 | echo "</div>"; |
||
174 | commonFooter(); |
||
175 | ?> |