Tienda de Articulos de Computacion

FacturaBean.java


package com.dansan.bean;

import com.dansan.database.BaseDatosManager;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;

/**
*
* @author dansan
*/
public class FacturaBean implements Printable{ 

  private ArrayList<Producto> productos;
  private String codigoVendedor,codigoCliente,nombre,domicilio,condicionVenta,iva,cuit;
  private long remito;
  private BufferedImage bufferImagen;
  private Image imagen;
  private Date date;
  private long nrofactura;
  private BaseDatosManager bdm;
  private String cadenaNroFactura;

  public FacturaBean(String codigoCliente, String codigoVendedor,String nombre, String domicilio, String condicionVenta, String iva, long remito, ArrayList<Producto> productos,String cuit, long nrofactura)
  {
    this.codigoCliente = codigoCliente;
    this.codigoVendedor = codigoVendedor;
    this.nombre = nombre;
    this.domicilio = domicilio;
    this.condicionVenta = condicionVenta;
    this.iva = iva;
    this.remito = remito;
    this.productos = productos;
    this.cuit = cuit;
    this.nrofactura = nrofactura;
  } 
     

  public void cargarImagen(){
    URL urlDeLaImagen = this.getClass().getClassLoader().getResource("\\imagenes\\facturab.jpg");
    ImageIcon icono = new ImageIcon(urlDeLaImagen);
    imagen = icono.getImage();
  }   
 
  public String obtenerFecha(){
    String fecha = "";
    date = new Date();
    String formato="dd";
    SimpleDateFormat dateFormat3 = new SimpleDateFormat(formato);
    fecha += Integer.parseInt(dateFormat3.format(date));
    fecha += "   ";
    formato="MM";
    SimpleDateFormat dateFormat2 = new SimpleDateFormat(formato);
    fecha += Integer.parseInt(dateFormat2.format(date));;
    fecha += "    ";
    formato="yyyy";
    SimpleDateFormat dateFormat = new SimpleDateFormat(formato);
    fecha += Integer.parseInt(dateFormat.format(date));
    fecha += " ";
    return fecha;
  } 

  private String obtenerCadenaNroFactura(){
    String cadenaNumero = "";
    String numeroFactura = "" + nrofactura;
    for(int i = numeroFactura.length();i<=12;i++){
      cadenaNumero = cadenaNumero + "0";
    }
    cadenaNumero = cadenaNumero + nrofactura;
    return cadenaNumero;    
  } 

  @Override
  public int print(Graphics g, PageFormat pf, int pageIndex){
    cargarImagen();
    Graphics2D g2d = (Graphics2D) g;
    g2d.translate(pf.getImageableX(), pf.getImageableY());    
    if(pageIndex==0){
      g2d.setColor(Color.WHITE);
      g2d.clearRect(0, 0, (int)pf.getWidth(),(int) pf.getHeight());
      g2d.drawImage(imagen, 0, 0,(int)pf.getImageableWidth(),(int)pf.getImageableHeight(), null);
          
      g2d.setColor(Color.BLACK);      
      //imprimo numero de factura     
      cadenaNroFactura = obtenerCadenaNroFactura();
      g2d.drawString(cadenaNroFactura, 350,75);
      //imprimo fecha de la factura           
      g2d.drawString(obtenerFecha(), 350,110);
      //imprimo datos de la operacion de la factura y del cliente
      g2d.drawString(nombre, 80,165);
      g2d.drawString(domicilio, 80,190);
      g2d.drawString(cuit, 80,210);
      g2d.drawString(iva, 80,235);
      g2d.drawString(condicionVenta, 110,260);
      int coordenaday = 300;
      float total = 0;
      for(Producto p:productos){
        g2d.drawString(""+p.getCantidad(), 20,coordenaday);
        g2d.drawString(""+p.getDescripcion(), 100,coordenaday);
        g2d.drawString(""+p.getPrecio(), 330,coordenaday);
        g2d.drawString(""+p.getImporte(), 400,coordenaday);
        float importeASumar = (float) p.getImporte();
        total = total + importeASumar;
        coordenaday = coordenaday + 20;
      }
      g2d.drawString(""+total, 400, 640);     
      return PAGE_EXISTS;
    }else{
      return NO_SUCH_PAGE;
    }
  }
  /**
  * @return the productos
  */
  public ArrayList<Producto> getProductos() {
    return productos;
  }
  /**
  * @param productos the productos to set
  */
  public void setProductos(ArrayList<Producto> productos) {
    this.productos = productos;
  }
  /**
  * @return the codigoVendedor
  */
  public String getCodigoVendedor() {
    return codigoVendedor;
  }
  /**
  * @param codigoVendedor the codigoVendedor to set
  */
  public void setCodigoVendedor(String codigoVendedor) {
    this.codigoVendedor = codigoVendedor;
  }
  /**
  * @return the codigoCliente
  */
  public String getCodigoCliente() {
    return codigoCliente;
  }
  /**
  * @param codigoCliente the codigoCliente to set
  */
  public void setCodigoCliente(String codigoCliente) {
    this.codigoCliente = codigoCliente;
  }
  /**
  * @return the nombre
  */
  public String getNombre() {
    return nombre;
  }
  /**
  * @param nombre the nombre to set
  */
  public void setNombre(String nombre) {
    this.nombre = nombre;
  }
  /**
  * @return the domicilio
  */
  public String getDomicilio() {
    return domicilio;
  }

  /**
  * @param domicilio the domicilio to set
  */
  public void setDomicilio(String domicilio) {
    this.domicilio = domicilio;
  }

  /**
  * @return the condicionVenta
  */
  public String getCondicionVenta() {
    return condicionVenta;
  }

  /**
  * @param condicionVenta the condicionVenta to set
  */
  public void setCondicionVenta(String condicionVenta) {
    this.condicionVenta = condicionVenta;
  }
  /**
  * @return the iva
  */
  public String getIva() {
    return iva;
  }

  /**
  * @param iva the iva to set
  */
  public void setIva(String iva) {
    this.iva = iva;
  }

  /**
  * @return the remito
  */
  public long getRemito() {
    return remito;
  }
  /**
  * @param remito the remito to set
  */
  public void setRemito(long remito) {
    this.remito = remito;
  }  
}

Producto.java


package com.dansan.bean;
/**
*
* @author dansan
*/
public class Producto {

  private long cantidad;
  private float precio;
  private String descripcion;
  private float importe;

  public Producto(long cantidad,float precio,String descripcion,float importe){
    this.cantidad = cantidad;
    this.precio = precio;
    this.descripcion = descripcion;
    this.importe = importe;
  }

