Commit 2078b8e7d9c84e711479fd3cb552d4d8eb26f96a
1 parent
1fbdbcb8
Exists in
master
and in
1 other branch
Revisao das geracoes de relatorios nos formatos PDF, ODS e CSV para Anti-Virus, …
…Hardware e Patrimonio. git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/gerente@632 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
6 changed files
with
206 additions
and
162 deletions
Show diff stats
relatorios/antivirus/index.php
... | ... | @@ -373,7 +373,15 @@ echo $itens_combo_servidores; ?> |
373 | 373 | SelectAll(this.form.elements['list4[]']), |
374 | 374 | SelectAll(this.form.elements['list6[]']), |
375 | 375 | SelectAll(this.form.elements['frm_te_servidor[]']), |
376 | - SelectAll(this.form.elements['frm_te_serv_sel[]'])" value=" Gerar Relatório "> | |
376 | + SelectAll(this.form.elements['frm_te_serv_sel[]'])" value=" Gerar Relatório "> | |
377 | +Formato:<select name="formato" size="1"> | |
378 | + | |
379 | + <option value="html">HTML</option> | |
380 | + <option value="ods">Planilha (.ods)</option> | |
381 | + <option value="pdf">PDF</option> | |
382 | + <option value="csv">CSV</option> | |
383 | + | |
384 | + </select> | |
377 | 385 | </div></td> |
378 | 386 | </tr> |
379 | 387 | <tr> | ... | ... |
relatorios/antivirus/rel_antivirus.php
... | ... | @@ -392,12 +392,12 @@ foreach ($table as $row) |
392 | 392 | } |
393 | 393 | $cor = !$cor; |
394 | 394 | |
395 | - $relatorio->addRow(gera_row($num_registro, $row, $fields, $strTripaColunasValidas, $tra)); | |
395 | + $relatorio->addRow(gera_row($num_registro, $row, $fields, $strTripaColunasValidas, $relatorio)); | |
396 | 396 | $num_registro++; |
397 | 397 | } |
398 | 398 | #echo '</table><br><br>'; |
399 | 399 | |
400 | -function gera_row($num_registro, $row, $fields, $strTripaColunasValidas, $tra) | |
400 | +function gera_row($num_registro, $row, $fields, $strTripaColunasValidas, $relatorio) | |
401 | 401 | { |
402 | 402 | $c1 = '<font size="1" face="Verdana, Arial">' . $num_registro . '</font>'; |
403 | 403 | $c2 = "<font size='1' face='Verdana, Arial'><a href='../computador/computador.php?te_node_address=". $row[0] ."&id_so=". $row[1] ."' target='_blank'>" . $row[3] ."</a>"; |
... | ... | @@ -413,6 +413,7 @@ function gera_row($num_registro, $row, $fields, $strTripaColunasValidas, $tra) |
413 | 413 | if ($row[$i] == 'N') |
414 | 414 | { |
415 | 415 | $row[$i] = '<font size="1" face="Verdana, Arial" color="#FF0000"><center><strong>N</strong></center</font>'; |
416 | + $relatorio->setCellColor($num_registro - 1, $i - 2, array(0xFF, 0, 0)); | |
416 | 417 | } |
417 | 418 | else |
418 | 419 | { | ... | ... |
relatorios/hardware/index.php
... | ... | @@ -275,7 +275,16 @@ |
275 | 275 | $_SESSION['cs_nivel_administracao']<>2?"SelectAll(this.form.elements['list2[]'])":"SelectAll(this.form.elements['list12[]'])")?>, |
276 | 276 | SelectAll(this.form.elements['list4[]']), |
277 | 277 | SelectAll(this.form.elements['list6[]'])"> |
278 | - </div></td> | |
278 | + | |
279 | +Formato:<select name="formato" size="1"> | |
280 | + | |
281 | + <option value="html">HTML</option> | |
282 | + <option value="ods">Planilha (.ods)</option> | |
283 | + <option value="pdf">PDF</option> | |
284 | + <option value="csv">CSV</option> | |
285 | + | |
286 | + </select> | |
287 | +</div></td> | |
279 | 288 | </tr> |
280 | 289 | <tr> |
281 | 290 | <td> </td> | ... | ... |
relatorios/hardware/rel_hardware.php
... | ... | @@ -29,6 +29,7 @@ if($_POST['submit']) { |
29 | 29 | $_SESSION["list8"] = $_POST['list8']; |
30 | 30 | $_SESSION["list12"] = $_POST['list12']; |
31 | 31 | $_SESSION["cs_situacao"] = $_POST["cs_situacao"]; |
32 | + $_SESSION['orderby'] = ''; | |
32 | 33 | } |
33 | 34 | ?> |
34 | 35 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ... | ... |
relatorios/patrimonio/index.php
... | ... | @@ -457,7 +457,14 @@ require_once('../../include/library.php'); |
457 | 457 | $_SESSION['cs_nivel_administracao']<>2?"SelectAll(this.form.elements['list2[]'])":"SelectAll(this.form.elements['list12[]'])")?>, |
458 | 458 | SelectAll(this.form.elements['list4[]']), |
459 | 459 | SelectAll(this.form.elements['list6[]'])"> |
460 | - </div></td> | |
460 | + Formato:<select name="formato" size="1"> | |
461 | + | |
462 | + <option value="html">HTML</option> | |
463 | + <option value="ods">Planilha (.ods)</option> | |
464 | + <option value="pdf">PDF</option> | |
465 | + <option value="csv">CSV</option> | |
466 | + | |
467 | + </select></div></td> | |
461 | 468 | </tr> |
462 | 469 | <tr> |
463 | 470 | <td> </td> | ... | ... |
relatorios/patrimonio/rel_patrimonio.php
... | ... | @@ -27,10 +27,17 @@ if($_POST['submit']) |
27 | 27 | $_SESSION["list2"] = $_POST['list2']; |
28 | 28 | $_SESSION["list4"] = $_POST['list4']; |
29 | 29 | $_SESSION["list6"] = $_POST['list6']; |
30 | + $_SESSION["list6o"] = $_POST['list6']; | |
30 | 31 | $_SESSION["list8"] = $_POST['list8']; |
31 | 32 | $_SESSION["list12"] = $_POST['list12']; |
32 | 33 | $_SESSION["cs_situacao"] = $_POST["cs_situacao"]; |
33 | - } | |
34 | + $_SESSION['orderby'] = ''; | |
35 | + $_SESSION['post'] = $_POST; | |
36 | +} | |
37 | +else | |
38 | +{ | |
39 | + $_SESSION["list6"] = $_SESSION['list6o']; | |
40 | +} | |
34 | 41 | |
35 | 42 | ?> |
36 | 43 | <html> |
... | ... | @@ -69,6 +76,10 @@ function MM_openBrWindow(theURL,winName,features) { //v2.0 |
69 | 76 | <br> |
70 | 77 | <? |
71 | 78 | require_once('../../include/library.php'); |
79 | +require_once('../../include/RelatorioHTML.php'); | |
80 | +require_once('../../include/RelatorioPDF.php'); | |
81 | +require_once('../../include/RelatorioODS.php'); | |
82 | +require_once('../../include/RelatorioCSV.php'); | |
72 | 83 | conecta_bd_cacic(); |
73 | 84 | |
74 | 85 | $redes_selecionadas = ''; |
... | ... | @@ -126,8 +137,8 @@ for( $i = 0; $i < count($_SESSION["list6"] ); $i++ ) |
126 | 137 | else if (strpos(strtolower($_SESSION["list6"][$i]), "patrimonio.id_unid_organizacional_nivel1")) |
127 | 138 | $_SESSION["list6"][$i] = str_replace("patrimonio.id_unid_organizacional_nivel1", "unid_organizacional_nivel1.nm_unid_organizacional_nivel1", $_SESSION["list6"][$i]); |
128 | 139 | |
129 | - if (strpos($_SESSION["list6"][$i],'#in_destacar_duplicidade.S')>-1) | |
130 | - { | |
140 | + if (strpos($_SESSION["list6"][$i],'#in_destacar_duplicidade.S') !== FALSE) | |
141 | + { | |
131 | 142 | if ($in_destacar_duplicidade_total) $in_destacar_duplicidade_total .= '#'; |
132 | 143 | $_SESSION["list6"][$i] = str_replace("#in_destacar_duplicidade.S", "", $_SESSION["list6"][$i]); |
133 | 144 | $arr_in_destacar_duplicidade_tmp = explode('\"',$_SESSION["list6"][$i]); |
... | ... | @@ -181,11 +192,10 @@ $where = " AND concat(computadores.te_node_address, DATE_FORMAT(patrimonio.dt_hr |
181 | 192 | $join_UO2 = ''; |
182 | 193 | |
183 | 194 | // Monto as strings de critérios de Unidade Organizacional de Nível 1 e Nível 2, escolhidos para a consulta patrimonial |
184 | - while(list($key, $value) = each($HTTP_POST_VARS)) | |
185 | - { | |
186 | - | |
195 | + while(list($key, $value) = each($_SESSION['post'])) | |
196 | + { | |
187 | 197 | if (trim($value)<>'' && trim($value)<>'123456' && (trim(strpos($key,'frm_condicao1'))<>'' || trim(strpos($key,'IDS_frm'))<>'')) |
188 | - { | |
198 | + { | |
189 | 199 | if (trim(strpos($key,'nivel2'))<>'') // Identificador(es) de UO2 |
190 | 200 | $join_UO2 = $value; |
191 | 201 | elseif (trim(strpos($key,'IDS_frm_UO2'))<>'') // Desvio do campo Option do select UO2... |
... | ... | @@ -209,27 +219,28 @@ $where = " AND concat(computadores.te_node_address, DATE_FORMAT(patrimonio.dt_hr |
209 | 219 | $join_UO1 = str_replace('frm_te_valor_condicao1',$value,$join_UO1); |
210 | 220 | $join_UO1 = str_replace('__','.',$join_UO1); |
211 | 221 | $join_UO1 = str_replace("\'",'',$join_UO1); |
212 | - } | |
213 | - } | |
222 | + } | |
214 | 223 | } |
224 | + } | |
215 | 225 | |
216 | 226 | // Reinicializo o array para nova listagem, agora para os critérios posteriores |
217 | - reset($HTTP_POST_VARS); | |
218 | - while(list($key, $value) = each($HTTP_POST_VARS)) | |
219 | - { | |
227 | + reset($_SESSION['post']); | |
228 | + while(list($key, $value) = each($_SESSION['post'])) | |
229 | + { | |
220 | 230 | if (trim($value)<>'' && trim(strpos($key,'frm_'))<>'' && trim(strpos($key,'frm_UO'))=='') |
221 | - { | |
231 | + { | |
222 | 232 | if (trim(strpos($key,'frm_condicao2_'))<>'') |
223 | - { | |
233 | + { | |
224 | 234 | $criterios .= str_replace('frm_condicao2_','',$value); |
225 | - } | |
235 | + } | |
226 | 236 | elseif (trim(strpos($key,'frm_te_valor_condicao2_'))<>'') |
227 | - { | |
237 | + { | |
228 | 238 | $criterios = str_replace('frm_te_valor_condicao2',$value,$criterios); |
229 | - } | |
239 | + } | |
230 | 240 | $value_anterior = $value; |
231 | - } | |
232 | - } | |
241 | + } | |
242 | + | |
243 | + } | |
233 | 244 | |
234 | 245 | if ($criterios) |
235 | 246 | { |
... | ... | @@ -250,25 +261,25 @@ if ($join_UO1 || $join_UO1a || $join_UO2) |
250 | 261 | } |
251 | 262 | |
252 | 263 | if ($join_UO1a) |
253 | - { | |
264 | + { | |
254 | 265 | $where_uon1a = $where_uon . " AND unid_organizacional_nivel1a.id_unid_organizacional_nivel1 = unid_organizacional_nivel1.id_unid_organizacional_nivel1 AND ".$join_UO1a." " ; |
255 | 266 | // $where_uon = ''; |
256 | 267 | // $from .= " ,unid_organizacional_nivel1a"; |
257 | - } | |
268 | + } | |
258 | 269 | |
259 | 270 | if ($join_UO2) |
260 | - { | |
271 | + { | |
261 | 272 | $where_uon2 = $where_uon . " AND patrimonio.id_unid_organizacional_nivel2 = unid_organizacional_nivel2.id_unid_organizacional_nivel2 AND ".$join_UO2." " ; |
262 | 273 | // $from .= " ,unid_organizacional_nivel2"; |
263 | - } | |
264 | 274 | } |
275 | +} | |
265 | 276 | // O valor para join_opcional é relativo à seleção de critérios para a pesquisa. |
266 | 277 | // O LEFT JOIN só deverá ser utilizado para os casos em que não forem apontados critérios... |
267 | 278 | $join_opcional = ''; |
268 | 279 | if (!$join_UO1 && !$join_UO1a && !$join_UO2) |
269 | - { | |
280 | +{ | |
270 | 281 | $join_opcional = ',computadores left join patrimonio on (computadores.te_node_address = patrimonio.te_node_address AND computadores.id_so = patrimonio.id_so) '; |
271 | - } | |
282 | +} | |
272 | 283 | else |
273 | 284 | { |
274 | 285 | $from .= ' ,patrimonio, computadores '; |
... | ... | @@ -276,6 +287,7 @@ else |
276 | 287 | $query = " SELECT DISTINCT computadores.te_node_address, |
277 | 288 | so.id_so, |
278 | 289 | UNIX_TIMESTAMP(computadores.dt_hr_ult_acesso), |
290 | + UNIX_TIMESTAMP(patrimonio.dt_hr_alteracao), | |
279 | 291 | computadores.te_nome_computador as 'Nome Comp.', |
280 | 292 | sg_so as 'S.O.', |
281 | 293 | computadores.te_ip as 'IP'" . |
... | ... | @@ -299,181 +311,187 @@ $query = " SELECT DISTINCT computadores.te_node_address, |
299 | 311 | ORDER BY " . $orderby; |
300 | 312 | $result = mysql_query($query) or die('Não Existem Registros para os Parâmetros de Consulta Fornecidos ou sua sessão expirou!'); |
301 | 313 | if (mysql_num_rows($result)==0) |
314 | +{ | |
315 | + die('Não Existem Registros para os Parâmetros de Consulta Fornecidos.'); | |
316 | +} | |
317 | +else | |
318 | +{ | |
319 | + $fields=mysql_num_fields($result); | |
320 | + if ($in_destacar_duplicidade_total) | |
302 | 321 | { |
303 | - echo mensagem('Não Existem Registros para os Parâmetros de Consulta Fornecidos.'); | |
322 | + $arr_in_destacar_duplicidade_total = explode('#',$in_destacar_duplicidade_total); | |
304 | 323 | } |
305 | -else | |
306 | - { | |
307 | 324 | |
308 | - $fields=mysql_num_fields($result); | |
309 | - echo '<table cellpadding="2" cellspacing="0" border="1" bordercolor="#999999" bordercolordark="#E1E1E1"> | |
310 | - <tr bgcolor="#E1E1E1" > | |
311 | - <td nowrap align="left"><font size="1" face="Verdana, Arial"> </font></td>'; | |
325 | + if (isset($_GET['formato'])) | |
326 | + { | |
327 | + $formato = $_GET['formato']; | |
328 | + } | |
329 | + else | |
330 | + { | |
331 | + $formato = $_POST['formato']; | |
332 | + } | |
333 | + switch ($formato) | |
334 | + { | |
335 | + case "pdf": | |
336 | + $relatorio = new RelatorioPDF(); | |
337 | + break; | |
338 | + case "ods": | |
339 | + $relatorio = new RelatorioODS(); | |
340 | + break; | |
341 | + case "csv": | |
342 | + $relatorio = new RelatorioCSV(); | |
343 | + break; | |
344 | + default: | |
345 | + $relatorio = new RelatorioHTML(); | |
346 | + break; | |
347 | + } | |
312 | 348 | |
313 | - if ($in_destacar_duplicidade_total) $arr_in_destacar_duplicidade_total = explode('#',$in_destacar_duplicidade_total); | |
349 | + $relatorio->setTitulo('CACIC - Relatório de informações de Patrimônio e Localização Física'); | |
314 | 350 | |
315 | - // Coloco na string abaixo os nomes dos campos que não devem ser mostrados, concatenando-os com # para fins de busca em substring. | |
316 | - $strNaoMostrarCamposNomes = '#dt_hr_alteracao#'; | |
317 | - // Mais adiante eu coloco os indices das colunas que não serão mostradas, concatenando-os com # para fins de busca em substring. | |
318 | - $strNaoMostrarCamposIndices = ''; | |
319 | - | |
320 | 351 | $in_destacar_duplicidade_tmp = ''; |
321 | - for ($i=3; $i < mysql_num_fields($result); $i++) | |
322 | - { //Table Header | |
323 | - $boolNaoMostrar = stripos2($strNaoMostrarCamposNomes,'#'.mysql_field_name($result, $i).'#',false); | |
324 | - if (!$boolNaoMostrar) | |
352 | + $header = array('#'); | |
353 | + for ($i=4; $i < mysql_num_fields($result); $i++) | |
354 | + { //Table Header | |
355 | + $header[] = '<font size="1" face="Verdana, Arial"><b><a href="?orderby=' . ($i + 1) . '">'. mysql_field_name($result, $i) .'</a></b></font>'; | |
356 | + if ($in_destacar_duplicidade_total && in_array(mysql_field_name($result, $i), $arr_in_destacar_duplicidade_total)) | |
357 | + { | |
358 | + if ($in_destacar_duplicidade_tmp) $in_destacar_duplicidade_tmp .= '#'; | |
359 | + $in_destacar_duplicidade_tmp .= $i; | |
360 | + } | |
361 | + } | |
362 | +else | |
363 | + { | |
364 | + | |
365 | + $relatorio->setTableHeader($header); | |
366 | + | |
367 | + | |
368 | + @mysql_data_seek($result,0); | |
369 | + $table = array(); | |
370 | + while ($row = mysql_fetch_row($result)) | |
371 | + {//pre Table body | |
372 | + | |
373 | + // ja existe entrada para este MAC? | |
374 | + if (isset($table[$row[0]])) | |
375 | + { | |
376 | + // acesso mais rencente? | |
377 | + if ($row[2] > $table[$row[0]][2]) | |
378 | + { | |
379 | + $table[$row[0]] = $row; | |
380 | + } | |
381 | + if ($row[2] == $table[$row[0]][2]) | |
325 | 382 | { |
326 | - print '<td nowrap align="left"><font size="1" face="Verdana, Arial"><b><a href="?orderby=' . ($i + 1) . '">'. mysql_field_name($result, $i) .'</a></b></font></td>'; | |
327 | - if ($in_destacar_duplicidade_total && in_array(mysql_field_name($result, $i),$arr_in_destacar_duplicidade_total)) | |
383 | + // desempatar pela entrada de patrimonio mais recente | |
384 | + if ($row[3] > $table[$row[0]][3]) | |
328 | 385 | { |
329 | - if ($in_destacar_duplicidade_tmp) $in_destacar_duplicidade_tmp .= '#'; | |
330 | - $in_destacar_duplicidade_tmp .= $i; | |
386 | + $table[$row[0]] = $row; | |
331 | 387 | } |
332 | 388 | } |
389 | + } | |
333 | 390 | else |
334 | - $strNaoMostrarCamposIndices .= '#'.$i.'#'; | |
391 | + { | |
392 | + $table[$row[0]] = $row; | |
335 | 393 | } |
336 | - echo '</tr>'; | |
394 | + } | |
337 | 395 | |
338 | 396 | if ($in_destacar_duplicidade_tmp) |
339 | 397 | { |
340 | 398 | $arr_in_destacar_duplicidade = explode('#',$in_destacar_duplicidade_tmp); |
341 | 399 | $v_arr_campos_valores = array(); |
342 | 400 | $num_registro = 1; |
343 | - | |
344 | - while ($row = mysql_fetch_row($result)) | |
401 | + foreach ($table as $row) | |
402 | + { | |
403 | + for ($i = 5; $i < $fields; $i++) | |
345 | 404 | { |
346 | - for ($i=3; $i < $fields; $i++) | |
347 | - { | |
348 | 405 | if (trim($row[$i])<>'' && in_array($i,$arr_in_destacar_duplicidade)) |
349 | - { | |
350 | - array_push($v_arr_campos_valores,$i . ',' . trim(strtolower($row[$i]))); | |
351 | - } | |
406 | + { | |
407 | + array_push($v_arr_campos_valores,$i . ',' . trim(strtolower($row[$i]))); | |
352 | 408 | } |
353 | - $num_registro ++; | |
354 | 409 | } |
410 | + $num_registro ++; | |
411 | + } | |
355 | 412 | $v_arr_total_campos_valores = array(); |
356 | 413 | $v_arr_total_campos_valores = array_count_values($v_arr_campos_valores); |
357 | 414 | |
358 | 415 | $num_registro = 1; |
359 | - $v_registro_atual = ''; | |
360 | - @mysql_data_seek($result,0); | |
361 | - while ($row = mysql_fetch_row($result)) | |
416 | + $registros_valores_duplicados = array(); | |
417 | + foreach ($table as $row) | |
418 | + { | |
419 | + for ($i = 5; $i < $fields; $i++) | |
362 | 420 | { |
363 | - for ($i=3; $i < $fields; $i++) | |
421 | + if (trim($row[$i]) != '' && in_array($i, $arr_in_destacar_duplicidade)) | |
364 | 422 | { |
365 | - if (trim($row[$i])<>'' && in_array($i,$arr_in_destacar_duplicidade)) | |
366 | - { | |
367 | 423 | $v_chave = $i . ',' . trim($row[$i]); |
368 | - if ($v_arr_total_campos_valores[$v_chave]>1) | |
424 | + // se o valor aparece mais de 1 vez | |
425 | + if ($v_arr_total_campos_valores[strtolower($v_chave)] > 1) | |
426 | + { | |
427 | + if (!isset($registros_valores_duplicados[$num_registro])) | |
369 | 428 | { |
370 | - if ($v_registro_atual <> $num_registro) | |
371 | - $v_campos_valores_duplicados .= 'r='.$num_registro.'#'; | |
372 | - | |
373 | - $v_registro_atual = $num_registro; | |
374 | - $v_campos_valores_duplicados .= '#c='.$i.'#'; | |
429 | + $registros_valores_duplicados[$num_registro] = array(); | |
375 | 430 | } |
431 | + $registros_valores_duplicados[$num_registro][] = $i; | |
376 | 432 | } |
377 | 433 | } |
378 | - $num_registro++; | |
379 | 434 | } |
435 | + $num_registro++; | |
380 | 436 | } |
437 | + } | |
381 | 438 | |
382 | - $cor = 0; | |
439 | + $cor = FALSE; | |
383 | 440 | $num_registro = 1; |
384 | - @mysql_data_seek($result,0); | |
385 | - while ($row = mysql_fetch_row($result)) | |
386 | - {//pre Table body | |
387 | - | |
388 | - // ja existe entrada para este MAC? | |
389 | - if (isset($table[$row[0]])) | |
390 | - { | |
391 | - // acesso mais rencente? | |
392 | - if ($row[2] > $table[$row[0]][2]) | |
393 | - { | |
394 | - $table[$row[0]] = $row; | |
395 | - } | |
396 | - } | |
397 | - else | |
441 | + foreach ($table as $key => $row) | |
442 | + { //Table body | |
443 | + $possuiCampoDuplicado = isset($registros_valores_duplicados[$num_registro]); | |
444 | + if ($possuiCampoDuplicado) | |
398 | 445 | { |
399 | - $table[$row[0]] = $row; | |
446 | + $relatorio->setRowColor($num_registro - 1, 0xFF, 0xFF, 0x99); //'bgcolor="#FFFF99"'); | |
400 | 447 | } |
401 | - } | |
402 | - | |
403 | - foreach ($table as $row) | |
404 | - { //Table body | |
405 | - $v_key_campos_valores_duplicados = strpos($v_campos_valores_duplicados,'r='.$num_registro.'#',0); | |
406 | - echo '<tr '; | |
407 | - | |
408 | - if ($v_key_campos_valores_duplicados>-1) | |
409 | - echo 'bgcolor="#FFFF99"'; | |
410 | - elseif ($cor) | |
411 | - echo 'bgcolor="#E1E1E1"'; | |
412 | - | |
413 | - echo '>'; | |
414 | 448 | |
415 | - echo '<td nowrap align="right"><font size="1" face="Verdana, Arial">' . $num_registro . '</font></td>'; | |
416 | - echo "<td nowrap align='left'><font size='1' face='Verdana, Arial'><a href='../computador/computador.php?te_node_address=". $row[0] ."&id_so=". $row[1] ."' target='_blank'>" . $row[3] ."</a> </td>"; | |
449 | + $c1 = '<font size="1" face="Verdana, Arial">' . $num_registro . '</font>'; | |
450 | + $c2 = "<font size='1' face='Verdana, Arial'><a href='../computador/computador.php?te_node_address=". $row[0] ."&id_so=". $row[1] ."' target='_blank'>" . $row[4] ."</a>"; | |
417 | 451 | |
418 | - for ($i=4; $i < $fields; $i++) | |
452 | + unset($row[0]); | |
453 | + unset($row[1]); | |
454 | + unset($row[2]); | |
455 | + unset($row[3]); | |
456 | + unset($row[4]); | |
457 | + for ($i=5; $i < $fields; $i++) | |
458 | + { | |
459 | + $cell = '<font size="1" face="Verdana, Arial"'; | |
460 | + $campoDuplicado = FALSE; | |
461 | + | |
462 | + if ($possuiCampoDuplicado) | |
419 | 463 | { |
420 | - $boolNaoMostrar = stripos2($strNaoMostrarCamposIndices,'#'.$i.'#',false); | |
421 | - if (!$boolNaoMostrar) | |
422 | - { | |
464 | + if (in_array($i, $registros_valores_duplicados[$num_registro])) | |
465 | + { | |
466 | + $cell .= 'color="#FF0000" '; | |
467 | + $campoDuplicado = TRUE; | |
468 | + $relatorio->setCellColor($num_registro - 1, $i - 3, array(0xFF, 0, 0)); | |
469 | + } | |
470 | + } | |
423 | 471 | |
424 | - $v_bold=''; | |
425 | - | |
426 | - echo '<td nowrap align="left"><font size="1" face="Verdana, Arial"'; | |
427 | - | |
428 | - $j=$v_key_campos_valores_duplicados; | |
429 | - if ($j>-1) | |
430 | - { | |
431 | - $v_pesquisa_campo = 'c='.trim($i).'#'; | |
432 | - while ($j < strlen($v_campos_valores_duplicados)) | |
433 | - { | |
434 | - if (substr($v_campos_valores_duplicados,$j,strlen($v_pesquisa_campo))==$v_pesquisa_campo) | |
435 | - { | |
436 | - echo 'color="#FF0000"'; | |
437 | - $v_bold = 'OK'; | |
438 | - $j = strlen($v_campos_valores_duplicados); | |
439 | - } | |
440 | - $j++; | |
441 | - | |
442 | - if (substr($v_campos_valores_duplicados,$j,2)=='r=') | |
443 | - { | |
444 | - $j = strlen($v_campos_valores_duplicados); | |
445 | - } | |
446 | - } | |
447 | - | |
448 | - } | |
449 | - | |
450 | - echo '>'; | |
451 | - if ($v_bold) echo '<strong>'; | |
452 | - echo $row[$i]; | |
453 | - if ($v_bold) echo '</strong>'; | |
454 | - echo ' </td>'; | |
455 | - } | |
472 | + $cell .= '>'; | |
473 | + if ($campoDuplicado) | |
474 | + { | |
475 | + $cell .= '<b>'; | |
456 | 476 | } |
457 | - $cor=!$cor; | |
458 | - $num_registro++; | |
459 | - echo '</tr>'; | |
477 | + $cell .= $row[$i]; | |
478 | + | |
479 | + if ($campoDuplicado) | |
480 | + { | |
481 | + $cell .= '</b>'; | |
482 | + } | |
483 | + | |
484 | + $row[$i] = $cell; | |
460 | 485 | } |
461 | - } | |
462 | - | |
463 | -echo '</table>'; | |
464 | -echo '<br><br>'; | |
465 | -/* | |
466 | -if (count($_SESSION["list8"])>0) | |
467 | - { | |
468 | - $v_opcao = 'patrimonio'; // Nome do pie que será chamado por tabela_estatisticas | |
469 | - require_once($_SERVER['DOCUMENT_ROOT'] . '/cacic2/include/tabela_estatisticas.php'); | |
486 | + | |
487 | + array_unshift($row, $c1, $c2); | |
488 | + $relatorio->addRow($row); | |
489 | + $cor = !$cor; | |
490 | + $num_registro++; | |
491 | + | |
492 | + | |
470 | 493 | } |
471 | -*/ | |
472 | -?></p> | |
473 | -<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Relatório | |
474 | - gerado pelo <strong>CACIC</strong> - Configurador Automático e Coletor | |
475 | - de Informações Computacionais</font><br> | |
476 | - <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Software desenvolvido | |
477 | - pela Dataprev - Unidade Regional Espírito Santo</font></p> | |
478 | -</body> | |
479 | -</html> | |
480 | 494 | \ No newline at end of file |
495 | + | |
496 | + $relatorio->output(); | |
497 | +} | |
498 | +?> | ... | ... |