package bbuvajava;

public class jfrmArqueoFinal extends javax.swing.JFrame {
    Sucursal Auxsuc;
 
    public jfrmArqueoFinal(Sucursal suc) {
        Auxsuc=new Sucursal();
        Auxsuc=suc;
        initComponents();

    }

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

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jtxtsaldofinal = new javax.swing.JTextField();
        jbconfirmar = new javax.swing.JButton();
        jbParte = new javax.swing.JButton();
        jtxtdni = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jbidentificar = new javax.swing.JButton();
        jtxtdespedida = new javax.swing.JTextField();

        jLabel1.setText("ARQUEO FINAL");

        jLabel2.setText("SALDO DE LA CAJA");

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

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

        jbParte.setText("Parte diferencia");
        jbParte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbParteActionPerformed(evt);
            }
        });

        jtxtdni.setText("48944103");

        jLabel3.setText("DNI EMPLEADO");

        jbidentificar.setText("Identificar");
        jbidentificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbidentificarActionPerformed(evt);
            }
        });

        jtxtdespedida.setEditable(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(61, 61, 61)
                .addComponent(jbconfirmar, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(55, 55, 55)
                .addComponent(jbParte)
                .addContainerGap(68, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(37, 37, 37))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jbidentificar, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                    .addComponent(jtxtsaldofinal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
                    .addComponent(jtxtdni, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE))
                .addGap(128, 128, 128))
            .addGroup(layout.createSequentialGroup()
                .addGap(92, 92, 92)
                .addComponent(jtxtdespedida, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(85, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(153, 153, 153)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(168, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLabel1)
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtdni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jbidentificar)
                .addGap(9, 9, 9)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtsaldofinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbconfirmar)
                    .addComponent(jbParte))
                .addGap(18, 18, 18)
                .addComponent(jtxtdespedida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(42, 42, 42))
        );

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

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

    }//GEN-LAST:event_jtxtsaldofinalActionPerformed

    private void jbconfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbconfirmarActionPerformed
        jtxtdespedida.setText("gracias. Hasta mañana!!!");
    }//GEN-LAST:event_jbconfirmarActionPerformed

    private void jbidentificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbidentificarActionPerformed
        String dni=jtxtdni.getText();
        if(Auxsuc.getEmpleado(dni)==null)
            jtxtdni.setText("ese empleado no es correcto");
        else{
            if(Auxsuc.getEmpleado(dni).getCaj().getArqueo()!=null){
            
            String auxsaldo=String.valueOf(Auxsuc.getEmpleado(dni).getCaj().get_Arqueo().getSaldofin());
            //auxsuc.getEmpleado(dni).getCaj().RealizarArqueo();
            jtxtsaldofinal.setText(auxsaldo);
            }
            else jtxtsaldofinal.setText("No hay ningun arqueo realizado");

        }

    }//GEN-LAST:event_jbidentificarActionPerformed

    private void jbParteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbParteActionPerformed
       new jfrmParteDiferencia(Auxsuc).setVisible(true);
    }//GEN-LAST:event_jbParteActionPerformed

   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JButton jbParte;
    private javax.swing.JButton jbconfirmar;
    private javax.swing.JButton jbidentificar;
    private javax.swing.JTextField jtxtdespedida;
    private javax.swing.JTextField jtxtdni;
    private javax.swing.JTextField jtxtsaldofinal;
    // End of variables declaration//GEN-END:variables

}
