interfaces.InterfazPrincipal.java Source code

Java tutorial

Introduction

Here is the source code for interfaces.InterfazPrincipal.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaces;

import controladores.CompraProveedores;
import interfaces.dialogos.DialogoBuscarProveedor;
import controladores.ControladorCliente;
import controladores.ControladorConfiguraciones;
import controladores.ControladorFactura;
import controladores.ControladorFactura_Productos;
import controladores.ControladorFlujoFactura;
import controladores.ControladorProducto;
import controladores.ControladorProveedores;
import controladores.ControladorUsuarios;
import entidades.Cliente;
import controladores.ControladorCompraProveedor;
import controladores.ControladorFlujoCompras;
import entidades.Factura;
import entidades.Flujo_Compra;
import entidades.Productos;
import entidades.Proveedores;
import entidades.Usuarios;
import generarPDF.GenerarFactura;
import generarPDF.GenerarReporteDiario;
import generarPDF.ReporteFlujosCliente;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.title.LegendTitle;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.Range;
import org.jfree.data.time.Day;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.ui.RectangleInsets;

/**
 *
 * @author cardel
 */
public class InterfazPrincipal extends javax.swing.JFrame {

    /**
     * Creates new form InterfazPrincipal
     */
    public InterfazPrincipal() {
        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">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel7 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        botonBuscarClienteCrearFactura = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        nombreClienteCrearFactura = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        IdentificacionClienteBuscarFactura = new javax.swing.JTextField();
        jTextField_Factura_Cliente_Id = new javax.swing.JTextField();
        mensajesBusquedaClientesFactura = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jLabel23 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jTextField_Factura_Producto_Nombre = new javax.swing.JTextField();
        jTextField_Factura_Producto_Descripcion = new javax.swing.JTextField();
        botonAgregarProducto = new javax.swing.JButton();
        botonGuardarFactura = new javax.swing.JButton();
        valorActualPrestamo = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel53 = new javax.swing.JLabel();
        valorActualFactura = new javax.swing.JLabel();
        jPanel19 = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        valorMontoFactura = new javax.swing.JTextField();
        botonEstablecerMontoFactura = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        TablaDeFacturaProducto = new javax.swing.JTable();
        jPanel8 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jLabel36 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jLabel39 = new javax.swing.JLabel();
        jTextField_BuscarFactura_ID = new javax.swing.JTextField();
        jTextField_BuscarFactura_Cliente = new javax.swing.JTextField();
        jButton5 = new javax.swing.JButton();
        jLabel32 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        TablaDeBuscarFactura = new javax.swing.JTable();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        botonAgregarNuevoCliente = new javax.swing.JButton();
        nombreNuevoCliente = new javax.swing.JTextField();
        DireccionNuevoCliente = new javax.swing.JTextField();
        telefonoNuevoCliente = new javax.swing.JTextField();
        montoPrestamoNuevoCliente = new javax.swing.JTextField();
        celularNuevoCliente = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        TablaDeClientes = new javax.swing.JTable();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        nombreClienteBusqueda = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        identificacionClienteBusqueda = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        BotonBuscarCliente = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        jLabel29 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        nombreClienteBusquedaSaldo = new javax.swing.JTextField();
        BotonBuscarClienteSaldo = new javax.swing.JButton();
        mostrarIdentificacionCliente = new javax.swing.JTextField();
        jLabel37 = new javax.swing.JLabel();
        abonoClente = new javax.swing.JTextField();
        botonRegistrarAbono = new javax.swing.JButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        TablaDeSaldoClientes = new javax.swing.JTable();
        jLabel34 = new javax.swing.JLabel();
        textoTotalDebe = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        textoPersonaSaldo = new javax.swing.JLabel();
        jTabbedPane7 = new javax.swing.JTabbedPane();
        jPanel3 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jTextField_Producto_Con_Nombre = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jTextField_Producto_Con_Descripcion = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jTextField_Producto_Con_Unidades = new javax.swing.JTextField();
        jTextField4 = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        TablaDeProductos = new javax.swing.JTable();
        jPanel4 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jTextField_Producto_CP_nombre = new javax.swing.JTextField();
        jTextField_Producto_CP_descripcion = new javax.swing.JTextField();
        sliderNumeroUnidades = new javax.swing.JSlider();
        jTextField_Producto_CP_unidades = new javax.swing.JTextField();
        jTextField_Producto_CP_precio = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel_Producto_CP_Mensaje = new javax.swing.JLabel();
        jLabel62 = new javax.swing.JLabel();
        jTextField_valorCodigoBarrasNuevoProducto = new javax.swing.JTextField();
        jTabbedPane8 = new javax.swing.JTabbedPane();
        jPanel26 = new javax.swing.JPanel();
        jPanel28 = new javax.swing.JPanel();
        jPanel29 = new javax.swing.JPanel();
        jLabel69 = new javax.swing.JLabel();
        jLabel70 = new javax.swing.JLabel();
        jLabel71 = new javax.swing.JLabel();
        campoNITProveedor = new javax.swing.JTextField();
        campoNombreProveedor = new javax.swing.JTextField();
        campoProveedorSeleccionado = new javax.swing.JTextField();
        jButton11 = new javax.swing.JButton();
        jLabel67 = new javax.swing.JLabel();
        nombreProveedorAComprar = new javax.swing.JLabel();
        jPanel30 = new javax.swing.JPanel();
        jLabel72 = new javax.swing.JLabel();
        campoMontoCompra = new javax.swing.JTextField();
        jButton12 = new javax.swing.JButton();
        jPanel27 = new javax.swing.JPanel();
        jPanel31 = new javax.swing.JPanel();
        jLabel73 = new javax.swing.JLabel();
        jLabel74 = new javax.swing.JLabel();
        jLabel75 = new javax.swing.JLabel();
        campoNitBuscarProveedor = new javax.swing.JTextField();
        campoNombreBuscarProveedor = new javax.swing.JTextField();
        jButton13 = new javax.swing.JButton();
        jLabel76 = new javax.swing.JLabel();
        jScrollPane11 = new javax.swing.JScrollPane();
        tablaMostrarCompras = new javax.swing.JTable();
        jTabbedPane4 = new javax.swing.JTabbedPane();
        jPanel23 = new javax.swing.JPanel();
        jPanel25 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel63 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jTextFieldNitProveedores = new javax.swing.JTextField();
        jTextFieldNombreProveedores = new javax.swing.JTextField();
        jButton4 = new javax.swing.JButton();
        jScrollPane9 = new javax.swing.JScrollPane();
        TablaDeProveedores = new javax.swing.JTable();
        jPanel24 = new javax.swing.JPanel();
        jLabel64 = new javax.swing.JLabel();
        jLabel65 = new javax.swing.JLabel();
        jTextFieldNombreSaldoProveedores = new javax.swing.JTextField();
        mostrarIDProveedor = new javax.swing.JTextField();
        jButton9 = new javax.swing.JButton();
        jLabel66 = new javax.swing.JLabel();
        deudaActualProveedor = new javax.swing.JLabel();
        jLabel68 = new javax.swing.JLabel();
        jTextFieldAbonoProveedor = new javax.swing.JTextField();
        jButton10 = new javax.swing.JButton();
        jScrollPane10 = new javax.swing.JScrollPane();
        TablaDeSaldoProveedor = new javax.swing.JTable();
        jLabel77 = new javax.swing.JLabel();
        textoNombreProveedor = new javax.swing.JLabel();
        jTabbedPane5 = new javax.swing.JTabbedPane();
        jPanel14 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        jLabel40 = new javax.swing.JLabel();
        jButton6 = new javax.swing.JButton();
        fechaReporteDiario = new datechooser.beans.DateChooserCombo();
        jLabel54 = new javax.swing.JLabel();
        fechaReporteDiarioHasta = new datechooser.beans.DateChooserCombo();
        jScrollPane6 = new javax.swing.JScrollPane();
        TablaDeReporteDiario = new javax.swing.JTable();
        jPanel20 = new javax.swing.JPanel();
        jLabel45 = new javax.swing.JLabel();
        jLabel46 = new javax.swing.JLabel();
        ReporteDiarioAbono = new javax.swing.JTextField();
        ReporteDiarioDeuda = new javax.swing.JTextField();
        jPanel15 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jLabel41 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        nombreClienteReporteCliente = new javax.swing.JTextField();
        identificacionClienteCliente = new javax.swing.JTextField();
        jButton7 = new javax.swing.JButton();
        jTextFieldIdentificacionClienteReporte = new javax.swing.JTextField();
        jPanel18 = new javax.swing.JPanel();
        jLabel43 = new javax.swing.JLabel();
        jLabel44 = new javax.swing.JLabel();
        botonGenerarReporteCliente = new javax.swing.JButton();
        clienteReporteClienteFechaInicial = new datechooser.beans.DateChooserCombo();
        clienteReporteClienteFechaFinal = new datechooser.beans.DateChooserCombo();
        label1 = new java.awt.Label();
        jTabbedPane6 = new javax.swing.JTabbedPane();
        jPanel21 = new javax.swing.JPanel();
        jLabel47 = new javax.swing.JLabel();
        jLabel48 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        nombreNuevoUsuario = new javax.swing.JTextField();
        passwordNuevoUsuario = new javax.swing.JTextField();
        jLabel50 = new javax.swing.JLabel();
        checkBoxEstadoNuevoUsuario = new javax.swing.JCheckBox();
        jLabel51 = new javax.swing.JLabel();
        jButton8 = new javax.swing.JButton();
        jScrollPane7 = new javax.swing.JScrollPane();
        tablaUsuariosDelSistema = new javax.swing.JTable();
        jPanel22 = new javax.swing.JPanel();
        jLabel56 = new javax.swing.JLabel();
        jLabel57 = new javax.swing.JLabel();
        jLabel58 = new javax.swing.JLabel();
        jLabel59 = new javax.swing.JLabel();
        botonGuardarDatosEmpresa = new javax.swing.JButton();
        valorRazonSocial = new javax.swing.JTextField();
        valorNIT = new javax.swing.JTextField();
        valorDireccionEmpresa = new javax.swing.JTextField();
        jLabel60 = new javax.swing.JLabel();
        jLabel55 = new javax.swing.JLabel();
        valorIVA = new javax.swing.JSpinner();
        jLabel61 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        valorMensajeFinalFactura = new javax.swing.JTextArea();
        botonGuardarDatosFacturas = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel52 = new javax.swing.JLabel();
        JTextFieldnombreDeUsuario = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.LEFT);
        jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jPanel9.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jPanel10.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel24.setText("Cliente");

