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

/*
 * jfrPrincipal.java
 *
 * Created on 27-nov-2009, 13:11:34
 */

package Vistas;

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

/**
 *
 * @author Ro
 */
public class jfrmPrincipal extends javax.swing.JFrame  implements Observer {

    Sucursal AuxSuc;
    Caja AuxCa;
    /** Creates new form jfrPrincipal */
    public jfrmPrincipal(Sucursal s,Caja c) {
        AuxSuc=s;
        AuxCa=c;
        initComponents();
        jlblSaldoCaja.setText(String.valueOf(c.getSaldoFinal()));
    }

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

        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jlblSaldoCaja = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jmnOperaciones = new javax.swing.JMenu();
        jmiIngreso = new javax.swing.JMenuItem();
        jmiReintegro = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jmiTransferencia = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jmiRemesaC = new javax.swing.JMenuItem();
        jmiRemesaAbonos = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jmiNuevoTitular = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JSeparator();
        jmiAperturaCuenta = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JSeparator();
        jmiAperturaPrestamo = new javax.swing.JMenuItem();
        jmnConsultas = new javax.swing.JMenu();
        jmiUltimosMovimientos = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JSeparator();
        jmiConsCuentasClte = new javax.swing.JMenuItem();
        jmiClientesdeProducto = new javax.swing.JMenuItem();
        jSeparator8 = new javax.swing.JSeparator();
        jmiDomiciCuenta = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JSeparator();
        jmiParteDiferencia = new javax.swing.JMenuItem();
        jSeparator9 = new javax.swing.JSeparator();
        jmiRemesaTrans = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jmiCreaEmpleado = new javax.swing.JMenuItem();
        jmiVerEmpleados = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jmiIngresoCentral = new javax.swing.JMenuItem();
        jmiReintegroCentral = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JSeparator();
        jmiArqueoFinal = new javax.swing.JMenuItem();

        jMenu1.setText("File");
        jMenuBar2.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar2.add(jMenu2);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel3.setFont(new java.awt.Font("Papyrus", 1, 36));
        jLabel3.setForeground(new java.awt.Color(0, 0, 102));
        jLabel3.setText("Banco ALROMA");

        jLabel1.setFont(new java.awt.Font("Papyrus", 0, 14));
        jLabel1.setText("Saldo en Caja");

        jlblSaldoCaja.setFont(new java.awt.Font("Papyrus", 1, 18));
        jlblSaldoCaja.setForeground(new java.awt.Color(0, 153, 51));

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

