Ejemplo n.º 1
0
 $anexoItem->setProduto($_POST['produto']);
 $anexoItem->setQuantidade($_POST['quantidade']);
 $anexoItem->setValor($_POST['valor']);
 $anexoItem->setMedicaoItem($_POST['medicao_item']);
 $anexoItem->setDataNF($_POST['data_nf']);
 $anexoItem->setIdAnexo($_POST['anexo']);
 //$query = mysql_query("CALL sp_alterar_item_medicao(".$anexoItem->getMedicaoItem().", ".$anexoItem->getValor().", ".$anexoItem->getQuantidade().", TRUE, ".$anexoItem->getId().")");
 if ($_FILES['files']['error'] != UPLOAD_ERR_NO_FILE) {
     $uploadDir = '../../arquivos/medicao/';
     $name = sha1(date("d-m-Y H:i:s"));
     $uploadFile = $uploadDir . $name;
     $extension = pathinfo($_FILES['files']['name'], PATHINFO_EXTENSION);
     $uploadFile = $uploadFile . '.' . $extension;
     $name = $name . '.' . $extension;
     $anexoItem->setFile($name);
     $request = mysql_query("SELECT * FROM " . MYSQL_BASE_MEDICAO_ANEXO_ITENS . " WHERE status = 'S' AND nf_recibo = " . $anexoItem->getNfRecibo() . " AND id != " . $anexoItem->getId());
     //$num = mysql_num_rows($request);
     $num = 0;
     if ($num == 0) {
         //Fazer o Upload do arquivo
         if (move_uploaded_file($_FILES['files']['tmp_name'], $uploadFile)) {
             $arquivo_res = $DAO->Listar("SELECT * FROM " . MYSQL_BASE_MEDICAO_ANEXO_ITENS . " WHERE id = " . $anexoItem->getId());
             $nome_arquivo = "";
             foreach ($arquivo_res as $row_arquivo) {
                 $nome_arquivo = $row_arquivo['file'];
             }
             $Arquivo_res = $DAO->AtualizarArquivoItem($anexoItem);
             if ($Arquivo_res == false) {
                 unlink("../../arquivos/medicao/" . $anexoItem->getFile());
                 $msg = utf8_encode("Não foi possivel salvar essa edição, pois o sistema não conseguiu subir o arquivo, favor entrar em contato com a TI.");
                 echo '<script language= "JavaScript">alert("' . $msg . '");</script>';
Ejemplo n.º 2
0
    if ($anexoItem->getPessoa() != null) {
        $query .= " AND MAI.id_pessoa = " . $anexoItem->getPessoa() . " ";
    }
    // 	//Verifica se foi escolhido Empresa
    if ($anexoItem->getEmpresa() != 0) {
        $query .= " AND MAI.id_empresa = " . $anexoItem->getEmpresa();
    }
    // 	//Verifica se foi digitado Estabelecimento
    if ($anexoItem->getEstabelecimento() != null) {
        $query .= " AND MAI.empresa LIKE '%" . $anexoItem->getEstabelecimento() . "%'";
    }
    if ($anexoItem->getValor() != null || $anexoItem->getValor() != 0) {
        $query .= " AND MAI.valor = " . $anexoItem->getValor();
    }
    // 	//Verifica se foi digitado nf_recibo
    if ($anexoItem->getNfRecibo() != null) {
        $recibo = str_replace("recibo", "", $anexoItem->getNfRecibo());
        $query .= " AND MAI.nf_recibo = '" . $recibo . "'";
    }
    // 	//Verifica se foi digitado a data de processamento
    if ($anexoItem->getGrupo() != null) {
        if ($anexoItem->getGrupo() == 0) {
            $query .= " AND MA.grupo IN(1,3)  ";
        } else {
            $query .= " AND MA.grupo =" . $anexoItem->getGrupo() . " ";
        }
    }
    $query .= " ORDER BY MA.titulo DESC";
    $resultado = $DAO->Listar($query);
}
?>