<?php $erro == ''; $linha_cont = 1; $linha_excel = 0; $CONT_NOT = 0; $linha_arq = 1; if ($handle) { pt_register('POST', 'arquivo'); pt_register('POST', 'data'); pt_register('POST', 'id_servico'); $arquivoitemDAO = new ArquivoItemDAO(); $id_arquivo = $arquivoitemDAO->inserirArquivo($controle_id_empresa, $controle_id_usuario, $id_cliente, $file_import_name, $id_servico); while (!feof($handle)) { #trata a linha do buffer $erro = ''; $buffer = fgets($handle, 4096); $buffer = limpa_string($buffer); $buffer = strtoupper($buffer); $buffer = str_replace("'", '', $buffer); $buffer = str_replace('"', '', $buffer); $qtdd_registros = strlen($buffer); if ($linha_cont > 1000) { $erro .= "O limite máximo para importação do arquivo é de 1000 linhas<br>"; break; } #gera o primeiro array $ext_verifica = explode(';', $buffer); $tamanho = count($ext_verifica); #substitui as abreviações $ext_verifica['9'] = str_replace('S PAULO', 'SAO PAULO', $ext_verifica['9']);
<div id="meio"> <table border="0" height="100%" width="100%"> <tr> <td valign="top"> <center> <table width="650" class="result_tabela" cellpadding="4" cellspacing="1"> <tr> <td class="tabela_tit"><strong>ID </strong></td> <td class="tabela_tit"><strong>Cliente </strong></td> <td class="tabela_tit"><strong>Data </strong></td> <td class="tabela_tit"><strong>Erros </strong></td> <td class="tabela_tit"><strong>Excel </strong></td> </tr> <?php $arquivoitemDAO = new ArquivoItemDAO(); $lista = $arquivoitemDAO->listaRemessaC($controle_id_empresa); $p_valor = ''; foreach ($lista as $l) { $p_valor .= ' <tr> <td class="result_celula"> ' . $l->id_arquivo . '</td> <td class="result_celula"> ' . $l->nome . '</td> <td class="result_celula"> ' . invert($l->data, '/', 'PHP') . '</td> <td class="result_celula"> <a href="pedido_remessa_cc.php?id_arquivo=' . $l->id_arquivo . '">' . $l->erros . '</a></td> <td class="result_celula"> <a href="gera_remessa_c.php?id_arquivo=' . $l->id_arquivo . '" target="_blank">Download</a></td> </tr>'; } echo $p_valor; ?> </table>
<tr> <td valign="top"> <form enctype="multipart/form-data" action="gera_retorno.php" method="post" name="pedido_print" target="_blank"> <center> <table width="850" class="result_tabela" cellpadding="4" cellspacing="1"> <tr> <td class="tabela_tit"><strong>Nome</strong></td> <td class="tabela_tit"><strong>CPF/CNPJ</strong></td> <td class="tabela_tit"><strong>Cidade </strong></td> <td class="tabela_tit"><strong>Estado </strong></td> <td class="tabela_tit"><strong>Erro </strong></td> <td class="tabela_tit"><strong>Registrar </strong></td> </tr> <?php $arquivoitemDAO = new ArquivoItemDAO(); $lista = $arquivoitemDAO->listaRemessaCPorID($id_arquivo, $controle_id_empresa); $p_valor = ''; foreach ($lista as $l) { $p_valor .= ' <tr id="result_' . $l->id_arquivo_item . '"> <td class="result_celula"> <input type="text" name="nome_' . $l->id_arquivo_item . '" value = "' . $l->certidao_nome . '"></td> <td class="result_celula"> <input type="text" name="cpf_' . $l->id_arquivo_item . '" value = "' . $l->certidao_cpf . '"></td> <td class="result_celula"> <input type="text" name="cidade_' . $l->id_arquivo_item . '" value = "' . $l->certidao_cidade . '"></td> <td class="result_celula"> <input type="text" name="estado_' . $l->id_arquivo_item . '" value = "' . $l->certidao_estado . '"></td> <td class="result_celula" width="150"> ' . $l->erro . '</td> <td class="result_celula"> <input type="button" name="registro_' . $l->id_arquivo_item . '" onclick="remessa_registra(nome_' . $l->id_arquivo_item . '.value,cpf_' . $l->id_arquivo_item . '.value,cidade_' . $l->id_arquivo_item . '.value,estado_' . $l->id_arquivo_item . '.value,\'' . $l->id_arquivo_item . '\')" value = "Processar"> </td> </tr>'; }
if ($cpf == '') { $erro .= "CPF/CNPJ em branco <br>"; } if ($cidade == '') { $erro .= "Cidade em branco <br>"; } if ($estado == '') { $erro .= "Estado em branco <br>"; } #verifica cidade e estado $sql = $objQuery->SQLQuery("SELECT cidade from vsites_cidades as e where cidade = '" . $cidade . "' and estado = '" . $estado . "'"); $num_cidade = mysql_num_rows($sql); if ($num_cidade == '0') { $erro .= "Cidade ou Estado Inválidos<br>"; } $arquivoitemDAO = new ArquivoItemDAO(); $ret = $arquivoitemDAO->listaRemessaCPorIDItem($id_arquivo_item, $controle_id_empresa); $p_valor = ''; if ($ret->id_arquivo != '') { $aItem->nome = $nome; $aItem->cpf = $cpf; $aItem->cidade = $cidade; $aItem->estado = $estado; $aItem->erro = $erro; $ret2 = $arquivoitemDAO->atualizaArquivoItem($aItem, $ret, $ret->id_arquivo, $id_arquivo_item, $controle_id_usuario, $controle_id_empresa); if ($ret2 != '') { echo '<td class="result_celula" colspan="6">Serviço Registrado com sucesso. Protocolo: #' . $ret2 . '</td>'; } else { if ($erro == '') { echo '<td class="result_celula" colspan="6">Serviço em duplicidade</td>'; } else {