-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavance.php
executable file
·129 lines (104 loc) · 4.77 KB
/
avance.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
<?php require_once('Connections/tecnocomm.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;
}
}
$colname_rsPartidas = "-1";
if (isset($_GET['idip'])) {
$colname_rsPartidas = $_GET['idip'];
}
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_rsPartidas = sprintf("SELECT s.* FROM subcotizacionarticulo s RIGHT JOIN ip i ON s.idsubcotizacion = i.cotizacion WHERE i.idip = %s", GetSQLValueString($colname_rsPartidas, "int"));
$rsPartidas = mysql_query($query_rsPartidas, $tecnocomm) or die(mysql_error());
$row_rsPartidas = mysql_fetch_assoc($rsPartidas);
$totalRows_rsPartidas = mysql_num_rows($rsPartidas);
$colname_rsFechas = "-1";
if (isset($_GET['idip'])) {
$colname_rsFechas = $_GET['idip'];
}
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_rsFechas = sprintf("SELECT fecha FROM proyecto_avance WHERE idproyecto = %s GROUP BY fecha ORDER BY fecha ASC", GetSQLValueString($colname_rsFechas, "int"));
$rsFechas = mysql_query($query_rsFechas, $tecnocomm) or die(mysql_error());
$row_rsFechas = mysql_fetch_assoc($rsFechas);
$totalRows_rsFechas = mysql_num_rows($rsFechas);
$colname_rsAvance = "-1";
if (isset($_GET['idip'])) {
$colname_rsAvance = $_GET['idip'];
}
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_rsAvance = sprintf("SELECT * FROM proyecto_avance WHERE idproyecto = %s ORDER BY fecha ASC", GetSQLValueString($colname_rsSalidas, "int"));
$rsAvance = mysql_query($query_rsAvance, $tecnocomm) or die(mysql_error());
$row_rsAvance = mysql_fetch_assoc($rsAvance);
$totalRows_rsAvance = mysql_num_rows($rsAvance);
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_rsEmpleados = "SELECT * FROM usuarios ORDER BY nombrereal ASC";
$rsEmpleados = mysql_query($query_rsEmpleados, $tecnocomm) or die(mysql_error());
$row_rsEmpleados = mysql_fetch_assoc($rsEmpleados);
$totalRows_rsEmpleados = mysql_num_rows($rsEmpleados);
unset($fechas);
do{
$fechas[]=$row_rsFechas['fecha'];
}while ($row_rsFechas = mysql_fetch_assoc($rsFechas));
do{
$avances[$row_rsAvance['idsubcotizacion']][$row_rsAvance['fecha']] = $row_rsAvance;
}while($row_rsAvance = mysql_fetch_assoc($rsAvance));
unset($suma);
?>
<link href="style2.css" rel="stylesheet" type="text/css" />
<h1>Reporte De Avance</h1>
<?php include("ip.encabezado.php");?>
<div id="distabla">
<form name="salida" method="post" action="index.php?mod=confavance&idip=<?php echo $_GET['idip'];?>">
<table width="100%" class="0" cellpadding="2">
<thead>
<tr><td>Partida</td><td>Descripcion</td><td>Cantidad</td><?php foreach($fechas as $fecha){?><td><?php echo $fecha;?></td><?php }//fin de foreach?><td>Hoy</td>
<td>Instalado/Cotizado</td></tr>
</thead>
<tbody>
<?php do { ?>
<tr>
<td></td>
<td><?php echo substr($row_rsPartidas['descri'],0,25); ?></td>
<td><?php echo $row_rsPartidas['cantidad']; ?></td>
<?php foreach($fechas as $fecha){?> <td><?php echo $avances[$row_rsPartidas['idsubcotizacionarticulo']][$fecha]['cantidad']; $suma[$row_rsPartidas['idsubcotizacionarticulo']] = $suma[$row_rsPartidas['idsubcotizacionarticulo']] +$avances[$row_rsPartidas['idsubcotizacionarticulo']][$fecha]['cantidad'];?></td><?php }//fin de foreach?>
<td><input type="text" size="4" name="cantidad[<?php echo $row_rsPartidas['idsubcotizacionarticulo']; ?>]"></td>
<td><?php echo $suma[$row_rsPartidas['idsubcotizacionarticulo']];?>/<?php echo $row_rsPartidas['cantidad']; ?></td>
</tr>
<?php } while ($row_rsPartidas = mysql_fetch_assoc($rsPartidas)); ?>
</tbody>
</table>
<input type="hidden" name="idip" value="<?php echo $_GET['idip'];?>">
<button type="submit">Aceptar</button>
</form>
</div>
<?php
mysql_free_result($rsPartidas);
mysql_free_result($rsFechas);
mysql_free_result($rsAvance);
mysql_free_result($rsEmpleados);
?>