summaryrefslogtreecommitdiffstatsabout
path: root/proveedores0.php
blob: fb83a0d5c2617cbd4e13944bbf60633ad27364f7 (plain)
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
<?
    /*  
  
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
	
	Autores: Pedro Obregón Mejías
			 Rubén D. Mancera Morán
	Versión: 1.0
	Fecha Liberación del código: 13/07/2004
	Galopín para gnuLinEx 2004 -- Extremadura		 
	
	*/

?>
<html>
<head>
<title>Galopin v1.0</title>
<link href="estilo.css" rel="stylesheet" type="text/css">
<script>
var miPopup
function abreVentana(){
	miPopup = window.open("buscarproveedor.php","miwin","width=600,height=400,scrollbars=yes")
	miPopup.focus()
	}
</script>
</head>
<? include ("conectar.php");  
   include ("convertirfechas2.php");?>
<body>
<img src="images/nuevas/administracionalbaranesprov.jpg" alt="Administración de Albaranes de Proveedor"><br>
<br>

<form name="form1" method="post" action="proveedores0.php">
  <? if ($ini==1) {
     $error=0;
	 include ("controlfecha1.php"); }
	 if ($error==1) {
	 print $errores; } ?>
  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#0066FF">
    <tr> 
      <td width="33%" class="primeralineaizquierda">C&oacute;digo 
        de proveedor:</td>
      <td colspan="2"> 
	  <? if ($ini==0) { ?>
	    <input name="codigo" type="text" id="codigo" size="10" maxlength="10"> 
	  <? } else { ?>
	  <input name="codigo" type="text" id="nombre" size="10" maxlength="10" value="<? echo $codigo; ?>"> 
	  <? } ?>
	  <a href="#"><img src="images/lupa.jpg" alt="Buscar Proveedor" width="17" height="17" border="0" onclick="abreVentana()"></a></td>
      </td>
    </tr>
    <tr> 
      <td class="primeralineaizquierda">C&oacute;digo 
        de albar&aacute;n:</td>
      <td>
	  <? if ($ini==0) { ?>
	  <input name="albaran" type="text" id="albaran" size="12" maxlength="12">
	  <? } else { ?>
	  <input name="albaran" type="text" id="albaran" size="12" maxlength="12" value="<? echo $albaran; ?>">
	  <? } ?>
    </td></tr>
    <tr> 
      <td class="primeralineaizquierda">Fecha del 
        albar&aacute;n:</td>
      <td colspan="2">Desde 
	  <? if ($ini==0) { ?>
        <input name="fecha1" type="text" id="fecha1" size="10" maxlength="10">
		<? } else { ?>
		<input name="fecha1" type="text" id="fecha1" size="10" maxlength="10" value="<? echo $fecha1; ?>">
		<? } ?>
        hasta 
		<? if ($ini==0) { ?>
        <input name="fecha2" type="text" id="fecha2" size="10" maxlength="10">
		<? } else { ?>
		<input name="fecha2" type="text" id="fecha2" size="10" maxlength="10" value="<? echo $fecha2; ?>">
		<? } ?>
    </td></tr>
	 <tr> 
      <td class="primeralineaizquierda"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Ordenar 
        resultados por:</font></td>
		<? if ($ini==0) { ?>
      <td width="25%"><select name="campo" size="1">
          <option selected value="codalbaran">Cod. Albarán</option>
          <option value="fecha">Fecha</option>
          <option value="nombre">Proveedor</option>
        </select></td>
      <td width="42%"><input name="ordenacion" type="radio" value="desc" checked>Descendente
	  <input name="ordenacion" type="radio" value="asc">Ascendente</td>
	  <? }  
	  if ($ini==1) { 
	     if ($campo=="codalbaran") { ?>
		 <td width="25%"><select name="campo" size="1"><option selected value="codalbaran">Cod. Albaran</option>
          <option value="fecha">Fecha</option>
          <option value="nombre">Proveedor</option></select></td>
		  <? } else { 
		  if ($campo=="fecha") { ?>
		  <td width="25%"><select name="campo" size="1"><option  value="codalbaran">Cod. Albarán</option>
          <option selected value="fecha">Fecha</option>
          <option value="nombre">Proveedor</option></select></td>
		  <? } else { ?>
		   <td width="25%"><select name="campo" size="1"><option  value="codalbaran">Cod. Albarán</option>
          <option  value="fecha">Fecha</option>
          <option selected value="nombre">Proveedor</option></select></td>
		  <? } } ?>
		  <? if ($ordenacion=="desc") { ?>
		  <td width="42%"><input name="ordenacion" type="radio" value="desc" checked>Descendente
	  <input name="ordenacion" type="radio" value="asc">Ascendente</td>
		  <? } else { ?>
		  <td width="42%"><input name="ordenacion" type="radio" value="desc">Descendente
	  <input name="ordenacion" type="radio" value="asc" checked>Ascendente</td>
		  <? } ?>
	  
	  <? } ?>
    </tr>
    <tr> 
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr> 
      <td colspan="3"><div align="center"> 
          <input type="submit" name="Submit" value="Buscar albaranes">
		  <input type="hidden" name="ini" value="1">
      </div></td>
    </tr>
  </table>
