~marcelo-escobal/geined/Alianza

« back to all changes in this revision

Viewing changes to bolcon.php.moved

  • Committer: Cualquier Desarrollador
  • Date: 2010-01-29 21:15:22 UTC
  • Revision ID: desarrollo@marte-20100129211522-u97qh9o90mhdap04
Importación inicial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
include('funciones.php');
 
3
include('datos.php');
 
4
function listado(){
 
5
    /*! Listado de boletas contado */
 
6
    /* Entrada: deposito_id, cliente_id */
 
7
    $deposito_id = $_GET['deposito_id'];
 
8
    $caja_id = $_GET['caja_id'];
 
9
    $cliente_id = $_GET['cliente_id'];
 
10
    $boleta_id = $_GET['boleta_id'];
 
11
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id&cliente_id=$cliente_id&boleta_id=$boleta_id";
 
12
    /* ----------------------------------------- */
 
13
    $fil_dep = buscar_registro("depositos","id",$deposito_id);
 
14
    $sucursal = $fil_dep['deposito'];
 
15
    encabezado("Alianza $sucursal: boleta contado");
 
16
    script_noenter();
 
17
    $fil_bol = buscar_registro("bol_cont","id",$boleta_id);
 
18
    $fil_cli = buscar_registro("clientes","id",$cliente_id);
 
19
    $nombre = $fil_cli['nombre'];
 
20
    $direccion = $fil_cli['direccion'];
 
21
    echo '<table><tr><td>';
 
22
    /* Datos del cliente */
 
23
    echo '<table><tbody><tr><td>Fecha:</td><td align="right">';
 
24
    echo date('d/m/Y');
 
25
    echo  "</td></tr><tr><td>Nombre:</td><td>$nombre</td></tr><tr><td>Domicilio:</td><td>$domicilio</td></tr></tbody></table>";
 
26
    echo '</td><td>';
 
27
    /* Botonera */
 
28
    boton("Cuota","bolcuo.php?accion=cuota&id&$cola");
 
29
    boton("Libros","bollib.php?accion=editar&$cola");
 
30
    boton("Recargos","bolrec.php?accion=editar&$cola");
 
31
    boton("Matricula","bolmat.php?accion=editar&$cola");
 
32
    //boton("Módulo","bolmod.php?accion=editar&$cola");
 
33
    //boton("Imprimir","bolcon.php?accion=imprimir&$cola");
 
34
    boton("Volver","bolcon.php?accion=cancelar&$cola");
 
35
    /* si salgo de la boleta, no se graba eliminar toda la boleta y sus movimientos */
 
36
    echo '</td></tr></table>';
 
37
    /* Listado de movimientos */
 
38
    encabezado_tabla(array("Cantidad","Detalle","P.Unitario","Total","Acciones"));
 
39
    $sql_det = "SELECT * FROM bol_det WHERE bol_cont_id='$boleta_id'";
 
40
    $res_det = mysql_query($sql_det);
 
41
    $total=0;
 
42
    while ($fil = mysql_fetch_array($res_det)){
 
43
        echo '<tr>';
 
44
        celda($fil['cantidad']);
 
45
        celda($fil['detalle']);
 
46
        linea_moneda($fil['unitario']);
 
47
        linea_moneda($fil['total']);
 
48
        $total = $total + $fil['total'];
 
49
        echo '<td>';
 
50
        boton("Editar","bolcon?accion=editar");
 
51
        boton("Borrar","bolcon?accion=borrar"); 
 
52
        echo '</td></tr>';
 
53
    }
 
54
    fin_tabla();
 
55
    /* rutina de verificación para que no se guarde si no pagó está en el javascript*/
 
56
    $formac = "bolcon.php?accion=guardar&$cola";
 
57
    echo '<form id="bol" name="bol" action="'.$formac.'" method="POST">';
 
58
    echo "<input type='hidden' id='cola' value='$cola'>";
 
59
    echo '<h2>TOTAL: $<input type="text" id="to" name="total" value="'.$total.'" readonly="1" /></h2>';
 
60
    echo '<h3>Forma de pago</h3>';
 
61
    echo '<table><tbody><tr><td>Efectivo</td><td>Cheques</td><td>Vouchers</td><td>Otros</td></tr>';
 
62
    echo '<tr>';
 
63
    echo '<td align="right"><input align="right" type="text" id="ef" name="efectivo" value="0" onchange="recalcular('."'ef'".');"></td>';
 
64
    echo '<td align="right"><input align="right" type="text" id="ch" name="cheques" value="0" onchange="recalcular('."'ch'".');"></td>';
 
65
    echo '<td align="right"><input align="right" type="text" id="vo" name="vouchers" value="0" onchange="recalcular('."'vo'".');"></td>';
 
66
    echo '<td align="right"><input align="right" type="text" id="ot" name="otros" value="0" onchange="recalcular('."'ot'".');"></td>';
 
67
    echo '</tr>';
 
68
    fin_tabla();
 
69
    echo '<table><tbody><tr><td>Vuelto:</td><td><h3>$<input type="text" id="vu" name="vu"  value="'.$vuelto.'" readonly="1" /></h3></td></tr>';
 
70
    fin_tabla();
 
71
    echo '<span id="boton"></td><tr></span>';
 
72
    fin_formulario();
 
73
    echo '<script type="text/javascript">
 
74
    function recalcular(campo){
 
75
        var caracteresPermitidos ="0123456789.,-";
 
76
        var ef=0; var ch=0; var vo=0; var ot=0;var total=0;
 
77
        ef = parseFloat(document.getElementById("ef").value);
 
78
        ch = parseFloat(document.getElementById("ch").value);
 
79
        vo = parseFloat(document.getElementById("vo").value);
 
80
        ot = parseFloat(document.getElementById("ot").value);
 
81
        pago = ef + ch + vo + ot;
 
82
        total = parseFloat(document.getElementById("to").value);
 
83
        vuelto = pago-total;
 
84
        var str = document.getElementById(campo).value;
 
85
        flag = true;
 
86
        for(index=0;index<str.length;index++){
 
87
            myChar = str.charAt(index);
 
88
            if(caracteresPermitidos.indexOf(myChar)==-1){
 
89
                flag = false;
 
90
            }
 
91
        }
 
92
        if (flag==false){
 
93
            alert("Hay letras en los campos numericos");
 
94
        }
 
95
        if (vuelto<0){
 
96
            vuelto=0;
 
97
            document.getElementById("boton").innerHTML = "";
 
98
        } else {
 
99
            document.getElementById("boton").innerHTML = 
 
100
    "<input type='."'submit'"." value="."'Aceptar'".'>
 
101
    <input type='."'button'"." value="."'Imprimir'"."onClick=parent.location="."'bolcon.php?accion=imprimir&".$cola."'>".';
 
102
        }
 
103
        document.getElementById("vu").value = vuelto;
 
104
    }
 
105
    </script>';
 
106
    fin();
 
107
}
 
