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
|
<?
/*
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("buscarcliente2.php","miwin","width=600,height=400,scrollbars=yes")
miPopup.focus()
}
</script>
</head>
<? include ("conectar.php");
include ("convertirfechas.php");
include ("convertirfechas2.php");?>
<body>
<img src="images/nuevas/impresionescuentacorriente.jpg" alt="Impresión Cuenta Corriente"><br>
<br>
<form name="formul" method="post" action="cuentacorriente.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ódigo
de cliente:</td>
<td width="67%">
<? if ($ini==0) { ?>
<input name="codigoc" type="text" id="codigoc" size="10" maxlength="10">
<? } else { ?>
<input name="codigoc" type="text" id="codigoc" size="10" maxlength="10" value="<? echo $codigo; ?>">
<? } ?>
<a href="#"><img src="images/lupa.jpg" alt="Buscar Cliente" width="17" height="17" border="0" onclick="abreVentana()"></a></td></td>
</tr>
<tr>
<td class="primeralineaizquierda">Periodo
de consulta:</td>
<td>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 colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Enviar datos">
<input type="hidden" name="ini" value="1">
</div></td>
</tr>
</table>
</form>
<p>
<? if ($ini==1) { ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#cddfed">
<td width="25%" class="primeralinea">Cod. Factura</td>
<td width="25%" class="primeralinea">Fecha de factura</td>
<td width="25%" class="primeralinea">Estado</td>
<td width="25%" class="primeralinea">Importe</td>
</tr>
<? if (empty($codigo)) { $codigo=0; };
if (empty($fecha1)) { $fecha1="01/01/1970"; }
if (empty($fecha2)) { $fecha2=date("d/m/Y"); }
$fecha1=conversion($fecha1);
$fecha2=conversion($fecha2);
$pagado=0;
$enproceso=0;
$sinpagar=0;
$consulta="Select * from clientes,facturas where clientes.codcliente='$codigoc' and clientes.codcliente=facturas.codcliente and
fecha >= '$fecha1' and fecha <= '$fecha2' order by facturas.codfactura";
$resultado=mysql_query($consulta,$conexion);
while ($lafila=mysql_fetch_array($resultado)) {
$importe=0;
$codf=$lafila["codfactura"];
$iva0=$lafila["iva"]; ?>
<tr bgcolor="#cddfed">
<td width="25%" class="segundalinea"><font color="ff0000"><b><? echo $lafila["codfactura"]; ?></b></font></td>
<td width="25%" class="segundalinea"><? $fech=reconversion($lafila["fecha"]); echo $fech; ?></td>
<? if ($lafila["estado"]==1) { ?>
<td width="25%" class="segundalinea"><font color="#FF0000" size="1"><b>No pagada</b></font></td>
<? } else { if ($lafila["estado"]==2) { ?>
<td width="25%" class="segundalinea"><font color="#FFCC00" size="1"><b>En proceso</b></font></td>
<? } else { ?>
<td width="25%" class="segundalinea"><font color="#009900" size="1"><b>Pagada</b></font></td>
<? } } ?>
<? $consulta0="Select * from factulinea where factulinea.codfactura='$codf'";
$resultado0=mysql_query($consulta0,$conexion);
while ($lafila0=mysql_fetch_array($resultado0)) {
$codfamilia=$lafila0["codfamilia"];
$codsubfamilia=$lafila0["codsubfamilia"];
$codigo=$lafila0["codigo"]; ?>
<? if (($codfamilia=="a") and ($codsubfamilia=="a")) {
$consulta2="select * from albaranes,albalinea where albaranes.codalbaran='$codigo' and albaranes.codalbaran=albalinea.codalbaran";
$resultado2=mysql_query($consulta2,$conexion);
while ($lafila2=mysql_fetch_array($resultado2)) {
$codfamilia2=$lafila2["codfamilia"];
$codsubfamilia2=$lafila2["codsubfamilia"];
$codigo2=$lafila2["codigo"];
if (($codfamilia=="p") and ($codsubfamilia=="p")) {
$consulta3="select * from partes,partelinea,articulos where partes.codparte='$codigo' and partes.codparte=partelinea.codparte and
partelinea.codfamilia=articulos.codfamilia and partelinea.codsubfamilia=articulos.codsubfamilia and
partelinea.codigo=articulos.codigo";
$resultado3=mysql_query($consulta3,$conexion);
$lafila3=mysql_fetch_array($resultado3);
$importe=$importe + $lafila3["importe"];
} else {
$importe=$importe + $lafila2["importe"];
}
}
} else {
$importe= $importe + $lafila0["importe"];
} } ?>
<td width="25%" class="segundalineaderecha"><b><? $iva0=$iva0/100; $importe=$importe + ($importe*$iva0); $imp= number_format($importe,2,",","."); echo $imp; ?> Euros</b></td>
<? if ($lafila["estado"]==1) { $sinpagar=$sinpagar + $importe; }
if ($lafila["estado"]==2) { $enproceso=$enproceso + $importe; }
if ($lafila["estado"]==3) { $pagado=$pagado + $importe; } ?>
</tr>
<? } ?>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#cddfed">
<td width="33%" class="segundalinea"><font color="#FF0000" size="1"><b>Total no pagado</b></font></td>
<td width="33%" class="segundalinea"><font color="#FFCC00" size="1"><b>Total en proceso</b></font></td>
<td width="33%" class="segundalinea"><font color="#009900" size="1"><b>Total pagado</b></font></td>
</tr>
<tr bgcolor="#cddfed">
<td width="33%" class="segundalineaderecha"><b><? $sinpagar= number_format($sinpagar,2,",","."); echo $sinpagar; ?> Euros</b></td>
<td width="33%" class="segundalineaderecha"><b><? $enproceso= number_format($enproceso,2,",","."); echo $enproceso; ?> Euros</b></td>
<td width="33%" class="segundalineaderecha"><b><? $pagado= number_format($pagado,2,",","."); echo $pagado; ?> Euros</b></td>
</tr>
</table>
<br>
<?
@mysql_free_result($resultado);
@mysql_free_result($resultado1);
@mysql_free_result($resultado2);
@mysql_free_result($resultado21);
@mysql_free_result($resultado3); ?>
</body>
</html>
<?
}
?>
|