Commit a049f53e25701af687bca7ae8fef3d1ef75bf3d8

Authored by anderson.peterle@previdencia.gov.br
1 parent bed968b4
Exists in master and in 1 other branch 3.1

Gerente WEB: Implementacao de opcao para detalhamento dos resultados gerados a p…

…artir da opcao Estatisticas/Sistemas Monitorados.

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/gerente@820 fecfc0c7-e812-0410-ae72-849f08638ee7
estatisticas/aplicativos/aplicativos.php
... ... @@ -23,6 +23,12 @@ if(!isset($_SESSION['id_usuario']))
23 23 else { // Inserir regras para outras verificações (ex: permissões do usuário)!
24 24 }
25 25  
  26 +/*
  27 +if (count($HTTP_POST_VARS) > 0)
  28 + foreach($HTTP_POST_VARS as $i => $v)
  29 + echo 'POST => '.$i.' => '.$v.'<br>';
  30 +*/
  31 +
26 32 if($_POST['submit'])
27 33 {
28 34 $_SESSION["list2"] = $_POST['list2']; //Redes selecionadas
... ... @@ -86,7 +92,7 @@ $_SESSION[&#39;select&#39;] = &#39;&#39;;
86 92 $_SESSION['from'] = '';
87 93 $_SESSION['where'] = '';
88 94 $_SESSION['redes_selecionadas'] = '';
89   -$_SESSION['query_redes'] = ' AND computadores.id_ip_rede = redes.id_ip_rede AND ';
  95 +$_SESSION['query_redes'] = ' AND computadores.id_ip_rede = redes.id_ip_rede ';
90 96 if ($_SESSION['cs_nivel_administracao']<>1 && $_SESSION['cs_nivel_administracao']<>2)
91 97 {
92 98 // Aqui pego todas as redes selecionadas e faço uma query p/ condição de redes
... ... @@ -98,7 +104,7 @@ if ($_SESSION[&#39;cs_nivel_administracao&#39;]&lt;&gt;1 &amp;&amp; $_SESSION[&#39;cs_nivel_administracao&#39;
98 104 $_SESSION['redes_selecionadas'] .= "'".$_SESSION["list2"][$i]."'";
99 105 }
100 106  
101   - $_SESSION['query_redes'] .= 'redes.id_ip_rede IN ('. $_SESSION['redes_selecionadas'] .')';
  107 + $_SESSION['query_redes'] .= ' AND redes.id_ip_rede IN ('. $_SESSION['redes_selecionadas'] .')';
102 108 }
103 109 else
104 110 {
... ... @@ -111,15 +117,13 @@ else
111 117 $locais_selecionados .= $_SESSION["list12"][$i];
112 118 }
113 119  
114   - $_SESSION['query_redes'] .= 'redes.id_local = locais.id_local ';
115 120 if ($locais_selecionados)
116 121 $_SESSION['query_redes'] .= ' AND locais.id_local IN ('.$locais_selecionados.') ';
117   -
118   - $_SESSION['select'] = ' ,sg_local as SgLocal ';
119   - $_SESSION['from'] = ' ,locais ';
120 122 }
121 123  
122   -$_SESSION['from'] .= ',redes ';
  124 +$_SESSION['query_redes'] .= ' AND redes.id_local = locais.id_local ';
  125 +$_SESSION['select'] = ' ,nm_rede,nm_local ';
  126 +$_SESSION['from'] = ' ,locais, redes ';
123 127  
124 128 // Aqui pego todos os SO selecionados
125 129 $so_selecionados = "'" . $_SESSION["list4"][0] . "'";
... ... @@ -151,20 +155,54 @@ $query_select = &#39;SELECT id_aplicativo,
151 155 nm_aplicativo not like "%#DESATIVADO#%"
152 156 ORDER BY nm_aplicativo';
153 157  
154   -$result_query_selecao = mysql_query($query_select) or die($oTranslator->_('Ocorreu um erro no acesso a tabela %1 ou sua sessao expirou!',array('perfis_aplicativos_monitorados')));
  158 +//if ($_SERVER['REMOTE_ADDR']=='10.71.0.58')
  159 +// echo 'query_select: '.$query_select . '<br><br>';
  160 +
  161 +$result_query_selecao = mysql_query($query_select);
  162 +
  163 +$strGroupByVersao = ($_POST['rdCsSaidaDetalhada']=='S'?'':' GROUP BY a.te_versao ');
  164 +$strGroupByLicenca = ($_POST['rdCsSaidaDetalhada']=='S'?'':' GROUP BY a.id_aplicativo, a.te_licenca ');
  165 +
  166 +$strOrderByVersao = ($_POST['rdCsSaidaDetalhada']=='S'?' ORDER BY a.te_versao,nm_local,nm_rede,te_ip ':' ORDER BY total_equip DESC,a.te_versao,b.nm_aplicativo ');
  167 +$strOrderByLicenca = ($_POST['rdCsSaidaDetalhada']=='S'?' ORDER BY a.te_licenca,nm_local,nm_rede,te_ip ':' ORDER BY total_equip DESC ');
  168 +
  169 +$strCountVersao = ($_POST['rdCsSaidaDetalhada']=='S'?'':' ,COUNT(a.te_versao) as total_equip ');
  170 +$strCountLicenca = ($_POST['rdCsSaidaDetalhada']=='S'?'':' ,COUNT(a.te_licenca) as total_equip ');
  171 +
155 172 ?>
156 173 </p>
157 174 <table width="100%" border="0" align="center">
158   -<td>
  175 +<tr>
  176 +<td align="center">
159 177 <?
160 178 while($reg_selecao = @mysql_fetch_array($result_query_selecao))
161 179 {
  180 + if ($v_nm_aplicativo <> '')
  181 + {
  182 + if (($total_maquinas_versao + $total_maquinas_licenca) == 0)
  183 + {
  184 + ?>
  185 + <td align="center" class="label_vermelho"><?=$oTranslator->_('A pesquisa nao retornou registros');?></td>
  186 + <?
  187 + }
  188 + ?>
  189 + </table>
  190 + <br><br>
  191 + </table>
  192 + <?
  193 + }
162 194 ?>
163   - <table width="50%" border="1" align="center" cellpadding="0" cellspacing="0">
  195 + <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
164 196 <tr bordercolor="#FFFFFF" bgcolor="#E1E1E1">
165   - <td colspan="3" bgcolor="#FFFFFF" nowrap class="cabecalho_tabela">
  197 + <td colspan="3" bgcolor="#FFFFFF" nowrap class="cabecalho_secao">
166 198 <div align="center">
167 199 <?
  200 + $where = '';
  201 + if ($reg_selecao['cs_car_inst_w9x'] > 0 || $reg_selecao['cs_car_inst_wnt'] > 0)
  202 + $where = " AND (a.cs_instalado = 'S' OR (a.te_versao <> '' AND a.te_versao <> '?')) ";
  203 + elseif ($reg_selecao['cs_car_ver_w9x'] > 0 && $reg_selecao['cs_car_ver_wnt'] > 0)
  204 + $where = " AND a.te_versao <> '' AND a.te_versao <> '?' ";
  205 +
168 206 $v_nm_aplicativo = $reg_selecao['nm_aplicativo'];
169 207 echo $v_nm_aplicativo;
170 208 $reg_id_aplicativo = $reg_selecao['id_aplicativo'];
... ... @@ -173,23 +211,9 @@ while($reg_selecao = @mysql_fetch_array($result_query_selecao))
173 211 </td>
174 212 </tr>
175 213 <?
176   - $groupBy = '';
177   - $orderBy = '';
178   - $where = '';
179   - if ($reg_selecao['cs_car_inst_w9x'] > 0 || $reg_selecao['cs_car_inst_wnt'] > 0)
180   - {
181   - $where = " AND a.cs_instalado = 'S' ";
182   - }
183   - elseif ($reg_selecao['cs_car_ver_w9x'] > 0 && $reg_selecao['cs_car_ver_wnt'] > 0)
184   - {
185   - $where = " AND a.te_versao <> '' ";
186   -// $groupBy = ', a.te_versao ';
187   -// $orderBy = ', a.te_versao ';
188   - }
189 214  
190 215 // Exibir informações sobre a quantidade de máquinas e versões instaladas
191 216 $query_aplicativo ="SELECT DISTINCT a.te_versao,
192   - COUNT(a.te_versao) as total_equip,
193 217 a.id_aplicativo,
194 218 b.nm_aplicativo,
195 219 b.cs_car_inst_w9x,
... ... @@ -200,7 +224,13 @@ while($reg_selecao = @mysql_fetch_array($result_query_selecao))
200 224 $_SESSION['select'].",
201 225 b.cs_car_ver_w9x,
202 226 b.cs_car_ver_wnt,
203   - b.cs_ide_licenca
  227 + b.cs_ide_licenca,
  228 + computadores.te_nome_computador,
  229 + computadores.te_ip,
  230 + computadores.id_ip_rede,
  231 + computadores.id_so,
  232 + computadores.te_node_address ".
  233 + $strCountVersao. "
204 234 FROM aplicativos_monitorados a,
205 235 perfis_aplicativos_monitorados b,
206 236 computadores ".
... ... @@ -210,12 +240,15 @@ while($reg_selecao = @mysql_fetch_array($result_query_selecao))
210 240 a.id_aplicativo = ".$reg_id_aplicativo. " AND
211 241 a.id_aplicativo = b.id_aplicativo " . $_SESSION['query_redes'] . " AND
212 242 computadores.id_so IN (". $_SESSION['so_selecionados'] .") ".
213   - $where ."
214   - GROUP BY a.te_versao ".
215   - $groupBy."
216   - ORDER BY total_equip DESC,a.te_versao,b.nm_aplicativo ".
217   - $orderBy;
  243 + $where .
  244 + $strGroupByVersao.
  245 + $strOrderByVersao;
218 246 $result_query_versoes = mysql_query($query_aplicativo);
  247 +
  248 +
  249 + //if ($_SERVER['REMOTE_ADDR'] == '10.71.0.33' || $_SERVER['REMOTE_ADDR'] == '10.71.0.63')
  250 + // echo $query_aplicativo . '<br>';
  251 +
219 252 /*
220 253 Informações importantes:
221 254  
... ... @@ -232,97 +265,193 @@ while($reg_selecao = @mysql_fetch_array($result_query_selecao))
232 265 =======================
233 266 cs_instalado S/N
234 267 */
235   - $total_maquinas = 0;
236   - $sequencial = 1;
  268 +
  269 + $total_maquinas_versao = 0;
  270 + $sequencial = 0;
237 271  
238 272 $in_se_instalado = false;
239 273 if (mysql_num_rows($result_query_versoes))
240 274 {
  275 + // Crio variáveis array a partir do resultado da consulta, para exibição de detalhes (reuso)
  276 + // Anderson Peterle - 31/Julho/2009
  277 + $arrTotalNaVersao = array();
  278 + $arrTeVersao = array();
  279 + $arrTotalEquip = array();
  280 + $arrIdAplicativo = array();
  281 + $arrNmAplicativo = array();
  282 + $arrCsCarInstW9X = array();
  283 + $arrCsCarInstWNT = array();
  284 + $arrCsInstalado = array();
  285 + $arrTeCarInstW9X = array();
  286 + $arrTeCarInstWNT = array();
  287 + $arrNmRede = array();
  288 + $arrNmLocal = array();
  289 + $arrCsCarVerW9X = array();
  290 + $arrCsCarVerWNT = array();
  291 + $arrCsIdeLicenca = array();
  292 + $arrTeNomeComputador = array();
  293 + $arrTeIp = array();
  294 + $arrIdIpRede = array();
  295 + $arrIdSo = array();
  296 + $arrTeNodeAddress = array();
  297 +
241 298 while($reg_versoes = mysql_fetch_array($result_query_versoes))
242 299 {
243   - $te_versao = $reg_versoes['te_versao'];
244   - //$cs_instalado = ($reg_versoes['cs_instalado'] <>'' && $reg_versoes['cs_instalado']<>'0');
  300 + $arrTotalNaVersao[$reg_versoes['te_versao']] ++;
245 301  
246   - $cs_instalado = (($reg_versoes['cs_car_inst_w9x']<>'' && $reg_versoes['cs_car_inst_w9x']<>'0') || ($reg_versoes['cs_car_inst_wnt'] <> '' && $reg_versoes['cs_car_inst_wnt'] <> '0'));
  302 + $arrTeVersao[$sequencial] = $reg_versoes['te_versao'];
  303 + $arrTotalEquip[$sequencial] = ($_POST['rdCsSaidaDetalhada']=='S'?0:$reg_versoes['total_equip']);
  304 + $arrIdAplicativo[$sequencial] = $reg_versoes['id_aplicativo'];
  305 + $arrNmAplicativo[$sequencial] = $reg_versoes['nm_aplicativo'];
  306 + $arrCsCarInstW9X[$sequencial] = $reg_versoes['cs_car_inst_w9x'];
  307 + $arrCsCarInstWNT[$sequencial] = $reg_versoes['cs_car_inst_wnt'];
  308 + $arrCsInstalado[$sequencial] = $reg_versoes['cs_instalado'];
  309 + $arrTeCarInstW9X[$sequencial] = $reg_versoes['te_car_inst_w9x'];
  310 + $arrTeCarInstWNT[$sequencial] = $reg_versoes['te_car_inst_wnt'];
  311 + $arrNmRede[$sequencial] = $reg_versoes['nm_rede'];
  312 + $arrNmLocal[$sequencial] = $reg_versoes['nm_local'];
  313 + $arrCsCarVerW9X[$sequencial] = $reg_versoes['cs_car_ver_w9x'];
  314 + $arrCsCarVerWNT[$sequencial] = $reg_versoes['cs_car_ver_wnt'];
  315 + $arrCsIdeLicenca[$sequencial] = $reg_versoes['cs_ide_licenca'];
  316 + $arrTeNomeComputador[$sequencial] = $reg_versoes['te_nome_computador'];
  317 + $arrTeIp[$sequencial] = $reg_versoes['te_ip'];
  318 + $arrIdIpRede[$sequencial] = $reg_versoes['id_ip_rede'];
  319 + $arrIdSO[$sequencial] = $reg_versoes['id_so'];
  320 + $arrTeNodeAddress[$sequencial] = $reg_versoes['te_node_address'];
  321 +
  322 + $cs_instalado = (($arrCsCarInstW9X[$sequencial]<>'' && $arrCsCarInstW9X[$sequencial]<>'0') || ($arrCsCarInstWNT[$sequencial] <> '' && $arrCsCarInstWNT[$sequencial] <> '0'));
247 323 if (!$cs_instalado)
248   - $cs_instalado = (($reg_versoes['cs_car_ver_w9x']<>'' && $reg_versoes['cs_car_ver_w9x']<>'0') || ($reg_versoes['cs_car_ver_wnt'] <> '' && $reg_versoes['cs_car_ver_wnt'] <> '0'));
  324 + $cs_instalado = (($arrCsCarVerW9X[$sequencial]<>'' && $arrCsCarVerW9X[$sequencial]<>'0') || ($arrCsCarVerWNT[$sequencial] <> '' && $arrCsCarVerWNT[$sequencial] <> '0'));
249 325  
250   - $cs_ide_licenca = ($reg_versoes['cs_ide_licenca']<>'' && $reg_versoes['cs_ide_licenca']<>'0');
  326 + $cs_ide_licenca = ($arrCsIdeLicenca[$sequencial]<>'' && $arrCsIdeLicenca[$sequencial]<>'0');
251 327  
252   - $label = ($te_versao<>''?'Versão/Configuração':'Instalação Detectada');
  328 + $label = ($arrTeVersao[$sequencial]<>''?'Versão/Configuração':'Instalação Detectada');
253 329 if ($cs_instalado)
254   - $te_car_inst = ($reg_versoes['te_car_inst_w9x'] <> ''?$reg_versoes['te_car_inst_w9x']:$reg_versoes['te_car_inst_wnt']);
  330 + $te_car_inst = ($arrTeCarInstW9X[$sequencial] <> ''?$arrTeCarInstW9X[$sequencial]:$arrTeCarInstWNT[$sequencial]);
255 331  
256   - $total_maquinas += $reg_versoes['total_equip'];
257   -
  332 + $total_maquinas_versao += ($_POST['rdCsSaidaDetalhada']=='S'?1:$arrTotalEquip[$sequencial]);
  333 + $sequencial ++;
258 334 } //Fim do while
259   - if ($total_maquinas > 0 && $cs_instalado && !$cs_ide_licenca)
  335 +
  336 + if ($total_maquinas_versao > 0 && $cs_instalado && !$cs_ide_licenca)
260 337 {
261 338 ?>
262   - <table width="50%" border="0" align="center">
  339 + <table width="50%" border="1" align="center">
263 340 <tr valign="top" bgcolor="#E1E1E1">
264   - <td class="cabecalho_tabela"><div align="left"><?=$oTranslator->_('Sequencial');?></div></td>
265   - <td class="cabecalho_tabela"><div align="left"><? echo $label;?></div></td>
266   - <?
267   - /*
268   - if ($_SESSION['cs_nivel_administracao']==1 || $_SESSION['cs_nivel_administracao']==2)
269   - {
270   - ?>
271   - <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="left">Local</div></td>
272   - <?
273   - }
274   - */
275   - ?>
276   -
  341 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Sequencial');?></div></td>
  342 + <td class="cabecalho_tabela"><div align="center"><? echo $label;?></div></td>
277 343 <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Maquinas');?></div></td>
278 344 <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Percentual', T_SIGLA);?></div></td>
279 345 </tr>
280   - <?
281   -
282   - mysql_data_seek($result_query_versoes,0);
283   - while($reg_versoes = mysql_fetch_array($result_query_versoes))
284   - {
285   - $label = ($te_versao<>''?'Versão/Configuração':'Instalação Detectada');
286   - $cs_instalado = ($reg_versoes['cs_instalado'] <>'' && $reg_versoes['cs_instalado']<>'0');
287   - $cs_ide_licenca = ($reg_versoes['cs_ide_licenca']<>'' && $reg_versoes['cs_ide_licenca']<>'0');
288   - $te_versao = $reg_versoes['te_versao'];
289   -
290   - //echo 'cs_instalado: '.$cs_instalado.' => '.$reg_versoes['cs_instalado'].'<br>';
291   - //echo 'cs_ide_licenca: '.$cs_ide_licenca.' => '.$reg_versoes['cs_ide_licenca'].'<br>';
292   - //echo 'te_versao: '.$reg_versoes['te_versao'].'<br>';
293   - $cs_ide_licenca = ($reg_versoes['cs_ide_licenca']<>'' && $reg_versoes['cs_ide_licenca']<>'0');
294   -
295   - if ($cs_instalado && !$cs_ide_licenca)
296   - {
297   - ?>
298   - <tr>
299   - <td nowrap class="opcao_tabela"><div align="left"><? echo $sequencial; ?></a></div></td>
300   - <td nowrap class="opcao_tabela"><div align="left"><a href="../../estatisticas/aplicativos/est_maquinas_aplicativos.php?teversao=<? echo $reg_versoes['te_versao']?>&idaplicativo=<? echo $reg_versoes['id_aplicativo']?>&nmversao=<? echo $reg_versoes['nm_aplicativo']?>&cs_car_inst=<? echo ($reg_versoes['cs_car_inst_wnt']<>''?$reg_versoes['cs_car_inst_wnt']:$reg_versoes['cs_car_inst_w9x']);?>" target="_blank"><? echo ($te_versao<>''?$reg_versoes['te_versao']:$label) ?></a></div></td>
301   - <td nowrap class="opcao_tabela"><div align="right"><? echo $reg_versoes['total_equip']; ?></div></td>
302   - <td nowrap class="ajuda"><div align="right">&nbsp;&nbsp;&nbsp;<? echo sprintf("%01.2f", $reg_versoes['total_equip'] * 100 / $total_maquinas); ?></div></td>
303   - </tr>
304   - <?
305   - $sequencial ++;
306   - echo $linha;
307   - }
308   - } //Fim do while
  346 + <?
  347 + $intSequenciaVersoes = 0;
  348 + for ($intAuxVersoes = 0; $intAuxVersoes < count($arrTeVersao); $intAuxVersoes ++)
  349 + {
  350 + $intSequenciaVersoes ++;
  351 + $label = ($arrTeVersao[$intAuxVersoes] <> '' ? 'Versão/Configuração':'Instalação Detectada');
  352 + $cs_instalado = ($arrCsInstalado[$intAuxVersoes] <> '' && $arrCsInstalado[$intAuxVersoes] <> '0');
  353 + $cs_ide_licenca = ($arrCsIdeLicenca[$intAuxVersoes] <> '' && $arrCsIdeLicenca[$intAuxVersoes] <> '0');
  354 +
  355 + if ($cs_instalado && !$cs_ide_licenca || ($arrTeVersao[$intAuxVersoes]))
  356 + {
  357 + if ($intAuxVersoes > 0 && $_POST['rdCsSaidaDetalhada']=='S')
  358 + {
  359 + ?>
  360 + <tr><td colspan="4"></td></tr>
  361 + <tr><td colspan="4"></td></tr>
  362 + <tr valign="top" bgcolor="#E1E1E1">
  363 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Sequencial');?></div></td>
  364 + <td class="cabecalho_tabela"><div align="center"><? echo $label;?></div></td>
  365 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Maquinas');?></div></td>
  366 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Percentual', T_SIGLA);?></div></td>
  367 + </tr>
  368 + <?
  369 + }
  370 + ?>
  371 + <tr>
  372 + <td nowrap class="opcao_tabela"><div align="right"><? echo $intSequenciaVersoes; ?></a></div></td>
  373 + <td nowrap class="opcao_tabela"><div align="center"><a href="../../estatisticas/aplicativos/est_maquinas_aplicativos.php?teversao=<? echo $arrTeVersao[$intAuxVersoes]?>&idaplicativo=<? echo $arrIdAplicativo[$intAuxVersoes]?>&nmversao=<? echo $arrNmAplicativo[$intAuxVersoes]?>&cs_car_inst=<? echo ($arrCsCarInstWNT[$intAuxVersoes]<>''?$arrCsCarInstWNT[$intAuxVersoes]:$arrCsCarInstW9X[$intAuxVersoes]);?>" target="_blank"><? echo ($arrTeVersao[$intAuxVersoes]<>''?$arrTeVersao[$intAuxVersoes]:$label); ?></a></div></td>
  374 + <td nowrap class="opcao_tabela"><div align="right"><? echo ($_POST['rdCsSaidaDetalhada']=='S'?$arrTotalNaVersao[$arrTeVersao[$intAuxVersoes]]:$arrTotalEquip[$intAuxVersoes]); ?></div></td>
  375 + <td nowrap class="ajuda"><div align="right"><? echo sprintf("%01.2f", ($_POST['rdCsSaidaDetalhada']=='S'?$arrTotalNaVersao[$arrTeVersao[$intAuxVersoes]]:$arrTotalEquip[$intAuxVersoes]) * 100 / $total_maquinas_versao); ?></div></td>
  376 + </tr>
  377 + <?
  378 +
  379 + // Caso o usuário tenha optado por Saída Detalhada...
  380 + // Neste ponto serão exibidos os detalhes em forma de links para os registros de computadores constantes do resultado da consulta
  381 + // Anderson Peterle - 31/Julho/2009
  382 + if ($_POST['rdCsSaidaDetalhada']=='S')
  383 + {
  384 + ?>
  385 + <tr valign="top">
  386 + <td></td>
  387 + <td>
  388 + <table border="0" align="center" cellpadding="0" cellspacing="0" width="80%">
  389 + <tr bgcolor="#E1E1E1">
  390 + <td nowrap class="cabecalho_tabela" width="20%"><div align="right"><?=$oTranslator->_('Sequencial');?></div></td>
  391 + <td>|</td>
  392 + <td nowrap class="cabecalho_tabela" width="20%"><div align="left"><?=$oTranslator->_('Computador');?></div></td>
  393 + <td>|</td>
  394 + <td nowrap class="cabecalho_tabela" width="20%"><div align="left"><?=$oTranslator->_('SubRede');?></div></td>
  395 + <td>|</td>
  396 + <td nowrap class="cabecalho_tabela" width="20%"><div align="left"><?=$oTranslator->_('Local');?></div></td>
  397 + </tr>
  398 + <?
  399 +
  400 + $intSequencialDetalhes = 1;
  401 + $intAuxDetalhes = $intAuxVersoes;
  402 + $te_versao = $arrTeVersao[$intAuxDetalhes];
  403 + $strCorFundo = '.';
  404 + while ($te_versao == $arrTeVersao[$intAuxDetalhes])
  405 + {
  406 + ?>
  407 + <tr <? if ($strCorFundo) { echo 'bgcolor="#CCCCFF"'; } ?>>
  408 + <td nowrap class="opcao_tabela" width="20%"><div align="right"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $intSequencialDetalhes; ?></a></div></td>
  409 + <td>|</td>
  410 + <td nowrap class="opcao_tabela" width="20%"><div align="left"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $arrTeIp[$intAuxDetalhes].' ('.$arrTeNomeComputador[$intAuxDetalhes].')'; ?></a></div></td>
  411 + <td>|</td>
  412 + <td nowrap class="opcao_tabela" width="20%"><div align="left"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $arrIdIpRede[$intAuxDetalhes].' ('.$arrNmRede[$intAuxDetalhes].')'; ?></a></div></td>
  413 + <td>|</td>
  414 + <td nowrap class="opcao_tabela" width="20%"><div align="left"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $arrNmLocal[$intAuxDetalhes]; ?></a></div></td>
  415 + </tr>
  416 + <?
  417 + $strCorFundo = !$strCorFundo;
  418 + $intAuxDetalhes ++;
  419 + $intSequencialDetalhes ++;
  420 + }
  421 + ?>
  422 + </table></td></tr>
  423 + <?
  424 + $intAuxVersoes = ($intAuxDetalhes-1);
  425 + }
  426 + //else
  427 + // echo $linha;
  428 + }
  429 + } //Fim do for
309 430 ?>
310 431 <tr valign="top" bgcolor="#E1E1E1">
311 432 <td colspan="2" class="cabecalho_tabela"><div align="left"><?=$oTranslator->_('Total de maquinas');?></div></td>
312   - <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><? echo $total_maquinas; ?></div></td>
  433 + <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><? echo $total_maquinas_versao; ?></div></td>
313 434 <td bgcolor="#E1E1E1" class="opcao_tabela"><div align="right">&nbsp;&nbsp;&nbsp;100.00</div></td>
314 435 </tr>
315 436 </table>
316 437 <?
317 438 }
318 439 } //Fim do if das versões
  440 +
  441 +
319 442 // Exibir informações sobre a quantidade de máquinas e licenças
320 443 $query_aplicativo_licencas = "SELECT a.te_licenca,
321   - COUNT(a.te_licenca) as total_equip,
  444 + a.te_versao,
322 445 a.id_aplicativo,
323 446 b.nm_aplicativo ".
324 447 $_SESSION['select'] . ",
325   - b.cs_ide_licenca
  448 + computadores.te_nome_computador,
  449 + computadores.te_ip,
  450 + computadores.id_ip_rede,
  451 + computadores.id_so,
  452 + computadores.te_node_address,
  453 + b.cs_ide_licenca ".
  454 + $strCountLicenca . "
326 455 FROM aplicativos_monitorados a,
327 456 perfis_aplicativos_monitorados b,
328 457 computadores ".
... ... @@ -334,63 +463,152 @@ while($reg_selecao = @mysql_fetch_array($result_query_selecao))
334 463 trim(a.te_licenca) <> '?' AND
335 464 trim(a.te_licenca) <> 'none' AND
336 465 trim(a.te_licenca) <> '' AND
  466 + redes.id_ip_rede = computadores.id_ip_rede AND
  467 + locais.id_local = redes.id_local AND
337 468 computadores.id_so IN (". $_SESSION['so_selecionados'] .") ".
338   - $_SESSION['query_redes'] ."
339   - GROUP BY a.id_aplicativo, a.te_licenca
340   - ORDER BY total_equip desc";
  469 + $_SESSION['query_redes'] .
  470 + $strGroupByLicenca .
  471 + $strOrderByLicenca;
341 472  
342 473 $result_query_licencas = mysql_query($query_aplicativo_licencas);
343 474 if (mysql_num_rows($result_query_licencas))
344 475 {
  476 + // Crio variáveis array a partir do resultado da consulta, para exibição de detalhes (reuso)
  477 + // Anderson Peterle - 31/Julho/2009
  478 + $arrTotalNaLicenca = array();
  479 + $arrTeLicenca = array();
  480 + $arrTeVersao = array();
  481 + $arrTotalEquip = array();
  482 + $arrIdAplicativo = array();
  483 + $arrNmAplicativo = array();
  484 + $arrCsIdeLicenca = array();
  485 + $arrNmRede = array();
  486 + $arrNmLocal = array();
  487 + $arrTeNomeComputador = array();
  488 + $arrTeIp = array();
  489 + $arrIdIpRede = array();
  490 + $arrIdSo = array();
  491 + $arrTeNodeAddress = array();
345 492 ?>
346   - <table width="50%" border="0" align="center">
  493 + <table width="50%" border="1" align="center">
347 494 <tr valign="top" bgcolor="#FFFFFF">
348   - <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="left"><?=$oTranslator->_('Sequencial');?></div></td>
349   - <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="left"><?=$oTranslator->_('Licenca');?></div></td>
  495 + <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Sequencial');?></div></td>
  496 + <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="center"><?=$oTranslator->_('Licenca');?></div></td>
350 497 <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Maquinas');?></div></td>
  498 + <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Percentual', T_SIGLA);?></div></td>
351 499 </tr>
352 500 <?
353   - $total_maquinas = 0;
354   - $sequencial = 1;
  501 + $total_maquinas_licenca = 0;
  502 + $sequencial = 0;
355 503 while($reg_licencas = mysql_fetch_array($result_query_licencas))
356 504 {
357   - $te_informacao = ($reg_licencas['te_licenca']?$reg_licencas['te_licenca']:$reg_licencas['te_versao']);
  505 + $arrTeLicenca[$sequencial] = $reg_licencas['te_licenca'];
  506 + $arrTeVersao[$sequencial] = $reg_licencas['te_versao'];
  507 + $arrIdAplicativo[$sequencial] = $reg_licencas['id_aplicativo'];
  508 + $arrNmAplicativo[$sequencial] = $reg_licencas['nm_aplicativo'];
  509 + $arrNmRede[$sequencial] = $reg_licencas['nm_rede'];
  510 + $arrNmLocal[$sequencial] = $reg_licencas['nm_local'];
  511 + $arrCsIdeLicenca[$sequencial] = $reg_licencas['cs_ide_licenca'];
  512 + $arrTeNomeComputador[$sequencial] = $reg_licencas['te_nome_computador'];
  513 + $arrTeIp[$sequencial] = $reg_licencas['te_ip'];
  514 + $arrIdIpRede[$sequencial] = $reg_licencas['id_ip_rede'];
  515 + $arrIdSO[$sequencial] = $reg_licencas['id_so'];
  516 + $arrTeNodeAddress[$sequencial] = $reg_licencas['te_node_address'];
  517 +
  518 + $arrTotalEquip[$arrTeLicenca[$sequencial]] += ($_POST['rdCsSaidaDetalhada']=='S'?1:0);
  519 +
  520 + $sequencial ++;
  521 + $total_maquinas_licenca += ($_POST['rdCsSaidaDetalhada']=='S'?1:$reg_licencas['total_equip']);
  522 + } //Fim do while
  523 +
  524 + $intSequenciaLicencas = 0;
  525 + for ($intAuxLicencas = 0; $intAuxLicencas < count($arrTeLicenca); $intAuxLicencas ++)
  526 + {
  527 + $intSequenciaLicencas ++;
  528 + $te_informacao = ($arrTeLicenca[$intAuxLicencas]?$arrTeLicenca[$intAuxLicencas]:$arrTeVersao[$intAuxLicencas]);
  529 + if ($intAuxLicencas > 0 && $_POST['rdCsSaidaDetalhada']=='S')
  530 + {
  531 + ?>
  532 + <tr><td colspan="4"></td></tr>
  533 + <tr><td colspan="4"></td></tr>
  534 + <tr valign="top" bgcolor="#E1E1E1">
  535 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Sequencial');?></div></td>
  536 + <td class="cabecalho_tabela"><div align="center"><?=$oTranslator->_('Licenca');?></div></td>
  537 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Maquinas');?></div></td>
  538 + <td class="cabecalho_tabela"><div align="right"><?=$oTranslator->_('Percentual', T_SIGLA);?></div></td>
  539 + </tr>
  540 + <?
  541 + }
358 542 ?>
359 543 <tr>
360   - <td nowrap class="opcao_tabela"><div align="left"><? echo $sequencial; ?></a></div></td>
361   - <td nowrap class="opcao_tabela"><div align="left"><a href="../../estatisticas/aplicativos/est_maquinas_aplicativos.php?telicenca=<? echo $reg_licencas['te_licenca']?>&idaplicativo=<? echo $reg_licencas['id_aplicativo']?>&nmversao=<? echo $reg_licencas['nm_aplicativo']?>" target="_blank"><? echo $te_informacao; ?></a></div></td>
362   - <td nowrap class="opcao_tabela"><div align="right"><? echo $reg_licencas['total_equip'] ?></div></td>
  544 + <td nowrap class="opcao_tabela"><div align="right"><? echo $intSequenciaLicencas; ?></a></div></td>
  545 + <td nowrap class="opcao_tabela"><div align="center"><a href="../../estatisticas/aplicativos/est_maquinas_aplicativos.php?telicenca=<? echo $arrTeLicenca[$intAuxLicencas]?>&idaplicativo=<? echo $arrIdAplicativo[$intAuxLicencas]?>&nmversao=<? echo $arrNmAplicativo[$intAuxLicencas]?>" target="_blank"><? echo $te_informacao; ?></a></div></td>
  546 + <td nowrap class="opcao_tabela"><div align="right"><? echo ($_POST['rdCsSaidaDetalhada']=='S'?$arrTotalEquip[$arrTeLicenca[$intAuxLicencas]]:$total_maquinas_licenca); ?></div></td>
  547 + <td nowrap class="opcao_tabela"><div align="right"><? echo sprintf("%01.2f", ($_POST['rdCsSaidaDetalhada']=='S'?$arrTotalEquip[$arrTeLicenca[$intAuxLicencas]]:$total_maquinas_licenca) * 100 / $total_maquinas_licenca); ?></div></td>
363 548 </tr>
364 549 <?
365   - echo $linha;
366   - $sequencial ++;
367   - $total_maquinas += $reg_licencas['total_equip'];
368   - } //Fim do while
  550 + //echo $linha;
  551 + // Caso o usuário tenha optado por Saída Detalhada...
  552 + // Neste ponto serão exibidos os detalhes em forma de links para os registros de computadores constantes do resultado da consulta
  553 + // Anderson Peterle - 31/Julho/2009
  554 + if ($_POST['rdCsSaidaDetalhada']=='S')
  555 + {
  556 + ?>
  557 + <tr valign="top">
  558 + <td></td>
  559 + <td>
  560 + <table border="0" align="center" cellpadding="0" cellspacing="0" width="80%">
  561 + <tr bgcolor="#E1E1E1">
  562 + <td nowrap class="cabecalho_tabela" width="20%"><div align="right"><?=$oTranslator->_('Sequencial');?></div></td>
  563 + <td>|</td>
  564 + <td nowrap class="cabecalho_tabela" width="20%"><div align="left"><?=$oTranslator->_('Computador');?></div></td>
  565 + <td>|</td>
  566 + <td nowrap class="cabecalho_tabela" width="20%"><div align="left"><?=$oTranslator->_('SubRede');?></div></td>
  567 + <td>|</td>
  568 + <td nowrap class="cabecalho_tabela" width="20%"><div align="left"><?=$oTranslator->_('Local');?></div></td>
  569 + </tr>
  570 + <?
  571 +
  572 + $intSequencialDetalhes = 1;
  573 + $intAuxDetalhes = $intAuxLicencas;
  574 + $te_licenca = $arrTeLicenca[$intAuxDetalhes];
  575 +
  576 + $strCorFundo = '.';
  577 + while ($te_licenca == $arrTeLicenca[$intAuxDetalhes])
  578 + {
  579 + ?>
  580 + <tr <? if ($strCorFundo) { echo 'bgcolor="#CCCCFF"'; } ?>>
  581 + <td nowrap class="opcao_tabela" width="20%"><div align="right"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $intSequencialDetalhes; ?></a></div></td>
  582 + <td>|</td>
  583 + <td nowrap class="opcao_tabela" width="20%"><div align="left"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $arrTeIp[$intAuxDetalhes].' ('.$arrTeNomeComputador[$intAuxDetalhes].')'; ?></a></div></td>
  584 + <td>|</td>
  585 + <td nowrap class="opcao_tabela" width="20%"><div align="left"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $arrIdIpRede[$intAuxDetalhes].' ('.$arrNmRede[$intAuxDetalhes].')'; ?></a></div></td>
  586 + <td>|</td>
  587 + <td nowrap class="opcao_tabela" width="20%"><div align="left"><a href="../../relatorios/computador/computador.php?te_node_address=<? echo $arrTeNodeAddress[$intAuxDetalhes];?>&id_so=<? echo $arrIdSO[$intAuxDetalhes];?>" target="_blank"><? echo $arrNmLocal[$intAuxDetalhes]; ?></a></div></td>
  588 + </tr>
  589 + <?
  590 + $strCorFundo = !$strCorFundo;
  591 + $intAuxDetalhes ++;
  592 + $intSequencialDetalhes ++;
  593 + }
  594 + ?>
  595 + </table></td></tr>
  596 + <?
  597 + $intAuxLicencas = ($intAuxDetalhes-1);
  598 + }
  599 +
  600 + } //Fim do for
369 601 ?>
370 602 </tr>
371 603 <tr valign="top" bgcolor="#E1E1E1">
372 604 <td class="cabecalho_tabela" colspan="2"><div align="left"><?=$oTranslator->_('Total de maquinas');?></div></td>
373   - <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><? echo $total_maquinas; ?></div></td>
  605 + <td bgcolor="#E1E1E1" class="cabecalho_tabela"><div align="right"><? echo $total_maquinas_licenca; ?></div></td>
  606 + <td bgcolor="#E1E1E1" class="opcao_tabela"><div align="right">&nbsp;&nbsp;&nbsp;100.00</div></td>
374 607 </tr>
375 608 </table>
376   - <?
  609 + <?
377 610 } //Fim do if else das versões
378   - ?>
379   - </table>
380   - <br><br>
381   - </table>
382   - <?
383 611 }
384   -
385   - if (!$result_query_versoes)
386   - {
387   - ?>
388   - <tr align="center">
389   - <td colspan="3" align="center" class="label_vermelho"><?=$oTranslator->_('A pesquisa nao retornou registros');?></td>
390   - </tr>
391   - <?
392   - }
393   -
394 612 ?>
395 613 </p>
396 614  
... ...
estatisticas/aplicativos/est_maquinas_aplicativos.php
... ... @@ -41,7 +41,7 @@ AntiSpy(&#39;1,2,3,4&#39;);
41 41 <td rowspan="5" bgcolor="#FFFFFF"><img src="../../imgs/cacic_logo.png" width="50" height="50"></td>
42 42 </tr>
43 43 <tr bgcolor="#E1E1E1">
44   - <td class="cabecalho_rel"<?=$oTranslator->_('Estatisticas de sistemas monitorados');?></td>
  44 + <td class="cabecalho_rel"<?=$oTranslator->_('Estatisticas de sistemas monitorados'); ?></td>
45 45 </tr>
46 46 <tr>
47 47 <td height="1" bgcolor="#333333"></td>
... ...
estatisticas/aplicativos/index.php
... ... @@ -73,7 +73,28 @@ function open_window(theURL,winName,features) {
73 73 </tr>
74 74 </table>
75 75 <form action="../aplicativos/aplicativos.php" target="_blank" method="post" ENCTYPE="multipart/form-data" name="forma" onsubmit="return valida_form()">
76   -<table width="90%" border="0" align="center">
  76 +<table width="90%" border="0" align="center" cellpadding="0">
  77 + <tr>
  78 + <td class="label">
  79 + <?=$oTranslator->_('Saida Detalhada:');?> </td>
  80 + </tr>
  81 + <tr>
  82 + <td height="1" bgcolor="#333333"></td>
  83 + </tr>
  84 + <tr>
  85 + <td valign="top">
  86 + <tr>
  87 + <td><label>
  88 + <input type="radio" name="rdCsSaidaDetalhada" value="S" id="rdCsSaidaDetalhada_0">
  89 + Sim</label>&nbsp;&nbsp;
  90 + <label>
  91 + <input type="radio" name="rdCsSaidaDetalhada" value="N" id="rdCsSaidaDetalhada_1" checked>
  92 + Não</label></td>
  93 + </tr>
  94 +
  95 + </td>
  96 + </tr>
  97 +
77 98 <tr>
78 99  
79 100 <td valign="top">&nbsp;</td>
... ... @@ -82,8 +103,7 @@ function open_window(theURL,winName,features) {
82 103 <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
83 104 <tr>
84 105 <td class="label">
85   - <?=$oTranslator->_('Selecione os sistemas monitorados que deseja exibir:');?>
86   - </td>
  106 + <?=$oTranslator->_('Selecione os sistemas monitorados que deseja exibir:');?> </td>
87 107 </tr>
88 108 <tr>
89 109 <td height="1" bgcolor="#333333"></td>
... ... @@ -141,8 +161,7 @@ function open_window(theURL,winName,features) {
141 161 </tr>
142 162 <tr>
143 163 <td class="ajuda">
144   - (<?=$oTranslator->_('Dica: use SHIFT or CTRL para selecionar multiplos itens');?>)
145   - </td>
  164 + (<?=$oTranslator->_('Dica: use SHIFT or CTRL para selecionar multiplos itens');?>) </td>
146 165 </tr>
147 166 </table></td>
148 167 </tr>
... ... @@ -160,21 +179,19 @@ function open_window(theURL,winName,features) {
160 179 <td valign="top">
161 180 <? $v_require = '../../include/' .($_SESSION['cs_nivel_administracao']<>1 && $_SESSION['cs_nivel_administracao']<>2?'selecao_redes_inc.php':'selecao_locais_inc.php');
162 181 require_once($v_require);
163   - ?>
164   -
165   - </td>
  182 + ?> </td>
166 183 </tr>
167 184 <tr>
168 185 <td valign="top">&nbsp;</td>
169 186 </tr>
170 187 <tr>
171 188 <td valign="top">
172   - <? require_once('../../include/selecao_so_inc.php'); ?>
173   - </td>
  189 + <? require_once('../../include/selecao_so_inc.php'); ?> </td>
174 190 </tr>
175   - <tr>
  191 + <tr>
176 192 <td valign="top">&nbsp;</td>
177 193 </tr>
  194 +
178 195 <tr>
179 196 <td valign="top"> <br> <br> <table width="100%" border="0" cellpadding="0" cellspacing="1">
180 197 <tr>
... ...