  /**
  * @return the cantidad
  */
  public long getCantidad() {
    return cantidad;
  }
  /**
  * @param cantidad the cantidad to set
  */
  public void setCantidad(long cantidad) {
    this.cantidad = cantidad;
  }
  /**
  * @return the precio
  */
  public float getPrecio() {
    return precio;
  }
  /**
  * @param precio the precio to set
  */
  public void setPrecio(float precio) {
    this.precio = precio;
  }
  /**
  * @return the descripcion
  */
  public String getDescripcion() {
    return descripcion;
  }
  /**
  * @param descripcion the descripcion to set
  */
  public void setDescripcion(String descripcion) {
    this.descripcion = descripcion;
  }
  /**
  * @return the importe
  */
  public float getImporte() {
    return importe;
  }
  /**
  * @param importe the importe to set
  */
  public void setImporte(float importe) {
    this.importe = importe;
  } 

}

BaseDatosManager.java


package com.dansan.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author dansan
*/
public class BaseDatosManager {

  private String user = "root";
  private String pass = "riverplate";
  private String bd = "jdbc:mysql://localhost:3306/facturacion";
  private String controlador = "com.mysql.jdbc.Driver"; 

  private Connection conexion;
  private Statement st; 

  //Se crea conexion a base de datos

  public BaseDatosManager(){
    try {
      Class.forName(controlador);
      conexion = DriverManager.getConnection(bd, user, pass);
      st = conexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  } 

  //metodos de la tabla clientes

  public ResultSet listarClientes()
  {
    ResultSet rs = null;
    String query = "select * from clientes";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

  public ResultSet buscarClientes(long cliente)
  {
    ResultSet rs = null;
    String query = "select * from clientes where idcliente="+cliente;
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

  public ResultSet buscarClientes(String nombre)
  {
    ResultSet rs = null;
    String query = "select * from clientes where ape_nom='"+nombre+"'";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

  public long crearNuevoCliente(String apeNom, float deuda, String CondicionIva, String Cuit, String domicilio)
  {
    try {
      String query = "insert into clientes (ape_nom,deuda,fecha_ultpago,condicion_iva,CUIT,domicilio) values('";
      query += apeNom + "','" + deuda + "',now(),'" + CondicionIva + "','";
      query += Cuit + "','" + domicilio + "')";
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    int id=0;
    ResultSet rs = buscarClientes(apeNom);
    try {
      rs.last();
      id = (int) rs.getObject("idcliente");
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return id;
  } 

  public void actualizarCliente(long idCliente,String apeNom, float deuda, String CondicionIva, String Cuit, String domicilio)
  {
    try {
      String query = "update clientes set ape_nom='"+apeNom+"',deuda='"+deuda+"',fecha_ultpago=now()";
      query += ",condicion_iva='"+CondicionIva+"',CUIT='"+Cuit+"',domicilio='"+domicilio+"' ";
      query += "where idcliente="+idCliente;
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  public void actualizarClientePago(long idCliente,float deuda)
  {
    try {
      String query = "update clientes set deuda='"+deuda;
      query += "' where idcliente="+idCliente;
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  public void borrarCliente(long idCliente)
  {
   String query = "delete from clientes where idcliente=" + idCliente;
    try {
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  }


  //metodos de la tabla facturas

  public ResultSet listarFacturas()
  {
    ResultSet rs = null;
    String query = "select * from facturas";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

  public ResultSet obtenerFacturaCliente(long cliente){
    ResultSet rs = null;
    String query = "select * from facturas where idcliente="+cliente;
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

 public ResultSet obtenerFactura(long nrofactura){
    ResultSet rs = null;
    String query = "select * from facturas where nrofactura="+nrofactura;
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

 public ResultSet obtenerUltimaFactura(){
    ResultSet rs = null;
    String query = "select * from facturas order by nrofactura desc limit 1";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  }

 

  public void crearNuevaFactura(long idCliente,float importe, char estado, long nroRemito)
  {
    try {
      String query = "insert into facturas (idcliente,fecha_factura,importe,estado,nroremito) values('";
      query += idCliente + "',now(),'" + importe + "','";
      query += estado + "','" + nroRemito + "')";
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  public void actualizarFactura(long nroFactura, char estado)
  {
    try {
      String query = "update facturas set estado='"+estado+"' where nrofactura="+nroFactura;
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  }

  //metodos de la tabla pagos

  public ResultSet listarPagos()
  {
    ResultSet rs = null;
    String query = "select * from pagos";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  }

  public void crearNuevoPago(long nroFactura, float importe)
  {
    try {
      String query = "insert into pagos (nrofactura,importe,fecha_pago) values('";
      query += nroFactura + "','" + importe + "',now())";
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  //metodos de la tabla articulos
  public ResultSet listarArticulos()
  {
    ResultSet rs = null;
    String query = "select * from articulos";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

  public void crearNuevoArticulo(String marca,String descripcion ,float precio, int stock)
  {
    try {
      String query = "insert into articulos (marca,descripcion,precio,stock) values('";
      query += marca + "','" + descripcion + "','" + precio + "','" + stock + "')";
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  public void actualizarArticulo(int codigo,String marca,String descripcion ,float precio, int stock)
  {
    try {
      String query = "update articulos set marca='"+marca+"',descripcion='"+descripcion;
      query += "',precio='"+precio+"',stock='"+precio+"' where codigo_articulo='"+codigo+"'";
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  public ResultSet buscarArticulos(long codigo)
  {
    ResultSet rs = null;
    String query = "select * from articulos where codigo_articulo="+codigo;
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  }

  //metodos de la tabla vendedor
  public ResultSet listarVendedores()
  {
    ResultSet rs = null;
    String query = "select * from vendedores";
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

  public ResultSet obtenerVendedor(long codVendedor)
  {
    ResultSet rs = null;
    String query = "select * from vendedores where codigo_vendedor="+codVendedor;
    try {
      rs = st.executeQuery(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return rs;
  } 

   public void crearNuevoVendedor(String apeNom,long porcComision ,float comisionAcum)
  {
    try {
      String query = "insert into articulos (ape_nom,porc_comision,comision_acumulada) values('";
      query += apeNom + "','"+ porcComision + "','" + comisionAcum + "')";
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  }  

  public void actualizarVendedor(long codigo,String apeNom,long porcComision ,float comisionAcum)
  {
    try {
      String query = "update vendedores set ape_nom='"+apeNom+"',porc_comision="+porcComision;
      query += ",comision_acumulada="+comisionAcum+" where codigo_vendedor="+codigo;
      st.executeUpdate(query);
    } catch (SQLException ex) {
      Logger.getLogger(BaseDatosManager.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

}

VentanaConsulta.java


package com.dansan.frontend;

import com.dansan.database.BaseDatosManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;

/**
*
* @author dansan
*/
public class VentanaConsulta extends javax.swing.JDialog {

  BaseDatosManager bdm= new BaseDatosManager();
  /**
  * Creates new form VentanaConsulta
  */
  public VentanaConsulta(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();    
    cargarTablaClientes();
    cargarTablaFacturas();
    cargarTablaPagos();
    cargarTablaArticulos();
    cargarTablaVendedores();
    this.setVisible(true);
  }
  /**
  * This method is called from within the constructor to initialize the form.
  * WARNING: Do NOT modify this code. The content of this method is always
  * regenerated by the Form Editor.
  */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">             
  private void initComponents() {
    tabbedPaneConsultas = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    scrollClientes = new javax.swing.JScrollPane();
    tablaClientes = new javax.swing.JTable();
    jPanel2 = new javax.swing.JPanel();
    scrollFacturas = new javax.swing.JScrollPane();
    tablaFacturas = new javax.swing.JTable();
    jPanel3 = new javax.swing.JPanel();
    scrollPagos = new javax.swing.JScrollPane();
    tablaPagos = new javax.swing.JTable();
    jPanel4 = new javax.swing.JPanel();
    scrollArticulos = new javax.swing.JScrollPane();
    tablaArticulos = new javax.swing.JTable();
    jPanel5 = new javax.swing.JPanel();
    scrollVendedores = new javax.swing.JScrollPane();
    tablaVendedores = new javax.swing.JTable();
    btnCerrar = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    tablaClientes.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null, null, null, null}
      },
      new String [] {
        "Id Cliente", "Nombre y Apellido", "Deuda", "Fecha ultimo pago", "Condicion IVA", "C.U.I.T", "domicilio"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.String.class, java.lang.Float.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false, false, false, false
      };

      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });
    scrollClientes.setViewportView(tablaClientes);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollClientes, javax.swing.GroupLayout.DEFAULT_SIZE, 795, Short.MAX_VALUE)
    );
    jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollClientes, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
    );
    tabbedPaneConsultas.addTab("Clientes", jPanel1);
    tablaFacturas.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null, null, null},
        {null, null, null, null, null, null},
        {null, null, null, null, null, null},
        {null, null, null, null, null, null}
      },
      new String [] {
        "Nro. Factura", "Id Cliente", "Fecha Factura", "Importe", "Estado", "Nro. Remito"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.Float.class, java.lang.String.class, java.lang.Integer.class

      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false, false, false
      };

      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });

    scrollFacturas.setViewportView(tablaFacturas);

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
      jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollFacturas, javax.swing.GroupLayout.DEFAULT_SIZE, 795, Short.MAX_VALUE)
    );

    jPanel2Layout.setVerticalGroup(
      jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollFacturas, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
    );

    tabbedPaneConsultas.addTab("Facturas", jPanel2);

    tablaPagos.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null}
      },
      new String [] {
        "Id Pagos", "Nro. Factura", "Importe", "Fecha de pago"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.Integer.class, java.lang.Float.class, java.lang.String.class
      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false
      };

      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });

    scrollPagos.setViewportView(tablaPagos);

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
      jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollPagos, javax.swing.GroupLayout.DEFAULT_SIZE, 795, Short.MAX_VALUE)
    );
    jPanel3Layout.setVerticalGroup(
      jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollPagos, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
    );

    tabbedPaneConsultas.addTab("Pagos", jPanel3);

    tablaArticulos.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null, null},
        {null, null, null, null, null},
        {null, null, null, null, null},
        {null, null, null, null, null}
      },
      new String [] {
        "Codigo Articulo", "Marca", "Descripcion", "Precio", "Stock"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Float.class, java.lang.Integer.class
      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false, false
      };
      
      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });
    scrollArticulos.setViewportView(tablaArticulos);

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(
      jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollArticulos, javax.swing.GroupLayout.DEFAULT_SIZE, 795, Short.MAX_VALUE)
    );

    jPanel4Layout.setVerticalGroup(
      jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollArticulos, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
    );

    tabbedPaneConsultas.addTab("Articulos", jPanel4);

    tablaVendedores.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null}
      },
      new String [] {
        "Codigo Vendedor", "Nombre y apellido", "Porcentaje Comision", "Comision Acumulada"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Float.class
      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false
      };

      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }


      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });
    scrollVendedores.setViewportView(tablaVendedores);

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(
      jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollVendedores, javax.swing.GroupLayout.DEFAULT_SIZE, 795, Short.MAX_VALUE)
    );
    jPanel5Layout.setVerticalGroup(
      jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(scrollVendedores, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
    );

    tabbedPaneConsultas.addTab("Vendedores", jPanel5);

    btnCerrar.setText("Cerrar");
    btnCerrar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnCerrarActionPerformed(evt);
      }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(tabbedPaneConsultas)
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(btnCerrar)
        .addGap(19, 19, 19))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addComponent(tabbedPaneConsultas, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
        .addComponent(btnCerrar))
    );
    pack();
  }// </editor-fold>            

  private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {                     
    this.dispose();
  }                   

  public void cargarTablaClientes(){
    ResultSet rs = bdm.listarClientes(); 
    DefaultTableModel dtmClientes = (DefaultTableModel) tablaClientes.getModel();
    dtmClientes.setRowCount(0);
    try {
      while(rs.next()){      
        Object row[] = {rs.getObject("idcliente"),rs.getObject("ape_nom"),rs.getObject("deuda"),rs.getObject("fecha_ultpago").toString(),rs.getObject("condicion_iva"),rs.getObject("CUIT"),rs.getObject("domicilio")};
        dtmClientes.addRow(row);
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaConsulta.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  public void cargarTablaFacturas(){
    ResultSet rs = bdm.listarFacturas(); 
    DefaultTableModel dtmFacturas = (DefaultTableModel) tablaFacturas.getModel();
    dtmFacturas.setRowCount(0);
    try {
      while(rs.next()){      
        Object row[] = {rs.getObject("nrofactura"),rs.getObject("idcliente"),rs.getObject("fecha_factura"),rs.getObject("importe"),rs.getObject("estado").toString(),rs.getObject("nroremito")};
        dtmFacturas.addRow(row);
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaConsulta.class.getName()).log(Level.SEVERE, null, ex);
    }
  }

  

  public void cargarTablaPagos(){
    ResultSet rs = bdm.listarPagos(); 
    DefaultTableModel dtmPagos = (DefaultTableModel) tablaPagos.getModel();
    dtmPagos.setRowCount(0);
    try {
      while(rs.next()){      
        Object row[] = {rs.getObject("idpagos"),rs.getObject("nrofactura"),rs.getObject("importe"),rs.getObject("fecha_pago")};
        dtmPagos.addRow(row);
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaConsulta.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
 

  public void cargarTablaArticulos(){
    ResultSet rs = bdm.listarArticulos(); 
    DefaultTableModel dtmArticulos = (DefaultTableModel) tablaArticulos.getModel();
    dtmArticulos.setRowCount(0);
    try {
      while(rs.next()){      
        Object row[] = {rs.getObject("codigo_articulo"),rs.getObject("marca"),rs.getObject("descripcion"),rs.getObject("precio"),rs.getObject("stock")};
        dtmArticulos.addRow(row);
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaConsulta.class.getName()).log(Level.SEVERE, null, ex);
    }
  }

  public void cargarTablaVendedores(){
    ResultSet rs = bdm.listarVendedores(); 
    DefaultTableModel dtmVendedores = (DefaultTableModel) tablaVendedores.getModel();
    dtmVendedores.setRowCount(0);
    try {
      while(rs.next()){      
        Object row[] = {rs.getObject("codigo_vendedor"),rs.getObject("ape_nom"),rs.getObject("porc_comision"),rs.getObject("comision_acumulada")};
        dtmVendedores.addRow(row);
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaConsulta.class.getName()).log(Level.SEVERE, null, ex);
    }
  }

  // Variables declaration - do not modify          
  private javax.swing.JButton btnCerrar;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JPanel jPanel2;
  private javax.swing.JPanel jPanel3;
  private javax.swing.JPanel jPanel4;
  private javax.swing.JPanel jPanel5;
  private javax.swing.JScrollPane scrollArticulos;
  private javax.swing.JScrollPane scrollClientes;
  private javax.swing.JScrollPane scrollFacturas;
  private javax.swing.JScrollPane scrollPagos;
  private javax.swing.JScrollPane scrollVendedores;
  private javax.swing.JTabbedPane tabbedPaneConsultas;
  private javax.swing.JTable tablaArticulos;
  private javax.swing.JTable tablaClientes;
  private javax.swing.JTable tablaFacturas;
  private javax.swing.JTable tablaPagos;
  private javax.swing.JTable tablaVendedores;
  // End of variables declaration         
}

VentanaPago.java


package com.dansan.frontend;

import com.dansan.database.BaseDatosManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author dansan
*/
public class VentanaPago extends javax.swing.JDialog {
  BaseDatosManager bdm= new BaseDatosManager();
  DefaultTableModel dtm;
  long nrofactura;
  float importe;
  String estado;
  int idcliente;
  Date fechaFactura;
  int nroremito;  

  /**
  * Creates new form VentanaPago
  */
  public VentanaPago(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    configurarTabla();
    this.setVisible(true);
  }
  /**
  * This method is called from within the constructor to initialize the form.
  * WARNING: Do NOT modify this code. The content of this method is always
  * regenerated by the Form Editor.
  */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">             
  private void initComponents() {
    labelNroFactura = new javax.swing.JLabel();
    campoNroFactura = new javax.swing.JFormattedTextField();
    btnBuscar = new javax.swing.JButton();
    scrollTablaDatos = new javax.swing.JScrollPane();
    tablaDatosPago = new javax.swing.JTable();
    btnConfirmar = new javax.swing.JButton();
    btnCancelar = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    labelNroFactura.setText("Nro. Factura: ");
    btnBuscar.setText("Buscar");
    btnBuscar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnBuscarActionPerformed(evt);
      }
    });

    tablaDatosPago.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null, null}
      },
      new String [] {
        "Id Cliente", "Nro Factura", "Fecha Factura", "Importe a pagar", "Estado"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.Float.class, java.lang.String.class
      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false, false
      };

      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });
    scrollTablaDatos.setViewportView(tablaDatosPago);
    tablaDatosPago.getColumnModel().getColumn(0).setResizable(false);
    tablaDatosPago.getColumnModel().getColumn(0).setPreferredWidth(100);
    tablaDatosPago.getColumnModel().getColumn(1).setResizable(false);
    tablaDatosPago.getColumnModel().getColumn(1).setPreferredWidth(100);
    tablaDatosPago.getColumnModel().getColumn(2).setResizable(false);
    tablaDatosPago.getColumnModel().getColumn(2).setPreferredWidth(100);
    tablaDatosPago.getColumnModel().getColumn(3).setResizable(false);
    tablaDatosPago.getColumnModel().getColumn(4).setResizable(false);
    tablaDatosPago.getColumnModel().getColumn(4).setPreferredWidth(100);

    btnConfirmar.setText("Confirmar");
    btnConfirmar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnConfirmarActionPerformed(evt);
      }
    });

    btnCancelar.setText("Cancelar");
    btnCancelar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnCancelarActionPerformed(evt);
      }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(scrollTablaDatos, javax.swing.GroupLayout.DEFAULT_SIZE, 680, Short.MAX_VALUE)
          .addGroup(layout.createSequentialGroup()
            .addComponent(labelNroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(campoNroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(18, 18, 18)
            .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addGap(0, 0, Short.MAX_VALUE)))
        .addContainerGap())
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(18, 18, 18)
        .addComponent(btnConfirmar, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(20, 20, 20))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(labelNroFactura)
          .addComponent(campoNroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(btnBuscar))
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(scrollTablaDatos, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(btnCancelar)
          .addComponent(btnConfirmar))
        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    pack();
  }// </editor-fold>            

  private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {                      
    this.dispose();
  }                  

  private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {                     
    nrofactura = Long.parseLong(campoNroFactura.getText());
    try {    
      ResultSet rs = bdm.obtenerFactura(nrofactura);
      while(rs.next()){
        idcliente = (int) rs.getObject("idcliente");
        fechaFactura= (Date) rs.getObject("fecha_factura");
        importe = (float) rs.getObject("importe");
        estado = (String) rs.getObject("estado");
        nroremito = (int) rs.getObject("nroremito");
        Object row[] = {idcliente,nrofactura,fechaFactura.toString(),importe,estado};
        dtm.addRow(row);
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaPago.class.getName()).log(Level.SEVERE, null, ex);
    }
  }                 


  private void btnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {                      
    if(estado.charAt(0)=='a'){
      bdm.crearNuevoPago(nrofactura, importe);
      char estadoPagado = 'p';
      bdm.actualizarFactura(nrofactura, estadoPagado);
      float deuda=0;
      ResultSet rsCliente = bdm.buscarClientes(idcliente);
      try {
        while(rsCliente.next()){      
          deuda = (float) rsCliente.getObject("deuda");
        }
      } catch (SQLException ex) {
        Logger.getLogger(VentanaPago.class.getName()).log(Level.SEVERE, null, ex);
      }
      deuda = deuda - importe;      
      bdm.actualizarClientePago(idcliente, deuda);
      JOptionPane.showMessageDialog(this, "Operacion Satisfactoria", "Pago registrado", JOptionPane.INFORMATION_MESSAGE);
    }else{
      JOptionPane.showMessageDialog(this, "Operacion No Valida", "La factura ya esta pagada", JOptionPane.INFORMATION_MESSAGE);
    }
    this.dispose();
  }                 


  private void configurarTabla(){
    dtm = (DefaultTableModel) tablaDatosPago.getModel();
    dtm.setRowCount(0);
  } 

  // Variables declaration - do not modify          
  private javax.swing.JButton btnBuscar;
  private javax.swing.JButton btnCancelar;
  private javax.swing.JButton btnConfirmar;
  private javax.swing.JFormattedTextField campoNroFactura;
  private javax.swing.JLabel labelNroFactura;
  private javax.swing.JScrollPane scrollTablaDatos;
  private javax.swing.JTable tablaDatosPago;
  // End of variables declaration         

}