</form>
<center>
	 <form action="insertar_nuevo_albaranp.php" method="post">
        <input name="submit" type="submit" value="Insertar nuevo albarán">
     </form>
</center> 
 <? if ($ini==1) {
 
      $consulta = "Select albaranesp.*,nombre from albaranesp,proveedores";
	  $consulta2 = " where albaranesp.codproveedor=proveedores.codproveedor and codfactura = '0'";
	 include ("cascadaalbaranesp.php");
	 $consulta = $consulta . " " . "order by ".$campo." ".$ordenacion." ";
     $resultado = mysql_query($consulta, $conexion);
     $filas=mysql_num_rows($resultado);
	 if (empty($numi)) { $numi=0; }
	 print "<center><font size=2 face='Verdana, Arial, Helvetica, sans-serif'>Número de albaranes " . $filas . "</font></center>";
	 $consulta=$consulta." limit $numi,10";
	 $resultado = mysql_query($consulta, $conexion);
	 $enlaces=$filas;
   ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr bgcolor="#cddfed"> 
    <td width="11%" class="primeralinea">Cod. Albar&aacute;n</td>
    <td width="28%" class="primeralinea">Proveedor</td>
    <td width="14%" class="primeralinea">Fecha</td>
    <td width="9%" class="primeralinea">Ver albar&aacute;n</td>
    <td width="10%" class="primeralinea">Modificar</td>
    <td width="15%" class="primeralinea">Convertir factura</td>
  </tr>
  <? while ($lafila=mysql_fetch_array($resultado)) { ?>
  <tr> 
    <? 
     $fech=$lafila["fecha"]; 
	 $fech=reconversion($fech);
	 $codcli=$lafila["codproveedor"]; 
	 $consulta1 = "select nombre from proveedores where codproveedor = '$codcli'";
     $resultado1 = mysql_query($consulta1, $conexion);
     $lafila1=mysql_fetch_array($resultado1); ?>
    <td class="segundalinea"><font color="#FF0000"><b><? echo $lafila["codalbaran"]; ?></b></font></td>
    <td class="segundalineaizquierda"><font color="#FF0000"><? echo $lafila1["nombre"]; ?></font></td>
    <td class="segundalinea"><? echo $fech; ?></td>
    <td class="segundalinea">
    <form name="form2" method="post" action="vista_albaranp.php">
      <center><input type="submit" name="Submit2" value="Ver albar&aacute;n"></center>
     </td>
      <input type="hidden" name="codalbaran" value="<? echo $lafila["codalbaran"]; ?>">
      <input type="hidden" name="codcli" value="<? echo $codcli; ?>">
    </form>
	<td class="segundalinea">
    <form name="form3" method="post" action="modificar_albaranp.php">
      <center><input type="submit" name="Submit2" value="Modificar"></center></td>
      <input type="hidden" name="codalba" value="<? echo $lafila["codalbaran"]; ?>">
      <input type="hidden" name="codcli" value="<? echo $codcli; ?>">
      <input type="hidden" name="ini" value="0">
    </form>
	<td class="segundalinea">
    <form name="form4" method="post" action="convertir_albaranp.php">
      <center><input type="submit" name="Submit2" value="Convertir"></center></td>
      <input type="hidden" name="codalba" value="<? echo $lafila["codalbaran"]; ?>">
      <input type="hidden" name="codcli" value="<? echo $codcli; ?>">
      <input type="hidden" name="ini" value="0">
    </form>
  </tr>
  <? } ?>
</table> 
  <? } 
  if ($enlaces>10) {
  $i=0;
  $j=1; 
  print "<center><font size=2 face='Verdana, Arial, Helvetica, sans-serif'>Páginas: ";
  while ($i<$enlaces) { ?>
      <a href="proveedores0.php?fecha1=<? echo reconversion($fecha1); ?>&fecha2=<? echo reconversion($fecha2); ?>&campo=<? echo $campo; ?>&ordenacion=<? echo $ordenacion; ?>&codigo=<? echo $codigo; ?>&ini=1&numi=<? echo $i; ?>"><? echo $j; ?></a>
 <? $j++; 
 $i=$i+10; }
 }
    @mysql_free_result($resultado);
    @mysql_free_result($resultado1);  ?>
</body>
</html>