Jump to content


Japan_san

Member Since 21/05/2008
Offline Last Active 15/08/2008, 16:36
-----

Topics I've Started

Grafico Em Php

11/08/2008, 17:38

boa noite pessoal
queira tirar uma duvida
teria como criar graficos em php?

se tiver onde tem o tutorial pra eu estudar?
ou artigos

Tela De Classificação Em Java Script

08/08/2008, 15:06

boa tarde pessoal

tenho um problema aqui!
num sei desenvolvel direito em java

queria saber como q eu faço uma tela de classificação em java para uma pagina de internet
no momento so tenho ela em php

meu chefe
queria o seguinte

tem 3 cambos
uma de classificação
outra de projeto
e a ultima de data

quando o usuario for classificar um chamado!
quando selecionado uma das opções da classificação mudaria automaticamente o campo data e ao mesmo tempo o usuario poderia altera manualmente a data mais como padrão a data sera alterada automaticamente

como por exemplo
quando o usuario for classificar um chamado
seleciona a classificação para pendencia
no campo da data que seria de hj
acrecentaria mais 2 dia
(hj 8/8/08 -> +2dia -> 10/8/08)

mais quando o usuario for selecionar no box a classificação como solicitação
no campo da data teria um acrecimo de 60 dia!
(hj 8/8/08 -> +60dia -> 8/10/08)

a pagina que eu tenho e em php
<style type="text/css"><!--@import url("../css/apresentacao.css");body {	background-image: url(Pictures/fundo_hepdesk_sem_logo.gif);}.style1 {	color: #009ACE;	font-weight: bold;	font-size: xx-small;}.style2 {font-family: "Times New Roman", Times, serif}#box{width:162;}--></style><?	include ("includes/db.inc.php");	$con = db_conecta(); //o coadigo abaixo faz a conexão com o banco e sua tabela para que possa rodar dinamicamente o campo.$project = $row['cd_projeto'];  	  	$str = "select * from projeto";$result = mysql_query($str,$con);//$row = mysql_fetch_array($result,$con);$cont =  mysql_num_rows($result);			$cdch=$_GET['cdch'];$select_cla=$_POST['select_cla'];$select_pro=$_POST['select_pro'];$dt_prev=$_POST['dt_prev'];$dia=$_POST['dia'];$mes=$_POST['mes'];$ano=$_POST['ano'];$hora=$_POST['hora'];$min=$_POST['min'];		// no se incluimos o select_pro para que ela faça o seu respectivo update	 if ((($select_cla == 'S') or ($select_cla == 'P') or ($select_cla == 'D')) and (($select_pro == '1') or ($select_pro == '2') or ($select_pro == '3') or ($select_pro == '4') or ($select_pro == '5') or ($select_pro == '6') or ($select_pro == '7') or ($select_pro == '8') or ($select_pro == '9')))	  {     		$dt_prev = $ano."/".$mes."/".$dia." ".$hora.":".$min.":00";	  	$str = " UPDATE chamado				 set sg_classifica_chamado = '$select_cla', cd_projeto = '$select_pro', dt_previsao_chamado = '$dt_prev'				 where cd_chamado = $cdch";	  	$result = mysql_query($str,$con); 	  				 			   		if ($result)         {		?>				   <p align="center" class="warning">Seu chamado foi classificado com sucesso!<br></p>		   <p align=center ><input name="fechar" type="button" class="botao" value="Fechar" size="50" onClick="window.close();"></p>		<?		 }		else		 { ?>		  <p align="center" class="warning">Ocorreu um erro na classificação do seu chamado.Tente Novamente!<br></p>		  <p align=center ><input name="fechar" type="button" class="botao" value="Voltar" size="50" onClick="history.back();"></p>	  <? }	  }	 else	  { ?><html><head><title> Classificação do chamado <?=$cdch?> </title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><form action="<?=$PHP_SELF?>?cdch=<?=$cdch?>" method="post" ><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0" class="esp">  <tr>    <td align="center"><table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">      <tr>        <td width="60%" align="left" ><span class="style1">Nova Classifica&ccedil;&atilde;o:</span></td>        <td width="50%" ><select id="box" name="select_cla"> 		<option value="0">-Selecione-</option>		<option value="P" selected>Pendência</option>		<option value="S">Solicitação</option>		<option value="R">Proposta</option>		<option value="D">D&uacute;vida</option>		 </select>		 </td>      </tr>	  <tr>	  	<td width="60%" height="28" align="left"><span class="style1">Projeto:</span></td>		<td width="50%"><select id="box" name="select_pro"><?php while ($row = mysql_fetch_assoc($result)) : ?>		<option value="<?=$row['cd_projeto']?>"		<?php if ($row['cd_projeto'] == $project) :?> 		selected="selected"<?php endif; ?> >		<?=$row['nm_projeto']?></option>		<?php endwhile; ?></select></td>	  </tr>	  <tr>	  	<td width="60%" align="left"><span class="style1">Previs&atilde;o:</span></td>		<td width="50%" valign="middle"><span class="style1">		  <input name="dia" type="text" value="<?=date("d"); ?>" size="1" maxlength="2">		  /						<input name="mes" type="text" value="<?=date("m"); ?>" size="1" maxlength="2">						/						<input name="ano" type="text" value="<?=date("Y"); ?>" size="4" maxlength="4">						&nbsp;&nbsp;&nbsp;						<input name="hora" type="text" value="<?=date("H"); ?>" size="1" maxlength="2">						:						<input name="min" type="text" value="<?=date("i"); ?>" size="1" maxlength="2">		</span></td>	  </tr>    </table></td>  </tr>  <tr>    <td align="center">	<br>      <input name=concluir type=submit class=botao id="concluir4" value="Concluir" size=50 >      <input name=cancelar type=button class=botao id="cancelar5" value="Cancelar" size=50 onClick="window.close();">      </td>  </tr></table></form></body></html><?mysql_close($con); }   ?>

mais como faço para implementar este codigo com java script?

aguardo respota!

Como Crio Mensagem Box De Alerta?

07/08/2008, 15:34

queria saber como criar uma mensagem box de alerta!

e o seguinte

eu queria quando o usuario da minha pagina ao cricar num link
caso não corresponda as condições basicas retorna pra ele um alerta dizendo que não atendeu as condições basicas!

teria como dizer como q faço o mensagem box de alerta?

num sei se vc entenderam?

aguardo resposta
obrigado!

Pagina De Media

06/08/2008, 16:42

tenho umas duvida aqui
eu acho q eu fiz besteira
mais não sei onde q eu errei!
poderiam me ajudar a verificar onde eu errei!

é o seguinte
tenho uma pagina q deveria imprimir as medias de tempo dos fechamentos de chamados aqui da minha pagina
so q não ta e fazendo nada

nem imprimindo nem gera erros nem nada!

abaixo segue o codigo da pagina
<?phpob_start();session_start();IF (!(session_is_registered("login"))){ include ("../navcanc.php") ;} ELSE{include ("includes/db.inc.php");include ("includes/gerais.inc.php"); $con = db_conecta();  $project = $row['cd_projeto'];/*$query = "select * from projeto";$result = mysql_query($query,$conn);$cont = mysql_num_rows($result);*/$str2 = "select * from projeto";$result2 = mysql_query($str2,$con);//$row = mysql_fetch_array($result,$con);$cont2 =  mysql_num_rows($result2);	$str_combo = "select cd_cliente , nm_cliente from cliente";	$rs = mysql_query($str_combo,$con);	$num_rows = mysql_num_rows($rs);	$aux = mysql_fetch_array($rs);/*if(!isset($msg)){$msg=1;}if ($msg == 1) {$msg='Chamado incluído com sucesso!';}else if ($msg == 2) {$msg='Erro na inclusão do chamado!';}*/extract($_GET);extract($_POST);/*$cdc=$_POST['cdc'];$cdu=$_POST['cdu']; $filtra=$_GET['filtra']; $cdu=$_GET['cdu']; $cdc=$_GET['cdc']; $cdchcli=$_GET['cdchcli']; $cdch=$_GET['cdch']; $act=$_GET['act'];  $str_aux2=$_POST['str_aux2'];    if(($_POST['cb_cliente'])===' '){ 	$cb_class=$_GET['cb_cliente'];} else{ 	$cb_cliente=$_POST['cb_cliente'];}   if(($_POST['cb_class'])===' '){ 	$cb_class=$_GET['cb_class'];} else{ 	$cb_class=$_POST['cb_class'];}  if(($_POST['i']) === ' '){ 	$i=$_GET['i'];} else{ 	$i=$_POST['i'];}	 if(($_POST['result_pagina'])=== ' '){ 	$result_pagina=$_GET['result_pagina'];} else{ 	$result_pagina=$_POST['result_pagina'];} if(($_POST['dt_ini'])=== ' '){ 	$dt_ini=$_GET['dt_ini'];} else{ 	$dt_ini=$_POST['dt_ini'];} if(($_POST['dt_fim'])=== ' '){ 	$dt_fim=$_GET['dt_fim'];} else{ 	$dt_fim=$_POST['dt_fim'];} if(($_POST['estado'])=== ' '){ 	$estado=$_GET['estado'];} else{ 	$estado=$_POST['estado'];} */ if ($act == "fechar") {  $cd_cliente = $cdc;  $str = "update chamado 		  set sg_estado_chamado = 'F',		  dt_fechamento_chamado = now()		  		  where		   cd_cliente = $cd_cliente and		   cd_chamado = $cdch";  $result=mysql_query($str,$con);	    $stra = "select nm_email_usuario  		  from usuario 		  where cd_usuario = '$cdu'		  and cd_cliente = '$cdc'";  $rs = mysql_query($stra);	    $aux = mysql_fetch_array($rs);  # Faz o include do PEAR Mail e do Mime.  include ("Mail.php");  include ("Mail/mime.php");  # E-mail de destino. Caso seja mais de um destino, crie um array de e-mails.  # *OBRIGATÓRIO*  $email[0] = $aux['nm_email_usuario'];  $email[1] = $aux['nm_email_usuario2'];  $email[2] = $aux['nm_email_usuario3'];   # Cabeçalho do e-mail.  $headers =     array (      'From'    => 'helpdesk@vilainfo.com.br', # O 'From' é *OBRIGATÓRIO*.      'To'      => '',      'Subject' => 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time())    );  # Define o tipo de final de linha.  $crlf = "\r\n";  # Corpo da Mensagem e texto e em HTML  $text = 'Chamado Nº ' . $cdchcli . ' fechado em '. date("d/m/Y",time());  $html = "<HTML><BODY><SPAN ID=isee1 STYLE=position:absolute;width:0px;height:0px;top:-5px;visibility:hidden><IMG SRC=http://a0.vilainfo-com-br.hst.isee1.net/ WIDTH=1 HEIGHT=1 BORDER=0></SPAN><b><font color=blue>$text</font><b></BODY></HTML>";  # Instancia a classe Mail_mime  $mime = new Mail_mime($crlf);  # Coloca o HTML no email  $mime->setHTMLBody($html);  ##  # Anexa um arquivo ao email.  ##  $mime->addAttachment('/home/suapastahome/www/seuarquivo.txt');  # Procesa todas as informações.  $body = $mime->get();  $headers = $mime->headers($headers);  # Parâmetros para o SMTP. *OBRIGATÓRIO*  $params =     array (      'auth' => true, # Define que o SMTP requer autenticação.      'host' => 'smtp.vilainfo.com.br', # Servidor SMTP      'username' => 'helpdesk=vilainfo.com.br', # Usuário do SMTP      'password' => 'temp' # Senha do seu MailBox.    );      # Define o método de envio  $mail_object =& Mail::factory('smtp', $params);  # Envia o email. Se não ocorrer erro, retorna TRUE caso contrário, retorna um  # objeto PEAR_Error. Para ler a mensagem de erro, use o método 'getMessage()'.  if ($email[0] != "")   {  	 $recipients = $email[0];	# $result = $mail_object->send($recipients, $headers, $body);	mail('helpdesk@vilainfo.com.br', 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body);  }	  if ($email[1] != "")   {  	 $recipients = $email[1];	# $result = $mail_object->send($recipients, $headers, $body);	mail('helpdesk@vilainfo.com.br','Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body);  }  if ($email[2] != "")   {  	 $recipients = $email[2];	 #$result = $mail_object->send($recipients, $headers, $body);	mail('helpdesk@vilainfo.com.br', 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body);  }  if (PEAR::IsError($result))  {    echo "ERRO ao tentar enviar o email. (" . $result->getErrorMessage(). ")";  }     else  {   // echo "Email enviado com sucesso!";  }     }if ($filtra == "yes")   {	if ($cb_cliente != 0)	   {     	 $pos = strpos($cb_cliente,";");		 $cod = substr($cb_cliente,0,$pos);		 $nome = substr($cb_cliente,$pos + 1);	     $str_aux= " and chamado.cd_cliente = $cod"; }	  else  	   { $str_aux= " "; 	   	 $nome = "TODOS";	   }	   	   	  if ($cb_class != 'T')	   {	   	 if($projeto != 't') {	     	$str_aux2 = " and chamado.sg_classifica_chamado = '$cb_class' and chamado.cd_projeto = '$projeto'"; }		 else{		 	$str_aux2 = " and chamado.sg_classifica_chamado = '$cb_class'";}	   }	  else{ 	   	 if($projeto != 't'){		 	$str_aux2 = " and chamado.cd_projeto = '$projeto'";}		 else{	   $str_aux2= " "; }	   }   	   	$str = "select COUNT(chamado.dt_chamado),       			   chamado.sg_classifica_chamado,				   AVG(hour(timediff(chamado.dt_fechamento_chamado,chamado.dt_chamado))+				   (minute(timediff(chamado.dt_fechamento_chamado,chamado.dt_chamado)))/60 +				   (second(timediff(chamado.dt_fechamento_chamado,chamado.dt_chamado)))/3600) as media			from chamado			where chamado.sg_estado_chamado = 'F'										and				  chamado.dt_fechamento_chamado >= '". data2date($dt_ini)  ."'			and				  chamado.dt_fechamento_chamado <= '". data2date($dt_fim) ."'			and			group by chamado.sg_classifica_chamado";  			/* 	$str = "select  			C.cd_cliente,			C.cd_usuario,            cd_chamado,    		cd_chamado_cliente,  			nm_assunto_chamado, 			dt_chamado,			dt_previsao_chamado,			dt_fechamento_chamado,			sg_classifica_chamado,			U.nm_usuario,			C.cd_ip_chamado,			C.sg_classifica_chamado,			P.nm_projeto			from chamado as C,	usuario as U, projeto as P			where 			 U.cd_usuario = C.cd_usuario_postou and			 C.cd_projeto = P.cd_projeto	     	 and U.cd_cliente = C.cd_cliente_postou ". $str_aux .			 " and C.dt_chamado >= '". data2date($dt_ini)  ."'			 and C.dt_chamado <= '". data2date($dt_fim) ."'			 and C.sg_estado_chamado = '$estado'			 and C.cd_chamado_pai = 0  " . $str_aux2 .			 " order by dt_chamado desc ";			*/	 	 /*		$str = "select  			C.cd_cliente,			C.cd_usuario,            cd_chamado,    		cd_chamado_cliente,  			nm_assunto_chamado, 			dt_chamado,			dt_previsao_chamado,			dt_fechamento_chamado,			sg_classifica_chamado,			U.nm_usuario,			C.cd_ip_chamado,			C.sg_classifica_chamado,			P.nm_projeto			from chamado as C,	usuario as U, projeto as P";			*/	$result = mysql_query($str,$con);		if (!($i))	 {	  $i=0;	 }	 else	 {	  mysql_data_seek($result,$i);	 } }?><html><head><title> Bem Vindo Administrador :: Chamados :: Helpdesk Vilainfo </title><script language="Javascript" src="JS/funcoes.js"></script><style type="text/css"><!--@import url("../css/apresentacao.css");--></style><script language="JavaScript" type="text/JavaScript"><!--function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}//--></script></head><body background="Pictures/fundo_hepdesk_sem_logo.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('Pictures/barra_down/barra_down_r2_c2.gif','Pictures/barra_down/contato.gif','Pictures/barra_down/home.gif','Pictures/barra_down/voltar.gif')"><SPAN ID=isee1 STYLE=position:absolute;width:0px;height:0px;top:-5px;visibility:hidden><IMG SRC=http://a0.vilainfo-com-br.hst.isee1.net/ WIDTH=1 HEIGHT=1 BORDER=0></SPAN><table width="100%"  height="100%" border="1" cellpadding="0" cellspacing="0">  <tr valign="top">    <td height="10%"><?php include("includes/barra_top.php")?></td>  </tr>  <tr>    <td width="100%" height="80%" valign="top">		<FORM name="filtro" method="post" action="<?=$_SERVER['PHP_SELF']?>?filtra=yes&cdc=<?=$cdc?>&cdu=<?=$cdu?>"  enctype="multipart/form-data"><table width="90%"  border="0" align="center">  <tr align="center">    <td colspan="2" class="warning"><?=$msg?></td>  </tr>  <tr valign="bottom">    <td width="50%"><input class="botao" type="button" size="50" value="MENU DE OPÇÕES" name="logoff2"  	  onClick="location.href('opcoes.php');"></td>    <td width="50%"><div align="right">      <input class="botao" type="button" size="50" value="LogOff" name="logoff"  	  onClick="location.href('sessionclose.php');">    </td>  </tr></table><table width="90%"  border="0" align="center" class=esp>  <tr class="table_tit">    <td height="20"  align="center" colspan="8"  scope="col">FILTRO DE CHAMADOS</td>    </tr>  <tr >    <td width="10%" nowrap  class="normal_bold"><div align="right">Dt. Inicial: </div></td>    <td width="9%" nowrap class="normal_bold">	<input name="dt_ini" type="text" id="dt_ini"  value="<?=date("01/01/Y",time());?>"   onKeyPress="return(formataData(this))" size="12" maxlength="10"></td>    <td width="8%" nowrap class="normal_bold"><div align="right">Dt. Final:</div></td>    <td width="9%" nowrap class="normal_bold">	<input name="dt_fim" type="text" id="dt_fim" value="<?=date("31/12/Y",time());?>" onKeyPress="return(formataData(this))" size="12" maxlength="10"></td>    <td width="7%" nowrap class="normal_bold">&nbsp;</td>    <td width="12%" nowrap class="normal_bold">&nbsp;</td>    <td width="9%" nowrap class="normal_bold">&nbsp;</td>    <td width="19%" nowrap class="normal_bold"><input class="botao" type="submit" value="Filtrar" name="Submit"></td>  </tr>  <tr >    <td align="right" nowrap  class="normal_bold">&nbsp;</td>    <td align="left" nowrap class="normal_bold">&nbsp;</td>    <td align="right" nowrap class="normal_bold">&nbsp;</td>    <td nowrap class="normal_bold">&nbsp;</td>    <td nowrap class="normal_bold">&nbsp;</td>    <td nowrap class="normal_bold">&nbsp;</td>    <td nowrap>&nbsp;</td>    <td nowrap><div align="right">    </div></td>  </tr></table><br>	<?php	   switch ($estado) 	   {case 'F':         $est= "FECHADO";         break;	    case 'A':         $est = 'ABERTO';         break;   }	   switch ($cb_class) 	   {	    case 'T':         $nm_class= "TODOS";         break;	    case 'P':         $nm_class= "PENDÊNCIAS";         break;   		 		case 'D':		 $nm_class= "DÚVIDA";		 break;		 	    case 'N':         $nm_class= "NÃO CLASSIFICADOS";         break;  	    case 'S':         $nm_class= "SOLICITAÇÕES";         break;  		 		 		}	 if (!$qt_cham) 		{ ?>		 <div align=center class="textobold">Preencha os campos e clique em filtrar para executar a pesquisa!</div>	<?php	}		   else		{	?>         <br>	     <table width="90%"  border="0" align="center">           <tr align="center">             <td width="100%" align="right" class="textobold"><b>               <?php  if (($dt_ini) && ($dt_fim))	  		{ ?>Período: <?=$dt_ini?> a <?=$dt_fim?><?php } ?>             </b> </td>           </tr>        </table>		        <TABLE width="90%"border=1 align=center class=esp>    <TR class="table_tit">      <TD height="20" colSpan=4>      <DIV align=center> Chamados  <?=$est?>s - Cliente: <?=$nome?> - Classifica&ccedil;&atilde;o: <?=$nm_class?>      </DIV>             </TD>    </TR>    <TR align="center" valign="middle">      <TD align="center"  class="normal_bold">Total de<br>        Chamados Fechados</TD>    <TD align="center"  class="normal_bold">Classifica&ccedil;&atilde;o</TD>	<td align="center" class="normal_bold">M&eacute;dia do tempo de fechamento (horas) </td>	<?php if ($estado == 'A')   	{  ?>     <?php    }    else    { ?>     <?php     } ?>    </TR>   <?php if ($filtra=="yes")    {	$teste =  ($i + $result_pagina);     while (( $i < $qt_cham) && ($i < $teste ))     { 	 $row = mysql_fetch_array($result);?>      <TR>        <TD align="center" nowrap ><?=$row['COUNT(chamado.dt_chamado)']?></TD>      <TD width="100" align="center" nowrap><?=$row['chamado.sg_classifica_chamado']?></TD>	  	  <TD align="center" nowrap><?=substr($row['media'],0,45)?></TD>	      </TR>   <?php  $i++;   }       }	 		extract($_GET);     if ($i > $result_pagina)    {?>    <a href="<?=$_SERVER['PHP_SELF']?>?i=<?=$i-($result_pagina+1)?>&filtra=yes&dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>&cb_class=<?=$cb_class?>&cb_cliente=<?=$cb_cliente?>&projeto=<?=$projeto?>">	<img src="Pictures/prev.gif" border="0"></a>              <?php			    }				extract($_GET);		if ($i < $qt_cham)			  {?>              <a href="<?=$_SERVER['PHP_SELF']?>?i=<?=$i+($result_pagina)?>&filtra=yes&dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>&cb_class=<?=$cb_class?>&cb_cliente=<?=$cb_cliente?>&projeto=<?=$projeto?>"><img  src="Pictures/next.gif" border="0"></a>              <?php }?>			      <TR class="td_">      <TD height="20" colSpan=4><p><b>Chamados:               <?=$qt_cham?>               </b></p> 	  </TD>      </TR>  </TABLE>  <?php } ?></FORM >    </td>  </tr>  <tr valign="bottom">    <td height="10%"><? include("includes/barra_down_int.php")?></td>  </tr></table></body></html><?php  mysql_close($con);} ?>

Ps.:: sera q é meu select? q esta errado?
ou eu estou esqueçendo de algo?

Mysql_data_seek

04/08/2008, 14:43

tenho este problema aqui

Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 10 is invalid for MySQL result index 6 (or the query data is unbuffered) in /home/vilainfo-teste/www/helpdesk/centraladm/chamados.php on line 306

e não estou conseguindo saber qual e realmente o problema!

a pagina de internet e esta!

<?phpob_start();session_start();IF (!(session_is_registered("login"))){ include ("../navcanc.php") ;} ELSE{include ("includes/db.inc.php");include ("includes/gerais.inc.php"); $con = db_conecta();  $project = $row['cd_projeto'];/*$query = "select * from projeto";$result = mysql_query($query,$conn);$cont = mysql_num_rows($result);*/$str2 = "select * from projeto";$result2 = mysql_query($str2,$con);//$row = mysql_fetch_array($result,$con);$cont2 =  mysql_num_rows($result2);	$str_combo = "select cd_cliente , nm_cliente from cliente";	$rs = mysql_query($str_combo,$con);	$num_rows = mysql_num_rows($rs);	$aux = mysql_fetch_array($rs);/*if(!isset($msg)){$msg=1;}if ($msg == 1) {$msg='Chamado incluído com sucesso!';}else if ($msg == 2) {$msg='Erro na inclusão do chamado!';}*/extract($_GET);extract($_POST);/*$cdc=$_POST['cdc'];$cdu=$_POST['cdu']; $filtra=$_GET['filtra']; $cdu=$_GET['cdu']; $cdc=$_GET['cdc']; $cdchcli=$_GET['cdchcli']; $cdch=$_GET['cdch']; $act=$_GET['act'];  $str_aux2=$_POST['str_aux2'];    if(($_POST['cb_cliente'])===' '){ 	$cb_class=$_GET['cb_cliente'];} else{ 	$cb_cliente=$_POST['cb_cliente'];}   if(($_POST['cb_class'])===' '){ 	$cb_class=$_GET['cb_class'];} else{ 	$cb_class=$_POST['cb_class'];}  if(($_POST['i']) === ' '){ 	$i=$_GET['i'];} else{ 	$i=$_POST['i'];}	 if(($_POST['result_pagina'])=== ' '){ 	$result_pagina=$_GET['result_pagina'];} else{ 	$result_pagina=$_POST['result_pagina'];} if(($_POST['dt_ini'])=== ' '){ 	$dt_ini=$_GET['dt_ini'];} else{ 	$dt_ini=$_POST['dt_ini'];} if(($_POST['dt_fim'])=== ' '){ 	$dt_fim=$_GET['dt_fim'];} else{ 	$dt_fim=$_POST['dt_fim'];} if(($_POST['estado'])=== ' '){ 	$estado=$_GET['estado'];} else{ 	$estado=$_POST['estado'];} */ if ($act == "fechar") {  $cd_cliente = $cdc;  $str = "update chamado 		  set sg_estado_chamado = 'F',		  dt_fechamento_chamado = now()		  		  where		   cd_cliente = $cd_cliente and		   cd_chamado = $cdch";  $result=mysql_query($str,$con);	    $stra = "select nm_email_usuario  		  from usuario 		  where cd_usuario = '$cdu'		  and cd_cliente = '$cdc'";  $rs = mysql_query($stra);	    $aux = mysql_fetch_array($rs);  # Faz o include do PEAR Mail e do Mime.  include ("Mail.php");  include ("Mail/mime.php");  # E-mail de destino. Caso seja mais de um destino, crie um array de e-mails.  # *OBRIGATÓRIO*  $email[0] = $aux['nm_email_usuario'];  $email[1] = $aux['nm_email_usuario2'];  $email[2] = $aux['nm_email_usuario3'];   # Cabeçalho do e-mail.  $headers =     array (      'From'    => 'helpdesk@vilainfo.com.br', # O 'From' é *OBRIGATÓRIO*.      'To'      => '',      'Subject' => 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time())    );  # Define o tipo de final de linha.  $crlf = "\r\n";  # Corpo da Mensagem e texto e em HTML  $text = 'Chamado Nº ' . $cdchcli . ' fechado em '. date("d/m/Y",time());  $html = "<HTML><BODY><SPAN ID=isee1 STYLE=position:absolute;width:0px;height:0px;top:-5px;visibility:hidden><IMG SRC=http://a0.vilainfo-com-br.hst.isee1.net/ WIDTH=1 HEIGHT=1 BORDER=0></SPAN><b><font color=blue>$text</font><b></BODY></HTML>";  # Instancia a classe Mail_mime  $mime = new Mail_mime($crlf);  # Coloca o HTML no email  $mime->setHTMLBody($html);  ##  # Anexa um arquivo ao email.  ##  $mime->addAttachment('/home/suapastahome/www/seuarquivo.txt');  # Procesa todas as informações.  $body = $mime->get();  $headers = $mime->headers($headers);  # Parâmetros para o SMTP. *OBRIGATÓRIO*  $params =     array (      'auth' => true, # Define que o SMTP requer autenticação.      'host' => 'smtp.vilainfo.com.br', # Servidor SMTP      'username' => 'helpdesk=vilainfo.com.br', # Usuário do SMTP      'password' => 'temp' # Senha do seu MailBox.    );      # Define o método de envio  $mail_object =& Mail::factory('smtp', $params);  # Envia o email. Se não ocorrer erro, retorna TRUE caso contrário, retorna um  # objeto PEAR_Error. Para ler a mensagem de erro, use o método 'getMessage()'.  if ($email[0] != "")   {  	 $recipients = $email[0];	# $result = $mail_object->send($recipients, $headers, $body);	mail('helpdesk@vilainfo.com.br', 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body);  }	  if ($email[1] != "")   {  	 $recipients = $email[1];	# $result = $mail_object->send($recipients, $headers, $body);	mail('helpdesk@vilainfo.com.br','Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body);  }  if ($email[2] != "")   {  	 $recipients = $email[2];	 #$result = $mail_object->send($recipients, $headers, $body);	mail('helpdesk@vilainfo.com.br', 'Chamado Nº ' . $cdchcli . ' fechado em ' . date("d/m/Y",time()), $body);  }  if (PEAR::IsError($result))  {    echo "ERRO ao tentar enviar o email. (" . $result->getErrorMessage(). ")";  }     else  {   // echo "Email enviado com sucesso!";  }     }if ($filtra == "yes")   {	if ($cb_cliente != 0)	   {     	 $pos = strpos($cb_cliente,";");		 $cod = substr($cb_cliente,0,$pos);		 $nome = substr($cb_cliente,$pos + 1);	     $str_aux= " and chamado.cd_cliente = $cod"; }	  else  	   { $str_aux= " "; 	   	 $nome = "TODOS";	   }	   	   	  if ($cb_class != 'T')	   {	   	 if($projeto != 't') {	     	$str_aux2 = " and chamado.sg_classifica_chamado = '$cb_class' and chamado.cd_projeto = '$projeto'"; }		 else{		 	$str_aux2 = " and chamado.sg_classifica_chamado = '$cb_class'";}	   }	  else{ 	   	 if($projeto != 't'){		 	$str_aux2 = " and chamado.cd_projeto = '$projeto'";}		 else{	   $str_aux2= " "; }	   }   	   	$str = "select  	chamado.cd_cliente,			chamado.cd_usuario,         	chamado.cd_chamado,    		cd_chamado_cliente,  			nm_assunto_chamado, 			dt_chamado,			dt_previsao_chamado,			dt_fechamento_chamado,			sg_classifica_chamado,			usuario.nm_usuario,			chamado.cd_ip_chamado,			chamado.sg_classifica_chamado,			projeto.nm_projeto			from chamado 				join usuario on (usuario.cd_usuario = chamado.cd_usuario_postou and usuario.cd_cliente = chamado.cd_cliente_postou )			join projeto on (chamado.cd_projeto = projeto.cd_projeto)			where chamado.dt_chamado >= '". data2date($dt_ini)  ."'			 and chamado.dt_chamado <= '". data2date($dt_fim) ."'			 and chamado.sg_estado_chamado = '".$estado."'			 and usuario.cd_cliente = chamado.cd_cliente_postou ". $str_aux ."			 and chamado.cd_chamado_pai = 0 " . $str_aux2 . "			 order by dt_chamado desc ";  			/* 	$str = "select  			C.cd_cliente,			C.cd_usuario,            cd_chamado,    		cd_chamado_cliente,  			nm_assunto_chamado, 			dt_chamado,			dt_previsao_chamado,			dt_fechamento_chamado,			sg_classifica_chamado,			U.nm_usuario,			C.cd_ip_chamado,			C.sg_classifica_chamado,			P.nm_projeto			from chamado as C,	usuario as U, projeto as P			where 			 U.cd_usuario = C.cd_usuario_postou and			 C.cd_projeto = P.cd_projeto	     	 and U.cd_cliente = C.cd_cliente_postou ". $str_aux .			 " and C.dt_chamado >= '". data2date($dt_ini)  ."'			 and C.dt_chamado <= '". data2date($dt_fim) ."'			 and C.sg_estado_chamado = '$estado'			 and C.cd_chamado_pai = 0  " . $str_aux2 .			 " order by dt_chamado desc ";			*/	 	 /*		$str = "select  			C.cd_cliente,			C.cd_usuario,            cd_chamado,    		cd_chamado_cliente,  			nm_assunto_chamado, 			dt_chamado,			dt_previsao_chamado,			dt_fechamento_chamado,			sg_classifica_chamado,			U.nm_usuario,			C.cd_ip_chamado,			C.sg_classifica_chamado,			P.nm_projeto			from chamado as C,	usuario as U, projeto as P";			*/	$result = mysql_query($str,$con);		if (!($i))	 {	  $i=0;	 }	 else	 {	  mysql_data_seek($result,$i);	 }		$qt_cham = mysql_num_rows($result);		if ($qt_cham == 0) 	{$qt_cham = "Nenhum Chamado Cadastrado!";} }?><html><head><title> Bem Vindo Administrador :: Chamados :: Helpdesk Vilainfo </title><script language="Javascript" src="JS/funcoes.js"></script><style type="text/css"><!--@import url("../css/apresentacao.css");--></style><script language="JavaScript" type="text/JavaScript"><!--function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}//--></script></head><body background="Pictures/fundo_hepdesk_sem_logo.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('Pictures/barra_down/barra_down_r2_c2.gif','Pictures/barra_down/contato.gif','Pictures/barra_down/home.gif','Pictures/barra_down/voltar.gif')"><SPAN ID=isee1 STYLE=position:absolute;width:0px;height:0px;top:-5px;visibility:hidden><IMG SRC=http://a0.vilainfo-com-br.hst.isee1.net/ WIDTH=1 HEIGHT=1 BORDER=0></SPAN><table width="100%"  height="100%" border="1" cellpadding="0" cellspacing="0">  <tr valign="top">    <td height="10%"><?php include("includes/barra_top.php")?></td>  </tr>  <tr>    <td width="100%" height="80%" valign="top">		<FORM name="filtro" method="post" action="<?=$_SERVER['PHP_SELF']?>?filtra=yes&cdc=<?=$cdc?>&cdu=<?=$cdu?>"  enctype="multipart/form-data"><table width="90%"  border="0" align="center">  <tr align="center">    <td colspan="2" class="warning"><?=$msg?></td>  </tr>  <tr valign="bottom">    <td width="50%"><input class="botao" type="button" size="50" value="MENU DE OPÇÕES" name="logoff2"  	  onClick="location.href('opcoes.php');"></td>    <td width="50%"><div align="right">      <input class="botao" type="button" size="50" value="LogOff" name="logoff"  	  onClick="location.href('sessionclose.php');">    </td>  </tr></table><table width="90%"  border="0" align="center" class=esp>  <tr class="table_tit">    <td height="20"  align="center" colspan="8"  scope="col">FILTRO DE CHAMADOS</td>    </tr>  <tr >    <td width="10%" nowrap  class="normal_bold"><div align="right">Dt. Inicial: </div></td>    <td width="9%" nowrap class="normal_bold">	<input name="dt_ini" type="text" id="dt_ini"  value="<?=date("01/01/Y",time());?>"   onKeyPress="return(formataData(this))" size="12" maxlength="10"></td>    <td width="8%" nowrap class="normal_bold"><div align="right">Dt. Final:</div></td>    <td width="9%" nowrap class="normal_bold">	<input name="dt_fim" type="text" id="dt_fim" value="<?=date("31/12/Y",time());?>" onKeyPress="return(formataData(this))" size="12" maxlength="10"></td>    <td width="7%" nowrap class="normal_bold"><div align="right">Estado: </div></td>    <td width="12%" nowrap class="normal_bold"><select name="estado" id="estado" >      <option value="A">Abertos</option>      <option value="F">Fechados</option>        </select></td>    <td width="9%" nowrap class="normal_bold"><div align="right">Cliente:</div></td>    <td width="19%" nowrap class="normal_bold"><span class="normal_bold">      <select name="cb_cliente" >      <option value="0 <?=$aux['nm_cliente']?>" selected>Todos</option>  	  <?php $i = 1;	  	   		while ($i <= $num_rows )    	 {		  	  ?> 	  	   <option value="<?=$aux['cd_cliente'] . ";" . $aux['nm_cliente']?>"  >   <?=substr($aux['nm_cliente'],0,35)?> </option>	  <?php        	   $aux = mysql_fetch_array($rs);	  	   $i++;	     } 		 $i=0;	  ?>	  </select>    </span></td>  </tr>  <tr >    <td align="right" nowrap  class="normal_bold">Result./P&aacute;g.</td>    <td align="left" nowrap class="normal_bold"><select name="result_pagina" id="select" >      <option value="10">10</option>      <option value="20">20</option>      <option value="30">30</option>      <option value="40">40</option>      <option value="50" >50</option>      <option value="10000" selected>Ilimitado</option>	      </select></td>    <td align="right" nowrap class="normal_bold">Classifica&ccedil;&atilde;o:</td>    <td nowrap class="normal_bold"><select name="cb_class" id="cb_class"  >      <option value="T">Todos</option>      <option value="P">Pendências</option>      <option value="S">Solicitações</option>	  <option value="D">D&uacute;vida</option></option>      <option value="N">Não Classificados</option>    </select>	</td>    <td nowrap class="normal_bold">Projeto</td>    <td nowrap class="normal_bold"><span class="normal_bold"><select name="projeto">      <?			  		$z = 0;					while ($z < $cont2 ) 					{ 						 $aux = mysql_fetch_array($result2);						 ?>      <option value="<?=$aux['cd_projeto']?>">      <?=$aux['nm_projeto']?>      </option>      <?  						 $z++;					}		 	  ?>      <option value="t" selected>Todos</option>    </select></span></td>    <td nowrap>&nbsp;</td>    <td nowrap><div align="right">      <input class="botao" type="submit" value="Filtrar" name="Submit">    </div></td>  </tr></table><br>	<?php	   switch ($estado) 	   {case 'F':         $est= "FECHADO";         break;	    case 'A':         $est = 'ABERTO';         break;   }	   switch ($cb_class) 	   {	    case 'T':         $nm_class= "TODOS";         break;	    case 'P':         $nm_class= "PENDÊNCIAS";         break;   		 		case 'D':		 $nm_class= "DÚVIDA";		 break;		 	    case 'N':         $nm_class= "NÃO CLASSIFICADOS";         break;  	    case 'S':         $nm_class= "SOLICITAÇÕES";         break;  		 		 		}	 if (!$qt_cham) 		{ ?>		 <div align=center class="textobold">Preencha os campos e clique em filtrar para executar a pesquisa!</div>	<?php	}	       else if ($qt_cham == 0)		{ ?>		 <div align=center class="warning">Nenhum Chamado <?=$est?>  Cadastrado!</div> 		 <?php	}	   else		{	?>         <br>	     <table width="90%"  border="0" align="center">           <tr align="center">             <td width="100%" align="right" class="textobold"><b>               <?php  if (($dt_ini) && ($dt_fim))	  		{ ?>Período: <?=$dt_ini?> a <?=$dt_fim?><?php } ?>             </b> </td>           </tr>        </table>		        <TABLE width="100%"border=1 align=center class=esp>    <TR class="table_tit">      <TD height="20" colSpan=15>      <DIV align=center> Chamados  <?=$est?>s - Cliente: <?=$nome?> - Classifica&ccedil;&atilde;o: <?=$nm_class?>      </DIV>             </TD>    </TR>    <TR align="center" valign="middle">      <TD align="center"  class="normal_bold">C&oacute;d.</TD>    <TD align="center" nowrap  class="normal_bold"> Cli.</TD>    <TD align="center"  class="normal_bold">Assunto</TD>	<td align="center" class="normal_bold">Projeto</td>	<td class="normal_bold"><div align="center">Classifica&ccedil;&atilde;o</div></td>    <TD class="normal_bold" ><div align="center">Dt.Abertura</div></TD>	<TD class="normal_bold" ><div align="center">Dt.Previs&atilde;o</div></TD> <?php if ($estado == 'A')   	{  ?>     <TD class="normal_bold"><div align="center">Postado </div> </TD>    <TD align="center"  class="normal_bold">Fec.</TD>    <TD align="center"  class="normal_bold">Res.</TD> <?php    }    else    { ?>     <TD align="center"  class="normal_bold">Dt.Fechamento </TD>     <TD class="normal_bold"><div align="center">Postado </div> </TD> <?php     } ?>    <TD align="center"  class="normal_bold">Vis.</TD>    <TD align="center"  class="normal_bold">Clas</TD>    <TD align="center"  class="normal_bold">IP</TD>    </TR>   <?php if ($filtra=="yes")    {	$teste =  ($i + $result_pagina);     while (( $i < $qt_cham) && ($i < $teste ))     { 	 $row = mysql_fetch_array($result);?>      <TR>        <TD align="center" nowrap ><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">          <?=$row['cd_chamado']?>        </a></TD>      <TD align="center" nowrap ><div align="center"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">      </a><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">      <?=$row['cd_chamado_cliente']?>      </a></div></TD>      <TD width="100" align="left" nowrap><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">        <?=substr($row['nm_assunto_chamado'],0,45)?></a></TD>	  	  <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">	  <?=$row['nm_projeto']?>	  </a></div></TD>	  <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">      <?php switch ($row['sg_classifica_chamado']) 	   {	    case 'N':         $class_temp= "N&atilde;o Classificado";         break;		 		case 'P':		 $class_temp= "Pend&ecirc;ncia";		 break;		 		case 'S':         $class_temp= "Solicita&ccedil;&atilde;o";         break;		 		case 'D':		 $class_temp= "D&uacute;vidas";		 break;		 		Case 'T':		 $class_temp= "Todos";		 break;	   }?>	  <?php echo $class_temp; ?>	 <?php // foi colocado este codigo para facilitar a visualização do nome pos ele vem do banco como codigo.	 //<?=substr($row['sg_classifica_chamado'],0,18) ?> </a></div></TD>      <TD align="center" nowrap><div align="center"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">        <?=date2data(substr($row['dt_chamado'],0,16)); ?><!-- <?=substr($row['dt_chamado'],0,16)?> -->      </a></div></TD>	  	  <TD align="center" nowrap><div align="center"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">        <?=date2data(substr($row['dt_previsao_chamado'],0,16)); ?><!-- <?=substr($row['dt_chamado'],0,16)?> -->      </a></div></TD>	  	  		 <?php if ($estado =='A')  		  {  ?>		        <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">		<?=substr($row['nm_usuario'],0,18)?></a></div></TD>			  <TD align="center" nowrap>			  <a href="chamados.php?act=fechar&cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>&filtra=yes&dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>&cdchcli=<?=$row['cd_chamado_cliente']?>&cb_class=<?=$cb_class?>" onClick='return(confirm("Você tem certeza que deseja fechar o chamado " + <?=$row['cd_chamado']?> + "?"));'> <img src="Pictures/cadeado.bmp" border="0" ></a>			  </TD>			 		      <TD align="center" nowrap>			  <a href="op_chamado.php?acao=resp&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>&pai=<?=$row['cd_chamado']?>&chcli=<?=$row['cd_chamado_cliente']?>"> 	    <img src="Pictures/edit.gif" width="13" height="15" border="0"></a>			  </TD>						<?php		  }	else { ?>	 			  <TD align="center" nowrap>			  <a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">  			  <?=date2data(substr($row['dt_fechamento_chamado'],0,16))?></a></TD>			  		        <TD align="left" nowrap><div align="left"><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">		<?=substr($row['nm_usuario'],0,18)?></a></div></TD>         <?php } ?>		      <TD align="center" nowrap><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>"><img src="Pictures/lupa.gif" width="17" height="16" border="0"></a></TD>              <TD align="center" nowrap><a href="#"><img src="Pictures/podium.gif" width="17" height="16" border="0" onClick="window.open('class.php?cdch=<?=$row['cd_chamado']?>','janela',['width=350','height=120','top=200','left=200'])"></a></TD>              <TD align="center" nowrap><a href="view_chamados.php?cdch=<?=$row['cd_chamado']?>&cdc=<?=$row['cd_cliente']?>&cdu=<?=$row['cd_usuario']?>">                <?=$row['cd_ip_chamado']?>              </a></TD>      </TR>   <?php  $i++;   }       }	      if ($i > $result_pagina)    {?>    <a href="<?=$_SERVER['PHP_SELF']?>?i=<?=$i - ($result_pagina + 1)?>&filtra=yes&cdc=<?=$cdc?>&cdu=<?=$cdu?>&	dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>">	<img src="Pictures/prev.gif" border="0"></a>              <?php			    }						if ($i < $qt_cham)			  {?>              <a href="<?=$_SERVER['PHP_SELF']?>?i=<?=$i?>&filtra=yes&dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&result_pagina=<?=$result_pagina?>&cb_class=<?=$cb_class?>&cb_cliente=<?=$cb_cliente?>&cdch=<?=$cdch?>%0A%09"><img  src="Pictures/next.gif" border="0"></a>              <?php }?>			      <TR class="td_">      <TD height="20" colSpan=15><p><b>Chamados:               <?=$qt_cham?>               </b></p>        <DIV align="right"> <input class="botao" type="button" size="50" value="Imprimir Chamados" name="imprime"  	  onClick="window.open('print_chamados.php?dt_ini=<?=$dt_ini?>&dt_fim=<?=$dt_fim?>&estado=<?=$estado?>&cb_cliente=<?=$cb_cliente?>&est=<?=$est?>');"> </DIV> 	  </TD>      </TR>  </TABLE>  <?php } ?></FORM >    </td>  </tr>  <tr valign="bottom">    <td height="10%"><? include("includes/barra_down_int.php")?></td>  </tr></table></body></html><?php  mysql_close($con);} ?>

IPB Skin By Virteq