$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'); } geraPDF('48394208', '', '', '');
$cod_local = 3; $cod_tipo_atividade = buscaCampo("cod_tipo_atividade", "SELECT", "tipo_atividade", "cod_tipo_atividade", "desc_atividade ='" . $_POST['tipo_vistoria'] . "'"); $dt_inicial = retornaData($_POST['data_vistoria']) . " " . $_POST['hora_inicio_vistoria']; $dt_final = retornaData($_POST['data_vistoria']) . " " . $_POST['hora_termino_vistoria']; $credenciado = buscaCampo("desc_empresa", "SELECT", "credenciados", "desc_empresa", "pdv_empresa = '" . $pdv_empresa . "'"); $descricao = "OS " . $_POST['os'] . " - " . $credenciado; $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 // // Grava dados no BD - FIM // // // Cria vistoria em PDF - INICIO geraPDF($_POST['os']); // Cria vistoria em PDF - FIM // if (!$insere_vistoria) { $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!'; //
<body onLoad=""> <center> <div id="layer1"> <p align="center"> <img alt="SKY - HDTV É ISSO!" src="images/logosky.png" width="100"> </p> <fieldset id="fieldset_os"> <legend id="legend"><b>Correção de Relatório de Vistoria</b></legend> <table style="width:350px; padding: 5px"> <?php if ($_POST['btnEnviar'] == 'Enviar') { $btnText = "Enviar"; if (buscaCampo("os", "SELECT", "vistoria", "os", "os =" . $_POST['os'])) { echo '<tr><td colspan="2" style="text-align:center">' . geraPDF($_POST['os']) . '</td></tr>'; } else { echo '<tr><td colspan="2" style="text-align:center">A OS ' . $_POST['os'] . ' não consta no banco de dados!</td></tr>'; } } else { $btnText = "Consultar"; $data_original = $_POST['os'] > 0 ? $_POST['os'] : ''; ?> <form name="frmGeraPDF" method="post" action="../modulos/gera_pdf2.php" style="height: 107px; width: 261px"> <tr> <td colspan="2" align="center">OS: <input name="os" id="os" type="text" size="20" maxlength="8" onBlur="if(this.value.length>7){btnEnviar.disabled=false}else{btnEnviar.disabled=true}"></td> </tr> <tr> <td align="left">Data Original:<br><input name="data_original" type="text" size="20" maxlength="10" disabled></td> <td align="left">Data Corrigida:<br><input name="data_corrigida" type="text" size="20" maxlength="10"></td> </tr>