Ejemplo n.º 1
0
 public function getDetFile($nFile)
 {
     $sql = 'SELECT num_file, det_file.codigo, det_file.nombre, CONVERT(Nvarchar(10), in_, 103) as in_, CONVERT(Nvarchar(10), ' . 'out, 103) as out, pax_s, pax_d, pax_t, pax_q, pax_c, pax_c2, pax_a, pax_i, pax_ca,' . '( select sum(noches) from det_file WHERE num_file =' . $nFile . ' AND NOT(codigo ="CGO") and codigo="HTL" ) as noches ,' . 'CONVERT(Nvarchar(10),(select TOP 1 out FROM det_file WHERE num_file = ' . $nFile . ' AND NOT(codigo = "CGO") and codigo="HTL" ORDER BY out DESC),103) as fecha_salida,' . '(select cod_pak FROM det_file WHERE num_file =' . $nFile . ' AND NOT(codigo = "CGO") and codigo="HTL" and cod_pak <> "")as cod_pak,palimt.nombre as planali, tipoh.nombre as tipoHa,det_file.codser  ' . 'FROM det_file ' . 'left join palimt on palimt.codigo =det_file.pa left join tipoh on tipoh.codigo = det_file.tipoh ' . 'WHERE num_file = "' . $nFile . '" AND NOT(det_file.codigo = "CGO") ' . 'ORDER BY lin ASC ';
     //echo $sql;exit;
     $datos = $this->_db->consulta($sql);
     if ($this->_db->numRows($datos) > 0) {
         $objetosDetFile = array();
         $arrayDetFile = $this->_db->fetchAll($datos);
         foreach ($arrayDetFile as $dfDB) {
             $objDF = new detalleReservaDTO();
             $objDF->setFile(trim($dfDB['num_file']));
             $objDF->setCodigo(trim($dfDB['codigo']));
             $objDF->setNombre(trim($dfDB['nombre']));
             $objDF->setIN(trim($dfDB['in_']));
             $objDF->setOut(trim($dfDB['out']));
             $objDF->setPaxS(intval(trim($dfDB['pax_s'])));
             $objDF->setPaxD(intval(trim($dfDB['pax_d'])));
             $objDF->setPaxT(intval(trim($dfDB['pax_t'])));
             $objDF->setPaxQ(intval(trim($dfDB['pax_q'])));
             $objDF->setPaxC1(intval(trim($dfDB['pax_c'])));
             $objDF->setPaxC2(intval(trim($dfDB['pax_c2'])));
             $objDF->setPaxA(intval(trim($dfDB['pax_a'])));
             $objDF->setPaxI(intval(trim($dfDB['pax_i'])));
             $objDF->setPaxCA(intval(trim($dfDB['pax_ca'])));
             $objDF->setNoches(intval(trim($dfDB['noches'])));
             $objDF->setFecha(trim($dfDB['fecha_salida']));
             $objDF->setTipoH(trim($dfDB['tipoHa']));
             $objDF->setPa(trim($dfDB['planali']));
             $objDF->setCodser('');
             $objDF->setDirHotel('');
             $objDF->setPoliticas('');
             $objDF->setTelefono('');
             $objDF->setNombre_hotel('');
             $objDF->setHora_chekin('');
             $objDF->setHora_chekout('');
             if (trim($dfDB['codigo']) == 'HTL') {
                 $sql = 'SELECT hotel,direc,fono FROM hotel WHERE codigo ="' . trim($dfDB['codser']) . '"';
                 $datos = $this->_db->consulta($sql);
                 $n = $this->_db->fetchAll($datos);
                 $objDF->setDirHotel(trim($n[0]['direc']));
                 $objDF->setTelefono(trim($n[0]['fono']));
                 $objDF->setNombre_hotel(trim($n[0]['hotel']));
                 $single = $dfDB['pax_s'];
                 $doble = $dfDB['pax_d'] / 2;
                 $triple = $dfDB['pax_t'] / 3;
                 $qua = $dfDB['pax_q'] / 4;
                 $dep = $dfDB['pax_q'];
                 $habitaciones = $single + $doble + $triple + $qua + $dep;
                 $objDF->setCodser(trim($dfDB['codser']));
                 $objDF->setHabitacion($habitaciones);
                 $objDF->setHora_chekin('00:00');
                 $objDF->setHora_chekout('00:00');
                 if (trim($dfDB['cod_pak'])) {
                     $sql = 'SELECT nombre FROM packages WHERE codigo ="' . trim($dfDB['cod_pak']) . '"';
                     $datos = $this->_db->consulta($sql);
                     $n = $this->_db->fetchAll($datos);
                     $objDF->setNombreProg($n[0][0]);
                 } else {
                     $objDF->setNombreProg(trim($dfDB['nombre']));
                 }
             }
             $objetosDetFile[] = $objDF;
         }
         return $objetosDetFile;
     } else {
         return false;
     }
 }