public function dadosAction()
 {
     $this->_helper->layout->disableLayout();
     $page = $this->_request->getParam("page", 1);
     $limit = $this->_request->getParam("rows");
     $sidx = $this->_request->getParam("sidx", 1);
     $sord = $this->_request->getParam("sord");
     $array = $this->_request->getParams();
     $clientModel = new ClientModel();
     $covenantModel = new CovenantModel();
     $opernatureModel = new OpernatureModel();
     $supplierModel = new SupplierModel();
     $total_pages = 0;
     if (isset($array['secondperiod']) && $array['secondperiod'] != '') {
         $array['secondperiod'] = new Zend_Date($array['secondperiod'], 'dd-MM-YYYY HH:mm:ss');
         $array['secondperiod'] = $array['secondperiod']->toString('YYYY-MM-dd HH:mm:ss');
     }
     if (isset($array['firstperiod']) && $array['firstperiod'] != '') {
         $array['firstperiod'] = new Zend_Date($array['firstperiod'], 'dd-MM-YYYY HH:mm:ss');
         $array['firstperiod'] = $array['firstperiod']->toString('YYYY-MM-dd HH:mm:ss');
     }
     $accountentryData = $this->_model->fetchAll($this->_model->getAccountGridParams($array, $sidx, $sord, $limit, $page));
     $count = count($accountentryData);
     if ($page > $total_pages) {
         $page = $total_pages;
     } else {
         $total_pages = 0;
     }
     $responce = new stdClass();
     $responce->page = $page;
     $responce->total = $total_pages;
     $responce->records = $count;
     $i = 0;
     foreach ($accountentryData as $rows) {
         $favored = '';
         $nmopernature = '';
         $fgaccountcheck = '';
         $fgaccountentrytype = '';
         switch ($rows->fgaccountentrytype) {
             case '1':
                 $fgaccountentrytype = 'À Pagar';
                 break;
             case '2':
                 $fgaccountentrytype = 'À Receber';
                 break;
         }
         switch ($rows->fgactive) {
             case '2':
                 $fgactive = 'Inativo';
                 break;
             case '1':
                 $fgactive = 'Ativo';
                 break;
         }
         switch ($rows->fgaccountcheck) {
             case '0':
                 $fgaccountcheck = 'Pendente';
                 break;
             case '1':
                 $fgaccountcheck = 'Baixa Realizada';
                 break;
         }
         if ($rows->fgclienttype == 'a') {
             if ($rows->cdclient != null && $rows->cdclient != '') {
                 $clientData = $clientModel->fetchRow('cdclient = ' . $rows->cdclient);
                 $favored = $clientData['nmclient'];
             }
         } elseif ($rows->fgclienttype == 'b') {
             if ($rows->cdclient != null && $rows->cdclient != '') {
                 $clientData = $covenantModel->fetchRow('cdcovenant = ' . $rows->cdclient);
                 $favored = $clientData['nmcovenant'];
             }
         }
         if ($rows->fgaccountcheck != null && $rows->fgaccountcheck != '0') {
             if ($rows->cdopernature != '') {
                 $opernatureData = $opernatureModel->fetchRow('cdopernature = ' . $rows->cdopernature);
                 $nmopernature = $opernatureData['nmopernature'];
             }
         }
         if ($rows->cdsupplier != '' && $rows->cdsupplier != null) {
             $supplierData = $supplierModel->fetchRow('cdsupplier = ' . $rows->cdsupplier);
             $favored = $supplierData['nmsupplier'];
         }
         $responce->rows[$i]['cdaccountentry'] = $rows->cdaccountentry;
         $responce->rows[$i]['cell'] = array($rows->nraccountentry, $fgaccountentrytype, $favored, $fgaccountcheck, $fgactive, $nmopernature, $rows->cdaccountentry);
         $i++;
     }
     $this->view->dados = $responce;
 }