Newer
Older
ournorth2021 / admin / views / home.php
LuisOlaya on 8 Apr 2021 7 KB primer
<?php
	$queryAsis = mysqli_query($connect,"SELECT id FROM Asistentes ");
	$queryActv = mysqli_query($connect,"SELECT id FROM Agenda ");
	$querySpe = mysqli_query($connect,"SELECT id FROM Conferencistas ");
	$queryNuevos = mysqli_query($connect,"SELECT id FROM Asistentes WHERE tratamientos = 'on' ");

	$completo = 0;
	$queryPreregistro = mysqli_query($connect,"SELECT * FROM Asistentes WHERE origen = 1 ");
	while($dataPreregistro = mysqli_fetch_array($queryPreregistro)){
		
		if(  $dataPreregistro["tratamientos"] == "on" ){
			$completo ++;
		}
	}


?>

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.js"></script>
<div class="row" style="padding-top: 15px;">
    
    <!-- FICHA -->
	<div class="col-md-12" style="margin-bottom: 20px">
        <div class="card" align="center">
          <div class="card-body">
			<canvas id="canvas" style="width:100%; height:300px"></canvas>
          </div>
        </div>
    </div>

    <!-- FICHA -->
	<div class="col-md-6">
        <table width="100%" style="background-color: #ff5a23; color: #ffffff;">
			<tr>
				<td width="100" style="padding: 15px; background-color: rgba(0,0,0,0.2);">
					<i class="fa fa-user btn-left" style=" font-size: 60px "></i>
				</td>
				<td align="center" style="font-size: 20px; line-height: 35px;">
					Personas totales en bases de datos<br>
					<b style="font-size: 50px;"><?php echo $queryAsis->num_rows; ?></b>
                    <div style="margin-top: 3px; margin-bottom: 3px">
                        <a href="<?php echo $url_admin; ?>/?pg=asistentes">
                            <input type="button" class="btn btn-light btn-sm" value="Detalle">
                        </a>
                    </div>
				</td>
			</tr>
		</table>
    </div>
    
    <!-- FICHA -->
	<div class="col-md-6">
        <table width="100%" style="background-color: #3F51B5; color: #ffffff;">
			<tr>
				<td width="100" style="padding: 15px; background-color: rgba(0,0,0,0.2);">
					<i class="fa fa-address-book btn-left" style=" font-size: 60px "></i>
				</td>
				<td align="center" style="font-size: 20px; line-height: 35px;">
					No. de personas que completaron registro para el evento - leads<br>
					<b style="font-size: 50px;"><?php echo $queryNuevos->num_rows+$completo; ?></b>
                    
                    <div style="margin-top: 3px; margin-bottom: 3px">
                        <a href="<?php echo $url_admin; ?>/?pg=registrados">
                            <input type="button" class="btn btn-light btn-sm" value="Detalle">
                        </a>
                    </div>
				</td>
			</tr>
		</table>
    </div>

    <!-- FICHA -->
	<div class="col-md-12" align="center">
        <h1>Detallado</h1>
    </div>
	
	<!-- FICHA -->
	<div class="col-md-4">
        <table width="100%" style="background-color: #607d8b; color: #ffffff;">
			<tr>
				<td width="100" style="padding: 15px; background-color: rgba(0,0,0,0.2);">
					<i class="fa fa-address-book btn-left" style=" font-size: 60px "></i>
				</td>
				<td align="center" style="line-height: 16px; font-size: 12px;">
					No. de personas de la base de datos que NO completaron registro para el evento - Remarketing<br>
					<b style="font-size: 20px;"><?php echo $queryPreregistro->num_rows - $completo; ?></b> 
                    
                    <div style="margin-top: 3px; margin-bottom: 3px">
                        <a href="<?php echo $url_admin; ?>/?pg=asistentes&fil=1">
                            <input type="button" class="btn btn-light btn-sm" value="Detalle">
                        </a>
                    </div>
				</td>
			</tr>
		</table>
    </div>
    
    <!-- FICHA -->
	<div class="col-md-4">
        <table width="100%" style="background-color: #009688; color: #ffffff;">
			<tr>
				<td width="100" style="padding: 15px; background-color: rgba(0,0,0,0.2);">
					<i class="fa fa-address-book btn-left" style=" font-size: 60px "></i>
				</td>
				<td align="center" style="line-height: 16px; font-size: 12px;">
					No. de personas de la base de datos que completaron registro para el evento - Recurrentes<br>
					<b style="font-size: 20px;"><?php echo $completo; ?></b>
                    <div style="margin-top: 3px; margin-bottom: 3px">
                        <a href="<?php echo $url_admin; ?>/?pg=asistentes&fil=2">
                            <input type="button" class="btn btn-light btn-sm" value="Detalle">
                        </a>
                    </div>
				</td>
			</tr>
		</table>
    </div>

	<!-- FICHA -->
	<div class="col-md-4">
        <table width="100%" style="background-color: #ff9800; color: #ffffff;">
			<tr>
				<td width="100" style="padding: 15px; background-color: rgba(0,0,0,0.2);">
					<i class="fa fa-address-book btn-left" style=" font-size: 60px "></i>
				</td>
				<td align="center" style="line-height: 16px; font-size: 12px;">
					No. de personas nuevas que se registraron para este evento<br>
					<b style="font-size: 20px;"><?php echo $queryNuevos->num_rows; ?></b>
                    <div style="margin-top: 3px; margin-bottom: 3px">
                        <a href="<?php echo $url_admin; ?>/?pg=asistentes&fil=3">
                            <input type="button" class="btn btn-light btn-sm" value="Detalle">
                        </a>
                    </div>
				</td>
			</tr>
		</table>
    </div>
    


	
</div>


<style>
.col-md-4{
	margin-bottom:15px
}

.col-md-6{
	margin-bottom:15px
}

.btn-primary_blue{
	color: #fff;
    background-color: #2196f3;
    border-color: #2196f3;
}

</style>

<?php
$arrayFechas = array();
$arraycantidad = array();
$querySol = mysqli_query($connect,"SELECT COUNT(id),update_at FROM Asistentes WHERE acepto = 'on' GROUP BY DAYOFMONTH(update_at) ORDER BY update_at ASC  ");
while($dataSol = mysqli_fetch_array($querySol)){
    
    $fh = explode(" ", $dataSol["update_at"]);
	array_push($arrayFechas, $fh );
	array_push($arraycantidad, $dataSol["COUNT(id)"] );

}

?>

<script>
	var MONTHS = <?php echo json_encode($arrayFechas) ?>;
	var config = {
			type: 'line',
			data: {
				labels: MONTHS,
				datasets: [{
					label: 'Registros Días',
					backgroundColor: "#03A9F4",
					borderColor: "#035da5",
					data: <?php echo json_encode($arraycantidad) ?>,
					fill: false,
				}]
			},
			options: {
				responsive: true,
				title: {
					display: true,
					text: 'Registrados'
				},
				tooltips: {
					mode: 'index',
					intersect: false,
				},
				hover: {
					mode: 'nearest',
					intersect: true
				},
				scales: {
					x: {
						display: true,
						scaleLabel: {
							display: true,
							labelString: 'Month'
						}
					},
					y: {
						display: true,
						scaleLabel: {
							display: true,
							labelString: 'Value'
						}
					}
				}
			}
	};

	window.onload = function() {
		var ctx = document.getElementById('canvas').getContext('2d');
		window.myLine = new Chart(ctx, config);
	};

</script>