com.app.ventas.Produccion.java Source code

Java tutorial

Introduction

Here is the source code for com.app.ventas.Produccion.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.app.ventas;

import com.entidades.MtSucursales;
import com.entidades.MtArticulos;
import com.entidades.PrProduc;
import com.entidades.StExistenciaSuc;
import static java.awt.event.KeyEvent.VK_F9;
import java.io.File;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JRDesignQuery;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.view.JasperViewer;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import util.FormatearNumero;
import util.HibernateUtil;

/**
 *
 * @author vanessa
 */
public class Produccion extends javax.swing.JDialog {

    private Session st;
    private List<MtSucursales> sucursales;
    private List<PrProduc> produccion;
    private String sucursal;
    private String usuario;
    private DefaultTableModel model;
    SQLQuery query;

    /**
     * Creates new form ComandaPedido
     */
    public Produccion(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        hibernateSession();
        initComponents();
        deshabilitarCampos();
        cargarComboSucursal();

    }

    private void hibernateSession() {
        st = HibernateUtil.getSessionFactory().openSession();
    }

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

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        tablaListaProduccion = new javax.swing.JTable();
        jPanel3 = new javax.swing.JPanel();
        botonNuevo = new javax.swing.JButton();
        botonGuardar = new javax.swing.JButton();
        botonEditar = new javax.swing.JButton();
        botonBorrar = new javax.swing.JButton();
        botonCancelar = new javax.swing.JButton();
        botonBuscar = new javax.swing.JButton();
        botonInforme = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        txtFechaHora = new javax.swing.JTextField();
        txtCodUsuario = new javax.swing.JTextField();
        txtNomUsuario = new javax.swing.JTextField();
        panArticulo = new javax.swing.JPanel();
        botonQuitar = new javax.swing.JButton();
        botonAgregar = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        comboSucursal = new javax.swing.JComboBox();
        jLabel22 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        textFechaElab = new javax.swing.JTextField();
        textFechaVto = new javax.swing.JTextField();
        textRefComanda = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        comboEstadoPedido = new javax.swing.JComboBox();
        textCodArticulo = new javax.swing.JTextField();
        textDescripcionArticulo = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        textCantidad = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        comboLote = new javax.swing.JComboBox();
        textCodProduccion = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();

