public function imprimirRelatorioReciboCaptacaoAction() { $this->_helper->layout->disableLayout(); //DEFINE PARAMETROS DE ORDENACAO / QTDE. REG POR PAG. / PAGINACAO if ($this->_request->getParam("qtde")) { $this->intTamPag = $this->_request->getParam("qtde"); } $order = array(); //==== parametro de ordenacao ======// if ($this->_request->getParam("ordem")) { $ordem = $this->_request->getParam("ordem"); if ($ordem == "ASC") { $novaOrdem = "DESC"; } else { $novaOrdem = "ASC"; } } else { $ordem = "ASC"; $novaOrdem = "ASC"; } //==== campo de ordenacao ======// if ($this->_request->getParam("campo")) { $campo = $this->_request->getParam("campo"); $order = array($campo . " " . $ordem); $ordenacao = "&campo=" . $campo . "&ordem=" . $ordem; } else { $campo = null; $order = array(9, 7, 3); $ordenacao = null; } $get = Zend_Registry::get('post'); /* ================== PAGINACAO ======================*/ $where = array(); if (!empty($get->pronac)) { $where["c.AnoProjeto+c.Sequencial = ?"] = $get->pronac; } if (!empty($get->numLote)) { $where["c.NumeroRecibo = ?"] = $get->numLote; } if (!empty($get->proponente)) { $where["p.CgcCpf = ?"] = retiraMascara($get->proponente); } if (!empty($get->incentivador)) { $where["c.cgcCpfMecena = ?"] = retiraMascara($get->incentivador); } if (!empty($get->dtLote) || $get->tpDtLote != '') { if ($get->tpDtLote == "igual") { $where['DtChegadaRecibo >= ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; $where['DtChegadaRecibo <= ?'] = ConverteData($get->dtLote, 13) . " 23:59:59"; } elseif ($get->tpDtLote == "maior") { $where['DtChegadaRecibo >= ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; } elseif ($get->tpDtLote == "menor") { $where['DtChegadaRecibo <= ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; } elseif ($get->tpDtLote == "OT") { $where['DtChegadaRecibo = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($get->tpDtLote == "U7") { $where['DtChegadaRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtLote == "SP") { $where['DtChegadaRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtLote == "MM") { $where['DtChegadaRecibo > ?'] = date("Y-m-01") . " 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtLote == "UM") { $where['DtChegadaRecibo > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $where['DtChegadaRecibo < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $where['DtChegadaRecibo > ?'] = ConverteData($get->dtLote, 13) . " 00:00:00"; if ($get->dtLote_Final != "") { $where['DtChegadaRecibo < ?'] = ConverteData($get->dtLote_Final, 13) . " 23:59:59"; } } } if (!empty($get->dtCaptacao) || $get->tpDtCaptacao != '') { if ($get->tpDtCaptacao == "igual") { $where['DtRecibo >= ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; $where['DtRecibo <= ?'] = ConverteData($get->dtCaptacao, 13) . " 23:59:59"; } elseif ($get->tpDtCaptacao == "maior") { $where['DtRecibo >= ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; } elseif ($get->tpDtCaptacao == "menor") { $where['DtRecibo <= ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; } elseif ($get->tpDtCaptacao == "OT") { $where['DtRecibo = ?'] = date("Y-m-") . (date("d") - 1) . " 00:00:00"; } elseif ($get->tpDtCaptacao == "U7") { $where['DtRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtCaptacao == "SP") { $where['DtRecibo > ?'] = date("Y-m-") . (date("d") - 7) . " 00:00:00"; $where['DtRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtCaptacao == "MM") { $where['DtRecibo > ?'] = date("Y-m-01") . " 00:00:00"; $where['DtRecibo < ?'] = date("Y-m-d") . " 23:59:59"; } elseif ($get->tpDtCaptacao == "UM") { $where['DtRecibo > ?'] = date("Y-") . (date("m") - 1) . "-01 00:00:00"; $where['DtRecibo < ?'] = date("Y-") . (date("m") - 1) . "-31 23:59:59"; } else { $where['DtRecibo > ?'] = ConverteData($get->dtCaptacao, 13) . " 00:00:00"; if ($get->dtCaptacao_Final != "") { $where['DtRecibo < ?'] = ConverteData($get->dtCaptacao_Final, 13) . " 23:59:59"; } } } $tbCaptacao = new Captacao(); $busca = $tbCaptacao->buscaReciboCaptacao($where, $order); $this->view->dados = $busca; $this->view->vlrTotalGrid = $tbCaptacao->buscaReciboCaptacaoTotalValorGrid($where); }