| | Relatorio de Horas por O.S | |
| | Autor | Mensagem |
---|
leonardocr
Mensagens : 91 Data de inscrição : 30/04/2012 Idade : 32
| Assunto: Relatorio de Horas por O.S Qui Set 18, 2014 11:23 am | |
| Bom pessoal com vi aqui no fórum muitos precisam de um relatório de que mostra quanto tempo a O.S ficou em atendimento, pois e isso que conta no relatório, quanto tempo gastei atendendo aquele tipo de O.S sem contar o tempo parado ou inativo. Segue abaixo as mudanças façam com cuidado. Bom primeiro vamos criar uma tabela no banco de dados. Banco de dados - Código:
-
CREATE TABLE IF NOT EXISTS `tempo_status_hist` ( `ts_cod` int(6) NOT NULL AUTO_INCREMENT, `ts_ocorrencia` int(5) NOT NULL DEFAULT '0', `ts_status` int(4) NOT NULL DEFAULT '0', `operador` int(4) NOT NULL DEFAULT '0', `ts_tempo` int(10) NOT NULL DEFAULT '0', `ts_data` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `ts_dia` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`ts_cod`), KEY `ts_ocorrencia` (`ts_ocorrencia`,`ts_status`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16212 ; Agora vamos para o código, crie um arquivo com o nome relatorio_slas_hora.php e coloque o codigo abaixo: - Código:
-
<?php /* Copyright 2005 Flávio Ribeiro
This file is part of OCOMON.
OCOMON is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
OCOMON is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Foobar; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */session_start();
include ("../../includes/include_geral.inc.php"); include ("../../includes/include_geral_II.inc.php"); print "<link rel='stylesheet' href='../../includes/css/calendar.css.php' media='screen'></LINK>"; $_SESSION['s_page_ocomon'] = $_SERVER['PHP_SELF'];
$auth = new auth; $auth->testa_user($_SESSION['s_usuario'],$_SESSION['s_nivel'],$_SESSION['s_nivel_desc'],2);
print "<div id='idLoad' class='loading' style='{display:none}'><img src='../../includes/imgs/loading.gif'></div>";
if (!isset($_POST['ok'])) { //&& $_POST['ok'] != 'Pesquisar') print "<html>"; print "<head><script language=\"JavaScript\" src=\"../../includes/javascript/calendar.js\"></script></head>"; print "<body onLoad=\"ajaxFunction('divOperator', 'showOperators.php', 'idLoad', 'area_cod=idArea');\" "; print " <BR><BR>"; print " <B><center>:::".TRANS('TLT_INDICE_STATUS_CALL').":::</center></B><BR><BR>"; print " <FORM action='".$_SERVER['PHP_SELF']."' method='post' name='form1' onSubmit=\"return valida()\" >"; //onSubmit=\"return valida()\" print " <TABLE border='0' align='center' cellspacing='2' bgcolor=".BODY_COLOR." >"; print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_AREA').":</td>";
print " <td>"; print "<Select name='foward' class='select' size=1 id='idOperador' >"; print "<option value=''>Todos</option>"; $query="select nome, user_id from usuarios where area = 1"; $resultado=mysql_query($query); $linhas = mysql_num_rows($resultado); while($row=mysql_fetch_array($resultado)) { print "<option value=".$row['user_id'].">".$row['nome']."</option>"; } // while print " </Select>"; print " </td>"; print " </tr>"; print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_AREA2').":</td>";
print " <td>"; print "<Select name='foward2' class='select' size=1 id='idProblema' >"; print "<option value=''>Selecione um problema</option>"; $query="SELECT * FROM problemas WHERE prob_area = '1' GROUP BY problema ORDER BY problema"; $resultado=mysql_query($query); $linhas = mysql_num_rows($resultado); while($row=mysql_fetch_array($resultado)) { print "<option value=".$row['prob_id'].">".$row['problema']."</option>"; } // while print " </Select>"; print " </td>"; print " </tr>";
print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_DATE_BEGIN').":</td>"; print " <td><INPUT type='text' name='d_ini' class='data' id='idD_ini' value='".date("d-m-Y")."'><a onclick=\"displayCalendar(document.forms[0].d_ini,'dd-mm-yyyy',this)\"><img height='14' width='14' src='../../includes/javascript/img/cal.gif' width='16' height='16' border='0' alt='".TRANS('HNT_SEL_DATE')."'></a></td>"; print " </tr>"; print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_DATE_FINISH').":</td>"; print " <td><INPUT type='text' name='d_fim' class='data' id='idD_fim' value='".date("d-m-Y")."'><a onclick=\"displayCalendar(document.forms[0].d_fim,'dd-mm-yyyy',this)\"><img height='14' width='14' src='../../includes/javascript/img/cal.gif' width='16' height='16' border='0' alt='".TRANS('HNT_SEL_DATE')."'></a></td>"; print " </tr>"; print "<tr><td colspan='2'><input type='checkbox' name='novaJanela' title='".TRANS('HNT_NEW_WINDOW').".'>".TRANS('OPT_NEW_WINDOW')."<td><tr>"; print " </TABLE><br>";
print " <TABLE align='center'>"; print " <tr>"; print " <td>"; print " <input type='submit' class='button' value='".TRANS('BT_SEARCH')."' name='ok' >";//onClick=\"submitForm();\" print " </TD>"; print " <td>"; print " <INPUT type='reset' class='button' value='".TRANS('BT_CLEAR')."' name='cancelar'>"; print " </TD>"; print " </tr>"; print " </TABLE>"; print "</form>"; print "</BODY>"; print "</html>"; }//if !isset($_POST['ok'])
else { //if $ok==Pesquisar
print "<html><body class='relatorio'>";
//PARAMETRIZAR ESSES VALORES
//SLA 1 é menor do que o SLA 2 - VERDE $sla3 = 6; //INICIO DO VERMELHO - Tempo de SOLUÇÃO EM HORAS $sla2 = 4; //INÍCIO DO AMARELO $slaR3 = 3600; //Tempo de RESPOSTA em segundos VERMELHO $slaR2 = 1800; //AMARELO $percLimit = 20; //Limite em porcento que um chamado pode estourar para ficar no SLA2 antes de ficar no vermelho
//$sla3 = 6; //INICIO DO VERMELHO - Tempo de SOLUÇÃO EM HORAS //$sla2 = 4; //INÍCIO DO AMARELO //$slaR3 = 14400; //Tempo de RESPOSTA em segundos VERMELHO //$slaR2 = 7200; //AMARELO //$percLimit = 20; //Limite em porcento que um chamado pode estourar para ficar no SLA2 antes de ficar no vermelho
$corSla1 = "green"; $corSla2 = "orange"; $corSla3 = "red";
$chamadosSgreen = array(); $chamadosSyellow = array(); $chamadosSred = array();
$chamadosRgreen = array(); $chamadosRyellow = array(); $chamadosRred = array();
$hora_inicio = ' 00:00:00'; $hora_fim = ' 23:59:59';
$qryUpdOco = "UPDATE ocorrencias SET data_abertura = oco_real_open_date WHERE data_abertura = '0000-00-00 00:00:00' "; $execUpdoco = mysql_query($qryUpdOco); $query = "SELECT ts_ocorrencia AS ocorrencia,ts_data,prob_id, p.problema AS problema, date( ts_data ) AS dia,u.Nome AS nome, SEC_TO_TIME( ts_tempo ) AS horas, ts_tempo AS segundos, time( ts_data ) AS data, time( TIMESTAMP( ts_data, SEC_TO_TIME( ts_tempo ) ) ) AS HoraFinal FROM tempo_status_hist h LEFT OUTER JOIN usuarios u ON ( h.operador = u.user_id ) LEFT OUTER JOIN ocorrencias o ON ( o.numero = h.ts_ocorrencia ) LEFT OUTER JOIN problemas p ON ( o.problema = p.prob_id ) WHERE ts_status =2 AND ts_tempo <>0"; if (isset($_POST['foward']) || isset($_POST['foward2']) ) { if (!empty($_POST['foward']) && $_POST['foward'] != -1) $query.= " AND h.operador=".$_POST['foward']." "; if (!empty($_POST['foward2']) && $_POST['foward2'] != -1) $query.= " AND prob_id=".$_POST['foward2']." ";
}
if ((!isset($_POST['d_ini'])) || ((!isset($_POST['d_fim'])))) {
print "<script>window.alert('".TRANS('MSG_PERIOD_INFO')."'); history.back();</script>"; } else{ $d_ini_nova = converte_dma_para_amd(str_replace("-","/",$_POST['d_ini'])); $d_ini_fim = converte_dma_para_amd(str_replace("-","/",$_POST['d_fim'])); //print $query; $d_ini_completa = $d_ini_nova.$hora_inicio; $d_fim_completa = $d_ini_fim.$hora_fim; //$dias_va //Alterado de data_abertura para data_fechamento -- ordena mudou de fechamento para abertura $query .= " AND ts_data >= '".$d_ini_completa."' and ts_data <= '".$d_fim_completa."'"; $query .= " order by ts_ocorrencia, ts_data"; $resultado = mysql_query($query); // print "<b>Query--></b> $query<br><br>"; $resultado2 = mysql_query($query); // print "<b>Query--></b> $query<br><br>"; $linhas = mysql_num_rows($resultado); $row = mysql_fetch_array($resultado); print "<body style='text-align: center;'>"; print "<div aling='center'>======= RELATORIO DE TEMPO POR ATENDENDE =======</div><br />"; $originalDate = "$d_ini_completa"; $newDate = date("d-m-Y", strtotime($originalDate)); $originalDate2 = "$d_fim_completa"; $newDate2 = date("d-m-Y", strtotime($originalDate2)); if (!empty($_POST['foward'])){ print "<div aling='center'> Periodo: $newDate - $newDate2 </b></div><br />"; print "<div aling='center'> ".$row['nome']."<b> ($linhas)</b></div><br />"; }else{ print "<div aling='center'> Periodo: $newDate - $newDate2 </b></div><br />"; print "<div aling='center'> Todos<b>($linhas)</b></div><br />"; } print "<table TABLE class='header_centro' border='1' cellpadding='5' cellspacing='0' align='center' width='100%' > <tr class='header'> <td >Numero Ocorrencia</td> <td >Problema</td> <td >Data Abertura</td> <td >Hora Inicio</td> <td >Aguardando Atendimento</td> <td >Tempo Em Atendimento</td> <td >Hora Final</td> </tr>"; $cont = 0; if($linhas == 0) { //print "<script>window.alert('Nao Existe Registro para o Periodo Informado!'); history.back();</script>"; } else { //if($linhas==0) $i=0; $j=2; while ($row2 = mysql_fetch_array($resultado2)) { // $sql3 = "SELECT T.ts_ocorrencia as chamado, S.status as status, sum(T.ts_tempo) as total, sec_to_time(sum(T.ts_tempo)) as tempo, ". "SAT.status as status_atual, T.ts_status as codStat, O.status as codStatAtual, T.ts_data as data ". "FROM ocorrencias as O, tempo_status as T, `status` as S, `status` as SAT ". "WHERE O.numero = T.ts_ocorrencia and S.stat_id = T.ts_status and T.ts_ocorrencia = ".$row2['ocorrencia']." and O.status = SAT.stat_id and T.ts_status = 1 ". "GROUP BY T.ts_ocorrencia, T.ts_status ". "ORDER BY T.ts_ocorrencia, T.ts_status"; $dia = date("d-m-Y", strtotime($row2['dia'])); $resultado3 = mysql_query($sql3); $row3 = mysql_fetch_array($resultado3); if ($j % 2) { $trClass = "lin_par"; } else { $trClass = "lin_impar"; } $j++; print " <tr onMouseOver=\"destaca('linhax".$j."','#C2c2c2');\" onMouseOut=\"libera('linhax".$j."','".$_SESSION['s_colorLinPar']."','".$_SESSION['s_colorLinImpar']."');\"> <td ><div style=\"cursor: hand;\" title=\"Visualizar O.S\"><a onClick= \"javascript: popup_alerta('mostra_hist_status.php?popup=true&numero=".$row2['ocorrencia']."')\"><font color='blue'>".$row2['ocorrencia']."</font></a></div></td> <td >".$row2['problema']."</td> <td >".$dia."</td> <td >".$row2['data']."</td> <td >".$row3['tempo']."</td> <td >".$row2['horas']."</td> <td>".$row2['HoraFinal']."</td> </tr>"; $cont = $cont+$row2['segundos']; $cont2 = $cont2+$row3['total']; }//while chamados $total = $cont /$linhas; $total2 = $cont2 /$linhas; $select = "select SEC_TO_TIME(".$total.") as Total"; $select2 = "select SEC_TO_TIME(".$cont.") as Total"; $select3 = "select SEC_TO_TIME(".$total2.") as Total"; $resultado = mysql_query($select); $resultado2 = mysql_query($select2); $resultado3 = mysql_query($select3); $row = mysql_fetch_array($resultado); $row2 = mysql_fetch_array($resultado2); $row3 = mysql_fetch_array($resultado3); $total_media = $row2['Total']; $total_final = $row['Total']; $total_espera = $row3['Total'];
} //if($linhas==0) }//if ((empty($d_ini)) and (empty($d_fim)))
print "</table><br>"; print "<table width=\"440\" class='header_centro' border='1' cellpadding='5' cellspacing='0'> <tr class='header'> <td colspan=\"2\" align=\"center\">Levantamento de dados</td> </tr> <tr> <td width=\"388\">Tempo Medio em Atendimento</td> <td width=\"138\">$total_final</td> </tr> <tr> <td>Tempo Medio Aguardando Atendimento</td> <td>$total_espera</td> </tr> <tr> <td>Total de Horas Trabalhadas</td> <td>$total_media</td> </tr> </table>"; print "</body></html>"; }//if $ok==Pesquisar
?> <script type='text/javascript'> <!--
function popup(pagina) { //Exibe uma janela popUP x = window.open(pagina,'popup','dependent=yes,width=400,height=200,scrollbars=yes,statusbar=no,resizable=yes'); x.moveTo(window.parent.screenX+50, window.parent.screenY+100); return false }
function popup_alerta(pagina) { //Exibe uma janela popUP x = window.open(pagina,'_blank','dependent=yes,width=700,height=180,scrollbars=yes,statusbar=no,resizable=no'); x.moveTo(600,250);
return false }
function checar() { var checado = false; if (document.form1.novaJanela.checked){ checado = true; } else { checado = false; } return checado; }
//window.setInterval("checar()",1000);
function valida(){ var ok = validaForm('idD_ini','DATA-','Data Inicial',1); if (ok) var ok = validaForm('idD_fim','DATA-','Data Final',1);
if (ok) submitForm();
return ok; }
function submitForm() { if (checar() == true) { document.form1.target = "_blank"; document.form1.submit(); } else { document.form1.target = ""; document.form1.submit(); } } --> </script>
agora vamos mudar alguns arquivos. Entre no arquivo menu.php que fica na raiz do sistema e adicione la pela linha 97 logo abaixo desse codigo - Código:
-
..|SLAs|".$ocoDirPath."relatorio_slas_2.php||".$iconsPath."sla.png|centro e adicione esse - Código:
-
..|Relatorio/Hora|".$ocoDirPath."relatorio_slas_hora.php||".$iconsPath."appointment-new.png|centro"; entre no sistema e faça o teste tem que ficar assim | |
| | | vafonseca
Mensagens : 57 Data de inscrição : 04/10/2013
| Assunto: Re: Relatorio de Horas por O.S Qua Jan 14, 2015 5:23 pm | |
| - leonardocr escreveu:
- Bom pessoal com vi aqui no fórum muitos precisam de um relatório de que mostra quanto tempo a O.S ficou em atendimento, pois e isso que conta no relatório, quanto tempo gastei atendendo aquele tipo de O.S sem contar o tempo parado ou inativo.
Segue abaixo as mudanças façam com cuidado.
Bom primeiro vamos criar uma tabela no banco de dados.
Banco de dados - Código:
-
CREATE TABLE IF NOT EXISTS `tempo_status_hist` ( `ts_cod` int(6) NOT NULL AUTO_INCREMENT, `ts_ocorrencia` int(5) NOT NULL DEFAULT '0', `ts_status` int(4) NOT NULL DEFAULT '0', `operador` int(4) NOT NULL DEFAULT '0', `ts_tempo` int(10) NOT NULL DEFAULT '0', `ts_data` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `ts_dia` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`ts_cod`), KEY `ts_ocorrencia` (`ts_ocorrencia`,`ts_status`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=16212 ; Agora vamos para o código, crie um arquivo com o nome relatorio_slas_hora.php e coloque o codigo abaixo:
- Código:
-
<?php /* Copyright 2005 Flávio Ribeiro
This file is part of OCOMON.
OCOMON is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
OCOMON is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Foobar; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */session_start();
include ("../../includes/include_geral.inc.php"); include ("../../includes/include_geral_II.inc.php"); print "<link rel='stylesheet' href='../../includes/css/calendar.css.php' media='screen'></LINK>"; $_SESSION['s_page_ocomon'] = $_SERVER['PHP_SELF'];
$auth = new auth; $auth->testa_user($_SESSION['s_usuario'],$_SESSION['s_nivel'],$_SESSION['s_nivel_desc'],2);
print "<div id='idLoad' class='loading' style='{display:none}'><img src='../../includes/imgs/loading.gif'></div>";
if (!isset($_POST['ok'])) { //&& $_POST['ok'] != 'Pesquisar') print "<html>"; print "<head><script language="JavaScript" src="../../includes/javascript/calendar.js"></script></head>"; print "<body onLoad="ajaxFunction('divOperator', 'showOperators.php', 'idLoad', 'area_cod=idArea');" "; print " <BR><BR>"; print " <B><center>:::".TRANS('TLT_INDICE_STATUS_CALL').":::</center></B><BR><BR>"; print " <FORM action='".$_SERVER['PHP_SELF']."' method='post' name='form1' onSubmit="return valida()" >"; //onSubmit="return valida()" print " <TABLE border='0' align='center' cellspacing='2' bgcolor=".BODY_COLOR." >"; print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_AREA').":</td>";
print " <td>"; print "<Select name='foward' class='select' size=1 id='idOperador' >"; print "<option value=''>Todos</option>"; $query="select nome, user_id from usuarios where area = 1"; $resultado=mysql_query($query); $linhas = mysql_num_rows($resultado); while($row=mysql_fetch_array($resultado)) { print "<option value=".$row['user_id'].">".$row['nome']."</option>"; } // while print " </Select>"; print " </td>"; print " </tr>"; print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_AREA2').":</td>";
print " <td>"; print "<Select name='foward2' class='select' size=1 id='idProblema' >"; print "<option value=''>Selecione um problema</option>"; $query="SELECT * FROM problemas WHERE prob_area = '1' GROUP BY problema ORDER BY problema"; $resultado=mysql_query($query); $linhas = mysql_num_rows($resultado); while($row=mysql_fetch_array($resultado)) { print "<option value=".$row['prob_id'].">".$row['problema']."</option>"; } // while print " </Select>"; print " </td>"; print " </tr>";
print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_DATE_BEGIN').":</td>"; print " <td><INPUT type='text' name='d_ini' class='data' id='idD_ini' value='".date("d-m-Y")."'><a onclick="displayCalendar(document.forms[0].d_ini,'dd-mm-yyyy',this)"><img height='14' width='14' src='../../includes/javascript/img/cal.gif' width='16' height='16' border='0' alt='".TRANS('HNT_SEL_DATE')."'></a></td>"; print " </tr>"; print " <tr>"; print " <td bgcolor=".TD_COLOR.">".TRANS('OCO_FIELD_DATE_FINISH').":</td>"; print " <td><INPUT type='text' name='d_fim' class='data' id='idD_fim' value='".date("d-m-Y")."'><a onclick="displayCalendar(document.forms[0].d_fim,'dd-mm-yyyy',this)"><img height='14' width='14' src='../../includes/javascript/img/cal.gif' width='16' height='16' border='0' alt='".TRANS('HNT_SEL_DATE')."'></a></td>"; print " </tr>"; print "<tr><td colspan='2'><input type='checkbox' name='novaJanela' title='".TRANS('HNT_NEW_WINDOW').".'>".TRANS('OPT_NEW_WINDOW')."<td><tr>"; print " </TABLE><br>";
print " <TABLE align='center'>"; print " <tr>"; print " <td>"; print " <input type='submit' class='button' value='".TRANS('BT_SEARCH')."' name='ok' >";//onClick="submitForm();" print " </TD>"; print " <td>"; print " <INPUT type='reset' class='button' value='".TRANS('BT_CLEAR')."' name='cancelar'>"; print " </TD>"; print " </tr>"; print " </TABLE>"; print "</form>"; print "</BODY>"; print "</html>"; }//if !isset($_POST['ok'])
else { //if $ok==Pesquisar
print "<html><body class='relatorio'>";
//PARAMETRIZAR ESSES VALORES
//SLA 1 é menor do que o SLA 2 - VERDE $sla3 = 6; //INICIO DO VERMELHO - Tempo de SOLUÇÃO EM HORAS $sla2 = 4; //INÍCIO DO AMARELO $slaR3 = 3600; //Tempo de RESPOSTA em segundos VERMELHO $slaR2 = 1800; //AMARELO $percLimit = 20; //Limite em porcento que um chamado pode estourar para ficar no SLA2 antes de ficar no vermelho
//$sla3 = 6; //INICIO DO VERMELHO - Tempo de SOLUÇÃO EM HORAS //$sla2 = 4; //INÍCIO DO AMARELO //$slaR3 = 14400; //Tempo de RESPOSTA em segundos VERMELHO //$slaR2 = 7200; //AMARELO //$percLimit = 20; //Limite em porcento que um chamado pode estourar para ficar no SLA2 antes de ficar no vermelho
$corSla1 = "green"; $corSla2 = "orange"; $corSla3 = "red";
$chamadosSgreen = array(); $chamadosSyellow = array(); $chamadosSred = array();
$chamadosRgreen = array(); $chamadosRyellow = array(); $chamadosRred = array();
$hora_inicio = ' 00:00:00'; $hora_fim = ' 23:59:59';
$qryUpdOco = "UPDATE ocorrencias SET data_abertura = oco_real_open_date WHERE data_abertura = '0000-00-00 00:00:00' "; $execUpdoco = mysql_query($qryUpdOco); $query = "SELECT ts_ocorrencia AS ocorrencia,ts_data,prob_id, p.problema AS problema, date( ts_data ) AS dia,u.Nome AS nome, SEC_TO_TIME( ts_tempo ) AS horas, ts_tempo AS segundos, time( ts_data ) AS data, time( TIMESTAMP( ts_data, SEC_TO_TIME( ts_tempo ) ) ) AS HoraFinal FROM tempo_status_hist h LEFT OUTER JOIN usuarios u ON ( h.operador = u.user_id ) LEFT OUTER JOIN ocorrencias o ON ( o.numero = h.ts_ocorrencia ) LEFT OUTER JOIN problemas p ON ( o.problema = p.prob_id ) WHERE ts_status =2 AND ts_tempo <>0"; if (isset($_POST['foward']) || isset($_POST['foward2']) ) { if (!empty($_POST['foward']) && $_POST['foward'] != -1) $query.= " AND h.operador=".$_POST['foward']." "; if (!empty($_POST['foward2']) && $_POST['foward2'] != -1) $query.= " AND prob_id=".$_POST['foward2']." ";
}
if ((!isset($_POST['d_ini'])) || ((!isset($_POST['d_fim'])))) {
print "<script>window.alert('".TRANS('MSG_PERIOD_INFO')."'); history.back();</script>"; } else{ $d_ini_nova = converte_dma_para_amd(str_replace("-","/",$_POST['d_ini'])); $d_ini_fim = converte_dma_para_amd(str_replace("-","/",$_POST['d_fim'])); //print $query; $d_ini_completa = $d_ini_nova.$hora_inicio; $d_fim_completa = $d_ini_fim.$hora_fim; //$dias_va //Alterado de data_abertura para data_fechamento -- ordena mudou de fechamento para abertura $query .= " AND ts_data >= '".$d_ini_completa."' and ts_data <= '".$d_fim_completa."'"; $query .= " order by ts_ocorrencia, ts_data"; $resultado = mysql_query($query); // print "<b>Query--></b> $query<br><br>"; $resultado2 = mysql_query($query); // print "<b>Query--></b> $query<br><br>"; $linhas = mysql_num_rows($resultado); $row = mysql_fetch_array($resultado); print "<body style='text-align: center;'>"; print "<div aling='center'>======= RELATORIO DE TEMPO POR ATENDENDE =======</div><br />"; $originalDate = "$d_ini_completa"; $newDate = date("d-m-Y", strtotime($originalDate)); $originalDate2 = "$d_fim_completa"; $newDate2 = date("d-m-Y", strtotime($originalDate2)); if (!empty($_POST['foward'])){ print "<div aling='center'> Periodo: $newDate - $newDate2 </b></div><br />"; print "<div aling='center'> ".$row['nome']."<b> ($linhas)</b></div><br />"; }else{ print "<div aling='center'> Periodo: $newDate - $newDate2 </b></div><br />"; print "<div aling='center'> Todos<b>($linhas)</b></div><br />"; } print "<table TABLE class='header_centro' border='1' cellpadding='5' cellspacing='0' align='center' width='100%' > <tr class='header'> <td >Numero Ocorrencia</td> <td >Problema</td> <td >Data Abertura</td> <td >Hora Inicio</td> <td >Aguardando Atendimento</td> <td >Tempo Em Atendimento</td> <td >Hora Final</td> </tr>"; $cont = 0; if($linhas == 0) { //print "<script>window.alert('Nao Existe Registro para o Periodo Informado!'); history.back();</script>"; } else { //if($linhas==0) $i=0; $j=2; while ($row2 = mysql_fetch_array($resultado2)) { // $sql3 = "SELECT T.ts_ocorrencia as chamado, S.status as status, sum(T.ts_tempo) as total, sec_to_time(sum(T.ts_tempo)) as tempo, ". "SAT.status as status_atual, T.ts_status as codStat, O.status as codStatAtual, T.ts_data as data ". "FROM ocorrencias as O, tempo_status as T, `status` as S, `status` as SAT ". "WHERE O.numero = T.ts_ocorrencia and S.stat_id = T.ts_status and T.ts_ocorrencia = ".$row2['ocorrencia']." and O.status = SAT.stat_id and T.ts_status = 1 ". "GROUP BY T.ts_ocorrencia, T.ts_status ". "ORDER BY T.ts_ocorrencia, T.ts_status"; $dia = date("d-m-Y", strtotime($row2['dia'])); $resultado3 = mysql_query($sql3); $row3 = mysql_fetch_array($resultado3); if ($j % 2) { $trClass = "lin_par"; } else { $trClass = "lin_impar"; } $j++; print " <tr onMouseOver="destaca('linhax".$j."','#C2c2c2');" onMouseOut="libera('linhax".$j."','".$_SESSION['s_colorLinPar']."','".$_SESSION['s_colorLinImpar']."');"> <td ><div style="cursor: hand;" title="Visualizar O.S"><a onClick= "javascript: popup_alerta('mostra_hist_status.php?popup=true&numero=".$row2['ocorrencia']."')"><font color='blue'>".$row2['ocorrencia']."</font></a></div></td> <td >".$row2['problema']."</td> <td >".$dia."</td> <td >".$row2['data']."</td> <td >".$row3['tempo']."</td> <td >".$row2['horas']."</td> <td>".$row2['HoraFinal']."</td> </tr>"; $cont = $cont+$row2['segundos']; $cont2 = $cont2+$row3['total']; }//while chamados $total = $cont /$linhas; $total2 = $cont2 /$linhas; $select = "select SEC_TO_TIME(".$total.") as Total"; $select2 = "select SEC_TO_TIME(".$cont.") as Total"; $select3 = "select SEC_TO_TIME(".$total2.") as Total"; $resultado = mysql_query($select); $resultado2 = mysql_query($select2); $resultado3 = mysql_query($select3); $row = mysql_fetch_array($resultado); $row2 = mysql_fetch_array($resultado2); $row3 = mysql_fetch_array($resultado3); $total_media = $row2['Total']; $total_final = $row['Total']; $total_espera = $row3['Total'];
} //if($linhas==0) }//if ((empty($d_ini)) and (empty($d_fim)))
print "</table><br>"; print "<table width="440" class='header_centro' border='1' cellpadding='5' cellspacing='0'> <tr class='header'> <td colspan="2" align="center">Levantamento de dados</td> </tr> <tr> <td width="388">Tempo Medio em Atendimento</td> <td width="138">$total_final</td> </tr> <tr> <td>Tempo Medio Aguardando Atendimento</td> <td>$total_espera</td> </tr> <tr> <td>Total de Horas Trabalhadas</td> <td>$total_media</td> </tr> </table>"; print "</body></html>"; }//if $ok==Pesquisar
?> <script type='text/javascript'> <!--
function popup(pagina) { //Exibe uma janela popUP x = window.open(pagina,'popup','dependent=yes,width=400,height=200,scrollbars=yes,statusbar=no,resizable=yes'); x.moveTo(window.parent.screenX+50, window.parent.screenY+100); return false }
function popup_alerta(pagina) { //Exibe uma janela popUP x = window.open(pagina,'_blank','dependent=yes,width=700,height=180,scrollbars=yes,statusbar=no,resizable=no'); x.moveTo(600,250);
return false }
function checar() { var checado = false; if (document.form1.novaJanela.checked){ checado = true; } else { checado = false; } return checado; }
//window.setInterval("checar()",1000);
function valida(){ var ok = validaForm('idD_ini','DATA-','Data Inicial',1); if (ok) var ok = validaForm('idD_fim','DATA-','Data Final',1);
if (ok) submitForm();
return ok; }
function submitForm() { if (checar() == true) { document.form1.target = "_blank"; document.form1.submit(); } else { document.form1.target = ""; document.form1.submit(); } } --> </script>
agora vamos mudar alguns arquivos. Entre no arquivo menu.php que fica na raiz do sistema e adicione la pela linha 97 logo abaixo desse codigo - Código:
-
..|SLAs|".$ocoDirPath."relatorio_slas_2.php||".$iconsPath."sla.png|centro e adicione esse - Código:
-
..|Relatorio/Hora|".$ocoDirPath."relatorio_slas_hora.php||".$iconsPath."appointment-new.png|centro"; entre no sistema e faça o teste tem que ficar assim
Leonardo Efetuei o procedimento informado prem encontrei 2 problemas 1 resolvi parcialemente e o outro nao consegui resolver o Primeiro Ao adicionar o codigo na linha 91 "..|Relatorio/Hora|".$ocoDirPath."relatorio_slas_hora.php||".$iconsPath."appointment-new.png|centro"; ele apresenta erro, percebi que adicionando ele "inativa todos os codigos abaixo, ficam cinzas. Substituir pelo SLA e redirecionei os condigos somente assim funcionou. porem nao ficou com Layout adequado. 2º ao tentar tirar relatorio, porem nao gera nenhuma informação, sendo que as tabelas foram criadas como solitado. As Opçoes de Selecionar usuario e Problema nao abre. Alguma informação adicional? | |
| | | leonardocr
Mensagens : 91 Data de inscrição : 30/04/2012 Idade : 32
| Assunto: Resposta Qui Jan 15, 2015 8:04 am | |
| Bom coloque um print do erro aqui no forum e me add no skype leonardo.rodovalho. | |
| | | rombesso
Mensagens : 91 Data de inscrição : 22/06/2011
| Assunto: Re: Relatorio de Horas por O.S Qui Jan 15, 2015 8:31 am | |
| Vafonseca....
Na linha inserida
..|Relatorio/Hora|".$ocoDirPath."relatorio_slas_hora.php||".$iconsPath."appointment-new.png|centro";
remova o "; do final da linha acima desta que deve funcionar...o que você falou que inativa o código restante é devido a isso, pois você ao colocar o código ficará com duas linhas iguais no final é o "; | |
| | | vafonseca
Mensagens : 57 Data de inscrição : 04/10/2013
| Assunto: Re: Relatorio de Horas por O.S Qui Jan 15, 2015 12:31 pm | |
| - rombesso escreveu:
- Vafonseca....
Na linha inserida
..|Relatorio/Hora|".$ocoDirPath."relatorio_slas_hora.php||".$iconsPath."appointment-new.png|centro";
remova o "; do final da linha acima desta que deve funcionar...o que você falou que inativa o código restante é devido a isso, pois você ao colocar o código ficará com duas linhas iguais no final é o "; Ja fis este Processo e continua dando erro de Sintax na linha 91 onde adicionei o codigo, porem ja ajustei d uma forma que nao apreceça substituindo o sla por ele. Referente a ADD vc no skype ja fiz porem tem varios | |
| | | Conteúdo patrocinado
| Assunto: Re: Relatorio de Horas por O.S | |
| |
| | | | Relatorio de Horas por O.S | |
|
Tópicos semelhantes | |
|
| Permissões neste sub-fórum | Não podes responder a tópicos
| |
| |
| |