package javacgc;


import java.text.ParseException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JComboBox;
import javax.swing.ListSelectionModel;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JframeIngreso.java
 *
 * Created on 19-nov-2009, 12:46:47
 */

/**
 *
 */
public class JFramePrincipal extends javax.swing.JFrame {
        Sucursal auxS;
        Caja c;
    /** Creates new form JframeIngreso */
        public JFramePrincipal(Sucursal s,Caja ca) {

    /** Creates new form jfrmRemesaCargos */
        auxS=s;
        c=ca;
        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() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtxtdnicliente = new javax.swing.JTextField();
        jbttnbuscar = new javax.swing.JButton();
        jbttnseleccionar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jlstCuentas = new javax.swing.JList();
        jlblSeleccion = new javax.swing.JLabel();
        jbtnValidarDomicMov = new javax.swing.JButton();
        jrbDomic = new javax.swing.JRadioButton();
        jrbUltMov = new javax.swing.JRadioButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel3 = new javax.swing.JPanel();
        jlbldni = new javax.swing.JLabel();
        jtxtdni = new javax.swing.JTextField();
        jcbNuevaCuenta = new javax.swing.JCheckBox();
        jcbPrestamos = new javax.swing.JCheckBox();
        jbttnAceptar = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jbtnvalidar = new javax.swing.JButton();
        jlblingresar = new javax.swing.JLabel();
        jlbcantidad = new javax.swing.JLabel();
        jlblcuenta = new javax.swing.JLabel();
        jtxtcuenta = new javax.swing.JTextField();
        jtxtImporte = new javax.swing.JTextField();
        jlblsaldo = new javax.swing.JLabel();
        jlblsaldotot = new javax.swing.JLabel();
        jlblerror = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jtxtctaorigen = new javax.swing.JTextField();
        jtxtctadestino = new javax.swing.JTextField();
        jbttnValidarTrans = new javax.swing.JButton();
        jtxtcantidadtrans = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jlblremesa = new javax.swing.JLabel();
        jlblfichero = new javax.swing.JLabel();
        jtxtPathFicheroRemesa = new javax.swing.JTextField();
        jbtnImportar = new javax.swing.JButton();
        jarea = new javax.swing.JScrollPane();
        jtxaVerRemesa = new javax.swing.JTextArea();
        jbtnValidar = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel7 = new javax.swing.JPanel();
        jtxtSaldoCaja = new javax.swing.JTextField();
        jlblCantidad = new javax.swing.JLabel();
        jcheckEnviar = new javax.swing.JCheckBox();
        jcheckSolicitar = new javax.swing.JCheckBox();
        jbtnAceptar = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jlblcantidad = new javax.swing.JLabel();
        jbttnconfirmar = new javax.swing.JButton();
        jbttnNoconfirmar = new javax.swing.JButton();
        jbttnrealizarcuadre = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Introducir DNI cliente:");

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

        jbttnseleccionar.setText("Seleccionar");
        jbttnseleccionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbttnseleccionarActionPerformed(evt);
            }
        });

        jlstCuentas.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(jlstCuentas);

        jbtnValidarDomicMov.setText("Validar");
        jbtnValidarDomicMov.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnValidarDomicMovActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbDomic);
        jrbDomic.setText("Domiciliacion");
        jrbDomic.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbDomicActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbUltMov);
        jrbUltMov.setText("Ultimos Movimientos");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addGap(88, 88, 88)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jlblSeleccion)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jtxtdnicliente, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addGap(37, 37, 37)
                                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jbttnbuscar)
                                            .addComponent(jbttnseleccionar)))
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jrbUltMov)
                                            .addComponent(jrbDomic)
                                            .addGroup(jPanel5Layout.createSequentialGroup()
                                                .addGap(21, 21, 21)
                                                .addComponent(jbtnValidarDomicMov)))))))
                        .addGap(51, 51, 51))))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jlblSeleccion))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
                        .addGap(49, 49, 49)
                        .addComponent(jLabel1)
                        .addGap(30, 30, 30)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtxtdnicliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jbttnbuscar))
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGap(80, 80, 80)
                                .addComponent(jbttnseleccionar)
                                .addGap(18, 18, 18)
                                .addComponent(jrbDomic))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbUltMov)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbtnValidarDomicMov)
                .addContainerGap(40, Short.MAX_VALUE))
        );

        jTabbedPane2.addTab("Consultas", jPanel5);

        jlbldni.setText("Introduzca DNI del cliente :");

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

        buttonGroup1.add(jcbNuevaCuenta);
        jcbNuevaCuenta.setText("Nueva Cuenta");
        jcbNuevaCuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbNuevaCuentaActionPerformed(evt);
            }
        });

        buttonGroup1.add(jcbPrestamos);
        jcbPrestamos.setText("Nuevo Prestamos");

        jbttnAceptar.setText("Aceptar");
        jbttnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbttnAceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(164, 164, 164)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jcbNuevaCuenta)
                            .addComponent(jcbPrestamos)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(75, 75, 75)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jbttnAceptar)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jlbldni)
                                .addGap(34, 34, 34)
                                .addComponent(jtxtdni, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(43, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbldni)
                    .addComponent(jtxtdni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                .addComponent(jcbNuevaCuenta)
                .addGap(59, 59, 59)
                .addComponent(jcbPrestamos)
                .addGap(48, 48, 48)
                .addComponent(jbttnAceptar)
                .addGap(27, 27, 27))
        );

        jTabbedPane1.addTab("Contratar Producto", jPanel3);

        jbtnvalidar.setText("Validar");
        jbtnvalidar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnvalidarActionPerformed(evt);
            }
        });

        jlblingresar.setText("INGRESO / REINTEGRO");

        jlbcantidad.setText("Introduzca cantidad:");

        jlblcuenta.setText("Introduzca nº cuenta:");

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

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

        jlblsaldo.setText("Saldo actual: ");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(163, 163, 163)
                        .addComponent(jbtnvalidar))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jlbcantidad)
                            .addComponent(jlblcuenta)
                            .addComponent(jlblsaldo))
                        .addGap(30, 30, 30)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jlblsaldotot)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jtxtImporte, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE)
                                .addComponent(jlblingresar, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jtxtcuenta))
                            .addComponent(jlblerror))))
                .addContainerGap(177, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jlblingresar, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtcuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlblcuenta))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtImporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbcantidad))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtnvalidar)
                .addGap(40, 40, 40)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblsaldo)
                    .addComponent(jlblsaldotot))
                .addGap(66, 66, 66)
                .addComponent(jlblerror)
                .addContainerGap(73, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Ingreso/Reintegro", jPanel1);

        jLabel2.setText("Cuenta origen:");

        jLabel3.setText("Cuenta destino:");

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

        jbttnValidarTrans.setText("Validar");
        jbttnValidarTrans.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbttnValidarTransActionPerformed(evt);
            }
        });

        jLabel4.setText("Cantidad:");

        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(77, 77, 77)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))
                        .addGap(51, 51, 51))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(18, 18, 18)))
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(8, 8, 8)
                                .addComponent(jbttnValidarTrans))
                            .addComponent(jtxtctadestino, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
                            .addComponent(jtxtctaorigen, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(73, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jtxtcantidadtrans, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(64, 64, 64)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtctaorigen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtctadestino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGap(37, 37, 37)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtcantidadtrans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addGap(48, 48, 48)
                .addComponent(jbttnValidarTrans)
                .addContainerGap(79, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Transferencia", jPanel4);

        jlblremesa.setText("Tratamiento remesa de cargos");

        jlblfichero.setText("Fichero a tratar:");

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

        jbtnImportar.setText("Importar");
        jbtnImportar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnImportarActionPerformed(evt);
            }
        });

        jtxaVerRemesa.setColumns(20);
        jtxaVerRemesa.setRows(5);
        jarea.setViewportView(jtxaVerRemesa);

        jbtnValidar.setText("Validar");
        jbtnValidar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnValidarActionPerformed(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()
                        .addGap(21, 21, 21)
                        .addComponent(jlblfichero)
                        .addGap(33, 33, 33)
                        .addComponent(jtxtPathFicheroRemesa, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(167, 167, 167)
                        .addComponent(jlblremesa))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(219, 219, 219)
                        .addComponent(jbtnImportar))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(224, 224, 224)
                        .addComponent(jbtnValidar))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addComponent(jarea, javax.swing.GroupLayout.PREFERRED_SIZE, 436, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(57, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlblremesa)
                .addGap(41, 41, 41)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblfichero)
                    .addComponent(jtxtPathFicheroRemesa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
                .addComponent(jbtnImportar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jarea, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtnValidar)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Remesa", jPanel2);

        jTabbedPane2.addTab("Operaciones", jTabbedPane1);

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

        jlblCantidad.setText("Introduzca cantidad :");

        buttonGroup2.add(jcheckEnviar);
        jcheckEnviar.setText("Enviar a Caja Central");
        jcheckEnviar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcheckEnviarActionPerformed(evt);
            }
        });

        buttonGroup2.add(jcheckSolicitar);
        jcheckSolicitar.setText("Solicitar a Caja Central");

        jbtnAceptar.setText("Aceptar");
        jbtnAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAceptarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(67, 67, 67)
                .addComponent(jlblCantidad)
                .addGap(31, 31, 31)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jbtnAceptar)
                    .addComponent(jcheckSolicitar)
                    .addComponent(jtxtSaldoCaja, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcheckEnviar))
                .addContainerGap(128, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtSaldoCaja, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlblCantidad))
                .addGap(46, 46, 46)
                .addComponent(jcheckEnviar)
                .addGap(18, 18, 18)
                .addComponent(jcheckSolicitar)
                .addGap(52, 52, 52)
                .addComponent(jbtnAceptar)
                .addContainerGap(76, Short.MAX_VALUE))
        );

        jTabbedPane3.addTab("Modificar Saldo", jPanel7);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)
        );

        jTabbedPane2.addTab("Gestión Caja", jPanel6);

        jLabel5.setText("Confirme si esta cantidad es la correcta: ");

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

        jbttnNoconfirmar.setText("No confirmado");
        jbttnNoconfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbttnNoconfirmarActionPerformed(evt);
            }
        });

        jbttnrealizarcuadre.setText("Realizar Cuadre");
        jbttnrealizarcuadre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbttnrealizarcuadreActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(111, 111, 111)
                        .addComponent(jbttnconfirmar)
                        .addGap(88, 88, 88)
                        .addComponent(jbttnNoconfirmar))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(78, 78, 78)
                        .addComponent(jLabel5))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(188, 188, 188)
                        .addComponent(jbttnrealizarcuadre)))
                .addContainerGap(160, Short.MAX_VALUE))
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGap(269, 269, 269)
                    .addComponent(jlblcantidad)
                    .addContainerGap(270, Short.MAX_VALUE)))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jbttnrealizarcuadre)
                .addGap(31, 31, 31)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 163, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbttnconfirmar)
                    .addComponent(jbttnNoconfirmar))
                .addGap(78, 78, 78))
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGap(178, 178, 178)
                    .addComponent(jlblcantidad)
                    .addContainerGap(179, Short.MAX_VALUE)))
        );

        jTabbedPane2.addTab("Cuadre", jPanel8);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane2)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void jtxtImporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtImporteActionPerformed
        // TOD add your handling code here:
    }//GEN-LAST:event_jtxtImporteActionPerformed

    private void jbtnvalidarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnvalidarActionPerformed
        // TODO add your handling code here:
        Producto cta;
        cta=auxS.devuelveProducto(jtxtcuenta.getText()); 
        jlblerror.setText("");
        if(cta==null)
            jlblerror.setText("La cuenta indicada no existe. ");
        else {
        Double d= Double.valueOf(jtxtImporte.getText());
        if(cta.getSaldo()+d<0)
            jlblerror.setText("Insuficiente saldo para realizar el reintegro. ");
        else{
        cta.ingresoReintegro(d,c);
        String s=Double.toString(cta.getSaldo());
        jlblsaldotot.setText(s);
            }
             }
        
         


    }//GEN-LAST:event_jbtnvalidarActionPerformed

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

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

    private void jbtnImportarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnImportarActionPerformed
        String mensaje=auxS.verRemesa(jtxtPathFicheroRemesa.getText());
        jtxaVerRemesa.setText(mensaje);
}//GEN-LAST:event_jbtnImportarActionPerformed

    private void jbtnValidarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnValidarActionPerformed
        try {
            auxS.incorporarRemesa(jtxtPathFicheroRemesa.getText());
        } catch (ParseException ex) {
            Logger.getLogger(JFramePrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jbtnValidarActionPerformed

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

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

    private void jbttnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbttnAceptarActionPerformed
        // TODO add your handling code here:
        if(!jtxtdni.getText().isEmpty()){
        if (jcbNuevaCuenta.isSelected()){
        new JFrameNuevaCCorrienteLibreta(jtxtdni.getText(), auxS).setVisible(true);
        }
        else if (jcbPrestamos.isSelected()){
        new JFramePrestamoHipPersonal(jtxtdni.getText(),auxS).setVisible(true);
        }}
    }//GEN-LAST:event_jbttnAceptarActionPerformed

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

        ArrayList<Producto> a=auxS.busquedaProductosCliente(jtxtdnicliente.getText());
        if(a==null){jlblSeleccion.setText("No existe el cliente solicitado");}
        DefaultListModel dlm = new DefaultListModel();
        jlstCuentas.setModel(dlm);
        jlstCuentas.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        Iterator iterador = a.listIterator();
        
        while( iterador.hasNext() ) {
            Producto p = (Producto) iterador.next();
            dlm.addElement(p.getNumeroProducto()+"  "+p.getSaldo());
        }
    }//GEN-LAST:event_jbttnbuscarActionPerformed

    private void jbttnseleccionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbttnseleccionarActionPerformed
        // TODO add your handling code here:
        String cadena=(String) jlstCuentas.getSelectedValue();
        jlblSeleccion.setText(cadena.substring(0, 20));

    }//GEN-LAST:event_jbttnseleccionarActionPerformed

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

    private void jbttnValidarTransActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbttnValidarTransActionPerformed
        // TODO add your handling code here:
        Double c= Double.valueOf(jtxtcantidadtrans.getText());
        auxS.transferencia(jtxtctaorigen.getText(), jtxtctadestino.getText(), c);

    }//GEN-LAST:event_jbttnValidarTransActionPerformed

    private void jbtnValidarDomicMovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnValidarDomicMovActionPerformed
        if(jrbDomic.isSelected()){
                 new JFrameDomiciliacion(auxS.devuelveProducto(jlblSeleccion.getText()),auxS).setVisible(true);
                                 }
        else if(jrbUltMov.isSelected()){
            new JFrameUltimosMovimientos(auxS.devuelveProducto(jlblSeleccion.getText())).setVisible(true);
        }
    }//GEN-LAST:event_jbtnValidarDomicMovActionPerformed

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

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

    private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAceptarActionPerformed
        Double imp= Double.valueOf(jtxtSaldoCaja.getText());
        if(jcheckEnviar.isSelected()){
               auxS.modificarSaldoCaja(c, imp ,0);
                                     }
        else if(jcheckSolicitar.isSelected()){
               auxS.modificarSaldoCaja(c, imp, 1);
                                             }
    }//GEN-LAST:event_jbtnAceptarActionPerformed

    private void jbttnconfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbttnconfirmarActionPerformed
        
            c.arqueoFinal();
            new JFrameIdentificacion(auxS).setVisible(true);
}//GEN-LAST:event_jbttnconfirmarActionPerformed

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

        jlblcantidad.setText(String.valueOf(c.getSaldo()));
    }//GEN-LAST:event_jbttnrealizarcuadreActionPerformed

    private void jbttnNoconfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbttnNoconfirmarActionPerformed
       Arqueo arq=c.arqueoFinal();
        new jfrmParteDif(c,auxS,arq).setVisible(true);
    }//GEN-LAST:event_jbttnNoconfirmarActionPerformed

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

    /**
    * @param args the command line arguments
    */
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JScrollPane jarea;
    private javax.swing.JButton jbtnAceptar;
    private javax.swing.JButton jbtnImportar;
    private javax.swing.JButton jbtnValidar;
    private javax.swing.JButton jbtnValidarDomicMov;
    private javax.swing.JButton jbtnvalidar;
    private javax.swing.JButton jbttnAceptar;
    private javax.swing.JButton jbttnNoconfirmar;
    private javax.swing.JButton jbttnValidarTrans;
    private javax.swing.JButton jbttnbuscar;
    private javax.swing.JButton jbttnconfirmar;
    private javax.swing.JButton jbttnrealizarcuadre;
    private javax.swing.JButton jbttnseleccionar;
    private javax.swing.JCheckBox jcbNuevaCuenta;
    private javax.swing.JCheckBox jcbPrestamos;
    private javax.swing.JCheckBox jcheckEnviar;
    private javax.swing.JCheckBox jcheckSolicitar;
    private javax.swing.JLabel jlbcantidad;
    private javax.swing.JLabel jlblCantidad;
    private javax.swing.JLabel jlblSeleccion;
    private javax.swing.JLabel jlblcantidad;
    private javax.swing.JLabel jlblcuenta;
    private javax.swing.JLabel jlbldni;
    private javax.swing.JLabel jlblerror;
    private javax.swing.JLabel jlblfichero;
    private javax.swing.JLabel jlblingresar;
    private javax.swing.JLabel jlblremesa;
    private javax.swing.JLabel jlblsaldo;
    private javax.swing.JLabel jlblsaldotot;
    private javax.swing.JList jlstCuentas;
    private javax.swing.JRadioButton jrbDomic;
    private javax.swing.JRadioButton jrbUltMov;
    private javax.swing.JTextArea jtxaVerRemesa;
    private javax.swing.JTextField jtxtImporte;
    private javax.swing.JTextField jtxtPathFicheroRemesa;
    private javax.swing.JTextField jtxtSaldoCaja;
    private javax.swing.JTextField jtxtcantidadtrans;
    private javax.swing.JTextField jtxtctadestino;
    private javax.swing.JTextField jtxtctaorigen;
    private javax.swing.JTextField jtxtcuenta;
    private javax.swing.JTextField jtxtdni;
    private javax.swing.JTextField jtxtdnicliente;
    // End of variables declaration//GEN-END:variables

}
