
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;

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

/*
 * jfrmIngreso.java
 *
 * Created on 19-nov-2009, 14:01:54
 */

/**
 *
 * @author Administrador
 */
public class jfrmIngreso extends javax.swing.JFrame {

    JFrame auxJf;
    Sucursal sucAux = new Sucursal();

    /** Creates new form jfrmIngreso */
    public jfrmIngreso(Sucursal suc,JFrame jf) {
        auxJf=jf;
        initComponents();
        sucAux = suc;
    }

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

        jLabel6 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        label1 = new java.awt.Label();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jtxtConceptoIngreso = new javax.swing.JTextField();
        jtxtImporteIngreso = new javax.swing.JTextField();
        jtxtNumCuentaIngreso = new javax.swing.JTextField();
        jtxtRemitenteIngreso = new javax.swing.JTextField();
        jbtAceptarIngreso = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/EstafadorLogo2.JPG"))); // NOI18N

        jLabel1.setFont(new java.awt.Font("Comic Sans MS", 1, 18));
        jLabel1.setText("Ingreso");

        label1.setFont(new java.awt.Font("Comic Sans MS", 1, 48));
        label1.setText("SwindlerBank");

        jLabel2.setFont(new java.awt.Font("Comic Sans MS", 0, 14));
        jLabel2.setText("Nº Cuenta:");

        jLabel3.setFont(new java.awt.Font("Comic Sans MS", 0, 14));
        jLabel3.setText("Importe:");

        jLabel4.setFont(new java.awt.Font("Comic Sans MS", 0, 14));
        jLabel4.setText("Concepto:");

        jLabel5.setFont(new java.awt.Font("Comic Sans MS", 0, 14));
        jLabel5.setText("Remitente:");

        jbtAceptarIngreso.setFont(new java.awt.Font("Comic Sans MS", 0, 12));
        jbtAceptarIngreso.setText("Aceptar");
        jbtAceptarIngreso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtAceptarIngresoActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(52, 52, 52)
                .add(jLabel6)
                .add(214, 214, 214)
                .add(jLabel1)
                .addContainerGap(239, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(287, Short.MAX_VALUE)
                .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(126, 126, 126))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(406, Short.MAX_VALUE)
                .add(jbtAceptarIngreso)
                .add(235, 235, 235))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(184, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel2)
                    .add(jLabel3)
                    .add(jLabel4)
                    .add(jLabel5))
                .add(53, 53, 53)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jtxtConceptoIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jtxtImporteIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jtxtNumCuentaIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jtxtRemitenteIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(112, 112, 112))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(8, 8, 8)
                        .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(22, 22, 22)
                        .add(jLabel1))
                    .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .add(34, 34, 34)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(jtxtRemitenteIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(jtxtNumCuentaIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(jtxtImporteIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(jtxtConceptoIngreso, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(37, 37, 37)
                .add(jbtAceptarIngreso)
                .add(24, 24, 24))
        );

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

    private void jbtAceptarIngresoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtAceptarIngresoActionPerformed
        // TODO add your handling code here:
        Op_Basica op = new Op_Basica();
            op.setStRemitente(jtxtRemitenteIngreso.getText());
            op.setStCuentaCorriente(jtxtNumCuentaIngreso.getText());
            op.setStConcepto(jtxtConceptoIngreso.getText());
            String stImporte = jtxtImporteIngreso.getText();
            DecimalFormat df = new DecimalFormat("#######,##");
            Number n = null;

        try {
            n = df.parse(stImporte);
        } catch (ParseException ex) {
            Logger.getLogger(jfrmIngreso.class.getName()).log(Level.SEVERE, null, ex);
        }
        op.setFImport(n.floatValue());
        
        sucAux.RegistraMovimiento(op);
}//GEN-LAST:event_jbtAceptarIngresoActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        // TODO add your handling code here:

    }//GEN-LAST:event_formWindowClosed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        auxJf.setEnabled(true);
    }//GEN-LAST:event_formWindowClosing

    /**
    * @param args the command line arguments
    */
   /* public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new jfrmIngreso().setVisible(true);
            }
        });
    }*/

    // 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.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JButton jbtAceptarIngreso;
    private javax.swing.JTextField jtxtConceptoIngreso;
    private javax.swing.JTextField jtxtImporteIngreso;
    private javax.swing.JTextField jtxtNumCuentaIngreso;
    private javax.swing.JTextField jtxtRemitenteIngreso;
    private java.awt.Label label1;
    // End of variables declaration//GEN-END:variables

}