108
function cancelar(){
 
109
    $deposito_id = $_GET['deposito_id'];
 
110
    $caja_id = $_GET['caja_id'];
 
111
    $cliente_id = $_GET['cliente_id'];
 
112
    $boleta_id = $_GET['boleta_id'];
 
113
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id&cliente_id=$cliente_id&boleta_id=$boleta_id";
 
114
    /* ----------------------------------------- */
 
115
    //si salgo de la boleta, borrar la boleta con todos los movimientos
 
116
    // borrar los bol_det
 
117
    $sql = "DELETE FROM bol_det WHERE bol_cont_id = '$boleta_id'";
 
118
    $res = mysql_query($sql);
 
119
    // borrar bol_cont
 
120
    $sql = "DELETE FROM bol_cont WHERE id = '$boleta_id'";
 
121
    $res = mysql_query($sql);
 
122
    redirigir("caja_ver.php?accion=listado&$cola");
 
123
}
 
124
function guardar(){
 
125
    /* Entrada: deposito_id, cliente_id */
 
126
    /* Viene de bolcon */
 
127
    /* Actualiza datos de una boleta contado */
 
128
    $deposito_id = $_GET['deposito_id'];
 
129
    $caja_id = $_GET['caja_id'];
 
130
    $cliente_id = $_GET['cliente_id'];
 
131
    $boleta_id = $_GET['boleta_id'];
 
132
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id&cliente_id=$cliente_id&boleta_id=$boleta_id";
 
133
    /* campos: id caja_id fecha cliente_id efe che vou otr total flag */
 
134
    $efectivo = $_POST['efectivo'];
 
135
    $cheques = $_POST['cheques'];
 
136
    $vouchers = $_POST['vouchers'];
 
137
    $otros = $_POST['otros'];
 
138
    $total = $_POST['total'];
 
139
    $vuelto = $_POST['vu'];
 
140
    $efectivo = $efectivo - $vuelto;
 
141
    $fecha = fecha_a_mysql(date('d/m/Y'));
 
142
    /* Buscar cliente */
 
143
    $fil_cli = buscar_registro("clientes","id",$cliente_id);
 
144
    $nombre = $fil_cli['nombre'];
 
145
    $detalle = "Boleta contado Nº interno: $boleta_id, $nombre";
 
146
    $sql = "UPDATE bol_cont SET caja_id='$caja_id', fecha='$fecha', 
 
147
    cliente_id='$cliente_id', efectivo = '$efectivo', cheques='$cheques',
 
148
    vouchers='$vouchers', otros='$otros', total='$total' 
 
149
    WHERE id='$boleta_id'";
 
150
    $resultado = mysql_query($sql);
 
151
    /* Guarda linea en caja del dia */
 
152
    $sql = "INSERT INTO mov_caja SET caja_id ='$caja_id', 
 
153
    detalle = '$detalle', efectivo = '$efectivo', 
 
154
    cheques = '$cheques', vouchers = '$vouchers', 
 
155
    otros = '$otros'";
 
156
    $result = mysql_query($sql)  or die('SQL inválido: ' . mysql_error());
 
157
    // Ciclar x movimientos para generar asientos y demás
 
158
    $sql_mov = "SELECT * FROM bol_det WHERE bol_cont_id='$boleta_id'";
 
159
    $res_mov = mysql_query($sql_mov);
 
160
    $tot_mov = 0;
 
161
    while ($row = mysql_fetch_array($res_mov)){
 
162
        // para cada mov_bol dentro de ese boleta
 
163
        $monto = $row['total'];
 
164
        $tot_mov = $tot_mov + $monto;
 
165
        $rubro_haber = $row['rubro'];
 
166
        $subrub = substr($rubro_haber,0,3);
 
167
        $producto_id = $row['producto_id'];
 
168
        $extra_id = $row['extra_id'];
 
169
        $tot_cuota = 0;
 
170
        $cantidad = $row['cantidad'];
 
171
        // graba transaccion en otros como rubro $rubro_debe es la caja de origen
 
172
        switch ($deposito_id){
 
173
            case '1':
 
174
                $rubro_debe = 111018;
 
175
                break;
 
176
            case '2':
 
177
                $rubro_debe = 111025;
 
178
                break;
 
179
            case '3':
 
180
                $rubro_debe = 111026;
 
181
                break;
 
182
        }
 
183
        // pasar el monto a OTROS como rubro
 
184
        asiento_doble($fecha,$detalle,$rubro_debe,$rubro_haber,$monto,$boleta_id);
 
185
        // Genera movimientos específicos según el producto
 
186
        switch($producto_id){
 
187
            case '1':
 
188
                // el producto es una cuota
 
189
                // asignar una cuota paga al alumno
 
190
                // guardar linea en cuenta corriente del cliente
 
191
                $detalle_cuota = $row['detalle'];
 
192
                cta_cli_add($cliente_id,$detalle_cuota,0,$monto,$fecha);
 
193
                // agregar al alumno la cuota paga
 
194
                $fil_alu = buscar_registro("alumnos","id",$alumno_id);
 
195
                $pagos = $fil_alu['pago'];
 
196
                $pagos = $pagos + 1;
 
197
                $alumno_id = $extra_id;
 
198
                $sql_alu = "UPDATE alumnos SET pago='$pagos' WHERE id='$alumno_id'";
 
199
                $res = mysql_query($sql_alu) or die("Error: ".mysql_error());
 
200
                break;
 
201
            case '2':
 
202
                //El producto es un libro
 
203
                // Para detectar existencias: biecam_id y deposito_id
 
204
                // biecam_id es el extra_id
 
205
                $biecam_id = $extra_id;
 
206
                $sql_exi = "SELECT * FROM existencias WHERE deposito_id='$deposito_id' AND  biecam_id='$biecam_id'";
 
207
                $res_exi = mysql_query($sql_exi);
 
208
                // OJO: es probable que no esté ingresado en existencias
 
209
                if(mysql_num_rows($res_exi)==0){
 
210
                    // en ese caso tener previsto crear una línea en existencias
 
211
                    // Descontarlo del stock correspondiente en existencias
 
212
                    $cant_lib = -$cantidad;
 
213
                    // y asignarle una cantidad negativa al stock
 
214
                    // para que después se pueda corregir
 
215
                    $sql_ins = "INSERT INTO existencias SET biecam_id='$biecam_id',
 
216
                    deposito_id='$deposito_id', cantidad='$cant_lib'";
 
217
                } else {
 
218
                    $fil_exi = mysql_fetch_array($res_exi);
 
219
                    $cant_lib = $fil_exi['cantidad'] - $cantidad;
 
220
                    $sql_ins = "UPDATE existencias SET biecam_id='$biecam_id',
 
221
                    deposito_id='$deposito_id', cantidad='$cant_lib'";
 
222
                }
 
223
                $res = mysql_query($sql_ins);
 
224
                break;
 
225
        }
 
226
    }
 
227
    // despues de terminar el bucle, ciclar x transacciones con ese documento_id
 
228
    /* al final del ciclo, sacar de otros y pasar a EF CH VO */
 
229
    $rubro_otros = $rubro_debe;
 
230
    switch ($deposito_id){
 
231
        case '1':
 
232
            $rubro_ef = 111018;
 
233
            $rubro_ch = 111018;
 
234
            $rubro_vo = 111018;
 
235
            break;
 
236
        case '2':
 
237
            $rubro_ef = 111011;
 
238
            $rubro_ch = 111021;
 
239
            $rubro_vo = 113002;
 
240
            break;
 
241
        case '3':
 
242
            $rubro_ef = 111012;
 
243
            $rubro_ch = 111022;
 
244
            $rubro_vo = 113003;
 
245
            break;
 
246
    }
 
247
    // Hacer que no se procesen asientos con cifra 0
 
248
    // Efectivo
 
249
    if($efectivo!=0){
 
250
        asiento_doble($fecha,$detalle,$rubro_ef,$rubro_otros,$efectivo,$boleta_id);
 
251
    }
 
252
    //Cheques
 
253
    if($cheques!=0){
 
254
        asiento_doble($fecha,$detalle,$rubro_ch,$rubro_otros,$cheques,$boleta_id);
 
255
    }
 
256
    // Vouchers
 
257
    if($vouchers!=0){
 
258
        asiento_doble($fecha,$detalle,$rubro_vo,$rubro_otros,$vouchers,$boleta_id);
 
259
    }
 
260
    // No se toma en cuenta el rubro OTROS porque se supone que ya queda
 
261
    redirigir("bolcon.php?accion=imprimir&$cola");
 
262
}
 
