3
include('funciones.php');
6
encabezado('Listado de boletas');
7
boton("Eliminar boletas vacías","bol.php?accion=limpiar");
8
boton("Volver",'alianza.py?accion=recepcion');
9
$sql1='select * from bol_cont ORDER BY id DESC';
10
$res1 = mysql_query($sql1);
11
encabezado_tabla(array("Nº","Caja Nº","Fecha","Cliente","Total","Acciones"));
13
while ($fil1 = mysql_fetch_array($res1)){
17
celda($fil1['caja_id']);
18
celda(mysql_a_fecha($fil1['fecha']));
19
$fil_cli = buscar_registro("clientes","id",$fil1['cliente_id']);
20
celda($fil_cli['nombre']);
21
linea_moneda($fil1['total']);
23
boton("Detalles","bol.php?accion=detalles&id=$id");
24
boton("Imprimir","bol.php?accion=imprimir&id=$id");
25
//boton("Borrar",'cli.php?accion=confirmar&id=' .$fil1['id']);
30
boton("Volver",'alianza.py?accion=recepcion');
34
$boleta_id = $_GET['id'];
35
$fil_bol = buscar_registro("bol_cont","id",$boleta_id);
36
$caja_id = $fil_bol['caja_id'];
37
$fil_caj = buscar_registro("cajas","id",$caja_id);
38
$deposito_id = $fil_caj['deposito_id'];
39
$cliente_id = $fil_bol['cliente_id'];
40
$cola = "deposito_id=$deposito_id&caja_id=$caja_id&cliente_id=$cliente_id&boleta_id=$boleta_id";
41
/* ----------------------------------------- */
42
$fecha = mysql_a_fecha($fil_bol['fecha']);
43
$fil_cli = buscar_registro("clientes","id",$cliente_id);
44
$nombre = $fil_cli['nombre'];
45
$direccion = $fil_cli['direccion'];
47
$lin = str_repeat(' ',90);
48
for($i=0;$i<=70;$i++){
52
$hoja[0]=substr_replace($hoja[0],$fecha,80);
53
$hoja[0+$desp]=substr_replace($hoja[0+$desp],$fecha,80);
54
$hoja[3]=substr_replace($hoja[3],$nombre,20);
55
$hoja[3+$desp]=substr_replace($hoja[3+$desp],$nombre,20);
56
$hoja[5]=substr_replace($hoja[5],$direccion,20);
57
$hoja[5+$desp]=substr_replace($hoja[5+$desp],$direccion,20);
58
$sql_det = "SELECT * FROM bol_det WHERE bol_cont_id='$boleta_id'";
59
$res_det = mysql_query($sql_det);
60
$hoja[8] = substr_replace($hoja[8],"Cantidad",4,8);
61
$hoja[8] = substr_replace($hoja[8],"Detalle",13,7);
62
$hoja[8] = substr_replace($hoja[8],"Precio",79-6,6);
63
$hoja[8] = substr_replace($hoja[8],"Total",95-5,5);
64
$hoja[8+$desp] = substr_replace($hoja[8+$desp],"Cantidad",4,8);
65
$hoja[8+$desp] = substr_replace($hoja[8+$desp],"Detalle",13,7);
66
$hoja[8+$desp] = substr_replace($hoja[8+$desp],"Precio",79-6,6);
67
$hoja[8+$desp] = substr_replace($hoja[8+$desp],"Total",95-5,5);
70
while($fila = mysql_fetch_array($res_det)){
71
$cantidad = trim($fila['cantidad']);
72
$detalle = trim($fila['detalle']);
73
$unitario = moneda($fila['unitario']);
74
$total = moneda($fila['total']);
75
if (strlen($detalle)>57) $detalle=substr($detalle,0,57);
76
$hoja[$conta]= substr_replace($hoja[$conta],$cantidad,6,strlen($cantidad));
77
$hoja[$conta]= substr_replace($hoja[$conta],$detalle,13,strlen($detalle));
78
$hoja[$conta]= substr_replace($hoja[$conta],$unitario,80-strlen($unitario),strlen($unitario));
79
$hoja[$conta]= substr_replace($hoja[$conta],$total,96-strlen($total),strlen($total));
81
$hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$cantidad,6,strlen($cantidad));
82
$hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$detalle,13,strlen($detalle));
83
$hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$unitario,80-strlen($unitario),strlen($unitario));
84
$hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$total,96-strlen($total),strlen($total));
86
$totbol=$totbol + $fila['total'];
89
$total_boleta = moneda($totbol);
90
$hoja[19] = substr_replace($hoja[20],$total_boleta,96-strlen($total_boleta),strlen($total_boleta));
91
$hoja[19+$desp] = substr_replace($hoja[20+$desp],$total_boleta,96-strlen($total_boleta),strlen($total_boleta));
93
for($i=0;$i<=70;$i++){
94
echo $hoja[$i]."</br>";
97
boton("...","bol.php?accion=listado");
101
$sql_bol = "SELECT * FROM bol_cont";
102
$res_bol = mysql_query($sql_bol);
103
while($fila = mysql_fetch_array($res_bol)){
105
$sql_mov = "SELECT COUNT(*) AS num FROM bol_det WHERE bol_cont_id='$id'";
106
$res_mov = mysql_query($sql_mov);
107
$fil_mov = mysql_fetch_array($res_mov);
108
$num_fil = $fil_mov['num'];
110
$sql_del = "DELETE FROM bol_cont WHERE id='$id'";
111
$res = mysql_query($sql_del);
114
redirigir("bol.php?accion=listado");
117
$bol_id = $_GET['id'];
118
encabezado("Detalles de boleta Nº: $bol_id");
119
boton("Volver","bol.php?accion=listado");
120
$fil_bol = buscar_registro("bol_cont","id",$bol_id);
121
$fil_cli = buscar_registro("clientes","id",$fil_bol['cliente_id']);
122
echo '<table><tr><td>';
123
echo 'Nombre: '.$fil_cli['nombre'];
124
echo '</td></tr><tr><td>';
125
echo 'Direccion: '.$fil_cli['direccion'];
126
echo '</td></tr></table>';
127
$sql_mov = "SELECT * FROM bol_det WHERE bol_cont_id ='$bol_id'";
128
$res_mov = mysql_query($sql_mov);
130
encabezado_tabla(array("Nº","Cantidad","Detalle","Unitario","Total","Rubro"));
131
while($fil_mov = mysql_fetch_array($res_mov)){
133
celda($fil_mov['id']);
134
celda($fil_mov['cantidad']);
135
celda($fil_mov['detalle']);
136
celda($fil_mov['unitario']);
137
celda($fil_mov['total']);
138
celda($fil_mov['rubro']);
142
boton("Volver","bol.php?accion=listado");
146
if (!$_GET['accion']) $accion='listado';
147
else $accion=$_GET['accion'];
167
confirmar_borrar($_GET['id'],'bol.php');
168
boton("Volver",'bol.php?accion=listado');
171
borrar('bol_cont',$_POST['id'],'bol.php?accion=listado');
172
/* @annotation TODO: al eliminar boleta, eliminar sus movimientos */