
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.Date;
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.
 */

/*
 * jfrmReintegro.java
 *
 * Created on 19-nov-2009, 13:20:35
 */

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

    JFrame auxJf;
    Sucursal sucAux = new Sucursal();
    /** Creates new form jfrmReintegro */
    public jfrmReintegro(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();
        jtxtConceptoReintegro = new javax.swing.JTextField();
        jtxtImporteReintegro = new javax.swing.JTextField();
        jtxtNumCuentaReintegro = new javax.swing.JTextField();
        jtxtRemitenteReintegro = new javax.swing.JTextField();
        jbtAceptarReintegro = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            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("Reintegro");

        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:");

        jbtAceptarReintegro.setFont(new java.awt.Font("Comic Sans MS", 0, 12));
        jbtAceptarReintegro.setText("Aceptar");
        jbtAceptarReintegro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtAceptarReintegroActionPerformed(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(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(198, 198, 198)
                        .add(jLabel1))
                    .add(layout.createSequentialGroup()
                        .add(90, 90, 90)
                        .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(120, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(168, 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(jtxtConceptoReintegro, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jtxtImporteReintegro, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jtxtNumCuentaReintegro, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jtxtRemitenteReintegro, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(126, 126, 126))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(402, Short.MAX_VALUE)
                .add(jbtAceptarReintegro)
                .add(237, 237, 237))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(20, 20, 20)
                        .add(label1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(25, 25, 25)
                        .add(jLabel1))
                    .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE))
                .add(47, 47, 47)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(jtxtRemitenteReintegro, 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(jtxtNumCuentaReintegro, 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(jtxtImporteReintegro, 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(jtxtConceptoReintegro, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(34, 34, 34)
                .add(jbtAceptarReintegro)
                .add(25, 25, 25))
        );

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

    private void jbtAceptarReintegroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtAceptarReintegroActionPerformed
        // TODO add your handling code here:
        Op_Basica op = new Op_Basica();

        op.setStRemitente(jtxtRemitenteReintegro.getText());
        op.setStCuentaCorriente(jtxtNumCuentaReintegro.getText());
        op.setStConcBreve(jtxtConceptoReintegro.getText());

        String stImporte = jtxtImporteReintegro.getText();
        DecimalFormat df = new DecimalFormat("#######,##");
        Number n = null;

        try {
            n = df.parse(stImporte);
        } catch (ParseException ex) {
            Logger.getLogger(jfrmReintegro.class.getName()).log(Level.SEVERE, null, ex);
        }
        op.setDImporte(n.doubleValue() * (-1));
        Date d = new Date();
        op.setDatOpe(d);

        sucAux.RegistraMovimiento(op);
    }//GEN-LAST:event_jbtAceptarReintegroActionPerformed

    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 jfrmReintegro().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 jbtAceptarReintegro;
    private javax.swing.JTextField jtxtConceptoReintegro;
    private javax.swing.JTextField jtxtImporteReintegro;
    private javax.swing.JTextField jtxtNumCuentaReintegro;
    private javax.swing.JTextField jtxtRemitenteReintegro;
    private java.awt.Label label1;
    // End of variables declaration//GEN-END:variables

}
