public function getFile($nFile) { $sql = 'SELECT agencia, nompax, CONVERT(Nvarchar(10), fecha, 103) as fecha, hora, CONVERT(Nvarchar(10), f_viaje, 103) as f_viaje, comag, tcomi, cambio, moneda, totventa, ajuste, (totventa+ajuste) as tot_reserva, vage,ope,totpag,totalco,ciudad,pais ,npax, (convert(varchar,(DATEADD(HOUR,48,GETDATE())),103)+" "+convert(varchar(5),(DATEADD(HOUR,48,GETDATE())),108)) AS LIMITE_PAGO, estado,(convert(varchar,(DATEADD(HOUR,48,GETDATE())),103))as fconsulta,convert(varchar(5),(DATEADD(HOUR,48,GETDATE())),108) as fhora FROM file_ WHERE num_file = "' . $nFile . '"'; //echo $sql; exit; $datos = $this->_db->consulta($sql); if ($this->_db->numRows($datos) > 0) { $objetosFile = array(); $arrayObjFile = $this->_db->fetchAll($datos); foreach ($arrayObjFile as $fileDB) { $objFile = new reservaDTO(); $objFile->setAgencia(trim($fileDB['agencia'])); $objFile->setNomPax(trim($fileDB['nompax'])); $objFile->setNpax(trim($fileDB['npax'])); $objFile->setFecha(trim($fileDB['fecha'])); $objFile->setHora(trim($fileDB['hora'])); $objFile->setFViaje(trim($fileDB['f_viaje'])); $objFile->setComag(trim($fileDB['comag'])); $objFile->setTcomi(intval(trim($fileDB['tcomi']))); $objFile->setCambio(trim($fileDB['cambio'])); $objFile->setMoneda(trim($fileDB['moneda'])); $objFile->setTotVenta(trim($fileDB['totventa'])); $objFile->setAjuste(trim($fileDB['ajuste'])); $objFile->setChora(trim($fileDB['fhora'])); $objFile->setFconsulta(trim($fileDB['fconsulta'])); $objFile->setTotPag(trim($fileDB['totpag'])); $objFile->setTotReserva(trim($fileDB['tot_reserva'])); $objFile->setVage(trim($fileDB['vage'])); $objFile->setOperador(trim($fileDB['ope'])); $objFile->setTotalco(trim($fileDB['totalco'])); $objFile->setEstado(trim($fileDB['estado'])); $objFile->setPais(trim($fileDB['pais'])); $objFile->setCiudad(trim($fileDB['ciudad'])); $sql = 'SELECT piva FROM iva'; $datos = $this->_db->consulta($sql); $iva = $this->_db->fetchAll($datos); if ($fileDB['tcomi'] == 1) { $resultado = $fileDB['comag'] * $iva[0][0]; } else { $resultado = $fileDB['comag']; } if ($fileDB['moneda'] === 'D') { $comision = round($fileDB['totventa'] * ($resultado / 100), 2); } else { $comision = round($fileDB['totventa'] * ($resultado / 100), 0); } $objFile->setComision($comision); $objFile->setHoraLimi(trim($fileDB['LIMITE_PAGO'])); $objetosFile[] = $objFile; } return $objetosFile; } else { return false; } }