-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuscarPartida.php
executable file
·269 lines (242 loc) · 11.2 KB
/
buscarPartida.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?php require_once('Connections/tecnocomm.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "systemFail.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_RsArticulos = 30;
$pageNum_RsArticulos = 0;
if (isset($_GET['pageNum_RsArticulos'])) {
$pageNum_RsArticulos = $_GET['pageNum_RsArticulos'];
}
$startRow_RsArticulos = $pageNum_RsArticulos * $maxRows_RsArticulos;
$consulta=0;
$sql="";
if(isset($_GET['buscar']) and ($_GET['buscar']!="")){
$sql.=" descri like ".GetSQLValueString("%".$_GET['buscar']."%","text");
$sql.=" OR marca like ".GetSQLValueString("%".$_GET['buscar']."%","text");
$consulta++;
}
if ($consulta>0){
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_RsArticulos = "SELECT * FROM subcotizacionarticulo where ".$_GET['idsub'].$sql." ORDER BY descri";
$query_limit_RsArticulos = sprintf("%s LIMIT %d, %d", $query_RsArticulos, $startRow_RsArticulos, $maxRows_RsArticulos);
$RsArticulos = mysql_query($query_limit_RsArticulos, $tecnocomm) or die(mysql_error());
$row_RsArticulos = mysql_fetch_assoc($RsArticulos);
$totalRows_RsArticulos = mysql_num_rows($RsArticulos);
}
else{
mysql_select_db($database_tecnocomm, $tecnocomm);
$query_RsArticulos = "SELECT * FROM subcotizacionarticulo where idsubcotizacion=".$_GET['idsub']." ORDER BY descri";
$query_limit_RsArticulos = sprintf("%s LIMIT %d, %d", $query_RsArticulos, $startRow_RsArticulos, $maxRows_RsArticulos);
$RsArticulos = mysql_query($query_limit_RsArticulos, $tecnocomm) or die(mysql_error());
$row_RsArticulos = mysql_fetch_assoc($RsArticulos);
}
if (isset($_GET['totalRows_RsArticulos'])) {
$totalRows_RsArticulos = $_GET['totalRows_RsArticulos'];
} else {
$all_RsArticulos = mysql_query($query_RsArticulos);
$totalRows_RsArticulos = mysql_num_rows($all_RsArticulos);
}
$totalPages_RsArticulos = ceil($totalRows_RsArticulos/$maxRows_RsArticulos)-1;
$queryString_RsArticulos = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_RsArticulos") == false &&
stristr($param, "totalRows_RsArticulos") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_RsArticulos = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_RsArticulos = sprintf("&totalRows_RsArticulos=%d%s", $totalRows_RsArticulos, $queryString_RsArticulos);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/funciones.js"></script>
<style type="text/css">
<!--
.Estilo1 {
color: #FFFFFF;
font-size: 17px;
}
-->
</style>
</head>
<body class="wrapper" onload = "document.forms[0].buscar.focus()">
<form id="form1" name="form1" method="get" action="">
<table width="1036" border="0" align="center">
<tr class="titulos">
<td colspan="6" align="center" class="Estilo1" >AGREGAR ARTICULOS A SALIDA DE MATERIAL</td>
</tr>
<tr>
<td width="100"> </td>
<td colspan="2"> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td colspan="2">BUSCAR :
<input name="buscar" type="text" class="form" id="buscar" value="<?php echo $_GET['buscar'];?>" size="50" />
<input type="submit" name="button" id="button" value="Buscar" /></td>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td colspan="5" align="center"><label></label></td>
</tr>
<tr>
<td align="center"><label>
<input type="button" name="Submit" value="cerrar" onclick="window.location='close.php'" />
</label></td>
<td colspan="2"> </td>
<td colspan="3" align="center"></td>
</tr>
<tr>
<td> </td>
<td colspan="5" align="center"><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, 0, $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos > 0) { // Show if not first page ?>
<img src="images/First.gif" alt="primera" width="24" height="24" border="0" />
<?php } // Show if not first page ?>
</a><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, max(0, $pageNum_RsArticulos - 1), $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos > 0) { // Show if not first page ?>
<img src="images/Back.gif" alt="atras" width="24" height="24" border="0" />
<?php } // Show if not first page ?>
</a><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, min($totalPages_RsArticulos, $pageNum_RsArticulos + 1), $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos < $totalPages_RsArticulos) { // Show if not last page ?>
<img src="images/Forward.gif" alt="siguiente" width="24" height="24" border="0" />
<?php } // Show if not last page ?>
</a><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, $totalPages_RsArticulos, $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos < $totalPages_RsArticulos) { // Show if not last page ?>
<img src="images/Last.gif" alt="ultima" width="24" height="24" border="0" />
<?php } // Show if not last page ?>
</a></td>
</tr>
<?php if ($totalRows_RsArticulos > 0) { // Show if recordset not empty ?>
<tr class="titleTabla">
<td colspan="3" align="center">DESCRIPCION</td>
<td width="103" align="center">MARCA</td>
<td width="107" align="center">CANTIDAD</td>
<td width="107" align="center">OPCIONES</td>
</tr>
<?php } // Show if recordset not empty ?>
<tr>
<td colspan="6"> </td>
</tr>
<?php do { ?>
<tr onmouseover="
this.style.backgroundColor = '#E2EBF4';" onmouseout="this.style.backgroundColor = '';">
<td colspan="3"><?php echo $row_RsArticulos['descri']; ?></td>
<td align="center"><?php echo $row_RsArticulos['marca1']; ?></td>
<td align="center"><?php echo $row_RsArticulos['cantidad']; ?></td>
<td align="center"><?php if ($totalRows_RsArticulos > 0) { // Show if recordset not empty ?>
<a href="agregarPartidaSalida.php?id=<?php echo $row_RsArticulos['idsubcotizacionarticulo']; ?>&idsalida=<?php echo $_GET['idsalida'];?>" onclick="NewWindow(this.href,'Agregar articulo','600','500','no');return false"> <img src="images/Checkmark.png" alt="agregar" border="0" title="AGREGAR ARTICULO A SALIDA" /></a>
<?php } // Show if recordset not empty ?></td>
</tr>
<?php } while ($row_RsArticulos = mysql_fetch_assoc($RsArticulos)); ?>
<?php if ($totalRows_RsArticulos == 0) { // Show if recordset empty ?>
<tr>
<td colspan="6" align="center">NO SE ENCONTRARON REGISTROS</td>
</tr> <?php } // Show if recordset empty ?>
<tr>
<td colspan="6" align="center"> </td>
</tr>
<tr>
<td colspan="6" align="center"><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, 0, $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos > 0) { // Show if not first page ?>
<img src="images/First.gif" alt="primera" width="24" height="24" border="0" />
<?php } // Show if not first page ?>
</a><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, max(0, $pageNum_RsArticulos - 1), $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos > 0) { // Show if not first page ?>
<img src="images/Back.gif" alt="atras" width="24" height="24" border="0" />
<?php } // Show if not first page ?>
</a><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, min($totalPages_RsArticulos, $pageNum_RsArticulos + 1), $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos < $totalPages_RsArticulos) { // Show if not last page ?>
<img src="images/Forward.gif" alt="siguiente" width="24" height="24" border="0" />
<?php } // Show if not last page ?>
</a><a href="<?php printf("%s?pageNum_RsArticulos=%d%s", $currentPage, $totalPages_RsArticulos, $queryString_RsArticulos); ?>">
<?php if ($pageNum_RsArticulos < $totalPages_RsArticulos) { // Show if not last page ?>
<img src="images/Last.gif" alt="ultima" width="24" height="24" border="0" />
<?php } // Show if not last page ?>
</a></td>
</tr>
</table>
<input type="hidden" name="idsub" value="<?php echo $_GET['idsub'];?>"/>
</form>
</body>
</html>
<?php
mysql_free_result($RsArticulos);
?>