Beruflich Dokumente
Kultur Dokumente
1
Ao del Buen Servicio al Ciudadano
INSTITUCIN
Universidad Politcnica de la Amazona
ESCUELA
Ing. Sistemas y Telemtica
TITULO
Sistema Comercial de la Empresa
InforSystems Computer S.A.C
DOCENTE
Ing: Marco Aurelio Porro Chulli
AUTORES
Angaspilco Montenegro Geyser
1
INTRODUCCIN
En la actualidad las empresas necesitan informatizar sus procesos para as tener
una mejor performance en la consecucin de sus objetivos empresariales para
ser competitivos en el mercado globalizado donde se encuentran inmersos.
1
DEDICATORIA
2
AGRADECIMIENTO
3
INDICE
I. Anlisis y Diagnstico de la Empresa ........................................................................ 7
1. Descripcin de la Empresa........................................................................................ 7
2. Estructura Orgnica de la Empresa ........................................................................ 7
3. Visin............................................................................................................................... 7
4. Misin .............................................................................................................................. 7
5. Objetivos......................................................................................................................... 8
5.1. General .................................................................................................................... 8
5.2. Especficos............................................................................................................. 8
6. Breve descripcin de los Procesos Involucrados............................................... 8
6.1. Descripcin de los Procesos ............................................................................ 8
6.2. Descripcin de los Documentos ...................................................................... 9
7. Metodologa RUP-Diagrama UML........................................................................... 10
7.1. Anlisis de Requerimientos (Modelo de Casos de Usos del Negocio,
Modelo de Objetos del Negocio y Modelo del Dominio)...................................... 10
7.2. Diagrama de Casos de Uso ............................................................................. 18
7.3. Diagrama de Componentes ............................................................................. 20
7.4. Diagrama de Despliegue .................................................................................. 21
9. Diseo orientado a objetos...................................................................................... 23
1. Diseo de la base de datos...................................................................................... 23
1.1. Modelo E-R........................................................................................................... 23
1.2 . Diseo lgico .................................................................................................... 24
1.2. Diseo fsico........................................................................................................ 25
1.3. Diseo e implementacin de la base de datos (procedimientos
almacenados vistas, activadores, cursores, etc.) ................................................. 27
II. Arquitectura Tecnolgica Requerida ........................................................................ 29
1. Plataformas de Tecnologia ...................................................................................... 29
1.1. Requerimiento del Hardware y Software ..................................................... 29
Hardware: del Sistema .................................................................................................. 29
III. Implementacin al Sistema...................................................................................... 30
1.Pantallas del Sistema..................................................................................................... 30
1.1 Menu de Acceso....................................................................................................... 30
1.2 Menu Principal.......................................................................................................... 30
1.3 Mantenimientos: ..................................................................................................... 31
1.3.1- Categorias............................................................................................................. 31
4
1.3.2- Clientes.................................................................................................................. 31
1.3.3- Productos.............................................................................................................. 32
1.3.4- Proveedor.............................................................................................................. 32
1.3.5- Serie........................................................................................................................ 33
1.3.6- Comprobante........................................................................................................ 33
1.3.7- Marca...................................................................................................................... 33
1.3.8- Usuarios ................................................................................................................ 34
1.4- Movimientos: ............................................................................................................... 35
1.4.1- Ventas .................................................................................................................... 35
1.4.2- Compras ................................................................................................................ 35
1.5- Consultas: .................................................................................................................... 36
1.5.1- Categorias............................................................................................................. 36
1.5.2- Producto................................................................................................................ 36
1.5.3- Proveedor.............................................................................................................. 36
1.5.4- Serie........................................................................................................................ 37
1.5.5- Comprobante........................................................................................................ 37
1.5.6- Marca...................................................................................................................... 37
1.5.7- Clientes.................................................................................................................. 38
1.6.Configuracin:.............................................................................................................. 38
1.6.1- Global ..................................................................................................................... 38
1.7- Reportes: ...................................................................................................................... 39
1.7.1- Ventas .................................................................................................................... 39
1.7.2- Compras ................................................................................................................ 40
1.8- Acerca: .......................................................................................................................... 41
1.8.1- Autores .................................................................................................................. 41
1.9- Factura De Venta:....................................................................................................... 42
2. Codigo de la Aplicacin............................................................................................ 43
2.1 Menu de Acceso....................................................................................................... 43
2.2 Mantenimientos: .......................................................................................................... 44
2.2.1- Categorias............................................................................................................. 44
2.2.2- Clientes.................................................................................................................. 45
2.2.3- Productos.............................................................................................................. 47
2.2.4- Proveedor.............................................................................................................. 50
2.2.5- Serie........................................................................................................................ 52
2.2.6- Comprobante........................................................................................................ 54
2.2.7- Marca...................................................................................................................... 55
2.2.8- Usuario................................................................................................................... 57
5
2.3- Movimientos: ............................................................................................................... 59
2.3.1- Ventas .................................................................................................................... 59
2.3.2- Compras ................................................................................................................ 68
2.4- Consultas: .................................................................................................................... 74
2.4.1- Categorias............................................................................................................. 74
2.4.2- Productos.............................................................................................................. 76
2.4.3- Proveedor.............................................................................................................. 80
2.4.4- Serie........................................................................................................................ 82
2.4.5- Comprobante........................................................................................................ 84
2.4.6- Marca...................................................................................................................... 86
2.4.7- Cliente .................................................................................................................... 88
2.5.-Configuracin: ............................................................................................................ 91
2.5.1- Global ..................................................................................................................... 91
2.6- Reportes: ...................................................................................................................... 95
2.6.1- Ventas .................................................................................................................... 95
2.6.2- Compras ................................................................................................................ 96
Conclusiones................................................................................................................... 98
Recomendaciones.......................................................................................................... 99
Glosario de Trminos.................................................................................................. 100
Bibliografia..................................................................................................................... 101
Anexos ............................................................................................................................ 102
6
Sistema Comercial de la empresa InforSystems Computer S.A.C.
1. Descripcin de la Empresa
Directorio
Gerencia general
Secretaria
3. Visin
Ser la empresa lder en el nororiente del Per en la comercializacin de equipos de
cmputo y en brindar soluciones en telecomunicaciones.
4. Misin
Proveer equipos de cmputo y soluciones en telecomunicaciones a nuestros clientes
del nororiente del Per, asegurndoles una compra segura mediante una slida
garanta post-venta y el total cumplimiento de las garantas brindadas de nuestros
productos y servicios.
7
5. Objetivos
5.1.General
Abrir nuevas tiendas en diferentes lugares del nor oriente del Per, asimismo
liderar tecnologa, como tambin tener liderazgo en la logstica y ser reconocido
por el manejo de buenas prcticas empresariales.
5.2.Especficos
8
El cajero registra el comprobante de venta (factura o boleta).
Proceso de compras
El proceso de compras tiene sub procesos que a continuacin se
detallan:
1. Emisin de solicitud de cotizacin a los proveedores.
Se elabora una lista de productos con stock insuficiente.
Se enva por correo electrnico a los proveedores que venden dichos
Productos.
9
La boleta se entrega cuando el monto de la venta supera los 5
nuevos soles, caso contrario no es obligacin entregar la boleta de
venta, salvo que el comprador lo solicite.
La factura se realiza cuando el comprador tiene ruth, puede ser una
persona natural o jurdica.
10
Casos de usos del negocio
Gestionar Compra
Cajero
Proveedor
Gestionar Marca
Cliente
Gestionar Venta
Gestionar Usuario
Vendedor
Gestionar Proveedor Gestionar Serie Gestionar Cliente Gestionar Producto Gestionar Comprobante Gestionar Categoria
11
Modelo de objetos del negocio usuario
Consultar
Cajero
Usuario
(from Use Case View)
Registrando Usuario
Usuario Registrar/Modificar/Anular
(from Use Case View)
Consultar
Proveedor
Cajero
(from Use Case View)
Registrar Proveedor
Registrar/Modificar/Anular
Proveedor
(from Use Case View)
12
Consultar
Serie
Cajero
Registrando Serie
(from Use Case View) Consulatr
Registrar/Modificar/Anular Comprobante
Consulatr Cliente
Cajero
(from Use Case View) Registrar/Modificar/Anular
Registrando Cliente
Cliente
(from Use Case View)
13
Consultar
Producto
Consultar
Cajero Registrar Producto
(from Use Case View)
Consular
Categoria
Registrar/Modificar/Anular
Marca
Consultar
Comprobante
Cajero
Registrar Comprobante
(from Use Case View)
Registrar/Modificar/Anular
14
Consultar
Categoria
Cajero
(from Use Case View) Rgistrando Categoria
Registrar/Modificar/Anular
consultar
Producto
consultar
Registrando venta
consultar
Cliente
consultar
Comprobante
Serie
15
Marca
Cajero
Registrando Marca
(from Use Case View)
Registra/Modificar/Anular
consulta/modificar
consultar Compra
Cajero
(from Use Case View)
Registrando compra
consultar
Proveedor
Producto
Modelo de dominio
16
Serie +1
(from Diagrama de clases)
+n
+1
+n
Comprobante +1
(from Diagrama de clases) +n
+n +n +1 Cliente
Venta
(from Diagrama de clases)
(from Diagrama de clases)
+n
+n +1
+1
Categoria +1 +n +n Marca
Producto Persona Usuario
(from Diagrama de clases) (from Diagrama de clases) (from Diagrama de clases) (from Diagrama de clases)
+n
+n
Compra Proveedor
(from Diagrama de clases) (from Diagrama de clases)
+n +1
17
7.2.Diagrama de Casos de Uso
18
19
7.3.Diagrama de Componentes
PComprobante.java
GESTION SERIE
(Class)
SistemaDistribuidora.Datos GESTION MARCA
(funciones) (Class)
PVenta.java
GESTION DE
PCliente.java
VENTAS (Class)
GESTION GESTION USUARIO GESTION PDetalleVenta.java
CLIENTE (Class) (Class) PRODUCTO (Class) GESTION Pserie.java
COMPRAS (Class) PComprobante.java
GESTION PCategoria.java
PCliente.java PProducto.java CATEGORIA (Class)
PPersona.java
PPersona.java PMarca.java PProveedor.java
PCategoria.java PUsuario.java
PDetalleCompra.java
Modelo Fisico
SisComercial.Logica Getters Modelo Lgico
PROYECTO-VENTAS
20
7.4.Diagrama de Despliegue
21
8. Cronograma de Actividades (Diagrama de Gantt)
22
9. Diseo orientado a objetos
23
1.2 . Diseo lgico
Persona Proveedor
CodigoPersona : Integer CodProvee : Integer
Dni : Char(8) Compra Ruc : Varchar(11)
Nombres : Varchar(50) CodCompra : Integer RSocial : Varchar(30)
ApellidoP : Varchar(50) Numero : Integer EstadoRuc : Char(1)
ApellidoM : Varchar(50) Serie : Varchar(5) Telef : Char(9)
FeNac : Date TipDocm : Varchar(30) +n +1 Direccion : Varchar()30
Direc : Varchar(30) FecCompra : Date Ubicacion : Varchar(30)
Ubicacion : Varchar(30) FechaRegisto : Date Estado : Char(1)
Telf : Char(9) Igv : Char(1)
Estado : Char(1) Estado : Char(1)
Categoria
CodigoCategoria : Integer
+n
Categoria : Varchar(30)
Estado : Char(1)
Cliente
CodCliente : Integer +1
Usuario
CodUsuario : Integer +1 +n
NomUsuario : Varchar(30)
ClavUsuario : Varchar(30) +n
TipoUsuario : Varchar(30) +1 +n Producto
Estado : Char(1) CodProdcto : Integer
Venta Descrip : Varchar(50)
+n
CodigoVenta : Integer OtrasCaracter : Varchar(30)
+n Modelo : Varchar(30)
Numero : Integer +n
+n FechaVents : Date PrcCompra : Money
Comprobante +1 Igv : IChar(1) PrecVenta : Money
Estado : Char(1) Estado : Char(1)
CodigoComprobante : Integer
Descripcin : Varchar(30)
Estado : Char(1) +n +n
+1
+1 +1
+n Serie Marca
CodigoSerie : Integer CodigoMarca : Integer
Serie : Varchar(5) Descripcin : Varchar(30)
Numero : Integer Estado : Char(1)
Estado : Char(1)
24
1.2. Diseo fsico
25
26
1.3. Diseo e implementacin de la base de datos (procedimientos
almacenados vistas, activadores, cursores, etc.)
Tabla: Usuario
Tabla: Proveedor
Tabla: Serie
Tabla: Cliente
Tabla: Producto
27
Tabla: Comprobante
Tabla: Categora
Tabla: Venta
Tabla: Marca
Tabla: Compra
28
Tabla: DetalleVenta
Tabla: DetalleCompra
1. Plataformas de Tecnologia
29
III. Implementacin al Sistema
30
1.3 Mantenimientos:
1.3.1- Categorias
1.3.2- Clientes
31
1.3.3- Productos
1.3.4- Proveedor
32
1.3.5- Serie
1.3.6- Comprobante
1.3.7- Marca
33
1.3.8- Usuarios
34
1.4- Movimientos:
1.4.1- Ventas
1.4.2- Compras
35
1.5- Consultas:
1.5.1- Categorias
1.5.2- Producto
1.5.3- Proveedor
36
1.5.4- Serie
1.5.5- Comprobante
1.5.6- Marca
37
1.5.7- Clientes
1.6.Configuracin:
1.6.1- Global
38
1.7- Reportes:
1.7.1- Ventas
39
1.7.2- Compras
40
1.8- Acerca:
1.8.1- Autores
41
1.9- Factura De Venta:
42
2. Codigo de la Aplicacin
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import Base.ConectaBD;
import javax.swing.JOptionPane;
public Frm_Login() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
Frm_Venta.codusuario = cnx.rs.getInt(1);
FrmMenuPrincipal.ues = cnx.rs.getString(2);
FrmMenuPrincipal FRM_menu = new FrmMenuPrincipal();
//Estamos llamando al menu
FRM_menu.show();
} //0 es el icono de x --- null es el tipo de la ventana
//2 signo de admiracin
43
//1 signo de informacin
else {
JOptionPane.showMessageDialog(null, "Usuario y/o contrasea
incorrecta", "Accesono valido", 2);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
2.2 Mantenimientos:
2.2.1- Categorias
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class Frm_Categoria extends javax.swing.JFrame {
public Frm_Categoria() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
44
});
setLocationRelativeTo(null);
}
private void JBTNguardarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
String sql;
sql = ("INSERT INTO Categoria (Categoria) VALUES ('" +
this.jXTextDescripcion.getText() + "')");
try {
if (Sw == 0) {
r = JOptionPane.showConfirmDialog(null, "Grabar datos", "registrar",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (r == JOptionPane.YES_OPTION) {
cnx.stm.execute(sql);
limpiar();
}
}
if (Sw == 1) {
r = JOptionPane.showConfirmDialog(null, "Actualizar datos", "registrar",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (r == JOptionPane.YES_OPTION) {
cnx.stm.execute("UPDATE Categoria SET Categoria='" +
this.jXTextDescripcion.getText().toUpperCase() + "'where CodigoCategoria='" +
jXTextCodigo.getText() + "'");
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
}
2.2.2- Clientes
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Categoria.jXTextCodigo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.sql.Date;
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
45
int Sw;
public Frm_Cliente() {
initComponents();
jXTextCodigo.setVisible(false);
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
String idpersona = "";
try {
46
cnx.stm.execute("INSERT INTO Persona
(DNI,Nombres,ApellidoP,ApellidoM,FeNac,Direc,Ubicacion,Telf)VALUES ('" +
this.jXTextDni.getText() + "','" + this.jXTextNombre.getText() + "','" +
this.jXTextApellidoPat.getText() + "','" + this.jXTextApellidMat.getText() + "','" +
this.jTextFecnac.getText() + "','" + this.jXTextDirec.getText() + "','" +
this.jXTextUbicacio.getText() + "','" + this.jXTextTelef.getText() + "')");
2.2.3- Productos
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class Frm_Producto extends javax.swing.JFrame {
47
this.jXTextCodigo.setText("");
this.jXTextDescripc.setText("");
this.jXTextCaract.setText("");
this.jXTextModelo.setText("");
this.jXTextPreciCompre.setText("");
this.jXTextPrecioVenta.setText("");
this.jXTextCantidad.setText("");
this.jCboMarc.setSelectedIndex(-1);
this.jCboCateg.setSelectedIndex(-1);
}
public void cajas(boolean estado){
this.jXTextDescripc.setEnabled(estado);
this.jXTextCaract.setEnabled(estado);
this.jXTextModelo.setEnabled(estado);
this.jXTextPreciCompre.setEnabled(estado);
this.jXTextPrecioVenta.setEnabled(estado);
this.jXTextCantidad.setEnabled(estado);
this.jCboMarc.setEnabled(estado);
this.jCboCateg.setEnabled(estado);
}
public void botones(boolean estado){
this.jBtnNuevo.setEnabled(estado);
this.jBtnGuardar.setEnabled(!estado);
this.jBtnCancelar.setEnabled(!estado);
this.jBtnActualizar.setEnabled(estado);
this.jBtnBuscar.setEnabled(estado);
}
public void cargacombo1(){
try{
cnx.rs=cnx.stm.executeQuery("SELECT Descripcion FROM Marca ORDER
BY 1");
while(cnx.rs.next()){
this.jCboMarc.addItem(cnx.rs.getString(1));
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public void cargacombo2(){
try{
cnx.rs=cnx.stm.executeQuery("SELECT Categoria FROM Categoria ORDER
BY 1");
while(cnx.rs.next()){
this.jCboCateg.addItem(cnx.rs.getString(1));
}
}
48
catch(Exception e){
System.out.println(e.getMessage());
}
}
public Frm_Producto() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
String idmarac="",idcategoria="";
try{
cnx.rs=cnx.stm.executeQuery("SELECT CodigoMarca FROM Marca WHERE
Descripcion='"+this.jCboMarc.getSelectedItem().toString()+"'");
while(cnx.rs.next()){
idmarac=cnx.rs.getString(1);
}
cnx.rs=cnx.stm.executeQuery("SELECT CodigoCategoria FROM Categoria
WHERE Categoria='"+this.jCboCateg.getSelectedItem().toString()+"'");
while(cnx.rs.next()){
idcategoria=cnx.rs.getString(1);
}
if(Sw==0){
r=JOptionPane.showConfirmDialog(null,"Grabar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute("INSERT INTO Producto
(Descrip,OtrasCaracteristicas,IdMarca,IdCategoria,Modelo,PrecCompra,PrecVenta,
Cantidad)VALUES
('"+this.jXTextDescripc.getText().toUpperCase()+"','"+jXTextCaract.getText()+"','"+
idmarac +"','"+ idcategoria
+"','"+this.jXTextModelo.getText()+"','"+this.jXTextPreciCompre.getText()+"','"+this.j
XTextPrecioVenta.getText()+"','"+this.jXTextCantidad.getText()+"')");
}}
if(Sw==1){
r=JOptionPane.showConfirmDialog(null,"Actualizar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
49
cnx.stm.execute("UPDATE Producto SET
Descrip='"+this.jXTextDescripc.getText().toUpperCase()+"',OtrasCaracteristicas='"+
jXTextCaract.getText()+"',IdMarca='"+ idmarac +"',IdCategoria='"+ idcategoria
+"',Modelo='"+this.jXTextModelo.getText()+"',PrecCompra='"+this.jXTextPreciComp
re.getText()+"',PrecVenta='"+this.jXTextPrecioVenta.getText()+"',Cantidad='"+this.j
XTextCantidad.getText()+"'where CodProducto='"+jXTextCodigo.getText()+"'");
}
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
limpiar();
}
2.2.4- Proveedor
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Producto.jXTextCaract;
import static Formularios.Frm_Producto.jXTextCodigo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class Frm_Proveedor extends javax.swing.JFrame {
50
this.jXTextUbicacion.setEnabled(estado);
}
public Frm_Proveedor() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
try{
if(Sw==0){
r=JOptionPane.showConfirmDialog(null,"Grabar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute("INSERT INTO Proveedor
(RUC,RSocial,EstadoRUC,Telef,Direccion,Ubicacion)VALUES
('"+this.jXTextRuc.getText()+"','"+jXTextRazonSocl.getText()+"','"+this.jCboEstad.ge
tSelectedItem().toString()+"','"+this.jXTextTelefon.getText()+"','"+this.jXTexttDireccio
n.getText()+"','"+this.jXTextUbicacion.getText()+"')");
}}
if(Sw==1){
r=JOptionPane.showConfirmDialog(null,"Actualizar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute("UPDATE Proveedor SET
RUC='"+this.jXTextRuc.getText()+"',RSocial='"+jXTextRazonSocl.getText()+"',Estad
oRUC='"+this.jCboEstad.getSelectedItem().toString()+"',Telef='"+this.jXTextTelefon.
getText()+"',Direccion='"+this.jXTexttDireccion.getText()+"',Ubicacion='"+this.jXText
Ubicacion.getText()+"'where CodProvee='"+jXTextCodigo.getText()+"'");
}
51
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
limpiar();
}
2.2.5- Serie
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Producto.jCboCateg;
import static Formularios.Frm_Producto.jCboMarc;
import static Formularios.Frm_Producto.jXTextCaract;
import static Formularios.Frm_Producto.jXTextCodigo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class Frm_Serie extends javax.swing.JFrame {
this.jCboComprobante.setEnabled(estado);
this.jXTextSerie.setEnabled(estado);
this.jXTextNumero.setEnabled(estado);
}
public void botones(boolean estado){
this.jBtnNuevo.setEnabled(estado);
this.jBtnGuardar.setEnabled(!estado);
this.jBtnCancelar.setEnabled(!estado);
this.jBtnActualizar.setEnabled(estado);
this.jBtnBuscar.setEnabled(estado);
}
public void cargacombo1(){
try{
cnx.rs=cnx.stm.executeQuery("SELECT Descripcion FROM Comprobante
ORDER BY 1");
52
while(cnx.rs.next()){
this.jCboComprobante.addItem(cnx.rs.getString(1));
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public Frm_Serie() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
String idcomprobant="";
try{
cnx.rs=cnx.stm.executeQuery("SELECT CodigoComprobante FROM
Comprobante WHERE
Descripcion='"+this.jCboComprobante.getSelectedItem().toString()+"'");
while(cnx.rs.next()){
idcomprobant=cnx.rs.getString(1);
}
if(Sw==0){
r=JOptionPane.showConfirmDialog(null,"Grabar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute("INSERT INTO Serie
(IdComprobante,Serie,Numero)VALUES ('"+ idcomprobant
+"','"+jXTextSerie.getText()+"','"+this.jXTextNumero.getText()+"')");
}}
if(Sw==1){
r=JOptionPane.showConfirmDialog(null,"Actualizar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
53
cnx.stm.execute("UPDATE Serie SET IdComprobante='"+ idcomprobant
+"',Serie='"+jXTextSerie.getText()+"',Numero='"+this.jXTextNumero.getText()+"'whe
re CodigoSerie='"+jXTextCodigo.getText()+"'");
}
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
limpiar();
}
2.2.6- Comprobante
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Marca.jXTextCodigo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class Frm_Comprobante extends javax.swing.JFrame {
54
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
String sql;
sql=("INSERT INTO Comprobante (Descripcion) VALUES ('"+
this.jXTextDescripcion.getText() +"')");
try{
if(Sw==0){
r=JOptionPane.showConfirmDialog(null,"Grabar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute(sql);
limpiar();
}
}
if(Sw==1){
r=JOptionPane.showConfirmDialog(null,"Actualizar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute("UPDATE Comprobante SET
Descripcion='"+this.jXTextDescripcion.getText().toUpperCase()+"'where
CodigoComprobante='"+jXTextCodigo.getText()+"'");
limpiar();
}
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
}
2.2.7- Marca
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Categoria.jXTextCodigo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
public class Frm_Marca extends javax.swing.JFrame {
55
ConectaBD cnx=new ConectaBD();
int Sw;
56
r=JOptionPane.showConfirmDialog(null,"Actualizar
datos","registrar",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if(r==JOptionPane.YES_OPTION){
cnx.stm.execute("UPDATE Marca SET
Descripcion='"+this.jXTextDescripcion.getText().toUpperCase()+"'where
CodigoMarca='"+jXTextCodigo.getText()+"'");
limpiar();
}
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
}
2.2.8- Usuario
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Proveedor.jXTextCodigo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
57
this.JDSWclave.setEnabled(estado);
this.jCboTipo.setEnabled(estado);
this.jXTextDni.setEnabled(estado);
this.jXTextNombreUs.setEnabled(estado);
this.jXTextApater.setEnabled(estado);
this.jXTextAmater.setEnabled(estado);
this.jTextFecnac.setEnabled(estado);
this.jXTextDirec.setEnabled(estado);
this.jXTextUbicac.setEnabled(estado);
this.jXTextTelef.setEnabled(estado);
}
public Frm_Usuario() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
//registrar en persona
int r;
String idpersona = "";
try {
cnx.stm.execute("INSERT INTO Persona
(DNI,Nombres,ApellidoP,ApellidoM,FeNac,Direc,Ubicacion,Telf)VALUES ('" +
this.jXTextDni.getText() + "','" + this.jXTextNombreUs.getText() + "','" +
this.jXTextApater.getText() + "','" + this.jXTextAmater.getText() + "','" +
this.jTextFecnac.getText() + "','" + this.jXTextDirec.getText() + "','" +
this.jXTextUbicac.getText() + "','" + this.jXTextTelef.getText() + "')");
58
}
if (Sw == 0) {
r = JOptionPane.showConfirmDialog(null, "Grabar datos", "registrar",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (r == JOptionPane.YES_OPTION) {
cnx.stm.execute("INSERT INTO Usuario
(NomUsuario,ClavUsuario,TipoUsuario,IdPersona)VALUES ('" +
this.jXTextNombre.getText() + "','" +this.JDSWclave.getText()+"','"+
this.jCboTipo.getSelectedItem().toString() + "','" + idpersona + "')");
}
}
if (Sw == 1) {
r = JOptionPane.showConfirmDialog(null, "Actualizar datos", "registrar",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (r == JOptionPane.YES_OPTION) {
cnx.stm.execute("UPDATE Usuario SET NomUsuario='" +
this.jXTextNombre.getText() +
"',ClavUsuario='"+JDSWclave.getText()+"',TipoUsuario='" +
this.jCboTipo.getSelectedItem().toString() + "',IdPersona='" + idpersona + "'WHERE
CodUsuario='"+jXTextcodigo.getText()+"'");
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
botones(true);
cajas(false);
limpiar();
2.3- Movimientos:
2.3.1- Ventas
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
59
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;
public Frm_Venta() {
initComponents();
setLocationRelativeTo(null);
this.setExtendedState(NORMAL);
bloquearCampos();
iniciarbotones();
OcultaColumnas();
ocultarLabelsCodigos();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
60
}
jBtnbuscaCliente.setEnabled(false);
jBtnbuscaproducto.setEnabled(false);
}
jBtnbuscaproducto.setEnabled(true);
61
jCboserie.removeAllItems();
jCboComprobante.removeAllItems();
jCboserie.addItem("Seleccione");
jCboComprobante.addItem("Seleccione");
jtxtnumdoc.setText(null);
jtxtdni.setText(null);
jtxtnombrescliente.setText(null);
jtxtdescripcion.setText(null);
jtxtpreciocompra.setText(null);
jtxtprecioventa.setText(null);
jtxtcantidad.setText(null);
jtxtsubtotal.setText(null);
jtxtigv.setText(null);
jtxtotal.setText(null);
}
//Cargar combos
private void CargarSerie() {
try {
cnx.rs = cnx.stm.executeQuery("SELECT Serie FROM Serie where
Estado='A'");
while (cnx.rs.next()) {
this.jCboserie.addItem(cnx.rs.getString(1));
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
62
cnx.rs = cnx.stm.executeQuery("SELECT Correlativo FROM Serie where
Serie='" + this.jCboserie.getSelectedItem().toString() + "'");
if (cnx.rs.next()) {
String num = "";
int numcomprobante = cnx.rs.getInt(1) + 1;
if (numcomprobante < 10) {
num = "00000" + numcomprobante;
} else if (numcomprobante >= 10 && numcomprobante < 100) {
num = "0000" + numcomprobante;
} else if (numcomprobante >= 100 && numcomprobante < 1000) {
num = "000" + numcomprobante;
} else if (numcomprobante >= 1000 && numcomprobante < 10000) {
num = "00" + numcomprobante;
}
jtxtnumdoc.setText(num);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
63
this.igv = cnx.rs.getDouble(1);
} else {
igv = 0;
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
return igv;
}
total = (Double.parseDouble(this.jtxtsubtotal.getText()) +
(Double.parseDouble(this.jtxtigv.getText())));
BigDecimal bigTotal = new BigDecimal(total);
bigTotal = bigTotal.setScale(2, RoundingMode.HALF_UP);
jtxtotal.setText("" + bigTotal);
}
} catch (Exception e) {
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
try {
64
if (jtxtnumdoc.getText().equals("") || jCboComprobante.getSelectedIndex()
== 0 || jCboserie.getSelectedIndex() == 0
|| jtblventa.getRowCount() == 0 || jlblcodigopro.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Falta ingresar datos");
} else {
cnx.stm.execute("INSERT INTO Venta(Numero, IdSerie, Igv,
Idcliente,IdUsuario)VALUES('"
+ this.jtxtnumdoc.getText() + "'," + (this.jlblcodigoserie.getText()) +
",'" + jtxtigv.getText() + "'," + Integer.parseInt(this.jlblcodigocliente.getText()) + "," +
codusuario + ")");
65
}
JasperReport r =
JasperCompileManager.compileReport("src\\Reportes\\Factura.jrxml");
Map Parametro = new HashMap();
Parametro.put("CodigoVenta", idventa);
if (jtxtcantidad.getText().trim().equals("") ||
jtxtprecioventa.getText().trim().equals("")) {
JOptionPane.showMessageDialog(null, "Falta ingresar el precio de venta
o la cantidad");
} else {
if (Integer.parseInt(jtxtcantidad.getText()) <=
Integer.parseInt(jlblcantidad.getText())) {
66
vRow.addElement(jlblcodigopro.getText());
vRow.addElement(jtxtdescripcion.getText());
vRow.addElement(jtxtcantidad.getText().trim());
vRow.addElement(jtxtprecioventa.getText().trim());
vRow.addElement(bigImporte);
model.addRow(vRow);
Totalizar();
item++;
} else {
Vector vRow = new Vector();
vRow.addElement(item);
vRow.addElement(jlblcodigopro.getText());
vRow.addElement(jtxtdescripcion.getText());
vRow.addElement(jtxtcantidad.getText().trim());
vRow.addElement(jtxtprecioventa.getText().trim());
vRow.addElement(bigImporte);
model.addRow(vRow);
Totalizar();
item++;
}
} else {
JOptionPane.showMessageDialog(null, "El producto ya existe en la
lista");
}
} else {
JOptionPane.showMessageDialog(null, "No hay stock suficiente");
}
}
}
}
if (jtblventa.getSelectedRow() >= 0) {
DefaultTableModel modelo = (DefaultTableModel) jtblventa.getModel();
modelo.removeRow(jtblventa.getSelectedRow());
Totalizar();
} else {
JOptionPane.showMessageDialog(null, "Seleccione un producto");
}
67
2.3.2- Compras
package Formularios;
import Base.ConectaBD;
import static Formularios.Frm_Venta.buscarprod;
import static Formularios.Frm_Venta.jlblcodigopro;
import static Formularios.Frm_Venta.jtxtcantidad;
import static Formularios.Frm_Venta.jtxtconigv;
import static Formularios.Frm_Venta.jtxtdescripcion;
import static Formularios.Frm_Venta.jtxtprecioventa;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public Frm_Compra() {
initComponents();
this.setLocationRelativeTo(null);
this.setExtendedState(NORMAL);
bloquearCampos();
iniciarbotones();
OcultaColumnas();
ocultarLabelsCodigos();
titleBar1.addCloseAction(new ActionListener() {
68
public void actionPerformed(ActionEvent ae) {
close();
}
});
}
jlblcodigopro.setVisible(false);
jlblcantidad.setVisible(false);
jlblcodigoproveedor.setVisible(false);
69
jXTexTotal.setEnabled(false);
jBtnProveedor.setEnabled(false);
70
jBtnProveedor.setEnabled(false);
} else {
jBtnProveedor.setEnabled(true);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
total = (Double.parseDouble(this.jXTexDsubtotal.getText()) +
(Double.parseDouble(this.jXTextigv.getText())));
71
BigDecimal bigTotal = new BigDecimal(total);
bigTotal = bigTotal.setScale(2, RoundingMode.HALF_UP);
jXTexTotal.setText("" + bigTotal);
}
} catch (Exception e) {
}
}
private void jBtnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
try {
String fechacompra = fecha.format(this.jDcFecha.getDate());
String igb = "";//para guardar si tiene igv
int registradetalle = 0;//cuenta si ha registrado toda la tabla en detalleventa
igb = "S";
if (jXTextSerie.equals("") || jXTextnumero.getText().equals("") ||
jXTextcomprobante.getText().equals("") || jTblcompra.getRowCount() == 0 ||
jlblcodigopro.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Falta ingresar datos");
} else {
cnx.stm.execute("INSERT INTO Compra(Numero, Serie, TipDocm,
FechaCompra,Igv,IdProveedor)VALUES('"
+ this.jXTextnumero.getText() + "','" + this.jXTextSerie.getText() +
"','" + jXTextcomprobante.getText() + "','" + fechacompra + "','" + igb + "'," +
jlblcodigoproveedor.getText() + ")");
registradetalle++;
}
if (registradetalle == jTblcompra.getRowCount()) {
JOptionPane.showMessageDialog(null, "Compra registrada
correctamente");
limpiarCampos();
LimpiarTabla();
bloquearCampos();
jBtnGuardar.setEnabled(false);
jBtnCancelar.setEnabled(false);
72
jBtnNuevo.setEnabled(true);
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
private void jXTextcantidadKeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == evt.VK_ENTER) {
if (jXTextcantidad.getText().trim().equals("") ||
jXTextPrecioVenta.getText().trim().equals("") ||
jXTextCompra.getText().trim().equals("")) {
JOptionPane.showMessageDialog(null, "Falta ingresar el precio compra o
precio venta o cantidad");
} else {
73
} else {
Vector vRow = new Vector();
vRow.addElement(item);
vRow.addElement(jlblcodigopro.getText());
vRow.addElement(jXTextDescripcion.getText());
vRow.addElement(jXTextCompra.getText().trim());
vRow.addElement(jXTextPrecioVenta.getText().trim());
vRow.addElement(jXTextcantidad.getText().trim());
vRow.addElement(bigImporte);
model.addRow(vRow);
Totalizar();
item++;
}
} else {
JOptionPane.showMessageDialog(null, "El producto ya existe en la
lista");
}
}
}
} else {
JOptionPane.showMessageDialog(null, "Seleccione un producto");
}
}
2.4- Consultas:
2.4.1- Categorias
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
public class Frm_Categoria_Consulta extends javax.swing.JFrame {
74
ConectaBD cnx=new ConectaBD();
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public void limpiartabla(DefaultTableModel model){
//int x;
//DefaulTableModel posee filas que empiezan a contarse desde
for( int x=model.getRowCount()-1;x>=0;x--){
model.removeRow(x);
}
}
public void llenartabla(String consulta_SQL){
try{
cnx.rs=cnx.stm.executeQuery(consulta_SQL);
DefaultTableModel model=(DefaultTableModel) jTblCategoria.getModel();
limpiartabla(model);
while(cnx.rs.next()){
String cod=cnx.rs.getString(1);
String catg=cnx.rs.getString(2);
Vector vRow=new Vector();
vRow.addElement(cod);
vRow.addElement(catg);
model.addRow(vRow);
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public Frm_Categoria_Consulta() {
initComponents();
titleBar2.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
75
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
cnx.conectar();
String sql;
sql="SELECT * FROM Categoria";
llenartabla(sql);
}
package Formularios;
import Base.ConectaBD;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
76
try {
int fila = jTblProducto.getSelectedRow();
Frm_Producto.jXTextCodigo.setText(jTblProducto.getValueAt(fila,
0).toString());
Frm_Producto.jXTextDescripc.setText(jTblProducto.getValueAt(fila,
1).toString());
Frm_Producto.jXTextCaract.setText(jTblProducto.getValueAt(fila,
2).toString());
Frm_Producto.jCboMarc.setSelectedItem(jTblProducto.getValueAt(fila,
3).toString());
Frm_Producto.jCboCateg.setSelectedItem(jTblProducto.getValueAt(fila,
4).toString());
Frm_Producto.jXTextModelo.setText(jTblProducto.getValueAt(fila,
5).toString());
Frm_Producto.jXTextPreciCompre.setText(jTblProducto.getValueAt(fila,
6).toString());
Frm_Producto.jXTextPrecioVenta.setText(jTblProducto.getValueAt(fila,
7).toString());
Frm_Producto.jXTextCantidad.setText(jTblProducto.getValueAt(fila,
8).toString());
// this.dispose();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
// this.dispose();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void mostrar_en_compra(){
try {
77
int fila = jTblProducto.getSelectedRow();
Frm_Compra.jlblcodigopro.setText(jTblProducto.getValueAt(fila,
0).toString());
Frm_Compra.jXTextDescripcion.setText(jTblProducto.getValueAt(fila,
1).toString());
Frm_Compra.jXTextCompra.setText(jTblProducto.getValueAt(fila,
6).toString());
Frm_Compra.jXTextPrecioVenta.setText(jTblProducto.getValueAt(fila,
7).toString());
Frm_Compra.jlblcantidad.setText(jTblProducto.getValueAt(fila,
8).toString());
Frm_Compra.jXTextcantidad.setText(null);
Frm_Compra.jXTextcantidad.requestFocus();
// this.dispose();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void limpiartabla(DefaultTableModel model) {
for (int x = model.getRowCount() - 1; x >= 0; x--) {
model.removeRow(x);
}
}
78
vRow.addElement(cnx.rs.getString(2));
vRow.addElement(cnx.rs.getString(3));
vRow.addElement(cnx.rs.getString(4));
vRow.addElement(cnx.rs.getString(5));
vRow.addElement(cnx.rs.getString(6));
vRow.addElement(cnx.rs.getString(7));
vRow.addElement(cnx.rs.getString(8));
vRow.addElement(cnx.rs.getInt(9));
model.addRow(vRow);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public Frm_Producto_Consulta() {
initComponents();
this.setLocationRelativeTo(this);
}
private void jTblProductoMouseClicked(java.awt.event.MouseEvent evt) {
if (Frm_Venta.buscarprod == 1) {
monstrar_en_venta();
double igv = consultarigv();
double costoigv =
((Double.parseDouble(jTblProducto.getValueAt(jTblProducto.getSelectedRow(),
7).toString())) * igv);
double costonormal =
(Double.parseDouble(jTblProducto.getValueAt(jTblProducto.getSelectedRow(),
7).toString()));
double totalcosto = costoigv + costonormal;
BigDecimal bigSubtotal = new BigDecimal(totalcosto);
bigSubtotal = bigSubtotal.setScale(2, RoundingMode.HALF_UP);
Frm_Venta.jtxtconigv.setText("" + bigSubtotal);
Frm_Venta.buscarprod = 0;
this.dispose();
}
else if(Frm_Compra.buscarprod==1){
mostrar_en_compra();
double igv = consultarigv();
double costoigv =
((Double.parseDouble(jTblProducto.getValueAt(jTblProducto.getSelectedRow(),
7).toString())) * igv);
double costonormal =
(Double.parseDouble(jTblProducto.getValueAt(jTblProducto.getSelectedRow(),
7).toString()));
double totalcosto = costoigv + costonormal;
79
BigDecimal bigSubtotal = new BigDecimal(totalcosto);
bigSubtotal = bigSubtotal.setScale(2, RoundingMode.HALF_UP);
Frm_Compra.JTXTconigv.setText("" + bigSubtotal);
Frm_Compra.buscarprod = 0;
this.dispose();
}
else {
monstrar_en_productos();
this.dispose();
}
}
private void txtproductoKeyReleased(java.awt.event.KeyEvent evt) {
String dato = txtproducto.getText();
String sql = "SELECT * FROM Producto WHERE Descrip LIKE '%" + dato +
"%'";
try {
llenartabla(sql);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
public class Frm_Proveedor_Consulta extends javax.swing.JFrame {
80
String cod =
this.jTblProveedor.getValueAt(this.jTblProveedor.getSelectedRow(), 0).toString();
String sql = "SELECT * FROM Proveedor WHERE CodProvee='" + cod + "'";
try {
cnx.rs = cnx.stm.executeQuery(sql);
if (cnx.rs.next()) { //SI EXISTE EL REGISTRO
Frm_Proveedor.jXTextCodigo.setText(cnx.rs.getString(1));
Frm_Proveedor.jXTextRuc.setText(cnx.rs.getString(2));
Frm_Proveedor.jXTextRazonSocl.setText(cnx.rs.getString(3));
Frm_Proveedor.jCboEstad.setSelectedItem(cnx.rs.getString(4));
Frm_Proveedor.jXTextTelefon.setText(cnx.rs.getString(5));
Frm_Proveedor.jXTexttDireccion.setText(cnx.rs.getString(6));
Frm_Proveedor.jXTextUbicacion.setText(cnx.rs.getString(7));
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
81
vRow.addElement(direc);
vRow.addElement(ubic);
model.addRow(vRow);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public Frm_Proveedor_Consulta() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void txtproveedorKeyReleased(java.awt.event.KeyEvent evt) {
String dato=txtproveedor.getText();
String sql="SELECT * FROM Proveedor WHERE RUC LIKE '%"+dato+"%'";
try{
llenartabla(sql);
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
package Formularios;
import Base.ConectaBD;
82
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
public class Frm_Serie_Consulta extends javax.swing.JFrame {
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
83
vRow.addElement(comp);
vRow.addElement(ser);
vRow.addElement(num);
model.addRow(vRow);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public Frm_Serie_Consulta() {
initComponents();
titleBar5.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void txtserieKeyReleased(java.awt.event.KeyEvent evt) {
String dato=txtserie.getText();
String sql="SELECT * FROM Serie WHERE Serie LIKE '%"+dato+"%'";
try{
llenartabla(sql);
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
package Formularios;
import Base.ConectaBD;
84
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
public class Frm_Comprobante_Consulta extends javax.swing.JFrame {
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public void limpiartabla(DefaultTableModel model){
//int x;
//DefaulTableModel posee filas que empiezan a contarse desde
for( int x=model.getRowCount()-1;x>=0;x--){
model.removeRow(x);
}
}
public void llenartabla(String consulta_SQL){
try{
cnx.rs=cnx.stm.executeQuery(consulta_SQL);
DefaultTableModel model=(DefaultTableModel) jTblComprobante.getModel();
limpiartabla(model);
while(cnx.rs.next()){
String cod=cnx.rs.getString(1);
String catg=cnx.rs.getString(2);
Vector vRow=new Vector();
vRow.addElement(cod);
vRow.addElement(catg);
model.addRow(vRow);
}
}
catch(Exception e){
85
System.out.println(e.getMessage());
}
}
public Frm_Comprobante_Consulta() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void txtcomprobanteKeyReleased(java.awt.event.KeyEvent evt) {
String dato=txtcomprobante.getText();
String sql="SELECT * FROM Comprobante WHERE Descripcion LIKE
'%"+dato+"%'";
try{
llenartabla(sql);
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
86
public class Frm_Marca_Consulta extends javax.swing.JFrame {
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public void limpiartabla(DefaultTableModel model){
//int x;
//DefaulTableModel posee filas que empiezan a contarse desde
for( int x=model.getRowCount()-1;x>=0;x--){
model.removeRow(x);
}
}
public void llenartabla(String consulta_SQL){
try{
cnx.rs=cnx.stm.executeQuery(consulta_SQL);
DefaultTableModel model=(DefaultTableModel) jTblMarca.getModel();
limpiartabla(model);
while(cnx.rs.next()){
String cod=cnx.rs.getString(1);
String catg=cnx.rs.getString(2);
Vector vRow=new Vector();
vRow.addElement(cod);
vRow.addElement(catg);
model.addRow(vRow);
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
public Frm_Marca_Consulta() {
87
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void txtmaracaKeyReleased(java.awt.event.KeyEvent evt) {
String dato=txtmaraca.getText();
String sql="SELECT * FROM Marca WHERE Descripcion LIKE '%"+dato+"%'";
try{
llenartabla(sql);
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
2.4.7- Cliente
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
88
public void limpiartabla(DefaultTableModel model) {
//int x;
//DefaulTableModel posee filas que empiezan a contarse desde
for (int x = model.getRowCount() - 1; x >= 0; x--) {
model.removeRow(x);
}
}
public Frm_Cliente_Consulta() {
initComponents();
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
89
}
});
setLocationRelativeTo(null);
}
90
2.5.-Configuracin:
2.5.1- Global
package Formularios;
import Base.ConectaBD;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
this.jTextRazonSocial.setEnabled(estado);
this.jTextRuc.setEnabled(estado);
this.jTextIgv.setEnabled(estado);
}
public void Botones (boolean estado){
this.jBtnNuevo.setEnabled(estado);
this.jBtnGuardar.setEnabled(!estado);
this.jBtnCancelar.setEnabled(!estado);
this.jBtnEditar.setEnabled(estado);
this.jBtnEliminar.setEnabled(estado);
this.jBtnLliminar.setEnabled(estado);
}
public Frm_Global() {
initComponents();
this.setLocationRelativeTo(this);
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
91
private void close() {
this.dispose();
try{
cod=jTblGlobal.getValueAt(jTblGlobal.getSelectedRow(),0).toString();
cnx.rs=cnx.stm.executeQuery("SELECT * FROM Global WHERE
IdConfiguracion='"+ cod +"'");
if(cnx.rs.next()){
this.jTextCod.setText(cnx.rs.getString(1));
this.jTextRazonSocial.setText(cnx.rs.getString(2));
this.jTextRuc.setText(cnx.rs.getString(3));
this.jTextIgv.setText(cnx.rs.getString(4));
}
}
catch(Exception a){
System.out.println(a.getMessage());
}
}
public void LimpiarTabla(DefaultTableModel model){
for(int i=model.getRowCount()-1;i>=0;i--){
model.removeRow(i);
}
}
92
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
private void jBtnLliminarActionPerformed(java.awt.event.ActionEvent evt) {
int r;
r= JOptionPane.showConfirmDialog(null,"Cerrar
Programa","Salir",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MES
SAGE);
if (r==JOptionPane.YES_OPTION){
this.dispose();
}
}
93
}
94
2.6- Reportes:
2.6.1- Ventas
package Formularios;
import Base.ConectaBD;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;
public Frm_ReporteVenta() {
initComponents();
this.setLocationRelativeTo(this);
// this.getContentPane().setBackground(Color.white);
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void JBTNimprimirActionPerformed(java.awt.event.ActionEvent evt) {
try {
String fecha1 = fecha.format(this.JDCfecha.getDate());
String fecha2 = fecha.format(this.JDCfecha1.getDate());
95
JasperReport r =
JasperCompileManager.compileReport("src\\Reportes\\Reporte_Venta.jrxml");
Map Parametro = new HashMap();
Parametro.put("fecha1", fecha1);
Parametro.put("fecha2", fecha2);
2.6.2- Compras
package Formularios;
import Base.ConectaBD;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;
96
Date ahora = new Date(System.currentTimeMillis());
SimpleDateFormat fecha = new SimpleDateFormat("yyyy/MM/dd");
public Frm_ReporteCompra() {
initComponents();
this.setLocationRelativeTo(this);
// this.getContentPane().setBackground(Color.white);
titleBar1.addCloseAction(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
close();
}
});
setLocationRelativeTo(null);
}
private void close() {
this.dispose();
}
private void JBTNimprimirActionPerformed(java.awt.event.ActionEvent evt) {
try {
String fecha1 = fecha.format(this.JDCfecha.getDate());
String fecha2 = fecha.format(this.JDCfecha1.getDate());
JasperReport r =
JasperCompileManager.compileReport("src\\Reportes\\Reporte_Compra.jrxml");
Map Parametro = new HashMap();
Parametro.put("fechac1", fecha1);
Parametro.put("fechac2", fecha2);
Logger.getLogger(Frm_ReporteCompra.class.getName()).log(Level.SEVERE, null,
ex);
}
}
97
Conclusiones
98
Recomendaciones
2. Difundir entre los trabajadores las reglas del negocio que se deben
respetar as como hacer de conocimiento las bondades del sistema que
ser en beneficio de todo el personal de la empresa.
99
Glosario de Trminos
Venta: es el contrato a travs del cual se transfiere una cosa propia a dominio
ajeno por el precio pactado. La venta puede ser algo potencial (un producto
que est a la venta pero que an no ha sido comprado).
Proceso: es una secuencia de pasos dispuesta con algn tipo de lgica que
se enfoca en lograr algn resultado especfico. Los procesos son mecanismos
de comportamiento que disean los hombres para mejorar la productividad de
algo, para establecer un orden o eliminar algn tipo de problema.
Cotizacin: est formada por la cantidad que el total de los trabajadores deben
aportar al Estado de contribuciones a la seguridad social. Tambin
denominada cotizacin previsional, se trata de un porcentaje del salario que el
empleador (mediante una retencin) o el empleado tienen que depositar en el
sistema nacional de seguridad social.
100
Bibliografia
http://www.uai.edu.ar/facultades/tecnologia-informatica/carrera-ingenieria-en-
sistemas-informaticos.asp
http://si.usfx.bo/si/
https://www.etsisi.upm.es/escuela
https://www.sip.pe/
http://www1.herrera.unt.edu.ar/biblcet/wp-
content/uploads/2014/12/Desarrollo-de-Proyectos-Inform%C3%A1ticos-con-
Tecnolog%C3%ADa-Java.pdf
101
Anexos
102