예제 #1
0
파일: index.php 프로젝트: raulalkla/APW
        if ($_SESSION["carro"][$i]["idAtraccio"] == $_GET["idcompra"]) {
            $_SESSION["carro"][$i]["quantitat"] = $_SESSION["carro"][$i]["quantitat"] + 1;
            $nuevaCompra = false;
        }
    }
    if ($nuevaCompra) {
        if ($_GET[dsc] == 1) {
            $precio = $atraccions->getPreuByID($_GET["idcompra"]) - $atraccions->getPreuByID($_GET["idcompra"]) * 0.1;
        } else {
            $precio = $atraccions->getPreuByID($_GET["idcompra"]);
        }
        //  echo $precio;
        $carro[$num]["preu"] = $precio;
        $carro[$num]["quantitat"] = 1;
        $carro[$num]["idAtraccio"] = $_GET["idcompra"];
        $carro[$num]["nomAtraccio"] = $atraccions->getNomAtraccionByID($_GET["idcompra"]);
        $_SESSION["carro"] = $carro;
    }
}
if ($_GET["comprar"]) {
    $num = sizeof($_SESSION["carro"]);
    $lp = new LiniaPedido();
    for ($i = 0; $i < $num; $i++) {
        $resul = $lp->insertLinea($_SESSION["carro"][$i]["preu"] * $_GET["quant{$i}"], $_GET["quant{$i}"], $_SESSION["carro"][$i]["idAtraccio"], $_SESSION["idUsuario"]);
        if (!$resul) {
            echo "Error en la compra!";
        }
    }
    unset($_SESSION["carro"]);
}
?>
예제 #2
0
파일: compres.php 프로젝트: raulalkla/APW
        <?php 
$result = $histCompres->getHistoricCompres($_SESSION[idUsuario]);
if (mysql_num_rows($result) > 0) {
    ?>
        <table border=0 class='hovertable'>
                <tr>
                    <td><b>Atracción</b></td>
                    <td><b>Fecha</b></td>
                    <td><b>Precio</b></td>
                    <td><b>Cantidad</b></td>
                </tr>
                <?php 
    for ($i = 0; $i < mysql_num_rows($result); $i++) {
        $resultLiniaPedido = $liniaPedido->getLiniesPedido(mysql_result($result, $i, 2));
        echo "<tr onmouseover=\"this.style.backgroundColor='#ffff66';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\">";
        $nomAtraccio = $atraccions->getNomAtraccionByID(mysql_result($resultLiniaPedido, 0, 4));
        echo "<td style='text-align:center'>" . $nomAtraccio . "</td>";
        echo "<td style='text-align:center'>" . mysql_result($resultLiniaPedido, 0, 2) . "</td>";
        echo "<td style='text-align:center'>" . mysql_result($resultLiniaPedido, 0, 1) . "</td>";
        echo "<td style='text-align:center'>" . mysql_result($resultLiniaPedido, 0, 3) . "</td>";
        echo "</tr>";
    }
    ?>
               </table>
        <?php 
} else {
    echo "<p>No hay compras realizadas</p>";
}
?>
        
    </body>
예제 #3
0
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Social Travel</title>
        <link rel="stylesheet" href="../css/estil.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8"/>
        
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        
        <script type="text/javascript">
            google.load("visualization", "1", {packages:["corechart"]});
            google.setOnLoadCallback(drawChart);
            function drawChart() {
                var data = google.visualization.arrayToDataTable([
                ['Atraccion', 'Num. Ventas'],
                <?php 
                for($i = 0; $i < $lComanda->getNumVentasDiarias(); $i++){
                    echo "['".$atraccio->getNomAtraccionByID($lComanda->getIdAtraccioVentasDiarias($i))."', ".$lComanda->getCantitatVentasDiarias($i)." ]";
                    if($i < $lComanda->getNumVentasDiarias()) echo ",";
                }
                ?>
                ]);

                var options = {
                hAxis: {title: 'Atraccion', titleTextStyle: {color: 'red'}}
                };

                //var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
                var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
                chart.draw(data, options);
            }
        </script>