        botonBuscarClienteCrearFactura.setText("Buscar");
        botonBuscarClienteCrearFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBuscarClienteCrearFacturaActionPerformed(evt);
            }
        });

        jLabel25.setText("Nombre");

        jLabel26.setText("Identificacin");

        jTextField_Factura_Cliente_Id.setEnabled(false);

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(jPanel10Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel26).addComponent(jLabel24).addComponent(jLabel25))
                        .addGap(18, 18, 18)
                        .addGroup(
                                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(IdentificacionClienteBuscarFactura,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
                                        .addComponent(nombreClienteCrearFactura))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel10Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                        .addComponent(mensajesBusquedaClientesFactura,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 211,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel10Layout.createSequentialGroup()
                                        .addGroup(jPanel10Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(botonBuscarClienteCrearFactura)
                                                .addComponent(jTextField_Factura_Cliente_Id,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 150,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        jPanel10Layout.setVerticalGroup(jPanel10Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel25)
                                .addComponent(nombreClienteCrearFactura, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jTextField_Factura_Cliente_Id, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel26)
                                .addComponent(IdentificacionClienteBuscarFactura,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(botonBuscarClienteCrearFactura))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        jPanel10Layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(mensajesBusquedaClientesFactura).addGap(71, 71, 71)));

        jPanel11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel23.setText("Producto");

        jLabel27.setText("Nombre");

        jLabel28.setText("Descripcion");

        botonAgregarProducto.setText("Buscar");
        botonAgregarProducto.setEnabled(false);
        botonAgregarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAgregarProductoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(jPanel11Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel11Layout.createSequentialGroup().addContainerGap().addGroup(jPanel11Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel11Layout.createSequentialGroup()
                                .addGroup(jPanel11Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel27).addComponent(jLabel28))
                                .addGap(28, 28, 28)
                                .addGroup(jPanel11Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jTextField_Factura_Producto_Nombre)
                                        .addComponent(jTextField_Factura_Producto_Descripcion,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE))
                                .addGap(18, 18, 18).addComponent(botonAgregarProducto))
                        .addComponent(jLabel23))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel11Layout.setVerticalGroup(jPanel11Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel11Layout.createSequentialGroup().addContainerGap().addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel27)
                                .addComponent(jTextField_Factura_Producto_Nombre,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(botonAgregarProducto))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel28).addComponent(jTextField_Factura_Producto_Descripcion,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        botonGuardarFactura.setText("Guardar factura");
        botonGuardarFactura.setEnabled(false);
        botonGuardarFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonGuardarFacturaActionPerformed(evt);
            }
        });

        valorActualPrestamo.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        valorActualPrestamo.setText("0.0");

        jLabel30.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel30.setText("Valor factura:");

        jLabel53.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel53.setText("Monto prstamo disponible");

        valorActualFactura.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        valorActualFactura.setText("0.0");

        jPanel19.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel31.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel31.setText("Establecer monto factura");

        botonEstablecerMontoFactura.setText("Establecer");
        botonEstablecerMontoFactura.setEnabled(false);
        botonEstablecerMontoFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonEstablecerMontoFacturaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(jPanel19Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel19Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel19Layout.createSequentialGroup().addComponent(jLabel31).addGap(0, 0,
                                        Short.MAX_VALUE))
                                .addGroup(jPanel19Layout.createSequentialGroup().addComponent(valorMontoFactura)
                                        .addGap(18, 18, 18).addComponent(botonEstablecerMontoFactura)))
                        .addContainerGap()));
        jPanel19Layout.setVerticalGroup(jPanel19Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel19Layout.createSequentialGroup().addContainerGap().addComponent(jLabel31)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(valorMontoFactura, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(botonEstablecerMontoFactura))
                        .addContainerGap(23, Short.MAX_VALUE)));

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout
                .setHorizontalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap().addGroup(
                                jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                        false).addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 445,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(jPanel9Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel9Layout.createSequentialGroup().addGap(51, 51, 51)
                                                .addGroup(jPanel9Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jPanel19,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addGroup(jPanel9Layout.createSequentialGroup()
                                                                .addGroup(jPanel9Layout.createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                        .addComponent(valorActualFactura,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                160,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(jLabel30)
                                                                        .addComponent(jLabel53)
                                                                        .addComponent(valorActualPrestamo,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                160,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                                .addGap(0, 0, Short.MAX_VALUE)))
                                                .addContainerGap())
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout
                                                .createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(botonGuardarFactura).addGap(82, 82, 82)))));
        jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup().addContainerGap().addGroup(jPanel9Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel9Layout.createSequentialGroup().addComponent(botonGuardarFactura)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel53)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(valorActualPrestamo, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(1, 1, 1).addComponent(jLabel30)))
                        .addGap(5, 5, 5)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(jPanel9Layout.createSequentialGroup()
                                        .addComponent(valorActualFactura, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap()));

        TablaDeFacturaProducto.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Numero", "Identificacin", "Nombre", "Descripcion", "Unidades", "Valor Unitario",
                "Valor Total" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeFacturaProducto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeFacturaProductoMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(TablaDeFacturaProducto);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(jPanel7Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane3))
                        .addContainerGap()));
        jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 127,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jTabbedPane2.addTab("Crear Factura", jPanel7);

        jPanel13.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel36.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel36.setText("Buscar Factura");

        jLabel38.setText("Nmero factura");

        jLabel39.setText("Identificacin cliente");

        jButton5.setText("Buscar");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jLabel32.setText("Si desea borrar, guardar o imprimir una factura, haga clic sobre ella");

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(jPanel13Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel38).addComponent(jLabel39))
                        .addGap(36, 36, 36)
                        .addGroup(
                                jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jTextField_BuscarFactura_Cliente,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
                                        .addComponent(jTextField_BuscarFactura_ID))
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup().addGap(73, 73, 73)
                                        .addComponent(jButton5))
                                .addGroup(jPanel13Layout.createSequentialGroup().addGap(34, 34, 34)
                                        .addComponent(jLabel32)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
                        .addContainerGap(337, Short.MAX_VALUE).addComponent(jLabel36).addGap(326, 326, 326)));
        jPanel13Layout.setVerticalGroup(jPanel13Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup()
                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup().addGap(39, 39, 39)
                                        .addGroup(jPanel13Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel38).addComponent(jTextField_BuscarFactura_ID,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jPanel13Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel39)
                                                .addComponent(jTextField_BuscarFactura_Cliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap()
                                        .addComponent(jLabel36).addGap(20, 20, 20).addComponent(jButton5)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel32)))
                        .addContainerGap(19, Short.MAX_VALUE)));

        TablaDeBuscarFactura.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Numero", "Factura", "Fecha", "Cliente", "Estado", "Valor" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeBuscarFactura.setColumnSelectionAllowed(true);
        TablaDeBuscarFactura.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeBuscarFacturaMouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(TablaDeBuscarFactura);
        TablaDeBuscarFactura.getColumnModel().getSelectionModel()
                .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(jPanel8Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 768,
                                        Short.MAX_VALUE))
                        .addContainerGap()));
        jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)
                        .addContainerGap()));

        jTabbedPane2.addTab("Buscar Factura", jPanel8);

        jTabbedPane1.addTab("Facturas", jTabbedPane2);

        jLabel2.setText("Nombre");

        jLabel3.setText("Telfono");

        jLabel5.setText("Celular");

        jLabel6.setText("Direccin");

        jLabel7.setText("Monto a prestar");

        botonAgregarNuevoCliente.setText("Crear cliente");
        botonAgregarNuevoCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAgregarNuevoClienteActionPerformed(evt);
            }
        });

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

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel8.setText("Agregar clientes");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addGap(35, 35, 35).addGroup(jPanel1Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(
                                        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel2).addComponent(jLabel6))
                                .addGap(50, 50, 50)
                                .addGroup(jPanel1Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addComponent(DireccionNuevoCliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 259,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE))
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addComponent(nombreNuevoCliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 259,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addGroup(jPanel1Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING, false)
                                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                                                .addComponent(jLabel5)
                                                                .addPreferredGap(
                                                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        Short.MAX_VALUE)
                                                                .addComponent(celularNuevoCliente,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 259,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                                                .addComponent(jLabel3).addGap(18, 18, 18)
                                                                .addComponent(telefonoNuevoCliente,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 259,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addGap(32, 32, 32))))
                        .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel7).addGap(18, 18, 18)
                                .addComponent(montoPrestamoNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        259, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))))
                .addGroup(jPanel1Layout.createSequentialGroup().addGap(297, 297, 297).addComponent(jLabel8)
                        .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        jPanel1Layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(botonAgregarNuevoCliente).addGap(340, 340, 340)));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addGap(10, 10, 10).addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel2).addComponent(jLabel3)
                                .addComponent(nombreNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(telefonoNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(21, 21, 21)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5)
                                .addComponent(celularNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel6).addComponent(DireccionNuevoCliente,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel7).addComponent(montoPrestamoNuevoCliente,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(97, 97, 97).addComponent(botonAgregarNuevoCliente)
                        .addContainerGap(286, Short.MAX_VALUE)));

        jTabbedPane3.addTab("Crear clientes", jPanel1);

        TablaDeClientes.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Nmero cliente", "Nombre", "Monto a prestar", "Editar" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeClientes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeClientesMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(TablaDeClientes);

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel9.setText("Consultar y editar clientes");

        jLabel10.setText("Nombre");

        jLabel11.setText("Identificacin");

        jLabel12.setText("Usted puede buscar los clientes por nombre o su identificacin");

        jLabel13.setText("si no especifica nombre ni identificacin se muestran todos los clientes");

        BotonBuscarCliente.setText("Buscar");
        BotonBuscarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonBuscarClienteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(jPanel2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(
                                jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1))
                        .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(18, 18, 18)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(jLabel11)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addComponent(identificacionClienteBusqueda,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 228,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addComponent(jLabel10).addGap(59, 59, 59)
                                                        .addComponent(nombreClienteBusqueda,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 228,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(34, 34, 34)
                                                        .addGroup(jPanel2Layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                .addComponent(jLabel13).addComponent(jLabel12,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 334,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addGroup(jPanel2Layout.createSequentialGroup()
                                                        .addGap(168, 168, 168).addComponent(BotonBuscarCliente))))
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(245, 245, 245)
                                        .addComponent(jLabel9)))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addContainerGap().addComponent(jLabel9)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(23, 23, 23)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel10).addComponent(nombreClienteBusqueda,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(23, 23, 23)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel11)
                                                .addComponent(identificacionClienteBusqueda,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(BotonBuscarCliente)))
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(18, 18, 18)
                                        .addComponent(jLabel12)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel13)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 280,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));

        jTabbedPane3.addTab("Edicin de clientes", jPanel2);

        jLabel29.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel29.setText("Saldo clientes");

        jLabel33.setText("Nombre");

        BotonBuscarClienteSaldo.setText("Buscar");
        BotonBuscarClienteSaldo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonBuscarClienteSaldoActionPerformed(evt);
            }
        });

        mostrarIdentificacionCliente.setEnabled(false);

        jLabel37.setText("Abono");

        botonRegistrarAbono.setText("Registrar abono");
        botonRegistrarAbono.setEnabled(false);
        botonRegistrarAbono.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonRegistrarAbonoActionPerformed(evt);
            }
        });

        TablaDeSaldoClientes.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Nmero factura", "Tipo de Movimiento", "Fecha", "Valor" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeSaldoClientes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeSaldoClientesMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(TablaDeSaldoClientes);

        jLabel34.setText("El cliente debe la suma de:");

        textoTotalDebe.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        textoTotalDebe.setText("0.0");

        jLabel35.setText("Pagos  de:");

        textoPersonaSaldo.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        textoPersonaSaldo.setText("Nombre");

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(jPanel12Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(
                                jPanel12Layout.createSequentialGroup().addGap(316, 316, 316).addComponent(jLabel29))
                        .addGroup(jPanel12Layout.createSequentialGroup().addGap(18, 18, 18).addGroup(jPanel12Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addGroup(jPanel12Layout.createSequentialGroup()
                                                                .addGap(0, 0, Short.MAX_VALUE)
                                                                .addComponent(nombreClienteBusquedaSaldo,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 214,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(jPanel12Layout.createSequentialGroup()
                                                                .addComponent(jLabel37)
                                                                .addGap(0, 0, Short.MAX_VALUE)))
                                                .addComponent(abonoClente,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 217,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGap(437, 437, 437))
                                .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jLabel33)
                                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 748,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanel12Layout.createSequentialGroup().addGap(97, 97, 97)
                                                .addComponent(mostrarIdentificacionCliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 141,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(BotonBuscarClienteSaldo).addGap(81, 81, 81)
                                                .addGroup(jPanel12Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(botonRegistrarAbono)
                                                        .addGroup(jPanel12Layout.createSequentialGroup()
                                                                .addComponent(jLabel35).addGap(41, 41, 41)
                                                                .addComponent(textoPersonaSaldo,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 241,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(jPanel12Layout.createSequentialGroup()
                                                                .addComponent(jLabel34).addGap(26, 26, 26)
                                                                .addComponent(textoTotalDebe,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        Short.MAX_VALUE)))))
                                        .addGap(0, 0, Short.MAX_VALUE)))))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel12Layout
                .setVerticalGroup(jPanel12Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel12Layout
                                .createSequentialGroup().addGroup(jPanel12Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap()
                                                .addComponent(jLabel29).addGap(23, 23, 23).addGroup(jPanel12Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(jLabel33).addComponent(
                                                                nombreClienteBusquedaSaldo,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jLabel34)))
                                        .addGroup(jPanel12Layout
                                                .createSequentialGroup().addGap(61, 61, 61)
                                                .addComponent(textoTotalDebe)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel12Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel12Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(jPanel12Layout.createSequentialGroup()
                                                        .addGroup(jPanel12Layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(mostrarIdentificacionCliente,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(BotonBuscarClienteSaldo))
                                                        .addGap(6, 6, 6))
                                                .addComponent(jLabel35))
                                        .addComponent(textoPersonaSaldo))
                                .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(jPanel12Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel37)
                                        .addComponent(abonoClente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(botonRegistrarAbono))
                                .addGap(18, 18, 18)
                                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 206,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(29, 29, 29)));

        jTabbedPane3.addTab("Saldo cliente", jPanel12);

        jTabbedPane1.addTab("Clientes", jTabbedPane3);

        jPanel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel19.setText("Nombre");

        jLabel20.setText("Descripcion");

        jLabel21.setText("Unidades");

        jLabel22.setText("Precio");

        jButton2.setText("Buscar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(jPanel6Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup().addGap(19, 19, 19).addGroup(jPanel6Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jButton2)
                        .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel6Layout.createSequentialGroup().addComponent(jLabel19)
                                        .addGap(28, 28, 28).addComponent(jTextField_Producto_Con_Nombre,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 133,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel6Layout.createSequentialGroup().addComponent(jLabel20)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jTextField_Producto_Con_Descripcion)))
                                .addGap(34, 34, 34)
                                .addGroup(
                                        jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel21).addComponent(jLabel22))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel6Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jTextField_Producto_Con_Unidades).addComponent(jTextField4,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE))))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addGroup(jPanel6Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel19)
                        .addComponent(jTextField_Producto_Con_Nombre, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel21).addComponent(jTextField_Producto_Con_Unidades,
                                javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel20)
                                .addComponent(jTextField_Producto_Con_Descripcion,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel22).addComponent(jTextField4,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18).addComponent(jButton2)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        TablaDeProductos.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Numero", "Identificacin", "Nombre", "Descripcion", "Unidades", "Precio",
                "Cod. Barras" }) {
            boolean[] canEdit = new boolean[] { true, false, false, false, true, true, true };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeProductos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeProductosMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(TablaDeProductos);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(jPanel3Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 831,
                                        Short.MAX_VALUE))
                        .addContainerGap()));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 280,
                                javax.swing.GroupLayout.PREFERRED_SIZE)));

        jTabbedPane7.addTab("Consultar Producto", jPanel3);

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel14.setText("Crear nuevo producto");

        jPanel5.setBorder(new javax.swing.border.MatteBorder(null));

        jLabel15.setText("NOMBRE");

        jLabel16.setText("DESCRIPCION");

        jLabel17.setText("UNIDADES");

        jLabel18.setText("PRECIO");

        sliderNumeroUnidades.setMaximum(99);
        sliderNumeroUnidades.setMinimum(1);
        sliderNumeroUnidades.setValue(1);
        sliderNumeroUnidades.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                sliderNumeroUnidadesStateChanged(evt);
            }
        });

        jTextField_Producto_CP_unidades.setEditable(false);
        jTextField_Producto_CP_unidades.setText("1");

        jButton1.setText("Crear");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel62.setText("CDiGO DE BARRAS");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(jPanel5Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel15).addComponent(jLabel16).addComponent(jLabel17)
                                        .addComponent(jLabel18))
                                .addGap(23, 23, 23)
                                .addGroup(jPanel5Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jTextField_Producto_CP_nombre,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 313, Short.MAX_VALUE)
                                        .addComponent(jTextField_Producto_CP_descripcion)
                                        .addGroup(jPanel5Layout.createSequentialGroup()
                                                .addComponent(jTextField_Producto_CP_unidades,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 32,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(sliderNumeroUnidades,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 176,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(jTextField_Producto_CP_precio)))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel_Producto_CP_Mensaje, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton1).addGap(169, 169, 169))
                        .addGroup(jPanel5Layout.createSequentialGroup().addComponent(jLabel62).addGap(28, 28, 28)
                                .addComponent(jTextField_valorCodigoBarrasNuevoProducto)))
                        .addContainerGap()));
        jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel15).addComponent(jTextField_Producto_CP_nombre,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel16).addComponent(jTextField_Producto_CP_descripcion,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(sliderNumeroUnidades, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel5Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jTextField_Producto_CP_unidades,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel17)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel18).addComponent(jTextField_Producto_CP_precio,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel62).addComponent(jTextField_valorCodigoBarrasNuevoProducto,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel5Layout.createSequentialGroup()
                                                .addComponent(jLabel_Producto_CP_Mensaje,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 21,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(40, 40, 40))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout
                                        .createSequentialGroup().addComponent(jButton1).addGap(23, 23, 23)))));

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(jPanel4Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addGap(21, 21, 21)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                        .addContainerGap(387, Short.MAX_VALUE).addComponent(jLabel14,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(257, 257, 257)));
        jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup().addGap(23, 23, 23).addComponent(jLabel14)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(215, Short.MAX_VALUE)));

        jTabbedPane7.addTab("Nuevo Producto", jPanel4);

        jTabbedPane1.addTab("Productos", jTabbedPane7);

        jPanel28.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jPanel29.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel69.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); // NOI18N
        jLabel69.setText("Proveedor");

        jLabel70.setText("NIT");

        jLabel71.setText("Nombre");

        campoProveedorSeleccionado.setEnabled(false);

        jButton11.setText("Buscar");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jLabel67.setText("Compra al proveedor:");

        nombreProveedorAComprar.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

        javax.swing.GroupLayout jPanel29Layout = new javax.swing.GroupLayout(jPanel29);
        jPanel29.setLayout(jPanel29Layout);
        jPanel29Layout.setHorizontalGroup(jPanel29Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel29Layout.createSequentialGroup().addContainerGap().addGroup(jPanel29Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel29Layout.createSequentialGroup()
                                .addGroup(jPanel29Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel70).addComponent(jLabel71))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel29Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(campoNITProveedor).addComponent(campoNombreProveedor,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE))
                                .addGroup(jPanel29Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel29Layout.createSequentialGroup().addGap(33, 33, 33)
                                                .addComponent(campoProveedorSeleccionado,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 138,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(jPanel29Layout.createSequentialGroup().addGap(68, 68, 68)
                                                .addComponent(jButton11))))
                        .addComponent(jLabel69)).addGap(37, 37, 37)
                        .addGroup(jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(nombreProveedorAComprar, javax.swing.GroupLayout.PREFERRED_SIZE, 313,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel67))
                        .addContainerGap(105, Short.MAX_VALUE)));
        jPanel29Layout.setVerticalGroup(jPanel29Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel29Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel69).addComponent(jLabel67))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel29Layout.createSequentialGroup().addGroup(jPanel29Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel70)
                                        .addComponent(campoNITProveedor, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(campoProveedorSeleccionado,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel29Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel71)
                                                .addComponent(campoNombreProveedor,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jButton11)))
                                .addComponent(nombreProveedorAComprar, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(19, Short.MAX_VALUE)));

        jPanel30.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel72.setText("Establecer Monto");

        jButton12.setText("Guardar compra");
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel30Layout = new javax.swing.GroupLayout(jPanel30);
        jPanel30.setLayout(jPanel30Layout);
        jPanel30Layout.setHorizontalGroup(jPanel30Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel30Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel72)
                                .addGroup(jPanel30Layout.createSequentialGroup()
                                        .addComponent(campoMontoCompra, javax.swing.GroupLayout.PREFERRED_SIZE, 181,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(62, 62, 62).addComponent(jButton12)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel30Layout.setVerticalGroup(jPanel30Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel30Layout.createSequentialGroup().addContainerGap().addComponent(jLabel72)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(campoMontoCompra, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton12))
                        .addContainerGap(37, Short.MAX_VALUE)));

        javax.swing.GroupLayout jPanel28Layout = new javax.swing.GroupLayout(jPanel28);
        jPanel28.setLayout(jPanel28Layout);
        jPanel28Layout
                .setHorizontalGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel28Layout.createSequentialGroup().addGap(18, 18, 18)
                                .addGroup(jPanel28Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jPanel29, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jPanel30, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel28Layout.setVerticalGroup(jPanel28Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel28Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel29, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel30, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(185, Short.MAX_VALUE)));

        javax.swing.GroupLayout jPanel26Layout = new javax.swing.GroupLayout(jPanel26);
        jPanel26.setLayout(jPanel26Layout);
        jPanel26Layout.setHorizontalGroup(
                jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel28,
                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE));
        jPanel26Layout.setVerticalGroup(
                jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel28,
                        javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

        jTabbedPane8.addTab("Crear Compra", jPanel26);

        jPanel31.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel73.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); // NOI18N
        jLabel73.setText("Proveedor");

        jLabel74.setText("NIT");

        jLabel75.setText("Nombre");

        jButton13.setText("Buscar");
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        jLabel76.setText("Si hace clic en una compra en la tabla, puede editar o borrar");

        javax.swing.GroupLayout jPanel31Layout = new javax.swing.GroupLayout(jPanel31);
        jPanel31.setLayout(jPanel31Layout);
        jPanel31Layout.setHorizontalGroup(jPanel31Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel31Layout.createSequentialGroup().addGap(18, 18, 18)
                        .addGroup(jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel73)
                                .addGroup(jPanel31Layout.createSequentialGroup()
                                        .addGroup(jPanel31Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel74).addComponent(jLabel75))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel31Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(campoNitBuscarProveedor)
                                                .addComponent(campoNombreBuscarProveedor,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE))
                                        .addGap(45, 45, 45).addComponent(jButton13).addGap(46, 46, 46)
                                        .addComponent(jLabel76)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel31Layout.setVerticalGroup(jPanel31Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel31Layout.createSequentialGroup().addContainerGap().addComponent(jLabel73)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel74).addComponent(campoNitBuscarProveedor,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(campoNombreBuscarProveedor, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel75).addComponent(jButton13).addComponent(jLabel76))
                        .addContainerGap(19, Short.MAX_VALUE)));

        tablaMostrarCompras.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Numero", "Proveedor", "Fecha", "Valor" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        tablaMostrarCompras.setColumnSelectionAllowed(true);
        tablaMostrarCompras.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablaMostrarComprasMouseClicked(evt);
            }
        });
        jScrollPane11.setViewportView(tablaMostrarCompras);
        tablaMostrarCompras.getColumnModel().getSelectionModel()
                .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(jPanel27Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel27Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel31, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane11, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addContainerGap()));
        jPanel27Layout.setVerticalGroup(jPanel27Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel27Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel31, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane11).addContainerGap()));

        jTabbedPane8.addTab("Buscar Compra", jPanel27);

        jTabbedPane1.addTab("Compras", jTabbedPane8);

        jPanel25.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel4.setText("NIT");

        jLabel63.setText("Nombre");

        jButton3.setText("Crear");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Buscar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(jPanel25Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel25Layout.createSequentialGroup().addGap(29, 29, 29)
                        .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel25Layout.createSequentialGroup().addComponent(jButton3)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jButton4))
                                .addGroup(jPanel25Layout.createSequentialGroup()
                                        .addGroup(jPanel25Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel4).addComponent(jLabel63))
                                        .addGap(29, 29, 29)
                                        .addGroup(jPanel25Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(jTextFieldNitProveedores)
                                                .addComponent(jTextFieldNombreProveedores,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 155,
                                                        Short.MAX_VALUE))))
                        .addContainerGap(167, Short.MAX_VALUE)));
        jPanel25Layout.setVerticalGroup(jPanel25Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel25Layout.createSequentialGroup().addContainerGap().addGroup(jPanel25Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel4)
                        .addComponent(jTextFieldNitProveedores, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel63).addComponent(jTextFieldNombreProveedores,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jButton3).addComponent(jButton4))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        TablaDeProveedores.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "NIT", "Nombre" }) {
            boolean[] canEdit = new boolean[] { false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeProveedores.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeProveedoresMouseClicked(evt);
            }
        });
        jScrollPane9.setViewportView(TablaDeProveedores);

        javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
        jPanel23.setLayout(jPanel23Layout);
        jPanel23Layout.setHorizontalGroup(jPanel23Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel23Layout.createSequentialGroup().addContainerGap().addGroup(jPanel23Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel23Layout.createSequentialGroup()
                                .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                        .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 831, Short.MAX_VALUE))
                        .addContainerGap()));
        jPanel23Layout.setVerticalGroup(jPanel23Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel23Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 280,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jTabbedPane4.addTab("Crear Proveedores", jPanel23);

        jLabel64.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel64.setText("SALDO DE PROVEEDORES");

        jLabel65.setText("Nombre");

        mostrarIDProveedor.setEnabled(false);

        jButton9.setText("Buscar");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jLabel66.setText("Se le debe al proveedor: ");

        deudaActualProveedor.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        deudaActualProveedor.setText("0.0");

        jLabel68.setText("Abono");

        jButton10.setText("Registrar Abono");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        TablaDeSaldoProveedor.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Numero compra", "Tipo flujo", "Fecha", "Valor" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeSaldoProveedor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeSaldoProveedorMouseClicked(evt);
            }
        });
        jScrollPane10.setViewportView(TablaDeSaldoProveedor);

        jLabel77.setText("Pagos de");

        textoNombreProveedor.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N

        javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
        jPanel24.setLayout(jPanel24Layout);
        jPanel24Layout.setHorizontalGroup(jPanel24Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel24Layout.createSequentialGroup().addGap(20, 20, 20).addGroup(jPanel24Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 748,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel24Layout.createSequentialGroup().addGroup(jPanel24Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel24Layout.createSequentialGroup().addComponent(jLabel68)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jTextFieldAbonoProveedor))
                                .addGroup(jPanel24Layout.createSequentialGroup()
                                        .addComponent(mostrarIDProveedor, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                132, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jButton9))
                                .addGroup(jPanel24Layout.createSequentialGroup().addComponent(jLabel65)
                                        .addGap(18, 18, 18).addComponent(jTextFieldNombreSaldoProveedores)))
                                .addGroup(jPanel24Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(jPanel24Layout.createSequentialGroup().addGap(18, 18, 18)
                                                .addComponent(jButton10))
                                        .addGroup(jPanel24Layout.createSequentialGroup().addGap(93, 93, 93)
                                                .addGroup(jPanel24Layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(jPanel24Layout.createSequentialGroup()
                                                                .addComponent(jLabel77).addGap(34, 34, 34)
                                                                .addComponent(textoNombreProveedor,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 130,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(jPanel24Layout.createSequentialGroup()
                                                                .addComponent(jLabel66).addGap(18, 18, 18)
                                                                .addComponent(deudaActualProveedor)))))))
                        .addContainerGap(20, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        jPanel24Layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel64).addGap(272, 272, 272)));
        jPanel24Layout.setVerticalGroup(jPanel24Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel24Layout.createSequentialGroup().addContainerGap().addComponent(jLabel64)
                        .addGap(32, 32, 32)
                        .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel65)
                                .addComponent(jTextFieldNombreSaldoProveedores,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel66).addComponent(deudaActualProveedor))
                        .addGap(26, 26, 26)
                        .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(mostrarIDProveedor, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton9).addComponent(jLabel77).addComponent(textoNombreProveedor))
                        .addGap(26, 26, 26)
                        .addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel68)
                                .addComponent(jTextFieldAbonoProveedor, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jButton10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                        .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 206,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));

        jTabbedPane4.addTab("Saldo Proveedores", jPanel24);

        jTabbedPane1.addTab("Proveedores", jTabbedPane4);

        jPanel16.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel40.setText("Fecha Desde");

        jButton6.setText("Generar");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jLabel54.setText("Fecha Hasta");

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(jPanel16Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel16Layout.createSequentialGroup().addGap(19, 19, 19)
                        .addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jButton6)
                                .addGroup(jPanel16Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(jPanel16Layout.createSequentialGroup().addComponent(jLabel54)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(fechaReporteDiarioHasta,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(jPanel16Layout.createSequentialGroup().addComponent(jLabel40)
                                                .addGap(59, 59, 59).addComponent(fechaReporteDiario,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap(87, Short.MAX_VALUE)));
        jPanel16Layout.setVerticalGroup(jPanel16Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel16Layout.createSequentialGroup().addContainerGap().addGroup(jPanel16Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel16Layout.createSequentialGroup()
                                .addGroup(jPanel16Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jLabel40).addComponent(fechaReporteDiario,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel54))
                        .addGroup(jPanel16Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(
                                fechaReporteDiarioHasta, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18).addComponent(jButton6).addContainerGap()));

        TablaDeReporteDiario.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Numero", "Factura", "Fecha", "Tipo", "Valor" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        TablaDeReporteDiario.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TablaDeReporteDiarioMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(TablaDeReporteDiario);

        jPanel20.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel45.setText("Abono");

        jLabel46.setText("Deuda");

        ReporteDiarioAbono.setEnabled(false);

        ReporteDiarioDeuda.setEnabled(false);

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(jPanel20Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel20Layout.createSequentialGroup().addContainerGap().addGroup(jPanel20Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jPanel20Layout.createSequentialGroup().addComponent(jLabel45).addGap(18, 18, 18)
                                .addComponent(ReporteDiarioAbono, javax.swing.GroupLayout.PREFERRED_SIZE, 155,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel20Layout.createSequentialGroup().addComponent(jLabel46).addGap(18, 18, 18)
                                .addComponent(ReporteDiarioDeuda)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel20Layout.setVerticalGroup(jPanel20Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel20Layout.createSequentialGroup().addContainerGap().addGroup(jPanel20Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel45)
                        .addComponent(ReporteDiarioAbono, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel46).addComponent(ReporteDiarioDeuda,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(jPanel14Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel14Layout.createSequentialGroup()
                                        .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18).addComponent(jPanel20,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 831,
                                        Short.MAX_VALUE))
                        .addContainerGap()));
        jPanel14Layout.setVerticalGroup(jPanel14Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel20, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 278,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap()));

        jTabbedPane5.addTab("Diario", jPanel14);

        jPanel17.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel41.setText("Nombre");

        jLabel42.setText("Identificacion");

        jButton7.setText("Buscar");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jTextFieldIdentificacionClienteReporte.setEditable(false);
        jTextFieldIdentificacionClienteReporte.setEnabled(false);

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(jPanel17Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel17Layout.createSequentialGroup().addContainerGap().addGroup(jPanel17Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jButton7)
                        .addGroup(jPanel17Layout.createSequentialGroup().addGroup(jPanel17Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                        jPanel17Layout.createSequentialGroup().addComponent(jLabel42)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(identificacionClienteCliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 182,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                        jPanel17Layout.createSequentialGroup().addComponent(jLabel41)
                                                .addGap(47, 47, 47).addComponent(nombreClienteReporteCliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 182,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(30, 30, 30).addComponent(jTextFieldIdentificacionClienteReporte,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 106,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(27, Short.MAX_VALUE)));
        jPanel17Layout.setVerticalGroup(jPanel17Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel17Layout.createSequentialGroup().addGap(17, 17, 17).addGroup(jPanel17Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel41)
                        .addComponent(nombreClienteReporteCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextFieldIdentificacionClienteReporte,
                                javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel42).addComponent(identificacionClienteCliente,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18).addComponent(jButton7)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jPanel18.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabel43.setText("Desde");

        jLabel44.setText("Hasta");

        botonGenerarReporteCliente.setText("Generar");
        botonGenerarReporteCliente.setEnabled(false);
        botonGenerarReporteCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonGenerarReporteClienteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18);
        jPanel18.setLayout(jPanel18Layout);
        jPanel18Layout.setHorizontalGroup(jPanel18Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel18Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel18Layout.createSequentialGroup()
                                        .addGroup(jPanel18Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel43).addComponent(jLabel44))
                                        .addGap(52, 52, 52)
                                        .addGroup(jPanel18Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(clienteReporteClienteFechaInicial,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(clienteReporteClienteFechaFinal,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addComponent(botonGenerarReporteCliente))
                        .addContainerGap(192, Short.MAX_VALUE)));
        jPanel18Layout.setVerticalGroup(jPanel18Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel18Layout.createSequentialGroup().addGap(17, 17, 17).addGroup(jPanel18Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel43)
                        .addComponent(clienteReporteClienteFechaInicial, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(14, 14, 14)
                        .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel44).addComponent(clienteReporteClienteFechaFinal,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botonGenerarReporteCliente)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        label1.setText("Seleccione un rango de fechas.");

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(jPanel15Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel15Layout.createSequentialGroup().addContainerGap().addGroup(jPanel15Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(388, Short.MAX_VALUE)));
        jPanel15Layout.setVerticalGroup(jPanel15Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel15Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(23, 23, 23)
                        .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(243, Short.MAX_VALUE)));

        jTabbedPane5.addTab("Cliente", jPanel15);

        jTabbedPane1.addTab("Reportes", jTabbedPane5);

        jLabel47.setText("Nombre de usuario:");

        jLabel48.setText("Contrasea:");

        jLabel49.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel49.setText("Administrar usuarios del sistema");

        jLabel50.setText("Habilitado");

        checkBoxEstadoNuevoUsuario.setSelected(true);

        jLabel51.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel51.setText("Usuarios registrados en el sistema");

        jButton8.setText("Registrar usuario");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        tablaUsuariosDelSistema.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Nombre", "Fecha de creacin", "Habilitado" }));
        tablaUsuariosDelSistema.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tablaUsuariosDelSistemaMouseClicked(evt);
            }
        });
        jScrollPane7.setViewportView(tablaUsuariosDelSistema);
        if (tablaUsuariosDelSistema.getColumnModel().getColumnCount() > 0) {
            tablaUsuariosDelSistema.getColumnModel().getColumn(2).setResizable(false);
        }

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(jPanel21Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel21Layout.createSequentialGroup().addGroup(jPanel21Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel21Layout.createSequentialGroup().addGap(27, 27, 27).addGroup(jPanel21Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel21Layout.createSequentialGroup().addGroup(jPanel21Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel47).addComponent(jLabel48).addComponent(jLabel50))
                                        .addGap(30, 30, 30)
                                        .addGroup(jPanel21Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(checkBoxEstadoNuevoUsuario)
                                                .addGroup(jPanel21Layout.createSequentialGroup()
                                                        .addGroup(jPanel21Layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING,
                                                                        false)
                                                                .addComponent(nombreNuevoUsuario)
                                                                .addComponent(passwordNuevoUsuario,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE, 191,
                                                                        Short.MAX_VALUE))
                                                        .addGap(139, 139, 139).addComponent(jButton8))))
                                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 723,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(
                                jPanel21Layout.createSequentialGroup().addGap(245, 245, 245).addComponent(jLabel49))
                        .addGroup(jPanel21Layout.createSequentialGroup().addGap(307, 307, 307)
                                .addComponent(jLabel51)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel21Layout.setVerticalGroup(jPanel21Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel21Layout.createSequentialGroup().addContainerGap().addComponent(jLabel49)
                        .addGap(25, 25, 25)
                        .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel47).addComponent(nombreNuevoUsuario,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel21Layout.createSequentialGroup().addGap(18, 18, 18)
                                        .addGroup(jPanel21Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel48).addComponent(passwordNuevoUsuario,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel21Layout
                                        .createSequentialGroup().addGap(9, 9, 9).addComponent(jButton8)))
                        .addGap(22, 22, 22)
                        .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel50).addComponent(checkBoxEstadoNuevoUsuario))
                        .addGap(13, 13, 13).addComponent(jLabel51).addGap(18, 18, 18)
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 192,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        generarTablaUsuarios();

        jTabbedPane6.addTab("Administrar usuarios", jPanel21);

        jLabel56.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel56.setText("Datos legales empresa");

        jLabel57.setText("Razn social");

        jLabel58.setText("NIT");

        jLabel59.setText("Direccin empresa");

        botonGuardarDatosEmpresa.setText("Guardar datos legales");
        botonGuardarDatosEmpresa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonGuardarDatosEmpresaActionPerformed(evt);
            }
        });

        jLabel60.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel60.setText("Datos facturas");

        jLabel55.setText("Porcentaje IVA");

        valorIVA.setModel(new javax.swing.SpinnerNumberModel(0, 0, 100, 1));

        jLabel61.setText("Mensaje final factura");

        valorMensajeFinalFactura.setColumns(20);
        valorMensajeFinalFactura.setLineWrap(true);
        valorMensajeFinalFactura.setRows(5);
        jScrollPane8.setViewportView(valorMensajeFinalFactura);

        botonGuardarDatosFacturas.setText("Guardar datos facturas");
        botonGuardarDatosFacturas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonGuardarDatosFacturasActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(jPanel22Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel22Layout.createSequentialGroup().addGap(56, 56, 56).addGroup(jPanel22Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jLabel56)
                        .addComponent(jLabel60)
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel22Layout.createSequentialGroup().addGroup(jPanel22Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel57).addComponent(jLabel58).addComponent(jLabel59))
                                        .addGap(21, 21, 21)
                                        .addGroup(jPanel22Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(valorNIT, javax.swing.GroupLayout.PREFERRED_SIZE, 247,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(valorRazonSocial,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 247,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(valorDireccionEmpresa,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 310,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel22Layout.createSequentialGroup()
                                        .addGroup(jPanel22Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel61).addComponent(jLabel55))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel22Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(valorIVA, javax.swing.GroupLayout.PREFERRED_SIZE, 60,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        303, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addGap(48, 48, 48)
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(botonGuardarDatosEmpresa).addComponent(botonGuardarDatosFacturas,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 160,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(139, Short.MAX_VALUE)));
        jPanel22Layout.setVerticalGroup(jPanel22Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel22Layout.createSequentialGroup().addContainerGap().addComponent(jLabel56)
                        .addGap(32, 32, 32)
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel57).addComponent(valorRazonSocial,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel22Layout.createSequentialGroup().addGap(18, 18, 18)
                                        .addGroup(jPanel22Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel58).addComponent(valorNIT,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel22Layout.createSequentialGroup().addGap(3, 3, 3)
                                        .addComponent(botonGuardarDatosEmpresa)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel59)
                                .addComponent(valorDireccionEmpresa, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(44, 44, 44).addComponent(jLabel60).addGap(31, 31, 31)
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel55).addComponent(valorIVA,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel61).addComponent(botonGuardarDatosFacturas)
                                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        ControladorConfiguraciones controladorConfiguraciones = new ControladorConfiguraciones();
        String[] datosFactura = controladorConfiguraciones.obtenerInformacionFactura();
        String[] datosGlobales = controladorConfiguraciones.obtenerInformacionLegal();

        valorRazonSocial.setText(datosGlobales[0]);
        valorNIT.setText(datosGlobales[1]);
        valorDireccionEmpresa.setText(datosGlobales[2]);

        valorIVA.setValue(Double.parseDouble(datosFactura[0]));
        valorMensajeFinalFactura.setText(datosFactura[1]);

        jTabbedPane6.addTab("Configuraciones globales", jPanel22);

        jTabbedPane1.addTab("Administracin", jTabbedPane6);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel1.setText("Bienvenido al aplicativo del Mini-market");

        jLabel52.setText("Bienvenido:");

        JTextFieldnombreDeUsuario.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        JTextFieldnombreDeUsuario.setText("Nombre");

        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()
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 881,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(layout.createSequentialGroup().addGap(133, 133, 133).addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel52).addGap(18, 18, 18).addComponent(JTextFieldnombreDeUsuario,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel52).addComponent(JTextFieldnombreDeUsuario)))
                        .addComponent(jLabel1)).addGap(22, 22, 22)
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 458, Short.MAX_VALUE)
                        .addContainerGap()));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        String nombre = jTextField_Producto_CP_nombre.getText();
        String descripcion = jTextField_Producto_CP_descripcion.getText();
        String unidades = jTextField_Producto_CP_unidades.getText();
        String precio = jTextField_Producto_CP_precio.getText();
        String codigoBarras = jTextField_valorCodigoBarrasNuevoProducto.getText();
        if (nombre.equals("") || descripcion.equals("") || unidades.equals("") || precio.equals("")) {
            jLabel_Producto_CP_Mensaje.setForeground(Color.red);
            jLabel_Producto_CP_Mensaje.setText("No dejar campos vacios");
        } else {
            try {
                Double.parseDouble(precio);

            } catch (NumberFormatException nfe) {
                jLabel_Producto_CP_Mensaje.setForeground(Color.red);
                jLabel_Producto_CP_Mensaje.setText("Precio debe ser un nmero");
                return;
            }
            jLabel_Producto_CP_Mensaje.setForeground(Color.blue);
            jLabel_Producto_CP_Mensaje.setText("");
            JOptionPane.showMessageDialog(null, "Producto creado con xito");
            String[] value = { nombre, descripcion, unidades, precio, codigoBarras };
            ControladorProducto cp = new ControladorProducto();
            cp.insertProduct(value);
            jTextField_Producto_CP_nombre.setText("");
            jTextField_Producto_CP_descripcion.setText("");
            jTextField_Producto_CP_unidades.setText("1");
            jTextField_Producto_CP_precio.setText("");
            jTextField_valorCodigoBarrasNuevoProducto.setText("");
            sliderNumeroUnidades.setValue(1);
        }

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        String nombre = jTextField_Producto_Con_Nombre.getText();
        String descripcion = jTextField_Producto_Con_Descripcion.getText();
        String unidades_string = jTextField_Producto_Con_Unidades.getText();
        String precio_string = jTextField4.getText();

        int unidades = 0;
        double precio = 0;
        try {
            if (!unidades_string.equals("")) {
                unidades = Integer.parseInt(unidades_string);
            }
            if (!precio_string.equals("")) {
                precio = Double.parseDouble(precio_string);
            }

            ControladorProducto controladorPro = new ControladorProducto();
            String restriccion = "";

            boolean encounter = true;

            if (!nombre.equals("")) {
                if (encounter) {
                    encounter = false;
                    restriccion = " where ";
                } else {
                    restriccion += " OR ";
                }

                restriccion += " nombre like '%" + nombre + "%'";
            }

            if (!descripcion.equals("")) {
                if (encounter) {
                    encounter = false;
                    restriccion = " where ";
                } else {
                    restriccion += " OR ";
                }

                restriccion += " descripcion like '%" + descripcion + "%'";
            }

            if (!unidades_string.equals("")) {
                if (encounter) {
                    encounter = false;
                    restriccion = " where ";
                } else {
                    restriccion += " OR ";
                }

                restriccion += " unidades =" + unidades;
            }

            if (!precio_string.equals("")) {
                if (encounter) {
                    encounter = false;
                    restriccion = " where ";
                } else {
                    restriccion += " OR ";
                }

                restriccion += " precio =" + precio;
            }

            ArrayList<Productos> listaDeProductos = controladorPro.getProducto(restriccion);

            //Agregar filas
            DefaultTableModel modelo = (DefaultTableModel) TablaDeProductos.getModel();

            if (modelo.getRowCount() > 0) {
                for (int i = modelo.getRowCount() - 1; i > -1; i--) {
                    modelo.removeRow(i);
                }
            }

            for (int i = 0; i < listaDeProductos.size(); i++) {
                Productos producto = listaDeProductos.get(i);
                Object[] fila = new Object[7];
                fila[0] = (i + 1);
                fila[1] = producto.getProductoId();
                fila[2] = producto.getNombre();
                fila[3] = producto.getDescripcion();
                fila[4] = producto.getUnidadesDisponibles();
                fila[5] = producto.getPrecio();
                fila[6] = producto.getCodigoBarras();
                modelo.addRow(fila);

            }

            TablaDeProductos.setModel(modelo);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this,
                    "Error al consultar los productos\nInformacin tcnica\n" + e.toString(), "Error",
                    JOptionPane.ERROR_MESSAGE);
        }

    }//GEN-LAST:event_jButton2ActionPerformed

    private void TablaDeProductosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeProductosMouseClicked
        // TODO add your handling code here:
        int fila = TablaDeProductos.getSelectedRow();
        final int identificacion = (int) TablaDeProductos.getValueAt(fila, 1);

        final ControladorProducto controladorP = new ControladorProducto();
        ArrayList<Productos> listaProductos = controladorP.getProducto(" where producto_id = " + identificacion);
        final Productos productoActual = listaProductos.get(0);

        final JDialog dialogoEditar = new JDialog(this);

        dialogoEditar.setTitle("Editar clientes");
        dialogoEditar.setSize(600, 310);
        dialogoEditar.setResizable(false);

        JPanel panelDialogo = new JPanel();

        panelDialogo.setLayout(new GridBagLayout());

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;

        JLabel editarTextoPrincipalDialogo = new JLabel("Editar producto");
        c.gridx = 0;
        c.gridy = 0;
        c.gridwidth = 4;
        c.insets = new Insets(15, 200, 40, 0);
        c.ipadx = 100;
        Font textoGrande = new Font("Arial", 1, 18);
        editarTextoPrincipalDialogo.setFont(textoGrande);
        panelDialogo.add(editarTextoPrincipalDialogo, c);

        c.insets = new Insets(0, 5, 10, 0);
        c.gridx = 0;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 40;
        JLabel editarNombreClienteDialogo = new JLabel("Nombre:");
        panelDialogo.add(editarNombreClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);
        final JTextField valorEditarNombreClienteDialogo = new JTextField();
        valorEditarNombreClienteDialogo.setText(productoActual.getNombre());
        panelDialogo.add(valorEditarNombreClienteDialogo, c);

        final JTextField valorEditarUnidadesProductoDialogo = new JTextField();
        valorEditarUnidadesProductoDialogo.setText(String.valueOf(productoActual.getUnidadesDisponibles()));
        panelDialogo.add(valorEditarUnidadesProductoDialogo, c);

        c.gridx = 2;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 15, 10, 0);
        JLabel editarTelefonoClienteDialogo = new JLabel("Precio");
        panelDialogo.add(editarTelefonoClienteDialogo, c);

        c.gridx = 3;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 0, 10, 0);

        c.gridx = 0;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 5, 10, 0);
        JLabel editarCelularClienteDialogo = new JLabel("Descripcion:");
        panelDialogo.add(editarCelularClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);

        final JTextField valorEditarDescripcionProductoDialogo = new JTextField();
        valorEditarDescripcionProductoDialogo.setText(productoActual.getDescripcion());
        panelDialogo.add(valorEditarDescripcionProductoDialogo, c);
        c.gridx = 2;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 5, 10, 0);
        JLabel editarMontoClienteDialogo = new JLabel("Unidades");
        panelDialogo.add(editarMontoClienteDialogo, c);

        c.gridx = 3;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);

        final JTextField valorEditarPrecioProductoDialogo = new JTextField();
        valorEditarPrecioProductoDialogo.setText(productoActual.getPrecio() + "");
        panelDialogo.add(valorEditarPrecioProductoDialogo, c);

        c.gridx = 0;
        c.gridy = 3;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 5, 10, 0);
        JLabel editarCodigoBarrasProyecto = new JLabel("Cdigo de barras:");
        panelDialogo.add(editarCodigoBarrasProyecto, c);

        c.gridx = 1;
        c.gridy = 3;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);

        final JTextField valorCodigoDeBarras = new JTextField();
        valorCodigoDeBarras.setText(productoActual.getCodigoBarras());
        panelDialogo.add(valorCodigoDeBarras, c);

        c.gridx = 0;
        c.gridy = 4;
        c.gridwidth = 2;
        c.ipadx = 100;
        c.insets = new Insets(15, 40, 0, 0);
        JButton botonGuardarProductoDialogo = new JButton("Guardar");
        panelDialogo.add(botonGuardarProductoDialogo, c);

        c.gridx = 2;
        c.gridy = 4;
        c.gridwidth = 2;
        c.insets = new Insets(15, 40, 0, 0);
        c.ipadx = 100;

        JButton botonCerrarProductoDialogo = new JButton("Cancelar");
        panelDialogo.add(botonCerrarProductoDialogo, c);

        dialogoEditar.add(panelDialogo);

        botonCerrarProductoDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialogoEditar.dispose();
            }
        });

        botonGuardarProductoDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                try {

                    String[] selection = { "nombre", "descripcion", "unidades", "precio", "codigoBarras" };
                    String[] value = { valorEditarNombreClienteDialogo.getText(),
                            valorEditarDescripcionProductoDialogo.getText(),
                            valorEditarUnidadesProductoDialogo.getText(),
                            valorEditarPrecioProductoDialogo.getText(), valorCodigoDeBarras.getText() };
                    String[] type_value = { "varchar", "varchar", "int", "double", "varchar" };
                    String restriction = " where producto_id = " + identificacion;
                    controladorP.updateProduct(selection, value, type_value, restriction);
                    JOptionPane.showMessageDialog(dialogoEditar, "Se ha editado el producto xitosamente");
                    dialogoEditar.dispose();

                    //Refrescar busqueda actual
                    jButton2ActionPerformed(null);

                } catch (Exception event) {

                    JOptionPane.showMessageDialog(dialogoEditar, "El valor del monto debe ser numrico");

                }

            }
        });

        dialogoEditar.setVisible(true);
    }//GEN-LAST:event_TablaDeProductosMouseClicked

    private void botonBuscarClienteCrearFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBuscarClienteCrearFacturaActionPerformed

        String nombre = nombreClienteCrearFactura.getText();
        String identificacion = IdentificacionClienteBuscarFactura.getText();

        ControladorCliente controladorCliente = new ControladorCliente();

        try {
            int id = 0;
            if (!identificacion.equals("")) {
                id = Integer.parseInt(identificacion);
            }

            ArrayList<Cliente> listaClientes = controladorCliente.obtenerClientes(nombre, id);

            if (listaClientes.isEmpty()) {
                mensajesBusquedaClientesFactura.setText("La busqueda no arrojo resultados");
                return;
            }

            final JDialog dialogoEditar = new JDialog(this);
            dialogoEditar.setTitle("Buscar clientes");
            dialogoEditar.setSize(600, 310);
            dialogoEditar.setResizable(false);

            JPanel panelDialogo = new JPanel();

            panelDialogo.setLayout(new GridBagLayout());

            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;

            JLabel editarTextoPrincipalDialogo = new JLabel("Buscar Cliente");
            c.gridx = 0;
            c.gridy = 0;
            c.gridwidth = 4;
            c.insets = new Insets(15, 200, 40, 0);
            c.ipadx = 100;
            Font textoGrande = new Font("Arial", 1, 18);
            editarTextoPrincipalDialogo.setFont(textoGrande);
            panelDialogo.add(editarTextoPrincipalDialogo, c);

            /*Vector col = new Vector();
             col.add("1");
             col.add("2");
             col.add("3");
             col.add("4");
             Vector row = new Vector();
                
             for (int i = 0; i < listaClientes.size(); i++) {
             Cliente cliente = listaClientes.get(i);
             Vector temp = new Vector();
             temp.add((i + 1) + "");
             temp.add(cliente.getNombre());
             temp.add(cliente.getCliente_id() + "");
             temp.add(cliente.getMonto_prestamo() + "");
             System.out.println("info" + cliente.getNombre() + "," + cliente.getMonto_prestamo());
             row.add(temp);
             }
                
             final JTable table = new JTable(row, col);         */
            final JTable table = new JTable();
            DefaultTableModel modeloTabla = new DefaultTableModel() {

                @Override
                public boolean isCellEditable(int row, int column) {
                    //all cells false
                    return false;
                }
            };
            ;

            modeloTabla.addColumn("Numero");
            modeloTabla.addColumn("Identificacin");
            modeloTabla.addColumn("Nombre");
            modeloTabla.addColumn("Monto Prestamo");

            //LLenar tabla
            for (int i = 0; i < listaClientes.size(); i++) {
                Object[] data = { "1", "2", "3", "4" };
                data[0] = (i + 1);
                data[1] = listaClientes.get(i).getCliente_id();
                data[2] = listaClientes.get(i).getNombre();
                data[3] = listaClientes.get(i).getMonto_prestamo();

                modeloTabla.addRow(data);
            }

            table.setModel(modeloTabla);
            table.getColumn("Numero").setMinWidth(50);
            table.getColumn("Identificacin").setMinWidth(50);
            table.getColumn("Nombre").setMinWidth(110);
            table.getColumn("Monto Prestamo").setMinWidth(110);

            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            JScrollPane scroll = new JScrollPane(table);
            scroll.setPreferredSize(new Dimension(320, 150));

            table.addMouseListener(new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
                    jTextField_Factura_Cliente_Id.setText(table.getValueAt(table.getSelectedRow(), 1).toString());
                    String identificacion = table.getValueAt(table.getSelectedRow(), 3).toString();
                    ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();

                    //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506);
                    ArrayList<String[]> flujosCliente = controladorFlujoFactura.getTodosFlujo_Factura(
                            " where factura_id in (select factura_id from Factura where cliente_id = "
                                    + String.valueOf(identificacion)
                                    + " and estado=\"fiado\") order by factura_id");
                    double pago = 0.0;

                    for (int i = 0; i < flujosCliente.size(); i++) {
                        String[] datos = flujosCliente.get(i);
                        Object[] rowData = { datos[1], datos[2], datos[3], datos[4] };

                        if (datos[2].equals("deuda")) {
                            pago += Double.parseDouble(datos[4]);
                        } else {
                            pago -= Double.parseDouble(datos[4]);
                        }

                    }
                    nombreClienteCrearFactura.setText(table.getValueAt(table.getSelectedRow(), 2).toString());
                    IdentificacionClienteBuscarFactura
                            .setText(table.getValueAt(table.getSelectedRow(), 1).toString());
                    double montoPrestamo = Double
                            .parseDouble(table.getValueAt(table.getSelectedRow(), 3).toString());
                    Double totalDisponible = montoPrestamo - pago;
                    valorActualPrestamo.setText(String.valueOf(totalDisponible));
                    //System.out.println(table.getValueAt(table.getSelectedRow(), 3).toString());
                    botonAgregarProducto.setEnabled(true);
                    botonGuardarFactura.setEnabled(true);
                    botonEstablecerMontoFactura.setEnabled(true);
                    dialogoEditar.dispose();
                }
            });

            c.insets = new Insets(0, 5, 10, 0);
            c.gridx = 0;
            c.gridy = 1;
            c.gridwidth = 1;
            c.ipadx = 200;

            //panelDialogo.add(table, c);
            panelDialogo.add(scroll, c);
            dialogoEditar.add(panelDialogo);
            dialogoEditar.setVisible(true);
        } catch (Exception e) {
            mensajesBusquedaClientesFactura.setText("La identificacion debe ser un numero");

        }

    }//GEN-LAST:event_botonBuscarClienteCrearFacturaActionPerformed

    private void TablaDeFacturaProductoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeFacturaProductoMouseClicked
        final int fila = TablaDeFacturaProducto.getSelectedRow();
        final DefaultTableModel modeloTabla = (DefaultTableModel) TablaDeFacturaProducto.getModel();

        //int identificacion = (int) TablaDeFacturaProducto.getValueAt(fila, 0);        // TODO add your handling code here:
        final JDialog dialogoEdicionProducto = new JDialog(this);
        dialogoEdicionProducto.setTitle("Editar producto");
        dialogoEdicionProducto.setSize(250, 150);
        dialogoEdicionProducto.setResizable(false);

        JPanel panelDialogo = new JPanel();

        panelDialogo.setLayout(new GridBagLayout());

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;

        JLabel editarTextoPrincipalDialogo = new JLabel("Editar producto");
        c.gridx = 0;
        c.gridy = 0;
        c.gridwidth = 3;
        c.insets = new Insets(15, 40, 10, 0);
        Font textoGrande = new Font("Arial", 1, 18);
        editarTextoPrincipalDialogo.setFont(textoGrande);
        panelDialogo.add(editarTextoPrincipalDialogo, c);

        c.insets = new Insets(0, 0, 0, 0);
        c.gridwidth = 0;

        c.gridy = 1;
        c.gridx = 0;
        JLabel textoUnidades = new JLabel("Unidades");
        panelDialogo.add(textoUnidades, c);

        c.gridy = 1;
        c.gridx = 1;
        c.gridwidth = 2;
        final JTextField valorUnidades = new JTextField();
        valorUnidades.setText(String.valueOf(modeloTabla.getValueAt(fila, 4)));

        panelDialogo.add(valorUnidades, c);

        c.gridwidth = 1;
        c.gridy = 2;
        c.gridx = 0;
        JButton guardarCambios = new JButton("Guardar");
        panelDialogo.add(guardarCambios, c);

        c.gridy = 2;
        c.gridx = 1;
        JButton eliminarProducto = new JButton("Eliminar");
        panelDialogo.add(eliminarProducto, c);

        c.gridy = 2;
        c.gridx = 2;
        JButton botonCancelar = new JButton("Cerrar");
        panelDialogo.add(botonCancelar, c);
        botonCancelar.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialogoEdicionProducto.dispose();
            }
        });

        eliminarProducto.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                double precio = (double) modeloTabla.getValueAt(fila, 6);
                double precioActual = Double.parseDouble(valorActualFactura.getText());

                precioActual -= precio;
                valorActualFactura.setText(String.valueOf(precioActual));
                modeloTabla.removeRow(fila);

                dialogoEdicionProducto.dispose();

            }
        });
        guardarCambios.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    int numeroUnidades = Integer.parseInt(valorUnidades.getText());
                    modeloTabla.setValueAt(numeroUnidades, fila, 4);

                    double precioARestar = (double) modeloTabla.getValueAt(fila, 6);

                    double valorUnitario = Double.parseDouble((String) modeloTabla.getValueAt(fila, 5));

                    double precioNuevo = valorUnitario * numeroUnidades;

                    modeloTabla.setValueAt(precioNuevo, fila, 6);
                    double precioActual = Double.parseDouble(valorActualFactura.getText());
                    precioActual -= precioARestar;
                    precioActual += precioNuevo;
                    valorActualFactura.setText(String.valueOf(precioActual));

                    dialogoEdicionProducto.dispose();

                } catch (Exception eve) {
                    JOptionPane.showMessageDialog(dialogoEdicionProducto, "Por favor ingrese un valor numrico");
                }
            }
        });

        dialogoEdicionProducto.add(panelDialogo);
        dialogoEdicionProducto.setVisible(true);
    }//GEN-LAST:event_TablaDeFacturaProductoMouseClicked

    private void botonAgregarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAgregarProductoActionPerformed
        String nombre = jTextField_Factura_Producto_Nombre.getText();
        String descripcion = jTextField_Factura_Producto_Descripcion.getText();
        ControladorProducto controladorPro = new ControladorProducto();
        String restriccion = "";

        boolean encounter = true;

        if (!nombre.equals("")) {
            if (encounter) {
                encounter = false;
                restriccion = " where ";
            } else {
                restriccion += " OR ";
            }

            restriccion += " nombre like '%" + nombre + "%'";
        }

        if (!descripcion.equals("")) {
            if (encounter) {
                encounter = false;
                restriccion = " where ";
            } else {
                restriccion += " OR ";
            }

            restriccion += " descripcion like '%" + descripcion + "%'";
        }

        ArrayList<Productos> listaDeProductos = controladorPro.getProducto(restriccion);

        final JDialog dialogoEditar = new JDialog(this);
        dialogoEditar.setTitle("Buscar clientes");
        dialogoEditar.setSize(600, 310);
        dialogoEditar.setResizable(false);

        JPanel panelDialogo = new JPanel();

        panelDialogo.setLayout(new GridBagLayout());

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;

        JLabel editarTextoPrincipalDialogo = new JLabel("Buscar Producto");
        c.gridx = 0;
        c.gridy = 0;
        c.gridwidth = 6;
        c.insets = new Insets(15, 200, 40, 0);
        c.ipadx = 100;
        Font textoGrande = new Font("Arial", 1, 18);
        editarTextoPrincipalDialogo.setFont(textoGrande);
        panelDialogo.add(editarTextoPrincipalDialogo, c);

        final JTable table = new JTable();
        DefaultTableModel modeloTabla = new DefaultTableModel() {

            @Override
            public boolean isCellEditable(int row, int column) {
                //all cells false
                return false;
            }
        };
        ;

        modeloTabla.addColumn("Numero");
        modeloTabla.addColumn("Identificacin");
        modeloTabla.addColumn("Nombre");
        modeloTabla.addColumn("Descripcion");
        modeloTabla.addColumn("Unidades Disponibles");
        modeloTabla.addColumn("Precio");

        //LLenar tabla
        for (int i = 0; i < listaDeProductos.size(); i++) {
            Object[] data = { "1", "2", "3", "4", "5", "6" };
            data[0] = (i + 1);
            data[1] = listaDeProductos.get(i).getProductoId();
            data[2] = listaDeProductos.get(i).getNombre();
            data[3] = listaDeProductos.get(i).getDescripcion();
            data[4] = listaDeProductos.get(i).getUnidadesDisponibles();
            data[5] = listaDeProductos.get(i).getPrecio();

            modeloTabla.addRow(data);
        }

        table.setModel(modeloTabla);
        table.getColumn("Numero").setMinWidth(50);
        table.getColumn("Identificacin").setMinWidth(50);
        table.getColumn("Nombre").setMinWidth(110);
        table.getColumn("Descripcion").setMinWidth(110);
        table.getColumn("Unidades Disponibles").setMinWidth(40);
        table.getColumn("Precio").setMinWidth(110);

        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane scroll = new JScrollPane(table);
        scroll.setPreferredSize(new Dimension(320, 150));

        //final JTable table = new JTable(row, col);       
        table.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                //jTextField_Factura_Cliente_Id.setText(table.getValueAt(table.getSelectedRow(), 1).toString());
                //System.out.println(table.getValueAt(table.getSelectedRow(), 3).toString());
                DefaultTableModel modelo = (DefaultTableModel) TablaDeFacturaProducto.getModel();

                Object[] fila = new Object[7];

                fila[0] = table.getValueAt(table.getSelectedRow(), 0).toString();
                fila[1] = table.getValueAt(table.getSelectedRow(), 1).toString();
                fila[2] = table.getValueAt(table.getSelectedRow(), 2).toString();
                fila[3] = table.getValueAt(table.getSelectedRow(), 3).toString();
                //fila[4] = table.getValueAt(table.getSelectedRow(), 4).toString();
                fila[4] = (String) JOptionPane.showInputDialog("Ingrese el nmero de unidades que va a vender");
                fila[5] = table.getValueAt(table.getSelectedRow(), 5).toString();

                Double valorProducto = Double.parseDouble((String) fila[5]);
                String valorActualProducto = String.valueOf(Double.parseDouble(valorActualFactura.getText())
                        + Double.parseDouble((String) fila[4]) * valorProducto);
                valorActualFactura.setText(valorActualProducto);
                fila[6] = Double.parseDouble((String) fila[4]) * valorProducto;
                modelo.addRow(fila);
                //modelo.getColumnName(4).
                /*TablaDeFacturaProducto.setModel(modelo);
                 TablaDeFacturaProducto.getColumnClass(4). ;*/
                dialogoEditar.dispose();
            }
        });

        c.insets = new Insets(0, 5, 10, 0);
        c.gridx = 0;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 200;

        panelDialogo.add(scroll, c);

        //panelDialogo.add(table, c);
        dialogoEditar.add(panelDialogo);
        dialogoEditar.setVisible(true);

    }//GEN-LAST:event_botonAgregarProductoActionPerformed

    private void sliderNumeroUnidadesStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderNumeroUnidadesStateChanged
        // TODO add your handling code here:
        int valorActual = sliderNumeroUnidades.getValue();
        jTextField_Producto_CP_unidades.setText(String.valueOf(valorActual));
    }//GEN-LAST:event_sliderNumeroUnidadesStateChanged

    private void botonGuardarFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarFacturaActionPerformed
        // TODO add your handling code here:

        String id_cliente = jTextField_Factura_Cliente_Id.getText();

        if (id_cliente.equals("") || valorActualFactura.equals("0.0")) {
            JOptionPane.showMessageDialog(this,
                    "Por favor indique el monto de la factura o ingrese los productos a ella");

        } else {
            //System.err.println("Numero de filas" + TablaDeFacturaProducto.getRowCount());
            ArrayList<String> lineaCodigoProductos = new ArrayList<String>();
            ArrayList<String> lineaUnidadesProductos = new ArrayList<String>();
            ArrayList<String> lineaMontoProductos = new ArrayList<String>();
            double monto = 0d;
            try {
                double pago = Double.parseDouble(
                        (String) JOptionPane.showInputDialog("Ingrese por favor el monto pagado por el cliente"));
                while (pago < 0.0) {
                    pago = Double.parseDouble((String) JOptionPane.showInputDialog(
                            "El pago debe ser positivo \nIngrese por favor el monto pagado por el cliente"));

                }

                double prestamo = Double.parseDouble(valorActualPrestamo.getText());
                double montoFactura = Double.parseDouble(valorActualFactura.getText());
                while (montoFactura - pago < 0.0) {
                    pago = Double.parseDouble((String) JOptionPane.showInputDialog(
                            "El pago no debe ser superior al monto de la factura \nIngrese por favor el monto pagado por el cliente"));

                }
                if (prestamo - montoFactura <= 0.0) {
                    int opcion = JOptionPane.showConfirmDialog(this,
                            "Con este prstamo el cliente excede su limite de prestamos. \n Desea continuar?",
                            "Mensaje del sistema", JOptionPane.YES_NO_OPTION);
                    if (opcion != JOptionPane.YES_OPTION) {
                        return;
                    }

                }

                for (int i = 0; i < TablaDeFacturaProducto.getRowCount(); i++) {
                    /*
                     * Fila 0: ID producto
                     * Fila 4: Cantidad
                     */
                    String ProductoId = String.valueOf(TablaDeFacturaProducto.getValueAt(i, 0));
                    lineaCodigoProductos.add(ProductoId);

                    int numeroUnidades = Integer.parseInt(String.valueOf(TablaDeFacturaProducto.getValueAt(i, 4)));

                    String unidades = String.valueOf(numeroUnidades);
                    lineaUnidadesProductos.add(unidades);

                    double valorUnitario = Double
                            .parseDouble(String.valueOf(TablaDeFacturaProducto.getValueAt(i, 5)));
                    double valorProductoTotal = numeroUnidades * valorUnitario;
                    lineaMontoProductos.add(String.valueOf(valorProductoTotal));

                    monto += valorProductoTotal;
                }

                if (TablaDeFacturaProducto.getRowCount() == 0) {
                    monto = Double.parseDouble(valorActualFactura.getText());
                }

                String estado = "";
                if (monto == pago) {
                    estado = "pagado";
                } else {
                    estado = "fiado";
                }

                ControladorFactura controladorFactura = new ControladorFactura();
                //String[] selection = {"cliente_id", "fecha", "estado", "identificacionCliente"};
                Calendar calendario = Calendar.getInstance();
                String dia = Integer.toString(calendario.get(Calendar.DATE));
                String mes = Integer.toString(calendario.get(Calendar.MONTH)) + 1;
                String annio = Integer.toString(calendario.get(Calendar.YEAR));
                Date date = new Date();
                DateFormat hourFormat = new SimpleDateFormat("HH:mm:ss");
                String hora = hourFormat.format(date);

                String fecha = annio + "-" + mes + "-" + dia + " " + hora;
                String[] selection = { id_cliente, fecha, estado, String.valueOf(monto) };
                ArrayList<String[]> facturaActual = controladorFactura.insertFactura(selection);

                //Ingresar productos
                if (TablaDeFacturaProducto.getRowCount() > 0) {
                    ControladorFactura_Productos controladorFactura_Productos = new ControladorFactura_Productos();
                    for (int i = 0; i < lineaCodigoProductos.size(); i++) {
                        //        String [] selection = {"factura_id","producto_id","unidades","precio"};
                        String[] insertarLineaProducto = { facturaActual.get(0)[0], lineaCodigoProductos.get(i),
                                lineaUnidadesProductos.get(i), lineaMontoProductos.get(i) };
                        controladorFactura_Productos.insertFactura_Productos(insertarLineaProducto);
                    }
                }
                //Ingresar flujo factura
                ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();
                // String [] selection = {"factura_id","tipo_flujo","fecha","identificacionCliente"};

                String value[] = { facturaActual.get(0)[0], "abono", fecha, String.valueOf(pago) };
                controladorFlujoFactura.insertFlujo_Factura(value);

                String value2[] = { facturaActual.get(0)[0], "deuda", fecha, String.valueOf(monto) };
                controladorFlujoFactura.insertFlujo_Factura(value2);

                botonEstablecerMontoFactura.setEnabled(false);
                botonAgregarProducto.setEnabled(false);
                botonGuardarFactura.setEnabled(false);
                jTextField_Factura_Cliente_Id.setText("");

                DefaultTableModel modeloTabla = (DefaultTableModel) TablaDeFacturaProducto.getModel();

                for (int i = 0; i < modeloTabla.getRowCount(); i++) {
                    modeloTabla.removeRow(i);
                }

                modeloTabla.setRowCount(0);
                TablaDeFacturaProducto.setModel(modeloTabla);

                Object opciones[] = { "Cerrar", "Imprimir", "Guardar en disco" };
                GenerarFactura generarFactura = new GenerarFactura();
                int opcion = JOptionPane.showOptionDialog(this,
                        "Se ha guardado la factura con xito\nQue desea hacer?", "Elija una opcin",
                        JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, null);

                switch (opcion) {
                case 1:
                    generarFactura.imprimirFactura(Integer.parseInt(facturaActual.get(0)[0]), this);
                    break;
                case 2:
                    PDDocument documento = generarFactura.crearFactura(Integer.parseInt(facturaActual.get(0)[0]),
                            this);
                    JFileChooser fc = new JFileChooser();
                    FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivo PDF", "pdf", "text");
                    fc.setFileFilter(filter);
                    fc.showSaveDialog(this);
                    if (fc.getSelectedFile() != null) {
                        File selectedFile = fc.getSelectedFile();
                        try {

                            documento.save(selectedFile + ".pdf");
                            JOptionPane.showMessageDialog(this, "El archivo ha sido guardado en disco");

                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(this, "EL Archivo no se puede leer!");
                        }
                    }
                    break;

                default:
                    break;
                }

                nombreClienteCrearFactura.setText("");
                IdentificacionClienteBuscarFactura.setText("");
                valorActualPrestamo.setText("");
                jTextField_Factura_Cliente_Id.setText("");
                jTextField_Factura_Producto_Nombre.setText("");
                jTextField_Factura_Producto_Descripcion.setText("");
                valorMontoFactura.setText("");
                valorActualFactura.setText("0.0");
                valorActualPrestamo.setText("0.0");
                botonGuardarFactura.setEnabled(false);
                botonEstablecerMontoFactura.setEnabled(false);
                botonAgregarProducto.setEnabled(false);
            } catch (Exception e) {
            }

        }

    }//GEN-LAST:event_botonGuardarFacturaActionPerformed

    private void BotonBuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonBuscarClienteActionPerformed
        // TODO add your handling code here:
        String nombreCliente = nombreClienteBusqueda.getText();
        String identificacionCliente = identificacionClienteBusqueda.getText();
        int identificacionClienteInt = 0;
        try {
            if (!identificacionCliente.equals("")) {
                identificacionClienteInt = Integer.parseInt(identificacionCliente);
            }

            ControladorCliente controladorCliente = new ControladorCliente();

            ArrayList<Cliente> listaDeClientes = controladorCliente.obtenerClientes(nombreCliente,
                    identificacionClienteInt);

            //Agregar filas
            DefaultTableModel modelo = (DefaultTableModel) TablaDeClientes.getModel();

            for (int i = 0; i < modelo.getRowCount(); i++) {
                modelo.removeRow(i);
            }
            modelo.setRowCount(0);
            for (int i = 0; i < listaDeClientes.size(); i++) {
                Cliente cliente = listaDeClientes.get(i);
                Object[] fila = new Object[4];
                fila[0] = cliente.getCliente_id();
                fila[1] = cliente.getNombre();

                Double montoAPrestar = cliente.getMonto_prestamo();
                NumberFormat formatter = new DecimalFormat("#0");
                fila[2] = formatter.format(montoAPrestar);

                fila[3] = "Editar";
                modelo.addRow(fila);

            }

            TablaDeClientes.setModel(modelo);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this,
                    "La identificacin debe ser numrica, por favor ingrese correctamente el dato", "Error",
                    JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_BotonBuscarClienteActionPerformed

    private void TablaDeClientesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeClientesMouseClicked
        // TODO add your handling code here:
        int fila = TablaDeClientes.getSelectedRow();
        int identificacion = (int) TablaDeClientes.getValueAt(fila, 0);

        final ControladorCliente controladorCliente = new ControladorCliente();
        ArrayList<Cliente> listaClientes = controladorCliente.obtenerClientes("", identificacion);
        final Cliente clienteActual = listaClientes.get(0);

        final JDialog dialogoEditar = new JDialog(this);

        dialogoEditar.setTitle("Editar clientes");
        dialogoEditar.setSize(600, 310);
        dialogoEditar.setResizable(false);

        JPanel panelDialogo = new JPanel();

        panelDialogo.setLayout(new GridBagLayout());

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;

        JLabel editarTextoPrincipalDialogo = new JLabel("Editar clientes");
        c.gridx = 0;
        c.gridy = 0;
        c.gridwidth = 4;
        c.insets = new Insets(15, 200, 40, 0);
        c.ipadx = 100;
        Font textoGrande = new Font("Arial", 1, 18);
        editarTextoPrincipalDialogo.setFont(textoGrande);
        panelDialogo.add(editarTextoPrincipalDialogo, c);

        c.insets = new Insets(0, 5, 10, 0);
        c.gridx = 0;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 40;
        JLabel editarNombreClienteDialogo = new JLabel("Nombre:");
        panelDialogo.add(editarNombreClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);
        final JTextField valorEditarNombreClienteDialogo = new JTextField();
        valorEditarNombreClienteDialogo.setText(clienteActual.getNombre());
        panelDialogo.add(valorEditarNombreClienteDialogo, c);

        c.gridx = 0;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 5, 10, 0);
        JLabel editarCelularClienteDialogo = new JLabel("Celular:");
        panelDialogo.add(editarCelularClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);

        final JTextField valorEditarCelularClienteDialogo = new JTextField();
        valorEditarCelularClienteDialogo.setText(clienteActual.getNumero_celular());
        panelDialogo.add(valorEditarCelularClienteDialogo, c);
        c.gridx = 2;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 5, 10, 0);
        JLabel editarMontoClienteDialogo = new JLabel("Monto a prestar:");
        panelDialogo.add(editarMontoClienteDialogo, c);

        c.gridx = 3;
        c.gridy = 2;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 15, 10, 15);
        final JTextField valorEditarMontoClienteDialogo = new JTextField();
        valorEditarMontoClienteDialogo.setText(String.valueOf(clienteActual.getMonto_prestamo()));
        panelDialogo.add(valorEditarMontoClienteDialogo, c);

        c.gridx = 2;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 15, 10, 0);
        JLabel editarTelefonoClienteDialogo = new JLabel("Telefono:");
        panelDialogo.add(editarTelefonoClienteDialogo, c);

        c.gridx = 3;
        c.gridy = 1;
        c.gridwidth = 1;
        c.ipadx = 100;
        c.insets = new Insets(0, 0, 10, 0);
        final JTextField valorEditarTelefonoClienteDialogo = new JTextField();
        valorEditarTelefonoClienteDialogo.setText(clienteActual.getNumero_telefono());
        panelDialogo.add(valorEditarTelefonoClienteDialogo, c);

        c.gridx = 0;
        c.gridy = 3;
        c.gridwidth = 1;
        c.ipadx = 40;
        c.insets = new Insets(0, 0, 10, 0);

        JLabel editarAddressClienteDialogo = new JLabel("Direccin:");
        panelDialogo.add(editarAddressClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 3;
        c.gridwidth = 3;
        c.ipadx = 400;
        c.insets = new Insets(0, 15, 10, 0);
        final JTextField valorEditarAddressClienteDialogo = new JTextField();
        valorEditarAddressClienteDialogo.setText(clienteActual.getDireccion());
        panelDialogo.add(valorEditarAddressClienteDialogo, c);

        c.gridx = 0;
        c.gridy = 4;
        c.gridwidth = 2;
        c.ipadx = 100;
        c.insets = new Insets(15, 40, 0, 0);
        JButton botonGuardarClienteDialogo = new JButton("Guardar");
        panelDialogo.add(botonGuardarClienteDialogo, c);

        c.gridx = 2;
        c.gridy = 4;
        c.gridwidth = 2;
        c.insets = new Insets(15, 40, 0, 0);
        c.ipadx = 100;

        JButton botonCerrarClienteDialogo = new JButton("Cancelar");
        panelDialogo.add(botonCerrarClienteDialogo, c);

        dialogoEditar.add(panelDialogo);

        botonCerrarClienteDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialogoEditar.dispose();
            }
        });

        botonGuardarClienteDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {

                try {
                    clienteActual.setDireccion(valorEditarAddressClienteDialogo.getText());
                    clienteActual.setMonto_prestamo(Double.parseDouble(valorEditarMontoClienteDialogo.getText()));
                    clienteActual.setNombre(valorEditarNombreClienteDialogo.getText());
                    clienteActual.setNumero_celular(valorEditarCelularClienteDialogo.getText());
                    clienteActual.setNumero_telefono(valorEditarTelefonoClienteDialogo.getText());

                    controladorCliente.editarCliente(clienteActual);
                    JOptionPane.showMessageDialog(dialogoEditar, "Se ha editado el cliente xitosamente");
                    dialogoEditar.dispose();

                    //Refrescar busqueda actual
                    String nombreCliente = nombreClienteBusqueda.getText();

                    int identificacionClienteInt = 0;

                    ControladorCliente controladorCliente = new ControladorCliente();

                    ArrayList<Cliente> listaDeClientes = controladorCliente.obtenerClientes(nombreCliente,
                            identificacionClienteInt);

                    //Agregar filas
                    DefaultTableModel modelo = (DefaultTableModel) TablaDeClientes.getModel();

                    for (int i = 0; i < modelo.getRowCount(); i++) {
                        modelo.removeRow(i);
                    }
                    modelo.setRowCount(0);
                    for (int i = 0; i < listaDeClientes.size(); i++) {
                        Cliente cliente = listaDeClientes.get(i);
                        Object[] fila = new Object[4];
                        fila[0] = cliente.getCliente_id();
                        fila[1] = cliente.getNombre();
                        fila[2] = cliente.getMonto_prestamo();
                        //button.setText("<HTML>Click the <FONT color=\"#000099\"><U>link "+i+"</U></FONT>"+ " to go to the Java website.</HTML>");

                        fila[3] = "Editar";
                        modelo.addRow(fila);

                    }

                    TablaDeClientes.setModel(modelo);

                } catch (Exception event) {

                    JOptionPane.showMessageDialog(dialogoEditar, "El valor del monto debe ser numrico");

                }

            }
        });

        dialogoEditar.setVisible(true);
        /*Action mostrarMensaje;
         mostrarMensaje = new AbstractAction() {
         @Override
         public void actionPerformed(ActionEvent e) {
         JTable table = (JTable) e.getSource();
         int modelRow = Integer.valueOf(e.getActionCommand());
         ((DefaultTableModel) table.getModel()).removeRow(modelRow);
         }
         };
         ButtonColumn buttonColumn = new ButtonColumn(TablaDeClientes, mostrarMensaje, 3);
         buttonColumn.setMnemonic(KeyEvent.VK_E);*/
    }//GEN-LAST:event_TablaDeClientesMouseClicked

    private void nombreNuevoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nombreNuevoClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_nombreNuevoClienteActionPerformed

    private void botonAgregarNuevoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAgregarNuevoClienteActionPerformed
        // TODO add your handling code here:        
        String nombreEnviarNuevoCliente = nombreNuevoCliente.getText();
        String telefonoEnviarNuevoCliente = telefonoNuevoCliente.getText();
        String celularEnviarNuevoCliente = celularNuevoCliente.getText();
        String direccionEnviarNuevoCliente = DireccionNuevoCliente.getText();
        String montoAPrestarEnviarNuevoCliente = montoPrestamoNuevoCliente.getText();

        try {
            double montoAPrestarEnviarIntNuevoCliente = Double.parseDouble(montoAPrestarEnviarNuevoCliente);
            ControladorCliente controladorCliente = new ControladorCliente();
            controladorCliente.agregarCliente(nombreEnviarNuevoCliente, telefonoEnviarNuevoCliente,
                    celularEnviarNuevoCliente, direccionEnviarNuevoCliente, montoAPrestarEnviarIntNuevoCliente);

            JOptionPane.showMessageDialog(null, "Cliente creado exitosamente");
            nombreNuevoCliente.setText("");
            telefonoNuevoCliente.setText("");
            celularNuevoCliente.setText("");
            DireccionNuevoCliente.setText("");
            montoPrestamoNuevoCliente.setText("");

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this,
                    "La identificacin y el monto deben ser numricos, por favor ingrese correctamente los datos",
                    "Error", JOptionPane.ERROR_MESSAGE);

        }
    }//GEN-LAST:event_botonAgregarNuevoClienteActionPerformed

    private void BotonBuscarClienteSaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonBuscarClienteSaldoActionPerformed
        String nombreCliente = nombreClienteBusquedaSaldo.getText();
        //08-11-2014 listar clientes por nombre
        ControladorCliente controladorCliente = new ControladorCliente();
        ArrayList<Cliente> listaClientes = new ArrayList<>();

        if (nombreCliente.equals("")) {
            listaClientes = controladorCliente.obtenerClientes();
        } else {
            listaClientes = controladorCliente.obtenerClientes(nombreCliente, 0);
        }

        //08-11-2014 Crear dialogo de bsqueda
        final JDialog dialogoEditar = new JDialog(this);

        dialogoEditar.setTitle("Buscar clientes");
        dialogoEditar.setSize(300, 300);
        dialogoEditar.setResizable(false);

        JPanel panelDialogo = new JPanel();

        panelDialogo.setLayout(new GridBagLayout());

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;

        JLabel ediitarTextoPrincipalDialogo = new JLabel("Buscar cliente");
        c.gridx = 0;
        c.gridy = 0;
        c.gridwidth = 2;
        c.insets = new Insets(10, 60, 10, 10);
        Font textoGrande = new Font("Arial", 1, 16);
        ediitarTextoPrincipalDialogo.setFont(textoGrande);
        panelDialogo.add(ediitarTextoPrincipalDialogo, c);

        c.gridx = 0;
        c.gridy = 1;
        c.gridwidth = 2;
        c.insets = new Insets(10, 10, 10, 10);
        final JTable tablaDialogo = new JTable();
        DefaultTableModel modeloTabla = new DefaultTableModel() {

            @Override
            public boolean isCellEditable(int row, int column) {
                //all cells false
                return false;
            }
        };
        ;

        modeloTabla.addColumn("Identificacin");
        modeloTabla.addColumn("Nombre");

        //LLenar tabla
        for (int i = 0; i < listaClientes.size(); i++) {
            Object[] data = { "1", "2" };
            data[0] = listaClientes.get(i).getCliente_id();
            data[1] = listaClientes.get(i).getNombre();
            modeloTabla.addRow(data);
        }

        tablaDialogo.setModel(modeloTabla);
        tablaDialogo.getColumn("Identificacin").setMinWidth(110);
        tablaDialogo.getColumn("Nombre").setMinWidth(110);
        tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane scroll = new JScrollPane(tablaDialogo);
        scroll.setPreferredSize(new Dimension(220, 150));

        panelDialogo.add(scroll, c);

        c.insets = new Insets(0, 0, 0, 10);
        c.gridx = 0;
        c.gridy = 2;
        c.gridwidth = 1;
        JButton botonGuardarClienteDialogo = new JButton("Elegir");
        panelDialogo.add(botonGuardarClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 2;
        c.gridwidth = 1;
        JButton botonCerrarClienteDialogo = new JButton("Cancelar");
        panelDialogo.add(botonCerrarClienteDialogo, c);

        dialogoEditar.add(panelDialogo);
        dialogoEditar.setVisible(true);

        botonCerrarClienteDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialogoEditar.dispose();
            }
        });

        botonGuardarClienteDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                int row = tablaDialogo.getSelectedRow();
                if (row == -1) {
                    JOptionPane.showMessageDialog(dialogoEditar, "Por favor seleccione una fila");

                } else {
                    Object identificacionCliente = tablaDialogo.getValueAt(row, 0);
                    mostrarIdentificacionCliente.setText(String.valueOf(identificacionCliente));
                    String nombreClientePago = String.valueOf(tablaDialogo.getValueAt(row, 1));

                    //Limitar a 15 caracteres
                    if (nombreClientePago.length() >= 15) {
                        nombreClientePago = nombreClientePago.substring(0, 12);

                    }
                    textoPersonaSaldo.setText(nombreClientePago);

                    DefaultTableModel modeloClientes = (DefaultTableModel) TablaDeSaldoClientes.getModel();
                    for (int i = 0; i < modeloClientes.getRowCount(); i++) {
                        modeloClientes.removeRow(i);
                    }

                    modeloClientes.setRowCount(0);
                    ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();

                    //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506);
                    ArrayList<String[]> flujosCliente = controladorFlujoFactura.getTodosFlujo_Factura(
                            " where factura_id in (select factura_id from Factura where cliente_id = "
                                    + String.valueOf(identificacionCliente)
                                    + " and estado=\"fiado\") order by factura_id");
                    double pago = 0.0;

                    for (int i = 0; i < flujosCliente.size(); i++) {
                        String[] datos = flujosCliente.get(i);

                        TablaDeSaldoClientes.setModel(modeloClientes);
                        NumberFormat formatter = new DecimalFormat("#0");

                        String valorMovimiento = String.valueOf(formatter.format(Double.parseDouble(datos[4])));
                        Object[] rowData = { datos[1], datos[2], datos[3], valorMovimiento };

                        if (datos[2].equals("deuda")) {
                            pago += Double.parseDouble(datos[4]);
                        } else {
                            pago -= Double.parseDouble(datos[4]);
                        }

                        modeloClientes.addRow(rowData);
                    }

                    TablaDeSaldoClientes.setModel(modeloClientes);
                    NumberFormat formatter = new DecimalFormat("#0");
                    textoTotalDebe.setText(String.valueOf(formatter.format(pago)));
                    dialogoEditar.dispose();

                    //Mostrar en table de clientes los datos
                    botonRegistrarAbono.setEnabled(true);
                }

            }
        });
    }//GEN-LAST:event_BotonBuscarClienteSaldoActionPerformed

    private void TablaDeSaldoClientesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeSaldoClientesMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_TablaDeSaldoClientesMouseClicked

    private void botonRegistrarAbonoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonRegistrarAbonoActionPerformed
        // TODO add your handling code here:
        try {

            String identificacionCliente = mostrarIdentificacionCliente.getText();
            Double abono = Double.parseDouble(abonoClente.getText());

            if (abono <= 0.0) {
                throw new Exception();
            }

            ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();
            ControladorFactura controladorFactura = new ControladorFactura();

            Calendar calendario = Calendar.getInstance();
            String dia = Integer.toString(calendario.get(Calendar.DATE));
            String mes = Integer.toString(calendario.get(Calendar.MONTH));
            String annio = Integer.toString(calendario.get(Calendar.YEAR));
            Date date = new Date();
            DateFormat hourFormat = new SimpleDateFormat("HH:mm:ss");
            String hora = hourFormat.format(date);

            String fecha = annio + "-" + mes + "-" + dia + " " + hora;
            /*
             * -----------------Tomar el abono y los pagos-----------------
             * Procedimiento
             * 1 Tomar flujos de deuda de cada factura con estado fiado
             * 2 Tomar abonos de abono de cada factura con estado fiado
             * 3 Calcular la resta de estos dos para deteminar lo que se debe por factura
             * 4 Cancelar con el flujo la factura y si lo debido es 0 colocar estado pagado
             * 5 Mostrar una informacin en un JOptionPane y recalcular la deuda
             * 
             */
            DefaultTableModel modeloClientes = (DefaultTableModel) TablaDeSaldoClientes.getModel();
            ArrayList<String> codigoFactura = new ArrayList<>();
            ArrayList<Double> totalDebe = new ArrayList<>();

            JTextArea area = new JTextArea(10, 30);
            String informe = "\t Registro flujo pago del abono \n\n";
            informe += "Factura \t Pago \t Queda pagada? \n\n";

            int numeroRegistros = -1;
            for (int i = 0; i < modeloClientes.getRowCount(); i++) {
                //System.out.println("Entro al for " + i);
                //Se necesita 0: Factura ID, 1 Tipo, 3 Valor
                // Codigofactura contiene los cogidos de las facturas
                // totalDebe contiene lo que debe de las facturas, la posicion coincide con la lista CodigoFactura
                String factura_id = String.valueOf(modeloClientes.getValueAt(i, 0));
                String tipo_flujo = String.valueOf(modeloClientes.getValueAt(i, 1));
                Double valor = Double.parseDouble(String.valueOf(modeloClientes.getValueAt(i, 3)));
                if (codigoFactura.contains(factura_id)) {

                    if (tipo_flujo.equals("abono")) {
                        totalDebe.set(numeroRegistros, totalDebe.get(numeroRegistros) - valor);
                    } else {
                        totalDebe.set(numeroRegistros, totalDebe.get(numeroRegistros) + valor);
                    }
                } else {
                    numeroRegistros++;
                    codigoFactura.add(factura_id);
                    if (tipo_flujo.equals("abono")) {
                        totalDebe.add(-valor);
                    } else {
                        totalDebe.add(valor);
                    }
                }

            }
            //System.out.println(Arrays.toString(codigoFactura.toArray()));
            //System.out.println(Arrays.toString(totalDebe.toArray()));
            Double debeTotal = 0d;
            for (int i = 0; i < totalDebe.size(); i++) {
                debeTotal += totalDebe.get(i);

            }

            if (debeTotal < abono) {
                JOptionPane.showMessageDialog(this,
                        "El monto es superior a lo que debe el cliente, por favor indique otro monto", "Error",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }

            for (int i = 0; i < totalDebe.size(); i++) {
                //Tomar flujos
                if (abono > 0.0) {
                    Double pago = totalDebe.get(i) - abono;

                    //Pago igual a 0 significa que se pag la factura
                    if (pago == 0) {
                        //Registrar flujo
                        String[] value = { codigoFactura.get(i), "abono", fecha, String.valueOf(abono) };
                        //String [] selection = {"factura_id","tipo_flujo","fecha","valor"};
                        controladorFlujoFactura.insertFlujo_Factura(value);

                        controladorFactura.cambiarEstadoFactura(codigoFactura.get(i), "pagada");
                        informe += codigoFactura.get(i) + "\t" + String.valueOf(abono) + "\tSI\n";
                        //Romper el for
                        break;
                    } else {

                        //Pago mayor que 0, es decir se queda debiendo
                        if (pago > 0) {

                            //Registrar flujo
                            String[] value = { codigoFactura.get(i), "abono", fecha, String.valueOf(abono) };
                            //String [] selection = {"factura_id","tipo_flujo","fecha","valor"};
                            controladorFlujoFactura.insertFlujo_Factura(value);
                            //Como el abono ahora es menor que 0 debe romperse el for
                            informe += codigoFactura.get(i) + "\t" + String.valueOf(abono) + "\tNO\n";

                            break;

                        } else {
                            //Caso final pago menor 0, es decir el abono paga la factura pero queda disponible para otras facturas
                            //Registrar flujo
                            String[] value = { codigoFactura.get(i), "abono", fecha,
                                    String.valueOf(totalDebe.get(i)) };
                            //String [] selection = {"factura_id","tipo_flujo","fecha","valor"};
                            controladorFlujoFactura.insertFlujo_Factura(value);

                            controladorFactura.cambiarEstadoFactura(codigoFactura.get(i), "pagada");

                            //Ajustamos ahora el abono restando lo que debe la factura
                            informe += codigoFactura.get(i) + "\t" + String.valueOf(abono) + "\tSI\n";
                            abono -= totalDebe.get(i);
                        }

                    }
                } else {
                    //Romper el for
                    break;
                }

            }

            //Reordenar y volver a consultar
            for (int i = 0; i < modeloClientes.getRowCount(); i++) {
                modeloClientes.removeRow(i);
            }

            modeloClientes.setRowCount(0);

            //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506);
            ArrayList<String[]> flujosCliente = controladorFlujoFactura.getTodosFlujo_Factura(
                    " where factura_id in (select factura_id from Factura where cliente_id = "
                            + String.valueOf(identificacionCliente) + " and estado=\"fiado\") order by factura_id");
            double pago = 0.0;

            for (int i = 0; i < flujosCliente.size(); i++) {
                String[] datos = flujosCliente.get(i);
                Object[] rowData = { datos[1], datos[2], datos[3], datos[4] };
                modeloClientes.addRow(rowData);
                if (datos[2].equals("deuda")) {
                    pago += Double.parseDouble(datos[4]);
                } else {
                    pago -= Double.parseDouble(datos[4]);
                }
            }

            textoTotalDebe.setText(String.valueOf(pago));
            TablaDeSaldoClientes.setModel(modeloClientes);
            area.setText(informe);
            JScrollPane panelInformePago = new JScrollPane(area);
            JOptionPane.showMessageDialog(this, panelInformePago);

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Debe ingresar un valor numrico mayor que 0 en el abono ");
        }
    }//GEN-LAST:event_botonRegistrarAbonoActionPerformed

    private void TablaDeBuscarFacturaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeBuscarFacturaMouseClicked
        int fila = TablaDeBuscarFactura.getSelectedRow();
        int identificacion = (int) TablaDeBuscarFactura.getValueAt(fila, 1);

        Object opciones[] = { "Imprimir", "Guardar", " Eliminar", "Cancelar" };

        int opcion = JOptionPane.showOptionDialog(this,
                "Que operacin desea realizar con la factura  " + identificacion + "?", "Mensaje del sistema",
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, null);
        GenerarFactura generarFactura = new GenerarFactura();
        switch (opcion) {
        case 0:
            generarFactura.imprimirFactura(identificacion, this);
            break;
        case 1:
            PDDocument documento = generarFactura.crearFactura(identificacion, this);
            JFileChooser fc = new JFileChooser();
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivo PDF", "pdf", "text");
            fc.setFileFilter(filter);
            fc.showSaveDialog(this);
            if (fc.getSelectedFile() != null) {
                File selectedFile = fc.getSelectedFile();
                try {

                    documento.save(selectedFile + ".pdf");
                    JOptionPane.showMessageDialog(this, "El archivo ha sido guardado en disco");

                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(this,
                            "El Archivo no se puede leer!\nInformacin tcnica\n" + ex.toString());
                }
                break;
            }

        case 2:
            int confirmacion = JOptionPane.showConfirmDialog(this,
                    "Quieres eliminar la factura " + identificacion + " factura?");

            if (confirmacion == JOptionPane.YES_OPTION) {
                ControladorFactura controladorFactura = new ControladorFactura();
                controladorFactura.deleteFactura(" where factura_id = " + identificacion);
            }
            break;
        case 3:
            break;
        default:
            break;

        }

    }//GEN-LAST:event_TablaDeBuscarFacturaMouseClicked

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        String factura_id = jTextField_BuscarFactura_ID.getText();
        String cliente_id = jTextField_BuscarFactura_Cliente.getText();
        ControladorFactura controladorFactura = new ControladorFactura();
        String restriccion = "";
        if (!factura_id.equals("")) {
            restriccion += " where factura_id like '%" + factura_id + "%'";
            if (!cliente_id.equals("")) {
                restriccion += " or cliente_id like '%" + cliente_id + "%'";
            }
        } else {
            if (!cliente_id.equals("")) {
                restriccion += " where cliente_id like '%" + cliente_id + "%'";
            }
        }

        //String restriccion2 = " where factura_id like '%"+factura_id+"%' or cliente_id like '%"+cliente_id+"%'";
        ArrayList<Factura> listaFactura = controladorFactura.getFactura(restriccion);

        DefaultTableModel modelo = (DefaultTableModel) TablaDeBuscarFactura.getModel();

        for (int i = 0; i < modelo.getRowCount(); i++) {
            modelo.removeRow(i);
        }
        modelo.setRowCount(0);
        ControladorCliente controladorCliente = new ControladorCliente();
        for (int i = 0; i < listaFactura.size(); i++) {
            Factura factura = listaFactura.get(i);
            Object[] fila = new Object[6];
            fila[0] = (i + 1);
            fila[1] = factura.getFactura_id();
            fila[2] = factura.getFecha();

            Cliente cliente = controladorCliente.obtenerClientePorID(factura.getCliente_id());
            fila[3] = cliente.getNombre();
            fila[4] = factura.getEstado();

            Double valorFactura = factura.getValor();
            NumberFormat formatter = new DecimalFormat("#0");

            fila[5] = formatter.format(valorFactura);
            //button.setText("<HTML>Click the <FONT color=\"#000099\"><U>link "+i+"</U></FONT>"+ " to go to the Java website.</HTML>");
            modelo.addRow(fila);

        }

        TablaDeBuscarFactura.setModel(modelo);
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();
        ArrayList<String[]> listado = controladorFlujoFactura.getTodosFlujo_Factura("");
        DefaultTableModel modelo = (DefaultTableModel) TablaDeReporteDiario.getModel();

        if (modelo.getRowCount() > 0) {
            for (int k = modelo.getRowCount() - 1; k > -1; k--) {
                modelo.removeRow(k);
            }
        }
        int contador = 1;
        double abono = 0;
        double deuda = 0;
        for (int i = 0; i < listado.size(); i++) {
            String[] fila = listado.get(i);

            String[] partirEspacios = fila[3].split("\\s");
            //El primer string es la fecha sin hora
            //Ahora esparamos por -
            String[] tomarAgeMesDia = partirEspacios[0].split("-");

            //Realizar filtro
            int ageConsulta = Integer.parseInt(tomarAgeMesDia[0]);
            int mesConsulta = Integer.parseInt(tomarAgeMesDia[1]);
            int diaConsulta = Integer.parseInt(tomarAgeMesDia[2]);
            Calendar fechaDeLaBD = new GregorianCalendar(ageConsulta, mesConsulta, diaConsulta);

            int anioInicial = fechaReporteDiario.getSelectedDate().get(Calendar.YEAR);
            int mesInicial = fechaReporteDiario.getSelectedDate().get(Calendar.MONTH) + 1;
            int diaInicial = fechaReporteDiario.getSelectedDate().get(Calendar.DAY_OF_MONTH);
            Calendar fechaInicialRango = new GregorianCalendar(anioInicial, mesInicial, diaInicial);

            //fechaReporteDiarioHasta
            int anioFinal = fechaReporteDiarioHasta.getSelectedDate().get(Calendar.YEAR);
            int mesFinal = fechaReporteDiarioHasta.getSelectedDate().get(Calendar.MONTH) + 1;
            int diaFinal = fechaReporteDiarioHasta.getSelectedDate().get(Calendar.DAY_OF_MONTH);
            Calendar fechaFinalRango = new GregorianCalendar(anioFinal, mesFinal, diaFinal);

            //System.out.println("antes");
            //System.out.println("Va a comparar" + fechaDeLaBD.toString());
            //System.out.println(" con " + fechaInicialRango.toString());
            if (fechaDeLaBD.compareTo(fechaInicialRango) >= 0 && fechaDeLaBD.compareTo(fechaFinalRango) <= 0) {
                //System.out.println("Entra");
                Object[] row = new Object[5];
                row[0] = (contador);
                contador++;
                row[1] = fila[1];
                row[2] = fila[3];
                row[3] = fila[2];
                row[4] = fila[4];
                modelo.addRow(row);
                //flujo_id","factura_id","tipo_flujo","fecha","valor"
                /*System.out.println("fila 0" + fila[0]);
                 System.out.println("fila 1" + fila[1]);
                 System.out.println("fila 2" + fila[2]);
                 System.out.println("fila 3" + fila[3]);*/
                if (fila[2].equals("abono")) {
                    abono += Double.parseDouble(fila[4]);
                } else {
                    deuda += Double.parseDouble(fila[4]);
                }
                ;
            }

        }
        ReporteDiarioAbono.setText(abono + "");
        ReporteDiarioDeuda.setText(deuda + "");
        TablaDeReporteDiario.setModel(modelo);
        Object opciones[] = { "Cerrar", "Imprimir", "Guardar en disco" };
        int opcion = JOptionPane.showOptionDialog(this, "Se ha generado el diario solicitado\nQue desea hacer?",
                "Elija una opcin", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones,
                null);
        GenerarReporteDiario generarReporteDiario = new GenerarReporteDiario();
        switch (opcion) {
        case 1:
            generarReporteDiario.imprimiDiario(fechaReporteDiario.getSelectedDate(),
                    fechaReporteDiarioHasta.getSelectedDate(), modelo, this);
            break;
        case 2:
            PDDocument documento = generarReporteDiario.crearDiario(fechaReporteDiario.getSelectedDate(),
                    fechaReporteDiarioHasta.getSelectedDate(), modelo, this);
            JFileChooser fc = new JFileChooser();
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivo PDF", "pdf", "text");
            fc.setFileFilter(filter);
            fc.showSaveDialog(this);
            if (fc.getSelectedFile() != null) {
                File selectedFile = fc.getSelectedFile();
                try {

                    documento.save(selectedFile + ".pdf");
                    JOptionPane.showMessageDialog(this, "El archivo ha sido guardado en disco");

                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(this, "EL Archivo no se puede leer!");
                }
            }
            break;

        default:
            break;
        }
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        String nombreCliente = nombreClienteReporteCliente.getText();
        String identificacion = identificacionClienteCliente.getText();
        try {
            //08-11-2014 listar clientes por nombre
            ControladorCliente controladorCliente = new ControladorCliente();
            ArrayList<Cliente> listaClientes = new ArrayList<Cliente>();

            if (nombreCliente.equals("") && identificacion.equals("")) {
                listaClientes = controladorCliente.obtenerClientes();
            } else {
                int identificacionNumerico = 0;
                if (!identificacion.equals("")) {
                    identificacionNumerico = Integer.parseInt(identificacion);
                }
                listaClientes = controladorCliente.obtenerClientes(nombreCliente, identificacionNumerico);
            }

            //08-11-2014 Crear dialogo de bsqueda
            final JDialog dialogoEditar = new JDialog(this);

            dialogoEditar.setTitle("Buscar clientes");
            dialogoEditar.setSize(300, 300);
            dialogoEditar.setResizable(false);

            JPanel panelDialogo = new JPanel();

            panelDialogo.setLayout(new GridBagLayout());

            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;

            JLabel ediitarTextoPrincipalDialogo = new JLabel("Buscar cliente");
            c.gridx = 0;
            c.gridy = 0;
            c.gridwidth = 2;
            c.insets = new Insets(10, 60, 10, 10);
            Font textoGrande = new Font("Arial", 1, 16);
            ediitarTextoPrincipalDialogo.setFont(textoGrande);
            panelDialogo.add(ediitarTextoPrincipalDialogo, c);

            c.gridx = 0;
            c.gridy = 1;
            c.gridwidth = 2;
            c.insets = new Insets(10, 10, 10, 10);
            final JTable tablaDialogo = new JTable();
            DefaultTableModel modeloTabla = new DefaultTableModel() {

                @Override
                public boolean isCellEditable(int row, int column) {
                    //all cells false
                    return false;
                }
            };
            ;

            modeloTabla.addColumn("Identificacin");
            modeloTabla.addColumn("Nombre");

            //LLenar tabla
            for (int i = 0; i < listaClientes.size(); i++) {
                Object[] data = { "1", "2" };
                data[0] = listaClientes.get(i).getCliente_id();
                data[1] = listaClientes.get(i).getNombre();
                modeloTabla.addRow(data);
            }

            tablaDialogo.setModel(modeloTabla);
            tablaDialogo.getColumn("Identificacin").setMinWidth(110);
            tablaDialogo.getColumn("Nombre").setMinWidth(110);
            tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            JScrollPane scroll = new JScrollPane(tablaDialogo);
            scroll.setPreferredSize(new Dimension(220, 150));

            panelDialogo.add(scroll, c);

            c.insets = new Insets(0, 0, 0, 10);
            c.gridx = 0;
            c.gridy = 2;
            c.gridwidth = 1;
            JButton botonGuardarClienteDialogo = new JButton("Elegir");
            panelDialogo.add(botonGuardarClienteDialogo, c);

            c.gridx = 1;
            c.gridy = 2;
            c.gridwidth = 1;
            JButton botonCerrarClienteDialogo = new JButton("Cancelar");
            panelDialogo.add(botonCerrarClienteDialogo, c);

            dialogoEditar.add(panelDialogo);
            dialogoEditar.setVisible(true);

            botonCerrarClienteDialogo.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    dialogoEditar.dispose();
                }
            });

            botonGuardarClienteDialogo.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    int row = tablaDialogo.getSelectedRow();
                    if (row == -1) {
                        JOptionPane.showMessageDialog(dialogoEditar, "Por favor seleccione una fila");

                    } else {
                        Object identificacionCliente = tablaDialogo.getValueAt(row, 0);
                        jTextFieldIdentificacionClienteReporte.setText(String.valueOf(identificacionCliente));
                        botonGenerarReporteCliente.setEnabled(true);
                        dialogoEditar.dispose();

                    }

                }
            }); // TODO add your handling code here:     
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "El valor de la identificacin de ser numrico");

        }

    }//GEN-LAST:event_jButton7ActionPerformed

    private void botonGenerarReporteClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGenerarReporteClienteActionPerformed
        // TODO add your handling code here:
        try {
            if (clienteReporteClienteFechaFinal.getSelectedDate().getTime()
                    .compareTo(clienteReporteClienteFechaInicial.getSelectedDate().getTime()) < 0) {
                JOptionPane.showMessageDialog(this, "La fecha final debe ser posterior al dia de inicio");
            } else {
                final ArrayList<Integer> listaIDFlujos = new ArrayList<>();
                final JDialog dialogoEditar = new JDialog();
                dialogoEditar.setTitle("Reporte cliente");
                dialogoEditar.setSize(350, 610);
                dialogoEditar.setResizable(false);

                JPanel panelDialogo = new JPanel();
                panelDialogo.setLayout(new GridBagLayout());

                GridBagConstraints c = new GridBagConstraints();
                //c.fill = GridBagConstraints.HORIZONTAL;

                JLabel ediitarTextoPrincipalDialogo = new JLabel("Informe cliente");
                c.gridx = 0;
                c.gridy = 0;
                c.gridwidth = 1;
                c.insets = new Insets(10, 45, 10, 10);
                Font textoGrande = new Font("Arial", 1, 18);
                ediitarTextoPrincipalDialogo.setFont(textoGrande);
                panelDialogo.add(ediitarTextoPrincipalDialogo, c);

                final JTable tablaDialogo = new JTable();
                DefaultTableModel modeloTabla = new DefaultTableModel() {

                    @Override
                    public boolean isCellEditable(int row, int column) {
                        //all cells false
                        return false;
                    }
                };
                ;

                modeloTabla.addColumn("Factura");
                modeloTabla.addColumn("Tipo Flujo");
                modeloTabla.addColumn("Fecha");
                modeloTabla.addColumn("Valor");

                //Llenar tabla
                ControladorFlujoFactura controladorFlujoFactura = new ControladorFlujoFactura();
                ArrayList<String[]> flujosCliente = controladorFlujoFactura.getTodosFlujo_Factura(
                        " where factura_id in (select factura_id from Factura where cliente_id = "
                                + String.valueOf(jTextFieldIdentificacionClienteReporte.getText())
                                + ") order by factura_id");
                // {"flujo_id","factura_id","tipo_flujo","fecha","valor"};
                ArrayList<Calendar> fechasFlujos = new ArrayList<>();

                for (int i = 0; i < flujosCliente.size(); i++) {
                    String fila[] = new String[4];
                    String[] objeto = flujosCliente.get(i);
                    fila[0] = objeto[1];
                    fila[1] = objeto[2];
                    fila[2] = objeto[3];
                    fila[3] = objeto[4];

                    //Filtrar, mirar las fechas
                    String[] partirEspacios = objeto[3].split("\\s");
                    //El primer string es la fecha sin hora
                    //Ahora esparamos por -
                    String[] tomarAgeMesDia = partirEspacios[0].split("-");

                    //Realizar filtro
                    int ageConsulta = Integer.parseInt(tomarAgeMesDia[0]);
                    int mesConsulta = Integer.parseInt(tomarAgeMesDia[1]);
                    int diaConsulta = Integer.parseInt(tomarAgeMesDia[2]);

                    //Obtenemos dias, mes y ao de la consulta
                    //Inicial
                    int anioInicial = clienteReporteClienteFechaFinal.getSelectedDate().get(Calendar.YEAR);
                    int mesInicial = clienteReporteClienteFechaFinal.getSelectedDate().get(Calendar.MONTH) + 1;
                    int diaInicial = clienteReporteClienteFechaFinal.getSelectedDate().get(Calendar.DAY_OF_MONTH);
                    //Final
                    int anioFinal = clienteReporteClienteFechaInicial.getSelectedDate().get(Calendar.YEAR);
                    int mesFinal = clienteReporteClienteFechaInicial.getSelectedDate().get(Calendar.MONTH) + 1;
                    int diaFinal = clienteReporteClienteFechaInicial.getSelectedDate().get(Calendar.DAY_OF_MONTH);

                    //Construir fechas
                    Calendar fechaDeLaBD = new GregorianCalendar(ageConsulta, mesConsulta, diaConsulta);
                    //Set year, month, day)

                    Calendar fechaInicialRango = new GregorianCalendar(anioInicial, mesInicial, diaInicial);
                    Calendar fechaFinalRango = new GregorianCalendar(anioFinal, mesFinal, diaFinal);

                    if (fechaDeLaBD.compareTo(fechaInicialRango) <= 0
                            && fechaDeLaBD.compareTo(fechaFinalRango) >= 0) {
                        fechasFlujos.add(fechaDeLaBD);
                        modeloTabla.addRow(fila);
                    }

                }

                if (modeloTabla.getRowCount() > 0) {
                    tablaDialogo.setModel(modeloTabla);
                    tablaDialogo.getColumn("Factura").setMinWidth(80);
                    tablaDialogo.getColumn("Tipo Flujo").setMinWidth(80);
                    tablaDialogo.getColumn("Fecha").setMinWidth(90);
                    tablaDialogo.getColumn("Valor").setMinWidth(80);
                    tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                    JScrollPane scroll = new JScrollPane(tablaDialogo);
                    scroll.setPreferredSize(new Dimension(330, 150));

                    c.gridx = 0;
                    c.gridy = 1;
                    c.gridwidth = 1;
                    c.insets = new Insets(0, 0, 0, 0);
                    panelDialogo.add(scroll, c);

                    TimeSeries localTimeSeries = new TimeSeries("Compras del cliente en el periodo");

                    Map listaAbonos = new HashMap();

                    for (int i = 0; i < modeloTabla.getRowCount(); i++) {
                        listaIDFlujos.add(Integer.parseInt(flujosCliente.get(i)[0]));

                        if (modeloTabla.getValueAt(i, 1).equals("abono")) {
                            Calendar fechaFlujo = fechasFlujos.get(i);
                            double valor = Double.parseDouble(String.valueOf(modeloTabla.getValueAt(i, 3)));

                            int anoDato = fechaFlujo.get(Calendar.YEAR);
                            int mesDato = fechaFlujo.get(Calendar.MONTH) + 1;
                            int diaDato = fechaFlujo.get(Calendar.DAY_OF_MONTH);
                            Day FechaDato = new Day(diaDato, mesDato, anoDato);

                            if (listaAbonos.get(FechaDato) != null) {
                                double valorAbono = (double) listaAbonos.get(FechaDato);
                                listaAbonos.remove(FechaDato);
                                listaAbonos.put(FechaDato, valorAbono + valor);
                            } else {
                                listaAbonos.put(FechaDato, valor);

                            }

                        }

                    }
                    Double maximo = 0.0;
                    Iterator iterator = listaAbonos.keySet().iterator();
                    while (iterator.hasNext()) {
                        Day key = (Day) iterator.next();
                        Double value = (double) listaAbonos.get(key);
                        maximo = Math.max(maximo, value);
                        localTimeSeries.add(key, value);
                    }

                    //localTimeSeries.add();
                    TimeSeriesCollection datos = new TimeSeriesCollection(localTimeSeries);

                    JFreeChart chart = ChartFactory.createTimeSeriesChart("Compras del cliente en el periodo", // Title
                            "Tiempo", // x-axis Label
                            "Total ($)", // y-axis Label
                            datos, // Dataset
                            true, // Show Legend
                            true, // Use tooltips
                            false // Configure chart to generate URLs?
                    );
                    /*Altering the graph */
                    XYPlot plot = (XYPlot) chart.getPlot();
                    plot.setAxisOffset(new RectangleInsets(5.0, 10.0, 10.0, 5.0));
                    plot.setDomainCrosshairVisible(true);
                    plot.setRangeCrosshairVisible(true);

                    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
                    renderer.setBaseShapesVisible(true);
                    renderer.setBaseShapesFilled(true);

                    NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();
                    numberAxis.setRange(new Range(0, maximo * 1.2));
                    Font font = new Font("Dialog", Font.PLAIN, 9);
                    numberAxis.setTickLabelFont(font);
                    numberAxis.setLabelFont(font);

                    DateAxis axis = (DateAxis) plot.getDomainAxis();
                    axis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy"));
                    axis.setAutoTickUnitSelection(false);
                    axis.setVerticalTickLabels(true);

                    axis.setTickLabelFont(font);
                    axis.setLabelFont(font);

                    LegendTitle leyendaChart = chart.getLegend();
                    leyendaChart.setItemFont(font);

                    Font fontTitulo = new Font("Dialog", Font.BOLD, 12);
                    TextTitle tituloChart = chart.getTitle();
                    tituloChart.setFont(fontTitulo);

                    ChartPanel CP = new ChartPanel(chart);
                    Dimension D = new Dimension(330, 300);
                    CP.setPreferredSize(D);
                    CP.setVisible(true);
                    c.gridx = 0;
                    c.gridy = 2;
                    c.gridwidth = 1;
                    c.insets = new Insets(10, 0, 0, 0);
                    panelDialogo.add(CP, c);

                    c.gridx = 0;
                    c.gridy = 3;
                    c.gridwidth = 1;
                    c.anchor = GridBagConstraints.WEST;
                    c.insets = new Insets(10, 30, 0, 0);

                    JButton botonCerrar = new JButton("Cerrar");
                    botonCerrar.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent e) {
                            dialogoEditar.dispose();
                        }
                    });
                    panelDialogo.add(botonCerrar, c);

                    JButton botonGenerarPDF = new JButton("Guardar archivo");
                    botonGenerarPDF.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent e) {
                            ReporteFlujosCliente reporteFlujosCliente = new ReporteFlujosCliente();
                            reporteFlujosCliente.guardarDocumentoDialogo(dialogoEditar, listaIDFlujos,
                                    Integer.parseInt(jTextFieldIdentificacionClienteReporte.getText()),
                                    clienteReporteClienteFechaInicial.getSelectedDate(),
                                    clienteReporteClienteFechaFinal.getSelectedDate());

                        }
                    });
                    c.insets = new Insets(10, 100, 0, 0);

                    panelDialogo.add(botonGenerarPDF, c);

                    JButton botonImprimir = new JButton("Imprimir");
                    botonImprimir.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent e) {
                            ReporteFlujosCliente reporteFlujosCliente = new ReporteFlujosCliente();
                            reporteFlujosCliente.imprimirFlujo(listaIDFlujos,
                                    Integer.parseInt(jTextFieldIdentificacionClienteReporte.getText()),
                                    clienteReporteClienteFechaInicial.getSelectedDate(),
                                    clienteReporteClienteFechaFinal.getSelectedDate());

                        }
                    });
                    c.insets = new Insets(10, 230, 0, 0);

                    panelDialogo.add(botonImprimir, c);
                    dialogoEditar.add(panelDialogo);

                    dialogoEditar.setVisible(true);

                } else {
                    JOptionPane.showMessageDialog(this,
                            "El cliente no registra movimientos en el rango de fechas seleccionado");
                }

            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Debe seleccionar un da inicial y final de fechas");
        }

    }//GEN-LAST:event_botonGenerarReporteClienteActionPerformed

    private void TablaDeReporteDiarioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeReporteDiarioMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_TablaDeReporteDiarioMouseClicked

    //Llenar tabla usuarios
    public void generarTablaUsuarios() {
        //tablaUsuariosDelSistema
        ControladorUsuarios controladorUsuarios = new ControladorUsuarios();
        ArrayList<Usuarios> listaUsuarios = controladorUsuarios.obtenerTodosUsuarios();

        DefaultTableModel modeloTabla = (DefaultTableModel) tablaUsuariosDelSistema.getModel();

        for (int i = 0; i < modeloTabla.getRowCount(); i++) {
            modeloTabla.removeRow(i);
        }
        modeloTabla.setRowCount(0);

        for (int i = 0; i < listaUsuarios.size(); i++) {
            Usuarios usuarioActual = listaUsuarios.get(i);

            Object[] rowData = new Object[3];
            rowData[0] = usuarioActual.getLogin();
            rowData[1] = usuarioActual.getCreation_data();

            char habilitado = usuarioActual.getStatus();

            if (habilitado == 'e') {
                rowData[2] = "Habilitado";
            } else {
                rowData[2] = "Inhablitado";
            }

            modeloTabla.addRow(rowData);
        }
        tablaUsuariosDelSistema.setModel(modeloTabla);

    }

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        // TODO add your handling code here:
        String nombreUsuario = nombreNuevoUsuario.getText();
        String passwordUsuario = passwordNuevoUsuario.getText();

        if (nombreUsuario.equals("") || passwordUsuario.equals("")) {
            JOptionPane.showMessageDialog(this, "Debe indicar un nombre y contrasea para el nuevo usuario");
        } else {
            ControladorUsuarios controladorUsuarios = new ControladorUsuarios();

            if (controladorUsuarios.obtenerUsuario(nombreUsuario) == null) {

                String estado = "e";

                if (!checkBoxEstadoNuevoUsuario.isSelected()) {
                    estado = "i";
                }

                controladorUsuarios.CrearUsuario(nombreUsuario, passwordUsuario, estado);
                nombreNuevoUsuario.setText("");
                passwordNuevoUsuario.setText("");
                JOptionPane.showMessageDialog(this, "Se ha creado el usuario existosamente");
            } else {
                JOptionPane.showMessageDialog(this, "El login de usuario ya existe en el sistema");

            }

            generarTablaUsuarios();

        }
    }//GEN-LAST:event_jButton8ActionPerformed

    private void botonEstablecerMontoFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEstablecerMontoFacturaActionPerformed
        // TODO add your handling code here:
        int seleccion = JOptionPane.showConfirmDialog(this,
                "Al establecer un monto de factura, no se considerarn los productos en ella \n Desea continuar?",
                "Mensaje del sistema", JOptionPane.YES_NO_OPTION);
        if (seleccion == 0) {

            try {
                double monto = Double.parseDouble(valorMontoFactura.getText());

                if (monto <= 0.0) {
                    throw new Exception();

                }
                valorActualFactura.setText(valorMontoFactura.getText());

                DefaultTableModel modeloTabla = (DefaultTableModel) TablaDeFacturaProducto.getModel();

                //Borrar filas
                for (int i = 0; i < modeloTabla.getRowCount(); i++) {
                    modeloTabla.removeRow(i);
                }
                modeloTabla.setRowCount(0);

                TablaDeFacturaProducto.setModel(modeloTabla);
                botonAgregarProducto.setEnabled(false);

            } catch (Exception e) {
                JOptionPane.showMessageDialog(this, "El valor debe ser numrico positivo", "Advertencia",
                        JOptionPane.WARNING_MESSAGE);
            }

        }

    }//GEN-LAST:event_botonEstablecerMontoFacturaActionPerformed

    private void botonGuardarDatosEmpresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarDatosEmpresaActionPerformed
        // TODO add your handling code here:
        String razonSocial = valorRazonSocial.getText();
        //Esto para insertar comillas en sql
        String razonSocialFiltrado = razonSocial.replace("'", "''");
        String NITEmpresa = valorNIT.getText();
        String direccionEmpresa = valorDireccionEmpresa.getText();

        ControladorConfiguraciones controladorConfiguraciones = new ControladorConfiguraciones();
        controladorConfiguraciones.cambiarInformacionLegal(razonSocialFiltrado, NITEmpresa, direccionEmpresa);
        JOptionPane.showMessageDialog(this, "Informacin legal cambiada con xito");
    }//GEN-LAST:event_botonGuardarDatosEmpresaActionPerformed

    private void botonGuardarDatosFacturasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarDatosFacturasActionPerformed
        // TODO add your handling code here:
        String IVA = String.valueOf(valorIVA.getValue());
        String mensajeLegal = valorMensajeFinalFactura.getText();
        String mensajeLegalFiltrado = mensajeLegal.replace("'", "''");

        ControladorConfiguraciones controladorConfiguraciones = new ControladorConfiguraciones();
        controladorConfiguraciones.cambiarInformacioNFactura(IVA, mensajeLegalFiltrado);
        JOptionPane.showMessageDialog(this, "Informacin de factura cambiada con xito");

    }//GEN-LAST:event_botonGuardarDatosFacturasActionPerformed

    private void tablaUsuariosDelSistemaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaUsuariosDelSistemaMouseClicked
        // TODO add your handling code here:
        String opcionHabilitar = "Habilitar";
        String nombreUsuario = String
                .valueOf(tablaUsuariosDelSistema.getValueAt(tablaUsuariosDelSistema.getSelectedRow(), 0));
        String estado = String
                .valueOf(tablaUsuariosDelSistema.getValueAt(tablaUsuariosDelSistema.getSelectedRow(), 2));
        if (estado.equals("Habilitado")) {
            opcionHabilitar = "Deshabilitar";
        }
        Object[] opciones = { "Cancelar", "Editar", opcionHabilitar };
        final ControladorUsuarios controladorUsuarios = new ControladorUsuarios();
        final Usuarios usuarioSelecionado = controladorUsuarios.obtenerUsuario(nombreUsuario);
        if (nombreUsuario.equals("admin") || nombreUsuario.equals(JTextFieldnombreDeUsuario.getText())) {
            JOptionPane.showMessageDialog(this,
                    "No se puede editarse a si mismo o el usuario administrador del sistema", "Mensaje del sistema",
                    JOptionPane.WARNING_MESSAGE);
        } else {
            int opcionElegida = JOptionPane.showOptionDialog(this, "Por favor elija una opcin", "Editar cliente",
                    JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, opciones, null);
            switch (opcionElegida) {
            case 1:
                final JDialog dialogoEditar = new JDialog(this);
                dialogoEditar.setTitle("Editar usuario");
                dialogoEditar.setSize(400, 310);
                dialogoEditar.setResizable(false);
                JPanel panelDialogo = new JPanel();
                panelDialogo.setLayout(new GridBagLayout());
                GridBagConstraints c = new GridBagConstraints();
                c.fill = GridBagConstraints.HORIZONTAL;
                JLabel editarTextoPrincipalDialogo = new JLabel("Editar clientes");
                c.gridx = 0;
                c.gridy = 0;
                c.gridwidth = 2;
                c.insets = new Insets(15, 10, 40, 0);
                c.ipadx = 0;
                Font textoGrande = new Font("Arial", 1, 18);
                editarTextoPrincipalDialogo.setFont(textoGrande);
                panelDialogo.add(editarTextoPrincipalDialogo, c);
                c.insets = new Insets(0, 5, 10, 0);
                c.gridx = 0;
                c.gridy = 1;
                c.gridwidth = 1;
                c.ipadx = 0;
                JLabel editarNombreClienteDialogo = new JLabel("Login:");
                panelDialogo.add(editarNombreClienteDialogo, c);
                final JTextField valorEditarNombreClienteDialogo = new JTextField();
                c.gridx = 1;
                c.gridy = 1;
                c.gridwidth = 1;
                c.ipadx = 0;
                c.insets = new Insets(0, 5, 10, 0);
                valorEditarNombreClienteDialogo.setText(usuarioSelecionado.getLogin());
                panelDialogo.add(valorEditarNombreClienteDialogo, c);
                c.gridx = 0;
                c.gridy = 2;
                c.gridwidth = 1;
                c.ipadx = 0;
                c.insets = new Insets(0, 5, 10, 0);
                JLabel editarPasswordClienteDialogo = new JLabel("Contrasea:");
                panelDialogo.add(editarPasswordClienteDialogo, c);
                final JTextField valoreditarPasswordClienteDialogo = new JTextField();
                c.gridx = 1;
                c.gridy = 2;
                c.gridwidth = 1;
                c.ipadx = 0;
                c.insets = new Insets(0, 5, 10, 0);
                panelDialogo.add(valoreditarPasswordClienteDialogo, c);
                c.gridx = 0;
                c.gridy = 3;
                c.gridwidth = 2;
                c.ipadx = 0;
                c.insets = new Insets(0, 5, 10, 0);
                JLabel mensajeEditarPassword = new JLabel(
                        "Si no desea editar la contrasea deje este espacio en blanco:");
                panelDialogo.add(mensajeEditarPassword, c);
                c.gridx = 0;
                c.gridy = 4;
                c.gridwidth = 1;
                c.ipadx = 0;
                c.insets = new Insets(0, 15, 10, 15);
                JButton botonGuardarClienteDialogo = new JButton("Guardar");
                panelDialogo.add(botonGuardarClienteDialogo, c);
                c.gridx = 1;
                c.gridy = 4;
                c.gridwidth = 1;
                c.insets = new Insets(0, 15, 10, 15);
                c.ipadx = 0;
                JButton botonCerrarClienteDialogo = new JButton("Cancelar");
                panelDialogo.add(botonCerrarClienteDialogo, c);
                botonCerrarClienteDialogo.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        dialogoEditar.dispose();
                    }
                });
                botonGuardarClienteDialogo.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        String nombreUsuario = valorEditarNombreClienteDialogo.getText();
                        usuarioSelecionado.setLogin(nombreUsuario);
                        if (!valoreditarPasswordClienteDialogo.getText().equals("")) {
                            usuarioSelecionado.setPassword(valoreditarPasswordClienteDialogo.getText());
                        }
                        controladorUsuarios.modificarUsuario(usuarioSelecionado.getUser_id(),
                                usuarioSelecionado.getLogin(), usuarioSelecionado.getPassword());
                        JOptionPane.showMessageDialog(dialogoEditar, "Se ha modificado el usuario con xito",
                                "Mensaje del sistema", JOptionPane.INFORMATION_MESSAGE);
                        generarTablaUsuarios();
                        dialogoEditar.dispose();
                    }
                });
                dialogoEditar.add(panelDialogo);
                dialogoEditar.setVisible(true);
                break;
            case 2:
                if (estado.equals("Habilitado")) {
                    usuarioSelecionado.setStatus('i');
                } else {
                    usuarioSelecionado.setStatus('e');
                }
                controladorUsuarios.modificarEstadoUsuario(usuarioSelecionado);
                JOptionPane.showMessageDialog(this, "Se ha cambiado el estado del usuario", "Mensaje del sistema",
                        JOptionPane.INFORMATION_MESSAGE);
                generarTablaUsuarios();
                break;
            default:
                break;
            }
        } // TODO add your handling code here:

    }//GEN-LAST:event_tablaUsuariosDelSistemaMouseClicked

    private void TablaDeProveedoresMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeProveedoresMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_TablaDeProveedoresMouseClicked

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        String identificacion = jTextFieldNitProveedores.getText();
        String nombre = jTextFieldNombreProveedores.getText();

        try {
            if (identificacion.equals(""))
                Double.parseDouble("genere excepcion");
            if (nombre.equals(""))
                Double.parseDouble("genere excepcion");
            ControladorProveedores controladorProveedores = new ControladorProveedores();
            controladorProveedores.agregarProveedores(identificacion, nombre);

            JOptionPane.showMessageDialog(null, "Proveedor creado exitosamente");
            jTextFieldNitProveedores.setText("");
            jTextFieldNombreProveedores.setText("");

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "No dejar campos vacios", "Error", JOptionPane.ERROR_MESSAGE);

        }

    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        String identificacion = jTextFieldNitProveedores.getText();
        String nombre = jTextFieldNombreProveedores.getText();
        int identificacionClienteInt = 0;
        try {

            ControladorProveedores controladorProveedores = new ControladorProveedores();

            ArrayList<Proveedores> listaDeProveedores = controladorProveedores.obtenerProveedores(identificacion,
                    nombre);

            //Agregar filas
            DefaultTableModel modelo = (DefaultTableModel) TablaDeProveedores.getModel();

            for (int i = 0; i < modelo.getRowCount(); i++) {
                modelo.removeRow(i);
            }
            modelo.setRowCount(0);
            for (int i = 0; i < listaDeProveedores.size(); i++) {
                Proveedores proveedor = listaDeProveedores.get(i);
                Object[] fila = new Object[4];
                fila[0] = proveedor.getIdentificacion();
                fila[1] = proveedor.getNombre();
                //button.setText("<HTML>Click the <FONT color=\"#000099\"><U>link "+i+"</U></FONT>"+ " to go to the Java website.</HTML>");

                fila[3] = "Editar";
                modelo.addRow(fila);

            }

            TablaDeProveedores.setModel(modelo);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Buscar con campos validos", "Error", JOptionPane.ERROR_MESSAGE);
        }
        //TablaDeProveedores
    }//GEN-LAST:event_jButton4ActionPerformed

    private void TablaDeSaldoProveedorMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaDeSaldoProveedorMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_TablaDeSaldoProveedorMouseClicked

    private void tablaMostrarComprasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaMostrarComprasMouseClicked
        // TODO add your handling code here:
        int fila = tablaMostrarCompras.getSelectedRow();
        int identificacion = (int) tablaMostrarCompras.getValueAt(fila, 0);

        Object opciones[] = { "Editar", "Eliminar" };
        ControladorCompraProveedor controladorCompraProveedor = new ControladorCompraProveedor();
        ControladorFlujoCompras controladorFlujoCompras = new ControladorFlujoCompras();

        int opcion = JOptionPane.showOptionDialog(this,
                "Que operacin desea realizar con la compra nmero " + identificacion + "?",
                "Mensaje del sistema", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
                opciones, null);
        switch (opcion) {
        case 0:
            String valor = JOptionPane.showInputDialog("Desea cambiar el monto de la compra\nEl monto actual es: "
                    + tablaMostrarCompras.getValueAt(fila, 3));
            Double.parseDouble(valor);

            controladorCompraProveedor.editarCompraProveedor(String.valueOf(identificacion), valor);

            //Editar flujos
            //Registrar nueva deuda
            controladorFlujoCompras.registrarFlujoDeuda(String.valueOf(identificacion), valor);
            controladorFlujoCompras.registrarFlujoAbono(String.valueOf(identificacion),
                    String.valueOf(tablaMostrarCompras.getValueAt(fila, 3)));

            tablaMostrarCompras.setValueAt(valor, fila, 3);

            try {
            } catch (Exception e) {
                JOptionPane.showMessageDialog(this, "El monto debe ser numrico", "Error",
                        JOptionPane.ERROR_MESSAGE);
            }
            break;
        case 1:
            int confirmacion = JOptionPane.showConfirmDialog(this,
                    "Quieres eliminar la compra nmero " + identificacion + "?");

            if (confirmacion == JOptionPane.YES_OPTION) {
                controladorCompraProveedor
                        .eliminarCompraProveedor(" where  ID_Compra_Proveedor = " + identificacion);
                DefaultTableModel modeloTabla = (DefaultTableModel) tablaMostrarCompras.getModel();
                modeloTabla.removeRow(fila);
                tablaMostrarCompras.setModel(modeloTabla);

                //Eliminar flujo
                controladorFlujoCompras.borrarFlujosDeUnaCompraPorIDDeCompra(String.valueOf(identificacion));
            }
            break;
        default:
            break;
        }
    }//GEN-LAST:event_tablaMostrarComprasMouseClicked

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        // TODO add your handling code here:u
        String nitProveedor = campoNITProveedor.getText();
        String nombreProveedor = campoNombreProveedor.getText();

        DialogoBuscarProveedor dialogoBuscarProveedor = new DialogoBuscarProveedor(this, false);
        dialogoBuscarProveedor.establecerPatronesBusqueda(nombreProveedor, nitProveedor);
        dialogoBuscarProveedor.establecerSalida(campoProveedorSeleccionado);
        dialogoBuscarProveedor.establecerNombreProveedor(nombreProveedorAComprar);
        dialogoBuscarProveedor.llenarTabla();

        dialogoBuscarProveedor.setVisible(true);

    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
        // TODO add your handling code here:
        String montoCompra = campoMontoCompra.getText();
        String IDProveedor = campoProveedorSeleccionado.getText();

        String pago = JOptionPane.showInputDialog("Por favor ingrese el monto a pagar");

        try {
            Double.parseDouble(IDProveedor);
            Double valorCompra = Double.parseDouble(montoCompra);
            Double valorPagado = Double.parseDouble(pago);

            while (valorPagado > valorCompra || valorPagado < 0) {
                pago = JOptionPane.showInputDialog(
                        "El monto a pagar no puede ser mayor que el valor de la compra ni menor a 0\nPor favor ingrese el monto a pagar");
                valorPagado = Double.parseDouble(pago);
            }

            ControladorCompraProveedor controladorCompraProveedor = new ControladorCompraProveedor();
            int IDCompra = controladorCompraProveedor.crearNuevaCompra(IDProveedor, montoCompra);

            //Registrar flujo
            ControladorFlujoCompras controladorFlujoCompra = new ControladorFlujoCompras();
            controladorFlujoCompra.registrarFlujoAbono(IDProveedor, pago);
            controladorFlujoCompra.registrarFlujoDeuda(IDProveedor, montoCompra);

            JOptionPane.showMessageDialog(this, "Compra registrada con xito", "Mensaje del sistema",
                    JOptionPane.INFORMATION_MESSAGE);
            campoMontoCompra.setText("");
            campoProveedorSeleccionado.setText("");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Debe seleccionar un proveedor y el monto debe ser numrico",
                    "Mensaje del sistema", JOptionPane.ERROR_MESSAGE);

        }

    }//GEN-LAST:event_jButton12ActionPerformed

    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
        // TODO add your handling code here:
        String NitProveedor = campoNitBuscarProveedor.getText();
        String buscarNombreProveedor = campoNombreBuscarProveedor.getText();

        String restriccion = " where IDProveedor in ( select ID from Proveedores where 1";

        if (!NitProveedor.equals("")) {
            restriccion += " and ID = " + NitProveedor;
        }

        if (!buscarNombreProveedor.equals("")) {
            restriccion += " and nombre LIKE '\"%" + buscarNombreProveedor + "%\"";
        }

        restriccion += ")";
        ControladorCompraProveedor controladorCompraProveedor = new ControladorCompraProveedor();
        ArrayList<CompraProveedores> listaCompraProveedores = controladorCompraProveedor
                .obtenerCompraProveedoresPorRestriccion(restriccion);

        DefaultTableModel modeloTabla = (DefaultTableModel) tablaMostrarCompras.getModel();

        for (int i = 0; i < modeloTabla.getRowCount(); i++) {
            modeloTabla.removeRow(i);
        }
        modeloTabla.setRowCount(0);

        for (int i = 0; i < listaCompraProveedores.size(); i++) {
            CompraProveedores compraProveedores = listaCompraProveedores.get(i);
            Object[] fila = new Object[4];
            //numero, proveedor, fecha, valor
            fila[0] = compraProveedores.getID();

            ControladorProveedores controladorProveedores = new ControladorProveedores();
            Proveedores proveedores = controladorProveedores
                    .obtenerProveedores(String.valueOf(compraProveedores.getIDProveedor()), "").get(0);
            fila[1] = proveedores.getNombre();
            fila[2] = compraProveedores.getFecha();
            fila[3] = compraProveedores.getMontoCompra();

            modeloTabla.addRow(fila);

        }
        tablaMostrarCompras.setModel(modeloTabla);
    }//GEN-LAST:event_jButton13ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        // TODO add your handling code here:
        String nombre = jTextFieldNombreSaldoProveedores.getText();
        ControladorProveedores controladorProveedores = new ControladorProveedores();
        ArrayList<Proveedores> listaProveedores = controladorProveedores.obtenerProveedores("", nombre);

        final JDialog dialogoEditar = new JDialog(this);

        dialogoEditar.setTitle("Buscar proveedores");
        dialogoEditar.setSize(500, 300);
        dialogoEditar.setResizable(false);

        JPanel panelDialogo = new JPanel();

        panelDialogo.setLayout(new GridBagLayout());

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;

        JLabel ediitarTextoPrincipalDialogo = new JLabel("Buscar Proveedores");
        c.gridx = 0;
        c.gridy = 0;
        c.gridwidth = 3;
        c.insets = new Insets(10, 60, 10, 10);
        Font textoGrande = new Font("Arial", 1, 16);
        ediitarTextoPrincipalDialogo.setFont(textoGrande);
        panelDialogo.add(ediitarTextoPrincipalDialogo, c);

        c.gridx = 0;
        c.gridy = 1;
        c.gridwidth = 3;
        c.insets = new Insets(10, 10, 10, 10);
        final JTable tablaDialogo = new JTable();
        DefaultTableModel modeloTabla = new DefaultTableModel() {

            @Override
            public boolean isCellEditable(int row, int column) {
                //all cells false
                return false;
            }
        };
        ;
        modeloTabla.addColumn("ID");
        modeloTabla.addColumn("Identificacin");
        modeloTabla.addColumn("Nombre");

        //LLenar tabla
        for (int i = 0; i < listaProveedores.size(); i++) {
            Object[] data = { "1", "2", "3" };
            data[0] = listaProveedores.get(i).getID();
            data[1] = listaProveedores.get(i).getIdentificacion();
            data[2] = listaProveedores.get(i).getNombre();
            System.out.println("Nombre!!" + data[2]);
            modeloTabla.addRow(data);
        }

        tablaDialogo.setModel(modeloTabla);
        tablaDialogo.getColumn("ID").setMinWidth(70);
        tablaDialogo.getColumn("Identificacin").setMinWidth(60);
        tablaDialogo.getColumn("Nombre").setMinWidth(150);
        tablaDialogo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        JScrollPane scroll = new JScrollPane(tablaDialogo);
        scroll.setPreferredSize(new Dimension(220, 150));

        panelDialogo.add(scroll, c);

        c.insets = new Insets(0, 0, 0, 10);
        c.gridx = 0;
        c.gridy = 2;
        c.gridwidth = 1;
        JButton botonGuardarClienteDialogo = new JButton("Elegir");
        panelDialogo.add(botonGuardarClienteDialogo, c);

        c.gridx = 1;
        c.gridy = 2;
        c.gridwidth = 1;
        JButton botonCerrarClienteDialogo = new JButton("Cancelar");
        panelDialogo.add(botonCerrarClienteDialogo, c);

        dialogoEditar.add(panelDialogo);
        dialogoEditar.setVisible(true);

        botonCerrarClienteDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialogoEditar.dispose();
            }
        });

        botonGuardarClienteDialogo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                int row = tablaDialogo.getSelectedRow();
                if (row == -1) {
                    JOptionPane.showMessageDialog(dialogoEditar, "Por favor seleccione una fila");

                } else {
                    Object identificacionCliente = tablaDialogo.getValueAt(row, 0);
                    Object idCliente = tablaDialogo.getValueAt(row, 1);
                    mostrarIDProveedor.setText(String.valueOf(identificacionCliente));
                    String nombreClientePago = String.valueOf(tablaDialogo.getValueAt(row, 2));

                    //Limitar a 15 caracteres
                    if (nombreClientePago.length() >= 15) {
                        nombreClientePago = nombreClientePago.substring(0, 12);

                    }
                    textoNombreProveedor.setText(nombreClientePago);

                    DefaultTableModel modeloClientes = (DefaultTableModel) TablaDeSaldoProveedor.getModel();
                    for (int i = 0; i < modeloClientes.getRowCount(); i++) {
                        modeloClientes.removeRow(i);
                    }

                    modeloClientes.setRowCount(0);
                    ControladorFlujoCompras controladorFlujoCompra = new ControladorFlujoCompras();

                    //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506);
                    ArrayList<Flujo_Compra> flujosProveedor = controladorFlujoCompra.obtenerFlujosCompras(
                            " where ID_CompraProveedor in (select ID_CompraProveedor from Compra_Proveedores where IDProveedor = "
                                    + String.valueOf(identificacionCliente) + ") order by ID_CompraProveedor");
                    double pago = 0.0;

                    for (int i = 0; i < flujosProveedor.size(); i++) {
                        Flujo_Compra datos = flujosProveedor.get(i);
                        Object[] rowData = { datos.getID_CompraProveedor(), datos.getTipo_flujo(), datos.getFecha(),
                                datos.getMonto() };

                        if (datos.getTipo_flujo().equals("deuda")) {
                            pago += Double.parseDouble(datos.getMonto() + "");
                        } else {
                            pago -= Double.parseDouble(datos.getMonto() + "");
                        }

                        modeloClientes.addRow(rowData);
                    }

                    TablaDeSaldoProveedor.setModel(modeloClientes);
                    deudaActualProveedor.setText(String.valueOf(pago));
                    dialogoEditar.dispose();

                    //Mostrar en table de clientes los datos
                    botonRegistrarAbono.setEnabled(true);
                }

            }

        });

    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:

        try {

            String identificacionCliente = mostrarIDProveedor.getText();
            Double abono = Double.parseDouble(jTextFieldAbonoProveedor.getText());

            if (abono <= 0.0 || identificacionCliente.equals("")) {
                throw new Exception();
            }

            ControladorFlujoCompras controladorFlujoFactura = new ControladorFlujoCompras();
            ControladorCompraProveedor controladorCompraProveedor = new ControladorCompraProveedor();

            Calendar calendario = Calendar.getInstance();
            String dia = Integer.toString(calendario.get(Calendar.DATE));
            String mes = Integer.toString(calendario.get(Calendar.MONTH));
            String annio = Integer.toString(calendario.get(Calendar.YEAR));
            Date date = new Date();
            DateFormat hourFormat = new SimpleDateFormat("HH:mm:ss");
            String hora = hourFormat.format(date);

            String fecha = annio + "-" + mes + "-" + dia + " " + hora;
            /*
             * -----------------Tomar el abono y los pagos-----------------
             * Procedimiento
             * 1 Tomar flujos de deuda de cada factura con estado fiado
             * 2 Tomar abonos de abono de cada factura con estado fiado
             * 3 Calcular la resta de estos dos para deteminar lo que se debe por factura
             * 4 Cancelar con el flujo la factura y si lo debido es 0 colocar estado pagado
             * 5 Mostrar una informacin en un JOptionPane y recalcular la deuda
             * 
             */
            DefaultTableModel modeloClientes = (DefaultTableModel) TablaDeSaldoProveedor.getModel();
            ArrayList<String> codigoFactura = new ArrayList<>();
            ArrayList<Double> totalDebe = new ArrayList<>();

            JTextArea area = new JTextArea(10, 30);
            String informe = "\t Registro flujo pago del abono \n\n";
            informe += "Factura \t Pago \t Queda pagada? \n\n";

            int numeroRegistros = -1;
            for (int i = 0; i < modeloClientes.getRowCount(); i++) {
                //System.out.println("Entro al for " + i);
                //Se necesita 0: Factura ID, 1 Tipo, 3 Valor
                // Codigofactura contiene los cogidos de las facturas
                // totalDebe contiene lo que debe de las facturas, la posicion coincide con la lista CodigoFactura
                String factura_id = String.valueOf(modeloClientes.getValueAt(i, 0));
                String tipo_flujo = String.valueOf(modeloClientes.getValueAt(i, 1));
                Double valor = Double.parseDouble(String.valueOf(modeloClientes.getValueAt(i, 3)));
                if (codigoFactura.contains(factura_id)) {

                    if (tipo_flujo.equals("abono")) {
                        totalDebe.set(numeroRegistros, totalDebe.get(numeroRegistros) - valor);
                    } else {
                        totalDebe.set(numeroRegistros, totalDebe.get(numeroRegistros) + valor);
                    }
                } else {
                    numeroRegistros++;
                    codigoFactura.add(factura_id);
                    if (tipo_flujo.equals("abono")) {
                        totalDebe.add(-valor);
                    } else {
                        totalDebe.add(valor);
                    }
                }

            }
            //System.out.println(Arrays.toString(codigoFactura.toArray()));
            //System.out.println(Arrays.toString(totalDebe.toArray()));
            System.out.println(totalDebe);
            double debeTotal = 0d;
            for (int i = 0; i < totalDebe.size(); i++) {
                debeTotal += totalDebe.get(i);
            }

            if (debeTotal < abono) {
                JOptionPane.showMessageDialog(this, "El monto a pagar no puede ser superior a lo que se debe",
                        "Error del sistema", JOptionPane.ERROR_MESSAGE);
                return;
            }
            for (int i = 0; i < totalDebe.size(); i++) {
                //Tomar flujos
                if (abono > 0.0) {
                    Double pago = totalDebe.get(i) - abono;

                    //Pago igual a 0 significa que se pag la factura
                    if (pago == 0) {
                        //Registrar flujo
                        //String[] value = {codigoFactura.get(i), "abono", fecha, String.valueOf(abono)};
                        //String [] selection = {"factura_id","tipo_flujo","fecha","valor"};
                        controladorFlujoFactura.registrarFlujoAbono(codigoFactura.get(i), String.valueOf(abono));

                        //controladorFactura.cambiarEstadoFactura(codigoFactura.get(i), "pagada");
                        informe += codigoFactura.get(i) + "\t" + String.valueOf(abono) + "\tSI\n";
                        //Romper el for
                        break;
                    } else {

                        //Pago mayor que 0, es decir se queda debiendo
                        if (pago > 0) {

                            //Registrar flujo
                            //String[] value = {codigoFactura.get(i), "abono", fecha, String.valueOf(abono)};
                            //String [] selection = {"factura_id","tipo_flujo","fecha","valor"};
                            controladorFlujoFactura.registrarFlujoAbono(codigoFactura.get(i),
                                    String.valueOf(abono));
                            //Como el abono ahora es menor que 0 debe romperse el for
                            informe += codigoFactura.get(i) + "\t" + String.valueOf(abono) + "\tNO\n";

                            break;

                        } else {
                            //Caso final pago menor 0, es decir el abono paga la factura pero queda disponible para otras facturas
                            //Registrar flujo
                            //String[] value = {codigoFactura.get(i), "abono", fecha, String.valueOf(totalDebe.get(i))};
                            //String [] selection = {"factura_id","tipo_flujo","fecha","valor"};
                            controladorFlujoFactura.registrarFlujoAbono(codigoFactura.get(i),
                                    String.valueOf(totalDebe.get(i)));

                            //controladorFactura.cambiarEstadoFactura(codigoFactura.get(i), "pagada");
                            //Ajustamos ahora el abono restando lo que debe la factura
                            informe += codigoFactura.get(i) + "\t" + String.valueOf(abono) + "\tSI\n";
                            abono -= totalDebe.get(i);
                        }

                    }
                } else {
                    //Romper el for
                    break;
                }

            }

            //Reordenar y volver a consultar
            for (int i = 0; i < modeloClientes.getRowCount(); i++) {
                modeloClientes.removeRow(i);
            }

            modeloClientes.setRowCount(0);

            //SELECT * FROM Flujo_Factura where factura_id in (select factura_id from Factura where cliente_id = 1130614506);
            ArrayList<Flujo_Compra> flujosProveedor = controladorFlujoFactura.obtenerFlujosCompras(
                    " where ID_CompraProveedor in (select ID_CompraProveedor from Compra_Proveedores where IDProveedor = "
                            + String.valueOf(identificacionCliente) + ") order by ID_CompraProveedor");
            double pago = 0.0;

            for (int i = 0; i < flujosProveedor.size(); i++) {
                Flujo_Compra datos = flujosProveedor.get(i);
                Object[] rowData = { datos.getID_CompraProveedor(), datos.getTipo_flujo(), datos.getFecha(),
                        datos.getMonto() };

                if (datos.getTipo_flujo().equals("deuda")) {
                    pago += Double.parseDouble(datos.getMonto() + "");
                } else {
                    pago -= Double.parseDouble(datos.getMonto() + "");
                }

                modeloClientes.addRow(rowData);
            }

            TablaDeSaldoProveedor.setModel(modeloClientes);
            deudaActualProveedor.setText(String.valueOf(pago));

            //Mostrar en table de clientes los datos
            botonRegistrarAbono.setEnabled(true);

            area.setText(informe);
            JScrollPane panelInformePago = new JScrollPane(area);
            JOptionPane.showMessageDialog(this, panelInformePago);

        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "Debe ingresar un valor numrico mayor que 0 en el abono ");
        }

    }//GEN-LAST:event_jButton10ActionPerformed
    /*
     * Cambiar nombre de usuario
     */

    public void cambiarNombreUsuario(String nombre) {
        JTextFieldnombreDeUsuario.setText(nombre);
    }

    /**
     * @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(InterfazPrincipal.class.getName())
                    .log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(InterfazPrincipal.class.getName())
                    .log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(InterfazPrincipal.class.getName())
                    .log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(InterfazPrincipal.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 InterfazPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonBuscarCliente;
    private javax.swing.JButton BotonBuscarClienteSaldo;
    private javax.swing.JTextField DireccionNuevoCliente;
    private javax.swing.JTextField IdentificacionClienteBuscarFactura;
    private javax.swing.JLabel JTextFieldnombreDeUsuario;
    private javax.swing.JTextField ReporteDiarioAbono;
    private javax.swing.JTextField ReporteDiarioDeuda;
    private javax.swing.JTable TablaDeBuscarFactura;
    private javax.swing.JTable TablaDeClientes;
    private javax.swing.JTable TablaDeFacturaProducto;
    private javax.swing.JTable TablaDeProductos;
    private javax.swing.JTable TablaDeProveedores;
    private javax.swing.JTable TablaDeReporteDiario;
    private javax.swing.JTable TablaDeSaldoClientes;
    private javax.swing.JTable TablaDeSaldoProveedor;
    private javax.swing.JTextField abonoClente;
    private javax.swing.JButton botonAgregarNuevoCliente;
    private javax.swing.JButton botonAgregarProducto;
    private javax.swing.JButton botonBuscarClienteCrearFactura;
    private javax.swing.JButton botonEstablecerMontoFactura;
    private javax.swing.JButton botonGenerarReporteCliente;
    private javax.swing.JButton botonGuardarDatosEmpresa;
    private javax.swing.JButton botonGuardarDatosFacturas;
    private javax.swing.JButton botonGuardarFactura;
    private javax.swing.JButton botonRegistrarAbono;
    private javax.swing.JTextField campoMontoCompra;
    private javax.swing.JTextField campoNITProveedor;
    private javax.swing.JTextField campoNitBuscarProveedor;
    private javax.swing.JTextField campoNombreBuscarProveedor;
    private javax.swing.JTextField campoNombreProveedor;
    private javax.swing.JTextField campoProveedorSeleccionado;
    private javax.swing.JTextField celularNuevoCliente;
    private javax.swing.JCheckBox checkBoxEstadoNuevoUsuario;
    private datechooser.beans.DateChooserCombo clienteReporteClienteFechaFinal;
    private datechooser.beans.DateChooserCombo clienteReporteClienteFechaInicial;
    private javax.swing.JLabel deudaActualProveedor;
    private datechooser.beans.DateChooserCombo fechaReporteDiario;
    private datechooser.beans.DateChooserCombo fechaReporteDiarioHasta;
    private javax.swing.JTextField identificacionClienteBusqueda;
    private javax.swing.JTextField identificacionClienteCliente;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel54;
    private javax.swing.JLabel jLabel55;
    private javax.swing.JLabel jLabel56;
    private javax.swing.JLabel jLabel57;
    private javax.swing.JLabel jLabel58;
    private javax.swing.JLabel jLabel59;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel60;
    private javax.swing.JLabel jLabel61;
    private javax.swing.JLabel jLabel62;
    private javax.swing.JLabel jLabel63;
    private javax.swing.JLabel jLabel64;
    private javax.swing.JLabel jLabel65;
    private javax.swing.JLabel jLabel66;
    private javax.swing.JLabel jLabel67;
    private javax.swing.JLabel jLabel68;
    private javax.swing.JLabel jLabel69;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel70;
    private javax.swing.JLabel jLabel71;
    private javax.swing.JLabel jLabel72;
    private javax.swing.JLabel jLabel73;
    private javax.swing.JLabel jLabel74;
    private javax.swing.JLabel jLabel75;
    private javax.swing.JLabel jLabel76;
    private javax.swing.JLabel jLabel77;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel_Producto_CP_Mensaje;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel30;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTabbedPane jTabbedPane4;
    private javax.swing.JTabbedPane jTabbedPane5;
    private javax.swing.JTabbedPane jTabbedPane6;
    private javax.swing.JTabbedPane jTabbedPane7;
    private javax.swing.JTabbedPane jTabbedPane8;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextFieldAbonoProveedor;
    private javax.swing.JTextField jTextFieldIdentificacionClienteReporte;
    private javax.swing.JTextField jTextFieldNitProveedores;
    private javax.swing.JTextField jTextFieldNombreProveedores;
    private javax.swing.JTextField jTextFieldNombreSaldoProveedores;
    private javax.swing.JTextField jTextField_BuscarFactura_Cliente;
    private javax.swing.JTextField jTextField_BuscarFactura_ID;
    private javax.swing.JTextField jTextField_Factura_Cliente_Id;
    private javax.swing.JTextField jTextField_Factura_Producto_Descripcion;
    private javax.swing.JTextField jTextField_Factura_Producto_Nombre;
    private javax.swing.JTextField jTextField_Producto_CP_descripcion;
    private javax.swing.JTextField jTextField_Producto_CP_nombre;
    private javax.swing.JTextField jTextField_Producto_CP_precio;
    private javax.swing.JTextField jTextField_Producto_CP_unidades;
    private javax.swing.JTextField jTextField_Producto_Con_Descripcion;
    private javax.swing.JTextField jTextField_Producto_Con_Nombre;
    private javax.swing.JTextField jTextField_Producto_Con_Unidades;
    private javax.swing.JTextField jTextField_valorCodigoBarrasNuevoProducto;
    private java.awt.Label label1;
    private javax.swing.JLabel mensajesBusquedaClientesFactura;
    private javax.swing.JTextField montoPrestamoNuevoCliente;
    private javax.swing.JTextField mostrarIDProveedor;
    private javax.swing.JTextField mostrarIdentificacionCliente;
    private javax.swing.JTextField nombreClienteBusqueda;
    private javax.swing.JTextField nombreClienteBusquedaSaldo;
    private javax.swing.JTextField nombreClienteCrearFactura;
    private javax.swing.JTextField nombreClienteReporteCliente;
    private javax.swing.JTextField nombreNuevoCliente;
    private javax.swing.JTextField nombreNuevoUsuario;
    private javax.swing.JLabel nombreProveedorAComprar;
    private javax.swing.JTextField passwordNuevoUsuario;
    private javax.swing.JSlider sliderNumeroUnidades;
    private javax.swing.JTable tablaMostrarCompras;
    private javax.swing.JTable tablaUsuariosDelSistema;
    private javax.swing.JTextField telefonoNuevoCliente;
    private javax.swing.JLabel textoNombreProveedor;
    private javax.swing.JLabel textoPersonaSaldo;
    private javax.swing.JLabel textoTotalDebe;
    private javax.swing.JLabel valorActualFactura;
    private javax.swing.JLabel valorActualPrestamo;
    private javax.swing.JTextField valorDireccionEmpresa;
    private javax.swing.JSpinner valorIVA;
    private javax.swing.JTextArea valorMensajeFinalFactura;
    private javax.swing.JTextField valorMontoFactura;
    private javax.swing.JTextField valorNIT;
    private javax.swing.JTextField valorRazonSocial;
    // End of variables declaration//GEN-END:variables
}