Ejemplo n.º 1
0
 $anexoItem->setNfRecibo(limpaTexto($_POST['notafiscal']));
 $anexoItem->setEstabelecimento(limpaTexto($_POST['estabelecimento']));
 $anexoItem->setGrupo(limpaTexto($_POST['grupo']));
 $anexoItem->setValor(limpaTexto(str_replace(",", ".", $_POST['valor'])));
 $query = "SELECT \r\n\t\t\t\t\tMAI.*,\r\n\t\t\t\t\tMA.titulo, \r\n\t\t\t\t\tMA.grupo,\r\n\t\t\t\t\tIF(MAI.nf_recibo != '',MAI.nf_recibo,'RECIBO') as nota_fiscal, \r\n\t\t\t\t\tM.numero as medicao \r\n\t\t\t\tFROM \r\n\t\t\t\t\t" . MYSQL_BASE_MEDICAO_ANEXO_ITENS . " MAI\r\n\t\t\t\t\tINNER JOIN " . MYSQL_BASE_MEDICAO_ANEXOS . " MA ON  MAI.id_medicao_anexo = MA.id\r\n\t\t\t\t\tINNER JOIN " . MYSQL_BASE_MEDICAO . " M ON M.id = MA.id_medicao\r\n\t\t\t\tWHERE \r\n\t\t\t\t\tMAI.status = 'S'";
 $confirm = "return confirm('Deseja remover esse registro?');";
 //Verifica se foi digitado a Medicao
 if ($anexoItem->getIdMedicao() != null) {
     $query .= " AND  MA.id_medicao = " . $anexoItem->getIdMedicao() . " ";
 }
 // 	//Verifica se foi digitado Pessoa
 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