Commit d514da91c0bed4c40d6c815a86411caa156cfd52

Authored by Eduardo Santos
Committed by Eduardo Santos
2 parents 4200361b c45c6cce
Exists in master and in 1 other branch 3.1

Correções nos relatórios de software.

src/Cacic/CommonBundle/Entity/ComputadorColetaRepository.php
... ... @@ -150,8 +150,8 @@ class ComputadorColetaRepository extends EntityRepository
150 150 public function gerarRelatorioSoftware( $filtros, $software, $local )
151 151 {
152 152 $qb = $this->createQueryBuilder('coleta')
153   - ->select('DISTINCT IDENTITY(coleta.computador), property.nmPropertyName, coleta.teClassPropertyValue, comp.nmComputador, comp.teNodeAddress,
154   - comp.teIpComputador, so.idSo, so.inMswindows, so.sgSo, rede.idRede, rede.nmRede, rede.teIpRede, local.nmLocal, local.idLocal, comp.dtHrInclusao')
  153 + ->select('DISTINCT IDENTITY(coleta.computador), comp.nmComputador, comp.teNodeAddress,
  154 + comp.teIpComputador, so.inMswindows, so.sgSo, rede.idRede, rede.nmRede, rede.teIpRede, local.nmLocal, max(hist.dtHrInclusao) as dtHrInclusao')
155 155 ->innerJoin('CacicCommonBundle:ComputadorColetaHistorico','hist', 'WITH', 'coleta.idComputadorColeta = hist.computadorColeta')
156 156 ->innerJoin('coleta.classProperty', 'property')
157 157 ->innerJoin('property.idClass', 'classe')
... ... @@ -161,15 +161,14 @@ class ComputadorColetaRepository extends EntityRepository
161 161 ->innerJoin('rede.idLocal', 'local')
162 162 ->innerJoin('CacicCommonBundle:PropriedadeSoftware', 'prop', 'WITH', 'prop.classProperty = coleta.classProperty')
163 163 ->innerJoin('prop.software', 'soft')
164   - ->orWhere('property.nmPropertyName = :software')
165   - ->orWhere('prop.displayName = :software')
  164 + ->andWhere('soft.nmSoftware = :software')
  165 + ->groupBy('coleta.computador, comp.nmComputador, comp.teNodeAddress,
  166 + comp.teIpComputador, so.inMswindows, so.sgSo, rede.idRede, rede.nmRede, rede.teIpRede, local.nmLocal')
166 167 ->setParameter('software', $software);
167 168  
168 169 /**
169 170 * Verifica os filtros
170 171 */
171   - if (!empty($local))
172   - $qb->andWhere('local.nmLocal IN (:local)')->setParameter('local', $local);
173 172  
174 173 if ( array_key_exists('local', $filtros) && !empty($filtros['local']) )
175 174 $qb->andWhere('local.idLocal IN (:locais)')->setParameter('locais', explode( ',', $filtros['locais'] ));
... ...
src/Cacic/CommonBundle/Entity/SoftwareRepository.php
... ... @@ -102,14 +102,14 @@ class SoftwareRepository extends EntityRepository
102 102 {
103 103 // Monta a Consulta básica...
104 104 $qb = $this->createQueryBuilder('sw')
105   - ->select('COALESCE(sw.nmSoftware) as nmSoftware', 'l.nmLocal','COUNT(DISTINCT col.computador) AS numComp')
  105 + ->select('COALESCE(sw.nmSoftware) as nmSoftware', 'r.idRede', 'r.nmRede', 'r.teIpRede', 'l.nmLocal','COUNT(DISTINCT col.computador) AS numComp')
106 106 ->innerJoin('CacicCommonBundle:PropriedadeSoftware', 'prop', 'WITH', 'sw.idSoftware = prop.software')
107 107 ->innerJoin('CacicCommonBundle:ClassProperty', 'class','WITH', 'prop.classProperty = class.idClassProperty')
108 108 ->innerJoin('CacicCommonBundle:ComputadorColeta', 'col', 'WITH', 'col.computador = prop.computador')
109 109 ->innerJoin('CacicCommonBundle:Computador', 'comp', 'WITH', 'col.computador = comp.idComputador')
110 110 ->innerJoin('comp.idRede','r')
111 111 ->leftJoin('r.idLocal', 'l')
112   - ->groupBy('sw.nmSoftware, l.nmLocal')
  112 + ->groupBy('sw.nmSoftware, r.idRede, r.nmRede, r.teIpRede, l.nmLocal')
113 113 ->orderBy('sw.nmSoftware, l.nmLocal');
114 114  
115 115 /**
... ...
src/Cacic/RelatorioBundle/Controller/SoftwareController.php
... ... @@ -239,12 +239,17 @@ class SoftwareController extends Controller
239 239 * @param software O Nome do software a ser listado
240 240 */
241 241  
242   - public function listaAction(Request $request, $nmSoftware, $nmLocal) {
  242 + public function listaAction(Request $request, $nmSoftware, $nmLocal, $idRede) {
243 243 $locale = $request->getLocale();
244 244  
  245 + $filtros = array(
  246 + 'locais' => $nmLocal,
  247 + 'redes' => $idRede
  248 + );
  249 +
245 250 $dados = $this->getDoctrine()
246 251 ->getRepository('CacicCommonBundle:ComputadorColeta')
247   - ->gerarRelatorioSoftware($filtros = array(), $nmSoftware, $nmLocal);
  252 + ->gerarRelatorioSoftware($filtros, $nmSoftware);
248 253  
249 254 return $this->render(
250 255 'CacicRelatorioBundle:Software:rel_software_lista.html.twig',
... ...
src/Cacic/RelatorioBundle/Resources/config/routing.yml
... ... @@ -119,8 +119,8 @@ cacic_relatorio_hardware_wmi_rel:
119 119 _method: POST
120 120  
121 121 cacic_relatorio_software_lista:
122   - pattern: /software/inventariados/{nmSoftware}/{nmLocal}
123   - defaults: { _controller: CacicRelatorioBundle:Software:lista, nmSoftware:null, nmLocal:null }
  122 + pattern: /software/inventariados/{nmSoftware}/{nmLocal}/{idRede}
  123 + defaults: { _controller: CacicRelatorioBundle:Software:lista, nmSoftware:null, nmLocal:null, idRede:null }
124 124  
125 125 cacic_relatorio_hardware_wmi_detalhe:
126 126 pattern: /hardware/{classe}/{propriedade}
... ...
src/Cacic/RelatorioBundle/Resources/views/Software/rel_inventariados.html.twig
... ... @@ -11,9 +11,11 @@
11 11 <thead>
12 12 <tr>
13 13 <th width="5%" style="text-align: center"></th>
14   - <th width="30%">{{ "Software"|trans }}</th>
15   - <th width="20%">{{ "Local"|trans }}</th>
16   - <th width="20%" style="text-align: center">{{ "Máquinas"|trans }}</th>
  14 + <th width="20%">{{ "Software"|trans }}</th>
  15 + <th width="10%">{{ "Local"|trans }}</th>
  16 + <th width="10%">{{ "Ip da Rede"|trans }}</th>
  17 + <th width="30%">{{ "Nome da Rede"|trans }}</th>
  18 + <th width="10%" style="text-align: center">{{ "Máquinas"|trans }}</th>
17 19 </tr>
18 20 </thead>
19 21  
... ... @@ -24,8 +26,10 @@
24 26 <tr>
25 27 <td style="text-align: center">{{ loop.index }}</td>
26 28 <td><a href="{{ path('cacic_relatorio_software_lista') }}/{{ reg['nmSoftware'] }}" title="{{ "Relatório de coletas do software"|trans }}" target="_blank">{{ reg['nmSoftware'] }}</a></td>
27   - <td>{{ reg['nmLocal'] }}</td>
28   - <td style="text-align: center"><a href="{{ path('cacic_relatorio_software_lista') }}/{{ reg['nmSoftware'] }}/{{ reg['nmLocal'] }}" title="{{ "Relatório de coletas do software"|trans }}" target="_blank">{{ reg['numComp'] }}</a></td>
  29 + <td><a href="{{ path('cacic_relatorio_software_lista') }}/{{ reg['nmSoftware'] }}/{{ reg['nmLocal'] }}" title="{{ "Relatório de coletas do software no local"|trans }}" target="_blank">{{ reg['nmLocal'] }}</a></td>
  30 + <td><a href="{{ path('cacic_relatorio_software_lista') }}/{{ reg['nmSoftware'] }}/{{ reg['nmLocal'] }}/{{ reg['idRede'] }}" title="{{ "Relatório de coletas do software na rede"|trans }}" target="_blank">{{ reg['teIpRede'] }} </a></td>
  31 + <td><a href="{{ path('cacic_relatorio_software_lista') }}/{{ reg['nmSoftware'] }}/{{ reg['nmLocal'] }}/{{ reg['idRede'] }}" title="{{ "Relatório de coletas do software na rede"|trans }}" target="_blank">{{ reg['nmRede'] }}</a></td>
  32 + <td style="text-align: center"><a href="{{ path('cacic_relatorio_software_lista') }}/{{ reg['nmSoftware'] }}/{{ reg['nmLocal'] }}/{{ reg['idRede'] }}" title="{{ "Relatório de coletas do software na rede"|trans }}" target="_blank">{{ reg['numComp'] }}</a></td>
29 33 </tr>
30 34  
31 35 {% else %}
... ...