-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavance.confirmar.php
executable file
·102 lines (79 loc) · 3.34 KB
/
avance.confirmar.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
<?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;
}
}
if(isset($_POST['guardar']) && $_POST['guardar'] == true){
foreach($_POST['cantidad'] as $kcant => $cant)if($cant > 0){
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_insert = sprintf("INSERT INTO proyecto_avance(idproyecto,reporta,cantidad,fecha,hora,idsubcotizacion) VALUES(%s,%s,%s,NOW(),NOW(),%s)",GetSQLValueString($_POST['idip'],"int"),GetSQLValueString($_SESSION['MM_Userid'],"int"),GetSQLValueString($cant,"int"),GetSQLValueString($kcant,"int"));
$result = mysql_query($query_insert,$tecnocomm)or die(mysql_error());
}
}
$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);
do{
$partidas[$row_rsPartidas['idsubcotizacionarticulo']] = $row_rsPartidas;
}while($row_rsPartidas = mysql_fetch_assoc($rsPartidas));
?>
<h1>Confirmar Avance</h1>
<h2>Proyecto: <?php echo $_GET['idip'];?></h2>
<div id="distabla">
<form name="salida" method="post" action="index.php?mod=confavance">
<table width="100%" class="0" cellpadding="2">
<thead>
<tr><td>Partida</td><td>Descripcion</td><td>Cantidad Cotizada</td>
<td>Reporte Instalacion Hoy</td></tr>
</thead>
<tbody>
<?php foreach($_POST['cantidad'] as $kcant => $cant)if($cant > 0){?>
<tr>
<td></td>
<td><?php echo $partidas[$kcant]['descri']; ?></td>
<td><?php echo $partidas[$kcant]['cantidad']; ?></td>
<td><?php echo $cant; ?><input type="hidden" name="cantidad[<?php echo $partidas[$kcant]['idsubcotizacionarticulo']; ?>]" value="<?php echo $cant;?>"></td>
</tr>
<?php }//enforeach ?>
</tbody>
</table>
<input type="hidden" name="idip" value="<?php echo $_GET['idip'];?>">
<input type="hidden" name="guardar" value="true">
<button type="submit">Guadar</button>
</form>
</div>
<?php
mysql_free_result($rsPartidas);
mysql_free_result($rsEmpleados);
?>