コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: FinanzasController.php プロジェクト: sonny-one/zero
 public function parametrosfinAction()
 {
     //Conectamos a la BBDD del condominio
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $fon = new FondosTable($this->dbAdapter);
     $ban = new ListaBancoTable($this->dbAdapter);
     $cic = new CicloAdminTable($this->dbAdapter);
     $form = new FondoOperForm("form");
     $form2 = new FondoResForm("form");
     $form3 = new CajachicaForm("form");
     $form4 = new MultasForm("form");
     $form5 = new CicloForm("form");
     //Obtenemos Datos
     $lista = $fon->getDatos();
     $oper = $fon->getFondoOper();
     $rese = $fon->getFondoRes();
     $listab = $ban->getDatos();
     $cierre = $cic->getCiclo();
     //Calculamos dia de cierre
     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');
     }
     //Fecha mes administrativo
     $descr_cierre = $cierre[0]['dia'] . " de " . $mes_cierre . " a las " . substr($cierre[0]['hora'], 0, -3) . " Hrs";
     //cargamos id banco
     $form->get('idbanco')->setValue($oper[0]['id_banco']);
     // Validamos si existen fondos y desabilitamos inputs
     if (count($oper) > 0) {
         $form->get('saldo')->setAttribute('disabled', 'disabled');
         $form->get('cheque')->setAttribute('disabled', 'disabled');
     }
     if (count($rese) > 0) {
         $form2->get('saldo')->setAttribute('disabled', 'disabled');
     }
     $form->get('id_pk')->setAttribute('value', $oper[0]['id']);
     $form->get('numero')->setAttribute('value', $oper[0]['numero']);
     $form->get('rut')->setAttribute('value', $oper[0]['rut'] . "-" . $oper[0]['dv']);
     $form->get('titular')->setAttribute('value', $oper[0]['titular']);
     $form->get('banco')->setAttribute('options', $listab);
     $form->get('correo')->setAttribute('value', $oper[0]['correo']);
     $form->get('detalle')->setAttribute('value', $oper[0]['detalle']);
     $form->get('saldo')->setAttribute('value', number_format($oper[0]['saldo'], "0", ".", "."));
     $form->get('cheque')->setAttribute('value', $oper[0]['ultimo_cheque']);
     $form2->get('banco')->setAttribute('options', $listab);
     //Cargamos datos de Ciclo Administrativo
     $form5->get('dia')->setAttribute('value', $cierre[0]['dia']);
     $form5->get('hora')->setAttribute('value', $cierre[0]['hora']);
     //Return a la vista
     $result = new ViewModel(array('form' => $form, 'form2' => $form2, 'form3' => $form3, 'form4' => $form4, 'form5' => $form5, 'descr_cierre' => $descr_cierre, 'url' => $this->getRequest()->getBaseurl()));
     $result->setTerminal(true);
     return $result;
 }