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

/*
 * FormularioPrincipal.java
 *
 * Created on 18-nov-2009, 19:35:12
 */

package interfaz;

import daial.Caja;
import daial.Producto;
import daial.Sucursal;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.DefaultListModel;

/**
 *
 * @author David
 */
public class jfrmPrincipal extends javax.swing.JFrame {
    private Sucursal s = new Sucursal();
    //private String cuentaActiva = "";
    private Producto cuentaActiva;
    private Caja caja_activa;
    private Caja caja_central;

    public jfrmPrincipal(Sucursal suc) {
        initComponents();
        this.setSize(605, 660);
        this.setLocationRelativeTo(null);


        s = suc;

        //caja_activa = caj;
    }

    /** Creates new form FormularioPrincipal */
    public jfrmPrincipal(Sucursal suc, Caja caj,Caja central) {
        initComponents();
        this.setSize(605, 660);
        this.setLocationRelativeTo(null);


        s = suc;
    
        caja_activa = caj;
        caja_central = central;
        jTxt_cajaActiva.setText(caja_activa.getNombre());
    }

    /** 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() {

        jTxt_nombre = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jTxt_ncuenta = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jCck_busquedaxnombre = new javax.swing.JCheckBox();
        jLabel3 = new javax.swing.JLabel();
        jBtn_Buscar = new javax.swing.JButton();
        jCck_busquedaxnumcuenta = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jTxt_saldoCA = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jlstCuentas = new javax.swing.JList();
        jBtn_Seleccionar = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jTxt_nombreCA = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel9 = new javax.swing.JLabel();
        jTxt_ncuentaCA = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTxt_cajaActiva = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu4 = new javax.swing.JMenu();
        jM_nuevacuenta = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jM_transf = new javax.swing.JMenuItem();
        jM_Ing = new javax.swing.JMenuItem();
        jM_reint = new javax.swing.JMenuItem();
        jM_rem = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jM_ult_mov = new javax.swing.JMenuItem();
        jM_domiciliaciones = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jM_arq_final = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Menu Principal - Banco Daial");
        setResizable(false);

        jTxt_nombre.setDisabledTextColor(new java.awt.Color(100, 100, 100));
        jTxt_nombre.setEnabled(false);
        jTxt_nombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTxt_nombreActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel1.setText("Nombre cliente: ");

        jTxt_ncuenta.setDisabledTextColor(new java.awt.Color(100, 100, 100));

        jLabel2.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel2.setText("Numero cuenta:");

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

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel3.setText("BUSQUEDA DE CUENTA BANCARIA");

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

        jCck_busquedaxnumcuenta.setSelected(true);
        jCck_busquedaxnumcuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCck_busquedaxnumcuentaActionPerformed(evt);
            }
        });

        jLabel4.setText("Introduzca el nombre de cliente o un numero de cuenta en el campo correspondiente:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel5.setText("Saldo:");

        jTxt_saldoCA.setBackground(new java.awt.Color(250, 250, 250));
        jTxt_saldoCA.setEditable(false);
        jTxt_saldoCA.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/interfaz/Banco Daial.jpg"))); // NOI18N

        jlstCuentas.setFont(new java.awt.Font("Tahoma", 0, 14));
        jlstCuentas.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(jlstCuentas);

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

        jLabel7.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel7.setText("Nombre Cliente: ");

        jTxt_nombreCA.setBackground(new java.awt.Color(250, 250, 250));
        jTxt_nombreCA.setEditable(false);

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel8.setText("DATOS DE CUENTA ACTIVA");

        jLabel9.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel9.setText("Numero Cuenta: ");

        jTxt_ncuentaCA.setBackground(new java.awt.Color(250, 250, 250));
        jTxt_ncuentaCA.setEditable(false);

        jLabel10.setFont(new java.awt.Font("Tahoma", 2, 11));
        jLabel10.setText("Caja Activa:");

        jTxt_cajaActiva.setEditable(false);
        jTxt_cajaActiva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTxt_cajaActivaActionPerformed(evt);
            }
        });

        jMenu4.setText("Creacion");

        jM_nuevacuenta.setText("Nueva Cuenta");
        jM_nuevacuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_nuevacuentaActionPerformed(evt);
            }
        });
        jMenu4.add(jM_nuevacuenta);

        jMenuBar1.add(jMenu4);

        jMenu1.setText("Movimientos");

        jM_transf.setText("Transferencia");
        jM_transf.setEnabled(false);
        jM_transf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_transfActionPerformed(evt);
            }
        });
        jMenu1.add(jM_transf);

        jM_Ing.setText("Ingreso");
        jM_Ing.setEnabled(false);
        jM_Ing.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_IngActionPerformed(evt);
            }
        });
        jMenu1.add(jM_Ing);

        jM_reint.setText("Reintegro");
        jM_reint.setEnabled(false);
        jM_reint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_reintActionPerformed(evt);
            }
        });
        jMenu1.add(jM_reint);

        jM_rem.setText("Remesa");
        jM_rem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_remActionPerformed(evt);
            }
        });
        jMenu1.add(jM_rem);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Consultas");

        jM_ult_mov.setText("Ultimos movimientos");
        jM_ult_mov.setEnabled(false);
        jM_ult_mov.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_ult_movActionPerformed(evt);
            }
        });
        jMenu2.add(jM_ult_mov);

        jM_domiciliaciones.setText("Domiciliaciones");
        jM_domiciliaciones.setEnabled(false);
        jM_domiciliaciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_domiciliacionesActionPerformed(evt);
            }
        });
        jMenu2.add(jM_domiciliaciones);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Caja");

        jM_arq_final.setText("Arqueo final");
        jM_arq_final.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_arq_finalActionPerformed(evt);
            }
        });
        jMenu3.add(jM_arq_final);

        jMenuItem10.setText("Ingreso caja central");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem10);

        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel6)
            .addGroup(layout.createSequentialGroup()
                .addGap(212, 212, 212)
                .addComponent(jLabel8))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(75, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel1)
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jTxt_ncuenta, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTxt_nombre))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(18, 18, 18)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(jCck_busquedaxnombre)
                                            .addGap(18, 18, 18)
                                            .addComponent(jBtn_Buscar))
                                        .addComponent(jCck_busquedaxnumcuenta)))
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(32, 32, 32)
                                    .addComponent(jBtn_Seleccionar))))
                        .addComponent(jLabel4))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(119, 119, 119)))
                .addGap(67, 67, 67))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 578, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(16, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(393, Short.MAX_VALUE)
                        .addComponent(jLabel10)
                        .addGap(18, 18, 18)
                        .addComponent(jTxt_cajaActiva, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(60, 60, 60)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTxt_ncuentaCA, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTxt_nombreCA)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(jTxt_saldoCA, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(58, 58, 58))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(26, 26, 26)
                        .addComponent(jLabel4)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(22, 22, 22)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTxt_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1))
                                .addGap(29, 29, 29)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTxt_ncuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2))
                                .addGap(6, 6, 6)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(jCck_busquedaxnombre)
                                .addGap(28, 28, 28)
                                .addComponent(jCck_busquedaxnumcuenta)
                                .addGap(56, 56, 56)
                                .addComponent(jBtn_Seleccionar))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(92, 92, 92)
                        .addComponent(jBtn_Buscar)))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(jTxt_nombreCA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(jTxt_ncuentaCA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(54, 54, 54)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTxt_saldoCA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 79, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jTxt_cajaActiva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        getAccessibleContext().setAccessibleDescription("Menu Principal - Banco Daial");

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

    private void jCck_busquedaxnombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCck_busquedaxnombreActionPerformed
        // TODO add your handling code here:
        jTxt_ncuenta.setEnabled(false);
        jCck_busquedaxnumcuenta.setSelected(false);
        jTxt_nombre.setEnabled(true);
}//GEN-LAST:event_jCck_busquedaxnombreActionPerformed


    public void actualizar_info()
    {
        //this.jBtn_BuscarActionPerformed(null);
        cuentaActiva = s.buscarCuenta(jTxt_ncuenta.getText());
        jTxt_saldoCA.setText(Double.toString(cuentaActiva.getSaldo()));
    }


    private void jBtn_BuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtn_BuscarActionPerformed
        Producto p = null;

        ArrayList<Producto> a;
        DefaultListModel dlm = new DefaultListModel();
        jlstCuentas.setModel(dlm);
        
        jTxt_nombreCA.setText("");
        jTxt_ncuentaCA.setText("");
        jTxt_saldoCA.setText("");

        cuentaActiva(false);

        int tipoBusqueda;//Busqueda por nombre => 1 ; Busqueda por numero cuenta => 2
        if(jTxt_ncuenta.isEnabled()){
            p = s.buscarCuenta(jTxt_ncuenta.getText());
            tipoBusqueda=2;
        }else{
            p = s.buscarCuenta(jTxt_nombre.getText());
            tipoBusqueda=1;
        }

        jTxt_ncuenta.setText("");

        if(p == null){
            jTxt_nombreCA.setText("NO EXISTE");
            jTxt_nombre.setText("");
            jTxt_ncuenta.setText("");
            jTxt_saldoCA.setText("0");
            jTxt_ncuentaCA.setText("NO EXISTE");
            cuentaActiva(false);
            dlm.clear();
        }
        else{
            jTxt_nombre.setText(p.getNombreCliente());           
            
            a = s.buscarCuentas(jTxt_nombre.getText());

            Iterator iterador = a.listIterator();

            while( iterador.hasNext() ) {
                Producto prod = (Producto) iterador.next();
                dlm.addElement(prod);      
            }
            if(tipoBusqueda==2){ //Si la busqueda es por numero de cuenta hace que
                cuentaActiva = p;
                jTxt_ncuenta.setText(cuentaActiva.getNumeroProducto());//sea la cuenta activa
                jTxt_saldoCA.setText(Double.toString(cuentaActiva.getSaldo()));//directamente
                jTxt_nombreCA.setText(cuentaActiva.getNombreCliente());//sin seleccionarla
                jTxt_ncuentaCA.setText(cuentaActiva.getNumeroProducto());//de la lista.
                cuentaActiva(true);
            }
        }
}//GEN-LAST:event_jBtn_BuscarActionPerformed

    private void jM_transfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_transfActionPerformed
        jfrmTransferencia jf_t= new jfrmTransferencia(this, s, cuentaActiva);
        setEnabled(false);
        jf_t.show();
}//GEN-LAST:event_jM_transfActionPerformed

    private void jCck_busquedaxnumcuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCck_busquedaxnumcuentaActionPerformed
        // TODO add your handling code here:
        jTxt_nombre.setEnabled(false);
        jCck_busquedaxnombre.setSelected(false);
        jTxt_ncuenta.setEnabled(true);
    }//GEN-LAST:event_jCck_busquedaxnumcuentaActionPerformed

    private void jM_remActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_remActionPerformed
        jfrmRemesa jf_rc= new jfrmRemesa(s,this);
        setEnabled(false);
        jf_rc.show();
    }//GEN-LAST:event_jM_remActionPerformed

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

    }//GEN-LAST:event_jTxt_nombreActionPerformed

    private void jM_IngActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_IngActionPerformed
        // Accion para el ingreso
        jfrmIngreso jf_ing = new jfrmIngreso(s,cuentaActiva.getNumeroProducto(),this, caja_activa);
        setEnabled(false);
        jf_ing.show();
    }//GEN-LAST:event_jM_IngActionPerformed

    private void jM_reintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_reintActionPerformed
        // TODO add your handling code here:
        jfrmReintegro jf_r = new jfrmReintegro(s,cuentaActiva.getNumeroProducto(),this, caja_activa);
        setEnabled(false);
        jf_r.show();
    }//GEN-LAST:event_jM_reintActionPerformed

    private void jM_ult_movActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_ult_movActionPerformed
     
        jfrmMovimientos jf_m = new jfrmMovimientos(s,cuentaActiva.getNumeroProducto(),this,caja_activa);
        setEnabled(false);
        jf_m.show();
}//GEN-LAST:event_jM_ult_movActionPerformed

    private void jM_domiciliacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_domiciliacionesActionPerformed
        // TODO add your handling code here:
        jfrmDomiciliaciones jf_d = new jfrmDomiciliaciones(s,cuentaActiva.getNumeroProducto(),this,caja_activa);
        setEnabled(false);
        jf_d.show();
    }//GEN-LAST:event_jM_domiciliacionesActionPerformed

    private void jBtn_SeleccionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtn_SeleccionarActionPerformed
        cuentaActiva = (Producto) jlstCuentas.getSelectedValue();
        jTxt_ncuenta.setText(cuentaActiva.getNumeroProducto());
        jTxt_saldoCA.setText(Double.toString(cuentaActiva.getSaldo()));
        jTxt_nombreCA.setText(cuentaActiva.getNombreCliente());
        jTxt_ncuentaCA.setText(cuentaActiva.getNumeroProducto());
        cuentaActiva(true);
    }//GEN-LAST:event_jBtn_SeleccionarActionPerformed

    private void jM_nuevacuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_nuevacuentaActionPerformed
        jfrmNuevaCuenta jf_nc = new jfrmNuevaCuenta(s,this,caja_activa);
        setEnabled(false);
        jf_nc.show();
    }//GEN-LAST:event_jM_nuevacuentaActionPerformed

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

    private void jM_arq_finalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_arq_finalActionPerformed
        jfrmArqFinal jf_af = new jfrmArqFinal(s,this,caja_activa);
        setEnabled(false);
        jf_af.show();
    }//GEN-LAST:event_jM_arq_finalActionPerformed

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem10ActionPerformed
        jfrmMovCajaCentral jf_mcc = new jfrmMovCajaCentral(s,this,caja_activa,caja_central);
        setEnabled(false);
        jf_mcc.show();
    }//GEN-LAST:event_jMenuItem10ActionPerformed

    private void cuentaActiva(boolean b){//Activa o desactiva los menus dependientes
        if (b){                         //de si hay o no una cuenta activa
            jM_Ing.setEnabled(true);
            jM_reint.setEnabled(true);
            jM_domiciliaciones.setEnabled(true);
            jM_ult_mov.setEnabled(true);
            jM_transf.setEnabled(true);
        }else{
            jM_Ing.setEnabled(false);
            jM_reint.setEnabled(false);
            jM_domiciliaciones.setEnabled(false);
            jM_ult_mov.setEnabled(false);
            jM_transf.setEnabled(false);
        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtn_Buscar;
    private javax.swing.JButton jBtn_Seleccionar;
    private javax.swing.JCheckBox jCck_busquedaxnombre;
    private javax.swing.JCheckBox jCck_busquedaxnumcuenta;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuItem jM_Ing;
    private javax.swing.JMenuItem jM_arq_final;
    private javax.swing.JMenuItem jM_domiciliaciones;
    private javax.swing.JMenuItem jM_nuevacuenta;
    private javax.swing.JMenuItem jM_reint;
    private javax.swing.JMenuItem jM_rem;
    private javax.swing.JMenuItem jM_transf;
    private javax.swing.JMenuItem jM_ult_mov;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField jTxt_cajaActiva;
    private javax.swing.JTextField jTxt_ncuenta;
    private javax.swing.JTextField jTxt_ncuentaCA;
    private javax.swing.JTextField jTxt_nombre;
    private javax.swing.JTextField jTxt_nombreCA;
    private javax.swing.JTextField jTxt_saldoCA;
    private javax.swing.JList jlstCuentas;
    // End of variables declaration//GEN-END:variables

}
