Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/funciones.php');
- require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deTarifas.php');
- require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_aeropuertos.php');
- require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_status.php');
- require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_testimonial.php');
- require_once($_SERVER['DOCUMENT_ROOT'].'/Clases/Registro/reg_deReservacionesSpecial.php');
- class reg_MaResevaciones{
- private $id = 0;
- private $nombre = '';
- private $paterno = '';
- private $materno = '';
- private $direccion = '';
- private $ciudad ='';
- private $estado = '';
- private $cp = '';
- private $pais = '';
- private $telefono = '';
- private $celular = '';
- private $correo = '';
- private $id_tarifa = 0;
- private $aerolinea = '';
- private $no_vuelo = '';
- private $hora_vuelo = null;
- private $no_noches = 0;
- private $fecha_salida = ''; // string (yyyy-mm-dd)
- private $fecha_salida_dt = 0; // datetime
- private $aerolinea_salida = '';
- private $no_vuelo_salida = '';
- private $hora_vuelo_salida = null;
- private $info_adicional = '';
- private $pasajeros = 0;
- private $peticiones_adicionales = '';
- private $fecha_llegada = ''; // string (yyyy-mm-dd)
- private $fecha_llegada_dt = 0; // datetime
- private $id_status = 0;
- private $OtherAirport = '';
- private $id_paquete = 0;
- private $id_traslado = 0;
- private $id_hotel = 0;
- private $tipo = '';
- private $total = 0;
- private $fecha_creacion = '';
- private $tipocobro = 0;
- private $vip = 0;
- private $grocery = 0;
- private $folioSCT = '';
- private $ipickup_time = null;
- private $ipickup_date = '';
- private $dpickup_time = null;
- private $dpickup_date = '';
- private $msg = '';
- private $oTarifa = NULL;
- private $pagado = 0;
- private $oEsp = null; // instancia del objeto reg_deReservacionEspecial correspondiente
- public function __construct($id_reservacion=0){
- if($id_reservacion>0){
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql = "SELECT * FROM ma_reservaciones
- WHERE id_reservacion ='".$id_reservacion."'";
- $mysqli->multi_query($sql);
- if($result = $mysqli->store_result()){
- while ($dato = $result->fetch_row()){
- $this->setId($dato[0]);
- $this->setNombre($dato[1]);
- $this->setPaterno($dato[2]);
- $this->setMaterno($dato[3]);
- $this->setDireccion($dato[4]);
- $this->setCiudad($dato[5]);
- $this->setEstado($dato[6]);
- $this->setCP($dato[7]);
- $this->setPais($dato[8]);
- $this->setTelefono($dato[9]);
- $this->setCelular($dato[10]);
- $this->setCorreo($dato[11]);
- $this->setId_tarifa($dato[12]);
- $this->setAerolinea($dato[13]);
- $this->setNo_vuelo($dato[14]);
- $this->setHora_vuelo($dato[15]);
- $this->setNo_noches($dato[16]);
- $this->setFecha_salida($dato[17]);
- //$this->fecha_salida = substr($dato[17],8,2).'/'.substr($dato[17],5,2).'/'.substr($dato[17],0,4);
- $this->fecha_salida_dt = strtotime($dato[17]);
- $this->setAerolinea_salida($dato[18]);
- $this->setNo_vuelo_salida($dato[19]);
- $this->setHora_vuelo_salida($dato[20]);
- $this->setInfo_adicional($dato[21]);
- $this->setPasajeros($dato[22]);
- $this->setPeticiones_adicionales($dato[23]);
- $this->fecha_llegada = $dato[24];//substr($dato[24],8,2).'/'.substr($dato[24],5,2).'/'.substr($dato[24],0,4);
- $this->fecha_llegada_dt = strtotime($dato[24]);
- $this->setId_status($dato[25]);
- $this->setOtherAirport($dato[26]);
- $this->setIdPaquete($dato[27]);
- $this->setIdTraslado($dato[28]);
- $this->setIdHotel($dato[29]);
- $this->setTipo($dato[30]);
- $this->setTotal($dato[31]);
- $this->setFecha_creacion($dato[32]);
- $this->setTipoCobro($dato[33]);
- $this->setVip($dato[39]);
- $this->setGrocery($dato[40]);
- #informacion del voucher
- $this->folioSCT = $dato[34];
- $this->ipickup_time = $dato[35];
- $this->ipickup_date = $dato[36];
- $this->rpickup_time = $dato[37];
- $this->rpickup_date = $dato[38];
- $this->setPagado($dato[41]);
- }
- }
- }
- }
- public function __toString() {
- return $this->id.' '.$this->paterno.' '.$this->nombre;
- }
- /**
- *
- * @return bool success
- */
- public function guardarTotal()
- {
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql = "UPDATE ma_reservaciones set total = "
- .$this->getTotal()
- ." WHERE id_reservacion = "
- .$this->getId().";";
- if ($mysqli->query($sql)) {
- $this->setMsg('Info saved correctly');
- return true;
- } else {
- $this->setMsg('There was an error when trying to save information.');
- return false;
- }
- return true;
- }
- /**
- *
- * @return mixed
- */
- public function guardar(){
- if (null != $this->getFecha_salida() || '00/00/0000' != $this->getFecha_salida()) {
- $salida = date('Y-m-d', strtotime($this->getFecha_salida()));
- } else {
- $salida = '0000-00-00';
- }
- if (null != $this->getFecha_llegada()) {
- $llegada = date('Y-m-d', strtotime($this->getFecha_llegada()));
- } else {
- $salida = '0000-00-00';
- }
- if ($this->getHora_vuelo('H:i:s') == null) {
- $hora_vuelo = "'NULL'";
- } else {
- $hora_vuelo = "'".$this->getHora_vuelo()."'";
- }
- if ($this->getHora_vuelo_salida('H:i:s') == null) {
- $hora_vuelo_salida = "'NULL'";
- } else {
- $hora_vuelo_salida = "'".$this->getHora_vuelo_salida()."'";
- }
- if($this->getId()>0){#si se cumple la condicion hace un update en la tabla cat_Lugares
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql = "UPDATE ma_reservaciones SET
- nombre='".$this->getNombre()."',
- paterno='".$this->getPaterno()."',
- materno='".$this->getMaterno()."',
- direccion='".$this->getDireccion()."',
- ciudad='".$this->getCiudad()."',
- estado='".$this->getEstado()."',
- cp='".$this->getCP()."',
- pais='".$this->getPais()."',
- telefono='".$this->getTelefono()."',
- celular='".$this->getCelular()."',
- correo='".$this->getCorreo()."',
- id_tarifa='".$this->getId_tarifa()."',
- aerolinea='".$this->getAerolinea()."',
- no_vuelo='".$this->getNo_vuelo()."',
- hora_vuelo='".$hora_vuelo."',
- no_noches='".$this->getNo_noches()."',
- fecha_salida='".$salida."',
- aerolinea_salida='".$this->getAerolinea_salida()."',
- no_vuelo_salida='".$this->getNo_vuelo_salida()."',
- hora_vuelo_salida='".$hora_vuelo_salida."',
- info_adicional='".$this->getInfo_adicional()."',
- pasajeros='".$this->getPasajeros()."',
- peticiones_adicionales='".$this->getPeticiones_adicionales()."',
- fecha_llegada='".$llegada."',
- OtherAirport='".$this->getOtherAirport()."',
- IdPaquete='".$this->getIdPaquete()."',
- IdTraslado='".$this->getIdTraslado()."',
- IdHotel='".$this->getIdHotel()."',
- vip='".$this->getVip()."',
- total='".$this->getTotal()."',
- id_tipocobro='".$this->getTipoCobro()."',
- pagado='".$this->getPagado()."',
- grocery='".$this->getGrocery()."'
- WHERE id_reservacion = '".$this->getId()."';";
- if($mysqli->multi_query($sql)){
- $this->setMsg('La reservacion se modificó correctamente.');
- return 1;
- }else{
- $this->setMsg('Error al modificar la reservacion.');
- return 0;
- }
- }else{#en caso de que entre en el else se hace un insert sobre la tabla cat_Lugares
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql ="INSERT INTO ma_reservaciones
- (nombre,paterno,materno,direccion,ciudad,estado,cp,pais,telefono,celular,correo,id_tarifa,aerolinea,no_vuelo,hora_vuelo,no_noches,
- fecha_salida,aerolinea_salida,no_vuelo_salida,hora_vuelo_salida,info_adicional,pasajeros,peticiones_adicionales,fecha_llegada
- ,OtherAirport,IdPaquete,IdTraslado,IdHotel,tipo,total,fec_creacion,id_tipocobro,grocery,vip
- )
- VALUES
- ('".$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().");";
- if($mysqli->multi_query($sql)){
- $this->setMsg('Reservation request received successfully.');
- return 1;
- }else{
- $this->setMsg('Something wrong happened while making the reservation.');
- return 0;
- }
- }
- }
- public function ActualizaStatus(){
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql = "UPDATE ma_reservaciones SET
- id_status='".$this->getId_status()."'
- WHERE id_reservacion = '".$this->getId()."';";
- if($mysqli->multi_query($sql)){
- $this->setMsg('Operacion realizada con exito.');
- return "1";
- }else{
- $this->setMsg('Error al realizar la operacion.');
- return 0;
- }
- }
- public function ActualizaVoucher($folioSCT = '', $initialPickUpTime = '', $initialPickUpDate = '', $returnPickUpTime = '', $returnPickUpDate = ''){
- /*
- #voucher dates
- list($vmSal,$vdSal,$vaSal) = explode("/",$returnPickUpDate);
- list($vmLle,$vdLle,$vaLle) = explode("/",$initialPickUpDate);
- $returnPickUpDate = $vaSal.'-'.$vmSal.'-'.$vdSal;
- $initialPickUpDate = $vaLle.'-'.$vmLle.'-'.$vdLle;*/
- if ($initialPickUpDate != '') {
- $initialPickUpDate = date('Y-m-d', strtotime($initialPickUpDate));
- }
- if ($initialPickUpTime) {
- $initialPickUpTime = "'".date('H:i:s', strtotime($initialPickUpTime))."'";
- } else {
- $initialPickUpTime = 'NULL';
- }
- if ($returnPickUpTime) {
- $returnPickUpTime = "'".date('H:i:s', strtotime($returnPickUpTime))."'";
- } else {
- $returnPickUpTime = 'NULL';
- }
- if ($returnPickUpDate != '') {
- $returnPickUpDate = date('Y-m-d',strtotime($returnPickUpDate));
- }
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql = "UPDATE ma_reservaciones
- SET FolioSCT='".$folioSCT."',
- iPickUpTime='".$initialPickUpTime."',
- iPickUpDate='".$initialPickUpDate."',
- rPickUpTime='".$returnPickUpTime."',
- rPickUpDate='".$returnPickUpDate."'
- where id_reservacion='".$this->getId()."';";
- if($mysqli->multi_query($sql)){
- $this->setMsg('Operacion realizada con exito.');
- return 1;
- }else{
- $this->setMsg('Error al realizar la operacion.');
- return 0;
- }
- }
- public function Pagar($idReservacion){
- $mysqli = new mysqli("localhost", "root", "nxTYuugGCz", "niceridecabo");
- $sql = "update ma_reservaciones set pagado=1
- where id_reservacion = '".$idReservacion."';";
- if($mysqli->multi_query($sql)){
- $this->setMsg('Operacion realizada con exito.');
- return 1;
- }else{
- $this->setMsg('Error al realizar la operacion.');
- return 0;
- }
- }
- public function getDestination()
- {
- $this->instanciaTarifa();
- $destino = new reg_Lugares($this->oTarifa->getid_lugar_destino());
- return $destino->getDescripcion();
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setId($NewVal){
- $this->id = Limpiar($NewVal);
- return $this;
- }
- public function getId(){
- return $this->id;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setNombre($NewVal){
- $this->nombre = Limpiar($NewVal);
- return $this;
- }
- public function getNombre(){
- return $this->nombre;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setPaterno($NewVal){
- $this->paterno = Limpiar($NewVal);
- return $this;
- }
- public function getPaterno(){
- return $this->paterno;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setMaterno($NewVal){
- $this->materno = Limpiar($NewVal);
- return $this;
- }
- public function getMaterno(){
- return $this->materno;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setDireccion($NewVal){
- $this->direccion = Limpiar($NewVal);
- return $this;
- }
- public function getDireccion(){
- return $this->direccion;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setCiudad($NewVal){
- $this->ciudad = Limpiar($NewVal);
- return $this;
- }
- public function getCiudad(){
- return $this->ciudad;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setEstado($NewVal){
- $this->estado = Limpiar($NewVal);
- return $this;
- }
- public function getEstado(){
- return $this->estado;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setCP($NewVal){
- $this->cp = Limpiar($NewVal);
- return $this;
- }
- public function getCP(){
- return $this->cp;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setPais($NewVal){
- $this->pais = Limpiar($NewVal);
- return $this;
- }
- public function getPais(){
- return $this->pais;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setTelefono($NewVal){
- $this->telefono = Limpiar($NewVal);
- return $this;
- }
- public function getTelefono(){
- return $this->telefono;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setCelular($NewVal){
- $this->celular = Limpiar($NewVal);
- return $this;
- }
- public function getCelular(){
- return $this->celular;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setCorreo($NewVal){
- $this->correo = Limpiar($NewVal);
- return $this;
- }
- public function getCorreo(){
- return $this->correo;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setId_tarifa($NewVal){
- $this->id_tarifa = Limpiar($NewVal);
- return $this;
- }
- public function getId_tarifa(){
- return $this->id_tarifa;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setAerolinea($NewVal){
- $this->aerolinea = Limpiar($NewVal);
- return $this;
- }
- public function getAerolinea(){
- return $this->aerolinea;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setNo_vuelo($NewVal){
- $this->no_vuelo = Limpiar($NewVal);
- return $this;
- }
- public function getNo_vuelo(){
- return $this->no_vuelo;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setHora_vuelo($NewVal){
- if (false !== strpos(strtolower($NewVal), 'pm')) {
- $NewVal = date('H:i:s', strtotime($NewVal));
- }
- $this->hora_vuelo = Limpiar($NewVal);
- return $this;
- }
- public function getHora_vuelo($format=null){
- return $this->formatTime($this->hora_vuelo, $format);
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setNo_noches($NewVal){
- $this->no_noches = Limpiar($NewVal);
- return $this;
- }
- public function getNo_noches(){
- return $this->no_noches;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setFecha_salida($NewVal){
- #$this->fecha_salida = Limpiar($NewVal);
- $this->fecha_salida = ($NewVal);
- return $this;
- }
- public function getFecha_salida(){
- return $this->fecha_salida;
- }
- public function getFecha_salida_mdy($separador='/'){
- /*list($dSal,$mSal,$aSal) = explode("/",$this->fecha_salida);
- $salida = $mSal.$separador.$dSal.$separador.$aSal;*/
- if ($this->getFecha_salida()== '0000-00-00'
- or $this->getFecha_salida() == '1969-12-31'
- ) {
- return '';
- }
- return date("m{$separador}d{$separador}Y", $this->fecha_salida_dt);
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setAerolinea_salida($NewVal){
- $this->aerolinea_salida = Limpiar($NewVal);
- return $this;
- }
- public function getAerolinea_salida(){
- return $this->aerolinea_salida;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setNo_vuelo_salida($NewVal){
- $this->no_vuelo_salida = Limpiar($NewVal);
- return $this;
- }
- public function getNo_vuelo_salida(){
- return $this->no_vuelo_salida;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setHora_vuelo_salida($NewVal){
- if (false !== strpos(strtolower($NewVal), 'pm'))
- $NewVal = date('H:i:s', strtotime($NewVal));
- $this->hora_vuelo_salida = Limpiar($NewVal);
- return $this;
- }
- public function getHora_vuelo_salida($format=null){
- return $this->formatTime($this->hora_vuelo_salida, $format);
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setInfo_adicional($NewVal){
- $this->info_adicional = Limpiar($NewVal);
- return $this;
- }
- public function getInfo_adicional(){
- return $this->info_adicional;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setPasajeros($NewVal){
- $this->pasajeros = Limpiar($NewVal);
- return $this;
- }
- public function getPasajeros(){
- return $this->pasajeros;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setPeticiones_adicionales($NewVal){
- $this->peticiones_adicionales = Limpiar($NewVal);
- return $this;
- }
- public function getPeticiones_adicionales(){
- return $this->peticiones_adicionales;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setFecha_llegada($NewVal){
- #$this->fecha_llegada = Limpiar($NewVal);
- $this->fecha_llegada = ($NewVal);
- return $this;
- }
- public function getFecha_llegada(){
- return $this->fecha_llegada;
- }
- public function getFecha_llegada_mdy($separador='/'){
- if ($this->getFecha_llegada()== '0000-00-00'
- or $this->getFecha_llegada() == '1969-12-31') {
- return '';
- }
- return date("m{$separador}d{$separador}Y", $this->fecha_llegada_dt);
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setId_status($NewVal){
- $this->id_status = Limpiar($NewVal);
- return $this;
- }
- public function getId_status(){
- return $this->id_status;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setOtherAirport($NewVal){
- $this->OtherAirport = Limpiar($NewVal);
- return $this;
- }
- public function getOtherAirport(){
- return $this->OtherAirport;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setIdPaquete($NewVal){
- $this->id_paquete = Limpiar($NewVal);
- return $this;
- }
- public function getIdPaquete(){
- return $this->id_paquete;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setIdTraslado($NewVal){
- $this->id_traslado = Limpiar($NewVal);
- return $this;
- }
- public function getIdTraslado(){
- return $this->id_traslado;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setIdHotel($NewVal){
- $this->id_hotel = Limpiar($NewVal);
- return $this;
- }
- public function getIdHotel(){
- return $this->id_hotel;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setTipo($NewVal){
- $this->tipo = Limpiar($NewVal);
- return $this;
- }
- public function getTipo(){
- return $this->tipo;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setTotal($NewVal){
- $this->total = Limpiar($NewVal);
- return $this;
- }
- public function getTotal(){
- return $this->total;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setFecha_creacion($NewVal){
- $this->fecha_creacion = $NewVal;
- return $this;
- }
- public function getFecha_creacion(){
- return $this->fecha_creacion;
- }
- public function getFecha_creacion_mdy($separador = '/')
- {
- $fc = strtotime($this->getFecha_creacion());
- return date("m{$separador}d{$separador}Y", $fc);
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setTipoCobro($NewVal){
- $this->tipocobro = Limpiar($NewVal);
- return $this;
- }
- public function getTipoCobro(){
- return $this->tipocobro;
- }
- public function getVip(){
- return $this->vip;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setVip($newVal){
- $this->vip = $newVal;
- return $this;
- }
- public function getGrocery(){
- return $this->grocery;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setGrocery($newVal){
- $this->grocery = $newVal;
- return $this;
- }
- public function getFolioSCT(){
- return $this->folioSCT;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setFolioSTR($newVal){
- $this->folioSCT = $newVal;
- return $this;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setInitialPickUpTime($newVal){
- if (!$newVal)
- $newVal = null;
- $this->ipickup_time = $newVal;
- return $this;
- }
- protected function formatTime($time,$format=null)
- {
- $timet = strtotime($time);
- if (null !== $format && null !== $time && $timet) {
- $time = date($format, $timet);
- }
- return $time;
- }
- public function getInitialPickUpTime($format=null){
- return $this->formatTime($this->ipickup_time, $format);
- }
- public function setInitialPickUpDate($newVal){
- $this->ipickup_date = $newVal;
- return $this;
- }
- public function getInitialPickUpDate($format = null){
- $date = $this->ipickup_date;
- if ($date == '0000-00-00') {
- return '';
- }
- if ($format != null && $date != '') {
- $date = date($format, strtotime($date));
- }
- return $date;
- }
- public function setReturnPickUpTime($newVal){
- $this->rpickup_time = $newVal;
- return $this;
- }
- public function getReturnPickUpTime($format=null){
- return $this->formatTime($this->rpickup_time, $format);
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setReturnPickUpDate($newVal){
- $this->rpickup_date = $newVal;
- return $this;
- }
- public function getReturnlPickUpDate($format = null){
- $date = $this->rpickup_date;
- if ($date == '0000-00-00') {
- return '';
- }
- if ($format != null && $date != '') {
- $date = date($format, strtotime($date));
- }
- return $date;
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setMsg($NewVal){
- $this->msg = Limpiar($NewVal);
- return $this;
- }
- public function getMsg(){
- return $this->msg;
- }
- public function getLugarOrigenStr(){
- $this->instanciaTarifa();
- $retorno = '';
- if($this->tipo == 'D'){
- $retorno = $this->oTarifa->getLugarDestinoStr();
- }else{
- $retorno = $this->oTarifa->getLugarOrigenStr();
- }
- return $retorno;
- }
- public function getLugarDestinoStr(){
- $this->instanciaTarifa();
- $retorno = '';
- if($this->tipo == 'D'){
- $retorno = $this->oTarifa->getLugarOrigenStr();
- }else{
- $retorno = $this->oTarifa->getLugarDestinoStr();
- }
- return $retorno;
- }
- public function getTripStr(){
- $this->instanciaTarifa();
- return $this->oTarifa->getStripStr();
- }
- public function getVehiculoStr(){
- $this->instanciaTarifa();
- return $this->oTarifa->getVehiculoStr();
- }
- public function getTrasladoStr(){
- $this->instanciaTarifa();
- return $this->oTarifa->getTrasladoStr();
- }
- public function getOTarifa(){
- $this->instanciaTarifa();
- return $this->oTarifa;
- }
- private function instanciaTarifa(){
- if($this->oTarifa == null){
- $this->oTarifa = new reg_DeTarifas($this->id_tarifa);
- }
- }
- /**
- * @return reg_MaResevaciones
- */
- public function setPagado($newval){
- $this->pagado = $newval;
- return $this;
- }
- public function getPagado(){
- return $this->pagado;
- }
- public function tieneTestimonial(){
- return reg_testimonial::tieneTestimonial($this->id);
- }
- public function getFecha_llegada_dt()
- {
- return $this->fecha_llegada_dt;
- }
- public function getFecha_salida_dt()
- {
- return $this->fecha_salida_dt;
- }
- public function getInfo()
- {
- $r = array();
- if ($this->id_tarifa > 0) { // Shuttle o Private
- $this->instanciaTarifa();
- $r['auto'] = $this->oTarifa->getVehiculoStr();
- $r['destino'] = $this->oTarifa->getLugarDestinoStr();
- $r['origen'] = $this->oTarifa->getLugarOrigenStr();
- $r['traslado'] = $this->oTarifa->getTrasladoStr();
- $r['zona'] = $this->oTarifa->getId_zona();
- $r['paquete'] = $this->oTarifa->getStripStr();
- } else { // Special Reservation
- $spec = new reg_DeResevacionesSpecial($this->id);
- $r['paquete'] = 'Special';
- $r['destino'] = $spec->getDestination();
- $r['origen'] = $spec->getPickUpLocation();
- }
- return $r;
- }
- /**
- *
- * @return reg_DeTarifas
- */
- public function getTarifa()
- {
- if ($this->getId_tarifa()) {
- $this->instanciaTarifa();
- return $this->oTarifa;
- }
- return null;
- }
- /**
- *
- * @return reg_DeResevacionesSpecial
- */
- public function getSpecial()
- {
- if (!$this->getId_tarifa()) {
- $special = new reg_DeResevacionesSpecial($this->id);
- return $special;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement