public function getTcambio($atipo = '') { if ($atipo == '') { $sql = "SELECT TOP 1 cambio FROM tcambio WHERE getdate() between fechad AND fechah"; } else { $sql = "SELECT TOP 1 cambio FROM tcambio WHERE getdate() between fechad AND fechah and atipoa='{$atipo}'"; } $datos = $this->_db->consulta($sql); if ($this->_db->numRows($datos) > 0) { $userArray = $this->_db->fetchAll($datos); $objusuario = new usuarioDTO(); foreach ($userArray as $usdb) { $objusuario->setTipoCambio(trim($usdb['cambio'])); } return $objusuario; } else { $objusuario = new usuarioDTO(); $objusuario->setTipoCambio(0); return $objusuario; } }