public function relojesAction() { //Conectamos con BBDD $sid = new Container('base'); $db_name = $sid->offsetGet('dbNombre'); $this->dbAdapter = $this->getServiceLocator()->get($db_name); //Instancias $part = new PartidaMantTable($this->dbAdapter); $cicl = new CicloAdminTable($this->dbAdapter); //Obtenemos Dia y Hora de cierre Administrativo $cierre = $cicl->getCiclo(); $hora_cierre = substr($cierre[0]['hora'], 0, -3); //Obtenemos dias de meses a usar $dias_mes = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); $dias_mes2 = cal_days_in_month(CAL_GREGORIAN, date('n') + 1, date('Y')); $dias_mes3 = cal_days_in_month(CAL_GREGORIAN, date('n') + 2, date('Y')); //Horas restantes del dia $dif_diaria = (24 - date('G')) * 3600; //Validamos dia y calculamos segundos restantes if (date('j') > $cierre[0]['dia']) { $dif = ($dias_mes - date('j') + $cierre[0]['dia']) * 86400 - (24 - $hora_cierre) * 3600 - 1 - $dif_diaria; } else { $dif = ($cierre[0]['dia'] - date('j')) * 86400 + $dif_diaria - (24 - $hora_cierre) * 3600 - 1; } //Consultamos Partidas de cada Mes $partidas = $part->getPartidasMes($this->dbAdapter, date('M')); $partidas2 = $part->getPartidasMes($this->dbAdapter, date('M')); $partidas3 = $part->getPartidasMes($this->dbAdapter, date('M', strtotime('+2 month', strtotime(date('M'))))); //Calculamos segundos de meses proximos $dif2 = $dif + $dias_mes2 * 86400 - (24 - $hora_cierre) * 3600 - $dif_diaria - 1; $dif3 = $dif + $dif2 + $dias_mes3 * 86400 - (24 - $hora_cierre) * 3600 - $dif_diaria - 1; $this->layout('layout/comite'); $result = new ViewModel(array('partidas' => $partidas, 'partidas2' => $partidas2, 'partidas3' => $partidas3, 'segundos' => $dif, 'segundos2' => $dif2, 'segundos3' => $dif3)); // $result->setTerminal(true); return $result; }
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; }