        jTable1.setModel(
                new javax.swing.table.DefaultTableModel(
                        new Object[][] { { null, null, null, null }, { null, null, null, null },
                                { null, null, null, null }, { null, null, null, null } },
                        new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
        jScrollPane1.setViewportView(jTable1);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        tablaListaProduccion.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Cod Produccion", "Cod Articulo", "Cantidad", "Descripcion", "Fecha Elab", "Fecha Vto",
                "Sucursal", "Ref Comanda", "Estado Pedido", "Lote" }) {
            boolean[] canEdit = new boolean[] { true, false, false, false, true, true, false, true, true, true };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        jScrollPane2.setViewportView(tablaListaProduccion);

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        botonNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/New.png"))); // NOI18N
        botonNuevo.setToolTipText("Nuevo");
        botonNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonNuevoActionPerformed(evt);
            }
        });

        botonGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Save.png"))); // NOI18N
        botonGuardar.setToolTipText("Guardar");
        botonGuardar.setEnabled(false);
        botonGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonGuardarActionPerformed(evt);
            }
        });

        botonEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/edit.png"))); // NOI18N
        botonEditar.setToolTipText("Editar");
        botonEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonEditarActionPerformed(evt);
            }
        });

        botonBorrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Trashcan_empty.png"))); // NOI18N
        botonBorrar.setToolTipText("Borrar");
        botonBorrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBorrarActionPerformed(evt);
            }
        });

        botonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/cancel32.png"))); // NOI18N
        botonCancelar.setToolTipText("Cancelar");
        botonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCancelarActionPerformed(evt);
            }
        });

        botonBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Search (2).png"))); // NOI18N
        botonBuscar.setToolTipText("Buscar");
        botonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonBuscarActionPerformed(evt);
            }
        });

        botonInforme.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Tasks.png"))); // NOI18N
        botonInforme.setToolTipText("Informe");
        botonInforme.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        botonInforme.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        botonInforme.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonInformeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout
                .setHorizontalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup().addGap(3, 3, 3)
                                .addComponent(botonNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonBorrar, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonInforme, javax.swing.GroupLayout.PREFERRED_SIZE, 40,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(11, Short.MAX_VALUE)));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addGap(3, 3, 3)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addGroup(jPanel3Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(botonNuevo, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(botonBuscar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addGap(38, 38, 38))
                                .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(botonCancelar, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(botonBorrar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(botonGuardar, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(botonEditar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(botonInforme, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addGap(0, 0, Short.MAX_VALUE)))));

        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        txtFechaHora.setEditable(false);
        txtFechaHora.setBackground(new java.awt.Color(204, 255, 255));
        txtFechaHora.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtFechaHora.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        txtCodUsuario.setEditable(false);
        txtCodUsuario.setBackground(new java.awt.Color(204, 255, 255));
        txtCodUsuario.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtCodUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCodUsuarioActionPerformed(evt);
            }
        });

        txtNomUsuario.setEditable(false);
        txtNomUsuario.setBackground(new java.awt.Color(204, 255, 255));
        txtNomUsuario.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtNomUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNomUsuarioActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout
                .setHorizontalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap()
                                .addComponent(txtCodUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 65,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(3, 3, 3)
                                .addComponent(txtNomUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtFechaHora, javax.swing.GroupLayout.PREFERRED_SIZE, 126,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtFechaHora, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(txtCodUsuario, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(txtNomUsuario, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap()));

        panArticulo.setBorder(
                javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder()));

        botonQuitar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/quitar.png"))); // NOI18N
        botonQuitar.setToolTipText("Quitar de la lista");
        botonQuitar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonQuitarActionPerformed(evt);
            }
        });

        botonAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Select.png"))); // NOI18N
        botonAgregar.setToolTipText("Agregar a lista");
        botonAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAgregarActionPerformed(evt);
            }
        });

        jLabel14.setText("Sucursal:");

        comboSucursal.setModel(
                new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel22.setText("Fecha Elaboracion");

        jLabel3.setText("Ref. Comanda");

        textFechaElab.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textFechaElab.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        textFechaElab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textFechaElabActionPerformed(evt);
            }
        });
        textFechaElab.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textFechaElabFocusLost(evt);
            }
        });
        textFechaElab.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                textFechaElabKeyPressed(evt);
            }
        });

        textFechaVto.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textFechaVto.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        textFechaVto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textFechaVtoActionPerformed(evt);
            }
        });
        textFechaVto.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textFechaVtoFocusLost(evt);
            }
        });
        textFechaVto.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                textFechaVtoKeyPressed(evt);
            }
        });

        textRefComanda.setEditable(false);
        textRefComanda.setBackground(new java.awt.Color(255, 255, 255));
        textRefComanda.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textRefComanda.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel23.setText("Fecha Vencimiento");

        jLabel25.setText("Estado Pedido:");

        comboEstadoPedido.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "P", "C" }));
        comboEstadoPedido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboEstadoPedidoActionPerformed(evt);
            }
        });

        textCodArticulo.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textCodArticulo.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        textCodArticulo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodArticuloActionPerformed(evt);
            }
        });
        textCodArticulo.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textCodArticuloFocusLost(evt);
            }
        });
        textCodArticulo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                textCodArticuloKeyPressed(evt);
            }
        });

        textDescripcionArticulo.setEditable(false);
        textDescripcionArticulo.setBackground(new java.awt.Color(255, 255, 255));
        textDescripcionArticulo.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textDescripcionArticulo.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        jLabel15.setText("Cd. Articulo");

        jLabel2.setText("Descripcion Articulo");

        jLabel21.setText("Cantidad");

        textCantidad.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textCantidad.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        textCantidad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCantidadActionPerformed(evt);
            }
        });
        textCantidad.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textCantidadFocusLost(evt);
            }
        });
        textCantidad.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                textCantidadKeyPressed(evt);
            }
        });

        jLabel26.setText("Lote:");

        comboLote.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "S", "N" }));
        comboLote.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboLoteActionPerformed(evt);
            }
        });

        textCodProduccion.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textCodProduccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodProduccionActionPerformed(evt);
            }
        });

        jLabel5.setText("Cod Produccion");

        javax.swing.GroupLayout panArticuloLayout = new javax.swing.GroupLayout(panArticulo);
        panArticulo.setLayout(panArticuloLayout);
        panArticuloLayout.setHorizontalGroup(panArticuloLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panArticuloLayout.createSequentialGroup().addContainerGap().addGroup(panArticuloLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panArticuloLayout
                                .createSequentialGroup()
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 90,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textCodProduccion, javax.swing.GroupLayout.PREFERRED_SIZE, 57,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(textCodArticulo, javax.swing.GroupLayout.PREFERRED_SIZE, 68,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 68,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(28, 28, 28)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(textCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 68,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 68,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(32, 32, 32)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textDescripcionArticulo,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 278,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(panArticuloLayout.createSequentialGroup().addGroup(panArticuloLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(textFechaElab, javax.swing.GroupLayout.PREFERRED_SIZE, 85,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 135,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(textFechaVto, javax.swing.GroupLayout.PREFERRED_SIZE, 90,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 99,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(33, 33, 33)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panArticuloLayout
                                                .createSequentialGroup()
                                                .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 123,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                        .addGroup(panArticuloLayout.createSequentialGroup()
                                                .addComponent(comboSucursal, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        72, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(57, 57, 57)))
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(textRefComanda, javax.swing.GroupLayout.PREFERRED_SIZE, 72,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(comboEstadoPedido, javax.swing.GroupLayout.PREFERRED_SIZE, 42,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(panArticuloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 75,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(comboLote, javax.swing.GroupLayout.PREFERRED_SIZE, 43,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(panArticuloLayout.createSequentialGroup()
                                        .addComponent(botonAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(botonQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, 43,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(271, 271, 271)));
        panArticuloLayout.setVerticalGroup(panArticuloLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panArticuloLayout.createSequentialGroup()
                        .addGroup(panArticuloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(panArticuloLayout.createSequentialGroup().addContainerGap()
                                        .addGroup(panArticuloLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(panArticuloLayout.createSequentialGroup()
                                                        .addGroup(panArticuloLayout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(jLabel5).addComponent(jLabel15)
                                                                .addComponent(jLabel21).addComponent(jLabel2,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 14,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addGroup(panArticuloLayout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(textCodProduccion,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(textCodArticulo,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(textCantidad,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addComponent(botonQuitar, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        36, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(panArticuloLayout.createSequentialGroup().addGap(31, 31, 31).addComponent(
                                        textDescripcionArticulo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panArticuloLayout
                                        .createSequentialGroup().addContainerGap().addComponent(botonAgregar,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(panArticuloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(panArticuloLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addGroup(panArticuloLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel22)
                                                .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 14,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel14).addComponent(jLabel3).addComponent(jLabel25)
                                                .addComponent(jLabel26))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(panArticuloLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(textFechaElab, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(textFechaVto, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(comboSucursal, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(textRefComanda,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(comboLote, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panArticuloLayout
                                        .createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49,
                                                Short.MAX_VALUE)
                                        .addComponent(comboEstadoPedido, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(36, 36, 36)))));

        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(22, 22, 22)
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 127, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        layout.createSequentialGroup().addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(panArticulo, javax.swing.GroupLayout.Alignment.TRAILING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, 786, Short.MAX_VALUE)
                                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 43,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE))
                        .addGap(55, 55, 55)
                        .addComponent(panArticulo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 117,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(105, Short.MAX_VALUE)));

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

    private void botonNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonNuevoActionPerformed
        // Habilita los campos para agregar un nuevo registro
        habilitarCampos();
    }//GEN-LAST:event_botonNuevoActionPerformed

    private void habilitarCampos() {
        textCantidad.setEnabled(true);
        textFechaElab.setEnabled(true);
        textFechaVto.setEnabled(true);
        comboEstadoPedido.setEnabled(true);
        comboSucursal.setEnabled(true);
        botonAgregar.setEnabled(true);
        botonQuitar.setEnabled(true);
        textCantidad.setEnabled(true);
        botonGuardar.setEnabled(true);
    }

    private void deshabilitarCampos() {
        textCodProduccion.setEnabled(false);
        comboEstadoPedido.setEnabled(false);
        comboSucursal.setEnabled(false);
        textCantidad.setEnabled(false);
        botonAgregar.setEnabled(false);
        botonQuitar.setEnabled(false);
        botonGuardar.setEnabled(false);

    }

    private void cargarComboSucursal() {
        this.comboSucursal.removeAllItems();
        sucursales = (List<MtSucursales>) st.createQuery("From MtSucursales").list();
        for (MtSucursales sucursal : sucursales) {
            this.comboSucursal.addItem(sucursal.getNomSucursal());
        }
    }

    private void botonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonGuardarActionPerformed
        guardar();
    }//GEN-LAST:event_botonGuardarActionPerformed

 public void guardar() {
    hibernateSession();
    st.beginTransaction();
    Date fecha = new Date();
    FormatearNumero f = new FormatearNumero();
        
    PrProduc p = new PrProduc();

        data[i][4] = produccion.get(comboSucursal.getSelectedIndex());
        data[i][7] = produccion.get(i).getRefComanda();
        data[i][8] = produccion.get(comboEstadoPedido.getSelectedIndex();
        data[i][9] = produccion.get(comboLote.getSelectedIndex();
        
    p.setFkArt(obtenerarticulo(textCodArticulo.getText()));
    p.setCantidad(f.FormatearDecimal(textCantidad.getText()));
    p.setDescripcion(p.getDescripcion());
    p.setFechaElab(new Date (textFechaElab.getText()));
    p.setFechaVto(new Date (textFechaVto.getText()));
    p.setFkSuc(null);
        
    System.err.println("Minimo ConBertido  " + f.FormatearDecimal(textFieldStockMinimo.getText()));
        
    e.setUsuarioMod(usuario);
    e.setFechaMod(fecha);
    st.saveOrUpdate(e);
    st.getTransaction().commit();
    st.close();
    JOptionPane.showMessageDialog(null, "Registro guardado");
    dispose();
}

public void getData() {
    hibernateSession();
    produccion = new ArrayList<PrProduc>();
    st.beginTransaction();
    String q = "select * from pr_produc;";
    query = st.createSQLQuery(q);
    query.addEntity(PrProduc.class);
    produccion = query.list();
    FormatearNumero cantidad = new FormatearNumero();
    st.getTransaction().commit();
    String[][] data = new String[produccion.size()][9];

    for (int i = 0; i < produccion.size(); i++) {
        data[i][0] = Integer.toString(produccion.get(i).getCodProduccion());
        data[i][1] = produccion.get(i).getFkArt().getCodArticulo();
        data[i][2] = produccion.get(i).getCantidad());
        data[i][3] = produccion.get(i).getDescripcion();
        data[i][4] = produccion.get(comboSucursal.getSelectedIndex());
        data[i][5] = produccion.get(i).getFechaElab();
        data[i][6] = produccion.get(i).getFechaVto();
        data[i][7] = produccion.get(i).getRefComanda();
        data[i][8] = produccion.get(comboEstadoPedido.getSelectedIndex();
        data[i][9] = produccion.get(comboLote.getSelectedIndex();
    }

    String[] columnNames = {"Cod Produc", "Cod Art", "Cantidad", "Descripcion", "Sucursal", "Fecha Elab", "Fecha Vto", "Ref Comanda", "Estado Pedido", "Lote"};
    DefaultTableModel model = new DefaultTableModel(data, columnNames);
    tablaListaProduccion.setModel(model);
    tablaListaProduccion.setAutoscrolls(true);
             
}

    public MtArticulos obtenerarticulo(String codigo) {
        MtArticulos a = null;
        try {
            Query query = st.createQuery("From MtArticulos a Where a.codArticulo = ?");
            //reemplaza el primer parametro en el string del query (reemplaza ? por el valor de codigo)
            query.setParameter(0, codigo);
            a = (MtArticulos) query.uniqueResult();
        } catch (HibernateException ex) {
            JOptionPane.showMessageDialog(null,
                    "Existen varios articulos con el mismo codigo. Busque con el asistente.", "Comanda Pedido",
                    JOptionPane.ERROR_MESSAGE);
            ex.printStackTrace();
        }
        return a;

    }

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

    }//GEN-LAST:event_botonEditarActionPerformed

    private void botonBorrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_botonBorrarActionPerformed

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

    }//GEN-LAST:event_botonCancelarActionPerformed

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

    }//GEN-LAST:event_botonBuscarActionPerformed

    private void txtCodUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodUsuarioActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCodUsuarioActionPerformed

    private void txtNomUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomUsuarioActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNomUsuarioActionPerformed

    private void botonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAgregarActionPerformed
        String cantidad = textCodigo.getText();
        String descart = textDescripcion.getText();
        String punit = textPrecioUnitario.getText();
        actualizarSubTotal();
        String subt = textSubTotal.getText();
        cargarDetallePedido(cantidad, descart, punit, subt);

    }//GEN-LAST:event_botonAgregarActionPerformed

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

    }//GEN-LAST:event_botonQuitarActionPerformed

    private void botonInformeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonInformeActionPerformed
        informe();
    }//GEN-LAST:event_botonInformeActionPerformed

    private void textFechaElabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textFechaElabActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textFechaElabActionPerformed

    private void textFechaElabFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_textFechaElabFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_textFechaElabFocusLost

    private void textFechaElabKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textFechaElabKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_textFechaElabKeyPressed

    private void textFechaVtoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textFechaVtoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textFechaVtoActionPerformed

    private void textFechaVtoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_textFechaVtoFocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_textFechaVtoFocusLost

    private void textFechaVtoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textFechaVtoKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_textFechaVtoKeyPressed

    private void comboEstadoPedidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboEstadoPedidoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_comboEstadoPedidoActionPerformed

    private void textCodArticuloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCodArticuloActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textCodArticuloActionPerformed

    private void textCodArticuloFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_textCodArticuloFocusLost
        if (this.textCodArticulo.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Codigo de Articulo no ingresado. ", "Produccion",
                    JOptionPane.INFORMATION_MESSAGE);
        } else {

            MtArticulos articulo = obtenerarticulo(this.textCodArticulo.getText());
            if (articulo == null) {
                JOptionPane.showMessageDialog(null, "El articulo no existe", "Produccion",
                        JOptionPane.INFORMATION_MESSAGE);
                this.textCodArticulo.setText("");
                this.textDescripcionArticulo.setText("");
                this.textCodArticulo.grabFocus();
            } else {
                this.textDescripcionArticulo.setText(articulo.getNomArticulo());
                actualizarStock();
            }
        }
    }//GEN-LAST:event_textCodArticuloFocusLost

    private void actualizarStock() {

    }

    private void textCodArticuloKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCodArticuloKeyPressed
        if (evt.getKeyCode() == VK_F9) {
            // buscarArt();
        }
    }//GEN-LAST:event_textCodArticuloKeyPressed

    private void textCantidadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCantidadActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textCantidadActionPerformed

    private void textCantidadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_textCantidadFocusLost

    }//GEN-LAST:event_textCantidadFocusLost

    private void textCantidadKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCantidadKeyPressed
        if (evt.getKeyCode() == VK_F9) {
            //        buscarArt();
        }
    }//GEN-LAST:event_textCantidadKeyPressed

    private void comboLoteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboLoteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_comboLoteActionPerformed

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

    }//GEN-LAST:event_textCodProduccionActionPerformed

    private void informe() {

        JDialog viewer = new JDialog(this, "Comanda Pedido", true);
        viewer.setSize(800, 600);
        viewer.setLocationRelativeTo(null);

        try {
            String fileName = "src/com/informes/Comanda_Pedido.jrxml";
            File theFile = new File(fileName);
            JasperDesign jasperDesign = JRXmlLoader.load(theFile);
            String theQuery = "select nom_sucursal sucursal, nom_articulo articulo, "
                    + "cantidad, stock_minimo stock, nom_tipo_articulo tipo "
                    + "from mt_sucursales s , mt_articulos a, st_existencia_suc e, "
                    + "mt_tipos_articulos t  where s.cod_sucursal = e.cod_sucursal "
                    + "and e.cod_articulo = a.cod_articulo " + "and t.cod_tipo_articulo = a.cod_tipo_articulo;";

            JRDesignQuery newQuery = new JRDesignQuery();
            newQuery.setText(theQuery);
            jasperDesign.setQuery(newQuery);

            JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
            Connection conn = st.connection();

            JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
            JasperViewer jv = new JasperViewer(jasperPrint);
            viewer.getContentPane().add(jv.getContentPane());
            viewer.setVisible(true);

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Produccion.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Produccion.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Produccion.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Produccion.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Produccion dialog = new Produccion(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonAgregar;
    private javax.swing.JButton botonBorrar;
    private javax.swing.JButton botonBuscar;
    private javax.swing.JButton botonCancelar;
    private javax.swing.JButton botonEditar;
    private javax.swing.JButton botonGuardar;
    private javax.swing.JButton botonInforme;
    private javax.swing.JButton botonNuevo;
    private javax.swing.JButton botonQuitar;
    private javax.swing.JComboBox comboEstadoPedido;
    private javax.swing.JComboBox comboLote;
    private javax.swing.JComboBox comboSucursal;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JPanel panArticulo;
    private javax.swing.JTable tablaListaProduccion;
    private javax.swing.JTextField textCantidad;
    private javax.swing.JTextField textCodArticulo;
    private javax.swing.JTextField textCodProduccion;
    private javax.swing.JTextField textDescripcionArticulo;
    private javax.swing.JTextField textFechaElab;
    private javax.swing.JTextField textFechaVto;
    private javax.swing.JTextField textRefComanda;
    private javax.swing.JTextField txtCodUsuario;
    private javax.swing.JTextField txtFechaHora;
    private javax.swing.JTextField txtNomUsuario;
    // End of variables declaration//GEN-END:variables
}