VentanaVenta.java


package com.dansan.frontend;

import com.dansan.bean.FacturaBean;
import com.dansan.bean.Producto;
import com.dansan.database.BaseDatosManager;
import java.awt.print.PageFormat;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author dansan
*/
public class VentanaVenta extends javax.swing.JDialog {

  BaseDatosManager bdm= new BaseDatosManager();
  DefaultTableModel dtm;
  FacturaBean facturaBean;
  ArrayList<Producto> productos = new ArrayList<Producto>();
  String codigoCliente;
  String codigoVendedor;
  String nombre;
  String domicilio;
  long nroRemito;
  String condicionVenta;
  String iva;
  String CUIT;
  float importeTotal;
  long numeroCliente;
  int numerofactura;

  /**
  * Creates new form VentanaVenta
  */
  public VentanaVenta(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    configurarTabla();  
    this.setVisible(true);
  }
  /**
  * This method is called from within the constructor to initialize the form.
  * WARNING: Do NOT modify this code. The content of this method is always
  * regenerated by the Form Editor.
  */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">             
  private void initComponents() {
    grupoIva = new javax.swing.ButtonGroup();
    grupoCondicionVenta = new javax.swing.ButtonGroup();
    layeredPaneVendedor = new javax.swing.JLayeredPane();
    labelCodVendedor = new javax.swing.JLabel();
    campoCodVendedor = new javax.swing.JFormattedTextField();
    labelCodCliente = new javax.swing.JLabel();
    campoCodCliente = new javax.swing.JFormattedTextField();
    layeredPaneCliente = new javax.swing.JLayeredPane();
    jLabel1 = new javax.swing.JLabel();
    campoNombre = new javax.swing.JTextField();
    jLabel2 = new javax.swing.JLabel();
    campoDomicilio = new javax.swing.JTextField();
    labelIva = new javax.swing.JLabel();
    radioNoRespInsc = new javax.swing.JRadioButton();
    radioExento = new javax.swing.JRadioButton();
    radioConsumidorFinal = new javax.swing.JRadioButton();
    radioMonotributo = new javax.swing.JRadioButton();
    labelCondicionVenta = new javax.swing.JLabel();
    radioContado = new javax.swing.JRadioButton();
    radioCtaCte = new javax.swing.JRadioButton();
    jLabel3 = new javax.swing.JLabel();
    campoNroRemito = new javax.swing.JFormattedTextField();
    jLabel6 = new javax.swing.JLabel();
    campoCUIT = new javax.swing.JFormattedTextField();
    scrollTablaDetalle = new javax.swing.JScrollPane();
    tablaDetalleVenta = new javax.swing.JTable();
    labelCodProducto = new javax.swing.JLabel();
    campoCodProducto = new javax.swing.JFormattedTextField();
    jLabel4 = new javax.swing.JLabel();
    campoCantidad = new javax.swing.JTextField();
    btnAgregarProducto = new javax.swing.JButton();
    jLabel5 = new javax.swing.JLabel();
    campoTotal = new javax.swing.JTextField();
    btnCancelar = new javax.swing.JButton();
    btnAceptar = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    layeredPaneVendedor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
    layeredPaneVendedor.setForeground(new java.awt.Color(204, 204, 204));

    labelCodVendedor.setText("Codigo Vendedor: ");
    labelCodVendedor.setBounds(10, 20, 110, 14);
    layeredPaneVendedor.add(labelCodVendedor, javax.swing.JLayeredPane.DEFAULT_LAYER);
    try {
      campoCodVendedor.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    campoCodVendedor.setBounds(110, 10, 210, 25);
    layeredPaneVendedor.add(campoCodVendedor, javax.swing.JLayeredPane.DEFAULT_LAYER);

    labelCodCliente.setText("Codigo Cliente: ");
    labelCodCliente.setBounds(340, 20, 100, 14);
    layeredPaneVendedor.add(labelCodCliente, javax.swing.JLayeredPane.DEFAULT_LAYER);
    try {
      campoCodCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    campoCodCliente.setBounds(430, 10, 210, 25);
    layeredPaneVendedor.add(campoCodCliente, javax.swing.JLayeredPane.DEFAULT_LAYER);
    layeredPaneCliente.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));

    jLabel1.setText("Sr.(es): ");
    jLabel1.setBounds(10, 20, 50, 14);
    layeredPaneCliente.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
    campoNombre.setBounds(70, 10, 190, 25);
    layeredPaneCliente.add(campoNombre, javax.swing.JLayeredPane.DEFAULT_LAYER);

    jLabel2.setText("Domicilio: ");
    jLabel2.setBounds(280, 20, 60, 14);
    layeredPaneCliente.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
    campoDomicilio.setBounds(350, 10, 170, 25);
    layeredPaneCliente.add(campoDomicilio, javax.swing.JLayeredPane.DEFAULT_LAYER);
    labelIva.setText("IVA: ");
    labelIva.setBounds(10, 50, 24, 14);
    layeredPaneCliente.add(labelIva, javax.swing.JLayeredPane.DEFAULT_LAYER);
    grupoIva.add(radioNoRespInsc);
    radioNoRespInsc.setText("No. Resp. Insc.");
    radioNoRespInsc.setBounds(70, 50, 110, 23);
    layeredPaneCliente.add(radioNoRespInsc, javax.swing.JLayeredPane.DEFAULT_LAYER);

    grupoIva.add(radioExento);
    radioExento.setText("Exento");
    radioExento.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        radioExentoActionPerformed(evt);
      }
    });
    radioExento.setBounds(200, 50, 59, 23);
    layeredPaneCliente.add(radioExento, javax.swing.JLayeredPane.DEFAULT_LAYER);

    grupoIva.add(radioConsumidorFinal);
    radioConsumidorFinal.setText("Consumidor Final");
    radioConsumidorFinal.setBounds(280, 50, 130, 23);
    layeredPaneCliente.add(radioConsumidorFinal, javax.swing.JLayeredPane.DEFAULT_LAYER);

    grupoIva.add(radioMonotributo);
    radioMonotributo.setText("Monotributo");
    radioMonotributo.setBounds(410, 50, 100, 23);
    layeredPaneCliente.add(radioMonotributo, javax.swing.JLayeredPane.DEFAULT_LAYER);

    labelCondicionVenta.setText("Condicion de venta: ");
    labelCondicionVenta.setBounds(10, 90, 120, 14);
    layeredPaneCliente.add(labelCondicionVenta, javax.swing.JLayeredPane.DEFAULT_LAYER);

    grupoCondicionVenta.add(radioContado);
    radioContado.setText("Contado");
    radioContado.setBounds(160, 90, 80, 23);
    layeredPaneCliente.add(radioContado, javax.swing.JLayeredPane.DEFAULT_LAYER);

    grupoCondicionVenta.add(radioCtaCte);
    radioCtaCte.setText("Cta. Cte.");
    radioCtaCte.setBounds(280, 90, 93, 23);
    layeredPaneCliente.add(radioCtaCte, javax.swing.JLayeredPane.DEFAULT_LAYER);

    jLabel3.setText("Remito Nº: ");
    jLabel3.setBounds(10, 130, 80, 14);
    layeredPaneCliente.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
    try {
      campoNroRemito.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("############")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    campoNroRemito.setBounds(100, 130, 140, 25);
    layeredPaneCliente.add(campoNroRemito, javax.swing.JLayeredPane.DEFAULT_LAYER);
    jLabel6.setText("CUIT: ");
    jLabel6.setBounds(280, 134, 60, 10);
    layeredPaneCliente.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);
    try {
      campoCUIT.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##-########-#")));
    } catch (java.text.ParseException ex) {
      ex.printStackTrace();
    }
    campoCUIT.setBounds(370, 130, 190, 20);
    layeredPaneCliente.add(campoCUIT, javax.swing.JLayeredPane.DEFAULT_LAYER);

    tablaDetalleVenta.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null},
        {null, null, null, null}
      },
      new String [] {
        "Cantidad", "Detalle", "P. Unit", "Importe"
      }
    ) {
      Class[] types = new Class [] {
        java.lang.Integer.class, java.lang.String.class, java.lang.Float.class, java.lang.Float.class
      };
      boolean[] canEdit = new boolean [] {
        false, false, false, false
      };

      public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
      }

      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
      }
    });

    scrollTablaDetalle.setViewportView(tablaDetalleVenta);
    tablaDetalleVenta.getColumnModel().getColumn(0).setResizable(false);
    tablaDetalleVenta.getColumnModel().getColumn(0).setPreferredWidth(40);
    tablaDetalleVenta.getColumnModel().getColumn(1).setResizable(false);
    tablaDetalleVenta.getColumnModel().getColumn(1).setPreferredWidth(400);
    tablaDetalleVenta.getColumnModel().getColumn(2).setResizable(false);
    tablaDetalleVenta.getColumnModel().getColumn(2).setPreferredWidth(40);
    tablaDetalleVenta.getColumnModel().getColumn(3).setResizable(false);
    labelCodProducto.setText("Codigo Producto: ");

    campoCodProducto.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));

    jLabel4.setText("Cantidad:");

    campoCantidad.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        campoCantidadActionPerformed(evt);
      }
    });

    btnAgregarProducto.setText("Agregar Producto");
    btnAgregarProducto.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnAgregarProductoActionPerformed(evt);
      }
    });

    jLabel5.setText("TOTAL $ ");
    campoTotal.setEditable(false);

    btnCancelar.setText("Cancelar");
    btnCancelar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnCancelarActionPerformed(evt);
      }
    });
    
    btnAceptar.setText("Aceptar");
    btnAceptar.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        btnAceptarActionPerformed(evt);
      }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(layeredPaneVendedor, javax.swing.GroupLayout.DEFAULT_SIZE, 680, Short.MAX_VALUE)
          .addComponent(layeredPaneCliente)
          .addComponent(scrollTablaDetalle)
          .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addGap(0, 0, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                .addComponent(btnCancelar)
                .addGap(18, 18, 18)
                .addComponent(btnAceptar))
              .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))))
        .addContainerGap())
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        .addComponent(labelCodProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
        .addComponent(campoCodProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(18, 18, 18)
        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(18, 18, 18)
        .addComponent(campoCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(27, 27, 27)
        .addComponent(btnAgregarProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addGap(99, 99, 99))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addComponent(layeredPaneVendedor, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(layeredPaneCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(btnAgregarProducto)
          .addComponent(campoCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(jLabel4)
          .addComponent(campoCodProducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(labelCodProducto))
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addComponent(scrollTablaDetalle, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(campoTotal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(jLabel5))
        .addGap(18, 18, 18)
        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(btnCancelar)
          .addComponent(btnAceptar))
        .addContainerGap())
    );
    pack();

  }// </editor-fold>            



  private void radioExentoActionPerformed(java.awt.event.ActionEvent evt) {                   
    // TODO add your handling code here:
  }                     

  private void campoCantidadActionPerformed(java.awt.event.ActionEvent evt) {                       
    // TODO add your handling code here:
  }                      
  private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {                      
    this.dispose();
  }                  

  private void btnAgregarProductoActionPerformed(java.awt.event.ActionEvent evt) {                         
    agregarProducto();
  }                      

  private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {                     
    codigoCliente = campoCodCliente.getText();
    codigoVendedor = campoCodVendedor.getText();
    nombre = campoNombre.getText();
    domicilio = campoDomicilio.getText();
    nroRemito = Long.parseLong(campoNroRemito.getText());
    condicionVenta = obtenerCondicionVentaSeleccionada();
    iva = obtenerIvaSeleccionado();
    CUIT = campoCUIT.getText();
    numeroCliente = Long.parseLong(codigoCliente);
    actualizarClientes();
    actualizarFacturas();
    actualizarVendedores();
    obtenerNumeroFactura();
    if(condicionVenta.indexOf("Contado")>=0)actualizarPagos();
    facturaBean = new FacturaBean(codigoCliente, codigoVendedor, nombre, domicilio, condicionVenta, iva, nroRemito,productos,CUIT,numerofactura);
    imprimirFactura();
    JOptionPane.showMessageDialog(this, "Operacion Satisfactoria", "Venta registrada", JOptionPane.INFORMATION_MESSAGE);
    this.dispose();
  }                     
  
  private void actualizarClientes(){
    if(Integer.parseInt(codigoCliente)==0){//si es cliente nuevo se lo crea
      float deuda=Float.parseFloat(campoTotal.getText());
      if(condicionVenta.indexOf("Contado")>=0)
        {
          deuda=0;
        }
      numeroCliente= bdm.crearNuevoCliente(nombre, deuda, iva, CUIT, domicilio);
    }else{//sino se actualiza el cliente
      float importeTotal=Float.parseFloat(campoTotal.getText());
      float importeASumar=importeTotal;
      ResultSet rs =bdm.buscarClientes(Long.parseLong(codigoCliente));
      float deuda=0;      
      try {
        while(rs.next()){
          deuda = (float) rs.getObject("deuda");          
        }
      } catch (SQLException ex) {
        Logger.getLogger(VentanaVenta.class.getName()).log(Level.SEVERE, null, ex);
      }      
      if(condicionVenta.indexOf("Contado")>=0)
        {
          importeASumar=0;
        }
      deuda+= importeASumar;
      bdm.actualizarCliente(Long.parseLong(campoCodCliente.getText()), nombre, deuda, iva, CUIT, domicilio);      
    }
  }

   private void actualizarPagos(){
    try {
      ResultSet rsFactura= bdm.obtenerFactura(numerofactura);
      int nrofactura=0;
      float importePagado = 0;
      while(rsFactura.next()){
        String estadoFacturaCad = (String) rsFactura.getObject("estado");
        char estadoFactura = estadoFacturaCad.charAt(0);
        if(estadoFactura == 'a'){
        nrofactura = (int) rsFactura.getObject("nrofactura");
        importePagado = (float) rsFactura.getObject("importe");
        break;
        }
      }
      char estado = 'p';
      bdm.actualizarFactura(nrofactura, estado);
      bdm.crearNuevoPago(nrofactura, importeTotal);
    } catch (SQLException ex) {
      Logger.getLogger(VentanaVenta.class.getName()).log(Level.SEVERE, null, ex);
    }
  }


  private void actualizarFacturas(){
    char estado = 'a';
    bdm.crearNuevaFactura(numeroCliente, Float.parseFloat(campoTotal.getText()), estado, Long.parseLong(campoNroRemito.getText()));
  }

  private void obtenerNumeroFactura(){
    try {
      ResultSet rs = bdm.obtenerUltimaFactura();
      while(rs.next()){
        numerofactura = (int) rs.getObject("nrofactura");
      }
    } catch (SQLException ex) {
      Logger.getLogger(VentanaVenta.class.getName()).log(Level.SEVERE, null, ex);
    }  

  }


  private void actualizarVendedores(){
    long codigo = Long.parseLong(campoCodVendedor.getText());
    long porcentaje = 0;
    float comisionAcumulada = 0;
    String nombre = "";
    try {
      ResultSet vendedor = bdm.obtenerVendedor(codigo);
      while(vendedor.next()){
        porcentaje = (long) vendedor.getObject("porc_comision");
        comisionAcumulada = (float) vendedor.getObject("comision_acumulada");        
        nombre = (String) vendedor.getObject("ape_nom");
      }      
      float importeBase = Float.parseFloat(campoTotal.getText());
      float comision = (importeBase * porcentaje) / 100;
      comisionAcumulada = comisionAcumulada + comision;
      bdm.actualizarVendedor(codigo, nombre, porcentaje, comisionAcumulada);
    } catch (SQLException ex) {
      Logger.getLogger(VentanaVenta.class.getName()).log(Level.SEVERE, null, ex);
    }
  } 

  private String obtenerIvaSeleccionado(){
    String condicion = "";
    if(radioConsumidorFinal.isSelected()) condicion = "Consumidor final";
    else if(radioMonotributo.isSelected()) condicion = "Monotributo";
    else if(radioNoRespInsc.isSelected()) condicion = "Resp. No Insc.";
    else if(radioExento.isSelected()) condicion = "Exento";
    return condicion;
  }

 
  private String obtenerCondicionVentaSeleccionada(){
    String condicion = "";
    if(radioContado.isSelected()) condicion = "Contado";
    else if(radioCtaCte.isSelected()) condicion = "Cta. Cte.";
    return condicion;
  } 

  private void configurarTabla(){
    dtm = (DefaultTableModel) tablaDetalleVenta.getModel();
    dtm.setRowCount(0);
  } 

  private void agregarProducto(){
    if(!campoCodProducto.getText().equals("")&&!campoCantidad.getText().equals(""))
    {
      try {
        long codigoProducto = Long.parseLong(campoCodProducto.getText());
        long cantidad = Long.parseLong(campoCantidad.getText());
        ResultSet rsProducto = bdm.buscarArticulos(codigoProducto);
        while(rsProducto.next()){
          long stock = (long) rsProducto.getObject("stock");
          if(cantidad<=stock){
            float precio = (float) rsProducto.getObject("precio");
            Object row[]={cantidad,rsProducto.getObject("descripcion"),precio,(precio*cantidad)};
            Producto producto = new Producto(cantidad, precio,rsProducto.getObject("descripcion").toString(), precio*cantidad);
            productos.add(producto);
            dtm.addRow(row);
            float importe = precio * cantidad;
            importeTotal += importe;
            campoTotal.setText(""+importeTotal);
          }
        }
      } catch (SQLException ex) {
        Logger.getLogger(VentanaVenta.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  } 

  public void imprimirFactura(){
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintable(facturaBean);
    PageFormat pageFormat = new PageFormat();
    pageFormat = job.pageDialog(pageFormat);
    if (job.printDialog())
      try {
      job.print();
    } catch (PrinterException ex) {
      Logger.getLogger(VentanaVenta.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
 

  // Variables declaration - do not modify          
  private javax.swing.JButton btnAceptar;
  private javax.swing.JButton btnAgregarProducto;
  private javax.swing.JButton btnCancelar;
  private javax.swing.JFormattedTextField campoCUIT;
  private javax.swing.JTextField campoCantidad;
  private javax.swing.JFormattedTextField campoCodCliente;
  private javax.swing.JFormattedTextField campoCodProducto;
  private javax.swing.JFormattedTextField campoCodVendedor;
  private javax.swing.JTextField campoDomicilio;
  private javax.swing.JTextField campoNombre;
  private javax.swing.JFormattedTextField campoNroRemito;
  private javax.swing.JTextField campoTotal;
  private javax.swing.ButtonGroup grupoCondicionVenta;
  private javax.swing.ButtonGroup grupoIva;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JLabel jLabel2;
  private javax.swing.JLabel jLabel3;
  private javax.swing.JLabel jLabel4;
  private javax.swing.JLabel jLabel5;
  private javax.swing.JLabel jLabel6;
  private javax.swing.JLabel labelCodCliente;
  private javax.swing.JLabel labelCodProducto;
  private javax.swing.JLabel labelCodVendedor;
  private javax.swing.JLabel labelCondicionVenta;
  private javax.swing.JLabel labelIva;
  private javax.swing.JLayeredPane layeredPaneCliente;
  private javax.swing.JLayeredPane layeredPaneVendedor;
  private javax.swing.JRadioButton radioConsumidorFinal;
  private javax.swing.JRadioButton radioContado;
  private javax.swing.JRadioButton radioCtaCte;
  private javax.swing.JRadioButton radioExento;
  private javax.swing.JRadioButton radioMonotributo;
  private javax.swing.JRadioButton radioNoRespInsc;
  private javax.swing.JScrollPane scrollTablaDetalle;
  private javax.swing.JTable tablaDetalleVenta;
  // End of variables declaration         
}

VentanaPrincipal.java


package com.dansan.frontend;
/**
*
* @author dansan
*/
public class VentanaPrincipal extends javax.swing.JFrame {
  /**
  * Creates new form VentanaPrincipal
  */
  public VentanaPrincipal() {
    initComponents();
  }
  /**
  * This method is called from within the constructor to initialize the form.
  * WARNING: Do NOT modify this code. The content of this method is always
  * regenerated by the Form Editor.
  */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">             
  private void initComponents() {
    labelFondo = new javax.swing.JLabel();

    barraMenu = new javax.swing.JMenuBar();

    jMenu1 = new javax.swing.JMenu();

    itemVenta = new javax.swing.JMenuItem();

    itemPago = new javax.swing.JMenuItem();

    itemConsulta = new javax.swing.JMenuItem();

    jMenu2 = new javax.swing.JMenu();

    itemCerrar = new javax.swing.JMenuItem();



    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    setTitle("dansan computers");



    labelFondo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/computadorainicio.png"))); // NOI18N



    jMenu1.setText("Operaciones");

    jMenu1.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent evt) {

        jMenu1ActionPerformed(evt);

      }

    });



    itemVenta.setText("Venta");

    itemVenta.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent evt) {

        itemVentaActionPerformed(evt);

      }

    });

    jMenu1.add(itemVenta);



    itemPago.setText("Pago");

    itemPago.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent evt) {

        itemPagoActionPerformed(evt);

      }

    });

    jMenu1.add(itemPago);



    itemConsulta.setText("Consulta");

    itemConsulta.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent evt) {

        itemConsultaActionPerformed(evt);

      }

    });

    jMenu1.add(itemConsulta);



    barraMenu.add(jMenu1);



    jMenu2.setText("Salir");

    jMenu2.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent evt) {

        jMenu2ActionPerformed(evt);

      }

    });



    itemCerrar.setText("Cerrar");

    itemCerrar.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent evt) {

        itemCerrarActionPerformed(evt);

      }

    });

    jMenu2.add(itemCerrar);



    barraMenu.add(jMenu2);



    setJMenuBar(barraMenu);



    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

    getContentPane().setLayout(layout);

    layout.setHorizontalGroup(

      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

      .addComponent(labelFondo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

    );

    layout.setVerticalGroup(

      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

      .addComponent(labelFondo, javax.swing.GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE)

    );



    pack();

  }// </editor-fold>            



  private void itemVentaActionPerformed(java.awt.event.ActionEvent evt) {                     

    VentanaVenta ventanaVenta = new VentanaVenta(this,true);

  }                    



  private void itemPagoActionPerformed(java.awt.event.ActionEvent evt) {                    

    VentanaPago ventanaPago = new VentanaPago(this,true);

  }                    



  private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {                   

   

  }                   



  private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {                   

   

  }                   



  private void itemConsultaActionPerformed(java.awt.event.ActionEvent evt) {                      

    VentanaConsulta ventanaConsulta = new VentanaConsulta(this,true);

  }                      



  private void itemCerrarActionPerformed(java.awt.event.ActionEvent evt) {                     

    this.dispose();

  }                     



  /**

  * @param args the command line arguments

  */

  public static void main(String args[]) {

    /* Set the Nimbus look and feel */

    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

    * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

    */

    try {

      for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

        if ("Nimbus".equals(info.getName())) {

          javax.swing.UIManager.setLookAndFeel(info.getClassName());

          break;

        }

      }

    } catch (ClassNotFoundException ex) {

      java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

    } catch (InstantiationException ex) {

      java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

    } catch (IllegalAccessException ex) {

      java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

    } catch (javax.swing.UnsupportedLookAndFeelException ex) {

      java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

    }

    //</editor-fold>



    /* Create and display the form */

    java.awt.EventQueue.invokeLater(new Runnable() {

      public void run() {

        new VentanaPrincipal().setVisible(true);

      }

    });

  }

  // Variables declaration - do not modify          

  private javax.swing.JMenuBar barraMenu;

  private javax.swing.JMenuItem itemCerrar;

  private javax.swing.JMenuItem itemConsulta;

  private javax.swing.JMenuItem itemPago;

  private javax.swing.JMenuItem itemVenta;

  private javax.swing.JMenu jMenu1;

  private javax.swing.JMenu jMenu2;

  private javax.swing.JLabel labelFondo;

  // End of variables declaration         

}

Imagenes del Proyecto




Imagenes del Gestor creado con Netbeans


Los archivos del proyecto

facturacionDansan.rar: descomprimir , adentro esta el jar ejecutable y elmysql-connector-java-5.1.23-bin.jar.

https://drive.google.com/file/d/0B0sBXdZ8aJgdS3FHSHdGZVlYdnc/edit?usp=sharing

facturacion.sql: el script para crear la base de datos.

https://drive.google.com/file/d/0B0sBXdZ8aJgdQlhaZ2J5ZHMzS0U/edit?usp=sharing

Ademas para gestionar la base de datos el siguiente proyecto creado con Java Server Faces 2.0 a traves de Netbeans 7.3.1.

https://drive.google.com/file/d/0B0sBXdZ8aJgdeFVyWWt3M3JHMFE/edit?usp=sharing


Comentarios