        jmiIngreso.setText("Ingreso");
        jmiIngreso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiIngresoActionPerformed(evt);
            }
        });
        jmnOperaciones.add(jmiIngreso);

        jmiReintegro.setText("Reintegro");
        jmiReintegro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiReintegroActionPerformed(evt);
            }
        });
        jmnOperaciones.add(jmiReintegro);
        jmnOperaciones.add(jSeparator2);

        jmiTransferencia.setText("Transferencia");
        jmiTransferencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiTransferenciaActionPerformed(evt);
            }
        });
        jmnOperaciones.add(jmiTransferencia);
        jmnOperaciones.add(jSeparator1);

        jmiRemesaC.setText("Remesa cargos");
        jmiRemesaC.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiRemesaCActionPerformed(evt);
            }
        });
        jmnOperaciones.add(jmiRemesaC);

        jmiRemesaAbonos.setText("Remesa abonos");
        jmiRemesaAbonos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiRemesaAbonosActionPerformed(evt);
            }
        });
        jmnOperaciones.add(jmiRemesaAbonos);

        jMenuBar1.add(jmnOperaciones);

        jMenu4.setText("Contrataciones");
        jMenu4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu4ActionPerformed(evt);
            }
        });

        jmiNuevoTitular.setText("Inserta Nuevo Titular");
        jMenu4.add(jmiNuevoTitular);
        jMenu4.add(jSeparator5);

        jmiAperturaCuenta.setText("Apertura Cuenta o Libreta");
        jmiAperturaCuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiAperturaCuentaActionPerformed(evt);
            }
        });
        jMenu4.add(jmiAperturaCuenta);
        jMenu4.add(jSeparator4);

        jmiAperturaPrestamo.setText("Apertura Prestamo Personal o Hipotecario");
        jmiAperturaPrestamo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiAperturaPrestamoActionPerformed(evt);
            }
        });
        jMenu4.add(jmiAperturaPrestamo);

        jMenuBar1.add(jMenu4);

        jmnConsultas.setText("Consultas");

        jmiUltimosMovimientos.setText("Ultimos Movimientos");
        jmiUltimosMovimientos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiUltimosMovimientosActionPerformed(evt);
            }
        });
        jmnConsultas.add(jmiUltimosMovimientos);
        jmnConsultas.add(jSeparator7);

        jmiConsCuentasClte.setText("Productos de un cliente");
        jmiConsCuentasClte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiConsCuentasClteActionPerformed(evt);
            }
        });
        jmnConsultas.add(jmiConsCuentasClte);

        jmiClientesdeProducto.setText("Clientes de un Producto");
        jmiClientesdeProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiClientesdeProductoActionPerformed(evt);
            }
        });
        jmnConsultas.add(jmiClientesdeProducto);
        jmnConsultas.add(jSeparator8);

        jmiDomiciCuenta.setText("Domiciliaciones de una Cuenta");
        jmiDomiciCuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiDomiciCuentaActionPerformed(evt);
            }
        });
        jmnConsultas.add(jmiDomiciCuenta);
        jmnConsultas.add(jSeparator3);

        jmiParteDiferencia.setText("Partes de Diferencia");
        jmiParteDiferencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiParteDiferenciaActionPerformed(evt);
            }
        });
        jmnConsultas.add(jmiParteDiferencia);
        jmnConsultas.add(jSeparator9);

        jmiRemesaTrans.setText("Remesa Transferencias");
        jmiRemesaTrans.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiRemesaTransActionPerformed(evt);
            }
        });
        jmnConsultas.add(jmiRemesaTrans);

        jMenuBar1.add(jmnConsultas);

        jMenu5.setText("Empleado");

        jmiCreaEmpleado.setText("Crear Empleado");
        jmiCreaEmpleado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiCreaEmpleadoActionPerformed(evt);
            }
        });
        jMenu5.add(jmiCreaEmpleado);

        jmiVerEmpleados.setText("Ver Empleados");
        jmiVerEmpleados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiVerEmpleadosActionPerformed(evt);
            }
        });
        jMenu5.add(jmiVerEmpleados);

        jMenuBar1.add(jMenu5);

        jMenu3.setText("Caja");

        jmiIngresoCentral.setText("Ingreso Caja Central");
        jmiIngresoCentral.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiIngresoCentralActionPerformed(evt);
            }
        });
        jMenu3.add(jmiIngresoCentral);

        jmiReintegroCentral.setText("Pedir dinero Caja Central");
        jmiReintegroCentral.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiReintegroCentralActionPerformed(evt);
            }
        });
        jMenu3.add(jmiReintegroCentral);
        jMenu3.add(jSeparator6);

        jmiArqueoFinal.setText("Arqueo Final");
        jmiArqueoFinal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiArqueoFinalActionPerformed(evt);
            }
        });
        jMenu3.add(jmiArqueoFinal);

        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)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(179, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(28, 28, 28)
                        .addComponent(jlblSaldoCaja, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(171, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblSaldoCaja, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

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

    private void jmiRemesaCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiRemesaCActionPerformed
        this.setEnabled(false);
        new jfrmRemesaCargos(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiRemesaCActionPerformed

    private void jmiReintegroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiReintegroActionPerformed
        this.setEnabled(false);
        jfrmIngresoReintegro ir = new jfrmIngresoReintegro(AuxSuc,AuxCa,this);
        AuxCa.addObserver(ir);
        ir.setVisible(true);
    }//GEN-LAST:event_jmiReintegroActionPerformed

    private void jmiIngresoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiIngresoActionPerformed
        this.setEnabled(false);
        jfrmIngresoReintegro ir = new jfrmIngresoReintegro(AuxSuc,AuxCa,this);
        AuxCa.addObserver(ir);
        ir.setVisible(true);
    }//GEN-LAST:event_jmiIngresoActionPerformed

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

    private void jmiTransferenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiTransferenciaActionPerformed
        this.setEnabled(false);
        new jfrmTransferencias(AuxSuc,this).setVisible(true);
}//GEN-LAST:event_jmiTransferenciaActionPerformed

    private void jmiUltimosMovimientosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiUltimosMovimientosActionPerformed
        this.setEnabled(false);
        new jfrmUltimosMovimientos(AuxSuc,this).setVisible(true);
}//GEN-LAST:event_jmiUltimosMovimientosActionPerformed

    private void jmiConsCuentasClteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiConsCuentasClteActionPerformed
        this.setEnabled(false);
        new jfrmCuentasCliente(AuxSuc,this).setVisible(true);
}//GEN-LAST:event_jmiConsCuentasClteActionPerformed

    private void jmiAperturaCuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiAperturaCuentaActionPerformed
        this.setEnabled(false);
        new jfrmAperturaCuenta(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiAperturaCuentaActionPerformed

    private void jmiArqueoFinalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiArqueoFinalActionPerformed
        this.setEnabled(false);
        new jfrmArqueoFinal(AuxSuc,AuxCa,this).setVisible(true);
        this.dispose();
    }//GEN-LAST:event_jmiArqueoFinalActionPerformed

    private void jmiRemesaAbonosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiRemesaAbonosActionPerformed
        this.setEnabled(false);
        new jfrmRemesaAbonos(AuxSuc,this).setVisible(true);
}//GEN-LAST:event_jmiRemesaAbonosActionPerformed

    private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed
        this.setEnabled(false);
        new jfrmNuevoTitular(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jMenu4ActionPerformed

    private void jmiAperturaPrestamoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiAperturaPrestamoActionPerformed
        this.setEnabled(false);
        new jfrmNuevoTitular(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiAperturaPrestamoActionPerformed

    private void jmiClientesdeProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiClientesdeProductoActionPerformed
        this.setEnabled(false);
        new jfrmClientesdeProducto(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiClientesdeProductoActionPerformed

    private void jmiIngresoCentralActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiIngresoCentralActionPerformed
        this.setEnabled(false);
        jfrmIngresoCentral ic = new jfrmIngresoCentral(AuxSuc,AuxCa,this);
        AuxCa.addObserver(ic);
        ic.setVisible(true);
}//GEN-LAST:event_jmiIngresoCentralActionPerformed

    private void jmiReintegroCentralActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiReintegroCentralActionPerformed
        this.setEnabled(false);
        jfrmIngresoCentral ic = new jfrmIngresoCentral(AuxSuc,AuxCa,this);
        AuxCa.addObserver(ic);
        ic.setVisible(true);
}//GEN-LAST:event_jmiReintegroCentralActionPerformed

    private void jmiDomiciCuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiDomiciCuentaActionPerformed
        this.setEnabled(false);
        new jfrmDomiciCuentas(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiDomiciCuentaActionPerformed

    private void jmiParteDiferenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiParteDiferenciaActionPerformed
        this.setEnabled(false);
        new jfrmParteDiferencia(AuxCa,AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiParteDiferenciaActionPerformed

    private void jmiRemesaTransActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiRemesaTransActionPerformed
        this.setEnabled(false);
        new jfrmRemesaTrans(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiRemesaTransActionPerformed

    private void jmiCreaEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiCreaEmpleadoActionPerformed
        this.setEnabled(false);
        new jfrmCreaEmpleado(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiCreaEmpleadoActionPerformed

    private void jmiVerEmpleadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiVerEmpleadosActionPerformed
        this.setEnabled(false);
        new jfrmMuestraEmpleado(AuxSuc,this).setVisible(true);
    }//GEN-LAST:event_jmiVerEmpleadosActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JSeparator jSeparator7;
    private javax.swing.JSeparator jSeparator8;
    private javax.swing.JSeparator jSeparator9;
    private javax.swing.JLabel jlblSaldoCaja;
    private javax.swing.JMenuItem jmiAperturaCuenta;
    private javax.swing.JMenuItem jmiAperturaPrestamo;
    private javax.swing.JMenuItem jmiArqueoFinal;
    private javax.swing.JMenuItem jmiClientesdeProducto;
    private javax.swing.JMenuItem jmiConsCuentasClte;
    private javax.swing.JMenuItem jmiCreaEmpleado;
    private javax.swing.JMenuItem jmiDomiciCuenta;
    private javax.swing.JMenuItem jmiIngreso;
    private javax.swing.JMenuItem jmiIngresoCentral;
    private javax.swing.JMenuItem jmiNuevoTitular;
    private javax.swing.JMenuItem jmiParteDiferencia;
    private javax.swing.JMenuItem jmiReintegro;
    private javax.swing.JMenuItem jmiReintegroCentral;
    private javax.swing.JMenuItem jmiRemesaAbonos;
    private javax.swing.JMenuItem jmiRemesaC;
    private javax.swing.JMenuItem jmiRemesaTrans;
    private javax.swing.JMenuItem jmiTransferencia;
    private javax.swing.JMenuItem jmiUltimosMovimientos;
    private javax.swing.JMenuItem jmiVerEmpleados;
    private javax.swing.JMenu jmnConsultas;
    private javax.swing.JMenu jmnOperaciones;
    // End of variables declaration//GEN-END:variables

    public void update(Observable o, Object arg) {
        jlblSaldoCaja.setText(String.valueOf(AuxCa.getSaldoFinal()));
    }
}
