-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathnueva_factura.php
170 lines (155 loc) · 5.75 KB
/
nueva_factura.php
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
<?php
/*-------------------------
Autor: Obed Alvarado
Web: obedalvarado.pw
Mail: [email protected]
---------------------------*/
session_start();
if (!isset($_SESSION['user_login_status']) AND $_SESSION['user_login_status'] != 1) {
header("location: login.php");
exit;
}
$active_facturas="active";
$active_productos="";
$active_clientes="";
$active_usuarios="";
$title="Nueva Factura | Simple Invoice";
/* Connect To Database*/
require_once ("config/db.php");//Contiene las variables de configuracion para conectar a la base de datos
require_once ("config/conexion.php");//Contiene funcion que conecta a la base de datos
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include("head.php");?>
</head>
<body>
<?php
include("navbar.php");
?>
<div class="container">
<div class="panel panel-info">
<div class="panel-heading">
<h4><i class='glyphicon glyphicon-edit'></i> Nueva Factura</h4>
</div>
<div class="panel-body">
<?php
include("modal/buscar_productos.php");
include("modal/registro_clientes.php");
include("modal/registro_productos.php");
?>
<form class="form-horizontal" role="form" id="datos_factura">
<div class="form-group row">
<label for="nombre_cliente" class="col-md-1 control-label">Cliente</label>
<div class="col-md-3">
<input type="text" class="form-control input-sm" id="nombre_cliente" placeholder="Selecciona un cliente" required>
<input id="id_cliente" type='hidden'>
</div>
<label for="tel1" class="col-md-1 control-label">Teléfono</label>
<div class="col-md-2">
<input type="text" class="form-control input-sm" id="tel1" placeholder="Teléfono" readonly>
</div>
<label for="mail" class="col-md-1 control-label">Email</label>
<div class="col-md-3">
<input type="text" class="form-control input-sm" id="mail" placeholder="Email" readonly>
</div>
</div>
<div class="form-group row">
<label for="empresa" class="col-md-1 control-label">Vendedor</label>
<div class="col-md-3">
<select class="form-control input-sm" id="id_vendedor">
<?php
$sql_vendedor=mysqli_query($con,"select * from users order by lastname");
while ($rw=mysqli_fetch_array($sql_vendedor)){
$id_vendedor=$rw["user_id"];
$nombre_vendedor=$rw["firstname"]." ".$rw["lastname"];
if ($id_vendedor==$_SESSION['user_id']){
$selected="selected";
} else {
$selected="";
}
?>
<option value="<?php echo $id_vendedor?>" <?php echo $selected;?>><?php echo $nombre_vendedor?></option>
<?php
}
?>
</select>
</div>
<label for="tel2" class="col-md-1 control-label">Fecha</label>
<div class="col-md-2">
<input type="text" class="form-control input-sm" id="fecha" value="<?php echo date("d/m/Y");?>" readonly>
</div>
<label for="email" class="col-md-1 control-label">Pago</label>
<div class="col-md-3">
<select class='form-control input-sm' id="condiciones">
<option value="1">Efectivo</option>
<option value="2">Cheque</option>
<option value="3">Transferencia bancaria</option>
<option value="4">Crédito</option>
</select>
</div>
</div>
<div class="col-md-12">
<div class="pull-right">
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#nuevoProducto">
<span class="glyphicon glyphicon-plus"></span> Nuevo producto
</button>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#nuevoCliente">
<span class="glyphicon glyphicon-user"></span> Nuevo cliente
</button>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#myModal">
<span class="glyphicon glyphicon-search"></span> Agregar productos
</button>
<button type="submit" class="btn btn-default">
<span class="glyphicon glyphicon-print"></span> Imprimir
</button>
</div>
</div>
</form>
<div id="resultados" class='col-md-12' style="margin-top:10px"></div><!-- Carga los datos ajax -->
</div>
</div>
<div class="row-fluid">
<div class="col-md-12">
</div>
</div>
</div>
<hr>
<?php
include("footer.php");
?>
<script type="text/javascript" src="js/VentanaCentrada.js"></script>
<script type="text/javascript" src="js/nueva_factura.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(function() {
$("#nombre_cliente").autocomplete({
source: "./ajax/autocomplete/clientes.php",
minLength: 2,
select: function(event, ui) {
event.preventDefault();
$('#id_cliente').val(ui.item.id_cliente);
$('#nombre_cliente').val(ui.item.nombre_cliente);
$('#tel1').val(ui.item.telefono_cliente);
$('#mail').val(ui.item.email_cliente);
}
});
});
$("#nombre_cliente" ).on( "keydown", function( event ) {
if (event.keyCode== $.ui.keyCode.LEFT || event.keyCode== $.ui.keyCode.RIGHT || event.keyCode== $.ui.keyCode.UP || event.keyCode== $.ui.keyCode.DOWN || event.keyCode== $.ui.keyCode.DELETE || event.keyCode== $.ui.keyCode.BACKSPACE )
{
$("#id_cliente" ).val("");
$("#tel1" ).val("");
$("#mail" ).val("");
}
if (event.keyCode==$.ui.keyCode.DELETE){
$("#nombre_cliente" ).val("");
$("#id_cliente" ).val("");
$("#tel1" ).val("");
$("#mail" ).val("");
}
});
</script>
</body>
</html>