Пример #1
0
function getSongURL($song, $type)
{
    $url = '';
    if ($song && $song->lMusic && $song->lMusic->dfsId) {
        switch ($type) {
            case "l":
                $dfsId = strval($song->lMusic->dfsId);
                break;
            case "m":
                $dfsId = strval($song->mMusic->dfsId);
                break;
            case "h":
                $dfsId = strval($song->hMusic->dfsId);
                break;
            default:
                $dfsId = strval($song->lMusic->dfsId);
                break;
        }
        $url = sprintf("http://m%s.music.126.net/%s/%s.mp3", rand(1, 2), decryptId($dfsId), $dfsId);
    }
    return $url;
}
Пример #2
0
function generarFactura($reserva, $hotel, $negativo = false)
{
    try {
        global $template_dir;
        global $template_url;
        global $app_dir;
        global $smarty;
        $campania = getCampania($hotel->campaniaId);
        $reserva->id = decryptId($reserva->id);
        if ($negativo) {
            $factura = getFacturaByIdReserva($reserva->id);
            if ($factura) {
                $negativo = $factura->id;
                $numeroFactura = 'R-' . $factura->numero;
            } else {
                return false;
            }
        } else {
            $count = DAOFactory::getFacturaDAO()->countByYear(intval(date('Y')), $campania->localizador);
            $count = '' . $count[0][0];
            $count++;
            while (strlen($count) < 4) {
                $count = '0' . $count;
            }
            $numeroFactura = $count . '-' . $campania->localizador . '-' . date('Y');
        }
        insertFactura($hotel->id, array($reserva->id), "cobrado", $negativo);
        $smarty->assign('numero', $numeroFactura);
        $smarty->assign('reserva', $reserva);
        $smarty->assign('hotel', $hotel);
        $smarty->assign('negativo', $negativo);
        $content = $smarty->fetch('reserva_factura.tpl');
        $filename = $app_dir . '/cache/factura_' . time() . '.pdf';
        Html2PdfWriter::write($content, $filename);
        return $filename;
    } catch (Exception $e) {
        print_r($e);
        return false;
    }
}
Пример #3
0
<?php

$reserva = getReserva(decryptId($_GET['id']));
if (!$reserva) {
    header('Location:' . $base_url);
} else {
    $reserva->id = $_GET['id'];
    $hotel = getHotelById($reserva->hotelId);
    $smarty->assign('hotel', $hotel);
    if ($reserva->alojamiento && count($reserva->alojamiento)) {
        $apartamento = $reserva->alojamiento[0];
    } else {
        $apartamento = NULL;
    }
    $smarty->assign('id', $_GET['id']);
    $smarty->assign('usuario', $usuario);
    $smarty->assign('apartamento', $apartamento);
    $smarty->assign('cart', $reserva->cart);
    $usuario = getUsuario($reserva->usuarioId);
    $smarty->assign('usuario', $usuario);
    $smarty->assign('reserva', $reserva);
    $inicio = $apartamento->inicio;
    $salida = $apartamento->final;
    $time_inicio = strtotime($inicio);
    $time_salida = strtotime($salida);
    $noches = ceil(($time_salida - $time_inicio) / (24 * 60 * 60));
    $inicio = date('l, d-F-Y', strtotime($inicio));
    $salida = date('l, d-F-Y', strtotime($salida));
    $smarty->assign('inicio', $inicio);
    $smarty->assign('salida', $salida);
    $smarty->assign('noches', $noches);
Пример #4
0
function getHotelIdByLoginCode($loginCode)
{
    try {
        $arr_loginCode = explode('-', $loginCode);
        $id = decryptId($arr_loginCode[0]);
        $Y = decryptId($arr_loginCode[1]);
        $m = decryptId($arr_loginCode[2]);
        $d = decryptId($arr_loginCode[3]);
        $hotel = DAOFactory::getHotelDAO()->load($id);
        if (strtotime(date('Y-m-d', strtotime($hotel->tiempoCreacion))) == strtotime("{$Y}-{$m}-{$d}")) {
            return $id;
        }
        return false;
    } catch (Exception $e) {
        return false;
    }
}
Пример #5
0
<?php

if (isset($_REQUEST['login_code']) && isset($_REQUEST['fcode'])) {
    $login_code = $_REQUEST['login_code'];
    $fcode = $_REQUEST['fcode'];
    $hotelId = getHotelIdByLoginCode($login_code);
    $factura = getFactura(decryptId($fcode));
    if ($hotelId && $factura && $factura->hotelId == $hotelId) {
        $moneda = 'EUR';
        $reservas = $factura->reservas;
        if (count($reservas)) {
            $hotel = getHotelById($hotelId);
            $hotel->empresa = getEmpresaById($hotel->empresaId);
            $totalFacturado = $factura->total;
            $totalComisiones = $factura->comision;
            $smarty->assign('factura', $factura);
            $smarty->assign('hotel', $hotel);
            $smarty->assign('reservas', $reservas);
            $reserva = $reservas[0];
            $smarty->assign('cliente', $reserva->usuario);
            $smarty->assign('totalFacturado', $totalFacturado);
            $smarty->assign('totalComisiones', $totalComisiones);
            $smarty->assign('backUrl', $base_url);
            if ($factura->cliente == 'hotel') {
                $smarty->display('admin/factura1.tpl');
            } else {
                $smarty->display('admin/factura_cliente.tpl');
            }
        } else {
            // header('Location:' . $base_url . '/admin-login');
        }
Пример #6
0
            $subject = 'Reserva en ' . $smarty->getConfigVariable('sistema_nombre') . ' [contrato ' . $campania->localizador . ']';
        } else {
            $subject = 'Reserva en ' . $smarty->getConfigVariable('sistema_nombre') . '';
        }
        foreach ($emails as $email) {
            if (strlen(trim($email)) > 0) {
                $enviado = $mail->send_email($email, $subject, $body);
            }
        }
    } else {
        $result['data'] = 'Hay errores en los datos. Revíselos por favor.';
    }
}
if (strcmp($action, 'cancelar') == 0) {
    if (isset($_POST['id'])) {
        $id = decryptId($_POST['id']);
        $estado = 'Cancelada por el cliente';
        $r = cambiarEstadoReserva($id, $estado);
        if ($r) {
            $result['msg'] = 'ok';
            $result['data'] = 'La reserva fue cancelada';
            try {
                $reservacion = getReserva($id);
                /** cancelar excursiones **/
                /*
                                if($reservacion->extras) {
                                    foreach ($reservacion->extras as $excursion) {
                                        set_time_limit(0);
                                        $distribuidor = getParametrosVikaByHotelId($reservacion->hotelId);
                                        $params_ws = array_merge($distribuidor, array());
                                        $params_ws['codigo'] = $excursion->localizador;