-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathreportes_usuariosa.php
133 lines (115 loc) · 4.48 KB
/
reportes_usuariosa.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php require_once('connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
require_once('header.php');
require_once('pagewidth.php');
if ($_SESSION['tipo'] === '1') {
date_default_timezone_set("America/Bogota");
$hoy = date('Y-m-d');
$numeroSemana = date("W");
// echo $hoy, ' ' ,$numeroSemana;
//aqui meto yo
$año = date(Y);
$mes = date(m);
$numerosemana = date("W");
if ($numerosemana > 0 and $numerosemana < 54) {$numerosemana = $numerosemana;
$primerdiaS = $numerosemana * 7 -7;
$ultimodiaS = $numerosemana * 7 -1;
$principioaño = "$año-01-01";
$principiomes = "$año-$mes-01";
$primerdia = date('Y-m-d', strtotime("$principioaño + $primerdiaS DAY"));
$ultimodia = date('Y-m-d', strtotime ("$principioaño + $ultimodiaS DAY"));
$primerdiames = date('Y-m-d', strtotime("$principiomes"));
if ($fecha2 <= date('Y-m-d', strtotime("$año-12-31"))) {$fecha2 = $fecha2;} else {$fecha2 = date('Y-m-d',strtotime("$año-12-31"));}
//echo 'la semana nº '.$numerosemana.' del año '.$año.', va desde '.$primerdia.' hasta '.$ultimodia.'</br>';} else {echo "este número de semana no es válido";
}
//hasta aqui
mysql_select_db($database_conexion, $conexion);
$query_users = "SELECT * FROM usuarios WHERE tipo = '2'";
$users = mysql_query($query_users, $conexion) or die(mysql_error($conexion));
while($row_users = mysql_fetch_assoc($users)){
$totalRows_users = mysql_num_rows($users);
mysql_select_db($database_conexion, $conexion);
$query_Diario = "SELECT * FROM movimientos WHERE fecha_salida = '$hoy' && usuario_salida = '$row_users[login]'";
$Diario = mysql_query($query_Diario, $conexion) or die(mysql_error());
$row_Diario = mysql_fetch_assoc($Diario);
$totalRows_Diario = mysql_num_rows($Diario);
mysql_select_db($database_conexion, $conexion);
$query_sumatoria = "SELECT sum(valor_cobro) as suma from movimientos WHERE fecha_salida = '$hoy' && usuario_salida = '$row_users[login]'";
$sumatoria = mysql_query($query_sumatoria, $conexion) or die(mysql_error());
$row_sumatoria = mysql_fetch_assoc($sumatoria);
$totalRows_sumatoria = mysql_num_rows($sumatoria);
?>
<section class="row">
<div class="center">
<h1></h1>
<strong class="subHeading">
Reporte Diario </br>
<?php echo date('d/m/Y'); ?> <br />
Usuario: <?php echo $row_users['nombres']; ?>
</strong>
<table class="center" border="1" cellpadding="1" cellspacing="1">
<tr>
<td><strong>ID</strong></td>
<td><strong>PLACA </strong></td>
<td><strong>TIPO</strong></td>
<td><strong>FECHA LLEGADA</strong></td>
<td><strong>HORA LLEGADA</strong></td>
<td><strong>FECHA SALIDA</strong></td>
<td><strong>HORA SALIDA</strong></td>
<td><strong>TRANSCURRIDO</strong></td>
<td><strong>VALOR cobro</strong></td>
<td><strong>CLIENTE</strong></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Diario['id']; ?></td>
<td><?php echo $row_Diario['placa']; ?></td>
<td><?php echo $row_Diario['tipo']; ?></td>
<td><?php echo $row_Diario['fecha_llegada']; ?></td>
<td><?php echo $row_Diario['hora_llegada']; ?></td>
<td><?php echo $row_Diario['fecha_salida']; ?></td>
<td><?php echo $row_Diario['hora_salida']; ?></td>
<td><?php echo $row_Diario['transcurrido']; ?></td>
<td><?php echo $row_Diario['valor_cobro']; ?></td>
<td><?php echo $row_Diario['cliente']; ?></td>
</tr>
<?php } while ($row_Diario = mysql_fetch_assoc($Diario)); ?>
</table>
<section class="row">
<strong>Total Dia:</strong> <?php echo "<strong>".$row_sumatoria['suma']."</strong>";?>
</section>
</div>
</section>
<?php
}
}
require_once('footer.php');
?>