public function municipioAction() { $this->_helper->layout->disableLayout(); // desabilita o Zend_Layout $iduf = $_POST['iduf']; try { $municipio = new Municipios(); $buscarmunicipio = $municipio->buscar(array('idUFIBGE = ?' => $iduf)); $municipio = array(); $cont = 0; foreach ($buscarmunicipio as $dadosmunicipio) { $municipio[$cont]['idmun'] = $dadosmunicipio->idMunicipioIBGE; $municipio[$cont]['descmun'] = utf8_encode($dadosmunicipio->Descricao); $cont++; } echo json_encode($municipio); die; } catch (Zend_Exception $e) { echo json_encode(array('error' => 'true')); die; } }
public function carregadadosAction() { $this->_helper->layout->disableLayout(); $this->_helper->ViewRenderer->setNoRender(true); $post = Zend_Registry::get('post'); $retorno = array(); switch ($post->option) { case 'uf': $ufDao = new Uf(); $resp = $ufDao->buscar(array('Regiao = ?' => $post->regiao), array('Sigla')); foreach ($resp as $key => $resulte) { $retorno[$key]['id'] = $resulte->idUF; $retorno[$key]['nome'] = $resulte->Sigla; } break; // xd($post->regiao); // xd($post->regiao); case 'cidade': $municipioDao = new Municipios(); $resp = $municipioDao->buscar(array('idUFIBGE = ?' => $post->idUF), array('Descricao')); foreach ($resp as $key => $resulte) { $retorno[$key]['id'] = $resulte->idMunicipioIBGE; $retorno[$key]['nome'] = utf8_encode($resulte->Descricao); } break; case 'regiao': $ufDao = new Uf(); $resp = $ufDao->buscaRegiaoPorPRONAC($post->PRONAC); $retorno = $resp[0]['Regiao']; break; case 'segmento': $ufDao = new Segmento(); $resp = $ufDao->buscar(array('Regiao = ?' => $post->regiao), array('Sigla')); foreach ($resp as $key => $resulte) { $retorno[$key]['id'] = $resulte->idUF; $retorno[$key]['nome'] = $resulte->Sigla; } break; } echo json_encode($retorno); }
public function cidadesAction() { $this->_helper->layout->disableLayout(); $post = Zend_Registry::get('post'); $idEstado = $post->idEstado; //RECUPERA AS CIDADES $Municipios = new Municipios(); $rsCidades = $Municipios->buscar(array('idUFIBGE = ?' => $idEstado)); if (count($rsCidades) > 0) { $html = ''; foreach ($rsCidades as $cidades) { $html .= '<option value="' . $cidades->idMunicipioIBGE . '">' . utf8_encode($cidades->Descricao) . '</option>'; } echo $html; } else { echo ''; } die; }
public function resultadoAgenciaBancariaAction() { header("Content-Type: text/html; charset=ISO-8859-1"); $this->_helper->layout->disableLayout(); $post = Zend_Registry::get('post'); $arrBusca = array(); if (!empty($post->banco)) { $arrBusca["c.Banco = ?"] = $post->banco; } if (!empty($post->uf)) { $tblUf = new Uf(); $rsUf = $tblUf->buscar(array("idUF = ?" => $post->uf))->current(); $arrBusca["a.Uf = ?"] = $rsUf->Sigla; } if (!empty($post->cidade)) { $tblMunicipio = new Municipios(); $rsMunicipio = $tblMunicipio->buscar(array("idMunicipioIBGE = ?" => $post->cidade))->current(); $arrBusca["a.Cidade = ?"] = $rsMunicipio->Descricao; } if (!empty($post->mecanismo)) { $arrBusca["c.Mecanismo = ?"] = $post->mecanismo; } if (!empty($post->area)) { $arrBusca["p.Area = ?"] = $post->area; } if (!empty($post->tipoPessoa)) { $arrBusca["i.tipoPessoa = ?"] = $post->tipoPessoa; } if (!empty($post->agencia)) { $arrBusca["c.Agencia = ?"] = retiraMascara($post->agencia); } if (!empty($post->dtLoteRemessaCB) || $post->tpDtLoteRemessaCB != '') { if ($post->tpDtLoteRemessaCB == "igual") { $arrBusca['DtLoteRemessaCB >= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; $arrBusca['DtLoteRemessaCB <= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "maior") { $arrBusca['DtLoteRemessaCB >= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCB == "menor") { $arrBusca['DtLoteRemessaCB <= ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCB == "OT") { $arrBusca['DtLoteRemessaCB = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCB == "U7") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "SP") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "MM") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-m-01") . " 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCB == "UM") { $arrBusca['DtLoteRemessaCB > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $arrBusca['DtLoteRemessaCB < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $arrBusca['DtLoteRemessaCB > ?'] = ConverteData($post->dtLoteRemessaCB, 13) . " 00:00:00"; if ($post->dtLoteRemessaCB_Final != "") { $arrBusca['DtLoteRemessaCB < ?'] = ConverteData($post->dtLoteRemessaCB_Final, 13) . " 23:59:59"; } } } if (!empty($post->dtLoteRemessaCL) || $post->tpDtLoteRemessaCL != '') { if ($post->tpDtLoteRemessaCL == "igual") { $arrBusca['DtLoteRemessaCL >= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; $arrBusca['DtLoteRemessaCL <= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "maior") { $arrBusca['DtLoteRemessaCL >= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCL == "menor") { $arrBusca['DtLoteRemessaCL <= ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCL == "OT") { $arrBusca['DtLoteRemessaCL = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($post->tpDtLoteRemessaCL == "U7") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "SP") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "MM") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-m-01") . " 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($post->tpDtLoteRemessaCL == "UM") { $arrBusca['DtLoteRemessaCL > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $arrBusca['DtLoteRemessaCL < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $arrBusca['DtLoteRemessaCL > ?'] = ConverteData($post->dtLoteRemessaCL, 13) . " 00:00:00"; if ($post->dtLoteRemessaCL_Final != "") { $arrBusca['DtLoteRemessaCL < ?'] = ConverteData($post->dtLoteRemessaCL_Final, 13) . " 23:59:59"; } } } //xd($arrBusca); $tbl = new ContaBancaria(); //xd($_POST); if ($post->tipo == 'xls' || $post->tipo == 'pdf') { //buscando os registros no banco de dados $tamanho = -1; $inicio = -1; $pag = 0; $totalPag = 0; $total = 0; $fim = 0; $rs = $tbl->buscar($arrBusca, array(), $tamanho, $inicio); $this->_forward('preparar-xls-pdf', null, null, array('dados' => $rs, 'view' => 'operacional/preparar-xls-pdf-agencia-bancaria.phtml', 'tipo' => $post->tipo)); } else { $pag = 1; //$get = Zend_Registry::get('get'); if (isset($post->pag)) { $pag = $post->pag; } if (isset($post->tamPag)) { $this->intTamPag = $post->tamPag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; $fim = $inicio + $this->intTamPag; $total = $tbl->pegaTotal($arrBusca); $total = $total["total"]; //xd($total); $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1); $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag; if ($fim > $total) { $fim = $total; } //Varifica se foi solicitado a ordenação if (!empty($post->ordenacao)) { $ordem[] = "{$post->ordenacao} {$post->tipoOrdenacao}"; } else { $ordem = array('Descricao ASC'); } $rs = $tbl->buscar($arrBusca, $ordem, $tamanho, $inicio); //xd($total); } $this->view->contasBancarias = $rs; $this->view->pag = $pag; $this->view->total = $total; $this->view->inicio = $inicio + 1; $this->view->fim = $fim; $this->view->totalPag = $totalPag; $this->view->parametrosBusca = $_POST; }
public function resultadoPcRegiaoUfCidadeAction() { header("Content-Type: text/html; charset=ISO-8859-1"); $this->_helper->layout->disableLayout(); $post = Zend_Registry::get('post'); //recuperando filtros do POST $arrBusca = array("modalidade = ?" => 76); if ($post->regiao != "") { $arrBusca["u.Regiao = ?"] = $post->regiao; } if ($post->uf != "") { $arrBusca["u.CodUfIbge = ?"] = $post->uf; } //if($post->cidade != ""){ $arrBusca["i.Cidade = ?"] = $post->cidade; } if (!empty($post->cidade)) { $tblMunicipio = new Municipios(); $rsMunicipio = $tblMunicipio->buscar(array("idMunicipioIBGE = ?" => $post->cidade))->current(); $arrBusca["i.Cidade = ?"] = $rsMunicipio->Descricao; } //Varifica se foi solicitado a ordenação if (!empty($post->ordenacao)) { $ordem[] = "{$post->ordenacao} {$post->tipoOrdenacao}"; } else { $ordem = array("5", "4", "3"); } $tbl = new Projetos(); $total = $tbl->pontoCulturaRegiaoUfCidade($arrBusca, $ordem, null, null); $total = count($total); if ($post->tipo == 'xls' || $post->tipo == 'pdf') { //buscando os registros no banco de dados $tamanho = -1; $inicio = -1; $pag = 0; $totalPag = 0; $fim = 0; $rs = $tbl->pontoCulturaRegiaoUfCidade($arrBusca, $ordem, $tamanho, $inicio); $this->_forward('preparar-xls-pdf', null, null, array('dados' => $rs, 'view' => 'relatorio/preparar-xls-pdf-pc-regiao-uf-cidade.phtml', 'tipo' => $post->tipo)); } else { //controlando a paginacao $this->intTamPag = 10; $pag = 1; if (isset($post->pag)) { $pag = $post->pag; } if (isset($post->tamPag)) { $this->intTamPag = $post->tamPag; } $inicio = $pag > 1 ? ($pag - 1) * $this->intTamPag : 0; $fim = $inicio + $this->intTamPag; $totalPag = (int) ($total % $this->intTamPag == 0 ? $total / $this->intTamPag : $total / $this->intTamPag + 1); $tamanho = $fim > $total ? $total - $inicio : $this->intTamPag; $rs = $tbl->pontoCulturaRegiaoUfCidade($arrBusca, $ordem, $tamanho, $inicio); } $this->view->registros = $rs; $this->view->pag = $pag; $this->view->total = $total; $this->view->inicio = $inicio + 1; $this->view->fim = $fim; $this->view->totalPag = $totalPag; $this->view->parametrosBusca = $_POST; }