263
function nuevo(){
 
264
    $fecha = fecha_a_mysql(date('d/m/Y'));
 
265
    $deposito_id=$_GET['deposito_id'];
 
266
    $caja_id = $_GET['caja_id'];
 
267
    $cliente_id = $_GET['cliente_id'];
 
268
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id&cliente_id=$cliente_id";
 
269
    $sql_bol = "INSERT INTO bol_cont SET caja_id = '$caja_id',  cliente_id='$cliente_id', fecha='$fecha'";
 
270
    $result = mysql_query($sql_bol) or die('Invalid query: ' . mysql_error());
 
271
    /* Ultimo registro insertado */
 
272
    $boleta_id=mysql_insert_id();
 
273
    redirigir("bolcon.php?accion=listado&boleta_id=$boleta_id&$cola");
 
274
}
 
275
function buscar_cliente(){
 
276
    /* Entrada: caja_id, cliente_id, deposito_id */
 
277
    $deposito_id=$_GET['deposito_id'];
 
278
    $caja_id = $_GET['caja_id'];
 
279
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id";
 
280
    encabezado("Buscar cliente (boleta contado)");
 
281
    echo '<table><tr><td>';
 
282
    boton("Volver","alianza.php?accion=recepcion&$cola");
 
283
    echo '</td><td>';
 
284
    formulario("bolcon.php?accion=buscar_cliente&$cola");
 
285
    echo '<input type="text" name="busqueda">
 
286
        <input type="submit" VALUE="Buscar"></form>';
 
287
    echo '</td></tr></table>';
 
288
    //cargar datos
 
289
    if ($_POST['busqueda']<>''){
 
290
        $sql1='SELECT * from clientes where nombre like "%' .$_POST['busqueda'] .'%" order by nombre';
 
291
    }
 
292
    else {
 
293
        $sql1='select * from clientes order by nombre LIMIT 20';
 
294
    }
 
295
    $res1 = mysql_query($sql1);    
 
296
    if ($res1==0)    {
 
297
        echo 'Error ' . mysql_error();
 
298
    }
 
299
    else {
 
300
        encabezado_tabla(array("Nombre","Teléfono","eMail","Categoría","Acciones"));
 
301
        for ($i = 0; $i < mysql_num_rows($res1); $i++){
 
302
            echo '<tr>';
 
303
            $fil1 = mysql_fetch_array($res1);
 
304
            celda($fil1['nombre']);
 
305
            celda($fil1['telefono']);
 
306
            celda($fil1['email']);
 
307
            // Categoria
 
308
            $sql2 = 'SELECT * FROM cat_clientes WHERE id="' . $fil1['categoria_id'] . '"';
 
309
            $res2 = mysql_query($sql2);
 
310
            if ($res2==0){
 
311
                $categoria='';
 
312
            }
 
313
            else {
 
314
                $fil2 = mysql_fetch_array($res2);
 
315
                $categoria=$fil2['categoria'];
 
316
            }
 
317
            celda($categoria);
 
318
            echo '<td>';
 
319
            $cliente_id = $fil1['id'];
 
320
            boton("Seleccionar","bolcon.php?accion=nuevo&cliente_id=$cliente_id&$cola");
 
321
            echo '</td>';
 
322
            echo '</tr>';
 
323
        }
 
324
        fin_tabla();
 
325
    }
 
326
    boton("Volver",'alianza.php?accion=recepcion');
 
327
    fin();
 
328
}
 
329
function buscar_sucursal(){
 
330
    encabezado("Caja: seleccionar sucursal");
 
331
    boton("Central","bolcon.php?accion=listado&deposito_id=1");
 
332
    boton("Costa de Oro","bolcon.php?accion=listado&deposito_id=2");
 
333
    boton("Carrasco","bolcon.php?accion=listado&deposito_id=3");
 
334
    boton("Volver","alianza.php?accion=recepcion");
 
335
    fin();    
 
336
}
 
337
function imprimir(){
 
338
    $deposito_id = $_GET['deposito_id'];
 
339
    $caja_id = $_GET['caja_id'];
 
340
    $cliente_id = $_GET['cliente_id'];
 
341
    $boleta_id = $_GET['boleta_id'];
 
342
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id&cliente_id=$cliente_id&boleta_id=$boleta_id";
 
343
    /* ----------------------------------------- */
 
344
    $fil_bol = buscar_registro("bol_cont","id",$boleta_id);
 
345
    $fecha = mysql_a_fecha($fil_bol['fecha']);
 
346
    $cliente_id = $fil_bol['cliente_id'];
 
347
    $fil_cli = buscar_registro("clientes","id",$cliente_id);
 
348
    $nombre = $fil_cli['nombre'];
 
349
    $direccion = $fil_cli['direccion'];
 
350
    encabezado_boleta();
 
351
    $lin = str_repeat(' ',90);
 
352
    for($i=0;$i<=70;$i++){
 
353
        $hoja[$i]=$lin;
 
354
    }
 
355
    $desp = 40;
 
356
    $hoja[0]=substr_replace($hoja[0],$fecha,80);
 
357
    $hoja[0+$desp]=substr_replace($hoja[0+$desp],$fecha,80);
 
358
    $hoja[3]=substr_replace($hoja[3],$nombre,20);
 
359
    $hoja[3+$desp]=substr_replace($hoja[3+$desp],$nombre,20);
 
360
    $hoja[5]=substr_replace($hoja[5],$direccion,20);
 
361
    $hoja[5+$desp]=substr_replace($hoja[5+$desp],$direccion,20);
 
362
    $sql_det = "SELECT * FROM bol_det WHERE bol_cont_id='$boleta_id'";
 
363
    $res_det = mysql_query($sql_det);
 
364
    $hoja[8] = substr_replace($hoja[8],"Cantidad",4,8);
 
365
    $hoja[8] = substr_replace($hoja[8],"Detalle",13,7);
 
366
    $hoja[8] = substr_replace($hoja[8],"Precio",79-6,6);
 
367
    $hoja[8] = substr_replace($hoja[8],"Total",95-5,5);
 
368
    $hoja[8+$desp] = substr_replace($hoja[8+$desp],"Cantidad",4,8);
 
369
    $hoja[8+$desp] = substr_replace($hoja[8+$desp],"Detalle",13,7);
 
370
    $hoja[8+$desp] = substr_replace($hoja[8+$desp],"Precio",79-6,6);
 
371
    $hoja[8+$desp] = substr_replace($hoja[8+$desp],"Total",95-5,5);
 
372
    $conta = 9;
 
373
    $totbol=0;
 
374
    while($fila = mysql_fetch_array($res_det)){
 
375
        $cantidad = trim($fila['cantidad']);
 
376
        $detalle = trim($fila['detalle']);
 
377
        $unitario = moneda($fila['unitario']);
 
378
        $total = moneda($fila['total']);
 
379
        if (strlen($detalle)>57) $detalle=substr($detalle,0,57);
 
380
        $hoja[$conta]= substr_replace($hoja[$conta],$cantidad,6,strlen($cantidad));
 
381
        $hoja[$conta]= substr_replace($hoja[$conta],$detalle,13,strlen($detalle));
 
382
        $hoja[$conta]= substr_replace($hoja[$conta],$unitario,80-strlen($unitario),strlen($unitario));
 
383
        $hoja[$conta]= substr_replace($hoja[$conta],$total,96-strlen($total),strlen($total));
 
384
        // Segunda hoja
 
385
        $hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$cantidad,6,strlen($cantidad));
 
386
        $hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$detalle,13,strlen($detalle));
 
387
        $hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$unitario,80-strlen($unitario),strlen($unitario));
 
388
        $hoja[$conta+$desp]= substr_replace($hoja[$conta+$desp],$total,96-strlen($total),strlen($total));
 
389
        // Total
 
390
        $totbol=$totbol + $fila['total'];
 
391
        $conta = $conta + 1;
 
392
    }
 
393
    $total_boleta = moneda($totbol);
 
394
    $hoja[19] = substr_replace($hoja[20],$total_boleta,96-strlen($total_boleta),strlen($total_boleta));
 
395
    $hoja[19+$desp] = substr_replace($hoja[20+$desp],$total_boleta,96-strlen($total_boleta),strlen($total_boleta));
 
396
    /* Cargar linea desde archivo */
 
397
    $pie_bol = 'pie_bol.txt';
 
398
    $fh = fopen($pie_bol, 'r');
 
399
    $linea = fgets($fh);
 
400
    fclose($fh);
 
401
    $hoja[22] = substr_replace($hoja[22],$linea,6,strlen($linea));
 
402
    $hoja[22+$desp] = substr_replace($hoja[22+$desp],$linea,6,strlen($linea));
 
403
    echo "<pre>";
 
404
    for($i=0;$i<=70;$i++){
 
405
        echo $hoja[$i]."</br>";
 
406
    }
 
407
    echo "</pre>"    ;
 
408
    //boton("IMPRIMIR","bolcon.php?accion=guardar&$cola");
 
409
    echo '<script type="text/javascript">
 
410
    window.print();
 
411
    </script>';
 
412
    redirigir("caja_ver.php?accion=listado&$cola");
 
413
    //redirigir("bolcon.php?accion=guardar&$cola");
 
414
    fin();
 
415
}
 
416
/* INICIO DE BUCLE PRINCIPAL */
 
417
autorizacion(5);
 
418
if (!$_GET["accion"]){
 
419
    $accion="listado";
 
420
}
 
421
else{
 
422
    $accion=$_GET["accion"];
 
423
}
 
424
if(!$_GET['deposito_id']){
 
425
    //@annotation cambiar esto seleccionar_sucursal();
 
426
}
 
427
else {
 
428
    if(!$_GET['cliente_id']){
 
429
        buscar_cliente();
 
430
    }
 
431
    else {
 
432
        switch($accion){
 
433
            case 'listado':
 
434
                listado();
 
435
                break;
 
436
            case 'nuevo':
 
437
                nuevo();
 
438
                break;
 
439
            case 'buscar_cliente':
 
440
                buscar_cliente();
 
441
                break;
 
442
            case 'cuota':
 
443
                cuota();
 
444
                break;
 
445
            case 'guardar':
 
446
                guardar();
 
447
                break;
 
448
            case 'cancelar':
 
449
                cancelar();
 
450
                break;
 
451
            case 'imprimir':
 
452
                imprimir();
 
453
                break;
 
454
        }
 
455
    }
 
456
}
 
457
?>