function geraXLS($exibir, $criterios) { $campos = "cred.*, c.nome, reg.desc_regional, c.cod_grupo"; $tabela = "credenciados cred INNER JOIN consultor c ON (c.cod_consultor = cred.cod_consultor) " . "INNER JOIN regional reg ON (reg.cod_regional = cred.cod_regional)"; $query = "SELECT " . $campos . " FROM " . $tabela . " WHERE " . $criterios . " ORDER BY c.cod_grupo, c.nome, cred.cod_regional, cred.desc_empresa"; $resultado = mysql_query($query); // Nome do arquivo que será exportado $arquivo = 'lista_empresas.xls'; //Constroi o HTML $html = '<style>td{font-size:12px;text-align:center;white-space:nowrap;} ' . 'table{border:1px black solid; width:100%} ' . 'td.head{background-color:#cc6;font-weight:bold} ' . 'td{padding:2px} ' . 'tr{background-color:#fff} ' . '</style>'; $html .= '<table>'; $html .= '<tr>'; $html .= '<td class="head">#</td>'; $html .= '<td class="head">GESTOR</td>'; $html .= '<td class="head">CONSULTOR</td>'; $html .= '<td class="head">PDV</td>'; $html .= '<td class="head">EMPRESA</td>'; $html .= '<td class="head">REGIONAL</td>'; $html .= '<td class="head">PERIODICIDADE</td>'; $html .= '</tr>'; $contador = 1; while ($coluna = mysql_fetch_array($resultado)) { $html .= '<tr onMouseOver="this.style.backgroundColor=\'#ff0\';this.style.cursor=\'pointer\';" onMouseOut="this.style.backgroundColor=\'#fff\';" ' . 'onClick="window.open(\'edita_credenciado.php?cod_tipo_empresa=' . $coluna['cod_tipo_empresa'] . '&nome=' . $coluna['nome'] . '&pdv_empresa=' . $coluna['pdv_empresa'] . '&desc_empresa=' . $coluna['desc_empresa'] . '&desc_regional=' . $coluna['desc_regional'] . '&periodicidade=' . $coluna['periodicidade'] . '&nvl=' . $_SESSION['nivel_acesso'] . '\',\'_blank\',\'fullscreen=no,toolbar=no,scrollbars=no,resizable=no,location=no,top=\'+((screen.height/2)-150)+\',left=\'+((screen.width/2)-175)+\',width=350,height=' . ($coluna['cod_tipo_empresa'] == 2 ? $_SESSION['nivel_acesso'] < 3 ? 380 : 200 : 200) . '\')">'; $html .= '<td>' . $contador++ . '</td>'; $html .= '<td>' . buscaCampo("nome", "SELECT", "consultor c INNER JOIN grupo grp ON (grp.cod_consultor = c.cod_consultor)", "c.nome", "grp.cod_grupo = " . (int) $coluna['cod_grupo']) . '</td>'; $html .= '<td>' . $coluna['nome'] . '</td>'; $html .= '<td>' . $coluna['pdv_empresa'] . '</td>'; $html .= '<td>' . $coluna['desc_empresa'] . '</td>'; $html .= '<td>' . $coluna['desc_regional'] . '</td>'; $html .= '<td>' . $coluna['periodicidade'] . '</td>'; $html .= '</tr>'; } $html .= '</table>'; //Acesso ao BD - FIM if (!$exibir) { // Configurações header para forçar o download header("Content-type: application/x-msexcel"); header("Content-Disposition: attachment; filename=\"{$arquivo}\""); header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Content-Description: PHP Generated Data"); // Detecta o Browser e Plataforma e Envia o conteúdo do arquivo no formato correto $ua = getBrowser(); echo $ua['platform'] == 'windows' ? utf8_decode($html) : $html; } else { echo "<center>"; echo $html; echo "</center>"; } }
$pdv_sede = $_POST['pdv_sede']; //Campos para Update $campos = "senha = '" . $senha . "'"; $campos .= $nivel_acesso > 0 ? ',nivel_acesso = ' . $nivel_acesso : ''; $campos .= $ativo > -1 ? ',ativo = ' . $ativo : ''; $campos .= $cod_regional > 0 ? ',cod_regional = ' . $cod_regional : ''; $campos .= $cod_grupo > 0 ? ',cod_grupo = ' . $cod_grupo : ($cod_grupo == 0 ? ',cod_grupo = NULL' : ''); $campos .= $pdv_sede > 0 ? ',pdv_sede = \'' . $pdv_sede . '\'' : ''; $comando = "UPDATE"; $tabela = "consultor"; $criterios = "cod_consultor = " . $cod_consultor; $edita = acessaBD($comando, $tabela, $campos, $criterios); //exit; // Se for novo supervisor, cria o novo grupo - INCIO if ($cod_grupo == -1 && buscaCampo("cod_consultor", "SELECT", "grupo", "cod_consultor", "cod_consultor=" . $cod_consultor) == 0) { $novo_grupo = 1 + buscaCampo("grp", "SELECT", "grupo", "MAX(cod_grupo) AS grp", "1"); $novo_supervisor = $cod_consultor; //Cria o novo grupo $comando = "INSERT"; $tabela = "grupo"; $campos = "(" . $novo_grupo . ", " . $novo_supervisor . ")"; $criterios = ""; $insere = acessaBD($comando, $tabela, $campos, $criterios); //Atribui o novo supervisor ao novo grupo $comando = "UPDATE"; $tabela = "consultor"; $campos = "cod_grupo = " . $novo_grupo; $criterios = "cod_consultor = " . $novo_supervisor; $insere = acessaBD($comando, $tabela, $campos, $criterios); } // Se for novo supervisor, cria o novo grupo - FIM
} //Email de solicitação de abertura de OS if (strtoupper($_POST['abrir_nova_os']) == 'SIM' && $aprovacao == 1 && $consulta_login['nivel_acesso'] != 4) { //Aprovação = Fora do padrão $email_abre_os = emailAbreOS($_POST['os'], $_POST['customer'], $pdv_empresa, $_POST['abrir_nova_os_agendar_para'], $_POST['abrir_nova_os_periodo'], $consulta_login['nome'], $consulta_login['email'], '', 6, 'BL'); //$grupo_comunicado (1: PayTV | 6: Banda Larga) if ($email_abre_os != 1) { $valida = 'false'; $title = 'ATENÇÃO'; $msg = 'Não foi possível enviar o email de abertura de OS!'; } } //Email de solicitação de alteração de nível if (($_POST['tipo_vistoria'] == 2 || $_POST['tipo_vistoria'] == 5) && $consulta_login['nivel_acesso'] != 4) { //Envia email para a Central de Conhecimento $email_altera_nivel = emailAlteraNivel($_POST['os'], buscaCampo('desc_tipo_servico', 'SELECT', 'tipo_servico', 'desc_tipo_servico', 'cod_tipo_servico=' . $_POST['tipo_servico']), $_POST['pdv_empresa'], $_POST['id_tecnico'], $_POST['nome_tecnico'], '', buscaCampo('desc_tipo_vistoria', 'SELECT', 'tipo_vistoria', 'desc_tipo_vistoria', 'cod_tipo_vistoria=' . $_POST['tipo_vistoria']), $_POST['data_vistoria'], buscaCampo('desc_tipo_aprovacao', 'SELECT', 'tipo_aprovacao', 'desc_tipo_aprovacao', 'cod_tipo_aprovacao=' . $_POST['tipo_aprovacao']), $consulta_login['nome'], $consulta_login['email'], '', 'BL'); if ($email_altera_nivel != 1) { $valida = 'false'; $title = 'ATENÇÃO'; $msg = 'Não foi possível enviar o email de alteração de nível!'; } } // // Envio de Emails - FIM // } } } } //Mensagem de retorno para o dispositivo //header('Location: redireciona.php?msg='. $msg .'&url=../km/defalt.asp');
function geraXLS($tipo_relatorio, $exportar) { // $exportar=1 -> exporta p/ xls; $exportar=0 -> exibe na tela //Constroi o HTML $msg = ""; $html = '<style>table{border:1px solid black;background-color:#fff;width:100%} td{font-size:11px;text-align:center;white-space:nowrap;border:1px solid black;padding:3px} td.head{background-color:#ff0;font-weight:bold;}</style>'; $html .= '<table>'; if ($tipo_relatorio == 1) { //Vistoria PayTV(1); Vistoria BL(2); QB(3); Tecnicos(4) $campos = "v.os, v.data_vistoria, v.data_servico, v.pdv_empresa, v.cod_regional, v.id_tecnico, v.nivel_tecnico, v.padrao_ber, " . "v.padrao_taxa, v.padrao_checkup_sky, v.regiao_tem_uhf, v.cod_modelo_ird, v.smart_card, v.modulo_terrestre_habilitado, " . "v.tv_lcd_led, tv.desc_tipo_vistoria, resp.nome resp_nome, cons.nome cons_nome, cons.pdv_sede, ts.desc_tipo_servico, " . "ta.desc_tipo_aprovacao, mt.desc_modulo_terrestre, cons.cod_grupo, cred.desc_empresa, " . "cred.periodicidade, ti.desc_tipo_instalacao, tlnb.desc_tipo_lnb, tbl.desc_tipo_banda_larga, " . "top.desc_tipo_operadora, mird.desc_modelo_ird, v.moderacao"; $tabela = "vistoria v INNER JOIN tipo_vistoria tv on (tv.cod_tipo_vistoria = v.cod_tipo_vistoria) " . "INNER JOIN credenciados cred ON (cred.pdv_empresa = v.pdv_empresa) " . "INNER JOIN tipo_servico ts ON (ts.cod_tipo_servico = v.cod_tipo_servico) " . "INNER JOIN tipo_instalacao ti ON (ti.cod_tipo_instalacao = v.cod_tipo_instalacao) " . "INNER JOIN tipo_aprovacao ta ON (ta.cod_tipo_aprovacao = v.cod_tipo_aprovacao) " . "INNER JOIN tipo_lnb tlnb ON (tlnb.cod_tipo_lnb = v.cod_tipo_lnb) " . "INNER JOIN tipo_banda_larga tbl ON (tbl.cod_tipo_banda_larga = v.cod_tipo_banda_larga) " . "INNER JOIN tipo_operadora top ON (top.cod_tipo_operadora = v.cod_tipo_operadora) " . "INNER JOIN modelo_ird mird ON (mird.cod_modelo_ird = v.cod_modelo_ird) " . "INNER JOIN modulo_terrestre mt ON (mt.cod_modulo_terrestre = v.cod_modulo_terrestre) " . "INNER JOIN consultor cons ON (cons.cod_consultor = v.cod_consultor) " . "INNER JOIN consultor resp ON (resp.cod_consultor = cred.cod_consultor)"; if ($_REQUEST['os'] != '') { //Com número de OS $criterios = "v.os = " . trim($_REQUEST['os']); } else { //Sem número de OS $primeiro_dia = "01"; $mes = $_REQUEST['mes'] != '' ? $_REQUEST['mes'] : date("m"); $ano = $_REQUEST['ano'] != '' ? $_REQUEST['ano'] : date("Y"); $ultimo_dia = date('t', mktime(0, 0, 0, $mes, '01', $ano)); if ($_GET['meses_anteriores'] != 'true') { //Somente mês selecionado $ultimo_dia = date('t', mktime(0, 0, 0, $mes, '01', $ano)); $data_inicial = date('Y-m-d', strtotime($ano . "-" . $mes . "-" . $primeiro_dia)); } else { //Inclui 2 últimos meses $ano_mes = date('Y-m', strtotime($ano . "-" . $mes)); $meses_anteriores = date('Y-m', strtotime("-2 month", strtotime(". {$ano_mes} ."))); $data_inicial = date('Y-m-d', strtotime($meses_anteriores . "-" . $primeiro_dia)); } $data_final = date('Y-m-d', strtotime($ano . "-" . $mes . "-" . $ultimo_dia)); $criterios .= "v.data_vistoria BETWEEN '" . $data_inicial . "' AND '" . $data_final . "'"; if ($_REQUEST['cnst'] != 0) { //Selecionado um 'Consultor' if ($_REQUEST['especialista'] > 0) { //Selecionado 'Somente Especialista' $tabela .= "INNER JOIN consultor_especialista ce ON (ce.pdv_empresa = cons.pdv_sede) "; $criterios .= " AND ce.cod_consultor = " . $_REQUEST['cnst']; } else { //Selecionado 'Somente consultor' $criterios .= " AND v.cod_consultor = " . $_REQUEST['cnst']; } } elseif ($_SESSION['nivel_acesso'] > 2 && $_SESSION['nivel_acesso'] < 6) { $criterios .= " AND v.cod_consultor = " . $_SESSION['login']; } elseif ($_SESSION['nivel_acesso'] == 5 && strlen($_REQUEST['pdv_especialista']) > 1) { $criterios .= " AND cons.pdv_sede = '" . $_REQUEST['pdv_especialista'] . "'"; } elseif (($_SESSION['nivel_acesso'] < 3 || $_SESSION['nivel_acesso'] > 4) && $_REQUEST['grp'] != 0) { $criterios .= " AND cons.cod_grupo = " . $_REQUEST['grp']; } if (strlen($_REQUEST['pdv_empresa']) > 1) { $criterios .= " AND v.pdv_empresa = '" . $_REQUEST['pdv_empresa'] . "'"; } if ($_REQUEST['reg'] > 0) { $criterios .= " AND v.cod_regional = " . $_REQUEST['reg']; } } $criterios .= " AND v.moderacao < 2"; $query = "SELECT " . $campos . " FROM " . $tabela . " WHERE " . $criterios . " ORDER BY v.data_vistoria DESC"; $resultado = mysql_query($query); if (mysql_num_rows($resultado) == 0) { $msg = 'Não há VISTORIAS de PAYTV com os critérios escolhidos!'; $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } elseif ($_REQUEST['exibir']) { if ($_REQUEST['os'] > 0) { header('Location: ../files/fotos/' . trim($_REQUEST['os']) . '/' . trim($_REQUEST['os']) . '.html'); } else { $msg = 'Digite uma OS válida!'; $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } } else { // Nome do arquivo que será exportado $arquivo = 'relatorio_vistoria.xls'; if (!$exportar) { $html .= '<span id="num_vistorias">' . mysql_num_rows($resultado) . '</span> VISTORIAS'; } $html .= '<tr>'; $html .= '<td class="head">TIPO INSPEÇÃO</td>'; $html .= '<td class="head">DATA VISTORIA</td>'; if ($exportar == 1) { $html .= '<td class="head">DATA SERVIÇO</td>'; } $html .= '<td class="head">PDV</td>'; $html .= '<td class="head">CREDENCIADO</td>'; $html .= '<td class="head">REGIONAL</td>'; $html .= '<td class="head">CONSULTOR</td>'; $html .= '<td class="head">SEDE</td>'; if ($exportar == 1) { $html .= '<td class="head">PERIODICIDADE</td>'; } $html .= '<td class="head">OS</td>'; if ($exportar == 1) { $html .= '<td class="head">TIPO INSTALAÇÃO</td>'; $html .= '<td class="head">TIPO SERVIÇO</td>'; $html .= '<td class="head">TIPO LNB</td>'; $html .= '<td class="head">ID DO TÉCNICO</td>'; $html .= '<td class="head">NÍVEL TÉCNICO</td>'; } $html .= '<td class="head">APROVAÇÃO</td>'; if ($exportar == 1) { $html .= '<td class="head">BER</td>'; $html .= '<td class="head">TAXA</td>'; $html .= '<td class="head">CHECKUP SKY</td>'; $html .= '<td class="head">ABRIR NOVA OS?</td>'; $html .= '<td class="head">BANDA LARGA</td>'; $html .= '<td class="head">OPERADORA</td>'; $html .= '<td class="head">TEM UHF?</td>'; $html .= '<td class="head">MODELO IRD</td>'; $html .= '<td class="head">SMART CARD</td>'; $html .= '<td class="head">MODULO TERRESTRE</td>'; $html .= '<td class="head">HABILITADO</td>'; $html .= '<td class="head">TV LCD</td>'; $html .= '<td class="head">MODELO IRD 2</td>'; $html .= '<td class="head">MODULO TERRESTRE 2</td>'; $html .= '<td class="head">HABILITADO 2</td>'; $html .= '<td class="head">TV LCD 2</td>'; $html .= '<td class="head">MODELO IRD 3</td>'; $html .= '<td class="head">MODULO TERRESTRE 3</td>'; $html .= '<td class="head">HABILITADO 3</td>'; $html .= '<td class="head">TV LCD 3</td>'; $html .= '<td class="head">MODELO IRD 4</td>'; $html .= '<td class="head">MODULO TERRESTRE 4</td>'; $html .= '<td class="head">HABILITADO 4</td>'; $html .= '<td class="head">TV LCD 4</td>'; $html .= '<td class="head">MODELO IRD 5</td>'; $html .= '<td class="head">MODULO TERRESTRE 5</td>'; $html .= '<td class="head">HABILITADO 5</td>'; $html .= '<td class="head">TV LCD 5</td>'; $html .= '<td class="head">MODELO IRD 6</td>'; $html .= '<td class="head">MODULO TERRESTRE 6</td>'; $html .= '<td class="head">HABILITADO 6</td>'; $html .= '<td class="head">TV LCD 6</td>'; $html .= '<td class="head">Apontamento e Visada (I.F.E.)</td>'; $html .= '<td class="head">Antena irregular (I.F.E.)</td>'; $html .= '<td class="head">Antena fixação (I.F.E.)</td>'; $html .= '<td class="head">LNB irregular (I.F.E.)</td>'; $html .= '<td class="head">LNB fixação (I.F.E.)</td>'; $html .= '<td class="head">Silicone (I.F.E.)</td>'; $html .= '<td class="head">Fita de auto fusão (I.F.E.)</td>'; $html .= '<td class="head">Cabo irregular (I.F.E.)</td>'; $html .= '<td class="head">Cabo fixação (I.F.E.)</td>'; $html .= '<td class="head">Conector irregular (I.F.E.)</td>'; $html .= '<td class="head">Conector crimpagem (I.F.E.)</td>'; $html .= '<td class="head">Dispositivos de distribuição (I.F.E.)</td>'; $html .= '<td class="head">Conexão de áudio e vídeo (I.F.E.)</td>'; $html .= '<td class="head">Conexão modem (I.F.E.)</td>'; $html .= '<td class="head">Controle codificado (I.F.E.)</td>'; $html .= '<td class="head">Instalação módulo terrestre (I.F.E.)</td>'; $html .= '<td class="head">Qualidade Técnica (I.C.)</td>'; $html .= '<td class="head">Uniforme ou identificação (I.C.)</td>'; $html .= '<td class="head">Limpeza do local (I.C.)</td>'; $html .= '<td class="head">Danos no local (I.C.)</td>'; $html .= '<td class="head">Cobrança do serviço (I.C.)</td>'; $html .= '<td class="head">Cumprimento agendamento (I.C.)</td>'; $html .= '<td class="head">Atendimento SAC (I.C.)</td>'; $html .= '<td class="head">Informações do vendedor (I.C.)</td>'; $html .= '<td class="head">Programação (I.C.)</td>'; $html .= '<td class="head">Informações da grade (I.C.)</td>'; $html .= '<td class="head">Qualidade de som e imagem (I.C.)</td>'; $html .= '<td class="head">Fatura (I.C.)</td>'; $html .= '<td class="head">Antena DTH (D.M.)</td>'; $html .= '<td class="head">Antena UHF (D.M.)</td>'; $html .= '<td class="head">LNB (D.M.)</td>'; $html .= '<td class="head">Cabo (D.M.)</td>'; $html .= '<td class="head">Conector (D.M.)</td>'; $html .= '<td class="head">Amplificador (D.M.)</td>'; $html .= '<td class="head">Dispositivos de distribuição (D.M.)</td>'; } $html .= '</tr>'; while ($coluna = mysql_fetch_array($resultado)) { $html .= '<tr>'; $html .= '<td>' . $coluna['desc_tipo_vistoria'] . '</td>'; $html .= '<td>' . date("d/m/Y", strtotime($coluna['data_vistoria'])) . '</td>'; if ($exportar == 1) { $html .= '<td>' . date("d/m/Y", strtotime($coluna['data_servico'])) . '</td>'; } $html .= '<td>' . $coluna['pdv_empresa'] . '</td>'; $html .= '<td>' . $coluna['desc_empresa'] . '</td>'; $html .= '<td>R' . $coluna['cod_regional'] . '</td>'; $html .= '<td>' . $coluna[($coluna['pdv_sede'] == 'SKY0000' ? 'cons' : 'resp') . '_nome'] . '</td>'; $cor_validacao = array("red", "green", "black"); $html .= '<td><b style="color:' . $cor_validacao[$coluna['moderacao']] . '">' . buscaCampo("desc_empresa", "SELECT", "credenciados ", "desc_empresa", "pdv_empresa = '" . $coluna['pdv_sede'] . "'") . '</td>'; if ($exportar == 1) { $html .= '<td>' . $coluna['periodicidade'] . '</td>'; } $html .= '<td><a href="http://' . $_SERVER['HTTP_HOST'] . '/files/fotos/' . $coluna['os'] . '/' . $coluna['os'] . '.html" target="_blank">' . $coluna['os'] . '</a></td>'; if ($exportar == 1) { $html .= '<td>' . $coluna['desc_tipo_instalacao'] . '</td>'; $html .= '<td>' . $coluna['desc_tipo_servico'] . '</td>'; $html .= '<td>' . $coluna['desc_tipo_lnb'] . '</td>'; $html .= '<td>' . $coluna['id_tecnico'] . '</td>'; $html .= '<td>' . $coluna['nivel_tecnico'] . '</td>'; } $html .= '<td>' . $coluna['desc_tipo_aprovacao'] . '</td>'; if ($exportar == 1) { $html .= '<td>' . $coluna['padrao_ber'] . '</td>'; $html .= '<td>' . $coluna['padrao_taxa'] . '</td>'; $html .= '<td>' . $coluna['padrao_checkup_sky'] . '</td>'; $html .= '<td>' . (buscaCampo("os", "SELECT", "vistoria_abrir_nova_os", "os", "os = " . $coluna['os']) != 0 ? 'Sim' : 'Não') . '</td>'; $html .= '<td>' . $coluna['desc_tipo_banda_larga'] . '</td>'; $html .= '<td>' . $coluna['desc_tipo_operadora'] . '</td>'; $html .= '<td>' . $coluna['regiao_tem_uhf'] . '</td>'; $html .= '<td>' . $coluna['desc_modelo_ird'] . '</td>'; $html .= '<td>' . $coluna['smart_card'] . '</td>'; $html .= '<td>' . $coluna['desc_modulo_terrestre'] . '</td>'; $html .= '<td>' . $coluna['modulo_terrestre_habilitado'] . '</td>'; $html .= '<td>' . $coluna['tv_lcd_led'] . '</td>'; //Insere IRDs 2 a 6 - INICIO $tabela_pa = buscaTabela("mi.desc_modelo_ird, mt.desc_modulo_terrestre, vpa.modulo_terrestre_habilitado, vpa.tv_lcd_led", "modelo_ird mi INNER JOIN vistoria_ponto_adicional vpa ON (vpa.cod_modelo_ird = mi.cod_modelo_ird) INNER JOIN modulo_terrestre mt ON (mt.cod_modulo_terrestre = vpa.cod_modulo_terrestre)", "vpa.os = " . $coluna['os']); $registros = mysql_num_rows($tabela_pa); while ($row = mysql_fetch_array($tabela_pa)) { $html .= '<td>' . $row['desc_modelo_ird'] . '</td>'; $html .= '<td>' . $row['desc_modulo_terrestre'] . '</td>'; $html .= '<td>' . $row['modulo_terrestre_habilitado'] . '</td>'; $html .= '<td>' . $row['tv_lcd_led'] . '</td>'; } for ($i = 1; $i <= (5 - $registros) * 4; $i++) { $html .= '<td></td>'; } //Insere IRDs 2 a 6 - FIM //Busca IFEs (Itens Fora do Padrão) - INICIO $campo_ife = "cod_item_fora_padrao"; $tabela_ife = "vistoria_item_fora_padrao"; $criterio_ife = "os = " . $coluna['os']; //Loop para preenchimento dos IFEs for ($i = 1; $i <= 16; $i++) { $print = 0; $ife = mysql_query("SELECT " . $campo_ife . " FROM " . $tabela_ife . " WHERE " . $criterio_ife); while ($row = mysql_fetch_array($ife)) { if ($i == $row['cod_item_fora_padrao']) { $html .= '<td>1</td>'; $print = 1; } } if ($print == 0) { $html .= '<td></td>'; } } //Busca Itens Fora do Padrão - FIM //Busca ICs (Insatisfação Cliente) - INICIO $campo_ic = "cod_insatisfacao_cliente"; $tabela_ic = "vistoria_insatisfacao_cliente"; $criterio_ic = "os = " . $coluna['os']; //Loop para preenchimento dos ICs for ($i = 1; $i <= 12; $i++) { $print = 0; $ic = mysql_query("SELECT " . $campo_ic . " FROM " . $tabela_ic . " WHERE " . $criterio_ic); while ($row = mysql_fetch_array($ic)) { if ($i == $row['cod_insatisfacao_cliente']) { $html .= '<td>1</td>'; $print = 1; } } if ($print == 0) { $html .= '<td></td>'; } } //Busca Insatisfação Cliente - FIM //Insere Divergência de Materiais - INICIO $div_mat = ''; $div_mat = array('DTH', 'UHF', 'LNB', 'CABO', 'CONECTOR', 'AMPLIFICADOR', 'DISPOSITIVOS'); foreach ($div_mat as $items) { $flag = 0; $tabela_dm = buscaTabela("dm.desc_divergencia_materiais", "divergencia_materiais dm INNER JOIN vistoria_divergencia_materiais vdm ON (vdm.cod_divergencia_materiais = dm.cod_divergencia_materiais)", "vdm.os = " . $coluna['os'] . " ORDER BY dm.cod_divergencia_materiais"); while ($row = mysql_fetch_array($tabela_dm)) { $valor = strpos(strtoupper($row['desc_divergencia_materiais']), $items); if (is_numeric($valor)) { $html .= '<td>' . $row['desc_divergencia_materiais'] . '</td>'; $flag = 1; break; } } if ($flag == 0) { $html .= '<td></td>'; } } //Insere Divergência de Materiais - FIM } $html .= '</tr>'; } } } elseif ($tipo_relatorio == 2) { //Vistoria PayTV(1); Vistoria BL(2); QB(3); Tecnicos(4) $campos = "v.*, tv.desc_tipo_vistoria, resp.nome resp_nome, cons.nome cons_nome, cons.pdv_sede, cons.cod_grupo, " . "ts.desc_tipo_servico, ta.desc_tipo_aprovacao, cred.desc_empresa, tbl.desc_tipo_banda_larga, top.desc_tipo_operadora, " . "mcpe.desc_modelo_cpe, fw.desc_versao_firmware_cpe, vc.desc_velocidade_contratada, tco.desc_tipo_conexao"; $tabela = "vistoria_bl v INNER JOIN tipo_vistoria tv on (tv.cod_tipo_vistoria = v.cod_tipo_vistoria) " . "INNER JOIN credenciados cred ON (cred.pdv_empresa = v.pdv_empresa) " . "INNER JOIN tipo_servico ts ON (ts.cod_tipo_servico = v.cod_tipo_servico) " . "INNER JOIN tipo_aprovacao ta ON (ta.cod_tipo_aprovacao = v.cod_tipo_aprovacao) " . "INNER JOIN tipo_banda_larga tbl ON (tbl.cod_tipo_banda_larga = v.cod_tipo_banda_larga) " . "INNER JOIN tipo_operadora top ON (top.cod_tipo_operadora = v.cod_tipo_operadora) " . "INNER JOIN tipo_conexao tco ON (tco.cod_tipo_conexao = v.cod_tipo_conexao) " . "INNER JOIN velocidade_contratada vc ON (vc.cod_velocidade_contratada = v.cod_velocidade_contratada) " . "INNER JOIN modelo_cpe mcpe ON (mcpe.cod_modelo_cpe = v.cod_modelo_cpe) " . "INNER JOIN versao_firmware_cpe fw ON (fw.cod_versao_firmware_cpe = v.cod_versao_firmware_cpe) " . "INNER JOIN consultor cons ON (cons.cod_consultor = v.cod_consultor) " . "INNER JOIN consultor resp ON (resp.cod_consultor = cred.cod_consultor)"; if ($_REQUEST['os'] != '') { //Com número de OS $criterios = "v.os = " . trim($_REQUEST['os']); } else { //Sem número de OS $primeiro_dia = "01"; $mes = $_REQUEST['mes'] != '' ? $_REQUEST['mes'] : date("m"); $ano = $_REQUEST['ano'] != '' ? $_REQUEST['ano'] : date("Y"); $ultimo_dia = date('t', mktime(0, 0, 0, $mes, '01', $ano)); if ($_GET['meses_anteriores'] != 'true') { //Somente mês selecionado $ultimo_dia = date('t', mktime(0, 0, 0, $mes, '01', $ano)); $data_inicial = date('Y-m-d', strtotime($ano . "-" . $mes . "-" . $primeiro_dia)); } else { //Inclui 2 últimos meses $ano_mes = date('Y-m', strtotime($ano . "-" . $mes)); $meses_anteriores = date('Y-m', strtotime("-2 month", strtotime(". {$ano_mes} ."))); $data_inicial = date('Y-m-d', strtotime($meses_anteriores . "-" . $primeiro_dia)); } $data_final = date('Y-m-d', strtotime($ano . "-" . $mes . "-" . $ultimo_dia)); $criterios .= "v.data_vistoria BETWEEN '" . $data_inicial . "' AND '" . $data_final . "'"; if ($_REQUEST['cnst'] != 0) { //Selecionado um 'Consultor' if ($_REQUEST['especialista'] > 0) { //Selecionado 'Somente Especialista' $tabela .= "INNER JOIN consultor_especialista ce ON (ce.pdv_empresa = cons.pdv_sede) "; $criterios .= " AND ce.cod_consultor = " . $_REQUEST['cnst']; } else { //Selecionado 'Somente consultor' $criterios .= " AND v.cod_consultor = " . $_REQUEST['cnst']; } } elseif ($_SESSION['nivel_acesso'] > 2 && $_SESSION['nivel_acesso'] < 6) { $criterios .= " AND v.cod_consultor = " . $_SESSION['login']; } elseif ($_SESSION['nivel_acesso'] == 5 && strlen($_REQUEST['pdv_especialista']) > 1) { $criterios .= " AND cons.pdv_sede = '" . $_REQUEST['pdv_especialista'] . "'"; } elseif (($_SESSION['nivel_acesso'] < 3 || $_SESSION['nivel_acesso'] > 4) && $_REQUEST['grp'] != 0) { $criterios .= " AND cons.cod_grupo = " . $_REQUEST['grp']; } if (strlen($_REQUEST['pdv_empresa']) > 1) { $criterios .= " AND v.pdv_empresa = '" . $_REQUEST['pdv_empresa'] . "'"; } if ($_REQUEST['reg'] > 0) { $criterios .= " AND v.cod_regional = " . $_REQUEST['reg']; } } $criterios .= " AND v.moderacao < 2"; $query = "SELECT " . $campos . " FROM " . $tabela . " WHERE " . $criterios . " ORDER BY v.data_vistoria DESC"; $resultado = mysql_query($query); if (mysql_num_rows($resultado) == 0) { $msg = 'Não há VISTORIAS de BANDA LARGA com os critérios escolhidos!'; $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } elseif ($_REQUEST['exibir']) { if ($_REQUEST['os'] > 0) { header('Location: ../files/fotos/' . trim($_REQUEST['os']) . '/' . trim($_REQUEST['os']) . '.html'); } else { $msg = 'Digite uma OS válida!'; $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } } else { // Nome do arquivo que será exportado $arquivo = 'relatorio_vistoria_bl.xls'; if (!$exportar) { $html .= '<span id="num_vistorias">' . mysql_num_rows($resultado) . '</span> VISTORIAS'; } $html .= '<tr>'; $html .= '<td class="head">TIPO INSPEÇÃO</td>'; $html .= '<td class="head">DATA VISTORIA</td>'; if ($exportar == 1) { $html .= '<td class="head">DATA SERVIÇO</td>'; } $html .= '<td class="head">PDV</td>'; $html .= '<td class="head">CREDENCIADO</td>'; if ($exportar == 1) { $html .= '<td class="head">REGIONAL</td>'; } $html .= '<td class="head">UF</td>'; $html .= '<td class="head">CONSULTOR</td>'; if ($exportar == 1) { $html .= '<td class="head">SEDE</td>'; } $html .= '<td class="head">OS</td>'; if ($exportar == 1) { $html .= '<td class="head">TIPO SERVIÇO</td>'; $html .= '<td class="head">ID DO TÉCNICO</td>'; $html .= '<td class="head">TREINAMENTO BL?</td>'; } $html .= '<td class="head">APROVAÇÃO</td>'; if ($exportar == 1) { $html .= '<td class="head">MODELO CPE</td>'; $html .= '<td class="head">IMSI</td>'; $html .= '<td class="head">VERSÃO FW</td>'; $html .= '<td class="head">VEL. CONTRATADA</td>'; $html .= '<td class="head">RSRP</td>'; $html .= '<td class="head">CINR</td>'; $html .= '<td class="head">TX POWER</td>'; $html .= '<td class="head">DL</td>'; $html .= '<td class="head">UL</td>'; $html .= '<td class="head">LATÊNCIA</td>'; $html .= '<td class="head">ABRIR NOVA OS?</td>'; $html .= '<td class="head">PROBLEMA NAVEGAÇÃO?</td>'; $html .= '<td class="head">COMITÊ NOTIFICADO?</td>'; $html .= '<td class="head">BANDA LARGA</td>'; $html .= '<td class="head">OPERADORA</td>'; $html .= '<td class="head">CONEXÃO</td>'; //Query dispositivo_conectado_bl"; $result = buscaTabela('*', 'dispositivo_conectado_bl', '1'); while ($row = mysql_fetch_array($result)) { $html .= '<td class="head">' . $row['desc_dispositivo_conectado_bl'] . ' (D.C.)</td>'; } $num_dispositivo_conectado_bl = mysql_num_rows($result); //Query item_fora_padrao_bl"; $result = buscaTabela('*', 'item_fora_padrao_bl', '1'); while ($row = mysql_fetch_array($result)) { $html .= '<td class="head">' . $row['desc_item_fora_padrao_bl'] . ' (I.F.E.)</td>'; } $num_item_fora_padrao_bl = mysql_num_rows($result); //Query insatisfacao_cliente_bl"; $result = buscaTabela('*', 'insatisfacao_cliente_bl', '1'); while ($row = mysql_fetch_array($result)) { $html .= '<td class="head">' . $row['desc_insatisfacao_cliente_bl'] . ' (I.C.)</td>'; } $num_insatisfacao_cliente_bl = mysql_num_rows($result); //Query insatisfacao_cliente_bl"; $result = buscaTabela('*', 'divergencia_materiais_bl', '1'); while ($row = mysql_fetch_array($result)) { $html .= '<td class="head">' . $row['desc_divergencia_materiais_bl'] . ' (D.M.)</td>'; } $num_divergencia_materiais_bl = mysql_num_rows($result); } $html .= '</tr>'; while ($coluna = mysql_fetch_array($resultado)) { $html .= '<tr>'; $html .= '<td>' . $coluna['desc_tipo_vistoria'] . '</td>'; $html .= '<td>' . date("d/m/Y", strtotime($coluna['data_vistoria'])) . '</td>'; if ($exportar == 1) { $html .= '<td>' . date("d/m/Y", strtotime($coluna['data_servico'])) . '</td>'; } $html .= '<td>' . $coluna['pdv_empresa'] . '</td>'; $html .= '<td>' . $coluna['desc_empresa'] . '</td>'; if ($exportar == 1) { $html .= '<td>R' . $coluna['cod_regional'] . '</td>'; } $html .= '<td>' . $coluna['cod_uf'] . '</td>'; $html .= '<td>' . $coluna[($coluna['pdv_sede'] == 'SKY0000' ? 'cons' : 'resp') . '_nome'] . '</td>'; if ($exportar == 1) { $cor_validacao = array("red", "green", "black"); $html .= '<td><b style="color:' . $cor_validacao[$coluna['moderacao']] . '">' . buscaCampo("desc_empresa", "SELECT", "credenciados ", "desc_empresa", "pdv_empresa = '" . $coluna['pdv_sede'] . "'") . '</td>'; } $html .= '<td><a href="http://' . $_SERVER['HTTP_HOST'] . '/files/fotos/' . $coluna['os'] . '/' . $coluna['os'] . '.html" target="_blank">' . $coluna['os'] . '</a></td>'; if ($exportar == 1) { $html .= '<td>' . $coluna['desc_tipo_servico'] . '</td>'; $html .= '<td>' . $coluna['id_tecnico'] . '</td>'; $html .= '<td>' . $coluna['treinamento_bl'] . '</td>'; } $html .= '<td>' . $coluna['desc_tipo_aprovacao'] . '</td>'; if ($exportar == 1) { $html .= '<td>' . $coluna['desc_modelo_cpe'] . '</td>'; $html .= '<td>' . $coluna['imsi'] . '</td>'; $html .= '<td>' . $coluna['desc_versao_firmware_cpe'] . '</td>'; $html .= '<td>' . $coluna['desc_velocidade_contratada'] . '</td>'; $html .= '<td>' . $coluna['padrao_rsrp'] . '</td>'; $html .= '<td>' . $coluna['padrao_cinr'] . '</td>'; $html .= '<td>' . $coluna['padrao_tx_power'] . '</td>'; $html .= '<td>' . $coluna['padrao_download'] . '</td>'; $html .= '<td>' . $coluna['padrao_upload'] . '</td>'; $html .= '<td>' . $coluna['padrao_latencia'] . '</td>'; $html .= '<td>' . (buscaCampo("os", "SELECT", "vistoria_bl_abrir_nova_os", "os", "os = " . $coluna['os']) != 0 ? 'SIM' : 'NÃO') . '</td>'; $html .= '<td>' . buscaCampo("desc_problema_navegacao", "SELECT", "vistoria_bl v INNER JOIN tipo_problema_navegacao tpn ON (tpn.cod_problema_navegacao = v.cod_problema_navegacao)", "tpn.desc_problema_navegacao", "v.os = " . $coluna['os']) . '</td>'; $html .= '<td>' . buscaCampo("comite_notificado", "SELECT", "vistoria_bl", "comite_notificado", "os = " . $coluna['os']) . '</td>'; $html .= '<td>' . $coluna['desc_tipo_banda_larga'] . '</td>'; $html .= '<td>' . $coluna['desc_tipo_operadora'] . '</td>'; $html .= '<td>' . $coluna['desc_tipo_conexao'] . '</td>'; //Busca DCs (Dispositivos Conectados) - INICIO $campo_ife = "cod_dispositivo_conectado"; $tabela_ife = "vistoria_bl_dispositivo_conectado"; $criterio_ife = "os = " . $coluna['os']; //Loop para preenchimento dos IFPs for ($i = 1; $i <= $num_dispositivo_conectado_bl; $i++) { $print = 0; $ife = mysql_query("SELECT " . $campo_ife . " FROM " . $tabela_ife . " WHERE " . $criterio_ife); while ($row = mysql_fetch_array($ife)) { if ($i == $row['cod_dispositivo_conectado']) { $html .= '<td>1</td>'; $print = 1; } } if ($print == 0) { $html .= '<td></td>'; } } //Busca DC - FIM //Busca IFEs (Itens Fora do Padrão) - INICIO $campo_ife = "cod_item_fora_padrao"; $tabela_ife = "vistoria_bl_item_fora_padrao"; $criterio_ife = "os = " . $coluna['os']; //Loop para preenchimento dos IFPs for ($i = 1; $i <= $num_item_fora_padrao_bl; $i++) { $print = 0; $ife = mysql_query("SELECT " . $campo_ife . " FROM " . $tabela_ife . " WHERE " . $criterio_ife); while ($row = mysql_fetch_array($ife)) { if ($i == $row['cod_item_fora_padrao']) { $html .= '<td>1</td>'; $print = 1; } } if ($print == 0) { $html .= '<td></td>'; } } //Busca IFP - FIM //Busca ICs (Insatisfação Cliente) - INICIO $campo_ic = "cod_insatisfacao_cliente"; $tabela_ic = "vistoria_bl_insatisfacao_cliente"; $criterio_ic = "os = " . $coluna['os']; //Loop para preenchimento dos ICs for ($i = 1; $i <= $num_insatisfacao_cliente_bl; $i++) { $print = 0; $ic = mysql_query("SELECT " . $campo_ic . " FROM " . $tabela_ic . " WHERE " . $criterio_ic); while ($row = mysql_fetch_array($ic)) { if ($i == $row['cod_insatisfacao_cliente']) { $html .= '<td>1</td>'; $print = 1; } } if ($print == 0) { $html .= '<td></td>'; } } //Busca IC - FIM //Insere Divergência de Materiais - INICIO $campo_ic = "cod_divergencia_materiais"; $tabela_ic = "vistoria_bl_divergencia_materiais"; $criterio_ic = "os = " . $coluna['os']; //Loop para preenchimento dos DMs for ($i = 1; $i <= $num_divergencia_materiais_bl; $i++) { $print = 0; $ic = mysql_query("SELECT " . $campo_ic . " FROM " . $tabela_ic . " WHERE " . $criterio_ic); while ($row = mysql_fetch_array($ic)) { if ($i == $row['cod_divergencia_materiais']) { $html .= '<td>1</td>'; $print = 1; } } if ($print == 0) { $html .= '<td></td>'; } } //Insere DMs - FIM } $html .= '</tr>'; } } } elseif ($tipo_relatorio == 3) { //Vistoria PayTV(1); Vistoria BL(2); QB(3); Tecnicos(4) $campos = "tqb.pdv_empresa, cred.desc_empresa, cons.nome, cred.cod_regional, tqb.data_teste_qb, tqb.os, mird.desc_modelo_ird, " . "qbrel.desc_defeito defeito_relatado, qbconst.desc_defeito defeito_constatado, tqb.id_tecnico, tqb.troca_devida"; $tabela = "teste_qb tqb INNER JOIN credenciados cred ON (cred.pdv_empresa = tqb.pdv_empresa) " . "INNER JOIN consultor cons ON (cons.cod_consultor = tqb.cod_consultor) " . "INNER JOIN modelo_ird mird ON (mird.cod_modelo_ird = tqb.cod_modelo_ird) " . "INNER JOIN qb_defeito qbrel ON (qbrel.cod_defeito = tqb.defeito_relatado) " . "INNER JOIN qb_defeito qbconst ON (qbconst.cod_defeito = tqb.defeito_constatado)"; if ($_REQUEST['os'] != '') { //Com número de OS $criterios = "tqb.os = " . trim($_REQUEST['os']); } else { //Sem número de OS $primeiro_dia = "01"; $mes = $_REQUEST['mes'] != '' ? $_REQUEST['mes'] : date("m"); $ano = $_REQUEST['ano'] != '' ? $_REQUEST['ano'] : date("Y"); $ultimo_dia = date('t', mktime(0, 0, 0, $mes, '01', $ano)); if ($_GET['meses_anteriores'] != 'true') { //Somente mês selecionado $ultimo_dia = date('t', mktime(0, 0, 0, $mes, '01', $ano)); $data_inicial = date('Y-m-d', strtotime($ano . "-" . $mes . "-" . $primeiro_dia)); } else { //Inclui 2 últimos meses $ano_mes = date('Y-m', strtotime($ano . "-" . $mes)); $meses_anteriores = date('Y-m', strtotime("-2 month", strtotime(". {$ano_mes} ."))); $data_inicial = date('Y-m-d', strtotime($meses_anteriores . "-" . $primeiro_dia)); } $data_final = date('Y-m-d', strtotime($ano . "-" . $mes . "-" . $ultimo_dia)); $criterios .= "tqb.data_teste_qb BETWEEN '" . $data_inicial . "' AND '" . $data_final . "'"; if ($_REQUEST['cnst'] != 0) { $criterios .= " AND tqb.cod_consultor = " . $_REQUEST['cnst']; } elseif ($_SESSION['nivel_acesso'] < 3 && $_REQUEST['grp'] != 0) { $criterios .= " AND cons.cod_grupo = " . $_REQUEST['grp']; } if (strlen($_REQUEST['pdv_empresa']) > 1) { $criterios .= " AND tqb.pdv_empresa = '" . $_REQUEST['pdv_empresa'] . "'"; } if ($_REQUEST['reg'] > 0) { $criterios .= " AND cred.cod_regional = " . $_REQUEST['reg']; } } $query = "SELECT " . $campos . " FROM " . $tabela . " WHERE " . $criterios . " ORDER BY tqb.data_teste_qb DESC"; $resultado = mysql_query($query); if (mysql_num_rows($resultado) == 0) { $msg = 'Não há Teste de QB com os critérios escolhidos!'; $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } elseif ($_REQUEST['exibir']) { if ($_REQUEST['os'] > 0) { $msg = 'Não é possivel visualizar relatórios de Teste de QB!'; } else { $msg = 'Digite uma OS válida!'; } $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } else { // Nome do arquivo que será exportado $arquivo = 'relatorio_teste_qb.xls'; if (!$exportar) { $html .= mysql_num_rows($resultado) . ' TESTES DE QB'; } $html .= '<tr>'; $html .= '<td class="head">PDV</td>'; $html .= '<td class="head">EMPRESA</td>'; $html .= '<td class="head">CONSULTOR</td>'; $html .= '<td class="head">REGIONAL</td>'; $html .= '<td class="head">DATA</td>'; $html .= '<td class="head">OS</td>'; $html .= '<td class="head">MODELO IRD</td>'; if ($exportar == 1) { $html .= '<td class="head">DEFEITO RELATADO</td>'; $html .= '<td class="head">DEFEITO CONSTATADO</td>'; $html .= '<td class="head">ID DO TÉCNICO</td>'; } $html .= '<td class="head">TROCA DEVIDA?</td>'; $html .= '</tr>'; while ($coluna = mysql_fetch_array($resultado)) { $html .= '<tr>'; $html .= '<td>' . $coluna['pdv_empresa'] . '</td>'; $html .= '<td>' . $coluna['desc_empresa'] . '</td>'; $html .= '<td>' . $coluna['nome'] . '</td>'; $html .= '<td>R' . $coluna['cod_regional'] . '</td>'; $html .= '<td>' . date("d/m/Y", strtotime($coluna['data_teste_qb'])) . '</td>'; $html .= '<td>' . $coluna['os'] . '</td>'; $html .= '<td>' . $coluna['desc_modelo_ird'] . '</td>'; if ($exportar == 1) { $html .= '<td>' . $coluna['defeito_relatado'] . '</td>'; $html .= '<td>' . $coluna['defeito_constatado'] . '</td>'; $html .= '<td>' . $coluna['id_tecnico'] . '</td>'; } $html .= '<td>' . $coluna['troca_devida'] . '</td>'; $html .= '</tr>'; } } } elseif ($tipo_relatorio == 4) { //Vistoria PayTV(1); Vistoria BL(2); QB(3); Tecnicos(4) $campos = "tec.id_tecnico, tec.nome_tecnico, tec.nivel_tecnico, tec.pdv_empresa, " . "tec.status_banda_larga, tec.apto_mudanca_nivel, cred.cod_regional"; $tabela = "tecnico tec INNER JOIN credenciados cred ON (cred.pdv_empresa = tec.pdv_empresa)"; // "INNER JOIN grupo grp ON (grp.cod_consultor = cons.cod_consultor)"; $criterios = "tec.status_tecnico = 'S'"; /* if ($_REQUEST['cnst'] != 0) $criterios .= " AND cred.cod_consultor = " . $_REQUEST['cnst']; elseif ($_SESSION['nivel_acesso'] < 3 && $_REQUEST['grp'] != 0) $criterios .= " AND cons.cod_consultor > 1"; // $criterios .= " AND cons.cod_grupo = " . $_REQUEST['grp']; if (strlen($_REQUEST['pdv_empresa']) > 1) $criterios .= " AND cred.pdv_empresa = '" . $_REQUEST['pdv_empresa'] . "'"; if ($_REQUEST['reg'] > 0) $criterios .= " AND cred.cod_regional = " . $_REQUEST['reg']; } */ $query = "SELECT " . $campos . " FROM " . $tabela . " WHERE " . $criterios . " ORDER BY 2 ASC"; $resultado = mysql_query($query); if (mysql_num_rows($resultado) == 0) { $msg = 'Não há Técnicos com os critérios escolhidos!'; $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } elseif ($_REQUEST['exibir']) { $html .= '<tr>'; $html .= '<td><b>' . $msg . '</b></td>'; $html .= '</tr>'; } else { // Nome do arquivo que será exportado $arquivo = 'relatorio_tecnicos.xls'; if (!$exportar) { $html .= mysql_num_rows($resultado) . ' TECNICOS'; } $html .= '<tr>'; $html .= '<td class="head">REGIONAL</td>'; $html .= '<td class="head">PDV</td>'; $html .= '<td class="head">EMPRESA</td>'; $html .= '<td class="head">ID</td>'; $html .= '<td class="head">TÉCNICO</td>'; $html .= '<td class="head">NÍVEL</td>'; $html .= '<td class="head">BANDA LARGA</td>'; $html .= '<td class="head">APTO MUDANÇA NÍVEL</td>'; $html .= '</tr>'; while ($coluna = mysql_fetch_array($resultado)) { $html .= '<tr>'; $html .= '<td>R' . $coluna['cod_regional'] . '</td>'; $html .= '<td>' . $coluna['pdv_empresa'] . '</td>'; $html .= '<td>' . $coluna['pdv_empresa'] . '</td>'; $html .= '<td>' . $coluna['id_tecnico'] . '</td>'; $html .= '<td>' . $coluna['nome_tecnico'] . '</td>'; $html .= '<td>' . $coluna['nivel_tecnico'] . '</td>'; $html .= '<td>' . $coluna['status_banda_larga'] . '</td>'; $html .= '<td>' . $coluna['apto_mudanca_nivel'] . '</td>'; $html .= '</tr>'; } } } $html .= '</table>'; //Acesso ao BD - FIM if ($exportar == 0) { echo $html; } elseif ($msg != "") { header('Location: ' . $_SERVER['HTTP_REFERER'] . '&msg=' . $msg); } else { // Configurações header para forçar o download header("Content-type: application/x-msexcel"); header("Content-Disposition: attachment; filename=\"{$arquivo}\""); header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Content-Description: PHP Generated Data"); // Detecta o Browser e Plataforma e Envia o conteúdo do arquivo no formato correto $ua = getBrowser(); echo $ua['platform'] == 'windows' ? utf8_decode($html) : $html; } }
$tabela = buscaCampo("", "INSERT", "consultor_especialista", "('','" . $_GET['pdv_empresa'] . "'," . $_GET['cod_consultor'] . ")", ""); if (mysql_affected_rows() > 0) { $msg = "Consultor incluído para validação com sucesso!"; } break; } } elseif ($_POST['comando'] == 'alterar') { $tabela = buscaCampo("", "UPDATE", "credenciados", "cod_regional=" . $_POST['cod_regional'] . ", cod_consultor=" . $_POST['cod_consultor'] . ", periodicidade='" . $_POST['periodicidade'] . "'", "pdv_empresa='" . $pdv_empresa . "'"); if (mysql_affected_rows() > 0) { $msg = "Dados alterados com sucesso!"; } } elseif ($_POST['comando'] == 'excluir') { if ($tipo_empresa == 2) { $tabela = buscaCampo("", "DELETE", "consultor_especialista", "", "pdv_empresa='" . $pdv_empresa . "'"); } $tabela = buscaCampo("", "DELETE", "credenciados", "", "pdv_empresa='" . $pdv_empresa . "'"); if (mysql_affected_rows() > 0) { $msg = "Dados excluídos com sucesso!"; } else { $msg = "Não foi possivel excluir a empresa. Provavelmente existem vistorias lançadas com este PDV."; } //mysql_error($tabela); } else { echo "<style type=\"text/css\">"; echo "body{margin-top:0px;font-family:helvetica;font-size:15px;}"; echo "label{display:block;float:left;width:300px;}"; echo "fieldset{background-color:#ffc;height:150px;}"; echo "legend{font-weight:bold;}"; echo "</style>"; echo "<body style=font-family:arial>"; echo "<form name=formEditaCredenciado id=formEditaCredenciado action=edita_credenciado.php?" . $_SERVER['QUERY_STRING'] . " method=post>";
echo "\t\t<br>Este formulário destina-se exclusivamente para cadastro de usuários de empresas especialistas.<br><br>"; echo "\t\t<label>Nome:</label><input type=\"text\" name=\"nome\" id=\"nome\" class=\"input\">"; echo "\t\t<br>"; echo "\t\t<label>E-mail:</label><input type=\"text\" name=\"email\" id=\"email\" class=\"input\">"; echo "\t\t<br>"; echo "\t\t<label>Empresa:</label>"; //Monta Select da Regional"; $result = buscaTabela('*', 'credenciados', 'cod_tipo_empresa = 2 ORDER BY desc_empresa ASC'); echo "\t\t<select name=\"pdv_empresa\" id=\"pdv_empresa\">"; echo "\t\t\t<option value=\"\"></option>"; while ($row = mysql_fetch_array($result)) { echo "\t\t\t<option value=\"" . $row['pdv_empresa'] . "\">" . $row['desc_empresa'] . "</option>"; } echo "\t\t</select>"; echo "\t\t</fieldset>"; //======== INSTALACAO - FIM ========// echo "\t\t<br>"; echo "\t\t<div style=\"width:100%; text-align: center\">"; echo "\t\t<input type=\"hidden\" name=\"moderacao\" id=\"moderacao\" value=\"" . (buscaCampo("nivel_acesso", "SELECT", "consultor", "nivel_acesso", "cod_consultor = " . $_SESSION['login']) == 4 ? 0 : 1) . "\" style=\"width: 100px\">"; echo "\t\t<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Enviar\" style=\"width: 100px\">"; echo "\t\t<input type=\"button\" name=\"btnVoltar\" id=\"btnVoltar\" value=\"Menu Inicial\" onClick=\"window.location.replace('http://" . $_SERVER['HTTP_HOST'] . "/km')\" style=\"width: 100px\">"; echo "\t\t</div>"; echo "\t\t</form>"; echo "\t\t<hr>"; echo "\t\t<p style=\"font-size:12px; text-align:center; font-weight:bold; \">Formulário de vistoria gerado pelo Sistema de Engenharia de campo - SKY</p>"; echo "\t</div>"; echo "\t</body>"; echo "\t<script language=\"javaScript\">"; echo "\t\tajustaPosicao();"; echo "\t</script>"; echo "</html>";
</head> <body> <div id="topbar"> <div id="title">Links FormEntry</div> </div> <div id="content"> <ul class="pageitem"> <li class="menu"> <a href="javascript:newDoc('Vistoria.form','Formulário de Vistoria','')"><span class="name">Vistoria</span><span class="arrow"></span></a> </li> <li class="menu"> <a href="javascript:newDoc('Cadastro.form','Formulário de Cadastro')"><span class="name">Cadastro de Dispositivo</span><span class="arrow"></span></a> </li> <?php if (buscaCampo('nivel_acesso', 'SELECT', 'consultor', 'nivel_acesso', 'cod_consultor = ' . $_GET['cnst']) != 4) { ?> <li class="menu"> <a href="javascript:newDoc('CadastraEmpresa.form','Formulário de PDV','')"><span class="name">Cadastro de PDV</span><span class="arrow"></span></a> </li> <li class="menu"> <a href="javascript:newDoc('Teste_qb.form','Formulário de Teste QB','')"><span class="name">Teste de QB</span><span class="arrow"></span></a> </li> <li class="menu"> <a href="javascript:newDoc('Atividade_km.form','Formulário de Atividade KM','')"><span class="name">Atividade de KM</span><span class="arrow"></span></a> </li> <?php } ?> <li class="menu"> <a href="javascript:newDoc('','FormEntry','https://itunes.apple.com/br/app/formentry/id335355434?mt=8')"><span class="name">FormEntry</span><span class="arrow"></span></a>
</td> <td style="border:1px dotted #cc6; text-align: center"> <a href="javascript:newDoc('Vistoria.form','Formulário de Vistoria','')"><img class="enviar" src="../img/enviar.gif" alt="Enviar formulário"></a> </td> </tr> <tr style="text-align:center" onMouseOver="this.style.backgroundColor='#ff6';this.style.cursor='crosshair';" onMouseOut="this.style.backgroundColor='#fff'"> <td style="border:1px dotted #cc6; text-align: left"> <span class="name">Formulário de Cadastro de Dispositivo</span><span class="arrow"></span></a> </td> <td style="border:1px dotted #cc6; text-align: center"> <a href="javascript:newDoc('Cadastro.form','Formulário de Cadastro de Dispositivo','')"><img class="enviar" src="../img/enviar.gif" alt="Enviar formulário"></a> </td> </tr> <?php if (buscaCampo('nivel_acesso', 'SELECT', 'consultor', 'nivel_acesso', 'cod_consultor = ' . $_SESSION['login']) != 4) { ?> <tr style="text-align:center" onMouseOver="this.style.backgroundColor='#ff6';this.style.cursor='crosshair';" onMouseOut="this.style.backgroundColor='#fff'"> <td style="border:1px dotted #cc6; text-align: left"> <span class="name">Formulário de Cadastro de PDV</span><span class="arrow"></span></a> </td> <td style="border:1px dotted #cc6; text-align: center"> <a href="javascript:newDoc('CadastraEmpresa.form','Formulário de Cadastro de PDV','')"><img class="enviar" src="../img/enviar.gif" alt="Enviar formulário"></a> </td> </tr> <tr style="text-align:center" onMouseOver="this.style.backgroundColor='#ff6';this.style.cursor='crosshair';" onMouseOut="this.style.backgroundColor='#fff'"> <td style="border:1px dotted #cc6; text-align: left"> <span class="name">Formulário de Teste de QB</span><span class="arrow"></span></a> </td>
<?php session_start(); $_SESSION['login'] = 0; header('Content-Type: text/html; charset=utf-8'); require_once 'dao.php'; mysqlConnection(); mysql_query("SET NAMES 'utf8'"); mysql_query('SET character_set_connection=utf8'); mysql_query('SET character_set_client=utf8'); mysql_query('SET character_set_results=utf8'); if (isset($_GET['cnst']) && isset($_GET['url'])) { $consultor = $_GET['cnst']; $url = $_GET['url'] . '?' . str_replace('&url=' . $_GET['url'], '', $_SERVER['QUERY_STRING']); $_SESSION['login'] = buscaCampo("cod_consultor", "SELECT", "consultor", "cod_consultor", "cod_consultor = " . $consultor); } else { if (isset($_POST['txtEmail']) && isset($_POST['txtSenha'])) { $email = $_POST['txtEmail']; $senha = $_POST['txtSenha']; $_SESSION['login'] = buscaCampo("cod_consultor", "SELECT", "consultor", "cod_consultor", "email = '" . $email . "' AND senha = '" . $senha . "'"); $url = !$_SESSION['login'] ? $_SERVER['HTTP_REFERER'] : '../parceiro/'; } } header('Location: ' . $url);
if (strlen($_POST[$fields]) > 0) { $comando = "INSERT"; $tabela = "vistoria_" . $tabelas; $criterios = ""; if (!isset($_POST[$fields . '_valor'])) { //Grava campos no BD if (strpos($fields, "nova_os") > 0) { $campos = "(" . $_POST['os'] . ", '" . retornaData($_POST['abrir_nova_os_agendar_para']) . "', '" . $_POST['abrir_nova_os_periodo'] . "');"; } else { $campos = "(" . $_POST['os'] . ", '" . buscaCampo("cod_" . $tabelas, "SELECT", $tabelas, "cod_" . $tabelas, "desc_" . $tabelas . " ='" . $_POST[$fields] . "'") . "');"; } $insere = acessaBD($comando, $tabela, $campos, $criterios); } else { if ($_POST[$fields . '_valor'] > 0) { //Grava quantidade de IRDs se existir $campos = "(" . $_POST['os'] . ", '" . buscaCampo("cod_" . $tabelas, "SELECT", $tabelas, "cod_" . $tabelas, "desc_" . $tabelas . " ='" . $_POST[$fields] . "'") . "', " . $_POST[$fields . '_valor'] . ");"; $insere = acessaBD($comando, $tabela, $campos, $criterios); } } } } } } } /* //Insere dados na tabela `atividades` $comando = "INSERT"; $tabela = "atividades"; $criterios = ""; $campos = "(". buscaCampo("cod_tipo_atividade", "SELECT", "tipo_atividade", "cod_tipo_atividade", "desc_atividade ='". $_POST[$fields] ."'") ."', ". $_POST[$fields . '_valor'] .");"; $insere = acessaBD($comando, $tabela, $campos, $criterios);
function emailAlteraNivel($os, $tipo_servico, $pdv_empresa, $id_tecnico, $nome_tecnico, $alterar_nivel_para, $tipo_vistoria, $data_vistoria, $tipo_aprovacao, $nome, $email, $email_gestor = '', $tipo_auditoria) { if ($tipo_aprovacao == 'Fora do Padrão') { $subject = 'VISTORIA ' . $tipo_auditoria . ' REPROVADA'; $cor = 'F00'; } else { $subject = 'VISTORIA ' . $tipo_auditoria . ' APROVADA - ALTERACAO DE NIVEL'; $cor = '0A0'; } $message = "<div style=\"" . $GLOBALS['style'] . "\">Caros, <br><br>"; //Email de informação para a Central de Conhecimento $message .= "Seguem os dados da vistoria para as devidas providências:<br><br>"; $message .= "OS vistoriada: <b>" . $os . "</b><br>"; $message .= "Tipo de serviço: <b>" . $tipo_servico . "</b><br>"; $message .= "Credenciado: <b>" . strtoupper($pdv_empresa) . " - " . buscaCampo("desc_empresa", "SELECT", "credenciados", "desc_empresa", "pdv_empresa = '" . $pdv_empresa . "'") . "</b><br>"; $message .= "ID Técnico: <b>" . $id_tecnico . " - " . $nome_tecnico . "</b><br>"; $message .= "Tipo de vistoria: <b>" . $tipo_vistoria . "</b><br>"; $message .= "Data da vistoria: <b>" . $data_vistoria . "</b><br>"; $message .= "Avaliação: <b style=\"color:#" . $cor . "\">" . $tipo_aprovacao . "</b><br><br>"; $message .= "<b>" . $nome . "</b><br>"; $message .= "<i>" . $email . "</i><br>"; $message .= "<b>" . $GLOBALS['nome_from'] . "</b>" . $GLOBALS['nome_signature']; $message .= "</div>"; $email_from = $email; $email_cc = $email; $to = buscaCampo("email_grupo_comunicado", "SELECT", "grupo_comunicado", "email_grupo_comunicado", "cod_grupo_comunicado = 2"); return enviaEmail($to, $subject, $message, $email_from, $email_cc, ''); }
echo "<style type=\"text/css\">"; echo "body{margin-top:0px;font-family:helvetica;font-size:16px;}"; echo "label{display:block;float:left;width:300px;}"; echo "fieldset{background-color:#ffc;height:160px;}"; echo "legend{font-weight:bold;}"; echo "</style>"; echo "<body style=font-family:arial>"; echo "<form action=valida_vistoria.php?" . $_SERVER['QUERY_STRING'] . " method=post>"; echo "<label>Digite o que deve ser corrigido na vistoria:</label>"; echo "<textarea name=mensagem rows=10 cols=40></textarea><br>"; echo "<input type=submit name=Enviar value=Enviar>"; echo "</form>"; echo "</body>"; exit; } } elseif ($comando == 'Excluir') { $tabela = buscaCampo("0", "DELETE", "vistoria", "", "os=" . $row['os']); if (mysql_affected_rows() > 0) { $msg = "Vistoria excluída com sucesso!"; } else { $msg = "Vistoria não pode ser excluída!"; } } else { $msg = "Comando não informado!"; } } echo "<script>"; echo "alert('" . $msg . "');"; echo "window.opener.location.reload();"; echo "window.close();"; echo "</script>";
break; default: $titulo = 'Erro desconhecido'; $valida = 'false'; $msg = 'Ocorreu um erro não identificado no servidor'; break; } if ($retorno == 1) { //Se login OK //Insere dados na tabela `atividades` - INICIO $comando = "INSERT"; $tabela = "atividades"; $criterios = ""; $cod_consultor = buscaCampo("cod_consultor", "SELECT", "consultor", "cod_consultor", "udid8 ='" . $udid8 . "'"); $cod_local = buscaCampo("cod_local", "SELECT", "local", "cod_local", "desc_local ='" . $_POST['local'] . "'"); $cod_tipo_atividade = buscaCampo("cod_tipo_atividade", "SELECT", "tipo_atividade", "cod_tipo_atividade", "desc_atividade ='" . $_POST['atividade'] . "'"); $dt_inicial = retornaData($_POST['data']) . " " . $_POST['hora_inicio']; $dt_final = retornaData($_POST['data']) . " " . $_POST['hora_termino']; $descricao = $_POST['descricao']; $campos = "(''," . $cod_consultor . ", " . $cod_local . ", " . $cod_tipo_atividade . ", '" . $dt_inicial . "', '" . $dt_final . "', '" . $descricao . "')"; $insere = acessaBD($comando, $tabela, $campos, $criterios); //Insere dados na tabela `atividades` - FIM if (!$insere) { $retorno = 0; //Erro $titulo = 'Erro'; $valida = 'false'; $msg = 'Erro ao tentar gravar os dados no banco de dados!'; } else { //OK $retorno = 1;
if(file_exists('..\\files\\'. $arquivo)){ // faz o teste se o arquivo existe switch(strtolower(substr(strrchr(basename($arquivo),"."),1))){ // verifica a extensão do arquivo para pegar o tipo case "form": $tipo = "form-file"; break; } header("Content-Type: ". $tipo); // informa o tipo do arquivo ao navegador header("Content-Length: ". filesize($arquivo)); // informa o tamanho do arquivo ao navegador header("Content-Disposition: attachment; filename=". basename($arquivo)); // informa ao navegador que é tipo anexo e faz abrir a janela de download, tambem informa o nome do arquivo readfile($arquivo); // lê o arquivo exit; // aborta pós-ações } } else { */ $nome = buscaCampo('nome', 'SELECT', 'consultor', 'nome', 'cod_consultor = ' . $_SESSION['login']); $email = buscaCampo('email', 'SELECT', 'consultor', 'email', 'cod_consultor = ' . $_SESSION['login']); if ($_GET['arquivo'] != '') { $link = "http://" . $_SERVER['HTTP_HOST'] . "/files/" . $_GET['arquivo']; } emailFormEntry($nome, $email, $_GET['form'], $link); echo "<script>"; echo "alert('Foi enviado um e-mail de confirmação para " . $email . "'); window.location.assign(\"../km/default.asp\");"; echo "</script>"; exit; // } } else { if (isset($_SESSION['login'])) { $mobile = 0; //detect_mobile(); if ($mobile === true) { header('Location: links_mobile.php?cnst=' . $_SESSION['login'] . '&nome_formulario=Links%20FormEntry');
if (0) { //($browser=='IE'){ echo "<script type=\"text/javascript\">"; echo "alert('Este navegador não é compatível com o Formulário de Vistoria. Utilize o Google Chrome, Firefox ou Safari.');window.history.go(-1);"; echo "</script>"; //exit(); } require_once '../modulos/dao.php'; //Versão do formulário - 2.2 $app_version = '2.2'; mysqlConnection(); mysql_query("SET NAMES 'utf8'"); mysql_query('SET character_set_connection=utf8'); mysql_query('SET character_set_client=utf8'); mysql_query('SET character_set_results=utf8'); $nivel_acesso = buscaCampo("nivel_acesso", "SELECT", "consultor", "nivel_acesso", "cod_consultor = " . $_SESSION['login']); require_once 'formulario_topo.php'; echo "\t\t<form id=\"formVistoria\" name=\"formVistoria\" action=\"../qb/testeqb_web.php\" method=\"POST\" enctype=\"multipart/form-data\" onSubmit=\"return ValidaCampos(this)\">"; echo "\t\t<input type=\"hidden\" name=\"cod_consultor\" id=\"cod_consultor\" value=\"" . $_SESSION['login'] . "\">"; echo "\t\t<input type=\"hidden\" name=\"app_version\" id=\"app_version\" value=\"" . $app_version . "\">"; echo "\t\t<div id=\"barra_horizontal\">DADOS DO TESTE</div>"; echo "\t\t<br>"; //======== TIPO VISTORIA - INICIO ========// echo "\t\t<fieldset id=\"fieldset_os\">"; echo "\t\t<legend id=\"legend\">Dados da OS</legend>"; echo "\t\t<br>"; echo "\t\t<label>OS:</label><input type=\"text\" name=\"os\" id=\"os\" onKeyUp=\"camposNumericos(this)\">"; echo "\t\t<br>"; echo "\t\t<label>Customer:</label><input type=\"text\" name=\"customer\" id=\"customer\" onKeyUp=\"camposNumericos(this)\">"; echo "\t\t<br>"; echo "\t\t<label>Data do Teste:</label>";
function geraMomentoSKY($os) { $sql = "SELECT v.os, ims.desc_indicacao_momento_sky, r.desc_regional, \n" . "c.nome, vims.nome_tecnico, v.foto_antena, v.foto_lnb, \n" . "v.foto_base, v.foto_cabo, v.foto_conector, v.foto_checkup_sky \n" . "FROM vistoria_indicacao_momento_sky vims INNER JOIN indicacao_momento_sky ims \n" . "ON (ims.cod_indicacao_momento_sky = vims.cod_indicacao_momento_sky) \n" . "INNER JOIN vistoria v \n" . "ON (v.os = vims.os) \n" . "INNER JOIN consultor c \n" . "ON (c.cod_consultor = v.cod_consultor) \n" . "INNER JOIN regional r\n" . "ON (r.cod_regional = v.cod_regional) \n" . "WHERE vims.nome_tecnico is not null"; $html = '<html>'; $html .= '<head><title>Indicações Ultrapassagens e Derrapadas</title>'; $html .= '<meta charset="utf-8">'; $html .= '<style>'; $html .= '#borded-1px{white-space:nowrap; width:183px; border:1px solid black; padding:3px; font-size:11px; text-align:center; font-size:14;height:50px} '; $html .= '#borded-1px-head{border:1px solid #ddd; background-color:#fa3; padding:3px; font-size:11px; text-align:center; font-size:16} '; $html .= '#borded-2px{border:2px solid black; padding:3px; font-size:18; text-align:center;height:120px} '; $html .= 'body{font-family:arial; font-size:14} '; $html .= '#img{width:130px} '; $html .= '</style>'; $html .= '</head>'; $html .= '<body>'; $html .= '<center>'; $html .= '<table>'; $html .= '<tr>'; $html .= '<td id="borded-1px" cellpadding="5">'; $html .= '<table style="width:953">'; $html .= '<tr>'; $html .= '<td style="width:20%" id="borded-2px"><img src=http://skyengenhariadecampo.com.br/img/logosky.png width=100></td>'; $html .= '<td style="width:60%" id="borded-2px"><h2 style="width:100%;height:20px">MOMENTO SKY</h2>BLOCO MANDOU BEM</td>'; $html .= '<td style="width:20%" id="borded-2px">Mês/Ano<br><b>' . date("m/Y") . '</b></td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<table style="width:950">'; //ULTRAPASSAGEM 1 - INICIO $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ULTRAPASSAGEM #1</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 1</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5>'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Antena</b><br><br>'; $foto_antena = buscaCampo("foto_antena", "SELECT", "vistoria", "foto_antena", "os =" . $os); $html .= '<a href="' . $foto_antena . '"><img src=' . $foto_antena . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto LNB</b><br><br>'; $foto_lnb = buscaCampo("foto_lnb", "SELECT", "vistoria", "foto_lnb", "os =" . $os); $html .= '<a href="' . $foto_lnb . '"><img src=' . $foto_lnb . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Base</b><br><br>'; $foto_base = buscaCampo("foto_base", "SELECT", "vistoria", "foto_base", "os =" . $os); $html .= '<a href="' . $foto_base . '"><img src=' . $foto_base . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Cabo</b><br><br>'; $foto_cabo = buscaCampo("foto_cabo", "SELECT", "vistoria", "foto_cabo", "os =" . $os); $html .= '<a href="' . $foto_cabo . '"><img src=' . $foto_cabo . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Conector</b><br><br>'; $foto_conector = buscaCampo("foto_conector", "SELECT", "vistoria", "foto_conector", "os =" . $os); $html .= '<a href="' . $foto_conector . '"><img src=' . $foto_conector . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Checkup SKY</b><br><br>'; $foto_checkup_sky = buscaCampo("foto_checkup_sky", "SELECT", "vistoria", "foto_checkup_sky", "os =" . $os); $html .= '<a href="' . $foto_checkup_sky . '"><img src=' . $foto_checkup_sky . ' id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //COMENTÁRIOS 1 $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '<td colspan=4 id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 1</b>'; $html .= '</td>'; $html .= '</tr>'; //ULTRAPASSAGENS 1 - FIM //ULTRAPASSAGEM 2 - INICIO $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ULTRAPASSAGEM #2</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 2</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5>'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Antena</b><br><br>'; $foto_antena = buscaCampo("foto_antena", "SELECT", "vistoria", "foto_antena", "os =" . $os); $html .= '<a href="' . $foto_antena . '"><img src=' . $foto_antena . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto LNB</b><br><br>'; $foto_lnb = buscaCampo("foto_lnb", "SELECT", "vistoria", "foto_lnb", "os =" . $os); $html .= '<a href="' . $foto_lnb . '"><img src=' . $foto_lnb . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Base</b><br><br>'; $foto_base = buscaCampo("foto_base", "SELECT", "vistoria", "foto_base", "os =" . $os); $html .= '<a href="' . $foto_base . '"><img src=' . $foto_base . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Cabo</b><br><br>'; $foto_cabo = buscaCampo("foto_cabo", "SELECT", "vistoria", "foto_cabo", "os =" . $os); $html .= '<a href="' . $foto_cabo . '"><img src=' . $foto_cabo . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Conector</b><br><br>'; $foto_conector = buscaCampo("foto_conector", "SELECT", "vistoria", "foto_conector", "os =" . $os); $html .= '<a href="' . $foto_conector . '"><img src=' . $foto_conector . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Checkup SKY</b><br><br>'; $foto_checkup_sky = buscaCampo("foto_checkup_sky", "SELECT", "vistoria", "foto_checkup_sky", "os =" . $os); $html .= '<a href="' . $foto_checkup_sky . '"><img src=' . $foto_checkup_sky . ' id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //COMENTÁRIOS 2 $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '<td colspan=4 id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 1</b>'; $html .= '</td>'; $html .= '</tr>'; //ULTRAPASSAGENS 2 - FIM //ULTRAPASSAGEM 3 - INICIO $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ULTRAPASSAGEM #3</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 3</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5>'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Antena</b><br><br>'; $foto_antena = buscaCampo("foto_antena", "SELECT", "vistoria", "foto_antena", "os =" . $os); $html .= '<a href="' . $foto_antena . '"><img src=' . $foto_antena . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto LNB</b><br><br>'; $foto_lnb = buscaCampo("foto_lnb", "SELECT", "vistoria", "foto_lnb", "os =" . $os); $html .= '<a href="' . $foto_lnb . '"><img src=' . $foto_lnb . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Base</b><br><br>'; $foto_base = buscaCampo("foto_base", "SELECT", "vistoria", "foto_base", "os =" . $os); $html .= '<a href="' . $foto_base . '"><img src=' . $foto_base . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Cabo</b><br><br>'; $foto_cabo = buscaCampo("foto_cabo", "SELECT", "vistoria", "foto_cabo", "os =" . $os); $html .= '<a href="' . $foto_cabo . '"><img src=' . $foto_cabo . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Conector</b><br><br>'; $foto_conector = buscaCampo("foto_conector", "SELECT", "vistoria", "foto_conector", "os =" . $os); $html .= '<a href="' . $foto_conector . '"><img src=' . $foto_conector . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Checkup SKY</b><br><br>'; $foto_checkup_sky = buscaCampo("foto_checkup_sky", "SELECT", "vistoria", "foto_checkup_sky", "os =" . $os); $html .= '<a href="' . $foto_checkup_sky . '"><img src=' . $foto_checkup_sky . ' id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //COMENTÁRIOS 1 $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '<td colspan=4 id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 1</b>'; $html .= '</td>'; $html .= '</tr>'; //ULTRAPASSAGENS 3 - FIM //ULTRAPASSAGEM 4 - INICIO $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ULTRAPASSAGEM #4</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 4</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5>'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Antena</b><br><br>'; $foto_antena = buscaCampo("foto_antena", "SELECT", "vistoria", "foto_antena", "os =" . $os); $html .= '<a href="' . $foto_antena . '"><img src=' . $foto_antena . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto LNB</b><br><br>'; $foto_lnb = buscaCampo("foto_lnb", "SELECT", "vistoria", "foto_lnb", "os =" . $os); $html .= '<a href="' . $foto_lnb . '"><img src=' . $foto_lnb . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Base</b><br><br>'; $foto_base = buscaCampo("foto_base", "SELECT", "vistoria", "foto_base", "os =" . $os); $html .= '<a href="' . $foto_base . '"><img src=' . $foto_base . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Cabo</b><br><br>'; $foto_cabo = buscaCampo("foto_cabo", "SELECT", "vistoria", "foto_cabo", "os =" . $os); $html .= '<a href="' . $foto_cabo . '"><img src=' . $foto_cabo . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Conector</b><br><br>'; $foto_conector = buscaCampo("foto_conector", "SELECT", "vistoria", "foto_conector", "os =" . $os); $html .= '<a href="' . $foto_conector . '"><img src=' . $foto_conector . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Checkup SKY</b><br><br>'; $foto_checkup_sky = buscaCampo("foto_checkup_sky", "SELECT", "vistoria", "foto_checkup_sky", "os =" . $os); $html .= '<a href="' . $foto_checkup_sky . '"><img src=' . $foto_checkup_sky . ' id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //COMENTÁRIOS 4 $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '<td colspan=4 id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 1</b>'; $html .= '</td>'; $html .= '</tr>'; //ULTRAPASSAGENS 4 - FIM //ULTRAPASSAGEM 5 - INICIO $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ULTRAPASSAGEM #5</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 5</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5>'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Antena</b><br><br>'; $foto_antena = buscaCampo("foto_antena", "SELECT", "vistoria", "foto_antena", "os =" . $os); $html .= '<a href="' . $foto_antena . '"><img src=' . $foto_antena . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto LNB</b><br><br>'; $foto_lnb = buscaCampo("foto_lnb", "SELECT", "vistoria", "foto_lnb", "os =" . $os); $html .= '<a href="' . $foto_lnb . '"><img src=' . $foto_lnb . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Base</b><br><br>'; $foto_base = buscaCampo("foto_base", "SELECT", "vistoria", "foto_base", "os =" . $os); $html .= '<a href="' . $foto_base . '"><img src=' . $foto_base . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Cabo</b><br><br>'; $foto_cabo = buscaCampo("foto_cabo", "SELECT", "vistoria", "foto_cabo", "os =" . $os); $html .= '<a href="' . $foto_cabo . '"><img src=' . $foto_cabo . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Conector</b><br><br>'; $foto_conector = buscaCampo("foto_conector", "SELECT", "vistoria", "foto_conector", "os =" . $os); $html .= '<a href="' . $foto_conector . '"><img src=' . $foto_conector . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Checkup SKY</b><br><br>'; $foto_checkup_sky = buscaCampo("foto_checkup_sky", "SELECT", "vistoria", "foto_checkup_sky", "os =" . $os); $html .= '<a href="' . $foto_checkup_sky . '"><img src=' . $foto_checkup_sky . ' id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //COMENTÁRIOS 5 $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '<td colspan=4 id="borded-1px">'; $html .= '<b>ULTRAPASSAGEM 1</b>'; $html .= '</td>'; $html .= '</tr>'; //ULTRAPASSAGENS 5 - FIM //COMENTÁRIOS FINAIS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>COMENTÁRIOS FINAIS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<b>' . buscaCampo("comentarios_texto", "SELECT", "vistoria", "comentarios_texto", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<b>Relatório gerado pelo Sistema Engenharia de Campo em ' . date("d/m/Y") . ' às ' . date("h:i:s") . '</b></td>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</center>'; $html .= '</body>'; $html .= '</html>'; echo $html; /* //Cria o relatório em HTML $html_path = realpath($_SERVER['DOCUMENT_ROOT']) .'\\files\\fotos\\'. $os .'\\'. $os .'.html'; $fo_html = fopen($html_path,'w'); fwrite($fo_html, $html); fclose($fo_html); //Converte o relatório em PDF define('MPDF_PATH', realpath($_SERVER['DOCUMENT_ROOT']) .'\\modulos\\'); $pdf_path = realpath($_SERVER['DOCUMENT_ROOT']) .'\\files\\fotos\\'. $os .'\\'. $os .'.pdf'; include(MPDF_PATH . 'mpdf56/mpdf.php'); $mpdf = new mPDF(); $mpdf->WriteHTML($html); $mpdf->Output($pdf_path,'F'); */ }
function geraPDF($os) { $html = '<html>'; $html .= '<head><title>Vistoria - OS ' . $os . '</title>'; $html .= '<meta charset="utf-8">'; $html .= '<style>'; $html .= '#borded-1px{white-space:nowrap; width:183px; border:1px solid black; padding:3px; font-size:11px; text-align:center; font-size:14;height:50px} '; $html .= '#borded-1px-head{border:1px solid #ddd; background-color:#ddd; padding:3px; font-size:11px; text-align:center; font-size:16} '; $html .= '#borded-2px{border:2px solid black; padding:3px; font-size:18; text-align:center;height:120px} '; $html .= 'body{font-family:arial; font-size:14} '; $html .= '#img{width:130px} '; $html .= '</style>'; $html .= '</head>'; $html .= '<body>'; $html .= '<center>'; $html .= '<table>'; $html .= '<tr>'; $html .= '<td id="borded-1px" cellpadding="5">'; $html .= '<table style="width:953">'; $html .= '<tr>'; $html .= '<td style="width:20%" id="borded-2px"><img src=http://skyengenhariadecampo.com.br/img/logosky_bl.png width=170></td>'; $html .= '<td style="width:60%" id="borded-2px"><h2 style="width:100%;height:20px">Relatório de Visita Técnica - Banda Larga</h2>Engenharia de Campo Banda Larga</td>'; $html .= '<td style="width:20%" id="borded-2px">Natureza da visita<br><b>' . buscaCampo("desc_tipo_vistoria", "SELECT", "tipo_vistoria tv INNER JOIN vistoria_bl v ON (v.cod_tipo_vistoria = tv.cod_tipo_vistoria)", "tv.desc_tipo_vistoria", "v.os = " . $os) . '</b></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px" colspan="3">Vistoriador:<b> ' . buscaCampo("nome", "SELECT", "vistoria_bl v INNER JOIN consultor c ON (c.cod_consultor = v.cod_consultor)", "c.nome", "v.os =" . $os) . ' - ' . buscaCampo("desc_empresa", "SELECT", "credenciados cred INNER JOIN consultor c ON (c.pdv_sede = cred.pdv_empresa) INNER JOIN vistoria_bl v ON (v.cod_consultor=c.cod_consultor)", "cred.desc_empresa", "v.os = " . $os) . '</b></td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<table style="width:950">'; //Dados da OS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DA OS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria_bl", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria_bl", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria_bl", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Término<br><b>' . date("H:i", strtotime(buscaCampo("hora_termino_vistoria", "SELECT", "vistoria_bl", "hora_termino_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Dados do serviço $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DO SERVIÇO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo serviço<br><b>' . buscaCampo("desc_tipo_servico", "SELECT", "tipo_servico ts INNER JOIN vistoria_bl v ON (v.cod_tipo_servico = ts.cod_tipo_servico)", "ts.desc_tipo_servico", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Regional / UF<br><b>' . buscaCampo("desc_regional", "SELECT", "regional r INNER JOIN vistoria_bl v ON (v.cod_regional = r.cod_regional)", "r.desc_regional", "v.os = " . $os) . ' / ' . buscaCampo("cod_uf", "SELECT", "vistoria_bl", "cod_uf", "os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data serviço<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_servico", "SELECT", "vistoria_bl", "data_servico", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'ID Técnico<br><b>' . buscaCampo("id_tecnico", "SELECT", "vistoria_bl", "id_tecnico", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'PDV Empresa<br><b>' . buscaCampo("pdv_empresa", "SELECT", "vistoria_bl", "pdv_empresa", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Dados do local $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DO LOCAL</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Modelo CPE<br><b>' . buscaCampo("desc_modelo_cpe", "SELECT", "modelo_cpe mi INNER JOIN vistoria_bl v ON (v.cod_modelo_cpe = mi.cod_modelo_cpe)", "mi.desc_modelo_cpe", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'IMSI<br><b>' . buscaCampo("imsi", "SELECT", "vistoria_bl", "imsi", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Versão de FW<br><b>' . buscaCampo("desc_versao_firmware_cpe", "SELECT", "versao_firmware_cpe vf INNER JOIN vistoria_bl v ON (v.cod_versao_firmware_cpe = vf.cod_versao_firmware_cpe)", "vf.desc_versao_firmware_cpe", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Velocidade Contratada<br><b>' . buscaCampo("desc_velocidade_contratada", "SELECT", "velocidade_contratada vc INNER JOIN vistoria_bl v ON (v.cod_velocidade_contratada = vc.cod_velocidade_contratada)", "vc.desc_velocidade_contratada", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Área Coberta?<br><b>' . buscaCampo("area_coberta", "SELECT", "vistoria_bl", "area_coberta", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<td id="borded-1px">'; $html .= 'Endereço IP <br><b>' . buscaCampo("endereco_ip", "SELECT", "vistoria_bl", "endereco_ip", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Técnico Treinado?<br><b>' . buscaCampo("treinamento_bl", "SELECT", "vistoria_bl", "treinamento_bl", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'BSID<br><b>' . buscaCampo("padrao_bsid", "SELECT", "vistoria_bl", "padrao_bsid", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Distância do Site<br><b>' . buscaCampo("padrao_distancia_site", "SELECT", "vistoria_bl", "padrao_distancia_site", "os =" . $os) . ' m</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Localização do CPE (Lat/Lon)<br><b>' . buscaCampo("padrao_lat", "SELECT", "vistoria_bl", "padrao_lat", "os =" . $os) . ',' . buscaCampo("padrao_lon", "SELECT", "vistoria_bl", "padrao_lon", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Avaliação $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>AVALIAÇÃO DO SERVIÇO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'CINR<br><b>' . buscaCampo("padrao_cinr", "SELECT", "vistoria_bl", "padrao_cinr", "os =" . $os) . ' dB</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'RSRP<br><b>' . buscaCampo("padrao_rsrp", "SELECT", "vistoria_bl", "padrao_rsrp", "os =" . $os) . ' dBm</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'TX Power<br><b>' . buscaCampo("padrao_tx_power", "SELECT", "vistoria_bl", "padrao_tx_power", "os =" . $os) . ' dBm</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Problema de Navegação?<br><b>' . buscaCampo("desc_problema_navegacao", "SELECT", "tipo_problema_navegacao tpn INNER JOIN vistoria_bl v ON (v.cod_problema_navegacao = tpn.cod_problema_navegacao)", "tpn.desc_problema_navegacao", "v.os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Comitê Notificado?<br><b>' . (buscaCampo("comite_notificado", "SELECT", "vistoria_bl", "comite_notificado", "os =" . $os) == 'SIM' ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Download / Upload<br><b>' . buscaCampo("padrao_download", "SELECT", "vistoria_bl", "padrao_download", "os =" . $os) . ' Mbps / ' . buscaCampo("padrao_upload", "SELECT", "vistoria_bl", "padrao_upload", "os =" . $os) . ' Mbps</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Latência<br><b>' . buscaCampo("padrao_latencia", "SELECT", "vistoria_bl", "padrao_latencia", "os =" . $os) . ' ms</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Status<br><b>' . buscaCampo("desc_tipo_aprovacao", "SELECT", "tipo_aprovacao ta INNER JOIN vistoria_bl v ON (v.cod_tipo_aprovacao = ta.cod_tipo_aprovacao)", "ta.desc_tipo_aprovacao", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Abrir nova OS?<br><b>' . ($abrir_os = buscaCampo("os", "SELECT", "vistoria_bl_abrir_nova_os", "os", "os =" . $os) != 0 ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; if ($abrir_os == 'SIM') { $data_agendamento = date("d/m/Y", strtotime(buscaCampo("data_agendamento", "SELECT", "vistoria_bl_abrir_nova_os", "data_agendamento", "os =" . $os))) . ' / ' . buscaCampo("periodo", "SELECT", "vistoria_bl_abrir_nova_os", "periodo", "os =" . $os); } else { $data_agendamento = 'Não agendado'; } $html .= 'Agendado para<br><b>' . $data_agendamento . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Itens Fora do Padrão - Insatisfação Cliente - Divergencia Materiais $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DISPOSITIVOS CONECTADOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona dispositivo conectado $campos = "dc.desc_dispositivo_conectado_bl"; $tabela = "dispositivo_conectado_bl dc INNER JOIN vistoria_bl_dispositivo_conectado vdc ON (vdc.cod_dispositivo_conectado = dc.cod_dispositivo_conectado_bl) INNER JOIN vistoria_bl v ON (v.os = vdc.os)"; $criterio = "v.os = " . $os; //Seleciona itens fora do padrão - FIM $result = buscaTabela($campos, $tabela, $criterio); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_dispositivo_conectado_bl'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; //Itens Fora do Padrão - Insatisfação Cliente - Divergencia Materiais $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ITENS FORA DO PADRÃO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona itens fora do padrão - INICIO $campos = "ifp.desc_item_fora_padrao_bl"; $tabela = "item_fora_padrao_bl ifp INNER JOIN vistoria_bl_item_fora_padrao vifp ON (vifp.cod_item_fora_padrao = ifp.cod_item_fora_padrao_bl) INNER JOIN vistoria_bl v ON (v.os = vifp.os)"; $criterio = "v.os = " . $os; //Seleciona itens fora do padrão - FIM $result = buscaTabela($campos, $tabela, $criterio); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_item_fora_padrao_bl'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>INSATISFAÇÃO DO CLIENTE</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona insatisfacao do cliente - INICIO $campos = "ic.desc_insatisfacao_cliente_bl"; $tabela = "insatisfacao_cliente_bl ic INNER JOIN vistoria_bl_insatisfacao_cliente vic ON (vic.cod_insatisfacao_cliente = ic.cod_insatisfacao_cliente_bl) INNER JOIN vistoria_bl v ON (v.os = vic.os)"; $criterio = "v.os = " . $os; //Seleciona insatisfacao do cleinte - FIM $result = buscaTabela($campos, $tabela, $criterio); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_insatisfacao_cliente_bl'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DIVERGÊNCIA DE MATERIAIS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona divergencia de materiais - INICIO $campos = "dm.desc_divergencia_materiais_bl"; $tabela = "divergencia_materiais_bl dm INNER JOIN vistoria_bl_divergencia_materiais vdm ON (vdm.cod_divergencia_materiais = dm.cod_divergencia_materiais_bl) INNER JOIN vistoria_bl v ON (v.os = vdm.os)"; $criterio = "v.os = " . $os; //Seleciona divergencia de materiais - FIM $result = buscaTabela($campos, $tabela, $criterio); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_divergencia_materiais_bl'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>FOTOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; // Cria caminho para gravação das fotos $protocolo = strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'https') === false ? 'http' : 'https'; $host = $_SERVER['HTTP_HOST']; $url = $protocolo . '://' . $host . '/files/fotos/' . $os . '/'; //Foto CPE $html .= '<b>Foto CPE</b><br><br>'; $html .= '<a href="' . $url . $os . '-cpe.jpeg"><img src="' . $url . $os . '-cpe.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Cabo $html .= '<b>Foto Cabo</b><br><br>'; $html .= '<a href="' . $url . $os . '-cabo.jpeg"><img src="' . $url . $os . '-cabo.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Conector $html .= '<b>Foto Conector</b><br><br>'; $html .= '<a href="' . $url . $os . '-conector.jpeg"><img src="' . $url . $os . '-conector.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto ITSA $html .= '<b>Foto ITSA</b><br><br>'; $html .= '<a href="' . $url . $os . '-itsa.jpeg"><img src="' . $url . $os . '-itsa.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Mapa $html .= '<b>Foto Mapa</b><br><br>'; $html .= '<a href="' . $url . $os . '-mapa.jpeg"><img src="' . $url . $os . '-mapa.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Velocidade $html .= '<b>Foto Velocidade</b><br><br>'; $html .= '<a href="' . $url . $os . '-velocidade.jpeg"><img src="' . $url . $os . '-velocidade.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //Comentários $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<b>' . buscaCampo("comentarios_texto", "SELECT", "vistoria_bl", "comentarios_texto", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $data_vistoria = buscaCampo("log_data", "SELECT", "vistoria_bl", "log_data", "os =" . $os); $html .= 'Relatório gerado pelo SIGA em ' . date("d/m/Y - H:i", strtotime($data_vistoria)) . '</td>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</center>'; $html .= '</body>'; $html .= '</html>'; //Cria o relatório em HTML $html_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $os . '\\' . $os . '.html'; $fo_html = fopen($html_path, 'w'); fwrite($fo_html, $html); fclose($fo_html); /* //Converte o relatório em PDF define('MPDF_PATH', realpath($_SERVER['DOCUMENT_ROOT']) .'\\modulos\\'); $pdf_path = realpath($_SERVER['DOCUMENT_ROOT']) .'\\files\\fotos\\'. $os .'\\'. $os .'.pdf'; try { include(MPDF_PATH . 'mpdf56/mpdf.php'); $mpdf = new mPDF(); $mpdf->WriteHTML($html); $mpdf->Output($pdf_path,'F'); $mpdf->Close(); return 1; } catch (Exception $e) { return $e->getMessage(); } */ }
$tipo_aprovacao = buscaCampo("desc_tipo_aprovacao", "SELECT", "tipo_aprovacao", "desc_tipo_aprovacao", "cod_tipo_aprovacao=" . $indice_aprovacao); $array_tipo[1] = ""; $array_tipo[2] = "Ultrapassagem"; $array_tipo[3] = "Derrapada"; $tecnico = $_POST['tecnico']; if ($_POST['tipo'] != $array_tipo[$indice_aprovacao]) { $msg = "Vistoria " . $tipo_aprovacao . " não pode ser indicada como " . $_POST['tipo'] . "!"; header('Location: indica_mandou_bem.php?msg=' . $msg . '&tipo=' . $_REQUEST['tipo']); } elseif ($os == '' || $tipo == '' || $tecnico == '') { $msg = "Preencha todos os campos!"; header('Location: indica_mandou_bem.php?msg=' . $msg . '&tipo=' . $_REQUEST['tipo']); } elseif (!buscaCampo("os", "SELECT", "vistoria", "os", "os=" . $os . ($_SESSION['nivel_acesso'] > 2 ? ' AND cod_consultor=' . $_SESSION['login'] : ''))) { //Busca se OS existe no sistema $msg = "A OS " . $os . " não consta no sistema ou é de outro consultor.<br>Verifique se o número da OS está correto!"; header('Location: indica_mandou_bem.php?msg=' . $msg . '&tipo=' . $_REQUEST['tipo']); } elseif (buscaCampo("os", "SELECT", "vistoria_indicacao_momento_sky", "os", "os=" . $os) > 0) { //Busca se já existe indicação $msg = "A OS " . $os . " já foi indicada como " . $_REQUEST['tipo'] . "!"; header('Location: indica_mandou_bem.php?msg=' . $msg . '&tipo=' . $_REQUEST['tipo']); } else { $comando = "INSERT"; $tabela = "vistoria_indicacao_momento_sky"; $campos = "(" . $os . "," . $tipo . ",'" . $tecnico . "',1)"; $criterios = ""; $insere_vistoria = acessaBD($comando, $tabela, $campos, $criterios); if (mysql_affected_rows() > 0) { $msg = "Indicação inserida com sucesso!"; } else { $msg = "A indicação não pode ser incluída!"; } echo "<script>";
function emailAlteraNivel($os, $tipo_servico, $pdv_empresa, $id_tecnico, $nome_tecnico, $alterar_nivel_para, $tipo_vistoria, $data_vistoria, $tipo_aprovacao, $nome, $email, $email_gestor) { if ($tipo_aprovacao == 'Fora do Padrão') { $subject = 'VISTORIA REPROVADA'; $cor = 'F00'; } else { $subject = 'VISTORIA APROVADA - ALTERACAO DE NIVEL'; $cor = '0A0'; } $message = "Caros, <br><br>"; //Email de informação para a Central de Conhecimento $message .= "Seguem os dados da vistoria para as devidas providências:<br><br>"; $message .= "OS vistoriada: <b>" . $os . "</b><br>"; $message .= "Tipo de serviço: <b>" . $tipo_servico . "</b><br>"; $message .= "Credenciado: <b>" . $pdv_empresa . " - " . buscaCampo("desc_empresa", "SELECT", "credenciados", "desc_empresa", "pdv_empresa = '" . $pdv_empresa . "'") . "</b><br>"; $message .= "ID Técnico: <b>" . $id_tecnico . " - " . $nome_tecnico . "</b><br>"; if ($tipo_aprovacao != 'Fora do Padrão') { $message .= "Alterar nível para: <b>" . $alterar_nivel_para . "</b><br>"; } $message .= "Tipo de vistoria: <b>" . $tipo_vistoria . "</b><br>"; $message .= "Data da vistoria: <b>" . $data_vistoria . "</b><br>"; $message .= "Avaliação: <b style=\"color:#" . $cor . "\">" . $tipo_aprovacao . "</b><br><br>"; $message .= "<b>" . $nome . "</b><br>"; $message .= "<i>" . $email . "</i><br>"; $message .= "SKY Engenharia de Campo"; $message .= "<hr>Este email foi enviado automaticamente pelo Sistema Engenharia de Campo via Formulário Web<br><br>"; $email_from = $email; $email_cc = $email; $to = buscaCampo("email_grupo_comunicado", "SELECT", "grupo_comunicado", "email_grupo_comunicado", "cod_grupo_comunicado = 2"); return enviaEmail($to, $subject, $message, $email_from, $email_cc); }
echo "\t\t</select>"; echo "\t\t<br>"; echo "\t\t<label>OS:</label><input type=\"text\" name=\"os\" id=\"os\" onKeyUp=\"camposNumericos(this)\" value=\"" . $os . "\">"; echo "\t\t<br>"; echo "\t\t<label>Customer:</label><input type=\"text\" name=\"customer\" id=\"customer\" onKeyUp=\"camposNumericos(this)\" value=\"" . buscaCampo('customer', 'SELECT', 'vistoria', 'customer', 'os=' . $os) . "\">"; echo "\t\t<br>"; echo "\t\t<label>Data Vistoria:</label>"; echo "\t\t<input type=\"text\" name=\"dia_vistoria\" id=\"dia_vistoria\" size=\"2\" maxlength=\"2\" onKeyUp=\"camposNumericos(this); MudaCampo(this);\" onBlur=\"if(this.value.length==1){this.value = 0 + this.value}; ajustaDataHora(dia_vistoria,mes_vistoria,ano_vistoria,'',data_vistoria);\" value=\"" . buscaCampo('dia_vistoria', 'SELECT', 'vistoria', 'day(data_vistoria) dia_vistoria', 'os=' . $os) . "\"> / "; echo "\t\t<select name=\"mes_vistoria\" id=\"mes_vistoria\" onBlur=\"ajustaDataHora(dia_vistoria,mes_vistoria,ano_vistoria,'',data_vistoria);\">"; $mes = array('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'); $campo_provisorio = buscaCampo('mes_vistoria', 'SELECT', 'vistoria', 'month(data_vistoria) mes_vistoria', 'os=' . $os); for ($i = 0; $i < 12; $i++) { echo "\t\t\t<option value=\"" . ($i + 1) . "\"" . ($i + 1 == $campo_provisorio ? ' Selected' : '') . ">" . $mes[$i] . "</option>"; } echo "\t\t</select> / "; echo "\t\t<input type=\"text\" name=\"ano_vistoria\" id=\"ano_vistoria\" size=\"4\" maxlength=\"4\" onKeyUp=\"camposNumericos(this);\" onBlur=\"if(this.value.length<4){alert('Digite o ano com 4 dígitos!'); this.focus(); this.select();}; ajustaDataHora(dia_vistoria,mes_vistoria,ano_vistoria,'',data_vistoria);\" value=\"" . buscaCampo('ano_vistoria', 'SELECT', 'vistoria', 'year(data_vistoria) ano_vistoria', 'os=' . $os) . "\">"; echo "\t\t<input type=\"text\" name=\"data_vistoria\" id=\"data_vistoria\" value=\"\">"; echo "\t\t<br>"; echo "\t\t<label>Hora Início:</label>"; echo "\t\t<select name=\"hora_inicio\" id=\"hora_inicio\" onChange=\"ajustaDataHora(hora_inicio,minuto_inicio,'','',hora_inicio_vistoria)\">"; echo "\t\t<option value=\"\"></option>"; for ($i = 0; $i <= 23; $i++) { echo "<option value=\"" . (strlen($i) == 1 ? '0' . $i : $i) . "\">" . (strlen($i) == 1 ? '0' . $i : $i) . "</option>"; } echo "\t\t</select> : "; echo "\t\t<select name=\"minuto_inicio\" id=\"minuto_inicio\" onChange=\"ajustaDataHora(hora_inicio,minuto_inicio,'','',hora_inicio_vistoria)\">"; echo "\t\t<option value=\"\"></option>"; for ($i = 0; $i <= 59; $i += 5) { echo "<option value=\"" . (strlen($i) == 1 ? '0' . $i : $i) . "\">" . (strlen($i) == 1 ? '0' . $i : $i) . "</option>"; } echo "\t\t</select>";
function geraPDF($os) { $html = '<html>'; $html .= '<head><title>Vistoria - OS ' . $os . '</title>'; $html .= '<meta charset="utf-8">'; $html .= '<style>'; $html .= '#borded-1px{white-space:nowrap; width:183px; border:1px solid black; padding:3px; font-size:11px; text-align:center; font-size:14;height:50px} '; $html .= '#borded-1px-head{border:1px solid #ddd; background-color:#ddd; padding:3px; font-size:11px; text-align:center; font-size:16} '; $html .= '#borded-2px{border:2px solid black; padding:3px; font-size:18; text-align:center;height:120px} '; $html .= 'body{font-family:arial; font-size:14} '; $html .= '#img{width:130px} '; $html .= '</style>'; $html .= '</head>'; $html .= '<body>'; $html .= '<center>'; $html .= '<table>'; $html .= '<tr>'; $html .= '<td id="borded-1px" cellpadding="5">'; $html .= '<table style="width:953">'; $html .= '<tr>'; $html .= '<td style="width:20%" id="borded-2px"><img src=http://skyengenhariadecampo.com.br/img/logosky.png width=100></td>'; $html .= '<td style="width:60%" id="borded-2px"><h2 style="width:100%;height:20px">Relatório de Visita Técnica</h2>Engenharia de Campo</td>'; $html .= '<td style="width:20%" id="borded-2px">Natureza da visita<br><b>' . buscaCampo("desc_tipo_vistoria", "SELECT", "tipo_vistoria tv INNER JOIN vistoria v ON (v.cod_tipo_vistoria = tv.cod_tipo_vistoria)", "tv.desc_tipo_vistoria", "v.os = " . $os) . '</b></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px" colspan="3">Vistoriador:<b> ' . buscaCampo("nome", "SELECT", "vistoria v INNER JOIN consultor c ON (c.cod_consultor = v.cod_consultor)", "c.nome", "v.os =" . $os) . ' - ' . buscaCampo("desc_empresa", "SELECT", "credenciados cred INNER JOIN consultor c ON (c.pdv_sede = cred.pdv_empresa) INNER JOIN vistoria v ON (v.cod_consultor=c.cod_consultor)", "cred.desc_empresa", "v.os = " . $os) . '</b></td>'; // $html .= '<td id="borded-1px" colspan="3">Vistoriador:<b> '. $vistoriador .'</b></td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<table style="width:950">'; //Dados da OS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DA OS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $os . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . buscaCampo("customer", "SELECT", "vistoria", "customer", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_vistoria", "SELECT", "vistoria", "data_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . date("H:i", strtotime(buscaCampo("hora_inicio_vistoria", "SELECT", "vistoria", "hora_inicio_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Término<br><b>' . date("H:i", strtotime(buscaCampo("hora_termino_vistoria", "SELECT", "vistoria", "hora_termino_vistoria", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Dados do serviço $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DO SERVIÇO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo serviço<br><b>' . buscaCampo("desc_tipo_servico", "SELECT", "tipo_servico ts INNER JOIN vistoria v ON (v.cod_tipo_servico = ts.cod_tipo_servico)", "ts.desc_tipo_servico", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Regional<br><b>' . buscaCampo("desc_regional", "SELECT", "regional r INNER JOIN vistoria v ON (v.cod_regional = r.cod_regional)", "r.desc_regional", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data serviço<br><b>' . date("d/m/Y", strtotime(buscaCampo("data_servico", "SELECT", "vistoria", "data_servico", "os =" . $os))) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'ID Técnico<br><b>' . buscaCampo("id_tecnico", "SELECT", "vistoria", "id_tecnico", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'PDV Empresa<br><b>' . buscaCampo("pdv_empresa", "SELECT", "vistoria", "pdv_empresa", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Dados do local $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DO LOCAL</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo Instalação<br><b>' . buscaCampo("desc_tipo_instalacao", "SELECT", "tipo_instalacao ti INNER JOIN vistoria v ON (v.cod_tipo_instalacao = ti.cod_tipo_instalacao)", "ti.desc_tipo_instalacao", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo LNB<br><b>' . buscaCampo("desc_tipo_lnb", "SELECT", "tipo_lnb tl INNER JOIN vistoria v ON (v.cod_tipo_lnb = tl.cod_tipo_lnb)", "tl.desc_tipo_lnb", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Modelo IRD<br><b>' . buscaCampo("desc_modelo_ird", "SELECT", "modelo_ird mi INNER JOIN vistoria v ON (v.cod_modelo_ird = mi.cod_modelo_ird)", "mi.desc_modelo_ird", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Smart Card<br><b>' . buscaCampo("smart_card", "SELECT", "vistoria", "smart_card", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Possui Módulo Terrestre?<br><b>' . buscaCampo("desc_modulo_terrestre", "SELECT", "modulo_terrestre mt INNER JOIN vistoria v ON (v.cod_modulo_terrestre = mt.cod_modulo_terrestre)", "mt.desc_modulo_terrestre", "v.os = " . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<td id="borded-1px" colspan="2">'; $html .= '<ul>'; $html .= '<li style="text-align:left">Possui Banda Larga? <b>' . buscaCampo("desc_tipo_banda_larga", "SELECT", "tipo_banda_larga tbl INNER JOIN vistoria v ON (v.cod_tipo_banda_larga = tbl.cod_tipo_banda_larga)", "tbl.desc_tipo_banda_larga", "v.os = " . $os) . '</b></li>'; $html .= '<li style="text-align:left">Operadora: <b>' . buscaCampo("desc_tipo_operadora", "SELECT", "tipo_operadora o INNER JOIN vistoria v ON (v.cod_tipo_operadora = o.cod_tipo_operadora)", "o.desc_tipo_operadora", "os = " . $os) . '</b></li>'; $html .= '</ul>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'TV LCD/LED? <b>' . (buscaCampo("tv_lcd_led", "SELECT", "vistoria", "tv_lcd_led", "os = " . $os) ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Região tem SBTVD-T? <b>' . (buscaCampo("regiao_tem_uhf", "SELECT", "vistoria", "regiao_tem_uhf", "os = " . $os) ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Módulo funcionando? <b>' . (buscaCampo("modulo_terrestre_habilitado", "SELECT", "vistoria", "modulo_terrestre_habilitado", "os = " . $os) == 1 ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '</tr>'; // Busca pontos adicionais $query = "SELECT cod_modelo_ird, cod_modulo_terrestre, modulo_terrestre_habilitado, tv_lcd_led FROM vistoria_ponto_adicional WHERE os = " . $os; $pontos_adicionais = mysql_query($query); //Pontos adicionais if (mysql_affected_rows() > 0) { $html .= '<tr>'; $html .= '<td colspan="5" style="text-align: center">'; $html .= '<b>Pontos Adicionais</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; } $ponto = 2; while ($row = mysql_fetch_array($pontos_adicionais)) { $html .= '<td id="borded-1px" style="text-align:left; font-size: 12px">'; $html .= "<b>Ponto " . $ponto . ":</b><br>"; $html .= "Modelo IDR: <br><b>" . buscaCampo("desc_modelo_ird", "SELECT", "modelo_ird", "desc_modelo_ird", "cod_modelo_ird = " . $row['cod_modelo_ird']) . "</b><br>"; $html .= "Possui Módulo Terrestre? <br><b>" . buscaCampo("desc_modulo_terrestre", "SELECT", "modulo_terrestre", "desc_modulo_terrestre", "cod_modulo_terrestre = " . $row['cod_modulo_terrestre']) . "</b><br>"; $html .= "Módulo funcionando? <b>" . ($row['modulo_terrestre_habilitado'] == 1 ? 'SIM' : 'NÃO') . "</b><br>"; $html .= "TV LCD/LED? <b>" . ($row['tv_lcd_led'] ? 'SIM' : 'NÃO') . "</b>"; $html .= '</td>'; $ponto++; } $html .= '</tr>'; //Avaliação $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>AVALIAÇÃO DO SERVIÇO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Nível de Sinal<br><b>' . buscaCampo("padrao_ber", "SELECT", "vistoria", "padrao_ber", "os =" . $os) . buscaCampo("padrao_taxa", "SELECT", "vistoria", "padrao_taxa", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Checkup SKY<br><b>' . buscaCampo("padrao_checkup_sky", "SELECT", "vistoria", "padrao_checkup_sky", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Status<br><b>' . buscaCampo("desc_tipo_aprovacao", "SELECT", "tipo_aprovacao ta INNER JOIN vistoria v ON (v.cod_tipo_aprovacao = ta.cod_tipo_aprovacao)", "ta.desc_tipo_aprovacao", "v.os =" . $os) . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Abrir nova OS?<br><b>' . ($abrir_os = buscaCampo("os", "SELECT", "vistoria_abrir_nova_os", "os", "os =" . $os) != 0 ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; if ($abrir_os == 'SIM') { $data_agendamento = date("d/m/Y", strtotime(buscaCampo("data_agendamento", "SELECT", "vistoria_abrir_nova_os", "data_agendamento", "os =" . $os))) . ' / ' . buscaCampo("periodo", "SELECT", "vistoria_abrir_nova_os", "periodo", "os =" . $os); } else { $data_agendamento = 'Não agendado'; } $html .= 'Agendado para<br><b>' . $data_agendamento . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Itens Fora do Padrão - Insatisfação Cliente - Divergencia Materiais $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ITENS FORA DO PADRÃO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona itens fora do padrão - INICIO $comando = "SELECT"; $campos = "ifp.desc_item_fora_padrao"; $tabela = "item_fora_padrao ifp INNER JOIN vistoria_item_fora_padrao vifp ON (vifp.cod_item_fora_padrao = ifp.cod_item_fora_padrao) INNER JOIN vistoria v ON (v.os = vifp.os)"; $criterio = "v.os = " . $os; //Seleciona itens fora do padrão - FIM $query = $comando . ' ' . $campos . ' FROM ' . $tabela . ' WHERE ' . $criterio; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_item_fora_padrao'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>INSATISFAÇÃO DO CLIENTE</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona insatisfacao do cliente - INICIO $comando = "SELECT"; $campos = "ic.desc_insatisfacao_cliente"; $tabela = "insatisfacao_cliente ic INNER JOIN vistoria_insatisfacao_cliente vic ON (vic.cod_insatisfacao_cliente = ic.cod_insatisfacao_cliente) INNER JOIN vistoria v ON (v.os = vic.os)"; $criterio = "v.os = " . $os; //Seleciona insatisfacao do cleinte - FIM $query = $comando . ' ' . $campos . ' FROM ' . $tabela . ' WHERE ' . $criterio; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_insatisfacao_cliente'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DIVERGÊNCIA DE MATERIAIS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; //Seleciona divergencia de materiais - INICIO $comando = "SELECT"; $campos = "dm.desc_divergencia_materiais"; $tabela = "divergencia_materiais dm INNER JOIN vistoria_divergencia_materiais vdm ON (vdm.cod_divergencia_materiais = dm.cod_divergencia_materiais) INNER JOIN vistoria v ON (v.os = vdm.os)"; $criterio = "v.os = " . $os; //Seleciona divergencia de materiais - FIM $query = $comando . ' ' . $campos . ' FROM ' . $tabela . ' WHERE ' . $criterio; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $html .= '<li><b>' . $row['desc_divergencia_materiais'] . '</b></li>'; } $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>FOTOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; // Cria caminho para gravação das fotos $protocolo = strpos(strtolower($_SERVER['SERVER_PROTOCOL']), 'https') === false ? 'http' : 'https'; $host = $_SERVER['HTTP_HOST']; $url = $protocolo . '://' . $host . '/files/fotos/' . $os . '/'; //Foto Antena $html .= '<b>Foto Antena</b><br><br>'; $html .= '<a href="' . $url . $os . '-antena.jpeg"><img src="' . $url . $os . '-antena.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto LNB $html .= '<b>Foto LNB</b><br><br>'; $html .= '<a href="' . $url . $os . '-lnb.jpeg"><img src="' . $url . $os . '-lnb.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Base $html .= '<b>Foto Base</b><br><br>'; $html .= '<a href="' . $url . $os . '-base.jpeg"><img src="' . $url . $os . '-base.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Cabo $html .= '<b>Foto Cabo</b><br><br>'; $html .= '<a href="' . $url . $os . '-cabo.jpeg"><img src="' . $url . $os . '-cabo.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Conector $html .= '<b>Foto Conector</b><br><br>'; $html .= '<a href="' . $url . $os . '-conector.jpeg"><img src="' . $url . $os . '-conector.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; //Foto Checkup SKY $html .= '<b>Foto Checkup SKY</b><br><br>'; $html .= '<a href="' . $url . $os . '-checkup_sky.jpeg"><img src="' . $url . $os . '-checkup_sky.jpeg" id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //Comentários $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<b>' . buscaCampo("comentarios_texto", "SELECT", "vistoria", "comentarios_texto", "os =" . $os) . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $data_vistoria = buscaCampo("log_data", "SELECT", "vistoria", "log_data", "os =" . $os); $html .= 'Relatório gerado pelo SIGA em ' . date("d/m/Y - H:i", strtotime($data_vistoria)) . '</td>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</center>'; $html .= '</body>'; $html .= '</html>'; //Cria o relatório em HTML $html_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $os . '\\' . $os . '.html'; $fo_html = fopen($html_path, 'w'); fwrite($fo_html, $html); fclose($fo_html); /* //Converte o relatório em PDF define('MPDF_PATH', realpath($_SERVER['DOCUMENT_ROOT']) .'\\modulos\\'); $pdf_path = realpath($_SERVER['DOCUMENT_ROOT']) .'\\files\\fotos\\'. $os .'\\'. $os .'.pdf'; try { include(MPDF_PATH . 'mpdf56/mpdf.php'); $mpdf = new mPDF(); $mpdf->WriteHTML($html); $mpdf->Output($pdf_path,'F'); $mpdf->Close(); return 1; } catch (Exception $e) { return $e->getMessage(); } */ }
$retorno = 0; //Erro $titulo = 'Erro de banco de dados'; $valida = 'false'; $msg = 'Erro ao tentar gravar os dados no banco de dados!'; } else { //OK $retorno = 1; $titulo = 'Concluído'; $valida = 'true'; $msg = 'Dados gravados com sucesso no banco de dados!'; // // Envio de Emails - INICIO // //Cópia do email para os gestores $email_cc = buscaCampo("email", "SELECT", "consultor", "email", "cod_grupo = " . $consulta_login['cod_grupo'] . " AND nivel_acesso < 3"); //Se a vistoria for de especialista, busca email dos consultores responsaveis if ($consulta_login['pdv_sede'] != 'SKY0000') { $resultado_emailcc = buscaTabela("c.email", "consultor c INNER JOIN consultor_especialista ce ON (ce.cod_consultor = c.cod_consultor)", "ce.pdv_empresa = '" . $consulta_login['pdv_sede'] . "'"); while ($row = mysql_fetch_array($resultado_emailcc)) { $email_cc .= ',' . $row['email']; } } //Email de confirmação para o usuário $email_notificacao = emailNotificacao($consulta_login['nome'], $_POST['os'], $url, $consulta_login['cod_grupo'], $to, $email_from, $email_cc, $_POST['tipo_aprovacao'], 'PayTV'); if ($email_notificacao != 1) { $valida = 'false'; $title = 'ATENÇÃO'; $msg = 'Não foi possível enviar o email de confirmação!'; retornaMensagem('true', 'true', 'ATENÇÃO', $msg, 'OK'); exit;
function geraPDF($os, $item_fora_padrao, $insatisfacao_cliente, $divergencia_materiais) { $html = '<html>'; $html .= '<head><title>Vistoria - OS ' . $_POST['os'] . '</title>'; $html .= '<meta charset="utf-8">'; $html .= '<style>'; $html .= '#borded-1px{white-space:nowrap; width:183px; border:1px solid black; padding:3px; font-size:11px; text-align:center; font-size:14;height:50px} '; $html .= '#borded-1px-head{border:1px solid #ddd; background-color:#ddd; padding:3px; font-size:11px; text-align:center; font-size:16} '; $html .= '#borded-2px{border:2px solid black; padding:3px; font-size:18; text-align:center;height:120px} '; $html .= 'body{font-family:arial; font-size:14} '; $html .= '#img{width:130px} '; $html .= '</style>'; $html .= '</head>'; $html .= '<body>'; $html .= '<center>'; $html .= '<table>'; $html .= '<tr>'; $html .= '<td id="borded-1px" cellpadding="5">'; $html .= '<table style="width:953">'; $html .= '<tr>'; $html .= '<td style="width:20%" id="borded-2px"><img src=http://skyengenhariadecampo.com.br/img/logosky.png width=100></td>'; $html .= '<td style="width:60%" id="borded-2px"><h2 style="width:100%;height:20px">Relatório de Visita Técnica</h2>Engenharia de Campo</td>'; $html .= '<td style="width:20%" id="borded-2px">Natureza da visita<br><b>' . $_POST['tipo_vistoria'] . '</b></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px" colspan="3">Consultor:<b> ' . buscaCampo("nome", "SELECT", "consultor", "nome", "udid8 ='" . $_POST['device_udid8'] . "';") . '</b></td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<table style="width:950">'; //Dados da OS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DA OS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'OS<br><b>' . $_POST['os'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Customer<br><b>' . $_POST['customer'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data vistoria<br><b>' . $_POST['data_vistoria'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Inicio<br><b>' . $_POST['hora_inicio_vistoria'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Término<br><b>' . $_POST['hora_termino_vistoria'] . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Dados do serviço $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DO SERVIÇO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo serviço<br><b>' . $_POST['tipo_servico'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Regional<br><b>' . $_POST['regional'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Data serviço<br><b>' . $_POST['data_servico'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'ID Técnico<br><b>' . $_POST['id_tecnico'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'PDV Empresa<br><b>' . $_POST['pdv_empresa'] . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Dados do local $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DADOS DO LOCAL</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo Instalação<br><b>' . $_POST['tipo_instalacao'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Tipo LNB<br><b>' . $_POST['tipo_lnb'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Modelo IRD<br><b>' . $_POST['modelo_ird'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Smart Card<br><b>' . $_POST['smart_card'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Possui Módulo Terrestre?<br><b>' . $_POST['possui_modulo_terrestre'] . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px" colspan="2">'; $html .= 'Quantidade de pontos<br>'; $html .= 'SD: <b>' . $_POST['quantidade_ird_sd_valor'] . '</b> | '; $html .= 'HD Slim: <b>' . $_POST['quantidade_ird_hd_slim_valor'] . '</b> | '; $html .= 'HD Plus: <b>' . $_POST['quantidade_ird_hd_plus_valor'] . '</b> | '; $html .= 'Zapper: <b>' . $_POST['quantidade_ird_zapper_valor'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px" colspan="3">'; $html .= 'Outros Sistemas<br>'; $html .= 'TV 16:9: <b>' . ($_POST['outros_sistemas_tv_16_9'] != '' ? 'SIM' : 'NÃO') . '</b> | '; $html .= 'DVD/Bluray: <b>' . ($_POST['outros_sistemas_dvd_bluray'] != '' ? 'SIM' : 'NÃO') . '</b> | '; $html .= 'Home Theater: <b>' . ($_POST['outros_sistemas_home_theater'] != '' ? 'SIM' : 'NÃO') . '</b> | '; $html .= 'Video Game: <b>' . ($_POST['outros_sistemas_video_game'] != '' ? 'SIM' : 'NÃO') . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Avaliação $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>AVALIAÇÃO DO SERVIÇO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td id="borded-1px">'; $html .= 'BER<br><b>' . $_POST['padrao_ber'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Checkup SKY<br><b>' . $_POST['padrao_checkup_sky'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Aprovação<br><b>' . $_POST['tipo_aprovacao'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Abrir nova OS?<br><b>' . $_POST['abrir_nova_os'] . '</b>'; $html .= '</td>'; $html .= '<td id="borded-1px">'; $html .= 'Agendado para<br><b>' . $_POST['abrir_nova_os_agendar_para'] . ' / ' . $_POST['abrir_nova_os_periodo'] . '</b>'; $html .= '</td>'; $html .= '</tr>'; //Itens Fora do Padrão - Insatisfação Cliente - Divergencia Materiais $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>ITENS FORA DO PADRÃO</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; foreach ($item_fora_padrao as $item_fora) { if ($_POST['item_fora_padrao_' . $item_fora] != '') { $html .= '<li>' . $_POST['item_fora_padrao_' . $item_fora] . '</b></li>'; } } $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>INSATISFAÇÃO DO CLIENTE</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; foreach ($insatisfacao_cliente as $insatisfacao) { if ($_POST['insatisfacao_cliente_' . $insatisfacao] != '') { $html .= '<li>' . $_POST['insatisfacao_cliente_' . $insatisfacao] . '</b></li>'; } } $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>DIVERGÊNCIA DE MATERIAIS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; foreach ($divergencia_materiais as $divergencia) { if ($_POST['divergencia_materiais_' . $divergencia] != '') { $html .= '<li>' . $_POST['divergencia_materiais_' . $divergencia] . '</b></li>'; } } $html .= '</td>'; $html .= '</tr>'; //FOTOS $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>FOTOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<table style="width:930">'; $html .= '<tr>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Antena</b><br><br>'; $foto_antena = buscaCampo("foto_antena", "SELECT", "vistoria", "foto_antena", "os =" . $_POST['os']); $html .= '<a href="' . $foto_antena . '"><img src=' . $foto_antena . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto LNB</b><br><br>'; $foto_lnb = buscaCampo("foto_lnb", "SELECT", "vistoria", "foto_lnb", "os =" . $_POST['os']); $html .= '<a href="' . $foto_lnb . '"><img src=' . $foto_lnb . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Base</b><br><br>'; $foto_base = buscaCampo("foto_base", "SELECT", "vistoria", "foto_base", "os =" . $_POST['os']); $html .= '<a href="' . $foto_base . '"><img src=' . $foto_base . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Cabo</b><br><br>'; $foto_cabo = buscaCampo("foto_cabo", "SELECT", "vistoria", "foto_cabo", "os =" . $_POST['os']); $html .= '<a href="' . $foto_cabo . '"><img src=' . $foto_cabo . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Conector</b><br><br>'; $foto_conector = buscaCampo("foto_conector", "SELECT", "vistoria", "foto_conector", "os =" . $_POST['os']); $html .= '<a href="' . $foto_conector . '"><img src=' . $foto_conector . ' id="img"></a>'; $html .= '</td>'; $html .= '<td id="borded-1px" style="vertical-align:text-top;">'; $html .= '<b>Foto Checkup SKY</b><br><br>'; $foto_checkup_sky = buscaCampo("foto_checkup_sky", "SELECT", "vistoria", "foto_checkup_sky", "os =" . $_POST['os']); $html .= '<a href="' . $foto_checkup_sky . '"><img src=' . $foto_checkup_sky . ' id="img"></a>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</td>'; $html .= '</tr>'; //Comentários $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px-head">'; $html .= '<b>COMENTÁRIOS</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan=5 id="borded-1px">'; $html .= '<b>' . buscaCampo("comentarios_texto", "SELECT", "vistoria", "comentarios_texto", "os =" . $_POST['os']) . '</b>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '<b>Relatório gerado pelo Sistema Engenharia de Campo em ' . date("d/m/Y") . '</b></td>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</center>'; $html .= '</body>'; $html .= '</html>'; //Cria o relatório em HTML $html_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $os . '\\' . $os . '.html'; $fo_html = fopen($html_path, 'w'); fwrite($fo_html, $html); fclose($fo_html); //Converte o relatório em PDF define('MPDF_PATH', realpath($_SERVER['DOCUMENT_ROOT']) . '\\modulos\\'); $pdf_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $os . '\\' . $os . '.pdf'; include MPDF_PATH . 'mpdf56/mpdf.php'; $mpdf = new mPDF(); $mpdf->WriteHTML($html); $mpdf->Output($pdf_path, 'F'); }
//pdv_empresa: (self) $campos_vistoria .= buscaCampo("cod_modelo_ird", "SELECT", "modelo_ird", "cod_modelo_ird", "desc_modelo_ird ='" . $_POST['modelo_ird'] . "'") . ","; //cod_modelo_ird: (buscar em `modelo_ird`.`desc_modelo_ird`) $campos_vistoria .= buscaCampo("cod_consultor", "SELECT", "consultor", "cod_consultor", "udid8 ='" . $udid8 . "';") . ","; //, $mysql_host, $mysql_user_name, $mysql_password, $mysql_db_name) . ","; //cod_consultor (buscar em `consultor`.`udid8`) $campos_vistoria .= $_POST['customer'] . ","; //customer $campos_vistoria .= $_POST['os'] . ","; //os $campos_vistoria .= "'" . retornaData($_POST['data_do_teste']) . "',"; //"'2013-06-07',"; //data_do_teste: (converter data_vistoria - '3 de junho de 2013' -> yyyy-mm-aa) $campos_vistoria .= $_POST['id_tecnico'] . ","; //id_tecnico: (self) $campos_vistoria .= buscaCampo("cod_defeito", "SELECT", "qb_defeito", "cod_defeito", "desc_defeito ='" . $_POST['defeito_relatado'] . "'") . ","; // Defeito relatado pelo técnico $campos_vistoria .= buscaCampo("cod_defeito", "SELECT", "qb_defeito", "cod_defeito", "desc_defeito ='" . $_POST['defeito_constatado'] . "'") . ","; // Defeito constatado pelo consultor $campos_vistoria .= "'" . $_POST['troca_devida'] . "'"; $campos_vistoria .= ")"; //Insere dados na tabela teste_qb $insere_teste_qb = acessaBD($comando, $tabela, $campos_vistoria, $criterios); // // Grava dados no BD - FIM // if (!$insere_teste_qb) { $retorno = 0; //Erro $titulo = 'Erro de banco de dados'; $valida = 'false'; $msg = 'Erro ao tentar gravar os dados no banco de dados!'; } else {
echo "\turl = \"km/index.php?height=\" + screenHeight + \"&width=\" + screenWidth;"; echo "\tif('" . $_GET['msg'] . "'!='') {"; echo "\t\talert('" . $_GET['msg'] . "');"; echo "\t\tsetTimeout(function(){window.location.go(-1)},1000);"; echo "\t}"; echo "\tfunction validaCampos(valor){"; echo "\t\tif(isNaN(valor)) {alert('Digite somente números na OS'); return null;} else {return value;}"; echo "\t}"; echo "\tfunction toggleZoomScreen(zoom) {"; echo "\t\tdocument.body.style.zoom=zoom"; echo "\t}"; echo "\tfunction pageRefresh() {"; echo "\t}"; echo "</script>"; echo "<script type=\"text/javascript\" src=\"../modulos/funcoes.js\" charset=\"utf-8\"></script>"; echo "</head>"; echo "<body>"; echo "<div id=\"frame\">"; echo "<div style=\"width: 100%; margin-top: 0px; text-align: left\">"; echo "<div style=\"padding-top: 0px; text-align: left; position: relative; float: left;\">"; echo "\t<img src=\"../img/logo_siga_v.jpg\" style=\"width:180px\" id=\"logo_siga\" alt=\"SKY Engenharia de Campo\">"; echo "</div>"; echo "<div style=\"padding-top: 0px; text-align: right;padding: 10px;\">"; echo "\t<img src=\"../img/logo_sky_engcampo.png\" style=\"width:150px\" id=\"logo_sky\" alt=\"SKY Engenharia de Campo\">"; echo "</div>"; //echo "<div style=\"width: 100%; margin-top: 0px; padding-top: 10px; text-align: left\">"; //echo " <img src=\"../img/logo_siga_v.jpg\" alt=\"SKY Engenharia de Campo\" id=\"logo_sky\" style=\"width: 200px\">"; //echo " <h2 style=\"width: 70%; text-align:center; float: right\">". $title ."</h2>"; //echo "</div>"; echo "<div style=\"width:100%; text-align: right; font-size:13px\">Olá, <b>" . buscaCampo("nome", "SELECT", "consultor", "nome", "cod_consultor = " . $_SESSION['login']) . "</b></div>"; echo "<div id=\"barra_horizontal_title\">" . strtoupper($title) . "</div><br>";