com.app.ventas.ComandaPedido.java Source code

Java tutorial

Introduction

Here is the source code for com.app.ventas.ComandaPedido.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.ComandaCab;
import com.entidades.MtArticulos;
import com.entidades.MtClientes;
import com.entidades.MtCondicionPago;
import com.entidades.MtFormaPago;
import com.entidades.MtMonedas;
import com.entidades.MtSucursales;
import static java.awt.event.KeyEvent.VK_F9;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.swing.JOptionPane;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import util.Fecha;
import util.FormatearNumero;
import util.HibernateUtil;

/**
 *
 * @author vanessa
 */
public class ComandaPedido extends javax.swing.JDialog {
    private Session st;
    private List<MtSucursales> sucursales;
    private List<ComandaCab> estados;
    private String usuario;
    private MtClientes cliente = new MtClientes();

    /**
     * Creates new form ComandaPedido
     */
    public ComandaPedido(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        hibernateSession();
        initComponents();
        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();
        ListaComanda = new javax.swing.JTable();
        jPanel3 = new javax.swing.JPanel();
        botonNuevo = new javax.swing.JButton();
        cmdGuardar = new javax.swing.JButton();
        botonEditar = new javax.swing.JButton();
        botonBorrar = new javax.swing.JButton();
        botonCancelar = new javax.swing.JButton();
        cmdImprimir = new javax.swing.JButton();
        cmdBuscar = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        txtFechaHora = new javax.swing.JTextField();
        txtCodUsuario = new javax.swing.JTextField();
        txtNomUsuario = new javax.swing.JTextField();
        tablaCabecera = new javax.swing.JTabbedPane();
        panelComanda = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        textCliente = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        textMozo = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        textPedidoNumero = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        textMesaNumero = new javax.swing.JTextField();
        comboSucursal = new javax.swing.JComboBox();
        comboEstadoPedido = new javax.swing.JComboBox();
        jLabel25 = new javax.swing.JLabel();
        textCodCliente = new javax.swing.JTextField();
        panelComandaHistorico = new javax.swing.JPanel();
        txtCodCondPago = new javax.swing.JTextField();
        txtDescConPago = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        txtCodFormPago = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        txtDescFormaPago = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        txtCodTribFacNc = new javax.swing.JTextField();
        txtCodSucFacNc = new javax.swing.JTextField();
        txtNroFactNc = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        txtCodMoneda = new javax.swing.JTextField();
        txtDescMoneda = new javax.swing.JTextField();
        txtVencimiento = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtTipoCambio = new javax.swing.JFormattedTextField();
        txtObservacion = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        panArticulo = new javax.swing.JPanel();
        textCantidad = new javax.swing.JTextField();
        textDescripcionArticulo = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        textPrecioUnitario = new javax.swing.JFormattedTextField();
        textSubTotal = new javax.swing.JFormattedTextField();
        jLabel27 = new javax.swing.JLabel();
        botonQuitar = new javax.swing.JButton();
        botonAgregar = new javax.swing.JButton();

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

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

        }, new String[] { "Cantidad", "Articulo", "P Unitario", "Subtotal" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false };

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

        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);
            }
        });

        cmdGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Save.png"))); // NOI18N
        cmdGuardar.setToolTipText("Guardar");
        cmdGuardar.setEnabled(false);
        cmdGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdGuardarActionPerformed(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);
            }
        });

        cmdImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/imprimir 24.png"))); // NOI18N
        cmdImprimir.setToolTipText("Imprimir");
        cmdImprimir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdImprimirActionPerformed(evt);
            }
        });

        cmdBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/imagenes/Search (2).png"))); // NOI18N
        cmdBuscar.setToolTipText("Buscar");
        cmdBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdBuscarActionPerformed(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(cmdGuardar, 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(cmdImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cmdBuscar, 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)
                        .addComponent(botonCancelar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(botonNuevo, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(cmdBuscar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(cmdImprimir, javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(botonBorrar, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(botonEditar, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(cmdGuardar, javax.swing.GroupLayout.Alignment.LEADING,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addGap(3, 3, 3)));

        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()));
        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()));

        tablaCabecera.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);

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

        jLabel5.setText("Cliente:");

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

        jLabel14.setText("Sucursal:");

        textMozo.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textMozo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textMozoActionPerformed(evt);
            }
        });
        textMozo.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textMozoFocusLost(evt);
            }
        });
        textMozo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                textMozoKeyTyped(evt);
            }
        });

        jLabel17.setText("Mozo:");

        jLabel20.setText("Pedido Nmero:");

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

        jLabel22.setText("Mesa Nmero:");

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

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

        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);
            }
        });

        jLabel25.setText("Estado Pedido:");

        textCodCliente.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        textCodCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodClienteActionPerformed(evt);
            }
        });
        textCodCliente.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                textCodClienteFocusLost(evt);
            }
        });
        textCodCliente.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                textCodClienteKeyPressed(evt);
            }

            public void keyTyped(java.awt.event.KeyEvent evt) {
                textCodClienteKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout panelComandaLayout = new javax.swing.GroupLayout(panelComanda);
        panelComanda.setLayout(panelComandaLayout);
        panelComandaLayout.setHorizontalGroup(panelComandaLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelComandaLayout.createSequentialGroup().addGap(30, 30, 30).addGroup(panelComandaLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(panelComandaLayout.createSequentialGroup()
                                .addComponent(comboSucursal, javax.swing.GroupLayout.PREFERRED_SIZE, 180,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(98, 98, 98).addComponent(textMesaNumero))
                        .addGroup(panelComandaLayout.createSequentialGroup()
                                .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 123,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 123,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                panelComandaLayout.createSequentialGroup().addGroup(panelComandaLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 121,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(panelComandaLayout.createSequentialGroup()
                                                .addComponent(textCodCliente,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 57,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(textCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        172, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(43, 43, 43)
                                        .addGroup(panelComandaLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(textPedidoNumero,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 123,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 123,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addGap(62, 62, 62)
                        .addGroup(panelComandaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textMozo, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(comboEstadoPedido, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(28, 28, 28)));
        panelComandaLayout.setVerticalGroup(panelComandaLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelComandaLayout.createSequentialGroup().addGap(18, 18, 18)
                        .addGroup(panelComandaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5).addComponent(jLabel20).addComponent(jLabel17))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelComandaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(textCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textPedidoNumero, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textMozo, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(13, 13, 13)
                        .addGroup(panelComandaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel14).addComponent(jLabel22).addComponent(jLabel25))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelComandaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(comboSucursal, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textMesaNumero, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(comboEstadoPedido, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(29, Short.MAX_VALUE)));

        tablaCabecera.addTab("Datos Comanda", panelComanda);

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

        txtCodCondPago.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtCodCondPago.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtCodCondPagoFocusLost(evt);
            }
        });

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

        jLabel7.setText("Condicin Pago");

        txtCodFormPago.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtCodFormPago.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtCodFormPagoFocusLost(evt);
            }
        });

        jLabel12.setText("Forma de Pago");

        txtDescFormaPago.setEditable(false);
        txtDescFormaPago.setBackground(new java.awt.Color(204, 255, 255));
        txtDescFormaPago.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N

        jLabel18.setText("Nro. Nota de Crdito");

        txtCodTribFacNc.setEditable(false);
        txtCodTribFacNc.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        txtCodTribFacNc.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtCodTribFacNc.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCodTribFacNcKeyTyped(evt);
            }
        });

        txtCodSucFacNc.setEditable(false);
        txtCodSucFacNc.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        txtCodSucFacNc.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtCodSucFacNc.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCodSucFacNcKeyTyped(evt);
            }
        });

        txtNroFactNc.setEditable(false);
        txtNroFactNc.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        txtNroFactNc.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtNroFactNc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNroFactNcActionPerformed(evt);
            }
        });
        txtNroFactNc.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtNroFactNcKeyTyped(evt);
            }
        });

        jLabel19.setText("Moneda");

        txtCodMoneda.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtCodMoneda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCodMonedaActionPerformed(evt);
            }
        });
        txtCodMoneda.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtCodMonedaFocusLost(evt);
            }
        });
        txtCodMoneda.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txtCodMonedaKeyTyped(evt);
            }
        });

        txtDescMoneda.setEditable(false);
        txtDescMoneda.setBackground(new java.awt.Color(204, 255, 255));
        txtDescMoneda.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N

        txtVencimiento.setEditable(false);
        txtVencimiento.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        txtVencimiento.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel9.setText("Vencimiento");

        jLabel4.setText("Cambio");

        txtTipoCambio.setEditable(false);
        txtTipoCambio.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
                new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0"))));
        txtTipoCambio.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtTipoCambio.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N

        txtObservacion.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N

        jLabel23.setText("Observaciones");

        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelComandaHistoricoLayout = new javax.swing.GroupLayout(panelComandaHistorico);
        panelComandaHistorico.setLayout(panelComandaHistoricoLayout);
        panelComandaHistoricoLayout.setHorizontalGroup(panelComandaHistoricoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelComandaHistoricoLayout.createSequentialGroup().addContainerGap()
                        .addGroup(panelComandaHistoricoLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 109,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 175,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelComandaHistoricoLayout
                                        .createSequentialGroup()
                                        .addComponent(txtCodCondPago, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(1, 1, 1).addComponent(txtDescConPago))
                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                        .addComponent(txtCodFormPago, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(1, 1, 1)
                                        .addComponent(txtDescFormaPago, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(panelComandaHistoricoLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                        .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 142,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel23, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                        .addComponent(txtCodTribFacNc, javax.swing.GroupLayout.PREFERRED_SIZE, 35,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(1, 1, 1)
                                        .addComponent(txtCodSucFacNc, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(1, 1, 1)
                                        .addComponent(txtNroFactNc, javax.swing.GroupLayout.PREFERRED_SIZE, 65,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(txtObservacion))
                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                        false)
                                                .addComponent(txtVencimiento,
                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(33, 33, 33)
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                                        .addComponent(txtCodMoneda,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 32,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(1, 1, 1).addComponent(txtDescMoneda,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 112,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                        false)
                                                .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(txtTipoCambio, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        53, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(79, 79, 79)));
        panelComandaHistoricoLayout.setVerticalGroup(panelComandaHistoricoLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelComandaHistoricoLayout.createSequentialGroup().addContainerGap()
                        .addGroup(panelComandaHistoricoLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup().addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(txtCodCondPago,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(txtDescConPago,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel12)
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelComandaHistoricoLayout
                                        .createSequentialGroup()
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                                        .addComponent(jLabel9)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(txtVencimiento,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(panelComandaHistoricoLayout.createSequentialGroup()
                                                        .addGroup(panelComandaHistoricoLayout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(jLabel19).addComponent(jLabel4))
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addGroup(panelComandaHistoricoLayout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.BASELINE)
                                                                .addComponent(txtCodMoneda,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(txtDescMoneda,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addComponent(txtTipoCambio,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel18).addComponent(jLabel23))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(panelComandaHistoricoLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(panelComandaHistoricoLayout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(txtCodFormPago,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtDescFormaPago,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jButton1))
                                                .addGroup(panelComandaHistoricoLayout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(txtCodTribFacNc,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtCodSucFacNc,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtNroFactNc,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtObservacion,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(25, 25, 25)))));

        tablaCabecera.addTab("Historico", panelComandaHistorico);

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

        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);
            }
        });

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

        jLabel21.setText("Cantidad");

        jLabel2.setText("Descripcion Articulo");

        jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel24.setText("Precio Unit.");

        textPrecioUnitario.setEditable(false);
        textPrecioUnitario.setBackground(new java.awt.Color(204, 255, 255));
        textPrecioUnitario.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
                new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,###"))));
        textPrecioUnitario.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textPrecioUnitario.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N

        textSubTotal.setEditable(false);
        textSubTotal.setBackground(new java.awt.Color(255, 255, 204));
        textSubTotal.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
                new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,###"))));
        textSubTotal.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textSubTotal.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        textSubTotal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textSubTotalActionPerformed(evt);
            }
        });

        jLabel27.setText("Subtotal");

        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);
            }
        });

        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, false)
                                        .addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, 68,
                                                Short.MAX_VALUE)
                                        .addComponent(textCantidad))
                                .addGap(1, 1, 1)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(panArticuloLayout.createSequentialGroup()
                                                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(0, 0, Short.MAX_VALUE))
                                        .addComponent(textDescripcionArticulo))
                                .addGap(18, 18, 18)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(panArticuloLayout.createSequentialGroup().addComponent(jLabel24)
                                                .addGap(51, 51, 51))
                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                panArticuloLayout.createSequentialGroup()
                                                        .addComponent(textPrecioUnitario,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 88,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18, 18, 18)))
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 79,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textSubTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 107,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(30, 30, 30)
                                .addComponent(botonAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(botonQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(16, 16, 16)));
        panArticuloLayout.setVerticalGroup(panArticuloLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panArticuloLayout.createSequentialGroup().addContainerGap().addGroup(panArticuloLayout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(botonAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(panArticuloLayout.createSequentialGroup().addGroup(panArticuloLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel21).addComponent(jLabel2))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                        panArticuloLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel24).addComponent(jLabel27)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(panArticuloLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(textCantidad, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textDescripcionArticulo,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textPrecioUnitario, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textSubTotal, 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))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        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).addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jScrollPane2)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(tablaCabecera, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
                                        Short.MAX_VALUE)
                                .addGroup(layout.createSequentialGroup()
                                        .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))
                                .addComponent(panArticulo, javax.swing.GroupLayout.Alignment.TRAILING,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)))
                        .addGap(0, 21, Short.MAX_VALUE)));
        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,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(tablaCabecera, javax.swing.GroupLayout.PREFERRED_SIZE, 164,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .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, 141,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)));

        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
        textCodCliente.setEnabled(true);
        textCliente.setEnabled(true);
        textMesaNumero.setEnabled(true);
        textPedidoNumero.setEnabled(true);
        comboEstadoPedido.setEnabled(true);
        comboSucursal.setEnabled(true);
        textMozo.setEnabled(true);
        textCantidad.setEnabled(true);
        textPrecioUnitario.setEnabled(true);
        textSubTotal.setEnabled(true);
        textDescripcionArticulo.setEnabled(true);
        botonAgregar.setEnabled(true);
        botonQuitar.setEnabled(true);
        cmdGuardar.setEnabled(true);
    }//GEN-LAST:event_botonNuevoActionPerformed

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

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

    public void guardar() {
        hibernateSession();
        st.beginTransaction();
        Date fecha = new Date();
        ComandaCab c = new ComandaCab();
        FormatearNumero numero = new FormatearNumero();
        // Se le asigna un cliente de acuerdo al TextField Cliente a la entidad comandaCab
        c.setMtClientes(obtenercliente(textCliente.getText()));
        c.setNroComanda(Integer.parseInt(textPedidoNumero.getText()));
        c.setNroMesa(Short.parseShort(textMesaNumero.getText()));
        c.setTotal(new BigDecimal(textSubTotal.getText()));
        c.setEstado((char) comboEstadoPedido.getSelectedItem());
        c.setUsuarioMod(usuario);
        c.setFechaMod(fecha);
        st.saveOrUpdate(c);
        st.getTransaction().commit();
        st.close();
        JOptionPane.showMessageDialog(null, "Registro guardado");
        dispose();
    }

    public MtClientes obtenercliente(String codigo) {
        MtClientes c = null;
        try {
            Query query = st.createQuery("From MtClientes c Where c.nroDocum = ? and c.esActivo = 'S'");
            query.setParameter(0, codigo);
            System.err.println("QUERY " + query.toString());
            c = (MtClientes) query.uniqueResult();
        } catch (HibernateException ex) {
            //JOptionPane.showMessageDialog(null, "Existen varios clientes con el mismo codigo. Busque con el asistente.",
            //       "Comanda Pedido", JOptionPane.ERROR_MESSAGE);
            ex.printStackTrace();
        }
        return c;

    }

    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 cmdImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdImprimirActionPerformed

    }//GEN-LAST:event_cmdImprimirActionPerformed

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

    }//GEN-LAST:event_cmdBuscarActionPerformed

    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 textClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textClienteActionPerformed

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

    private void textMozoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_textMozoFocusLost
        if (!this.textMozo.getText().equals("")) {
            //cargarPedido();
        }
    }//GEN-LAST:event_textMozoFocusLost

    private void textMozoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textMozoKeyTyped
        char car = evt.getKeyChar();
        if (textMozo.getText().length() >= 10) {
            evt.consume();
        }
        if ((car < '0' || car > '9')) {
            evt.consume();
        }
    }//GEN-LAST:event_textMozoKeyTyped

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

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

    private void txtCodCondPagoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodCondPagoFocusLost
        MtCondicionPago cond = new MtCondicionPago();
        Date fecha = new Date();
        if (this.txtCodCondPago.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "No se ha seleccionado ninguna condicin de pago. ",
                    "Factura Venta", JOptionPane.ERROR_MESSAGE);
            this.txtCodCondPago.grabFocus();
        } else {
            //            cond = obtenerCondPago(Integer.parseInt(this.txtCodCondPago.getText()));
            //slo si es a crdito se habilita campo vencimiento
            if (cond != null) {
                if (cond.getPlazo() > 0) {
                    //calcula la fecha para el vencimiento
                    Calendar cal = Calendar.getInstance();
                    cal.setTime(fecha);
                    Fecha fec = new Fecha();

                    this.txtVencimiento.setEditable(true);
                    // this.txtVencimiento.setText(fec.fechaString(cal.add(Calendar.DAY_OF_WEEK, cond.getPlazo())));
                } else {
                    this.txtVencimiento.setEditable(false);
                }
            }
        }
    }//GEN-LAST:event_txtCodCondPagoFocusLost

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

    private void txtCodFormPagoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodFormPagoFocusLost
        MtFormaPago formp = new MtFormaPago();
        if (this.txtCodFormPago.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "No se ha seleccionado ninguna forma de pago. ", "Factura Venta",
                    JOptionPane.ERROR_MESSAGE);
            this.txtCodFormPago.grabFocus();
        } else {
            //            formp = obtenerFormaPago(Integer.parseInt(this.txtCodFormPago.getText()));
            //segn tipo de forma de pago se habilita o no la NC
            if (this.txtCodFormPago.getText().equals("NC")) {
                this.txtCodTribFacNc.setEditable(true);
                this.txtCodSucFacNc.setEditable(true);
                this.txtNroFactNc.setEditable(true);
            } else {
                this.txtCodTribFacNc.setEditable(false);
                this.txtCodSucFacNc.setEditable(false);
                this.txtNroFactNc.setEditable(false);
            }
        }

        if (this.txtCodFormPago.getText().equals("2") || this.txtCodFormPago.getText().equals("3")) {
            //lanzar formulario detalle
            //            lanzarDetalleTarjeta();
        }
    }//GEN-LAST:event_txtCodFormPagoFocusLost

    private void txtCodTribFacNcKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodTribFacNcKeyTyped
        char car = evt.getKeyChar();
        if (txtCodTribFacNc.getText().length() >= 3) {
            evt.consume();
        }
        if ((car < '0' || car > '9')) {
            evt.consume();
        }
    }//GEN-LAST:event_txtCodTribFacNcKeyTyped

    private void txtCodSucFacNcKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodSucFacNcKeyTyped
        char car = evt.getKeyChar();
        if (txtCodSucFacNc.getText().length() >= 3) {
            evt.consume();
        }
        if ((car < '0' || car > '9')) {
            evt.consume();
        }
    }//GEN-LAST:event_txtCodSucFacNcKeyTyped

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

    private void txtNroFactNcKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNroFactNcKeyTyped
        char car = evt.getKeyChar();
        if (txtNroFactNc.getText().length() >= 7) {
            evt.consume();
        }
        if ((car < '0' || car > '9')) {
            evt.consume();
        }
    }//GEN-LAST:event_txtNroFactNcKeyTyped

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

    private void txtCodMonedaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodMonedaFocusLost
        MtMonedas mon = new MtMonedas();
        if (this.txtCodMoneda.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "No se ha seleccionado ninguna moneda. ", "Factura Venta",
                    JOptionPane.ERROR_MESSAGE);
            this.txtCodMoneda.grabFocus();
        } else {
            //            mon = obtenerMoneda(Integer.parseInt(this.txtCodMoneda.getText()));
            if (this.txtCodMoneda.getText().equals("1")) {
                this.txtTipoCambio.setValue(1);
                this.txtTipoCambio.setEnabled(false);
            } else {
                this.txtTipoCambio.setValue(0);
                this.txtTipoCambio.setEnabled(true);
                this.txtTipoCambio.setEditable(true);
            }
        }
    }//GEN-LAST:event_txtCodMonedaFocusLost

    private void txtCodMonedaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodMonedaKeyTyped
        char car = evt.getKeyChar();
        if (txtCodMoneda.getText().length() >= 2) {
            evt.consume();
        }
        if ((car < '0' || car > '9')) {
            evt.consume();
        }
    }//GEN-LAST:event_txtCodMonedaKeyTyped

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        //   lanzarDetalleTarjeta();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void botonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAgregarActionPerformed
        // if (!this.txtCantPedida.getText().trim().equals("")
        //            || !this.txtCantPedida.getText().trim().equals("0")) {

        /*
            FormatearNumero conv = new FormatearNumero();
            BigDecimal subtotal = new BigDecimal(this.textSubTotal.getValue().toString());
            BigDecimal impDesc = calcularDescuento(this.txtDescto.getText(), this.textSubTotal.getValue());
            BigDecimal cantPedida = conv.FormatearDecimal(this.txtCantPedida.getText());
            String descto = this.txtDescto.getText();
            
            cargarArticulo(this.superArticulo, subtotal, impDesc, cantPedida, descto);
            limpiarCamposArticulo();
            
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Ocurri un error al agregar el artculo a la grilla. "
                + "\n" + ex.getMessage(), "Factura Venta", JOptionPane.ERROR_MESSAGE);
        }
            
                } else {
        JOptionPane.showMessageDialog(null, "La cantidad ingresa no es vlida.",
            "Factura Venta", JOptionPane.ERROR_MESSAGE);
            
        this.txtCantPedida.setValue(0);
        this.txtCantPedida.grabFocus();
            */

    }//GEN-LAST:event_botonAgregarActionPerformed

    private void botonQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonQuitarActionPerformed
        // quitarElemento();
        //limpiarCamposArticulo();
    }//GEN-LAST:event_botonQuitarActionPerformed

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

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

    private void textCantidadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_textCantidadFocusLost
        this.textCantidad.setText(this.textCantidad.getText().toUpperCase());
        MtArticulos art = null;

        if (!this.textCantidad.getText().equals("")) {
            //      art = obtenerArticulo(this.textCantidad.getText().toUpperCase());
        }

        if (null != art) {

            //    superArticulo = art;
            BigDecimal precio = art.getPrecioVenta();
            //  String cod_suc = this.txtCodSuc.getText().toUpperCase();

            this.textDescripcionArticulo.setText(art.getNomArticulo());
            this.textPrecioUnitario.setValue(precio);
            // this.txtStockActual.setValue(obtenerStock(art, cod_suc));
            // this.txtCantPedida.grabFocus();
            // this.txtCantPedida.selectAll();
        }
    }//GEN-LAST:event_textCantidadFocusLost

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

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

    }//GEN-LAST:event_textCodClienteActionPerformed

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

        if (this.textCodCliente.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Cdigo de Cliente no ingresado. ", "Comanda Pedido",
                    JOptionPane.INFORMATION_MESSAGE);
        } else {
            this.textCodCliente.setText(this.textCodCliente.getText().toUpperCase());
            cliente = obtenercliente(this.textCodCliente.getText());
            if (cliente == null) {
                JOptionPane.showMessageDialog(null, "El cliente no existe o no se encuentra activo. ",
                        "Comanda Pedido", JOptionPane.INFORMATION_MESSAGE);
                this.textCodCliente.setText("");
                this.textCliente.setText("");
                this.textCodCliente.grabFocus();
            } else {
                this.textCliente.setText(cliente.getNomTit());
            }
        }
    }//GEN-LAST:event_textCodClienteFocusLost

    private void textCodClienteKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCodClienteKeyPressed
        if (evt.getKeyCode() == VK_F9) {
            //      buscar();
        }
    }//GEN-LAST:event_textCodClienteKeyPressed

    private void textCodClienteKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCodClienteKeyTyped

    }//GEN-LAST:event_textCodClienteKeyTyped

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

    /**
     * @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(ComandaPedido.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ComandaPedido.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ComandaPedido.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ComandaPedido.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() {
                ComandaPedido dialog = new ComandaPedido(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.JTable ListaComanda;
    private javax.swing.JButton botonAgregar;
    private javax.swing.JButton botonBorrar;
    private javax.swing.JButton botonCancelar;
    private javax.swing.JButton botonEditar;
    private javax.swing.JButton botonNuevo;
    private javax.swing.JButton botonQuitar;
    private javax.swing.JButton cmdBuscar;
    private javax.swing.JButton cmdGuardar;
    private javax.swing.JButton cmdImprimir;
    private javax.swing.JComboBox comboEstadoPedido;
    private javax.swing.JComboBox comboSucursal;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel9;
    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.JPanel panelComanda;
    private javax.swing.JPanel panelComandaHistorico;
    private javax.swing.JTabbedPane tablaCabecera;
    private javax.swing.JTextField textCantidad;
    private javax.swing.JTextField textCliente;
    private javax.swing.JTextField textCodCliente;
    private javax.swing.JTextField textDescripcionArticulo;
    private javax.swing.JTextField textMesaNumero;
    private javax.swing.JTextField textMozo;
    private javax.swing.JTextField textPedidoNumero;
    private javax.swing.JFormattedTextField textPrecioUnitario;
    private javax.swing.JFormattedTextField textSubTotal;
    private javax.swing.JTextField txtCodCondPago;
    private javax.swing.JTextField txtCodFormPago;
    private javax.swing.JTextField txtCodMoneda;
    private javax.swing.JTextField txtCodSucFacNc;
    private javax.swing.JTextField txtCodTribFacNc;
    private javax.swing.JTextField txtCodUsuario;
    private javax.swing.JTextField txtDescConPago;
    private javax.swing.JTextField txtDescFormaPago;
    private javax.swing.JTextField txtDescMoneda;
    private javax.swing.JTextField txtFechaHora;
    private javax.swing.JTextField txtNomUsuario;
    private javax.swing.JTextField txtNroFactNc;
    private javax.swing.JTextField txtObservacion;
    private javax.swing.JFormattedTextField txtTipoCambio;
    private javax.swing.JTextField txtVencimiento;
    // End of variables declaration//GEN-END:variables
}