public function pasajeros($form = '')
 {
     $this->_view->form = $form;
     Session::accForm('Usuario');
     if (strtolower($this->getServer('HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest') {
         if ($this->getInt('_PP_')) {
             $this->_view->cntP = $this->getInt('_PP_');
             Session::set('sess_SGL', $this->getInt('_SGL_'));
             Session::set('sess_DBL', $this->getInt('_DBL_'));
             Session::set('sess_TPL', $this->getInt('_TPL_'));
             Session::set('sess_moneda', $this->getTexto('_MON_'));
             Session::set('sess_claveOpc', $this->getTexto('_OPC_'));
             Session::set('sess_CHD1', $this->getInt('_CHD1_'));
             Session::set('sess_CHD2', $this->getInt('_CHD2_'));
             Session::set('sess_PF', $this->getInt('_PF_'));
             $programas = $this->loadModel('programa');
             $edad = $programas->getChild($this->getTexto('_OPC_'));
             if ($edad) {
                 Session::set('sessRP_edadChd1', $edad->getChedad1());
                 Session::set('sessRP_edadChd2', $edad->getChedad2());
             } else {
                 ession::set('sessRP_edadChd1', 0);
                 Session::set('sessRP_edadChd2', 0);
             }
             $this->_view->hab = $this->getJson('_HAB_');
             $this->_view->hot = $this->getJson('_HOT_');
             $this->_view->plan = $this->getJson('_PLAN_');
             $this->_view->cant = $this->getJson('_CANT_');
             $this->_view->chd1 = $this->getInt('_CHD1_');
             $this->_view->chd2 = $this->getInt('_CHD2_');
             $this->_view->idHot = $this->getJson('_CODH_');
             $this->_view->pf = $this->getInt('_PF_');
             $this->_view->codHavi = $this->getInt('_CODHAVI_');
             $this->_view->codIopc = $this->getInt('_CODIDOPC_');
             $estado = $this->getTexto('_EST_');
             if ($estado === 'AVAILABLE') {
                 $this->_view->renderingCenterBox('pasajeros');
             } else {
                 $this->_view->renderingCenterBox('cotizacion');
             }
         } else {
             throw new Exception('Error al cargar las opciones');
         }
     } else {
         throw new Exception('Error al cargar los pasajeros');
     }
 }
 public function reservaPrograma($form = '')
 {
     $this->_view->form = $form;
     if (!Session::get('sess_boton_pago')) {
         Session::accForm('Usuario');
     }
     if (strtolower($this->getServer('HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest') {
         $RP_rdbOpc = false;
         $RP_idProg = false;
         //$this->
         $tags = array_keys($this->getPOST());
         if (!empty($tags[1])) {
             $RP_rdbOpc = $this->getTexto('varCenterBox');
             $RP_idProg = $this->getTexto('varCenterBoxH');
         }
         if (!$RP_rdbOpc) {
             throw new Exception('Seleccione una opcion para poder reservar.');
         } else {
             if ($RP_idProg) {
                 Session::set('sessRP_rdbOpc', $RP_rdbOpc);
                 Session::set('sessRP_idPrograma', $RP_idProg);
                 $bloqueo = $this->loadModel('bloqueo');
                 $this->_view->objPrograma = $bloqueo->validaPrograma($RP_idProg, $RP_rdbOpc);
                 // se obtienen las edades de la opcion
                 $childEdad = $bloqueo->getChild($RP_rdbOpc);
                 if ($childEdad) {
                     Session::set('sessRP_edadChd1', $childEdad->getChd1());
                     Session::set('sessRP_edadChd2', $childEdad->getChd2());
                 } else {
                     ession::set('sessRP_edadChd1', 0);
                     Session::set('sessRP_edadChd2', 0);
                 }
                 if ($this->_view->objPrograma) {
                     $this->loadDTO('incluye');
                     if (WEB) {
                         //Web
                         $sql = "exec TS_GET_BLOQUEOS_PROG_ID " . $RP_idProg . ", " . $RP_rdbOpc . ", " . "'" . Functions::invertirFecha(Session::get('sess_BP_fechaIn'), '/', '-') . "', " . "'" . Functions::invertirFecha(Session::get('sess_BP_fechaOut'), '/', '-') . "', ";
                     } else {
                         //Local
                         $sql = "exec TS_GET_BLOQUEOS_PROG_ID " . $RP_idProg . ", " . $RP_rdbOpc . ", " . "'" . str_replace('/', '-', Session::get('sess_BP_fechaIn')) . "', " . "'" . str_replace('/', '-', Session::get('sess_BP_fechaOut')) . "', ";
                     }
                     $sql .= "'" . Session::get('sess_BP_hotel') . "'";
                     for ($i = 1; $i <= 3; $i++) {
                         $sql .= ", '" . Session::get('sess_BP_Adl_' . $i) . "', '" . Session::get('sess_BP_edadChd_1_' . $i) . "', \n                                '" . Session::get('sess_BP_edadChd_2_' . $i) . "', '" . Session::get('sess_BP_Inf_' . $i) . "'";
                         //habitaciones
                     }
                     //echo $sql; exit;
                     $this->_view->objOpcionPrograma = $bloqueo->TS_GET_BLOQUEOS_PROG_ID($sql, true);
                     $cnt = count($this->_view->objOpcionPrograma);
                     /* for($i=1; $i<$cnt; $i++)
                        {
                        echo $this->_view->objOpcionPrograma[$i]->getIdOpc();
                        if($this->_view->objOpcionPrograma[$i]->getIdOpc() == $RP_rdbOpc)
                        {
                        $this->_view->objOpcionProg[]= $this->_view->objOpcionPrograma[$i];
                        break;
                        }
                        } */
                     if ($cnt > 0) {
                         //Formateando valores
                         $this->_view->fechaSalida = Functions::invertirFecha($this->_view->objOpcionPrograma[0]->getDesde(), '/', '/');
                         $exp_fechaSalida = explode('/', $this->_view->objOpcionPrograma[0]->getDesde());
                         $this->_view->anoSalida = $exp_fechaSalida[0];
                         $this->_view->mesSalida = $exp_fechaSalida[1];
                         $this->_view->diaSalida = $exp_fechaSalida[2];
                         $valorHab = $this->_view->objOpcionPrograma[0]->getValorHab();
                         $precio = $valorHab[0] + $valorHab[1] + $valorHab[2];
                         Session::set('sess_BP_Precio', $precio);
                         $this->_view->precio = Functions::formatoValor($this->_view->objOpcionPrograma[0]->getMoneda(), $precio);
                         Session::set('sess_money_pay', $this->_view->objOpcionPrograma[0]->getMoneda());
                         if ($this->_view->objOpcionPrograma[0]->getMoneda() == 'D') {
                             if (!Session::get('sess_tcambio')) {
                                 $us = $this->loadModel('usuario');
                                 $tcambio = $us->getPaisTc(Session::get('sess_BP_ciudadDes'));
                                 $TcambioSess = $us->getTcambio($tcambio);
                                 Session::set('sess_tcambio', $TcambioSess->getTipoCambio());
                             }
                             if (Session::get('sess_tcambio') == 0) {
                                 $this->loadDTO('usuarioH2h');
                                 $us = $this->loadModel('reserva');
                                 $user = '******';
                                 $mail = $us->getCorreo($user);
                                 $mail->getCorreoEjecutivo();
                                 $this->mailTipoCambio('Actualizar tipo cambio', $mail->getCorreoEjecutivo(), '*****@*****.**');
                             }
                             $precio = $precio * Session::get('sess_tcambio');
                             if (Session::get('sess_codigo_cliente_url') == '3f7a2611ee08c6645796463e0bb1ae7f') {
                                 $this->_view->precio .= ' &nbsp;(T.Cambio $' . Session::get('sess_tcambio') . ',&nbsp; ' . Functions::formatoValor('P', $precio) . ')';
                             }
                         }
                         $this->_view->hoteles = $this->_view->objOpcionPrograma[0]->getHoteles();
                         $this->_view->hotelesCNT = count($this->_view->hoteles);
                         $this->_view->condicionesGenerales = Functions::getCondicionesGenerales();
                         if (Session::get('sess_boton_pago')) {
                             $this->_view->botonPago = Session::get('sess_boton_pago');
                             $this->_view->boton = "Pagar";
                         } else {
                             $this->_view->botonPago = false;
                             $this->_view->boton = "Reservar";
                         }
                         $this->_view->renderingCenterBox('reservarPrograma');
                     } else {
                         throw new Exception('Ya no se encuentran espacios disponibles para reservar.');
                     }
                 } else {
                     throw new Exception('Existe un error en el armado de programas, favor actualize la busqueda.');
                 }
             }
         }
     } else {
         throw new Exception('Error inesperado, intente nuevamente. Si el error persiste comuniquese con el administrador');
     }
 }