package vistas;

import bbuvajava.*;
import java.util.Observable;
import java.util.Observer;

    public class jfrmPrincipal extends javax.swing.JFrame  implements Observer {
    Sucursal Auxsuc;

    public jfrmPrincipal(Sucursal suc) {

        Auxsuc=new Sucursal();
        Auxsuc=suc;
        initComponents();
        Auxsuc.getActual().addObserver(this);
        String pon=new String();
        pon=String.valueOf(suc.getActual().getSaldo());
        jtxtsaldocaja.setText(pon);
    }



    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Label1 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jtxtsaldocaja = new javax.swing.JTextField();
        jMenuBar1 = new javax.swing.JMenuBar();
        MnewCuenta = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        Mtransferencia = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        MOPbasica = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        MCuentasCliente = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        Mdomicializaciones = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
        jMenuConsultarPartes = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem7 = new javax.swing.JMenuItem();
        jverempleados = new javax.swing.JMenuItem();
        arqueoempleado = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        Label1.setFont(new java.awt.Font("Tahoma", 0, 48));
        Label1.setForeground(new java.awt.Color(255, 0, 0));
        Label1.setText("BANCO BBUVA");

        jLabel1.setFont(new java.awt.Font("Arial Black", 0, 14));
        jLabel1.setText("Sor Guar Dos");

        jLabel2.setText("Saldo Actual de su Caja Asignada");

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

        MnewCuenta.setText("Cuentas");

        jMenuItem4.setText("Nueva Cuenta");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        MnewCuenta.add(jMenuItem4);

        jMenuItem8.setText("añadir titular a cuenta existente");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        MnewCuenta.add(jMenuItem8);

        jMenuBar1.add(MnewCuenta);

        jMenu1.setText("Operaciones");
        jMenu1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu1ActionPerformed(evt);
            }
        });

        Mtransferencia.setText("Realizar Transeferencia");
        Mtransferencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MtransferenciaActionPerformed(evt);
            }
        });
        jMenu1.add(Mtransferencia);

        jMenuItem2.setText("Realizar OPBasica");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        MOPbasica.setText("Realizar Remesa de Cargos");
        MOPbasica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MOPbasicaActionPerformed(evt);
            }
        });
        jMenu1.add(MOPbasica);

        jMenuItem3.setText("Realizar Remesa de Abonos");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Consultas");

        MCuentasCliente.setText("Cuentas de un Cliente");
        MCuentasCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MCuentasClienteActionPerformed(evt);
            }
        });
        jMenu2.add(MCuentasCliente);

        jMenuItem1.setText("Ultimos movimientos de un Cliente");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        Mdomicializaciones.setText("Consultar Domicializaciones");
        Mdomicializaciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MdomicializacionesActionPerformed(evt);
            }
        });
        jMenu2.add(Mdomicializaciones);

        jMenuItem5.setText("Titulares de una cuenta");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem5);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("GestionPuesto");
        jMenu3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu3ActionPerformed(evt);
            }
        });

        jMenuItem6.setText("Enviar/Recibir de CC");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem6);

        jRadioButtonMenuItem1.setSelected(true);
        jRadioButtonMenuItem1.setText("Arqueo final");
        jRadioButtonMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jRadioButtonMenuItem1);

        jMenuConsultarPartes.setText("Consultar Partes Diferencia");
        jMenuConsultarPartes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuConsultarPartesActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuConsultarPartes);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("GetionEmpleados");

        jMenuItem7.setText("crear empleado");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem7);

        jverempleados.setText("ver empleados");
        jverempleados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jverempleadosActionPerformed(evt);
            }
        });
        jMenu4.add(jverempleados);

        arqueoempleado.setText("Arqueos Realizados");
        arqueoempleado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                arqueoempleadoActionPerformed(evt);
            }
        });
        jMenu4.add(arqueoempleado);

        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(186, 186, 186)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(90, 90, 90)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(18, 18, 18)
                                .addComponent(jtxtsaldocaja, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(Label1))))
                .addContainerGap(69, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addComponent(Label1)
                .addGap(29, 29, 29)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jtxtsaldocaja, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29))
        );

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

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        new jfrmCrearProducto(Auxsuc).setVisible(true);

    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
        new jfrmTransferencia(Auxsuc).setVisible(true);

    }//GEN-LAST:event_jMenu1ActionPerformed
 
    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        new jfrmIngreso(Auxsuc).setVisible(true);
        
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void MOPbasicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MOPbasicaActionPerformed
        new jfrmRemesas(Auxsuc).setVisible(true);
}//GEN-LAST:event_MOPbasicaActionPerformed

    private void MtransferenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MtransferenciaActionPerformed
        new jfrmTransferencia(Auxsuc).setVisible(true);
    }//GEN-LAST:event_MtransferenciaActionPerformed

    private void MCuentasClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MCuentasClienteActionPerformed
        new jfrmCuentasCliente(Auxsuc).setVisible(true);
    }//GEN-LAST:event_MCuentasClienteActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
       new jfrmUltimosMovimientos(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void MdomicializacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MdomicializacionesActionPerformed
         new jfrmDomicializaciones(Auxsuc).setVisible(true);
    }//GEN-LAST:event_MdomicializacionesActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        new jfrmRemesaAbonos(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
        
    }//GEN-LAST:event_jMenu3ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        new jfrmCajaCentral(Auxsuc).setVisible(true);
        
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jRadioButtonMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem1ActionPerformed
        new jfrmArqueoFinal(Auxsuc).setVisible(true);
    
    }//GEN-LAST:event_jRadioButtonMenuItem1ActionPerformed

    private void jtxtsaldocajaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtsaldocajaActionPerformed
        jtxtsaldocaja.setText(String.valueOf(Auxsuc.getActual().getSaldo()));
    }//GEN-LAST:event_jtxtsaldocajaActionPerformed

    private void jMenuConsultarPartesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuConsultarPartesActionPerformed
        new jfrmConsultaParte(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jMenuConsultarPartesActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        new jfrmConsultaTitulares(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        new jfrmCreacionEmpleado(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jverempleadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jverempleadosActionPerformed
        new jfrmVerEmpleados(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jverempleadosActionPerformed

    private void arqueoempleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_arqueoempleadoActionPerformed
        new jfrmArqueosPorEmpleado(Auxsuc).setVisible(true);
    }//GEN-LAST:event_arqueoempleadoActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
         new jfrmAnadirTitular(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jMenuItem8ActionPerformed



   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Label1;
    private javax.swing.JMenuItem MCuentasCliente;
    private javax.swing.JMenuItem MOPbasica;
    private javax.swing.JMenuItem Mdomicializaciones;
    private javax.swing.JMenu MnewCuenta;
    private javax.swing.JMenuItem Mtransferencia;
    private javax.swing.JMenuItem arqueoempleado;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    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 jMenuConsultarPartes;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem1;
    private javax.swing.JTextField jtxtsaldocaja;
    private javax.swing.JMenuItem jverempleados;
    // End of variables declaration//GEN-END:variables

    public void update(Observable o, Object arg) {
        
        String pon=new String();
        pon=String.valueOf(Auxsuc.getActual().getSaldo());
        jtxtsaldocaja.setText(pon);
    }

}
