~marcelo-escobal/geined/Alianza

« back to all changes in this revision

Viewing changes to caja_111031.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
/*! Movimientos de caja Deposito MN */
 
3
include('funciones.php');
 
4
include('datos.php');
 
5
autorizacion(5);
 
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 = "Depósito realizado por $receptor";
 
41
        $documento_id = movcaja_add($caja_id,$detalle,-$efectivo,-$cheques,-$vouchers,-$otros);
 
42
    /* Guardar contabilidad */
 
43
    /* Para cada uno: Efectivo, Cheques, Vouchers, Otros */
 
44
    /* Definir rubro DEBE */
 
45
    if($efectivo<>0){
 
46
                $rub_deb = "111031";
 
47
        /* Definir rubro HABER */
 
48
        switch($deposito_id){
 
49
            case '1':
 
50
                $rub_hab = "111018";
 
51
                break;
 
52
            case '2':
 
53
                $rub_hab = "111011";
 
54
                break;
 
55
            case '3':
 
56
                $rub_hab = "111012";
 
57
                break;
 
58
        }
 
59
        /* guardar linea contabilidad */
 
60
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$efectivo,$documento_id);
 
61
                movcaja_cont($documento_id);
 
62
    }
 
63
    if($cheques<>0){
 
64
                $rub_deb = "111031";
 
65
        /* Definir rubro HABER */
 
66
        switch($deposito_id){
 
67
            case '1':
 
68
                $rub_hab = "111027";
 
69
                break;
 
70
            case '2':
 
71
                $rub_hab = "111021";
 
72
                break;
 
73
            case '3':
 
74
                $rub_hab = "111022";
 
75
                break;
 
76
        }
 
77
        /* guardar linea contabilidad */
 
78
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$cheques,$documento_id);
 
79
                movcaja_cont($documento_id);
 
80
    }
 
81
    if($vouchers<>0){
 
82
                $rub_deb = "113009";
 
83
        /* Definir rubro HABER */
 
84
        switch($deposito_id){
 
85
            case '1':
 
86
                $rub_hab = "113010";
 
87
                break;
 
88
            case '2':
 
89
                $rub_hab = "113002";
 
90
                break;
 
91
            case '3':
 
92
                $rub_hab = "113003";
 
93
                break;
 
94
        }
 
95
        /* guardar linea contabilidad */
 
96
        asiento_doble($fecha,$detalle,$rub_deb,$rub_hab,$vouchers,$documento_id);
 
97
                movcaja_cont($documento_id);
 
98
    }
 
99
    if($otros<>0){
 
100
                /* Asumo DE FORMA ARRIESGADA que es un depósito de moneda extranjera */
 
101
                $rub_deb = "111032";
 
102
        /* Definir rubro HABER */
 
103
        switch($deposito_id){
 
104
            case '1':
 
105
                $rub_hab = "111029";
 
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
                movcaja_cont($documento_id);
 
117
    }
 
118
    /* Generar documento para imprimir */
 
119
    encabezado_informe("Deposito bancario / vouchers");
 
120
    echo "<h2>Se deposita de: $sucursal</h2>";
 
121
    echo "<h3>A cargo de: $receptor</h3>";
 
122
    echo "Con fecha ".mysql_a_fecha($fecha).", el siguiente detalle:";
 
123
    encabezado_tabla(array("Concepto","Monto"));
 
124
    echo "<tr><td>Efectivo: </td><td>".moneda($efectivo)."</td></tr>";
 
125
    echo "<tr><td>Cheques: </td><td>".moneda($cheques)."</td></tr>";
 
126
    echo "<tr><td>Vouchers: </td><td>".moneda($vouchers)."</td></tr>";
 
127
    echo "<tr><td>Otros: </td><td>".moneda($otros)."</td></tr>";
 
128
    echo "<tr><td>Total: </td><td>".moneda($efectivo+$cheques+$vouchers+$otros)."</td></tr>";
 
129
    fin_tabla();
 
130
    echo "Identificación del documento: $documento_id";
 
131
    echo '<br /><br />';
 
132
    echo "<div align='right'>Firma del receptor</div>";
 
133
    echo "<div align='right'>Copia para caja</div>";
 
134
    linea();
 
135
    echo '<br /><br />';
 
136
    echo "<h1>Salida de caja para depósito</h1>";
 
137
    echo "<h2>Sale de: $sucursal</h2>";
 
138
    echo "<h3>A cargo de: $receptor</h3>";
 
139
    echo "Con fecha ".mysql_a_fecha($fecha).", el siguiente detalle:";
 
140
    encabezado_tabla(array("Concepto","Monto"));
 
141
    echo "<tr><td>Efectivo: </td><td>".moneda($efectivo)."</td></tr>";
 
142
    echo "<tr><td>Cheques: </td><td>".moneda($cheques)."</td></tr>";
 
143
    echo "<tr><td>Vouchers: </td><td>".moneda($vouchers)."</td></tr>";
 
144
    echo "<tr><td>Otros: </td><td>".moneda($otros)."</td></tr>";
 
145
    echo "<tr><td>Total: </td><td>".moneda($efectivo+$cheques+$vouchers+$otros)."</td></tr>";
 
146
    fin_tabla();
 
147
    echo "Identificación del documento: $documento_id";
 
148
    echo '<br /><br />';
 
149
    echo "<div align='right'>Firma del cajero</div>";
 
150
    echo "<div align='right'>Copia para contabilidad</div>";
 
151
    linea();
 
152
    fin();
 
153
    /* Redirigir */
 
154
    echo '<script type="text/javascript">
 
155
    window.print();
 
156
    </script>';
 
157
    redirigir("caja_ver.php?accion=listado&$cola");
 
158
}
 
159
function ingresar(){
 
160
    /* Recuperacion de variables */
 
161
    $id = $_GET['id'];
 
162
    $deposito_id = $_GET['deposito_id'];
 
163
    $caja_id = $_GET['caja_id'];
 
164
    $cola = "deposito_id=$deposito_id&caja_id=$caja_id";
 
165
    /* buscar registros */
 
166
    $fil_dep = buscar_registro("depositos","id",$deposito_id);
 
167
    $sucursal = $fil_dep['deposito'];
 
168
    encabezado("Salida de caja a Depósito bancario / de Vouchers");
 
169
    formulario("caja_111031.php?accion=guardar&$cola");
 
170
    echo "<h2>Salida de: $sucursal</h2>";
 
171
    encabezado_tabla(array("Campo","Valor"));
 
172
    echo "<tr>";
 
173
    input_texto("Deposita:","receptor","Mariana Porta");
 
174
    input_numero("Efectivo:","efectivo",0);
 
175
    input_numero("Cheques:","cheques",0);
 
176
    input_numero("Vouchers:","vouchers",0);
 
177
    input_numero("Otros:","otros",0);
 
178
    fin_tabla();
 
179
    botones();
 
180
    fin_formulario();
 
181
    echo '<div align="right">';
 
182
    boton("Volver","caja_ver.php?$cola");
 
183
    echo '</div>';
 
184
    fin();
 
185
}
 
186
?>