public function resumenfinAction() { //Conectamos con BBDD $sid = new Container('base'); $db_name = $sid->offsetGet('dbNombre'); $this->dbAdapter = $this->getServiceLocator()->get($db_name); //Abrimos Instancias $fon = new FondosTable($this->dbAdapter); $mor = new MorososTable($this->dbAdapter); $ing = new IngresoTable($this->dbAdapter); $egr = new EgresoTable($this->dbAdapter); $cic = new CicloAdminTable($this->dbAdapter); $pmt = new PartidaMantTable($this->dbAdapter); //Obtenemos dia de cierre y calculamos restantes $cierre = $cic->getCiclo(); if (date('j') > $cierre[0]['dia']) { $dias_mes = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); $dif = $dias_mes - date('j') + $cierre[0]['dia']; $mes_cierre = date('F', strtotime('+1 month')); } else { $dif = $cierre[0]['dia'] - date('j'); $mes_cierre = date('F'); } //Obtenemos datos $fondo = $fon->getFondoOper(); $fondores = $fon->getFondoRes(); $cchica = $fon->getCajaChica(); $morosos = $mor->getTotal($this->dbAdapter); $egresos = $egr->getEgresosPeriodo($this->dbAdapter); $egrpend = $egr->getEgresosPendiente($this->dbAdapter); $ingresos = $ing->getIngresosPeriodo($this->dbAdapter); $mant = $pmt->getPartidasMes(date('M')); //Armamos Array para la vista $datos = array('fondo' => $fondo[0]['saldo'], 'fondores' => $fondores[0]['saldo'], 'cajachica' => $cchica[0]['saldo'], 'morosos' => $morosos[0]['total'], 'egresos' => $egresos, 'ingresos' => $ingresos, 'dias_restantes' => $dif, 'pagos_pendientes' => $egrpend[0]['pagos'], 'mant_periodo' => count($mant)); $result = new ViewModel($datos); $result->setTerminal(true); return $result; }