Advertisement
jerooski

reg_maReservaciones

Nov 7th, 2021 (edited)
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 25.32 KB | None | 0 0
  1. <?php
  2.                  
  3. require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/funciones.php');
  4. require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deTarifas.php');
  5. require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_aeropuertos.php');
  6. require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_status.php');
  7. require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_testimonial.php');
  8. require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deReservacionesSpecial.php');
  9.  
  10. class reg_MaResevaciones{
  11.     private $id = 0;
  12.     private $nombre = '';
  13.     private $paterno = '';
  14.     private $materno = '';
  15.     private $direccion = '';
  16.     private $ciudad ='';
  17.     private $estado = '';
  18.     private $cp = '';
  19.     private $pais = '';
  20.     private $telefono = '';
  21.     private $celular = '';
  22.     private $correo = '';
  23.     private $id_tarifa = 0;
  24.     private $aerolinea = '';
  25.     private $no_vuelo = '';
  26.     private $hora_vuelo = null;
  27.     private $no_noches = 0;
  28.     private $fecha_salida = ''; // string (yyyy-mm-dd)
  29.     private $fecha_salida_dt = 0; // datetime
  30.     private $aerolinea_salida = '';
  31.     private $no_vuelo_salida = '';
  32.     private $hora_vuelo_salida = null;
  33.     private $info_adicional = '';
  34.     private $pasajeros = 0;
  35.     private $peticiones_adicionales = '';
  36.     private $fecha_llegada = '';   // string (yyyy-mm-dd)
  37.     private $fecha_llegada_dt = 0; // datetime
  38.     private $id_status = 0;
  39.     private $OtherAirport = '';
  40.     private $id_paquete = 0;
  41.     private $id_traslado = 0;
  42.     private $id_hotel = 0;
  43.     private $tipo = '';
  44.     private $total = 0;
  45.     private $fecha_creacion = '';  
  46.     private $tipocobro = 0;
  47.    
  48.     private $vip = 0;
  49.     private $grocery = 0;
  50.    
  51.     private $folioSCT = '';
  52.     private $ipickup_time = null;
  53.     private $ipickup_date = '';
  54.     private $dpickup_time = null;
  55.     private $dpickup_date = '';
  56.     private $msg = '';
  57.     private $oTarifa = NULL;
  58.     private $pagado = 0;
  59.     private $oEsp = null; // instancia del objeto reg_deReservacionEspecial correspondiente
  60.  
  61.     public function __construct($id_reservacion=0){
  62.         if($id_reservacion>0){
  63.             $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  64.             $sql = "SELECT * FROM ma_reservaciones
  65.                  WHERE id_reservacion ='".$id_reservacion."'";
  66.             $mysqli->multi_query($sql);
  67.             if($result = $mysqli->store_result()){
  68.                 while ($dato = $result->fetch_row()){
  69.                     $this->setId($dato[0]);
  70.                     $this->setNombre($dato[1]);
  71.                     $this->setPaterno($dato[2]);
  72.                     $this->setMaterno($dato[3]);
  73.                     $this->setDireccion($dato[4]);
  74.                     $this->setCiudad($dato[5]);
  75.                     $this->setEstado($dato[6]);
  76.                     $this->setCP($dato[7]);
  77.                     $this->setPais($dato[8]);
  78.                     $this->setTelefono($dato[9]);
  79.                     $this->setCelular($dato[10]);
  80.                     $this->setCorreo($dato[11]);
  81.                     $this->setId_tarifa($dato[12]);
  82.                     $this->setAerolinea($dato[13]);
  83.                     $this->setNo_vuelo($dato[14]);
  84.                     $this->setHora_vuelo($dato[15]);
  85.                     $this->setNo_noches($dato[16]);
  86.                     $this->setFecha_salida($dato[17]);
  87.                     //$this->fecha_salida = substr($dato[17],8,2).'/'.substr($dato[17],5,2).'/'.substr($dato[17],0,4);
  88.                     $this->fecha_salida_dt = strtotime($dato[17]);
  89.                     $this->setAerolinea_salida($dato[18]);
  90.                     $this->setNo_vuelo_salida($dato[19]);
  91.                     $this->setHora_vuelo_salida($dato[20]);
  92.                     $this->setInfo_adicional($dato[21]);
  93.                     $this->setPasajeros($dato[22]);
  94.                     $this->setPeticiones_adicionales($dato[23]);
  95.                     $this->fecha_llegada = $dato[24];//substr($dato[24],8,2).'/'.substr($dato[24],5,2).'/'.substr($dato[24],0,4);                  
  96.                     $this->fecha_llegada_dt = strtotime($dato[24]);
  97.                     $this->setId_status($dato[25]);
  98.                     $this->setOtherAirport($dato[26]);
  99.                     $this->setIdPaquete($dato[27]);
  100.                     $this->setIdTraslado($dato[28]);
  101.                     $this->setIdHotel($dato[29]);
  102.                     $this->setTipo($dato[30]);
  103.                     $this->setTotal($dato[31]);
  104.                     $this->setFecha_creacion($dato[32]);
  105.                     $this->setTipoCobro($dato[33]);
  106.  
  107.                     $this->setVip($dato[39]);
  108.                     $this->setGrocery($dato[40]);
  109.  
  110.                     #informacion del voucher
  111.                     $this->folioSCT = $dato[34];
  112.                     $this->ipickup_time = $dato[35];
  113.                     $this->ipickup_date = $dato[36];
  114.                     $this->rpickup_time = $dato[37];
  115.                     $this->rpickup_date = $dato[38];
  116.                    
  117.                     $this->setPagado($dato[41]);
  118.                                        
  119.                 }
  120.             }
  121.         }  
  122.     }
  123.  
  124.         public function  __toString() {
  125.             return $this->id.' '.$this->paterno.' '.$this->nombre;
  126.         }
  127.    
  128.     /**
  129.      *
  130.      * @return bool success
  131.      */
  132.     public function guardarTotal()
  133.     {
  134.         $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  135.         $sql = "UPDATE ma_reservaciones set total = "
  136.             .$this->getTotal()
  137.             ." WHERE id_reservacion = "
  138.             .$this->getId().";";
  139.         if ($mysqli->query($sql)) {
  140.             $this->setMsg('Info saved correctly');
  141.             return true;
  142.         } else {
  143.             $this->setMsg('There was an error when trying to save information.');
  144.             return false;
  145.         }
  146.         return true;
  147.     }
  148.        
  149.    /**
  150.     *
  151.     * @return mixed
  152.     */
  153.     public function guardar(){
  154.        
  155.         if (null != $this->getFecha_salida() || '00/00/0000' != $this->getFecha_salida()) {
  156.             $salida = date('Y-m-d', strtotime($this->getFecha_salida()));
  157.         } else {
  158.             $salida = '0000-00-00';
  159.         }
  160.         if (null != $this->getFecha_llegada()) {
  161.             $llegada = date('Y-m-d', strtotime($this->getFecha_llegada()));
  162.         } else {
  163.             $salida = '0000-00-00';
  164.         }
  165.        
  166.         if ($this->getHora_vuelo('H:i:s') == null) {
  167.             $hora_vuelo = "'NULL'";
  168.         } else {
  169.             $hora_vuelo = "'".$this->getHora_vuelo()."'";
  170.         }
  171.        
  172.         if ($this->getHora_vuelo_salida('H:i:s') == null) {
  173.             $hora_vuelo_salida = "'NULL'";
  174.         } else {
  175.             $hora_vuelo_salida = "'".$this->getHora_vuelo_salida()."'";
  176.         }
  177.        
  178.         if($this->getId()>0){#si se cumple la condicion hace un update en la tabla cat_Lugares
  179.             $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  180.            
  181.             $sql = "UPDATE ma_reservaciones SET
  182.                 nombre='".$this->getNombre()."',
  183.                 paterno='".$this->getPaterno()."',
  184.                 materno='".$this->getMaterno()."',
  185.                 direccion='".$this->getDireccion()."',
  186.                 ciudad='".$this->getCiudad()."',
  187.                 estado='".$this->getEstado()."',
  188.                 cp='".$this->getCP()."',
  189.                 pais='".$this->getPais()."',
  190.                 telefono='".$this->getTelefono()."',
  191.                 celular='".$this->getCelular()."',
  192.                 correo='".$this->getCorreo()."',
  193.                 id_tarifa='".$this->getId_tarifa()."',
  194.                 aerolinea='".$this->getAerolinea()."',
  195.                 no_vuelo='".$this->getNo_vuelo()."',
  196.                 hora_vuelo='".$hora_vuelo."',
  197.                 no_noches='".$this->getNo_noches()."',
  198.                 fecha_salida='".$salida."',
  199.                 aerolinea_salida='".$this->getAerolinea_salida()."',
  200.                 no_vuelo_salida='".$this->getNo_vuelo_salida()."',
  201.                 hora_vuelo_salida='".$hora_vuelo_salida."',
  202.                 info_adicional='".$this->getInfo_adicional()."',
  203.                 pasajeros='".$this->getPasajeros()."',
  204.                 peticiones_adicionales='".$this->getPeticiones_adicionales()."',
  205.                 fecha_llegada='".$llegada."',
  206.                 OtherAirport='".$this->getOtherAirport()."',
  207.                 IdPaquete='".$this->getIdPaquete()."',
  208.                 IdTraslado='".$this->getIdTraslado()."',
  209.                 IdHotel='".$this->getIdHotel()."',
  210.                 vip='".$this->getVip()."',
  211.                 total='".$this->getTotal()."',
  212.                 id_tipocobro='".$this->getTipoCobro()."',
  213.                 pagado='".$this->getPagado()."',
  214.                 grocery='".$this->getGrocery()."'
  215.                 WHERE id_reservacion = '".$this->getId()."';";
  216.  
  217.             if($mysqli->multi_query($sql)){
  218.                 $this->setMsg('La reservacion se modificó correctamente.');
  219.                 return 1;
  220.             }else{
  221.                 $this->setMsg('Error al modificar la reservacion.');
  222.                 return 0;
  223.             }
  224.            
  225.         }else{#en caso de que entre en el else se hace un  insert sobre la tabla cat_Lugares
  226.            
  227.             $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  228.             $sql ="INSERT INTO ma_reservaciones
  229.     (nombre,paterno,materno,direccion,ciudad,estado,cp,pais,telefono,celular,correo,id_tarifa,aerolinea,no_vuelo,hora_vuelo,no_noches,
  230.     fecha_salida,aerolinea_salida,no_vuelo_salida,hora_vuelo_salida,info_adicional,pasajeros,peticiones_adicionales,fecha_llegada
  231.     ,OtherAirport,IdPaquete,IdTraslado,IdHotel,tipo,total,fec_creacion,id_tipocobro,grocery,vip
  232.     )
  233.     VALUES
  234.     ('".$this->getNombre()."','".$this->getPaterno()."','".$this->getMaterno()."','".$this->getDireccion()."','".$this->getCiudad()."','".$this->getEstado()."','".$this->getCP()."','".$this->getPais()."','".$this->getTelefono()."','".$this->getCelular()."','".$this->getCorreo()."',".$this->getId_tarifa().",'".$this->getAerolinea()."','".$this->getNo_vuelo()."',".$hora_vuelo.",".$this->getNo_noches().",'".$salida."','".$this->getAerolinea_salida()."','".$this->getNo_vuelo_salida()."',".$hora_vuelo_salida.",'".$this->getInfo_adicional()."',".$this->getPasajeros().",'".$this->getPeticiones_adicionales()."','".$llegada."','".$this->getOtherAirport()."',".$this->getIdPaquete().",".$this->getIdTraslado().",".$this->getIdHotel().",'".$this->getTipo()."',".$this->getTotal().",sysdate(),".$this->getTipoCobro().",".$this->getGrocery().",".$this->getVip().");";
  235.            
  236.             if($mysqli->multi_query($sql)){
  237.                 $this->setMsg('Reservation request received successfully.');
  238.                 return 1;
  239.             }else{
  240.                 $this->setMsg('Something wrong happened while making the reservation.');
  241.                 return 0;
  242.             }
  243.         }
  244.     }
  245.    
  246.     public function ActualizaStatus(){
  247.         $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  248.         $sql = "UPDATE ma_reservaciones SET
  249.                 id_status='".$this->getId_status()."'
  250.                 WHERE id_reservacion = '".$this->getId()."';";
  251.         if($mysqli->multi_query($sql)){
  252.             $this->setMsg('Operacion realizada con exito.');
  253.             return "1";
  254.         }else{
  255.             $this->setMsg('Error al realizar la operacion.');
  256.             return 0;
  257.         }
  258.     }
  259.  
  260.     public function ActualizaVoucher($folioSCT = '', $initialPickUpTime = '', $initialPickUpDate = '', $returnPickUpTime = '', $returnPickUpDate = ''){
  261.                            
  262.         /*
  263.                 #voucher dates
  264.                 list($vmSal,$vdSal,$vaSal) = explode("/",$returnPickUpDate);
  265.         list($vmLle,$vdLle,$vaLle) = explode("/",$initialPickUpDate);
  266.  
  267.                 $returnPickUpDate = $vaSal.'-'.$vmSal.'-'.$vdSal;
  268.                
  269.         $initialPickUpDate = $vaLle.'-'.$vmLle.'-'.$vdLle;*/
  270.        
  271.        
  272.        
  273.         if ($initialPickUpDate != '') {
  274.             $initialPickUpDate = date('Y-m-d', strtotime($initialPickUpDate));
  275.         }
  276.    
  277.         if ($initialPickUpTime) {
  278.             $initialPickUpTime = "'".date('H:i:s', strtotime($initialPickUpTime))."'";
  279.         } else {
  280.             $initialPickUpTime = 'NULL';
  281.         }
  282.         if ($returnPickUpTime) {
  283.             $returnPickUpTime = "'".date('H:i:s', strtotime($returnPickUpTime))."'";
  284.         } else {
  285.             $returnPickUpTime = 'NULL';
  286.         }
  287.        
  288.         if ($returnPickUpDate != '') {
  289.             $returnPickUpDate = date('Y-m-d',strtotime($returnPickUpDate));
  290.         }
  291.        
  292.         $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  293.         $sql = "UPDATE ma_reservaciones
  294.                 SET FolioSCT='".$folioSCT."',
  295.                 iPickUpTime='".$initialPickUpTime."',
  296.                 iPickUpDate='".$initialPickUpDate."',
  297.                 rPickUpTime='".$returnPickUpTime."',
  298.                 rPickUpDate='".$returnPickUpDate."'
  299.                 where id_reservacion='".$this->getId()."';";
  300.    
  301.         if($mysqli->multi_query($sql)){
  302.             $this->setMsg('Operacion realizada con exito.');
  303.        
  304.             return 1;
  305.         }else{
  306.             $this->setMsg('Error al realizar la operacion.');
  307.             return 0;
  308.         }
  309.     }
  310.    
  311.     public function Pagar($idReservacion){
  312.         $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
  313.         $sql = "update ma_reservaciones set pagado=1
  314.                 where id_reservacion = '".$idReservacion."';";
  315.         if($mysqli->multi_query($sql)){
  316.             $this->setMsg('Operacion realizada con exito.');
  317.             return 1;
  318.         }else{
  319.             $this->setMsg('Error al realizar la operacion.');
  320.             return 0;
  321.         }
  322.     }
  323.    
  324.     public function getDestination()
  325.     {
  326.         $this->instanciaTarifa();
  327.         $destino = new reg_Lugares($this->oTarifa->getid_lugar_destino());
  328.         return $destino->getDescripcion();
  329.     }
  330.    
  331.     /**
  332.      * @return reg_MaResevaciones
  333.      */
  334.     public function setId($NewVal){
  335.         $this->id = Limpiar($NewVal);
  336.         return $this;
  337.     }
  338.    
  339.     public function getId(){
  340.         return $this->id;
  341.     }
  342.    
  343.    
  344.     /**
  345.      * @return reg_MaResevaciones
  346.      */
  347.     public function setNombre($NewVal){
  348.         $this->nombre = Limpiar($NewVal);
  349.         return $this;
  350.     }
  351.    
  352.     public function getNombre(){
  353.         return $this->nombre;
  354.     }
  355.    
  356.    
  357.     /**
  358.      * @return reg_MaResevaciones
  359.      */
  360.     public function setPaterno($NewVal){
  361.         $this->paterno = Limpiar($NewVal);
  362.         return $this;
  363.     }
  364.    
  365.     public function getPaterno(){
  366.         return $this->paterno;
  367.     }
  368.    
  369.    
  370.     /**
  371.      * @return reg_MaResevaciones
  372.      */
  373.     public function setMaterno($NewVal){
  374.         $this->materno = Limpiar($NewVal);
  375.         return $this;
  376.     }
  377.    
  378.     public function getMaterno(){
  379.         return $this->materno;
  380.     }
  381.    
  382.    
  383.     /**
  384.      * @return reg_MaResevaciones
  385.      */
  386.     public function setDireccion($NewVal){
  387.         $this->direccion = Limpiar($NewVal);
  388.         return $this;
  389.     }
  390.    
  391.     public function getDireccion(){
  392.         return $this->direccion;
  393.     }
  394.    
  395.    
  396.     /**
  397.      * @return reg_MaResevaciones
  398.      */
  399.     public function setCiudad($NewVal){
  400.         $this->ciudad = Limpiar($NewVal);
  401.         return $this;
  402.     }
  403.    
  404.     public function getCiudad(){
  405.         return $this->ciudad;
  406.     }
  407.    
  408.    
  409.     /**
  410.      * @return reg_MaResevaciones
  411.      */
  412.     public function setEstado($NewVal){
  413.         $this->estado = Limpiar($NewVal);
  414.         return $this;
  415.     }
  416.    
  417.     public function getEstado(){
  418.         return $this->estado;
  419.     }
  420.    
  421.    
  422.     /**
  423.      * @return reg_MaResevaciones
  424.      */
  425.     public function setCP($NewVal){
  426.         $this->cp = Limpiar($NewVal);
  427.         return $this;
  428.     }
  429.    
  430.     public function getCP(){
  431.         return $this->cp;
  432.     }
  433.    
  434.    
  435.     /**
  436.      * @return reg_MaResevaciones
  437.      */
  438.     public function setPais($NewVal){
  439.         $this->pais = Limpiar($NewVal);
  440.         return $this;
  441.     }
  442.    
  443.     public function getPais(){
  444.         return $this->pais;
  445.     }
  446.    
  447.    
  448.     /**
  449.      * @return reg_MaResevaciones
  450.      */
  451.     public function setTelefono($NewVal){
  452.         $this->telefono = Limpiar($NewVal);
  453.         return $this;
  454.     }
  455.    
  456.     public function getTelefono(){
  457.         return $this->telefono;
  458.     }
  459.    
  460.    
  461.     /**
  462.      * @return reg_MaResevaciones
  463.      */
  464.     public function setCelular($NewVal){
  465.         $this->celular = Limpiar($NewVal);
  466.         return $this;
  467.     }
  468.    
  469.     public function getCelular(){
  470.         return $this->celular;
  471.     }
  472.    
  473.    
  474.     /**
  475.      * @return reg_MaResevaciones
  476.      */
  477.     public function setCorreo($NewVal){
  478.         $this->correo = Limpiar($NewVal);
  479.         return $this;
  480.     }
  481.    
  482.     public function getCorreo(){
  483.         return $this->correo;
  484.     }
  485.    
  486.    
  487.     /**
  488.      * @return reg_MaResevaciones
  489.      */
  490.     public function setId_tarifa($NewVal){
  491.         $this->id_tarifa = Limpiar($NewVal);
  492.         return $this;
  493.     }
  494.    
  495.     public function getId_tarifa(){
  496.         return $this->id_tarifa;
  497.     }
  498.    
  499.    
  500.     /**
  501.      * @return reg_MaResevaciones
  502.      */
  503.     public function setAerolinea($NewVal){
  504.         $this->aerolinea = Limpiar($NewVal);
  505.         return $this;
  506.     }
  507.    
  508.     public function getAerolinea(){
  509.         return $this->aerolinea;
  510.     }
  511.    
  512.    
  513.     /**
  514.      * @return reg_MaResevaciones
  515.      */
  516.     public function setNo_vuelo($NewVal){
  517.         $this->no_vuelo = Limpiar($NewVal);
  518.         return $this;
  519.     }
  520.    
  521.     public function getNo_vuelo(){
  522.         return $this->no_vuelo;
  523.     }
  524.    
  525.    
  526.     /**
  527.      * @return reg_MaResevaciones
  528.      */
  529.     public function setHora_vuelo($NewVal){
  530.          if (false !== strpos(strtolower($NewVal), 'pm')) {
  531.             $NewVal = date('H:i:s', strtotime($NewVal));
  532.         }
  533.         $this->hora_vuelo = Limpiar($NewVal);
  534.         return $this;
  535.     }
  536.    
  537.     public function getHora_vuelo($format=null){
  538.         return $this->formatTime($this->hora_vuelo, $format);
  539.     }
  540.    
  541.    
  542.     /**
  543.      * @return reg_MaResevaciones
  544.      */
  545.     public function setNo_noches($NewVal){
  546.         $this->no_noches = Limpiar($NewVal);
  547.         return $this;
  548.     }
  549.    
  550.     public function getNo_noches(){
  551.         return $this->no_noches;
  552.     }
  553.    
  554.    
  555.     /**
  556.      * @return reg_MaResevaciones
  557.      */
  558.     public function setFecha_salida($NewVal){
  559.         #$this->fecha_salida = Limpiar($NewVal);
  560.         $this->fecha_salida = ($NewVal);
  561.         return $this;
  562.     }
  563.    
  564.     public function getFecha_salida(){
  565.         return $this->fecha_salida;
  566.     }
  567.  
  568.     public function getFecha_salida_mdy($separador='/'){
  569.             /*list($dSal,$mSal,$aSal) = explode("/",$this->fecha_salida);
  570.             $salida = $mSal.$separador.$dSal.$separador.$aSal;*/
  571.         if ($this->getFecha_salida()== '0000-00-00'
  572.             or $this->getFecha_salida() == '1969-12-31'
  573.         ) {
  574.             return '';
  575.         }
  576.         return date("m{$separador}d{$separador}Y", $this->fecha_salida_dt);
  577.     }
  578.    
  579.    
  580.     /**
  581.      * @return reg_MaResevaciones
  582.      */
  583.     public function setAerolinea_salida($NewVal){
  584.         $this->aerolinea_salida = Limpiar($NewVal);
  585.         return $this;
  586.     }
  587.    
  588.     public function getAerolinea_salida(){
  589.         return $this->aerolinea_salida;
  590.     }
  591.    
  592.    
  593.     /**
  594.      * @return reg_MaResevaciones
  595.      */
  596.     public function setNo_vuelo_salida($NewVal){
  597.         $this->no_vuelo_salida = Limpiar($NewVal);
  598.         return $this;
  599.     }
  600.    
  601.     public function getNo_vuelo_salida(){
  602.         return $this->no_vuelo_salida;
  603.     }
  604.    
  605.    
  606.     /**
  607.      * @return reg_MaResevaciones
  608.      */
  609.     public function setHora_vuelo_salida($NewVal){
  610.          if (false !== strpos(strtolower($NewVal), 'pm'))
  611.             $NewVal = date('H:i:s', strtotime($NewVal));
  612.         $this->hora_vuelo_salida = Limpiar($NewVal);
  613.         return $this;
  614.     }
  615.    
  616.     public function getHora_vuelo_salida($format=null){
  617.         return $this->formatTime($this->hora_vuelo_salida, $format);
  618.     }
  619.    
  620.    
  621.     /**
  622.      * @return reg_MaResevaciones
  623.      */
  624.     public function setInfo_adicional($NewVal){
  625.         $this->info_adicional = Limpiar($NewVal);
  626.         return $this;
  627.     }
  628.    
  629.     public function getInfo_adicional(){
  630.         return $this->info_adicional;
  631.     }
  632.    
  633.    
  634.     /**
  635.      * @return reg_MaResevaciones
  636.      */
  637.     public function setPasajeros($NewVal){
  638.         $this->pasajeros = Limpiar($NewVal);
  639.         return $this;
  640.     }
  641.    
  642.     public function getPasajeros(){
  643.         return $this->pasajeros;
  644.     }
  645.    
  646.    
  647.     /**
  648.      * @return reg_MaResevaciones
  649.      */
  650.     public function setPeticiones_adicionales($NewVal){
  651.         $this->peticiones_adicionales = Limpiar($NewVal);
  652.         return $this;
  653.     }
  654.    
  655.     public function getPeticiones_adicionales(){
  656.         return $this->peticiones_adicionales;
  657.     }
  658.    
  659.    
  660.     /**
  661.      * @return reg_MaResevaciones
  662.      */
  663.     public function setFecha_llegada($NewVal){
  664.         #$this->fecha_llegada = Limpiar($NewVal);
  665.         $this->fecha_llegada = ($NewVal);
  666.         return $this;
  667.     }
  668.    
  669.     public function getFecha_llegada(){
  670.         return $this->fecha_llegada;
  671.     }
  672.  
  673.     public function getFecha_llegada_mdy($separador='/'){
  674.         if ($this->getFecha_llegada()== '0000-00-00'
  675.             or $this->getFecha_llegada() == '1969-12-31') {
  676.             return '';
  677.         }
  678.         return date("m{$separador}d{$separador}Y", $this->fecha_llegada_dt);
  679.     }
  680.        
  681.    
  682.     /**
  683.      * @return reg_MaResevaciones
  684.      */
  685.     public function setId_status($NewVal){
  686.         $this->id_status = Limpiar($NewVal);
  687.         return $this;
  688.     }
  689.    
  690.     public function getId_status(){
  691.         return $this->id_status;
  692.     }
  693.    
  694.    
  695.     /**
  696.      * @return reg_MaResevaciones
  697.      */
  698.     public function setOtherAirport($NewVal){
  699.         $this->OtherAirport = Limpiar($NewVal);
  700.         return $this;
  701.     }
  702.    
  703.     public function getOtherAirport(){
  704.         return $this->OtherAirport;
  705.     }
  706.    
  707.    
  708.     /**
  709.      * @return reg_MaResevaciones
  710.      */
  711.     public function setIdPaquete($NewVal){
  712.         $this->id_paquete = Limpiar($NewVal);
  713.         return $this;
  714.     }
  715.    
  716.     public function getIdPaquete(){
  717.         return $this->id_paquete;
  718.     }
  719.    
  720.    
  721.     /**
  722.      * @return reg_MaResevaciones
  723.      */
  724.     public function setIdTraslado($NewVal){
  725.         $this->id_traslado = Limpiar($NewVal);
  726.         return $this;
  727.     }
  728.    
  729.     public function getIdTraslado(){
  730.         return $this->id_traslado;
  731.     }
  732.    
  733.    
  734.     /**
  735.      * @return reg_MaResevaciones
  736.      */
  737.     public function setIdHotel($NewVal){
  738.         $this->id_hotel = Limpiar($NewVal);
  739.         return $this;
  740.     }
  741.    
  742.     public function getIdHotel(){
  743.         return $this->id_hotel;
  744.     }
  745.    
  746.    
  747.     /**
  748.      * @return reg_MaResevaciones
  749.      */
  750.     public function setTipo($NewVal){
  751.         $this->tipo = Limpiar($NewVal);
  752.         return $this;
  753.     }
  754.    
  755.     public function getTipo(){
  756.         return $this->tipo;
  757.     }
  758.    
  759.    
  760.     /**
  761.      * @return reg_MaResevaciones
  762.      */
  763.     public function setTotal($NewVal){
  764.         $this->total = Limpiar($NewVal);
  765.         return $this;
  766.     }
  767.    
  768.     public function getTotal(){
  769.         return $this->total;
  770.     }
  771.    
  772.    
  773.     /**
  774.      * @return reg_MaResevaciones
  775.      */
  776.     public function setFecha_creacion($NewVal){
  777.         $this->fecha_creacion = $NewVal;
  778.         return $this;
  779.     }
  780.    
  781.     public function getFecha_creacion(){
  782.         return $this->fecha_creacion;
  783.     }
  784.    
  785.     public function getFecha_creacion_mdy($separador = '/')
  786.     {
  787.         $fc = strtotime($this->getFecha_creacion());
  788.         return date("m{$separador}d{$separador}Y", $fc);
  789.     }
  790.  
  791.    
  792.     /**
  793.      * @return reg_MaResevaciones
  794.      */
  795.     public function setTipoCobro($NewVal){
  796.         $this->tipocobro = Limpiar($NewVal);
  797.         return $this;
  798.     }
  799.    
  800.     public function getTipoCobro(){
  801.         return $this->tipocobro;
  802.     }
  803.  
  804.     public function getVip(){
  805.         return $this->vip;
  806.     }
  807.  
  808.    
  809.     /**
  810.      * @return reg_MaResevaciones
  811.      */
  812.     public function setVip($newVal){
  813.         $this->vip = $newVal;
  814.         return $this;
  815.     }
  816.  
  817.     public function getGrocery(){
  818.         return $this->grocery;
  819.     }
  820.  
  821.    
  822.     /**
  823.      * @return reg_MaResevaciones
  824.      */
  825.     public function setGrocery($newVal){
  826.         $this->grocery = $newVal;
  827.         return $this;
  828.     }
  829.  
  830.     public function getFolioSCT(){
  831.         return $this->folioSCT;
  832.     }
  833.  
  834.    
  835.     /**
  836.      * @return reg_MaResevaciones
  837.      */
  838.     public function setFolioSTR($newVal){
  839.         $this->folioSCT  = $newVal;
  840.         return $this;
  841.     }
  842.  
  843.  
  844.    
  845.     /**
  846.      * @return reg_MaResevaciones
  847.      */
  848.     public function setInitialPickUpTime($newVal){
  849.         if (!$newVal)
  850.             $newVal = null;
  851.         $this->ipickup_time = $newVal;
  852.         return $this;
  853.     }
  854.    
  855.     protected function formatTime($time,$format=null)
  856.     {
  857.         $timet = strtotime($time);
  858.         if (null !== $format && null !== $time && $timet) {
  859.             $time = date($format, $timet);
  860.         }
  861.         return $time;
  862.     }
  863.  
  864.     public function getInitialPickUpTime($format=null){
  865.         return $this->formatTime($this->ipickup_time, $format);
  866.     }
  867.  
  868.     public function setInitialPickUpDate($newVal){
  869.         $this->ipickup_date = $newVal;
  870.         return $this;
  871.     }
  872.  
  873.     public function getInitialPickUpDate($format = null){
  874.         $date = $this->ipickup_date;
  875.         if ($date == '0000-00-00') {
  876.             return '';
  877.         }
  878.         if ($format != null && $date != '') {
  879.             $date = date($format, strtotime($date));
  880.         }
  881.         return $date;
  882.     }
  883.  
  884.  
  885.     public function setReturnPickUpTime($newVal){
  886.         $this->rpickup_time = $newVal;
  887.         return $this;
  888.     }
  889.  
  890.     public function getReturnPickUpTime($format=null){
  891.         return $this->formatTime($this->rpickup_time, $format);
  892.     }
  893.  
  894.    
  895.     /**
  896.      * @return reg_MaResevaciones
  897.      */
  898.     public function setReturnPickUpDate($newVal){
  899.         $this->rpickup_date = $newVal;
  900.         return $this;
  901.     }
  902.  
  903.     public function getReturnlPickUpDate($format = null){
  904.         $date = $this->rpickup_date;
  905.         if ($date == '0000-00-00') {
  906.             return '';
  907.         }
  908.         if ($format != null && $date != '') {
  909.             $date = date($format, strtotime($date));
  910.         }
  911.         return $date;
  912.     }
  913.  
  914.    
  915.     /**
  916.      * @return reg_MaResevaciones
  917.      */
  918.     public function setMsg($NewVal){
  919.         $this->msg = Limpiar($NewVal);
  920.         return $this;
  921.     }
  922.    
  923.     public function getMsg(){
  924.         return $this->msg;
  925.     }
  926.  
  927.     public function getLugarOrigenStr(){
  928.         $this->instanciaTarifa();
  929.  
  930.         $retorno = '';
  931.  
  932.         if($this->tipo == 'D'){
  933.             $retorno = $this->oTarifa->getLugarDestinoStr();
  934.         }else{
  935.             $retorno = $this->oTarifa->getLugarOrigenStr();
  936.         }
  937.  
  938.         return $retorno;
  939.     }
  940.  
  941.     public function getLugarDestinoStr(){
  942.         $this->instanciaTarifa();
  943.  
  944.         $retorno = '';
  945.  
  946.         if($this->tipo == 'D'){
  947.             $retorno = $this->oTarifa->getLugarOrigenStr();
  948.         }else{
  949.             $retorno = $this->oTarifa->getLugarDestinoStr();
  950.         }
  951.  
  952.         return $retorno;
  953.     }
  954.  
  955.     public function getTripStr(){
  956.         $this->instanciaTarifa();
  957.  
  958.         return $this->oTarifa->getStripStr();
  959.  
  960.     }
  961.  
  962.     public function getVehiculoStr(){
  963.         $this->instanciaTarifa();
  964.  
  965.         return $this->oTarifa->getVehiculoStr();
  966.     }
  967.  
  968.     public function getTrasladoStr(){
  969.         $this->instanciaTarifa();
  970.         return $this->oTarifa->getTrasladoStr();
  971.     }
  972.  
  973.     public function getOTarifa(){
  974.         $this->instanciaTarifa();
  975.         return $this->oTarifa;
  976.     }
  977.  
  978.     private function instanciaTarifa(){
  979.         if($this->oTarifa == null){
  980.             $this->oTarifa = new reg_DeTarifas($this->id_tarifa);
  981.         }
  982.     }
  983.    
  984.    
  985.     /**
  986.      * @return reg_MaResevaciones
  987.      */
  988.     public function setPagado($newval){
  989.         $this->pagado = $newval;
  990.         return $this;
  991.     }
  992.  
  993.     public function getPagado(){
  994.         return $this->pagado;
  995.     }
  996.  
  997.         public function tieneTestimonial(){
  998.             return reg_testimonial::tieneTestimonial($this->id);        
  999.         }
  1000.        
  1001.     public function getFecha_llegada_dt()
  1002.     {
  1003.         return $this->fecha_llegada_dt;
  1004.     }    
  1005.    
  1006.     public function getFecha_salida_dt()
  1007.     {
  1008.         return $this->fecha_salida_dt;
  1009.     }
  1010.    
  1011.     public function getInfo()
  1012.     {
  1013.         $r = array();
  1014.         if ($this->id_tarifa > 0) { // Shuttle o Private
  1015.             $this->instanciaTarifa();
  1016.             $r['auto'] = $this->oTarifa->getVehiculoStr();
  1017.             $r['destino'] = $this->oTarifa->getLugarDestinoStr();
  1018.             $r['origen'] = $this->oTarifa->getLugarOrigenStr();
  1019.             $r['traslado'] = $this->oTarifa->getTrasladoStr();
  1020.             $r['zona'] = $this->oTarifa->getId_zona();
  1021.             $r['paquete'] = $this->oTarifa->getStripStr();
  1022.         } else { // Special Reservation
  1023.             $spec = new reg_DeResevacionesSpecial($this->id);
  1024.             $r['paquete'] = 'Special';
  1025.             $r['destino'] = $spec->getDestination();
  1026.             $r['origen'] = $spec->getPickUpLocation();
  1027.         }
  1028.         return $r;
  1029.     }
  1030.    
  1031.     /**
  1032.      *
  1033.      * @return reg_DeTarifas
  1034.      */
  1035.     public function getTarifa()
  1036.     {
  1037.         if ($this->getId_tarifa()) {
  1038.             $this->instanciaTarifa();
  1039.             return $this->oTarifa;
  1040.         }
  1041.         return null;
  1042.     }
  1043.    
  1044.     /**
  1045.      *
  1046.      * @return reg_DeResevacionesSpecial
  1047.      */
  1048.     public function getSpecial()
  1049.     {
  1050.         if (!$this->getId_tarifa()) {
  1051.             $special = new reg_DeResevacionesSpecial($this->id);
  1052.             return $special;
  1053.         }
  1054.         return false;
  1055.     }
  1056. }
  1057.  
  1058.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement