~marcelo-escobal/geined/Alianza

« back to all changes in this revision

Viewing changes to dir_111018.php

  • 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
/*! Depósito bancario MN */
 
3
include('funciones.php');
 
4
include('datos.php');
 
5
autorizacion(3);
 
6
if(!$_GET['accion']){
 
7
    $accion="ingresar";
 
8
} else {
 
9
    $accion=$_GET['accion'];
 
10
}
 
11
switch($accion){
 
12
    case 'ingresar':
 
13
        ingresar();
 
14
        break;
 
15
    case 'guardar':
 
16
        guardar();
 
17
        break;
 
18
}
 
19
function guardar(){
 
20
    /* Recuperacion de variables */
 
21
    $id = $_GET['id'];
 
22
    $deposito_id = $_GET['deposito_id'];
 
23
    $caja_id = $_GET['caja_id'];
 
24
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id";
 
25
    $receptor = $_POST['receptor'];
 
26
    $efectivo = $_POST['efectivo'];
 
27
    $cheques = $_POST['cheques'];
 
28
    $vouchers = $_POST['vouchers'];
 
29
    $otros = $_POST['otros'];
 
30
    /* Buscar registro */
 
31
    $fil_caj = buscar_registro("cajas","id",$caja_id);
 
32
    $fecha = $fil_caj['fecha'];
 
33
    $fil_dep = buscar_registro("depositos","id",$deposito_id);
 
34
    $sucursal = $fil_dep['deposito'];    
 
35
    /* Guardar linea de caja */
 
36
    $c_efectivo = -$efectivo;
 
37
    $c_cheques = -$cheques;
 
38
    $c_vouchers = -$vouchers;
 
39
    $c_otros = -$otros;
 
40
    $detalle = "Salida para depositar (Responsable: $receptor)";
 
41
    $sql = "INSERT INTO mov_caja SET 
 
42
    caja_id = '$caja_id', detalle = '$detalle',
 
43
    efectivo ='$c_efectivo',
 
44
    cheques = '$c_cheques',
 
45
    vouchers ='$c_vouchers',
 
46
    otros = '$c_otros'";
 
47
    $result = mysql_query($sql)  or die('Invalid query: ' . mysql_error());
 
48
    $documento_id = mysql_insert_id();
 
49
    /* Guardar contabilidad */
 
50
    /* Para cada uno: Efectivo, Cheques, Vouchers, Otros */
 
51
    /* Definir rubro DEBE */
 
52
    $rub_deb = "111018";
 
53
    if($efectivo<>0){
 
54
        /* Definir rubro HABER */
 
55
        switch($deposito_id){
 
56
            case '1':
 
57
                $rub_hab = "111018";
 
58
                break;
 
59
            case '2':
 
60
                $rub_hab = "111011";
 
61
                break;
 
62
            case '3':
 
63
                $rub_hab = "111012";
 
64
                break;
 
65
        }
 
66
        /* guardar linea contabilidad */
 
67
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$efectivo,$documento_id);
 
68
    }
 
69
    if($cheques<>0){
 
70
        /* Definir rubro HABER */
 
71
        switch($deposito_id){
 
72
            case '1':
 
73
                $rub_hab = "111018";
 
74
                break;
 
75
            case '2':
 
76
                $rub_hab = "111021";
 
77
                break;
 
78
            case '3':
 
79
                $rub_hab = "111022";
 
80
                break;
 
81
        }
 
82
        /* guardar linea contabilidad */
 
83
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$cheques,$documento_id);
 
84
    }
 
85
    if($vouchers<>0){
 
86
        /* Definir rubro HABER */
 
87
        switch($deposito_id){
 
88
            case '1':
 
89
                $rub_hab = "111018";
 
90
                break;
 
91
            case '2':
 
92
                $rub_hab = "113002";
 
93
                break;
 
94
            case '3':
 
95
                $rub_hab = "113003";
 
96
                break;
 
97
        }
 
98
        /* guardar linea contabilidad */
 
99
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$vouchers,$documento_id);
 
100
    }
 
101
    if($otros<>0){
 
102
        /* Definir rubro HABER */
 
103
        switch($deposito_id){
 
104
            case '1':
 
105
                $rub_hab = "111018";
 
106
                break;
 
107
            case '2':
 
108
                $rub_hab = "111025";
 
109
                break;
 
110
            case '3':
 
111
                $rub_hab = "111026";
 
112
                break;
 
113
        }
 
114
        /* guardar linea contabilidad */
 
115
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$otros,$documento_id);
 
116
    }
 
117
    /* Generar documento para imprimir */
 
118
    encabezado_informe("Salida de caja para depósito");
 
119
    echo "<h2>Sale de: $sucursal</h2>";
 
120
    echo "<h3>A cargo de: $receptor</h3>";
 
121
    echo "Con fecha ".mysql_a_fecha($fecha).", el siguiente detalle:";
 
122
    encabezado_tabla(array("Concepto","Monto"));
 
123
    echo "<tr><td>Efectivo: </td><td>".moneda($efectivo)."</td></tr>";
 
124
    echo "<tr><td>Cheques: </td><td>".moneda($cheques)."</td></tr>";
 
125
    echo "<tr><td>Vouchers: </td><td>".moneda($vouchers)."</td></tr>";
 
126
    echo "<tr><td>Otros: </td><td>".moneda($otros)."</td></tr>";
 
127
    echo "<tr><td>Total: </td><td>".moneda($efectivo+$cheques+$vouchers+$otros)."</td></tr>";
 
128
    fin_tabla();
 
129
    echo "Identificación del documento: $documento_id";
 
130
    echo '<br /><br />';
 
131
    echo "<div align='right'>Firma del receptor</div>";
 
132
    echo "<div align='right'>Copia para caja</div>";
 
133
    linea();
 
134
    echo '<br /><br />';
 
135
    echo "<h1>Salida de caja para depósito</h1>";
 
136
    echo "<h2>Sale de: $sucursal</h2>";
 
137
    echo "<h3>A cargo de: $receptor</h3>";
 
138
    echo "Con fecha ".mysql_a_fecha($fecha).", el siguiente detalle:";
 
139
    encabezado_tabla(array("Concepto","Monto"));
 
140
    echo "<tr><td>Efectivo: </td><td>".moneda($efectivo)."</td></tr>";
 
141
    echo "<tr><td>Cheques: </td><td>".moneda($cheques)."</td></tr>";
 
142
    echo "<tr><td>Vouchers: </td><td>".moneda($vouchers)."</td></tr>";
 
143
    echo "<tr><td>Otros: </td><td>".moneda($otros)."</td></tr>";
 
144
    echo "<tr><td>Total: </td><td>".moneda($efectivo+$cheques+$vouchers+$otros)."</td></tr>";
 
145
    fin_tabla();
 
146
    echo "Identificación del documento: $documento_id";
 
147
    echo '<br /><br />';
 
148
    echo "<div align='right'>Firma del cajero</div>";
 
149
    echo "<div align='right'>Copia para receptor</div>";
 
150
    linea();
 
151
    fin();
 
152
    /* Redirigir */
 
153
    echo '<script type="text/javascript">
 
154
    window.print();
 
155
    </script>';
 
156
    redirigir("caja_ver.php?accion=listado&$cola");
 
157
}
 
158
function ingresar(){
 
159
    /* Recuperacion de variables */
 
160
    $id = $_GET['id'];
 
161
    $deposito_id = $_GET['deposito_id'];
 
162
    $caja_id = $_GET['caja_id'];
 
163
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id";
 
164
    /* buscar registros */
 
165
    $fil_dep = buscar_registro("depositos","id",$deposito_id);
 
166
    $sucursal = $fil_dep['deposito'];
 
167
    encabezado("AUN NO ESTA FUNCIONANDO NO USAR !!!!!!");
 
168
    formulario("caja_111018.php?accion=guardar&$cola");
 
169
    echo "<h2>Salida de: $sucursal</h2>";
 
170
    encabezado_tabla(array("Campo","Valor"));
 
171
    echo "<tr>";
 
172
    input_texto("Receptor:","receptor","Mariana Porta");
 
173
    input_numero("Efectivo:","efectivo",0);
 
174
    input_numero("Cheques:","cheques",0);
 
175
    input_numero("Vouchers:","vouchers",0);
 
176
    input_numero("Otros:","otros",0);
 
177
    fin_tabla();
 
178
    botones();
 
179
    fin_formulario();
 
180
    echo '<div align="right">';
 
181
    boton("Volver","caja_ver.php?$cola");
 
182
    echo '</div>';
 
183
    fin();
 
184
}
 
185
?>