Java tutorial
/* * 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 Compras; import Hibernate.Util.HibernateUtil; import Hibernate.entidades.Almacen; import Hibernate.entidades.Orden; import Hibernate.entidades.OrdenExterna; import Hibernate.entidades.Partida; import Hibernate.entidades.PartidaExterna; import Hibernate.entidades.Pedido; import Hibernate.entidades.Proveedor; import Hibernate.entidades.Usuario; import Integral.FormatoEditor; import Integral.FormatoEditorTexto; import java.awt.Color; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; import Integral.FormatoTabla; import Integral.Herramientas; import Integral.HorizontalBarUI; import Integral.Render1; import Integral.Integral; import Integral.VerticalBarUI; import java.text.SimpleDateFormat; import javax.swing.DefaultCellEditor; import org.hibernate.Criteria; /** * * @author ESPECIALIZADO TOLUCA */ public class EliminaPedido extends javax.swing.JPanel { private Usuario usrAut; Usuario usr; int entro = 0, x = 0; double imp = 0.0; static ResultSet rs; static Statement st; static Connection conn; DefaultTableModel temp; public Orden orden_act = null; public Proveedor prov_act = null; public Proveedor provf_act = null; public Partida part_act = null; MyModel model; Proveedor registro = null; Partida registropar = null; private Session session; String sessionPrograma = ""; Herramientas h; Formatos f1; int menu = 0; public Pedido pedido = null; String[] columnas = new String[] { "Interno", "N0", "#", "N Parte", "Folio", "Descripcin", "Med", "Plazo", "Cant", "Costo c/u", "Total" }; FormatoTabla formato; /** * Creates new form nuevoPedido */ public EliminaPedido(Usuario usuario, String ses, Pedido ped, int ventana) { usr = usuario; sessionPrograma = ses; pedido = ped; menu = ventana; initComponents(); scroll.getVerticalScrollBar().setUI(new VerticalBarUI()); scroll.getHorizontalScrollBar().setUI(new HorizontalBarUI()); formato = new FormatoTabla(); model = new MyModel(0, columnas); t_datos.setModel(model); t_datos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); busca(); } void estado() { String consulta = "SELECT DISTINCT obj from Orden obj " + "LEFT JOIN FETCH obj.partidasForIdOrden part " + "LEFT JOIN partP.pedido ped " + "where ped.idPedido = " + pedido.getIdPedido(); List<Object[]> resultList = executeHQLQuery(consulta); if (resultList.size() > 0) { Orden[] actor = (Orden[]) resultList.get(0); actor[0].getIdOrden(); if (actor[0].getFechaCierre() != null) { this.t_proveedor.setEnabled(false); this.t_notas.setEnabled(false); JOptionPane.showMessageDialog(null, "Orden cerrada!"); } } } /** * 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() { autorizarCosto = new javax.swing.JDialog(); jPanel7 = new javax.swing.JPanel(); t_contra = new javax.swing.JPasswordField(); jLabel2 = new javax.swing.JLabel(); t_user = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); b_autorizar = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); l_busca = new javax.swing.JLabel(); b_busca = new javax.swing.JButton(); t_busca = new javax.swing.JTextField(); r_autorizar = new javax.swing.JRadioButton(); r_autorizar2 = new javax.swing.JRadioButton(); b_eliminar = new javax.swing.JButton(); jPanel6 = new javax.swing.JPanel(); l_iva = new javax.swing.JLabel(); t_IVA = new javax.swing.JFormattedTextField(); t_subtotal = new javax.swing.JFormattedTextField(); l_subtotal = new javax.swing.JLabel(); l_total = new javax.swing.JLabel(); t_total = new javax.swing.JFormattedTextField(); jScrollPane2 = new javax.swing.JScrollPane(); t_notas = new javax.swing.JTextArea(); l_notas = new javax.swing.JLabel(); scroll = new javax.swing.JScrollPane(); t_datos = new javax.swing.JTable(); p_arriba = new javax.swing.JPanel(); p_interno_centro = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jPanel12 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); c_tipo = new javax.swing.JComboBox(); l_pedido = new javax.swing.JLabel(); t_pedido = new javax.swing.JTextField(); l_fecha = new javax.swing.JLabel(); t_fecha = new javax.swing.JTextField(); t_folio_externo = new javax.swing.JTextField(); l_pedido1 = new javax.swing.JLabel(); t_plazo = new javax.swing.JTextField(); l_plazo = new javax.swing.JLabel(); l_nombre1 = new javax.swing.JLabel(); t_id_comprador = new javax.swing.JTextField(); t_nombre_comprador = new javax.swing.JTextField(); jPanel8 = new javax.swing.JPanel(); l_orden = new javax.swing.JLabel(); t_orden = new javax.swing.JTextField(); l_tipo = new javax.swing.JLabel(); t_tipo = new javax.swing.JTextField(); jLabel21 = new javax.swing.JLabel(); t_marca = new javax.swing.JTextField(); l_modelo = new javax.swing.JLabel(); t_modelo = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); t_siniestro = new javax.swing.JTextField(); l_asegurado = new javax.swing.JLabel(); t_asegurado = new javax.swing.JTextField(); l_aseguradora = new javax.swing.JLabel(); t_id_aseguradora = new javax.swing.JTextField(); t_aseguradora = new javax.swing.JTextField(); t_nombre_partida = new javax.swing.JTextField(); t_id_partida = new javax.swing.JTextField(); l_nombre2 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); t_proveedor = new javax.swing.JTextField(); l_proveedor = new javax.swing.JLabel(); jPanel13 = new javax.swing.JPanel(); l_nombre = new javax.swing.JLabel(); t_nombre = new javax.swing.JTextField(); t_direccion = new javax.swing.JTextField(); l_direccion = new javax.swing.JLabel(); l_colonia = new javax.swing.JLabel(); t_colonia = new javax.swing.JTextField(); l_poblacion = new javax.swing.JLabel(); t_poblacion = new javax.swing.JTextField(); t_cp = new javax.swing.JTextField(); l_cp = new javax.swing.JLabel(); l_rfc = new javax.swing.JLabel(); t_rfc = new javax.swing.JTextField(); t_clave = new javax.swing.JTextField(); l_clave = new javax.swing.JLabel(); autorizarCosto.setModalExclusionType(null); autorizarCosto.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL); jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Autorizacin de costos mayores", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP)); t_contra.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_contraActionPerformed(evt); } }); jLabel2.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N jLabel2.setText("Contrasea:"); t_user.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_userActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N jLabel1.setText("Usuario:"); b_autorizar.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N b_autorizar.setText("Autorizar"); b_autorizar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_autorizarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addContainerGap().addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(b_autorizar) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(t_user).addComponent(t_contra, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(18, Short.MAX_VALUE))); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_user, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_contra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(b_autorizar).addGap(23, 23, 23))); javax.swing.GroupLayout autorizarCostoLayout = new javax.swing.GroupLayout(autorizarCosto.getContentPane()); autorizarCosto.getContentPane().setLayout(autorizarCostoLayout); autorizarCostoLayout.setHorizontalGroup( autorizarCostoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); autorizarCostoLayout.setVerticalGroup( autorizarCostoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)); setBackground(new java.awt.Color(255, 255, 255)); setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Eliminacin de Pedidos", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 12))); // NOI18N setLayout(new java.awt.BorderLayout()); jPanel4.setBackground(new java.awt.Color(2, 135, 242)); l_busca.setFont(new java.awt.Font("Arial", 0, 9)); // NOI18N l_busca.setForeground(new java.awt.Color(255, 255, 255)); l_busca.setText("Buscar:"); b_busca.setIcon(new ImageIcon("imagenes/buscar1.png")); b_busca.setToolTipText("Busca una partida"); b_busca.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscaActionPerformed(evt); } }); t_busca.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_busca.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_buscaActionPerformed(evt); } }); t_busca.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_buscaKeyTyped(evt); } }); r_autorizar.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N r_autorizar.setForeground(new java.awt.Color(254, 254, 254)); r_autorizar.setText("Autorizacion 1"); r_autorizar.setEnabled(false); r_autorizar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { r_autorizarActionPerformed(evt); } }); r_autorizar2.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N r_autorizar2.setForeground(new java.awt.Color(254, 254, 254)); r_autorizar2.setText("Autorizacion 2"); r_autorizar2.setEnabled(false); b_eliminar.setIcon(new ImageIcon("imagenes/nuevo.png")); b_eliminar.setText("Eliminar"); b_eliminar.setEnabled(false); b_eliminar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_eliminarActionPerformed(evt); } }); jPanel6.setBackground(new java.awt.Color(2, 135, 242)); jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); l_iva.setFont(new java.awt.Font("Arial", 0, 9)); // NOI18N l_iva.setForeground(new java.awt.Color(255, 255, 255)); l_iva.setText("I.V.A.:"); jPanel6.add(l_iva, new org.netbeans.lib.awtextra.AbsoluteConstraints(21, 20, -1, -1)); t_IVA.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_IVA.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00")))); t_IVA.setHorizontalAlignment(javax.swing.JTextField.RIGHT); t_IVA.setText("0.00"); t_IVA.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_IVA.setEnabled(false); t_IVA.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jPanel6.add(t_IVA, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 20, 88, -1)); t_subtotal.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_subtotal.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00")))); t_subtotal.setHorizontalAlignment(javax.swing.JTextField.RIGHT); t_subtotal.setText("0.00"); t_subtotal.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_subtotal.setEnabled(false); t_subtotal.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jPanel6.add(t_subtotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, 88, -1)); l_subtotal.setFont(new java.awt.Font("Arial", 0, 9)); // NOI18N l_subtotal.setForeground(new java.awt.Color(255, 255, 255)); l_subtotal.setText("Subtotal:"); jPanel6.add(l_subtotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 4, -1, -1)); l_total.setFont(new java.awt.Font("Arial", 0, 9)); // NOI18N l_total.setForeground(new java.awt.Color(255, 255, 255)); l_total.setText("Total:"); jPanel6.add(l_total, new org.netbeans.lib.awtextra.AbsoluteConstraints(23, 40, -1, -1)); t_total.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_total.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory( new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00")))); t_total.setHorizontalAlignment(javax.swing.JTextField.RIGHT); t_total.setText("0.00"); t_total.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_total.setEnabled(false); t_total.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N jPanel6.add(t_total, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 40, 88, -1)); t_notas.setEditable(false); t_notas.setColumns(20); t_notas.setRows(5); t_notas.setDisabledTextColor(new java.awt.Color(2, 38, 253)); jScrollPane2.setViewportView(t_notas); l_notas.setBackground(new java.awt.Color(254, 254, 254)); l_notas.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_notas.setForeground(new java.awt.Color(254, 254, 254)); l_notas.setText("Notas:"); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(75, 75, 75).addComponent(r_autorizar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(r_autorizar2)) .addGroup(jPanel4Layout.createSequentialGroup().addComponent(l_busca).addGap(18, 18, 18) .addComponent(t_busca, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(b_busca, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(b_eliminar))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 330, Short.MAX_VALUE) .addComponent(l_notas).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addComponent(l_notas).addGap(31, 31, 31)) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(r_autorizar).addComponent(r_autorizar2)) .addGap(1, 1, 1) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_busca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_busca)) .addComponent(b_busca, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(b_eliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))); add(jPanel4, java.awt.BorderLayout.PAGE_END); t_datos.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { "#", "R. Valua", "N Parte", "Folio", "Descripcin", "Medida", "Plazo", "Cantidad", "Costo c/u", "Total" })); t_datos.setAutoscrolls(false); t_datos.getTableHeader().setReorderingAllowed(false); scroll.setViewportView(t_datos); t_datos.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); add(scroll, java.awt.BorderLayout.CENTER); p_arriba.setBackground(new java.awt.Color(254, 254, 254)); p_arriba.setLayout(new java.awt.BorderLayout()); p_interno_centro.setBackground(new java.awt.Color(254, 254, 254)); p_interno_centro.setLayout(new java.awt.GridLayout(1, 0)); jPanel2.setBackground(new java.awt.Color(255, 255, 255)); jPanel2.setBorder(null); jPanel2.setLayout(new java.awt.BorderLayout()); jPanel12.setBackground(new java.awt.Color(254, 254, 254)); jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Pedido", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N jLabel3.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N jLabel3.setText("Tipo de Pedido:"); c_tipo.setFont(new java.awt.Font("Droid Sans", 0, 10)); // NOI18N c_tipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Interno", "Externo", "Adicional" })); c_tipo.setEnabled(false); c_tipo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { c_tipoActionPerformed(evt); } }); l_pedido.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_pedido.setText("No:"); t_pedido.setEditable(false); t_pedido.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_pedido.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_pedido.setEnabled(false); l_fecha.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_fecha.setText("Fecha:"); t_fecha.setEditable(false); t_fecha.setText("DD-MM-YYYY HH:MM:SS"); t_fecha.setToolTipText("fecha de pedido"); t_fecha.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_fecha.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_fecha.setEnabled(false); t_folio_externo.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_folio_externo.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_folio_externo.setEnabled(false); l_pedido1.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_pedido1.setText("Folio externo:"); t_plazo.setEditable(false); t_plazo.setText("DD-MM-YYYY"); t_plazo.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_plazo.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_plazo.setEnabled(false); l_plazo.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_plazo.setText("Plazo:"); l_nombre1.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_nombre1.setText("comprador:"); t_id_comprador.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_id_comprador.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_id_comprador.setEnabled(false); t_nombre_comprador.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_nombre_comprador.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_nombre_comprador.setEnabled(false); javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout.setHorizontalGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap().addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(c_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(l_pedido) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_pedido, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel12Layout .createSequentialGroup().addComponent(l_nombre1).addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_id_comprador)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel12Layout.createSequentialGroup().addComponent(l_plazo).addGap(7, 7, 7) .addComponent(t_plazo, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addGap(44, 44, 44) .addComponent(l_pedido1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_folio_externo, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(l_fecha) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(t_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel12Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_nombre_comprador))))) .addContainerGap())); jPanel12Layout.setVerticalGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(c_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3).addComponent(l_pedido).addComponent(t_pedido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_plazo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_plazo)) .addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_pedido1).addComponent(t_folio_externo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(9, 9, 9) .addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_nombre1) .addComponent(t_id_comprador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_nombre_comprador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(l_fecha).addComponent(t_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(16, Short.MAX_VALUE))); jPanel2.add(jPanel12, java.awt.BorderLayout.NORTH); jPanel8.setBackground(new java.awt.Color(254, 254, 254)); jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Orden", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N l_orden.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_orden.setText("Orden:"); t_orden.setEditable(false); t_orden.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_orden.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_orden.setEnabled(false); l_tipo.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_tipo.setText("Tipo:"); t_tipo.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_tipo.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_tipo.setEnabled(false); jLabel21.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel21.setText("Marca:"); t_marca.setBackground(new java.awt.Color(204, 255, 255)); t_marca.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_marca.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_marca.setEnabled(false); l_modelo.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_modelo.setText("Modelo:"); t_modelo.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_modelo.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_modelo.setEnabled(false); t_modelo.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_modeloKeyTyped(evt); } }); jLabel4.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N jLabel4.setText("Siniestro:"); t_siniestro.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_siniestro.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_siniestro.setEnabled(false); t_siniestro.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_siniestroKeyTyped(evt); } }); l_asegurado.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_asegurado.setText("Asegurado:"); t_asegurado.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_asegurado.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_asegurado.setEnabled(false); l_aseguradora.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_aseguradora.setText("Compaa:"); t_id_aseguradora.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_id_aseguradora.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_id_aseguradora.setEnabled(false); t_aseguradora.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_aseguradora.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_aseguradora.setEnabled(false); t_nombre_partida.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_nombre_partida.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_nombre_partida.setEnabled(false); t_id_partida.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_id_partida.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_id_partida.setEnabled(false); l_nombre2.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_nombre2.setText("Partida:"); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap().addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(l_orden) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_orden, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE) .addGap(41, 41, 41).addComponent(l_tipo).addGap(6, 6, 6) .addComponent(t_tipo, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE) .addGap(41, 41, 41).addComponent(jLabel21).addGap(6, 6, 6) .addComponent(t_marca, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) .addGap(46, 46, 46).addComponent(l_modelo) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_modelo, javax.swing.GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(jLabel4).addGap(3, 3, 3) .addComponent(t_siniestro, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(l_asegurado).addGap(3, 3, 3).addComponent(t_asegurado)) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(l_aseguradora).addGap(6, 6, 6) .addComponent(t_id_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_aseguradora)) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(l_nombre2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_id_partida, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(t_nombre_partida))) .addContainerGap())); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addGap(4, 4, 4).addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_tipo).addComponent(t_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_orden, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_orden)))) .addGroup(jPanel8Layout.createSequentialGroup().addGap(5, 5, 5).addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_marca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel21)) .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_modelo).addComponent(t_modelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_siniestro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4).addComponent(l_asegurado).addComponent(t_asegurado, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_aseguradora) .addComponent(t_id_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_nombre2) .addComponent(t_id_partida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_nombre_partida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(4, 4, 4))); jPanel2.add(jPanel8, java.awt.BorderLayout.CENTER); p_interno_centro.add(jPanel2); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jPanel1.setBorder(null); jPanel1.setLayout(new java.awt.BorderLayout()); jPanel5.setBackground(new java.awt.Color(254, 254, 254)); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Proveedor", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N t_proveedor.setEditable(false); t_proveedor.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_proveedor.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_proveedor.setEnabled(false); l_proveedor.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_proveedor.setText("SELECCIONE UN PROVEEDOR"); l_proveedor.setEnabled(false); 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(l_proveedor, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE) .addGap(41, 41, 41).addComponent(t_proveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addGap(3, 3, 3).addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_proveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_proveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 8, Short.MAX_VALUE))); jPanel1.add(jPanel5, java.awt.BorderLayout.NORTH); jPanel13.setBackground(new java.awt.Color(254, 254, 254)); jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11)), "Facturar a", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N l_nombre.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_nombre.setText("Nombre:"); t_nombre.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_nombre.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_nombre.setEnabled(false); t_direccion.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_direccion.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_direccion.setEnabled(false); l_direccion.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_direccion.setText("Direccin:"); l_colonia.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_colonia.setText("Colonia:"); t_colonia.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_colonia.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_colonia.setEnabled(false); l_poblacion.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_poblacion.setText("Poblacin:"); t_poblacion.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_poblacion.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_poblacion.setEnabled(false); t_cp.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_cp.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_cp.setEnabled(false); l_cp.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_cp.setText("C.P.:"); l_rfc.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_rfc.setText("R.F.C.:"); t_rfc.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_rfc.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_rfc.setEnabled(false); t_clave.setEditable(false); t_clave.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_clave.setDisabledTextColor(new java.awt.Color(2, 38, 253)); t_clave.setEnabled(false); l_clave.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N l_clave.setText("Clave:"); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout.setHorizontalGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap().addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addComponent(l_rfc) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_rfc, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(50, 50, 50).addComponent(l_cp) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_cp, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE) .addComponent(l_clave) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_clave, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel13Layout.createSequentialGroup().addComponent(l_colonia).addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel13Layout.createSequentialGroup().addComponent(l_direccion) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_direccion)) .addGroup(jPanel13Layout.createSequentialGroup().addComponent(l_nombre).addGap(21, 21, 21) .addComponent(t_nombre)) .addGroup(jPanel13Layout.createSequentialGroup().addComponent(l_poblacion).addGap(9, 9, 9) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(t_poblacion).addComponent(t_colonia)))) .addContainerGap())); jPanel13Layout.setVerticalGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap().addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(l_nombre) .addComponent(t_nombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(l_direccion, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(t_direccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_colonia).addComponent(t_colonia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_poblacion).addComponent(t_poblacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_clave).addComponent(t_clave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_rfc) .addComponent(t_rfc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_cp).addComponent(t_cp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(41, Short.MAX_VALUE))); jPanel1.add(jPanel13, java.awt.BorderLayout.CENTER); p_interno_centro.add(jPanel1); p_arriba.add(p_interno_centro, java.awt.BorderLayout.CENTER); add(p_arriba, java.awt.BorderLayout.NORTH); }// </editor-fold>//GEN-END:initComponents private void b_buscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscaActionPerformed consulta(); }//GEN-LAST:event_b_buscaActionPerformed private void t_buscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_buscaActionPerformed consulta(); }//GEN-LAST:event_t_buscaActionPerformed private void t_buscaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_buscaKeyTyped evt.setKeyChar(Character.toUpperCase(evt.getKeyChar())); if (t_busca.getText().length() >= 30) evt.consume(); }//GEN-LAST:event_t_buscaKeyTyped private void t_contraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_contraActionPerformed b_autorizar.requestFocus(); }//GEN-LAST:event_t_contraActionPerformed private void t_userActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_userActionPerformed t_contra.requestFocus(); }//GEN-LAST:event_t_userActionPerformed private void b_autorizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_autorizarActionPerformed if (t_user.getText().compareTo("") != 0) { if (t_contra.getPassword().toString().compareTo("") != 0) { session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Usuario autoriza = (Usuario) session.createCriteria(Usuario.class) .add(Restrictions.eq("idUsuario", t_user.getText())) .add(Restrictions.eq("clave", t_contra.getText())).setMaxResults(1).uniqueResult(); if (autoriza != null) { if (autoriza.getAutorizarSobrecosto() == true) { usrAut = autoriza; autorizarCosto.dispose(); } else JOptionPane.showMessageDialog(this, "El usuario no tiene permiso de autorizar!"); } else { session.beginTransaction().rollback(); JOptionPane.showMessageDialog(this, "Datos Incorrectos!"); t_user.requestFocus(); } } catch (Exception e) { session.beginTransaction().rollback(); JOptionPane.showMessageDialog(this, "Error al consultar los datos!"); e.printStackTrace(); } finally { if (session.isOpen() == true) session.close(); } } else { JOptionPane.showMessageDialog(this, "Ingrese la contrasea!"); t_contra.requestFocus(); } } else { JOptionPane.showMessageDialog(this, "Ingrese el usuario!"); t_user.requestFocus(); } }//GEN-LAST:event_b_autorizarActionPerformed private void b_eliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_eliminarActionPerformed if (this.usr.getEliminaPedidos() == true) { if (t_pedido.getText().compareTo("") != 0) { if (r_autorizar.isSelected() == false && r_autorizar2.isSelected() == false) { int opt = JOptionPane.showConfirmDialog(this, "Confirma que deseas eliminar el pedido!"); if (opt == 0) { session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Pedido ped = (Pedido) session.get(Pedido.class, Integer.parseInt(t_pedido.getText())); //ver si tiene entradas String consulta = "select id_pedido as id, " + "if(tipo_pedido='Interno', " + "(select if( sum(movimiento.cantidad) is null, 0, sum(movimiento.cantidad)) as can from partida inner join movimiento on partida.id_partida=movimiento.id_partida inner join almacen on movimiento.id_almacen=almacen.id_almacen where partida.id_pedido=id and almacen.tipo_movimiento=1 and almacen.operacion=1) " + "-(select if( sum(movimiento.cantidad) is null, 0, sum(movimiento.cantidad)) as can from partida inner join movimiento on partida.id_partida=movimiento.id_partida inner join almacen on movimiento.id_almacen=almacen.id_almacen where partida.id_pedido=id and almacen.tipo_movimiento=2 and almacen.operacion=1), " + " (select if( sum(movimiento.cantidad) is null, 0, sum(movimiento.cantidad)) as can from partida_externa inner join movimiento on partida_externa.id_partida_externa=movimiento.id_externos inner join almacen on movimiento.id_almacen=almacen.id_almacen where partida_externa.id_pedido=id and almacen.tipo_movimiento=1 and almacen.operacion in (2, 3)) " + "-(select if( sum(movimiento.cantidad) is null, 0, sum(movimiento.cantidad)) as can from partida_externa inner join movimiento on partida_externa.id_partida_externa=movimiento.id_externos inner join almacen on movimiento.id_almacen=almacen.id_almacen where partida_externa.id_pedido=id and almacen.tipo_movimiento=2 and almacen.operacion in (2, 3)) ) as almacen2 " + "from pedido inner join empleado on pedido.comprador=empleado.id_empleado where pedido.id_pedido = '" + t_pedido.getText() + "'"; Query query = session.createSQLQuery(consulta); query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); ArrayList pedidos = (ArrayList) query.list(); double existencias = 0.0d; for (int a = 0; a < pedidos.size(); a++) { java.util.HashMap map = (java.util.HashMap) pedidos.get(a); existencias = Double.parseDouble(map.get("almacen2").toString()); } if (existencias == 0.0d) { if (c_tipo.getSelectedItem().toString().compareTo("Interno") == 0) { Partida[] partidas = (Partida[]) ped.getPartidas().toArray(new Partida[0]); for (int ren = 0; ren < partidas.length; ren++) { partidas[ren].setPedido(null); session.update(partidas[ren]); } ped = (Pedido) session.get(Pedido.class, Integer.parseInt(t_pedido.getText())); Almacen[] almacen = (Almacen[]) ped.getAlmacens().toArray(new Almacen[0]); for (int alm = 0; alm < ped.getAlmacens().size(); alm++) { session.delete(almacen[alm]); } session.delete(ped); session.beginTransaction().commit(); h = new Herramientas(usr, menu); h.session(sessionPrograma); h.desbloqueaOrden(); h.desbloqueaPedido(); JOptionPane.showMessageDialog(this, "Pedido eliminado!"); Integral padre = (Integral) this.getTopLevelAncestor(); int pos = 0; for (int a = 0; a < padre.P_pestana.getTabCount(); a++) { if (padre.P_pestana.getTitleAt(a).compareTo("Eliminar Pedido") == 0) pos = a; } if (pos >= 0) padre.P_pestana.remove(pos); } if (c_tipo.getSelectedItem().toString().compareTo("Externo") == 0) { OrdenExterna ordex = (OrdenExterna) session.get(OrdenExterna.class, ped.getOrdenExterna().getIdOrden()); session.delete(ordex); Almacen[] almacen = (Almacen[]) ped.getAlmacens().toArray(new Almacen[0]); for (int alm = 0; alm < ped.getAlmacens().size(); alm++) { session.delete(almacen[alm]); } session.delete(ped); session.beginTransaction().commit(); h = new Herramientas(usr, menu); h.session(sessionPrograma); h.desbloqueaOrden(); h.desbloqueaPedido(); JOptionPane.showMessageDialog(this, "Pedido eliminado!"); Integral padre = (Integral) this.getTopLevelAncestor(); int pos = 0; for (int a = 0; a < padre.P_pestana.getTabCount(); a++) { if (padre.P_pestana.getTitleAt(a).compareTo("Eliminar Pedido") == 0) pos = a; } if (pos >= 0) padre.P_pestana.remove(pos); } if (c_tipo.getSelectedItem().toString().compareTo("Adicional") == 0) { Almacen[] almacen = (Almacen[]) ped.getAlmacens().toArray(new Almacen[0]); for (int alm = 0; alm < ped.getAlmacens().size(); alm++) { session.delete(almacen[alm]); } session.delete(ped); session.beginTransaction().commit(); h = new Herramientas(usr, menu); h.session(sessionPrograma); h.desbloqueaOrden(); h.desbloqueaPedido(); JOptionPane.showMessageDialog(this, "Pedido eliminado!"); Integral padre = (Integral) this.getTopLevelAncestor(); int pos = 0; for (int a = 0; a < padre.P_pestana.getTabCount(); a++) { if (padre.P_pestana.getTitleAt(a).compareTo("Eliminar Pedido") == 0) pos = a; } if (pos >= 0) padre.P_pestana.remove(pos); } } else { JOptionPane.showMessageDialog(this, "El pedido tiene " + existencias + " en el almacen!"); } } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); JOptionPane.showMessageDialog(this, "Error al eliminar el pedido!"); } finally { if (session.isOpen()) session.close(); } } } else JOptionPane.showMessageDialog(this, "No se puede eliminar pedidos autorizados!"); } else JOptionPane.showMessageDialog(this, "Seleccione primero un pedido!"); } else JOptionPane.showMessageDialog(null, "Acceso denegado!"); }//GEN-LAST:event_b_eliminarActionPerformed private void r_autorizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_r_autorizarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_r_autorizarActionPerformed private void c_tipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_c_tipoActionPerformed // TODO add your handling code here: /*if(c_tipo.getSelectedItem().toString().compareTo("Interno")==0) { datos_unidad("", "", "", "", "", "","","", ""); this.t_folio_externo.setEnabled(false); this.t_id_comprador.setText(""); this.t_nombre_comprador.setText(""); this.b_comprador.setEnabled(true); this.t_orden.setText(""); this.b_orden.setEnabled(true); this.b_tipo.setEnabled(false); this.b_marca.setEnabled(false); this.t_modelo.setEnabled(false); //this.t_serie.setEnabled(false); this.b_aseguradora.setEnabled(false); this.t_siniestro.setEnabled(false); this.t_asegurado.setEnabled(false); this.t_folio_externo.setEnabled(false); this.t_folio_externo.setText(""); this.b_partida.setEnabled(false); this.t_nombre_partida.setText(""); this.t_id_partida.setText(""); this.b_calendario.setEnabled(false); } if(c_tipo.getSelectedItem().toString().compareTo("Externo")==0) { datos_unidad("", "", "", "", "", "","","", ""); this.t_folio_externo.setEnabled(true); this.t_id_comprador.setText(""); this.t_nombre_comprador.setText(""); this.b_comprador.setEnabled(true); this.t_orden.setText(""); this.orden_act=null; this.b_orden.setEnabled(false); this.b_tipo.setEnabled(true); this.b_marca.setEnabled(true); this.t_modelo.setEnabled(true); //this.t_serie.setEnabled(true); this.b_aseguradora.setEnabled(true); this.t_siniestro.setEnabled(true); this.t_asegurado.setEnabled(true); this.t_folio_externo.setEnabled(true); this.t_folio_externo.setText(""); this.t_nombre_partida.setText(""); this.t_id_partida.setText(""); this.b_calendario.setEnabled(false); } if(c_tipo.getSelectedItem().toString().compareTo("Adicional")==0) { datos_unidad("", "", "", "", "", "","","", ""); this.t_folio_externo.setEnabled(false); this.t_id_comprador.setText(""); this.t_nombre_comprador.setText(""); this.b_comprador.setEnabled(true); this.t_orden.setText(""); this.b_orden.setEnabled(true); this.b_tipo.setEnabled(false); this.b_marca.setEnabled(false); this.t_modelo.setEnabled(false); this.b_aseguradora.setEnabled(false); this.t_siniestro.setEnabled(false); this.t_asegurado.setEnabled(false); this.t_folio_externo.setEnabled(false); this.t_folio_externo.setText(""); this.b_partida.setEnabled(true); this.t_nombre_partida.setText(""); this.t_id_partida.setText(""); this.b_calendario.setEnabled(false); } model=new MyModel(0, columnas); t_datos.setModel(model); formatoTabla();*/ }//GEN-LAST:event_c_tipoActionPerformed private void t_modeloKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_modeloKeyTyped // TODO add your handling code here: char car = evt.getKeyChar(); if (t_modelo.getText().length() >= 4) evt.consume(); if ((car < '0' || car > '9')) evt.consume(); }//GEN-LAST:event_t_modeloKeyTyped private void t_siniestroKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_siniestroKeyTyped // TODO add your handling code here: char car = evt.getKeyChar(); if (t_siniestro.getText().length() >= 18) evt.consume(); }//GEN-LAST:event_t_siniestroKeyTyped // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JDialog autorizarCosto; private javax.swing.JButton b_autorizar; private javax.swing.JButton b_busca; private javax.swing.JButton b_eliminar; private javax.swing.JComboBox c_tipo; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JLabel l_asegurado; private javax.swing.JLabel l_aseguradora; private javax.swing.JLabel l_busca; private javax.swing.JLabel l_clave; private javax.swing.JLabel l_colonia; private javax.swing.JLabel l_cp; private javax.swing.JLabel l_direccion; private javax.swing.JLabel l_fecha; private javax.swing.JLabel l_iva; private javax.swing.JLabel l_modelo; private javax.swing.JLabel l_nombre; private javax.swing.JLabel l_nombre1; private javax.swing.JLabel l_nombre2; private javax.swing.JLabel l_notas; private javax.swing.JLabel l_orden; private javax.swing.JLabel l_pedido; private javax.swing.JLabel l_pedido1; private javax.swing.JLabel l_plazo; private javax.swing.JLabel l_poblacion; private javax.swing.JLabel l_proveedor; private javax.swing.JLabel l_rfc; private javax.swing.JLabel l_subtotal; private javax.swing.JLabel l_tipo; private javax.swing.JLabel l_total; private javax.swing.JPanel p_arriba; private javax.swing.JPanel p_interno_centro; private javax.swing.JRadioButton r_autorizar; private javax.swing.JRadioButton r_autorizar2; private javax.swing.JScrollPane scroll; private javax.swing.JFormattedTextField t_IVA; private javax.swing.JTextField t_asegurado; private javax.swing.JTextField t_aseguradora; private javax.swing.JTextField t_busca; private javax.swing.JTextField t_clave; private javax.swing.JTextField t_colonia; private javax.swing.JPasswordField t_contra; private javax.swing.JTextField t_cp; private javax.swing.JTable t_datos; private javax.swing.JTextField t_direccion; private javax.swing.JTextField t_fecha; private javax.swing.JTextField t_folio_externo; private javax.swing.JTextField t_id_aseguradora; private javax.swing.JTextField t_id_comprador; private javax.swing.JTextField t_id_partida; private javax.swing.JTextField t_marca; private javax.swing.JTextField t_modelo; private javax.swing.JTextField t_nombre; private javax.swing.JTextField t_nombre_comprador; private javax.swing.JTextField t_nombre_partida; private javax.swing.JTextArea t_notas; private javax.swing.JTextField t_orden; private javax.swing.JTextField t_pedido; private javax.swing.JTextField t_plazo; private javax.swing.JTextField t_poblacion; private javax.swing.JTextField t_proveedor; private javax.swing.JTextField t_rfc; private javax.swing.JTextField t_siniestro; private javax.swing.JFormattedTextField t_subtotal; private javax.swing.JTextField t_tipo; private javax.swing.JFormattedTextField t_total; private javax.swing.JTextField t_user; // End of variables declaration//GEN-END:variables public void tabla_tamaos() { FormatoEditor fe=new FormatoEditor(); t_datos.setDefaultEditor(Double.class, fe); TableColumnModel col_model = t_datos.getColumnModel(); for (int i=0; i<t_datos.getColumnCount(); i++) { TableColumn column = col_model.getColumn(i); switch(i) { case 0: column.setPreferredWidth(10); break; case 1: column.setPreferredWidth(10); break; case 2: column.setPreferredWidth(10); break; case 3: column.setPreferredWidth(100); break; case 4: column.setPreferredWidth(10); break; case 5: column.setPreferredWidth(400); break; case 6: column.setPreferredWidth(10); break; case 7: column.setPreferredWidth(10); break; case 8: column.setPreferredWidth(10); break; case 9: column.setPreferredWidth(30); break; case 10: column.setPreferredWidth(30); break; default: column.setPreferredWidth(40); break; } } JTableHeader header = t_datos.getTableHeader(); header.setForeground(Color.white); } public void titulos() { Color c1 = new java.awt.Color(2, 135, 242); for(int x=0; x<t_datos.getColumnModel().getColumnCount(); x++) t_datos.getColumnModel().getColumn(x).setHeaderRenderer(new Render1(c1)); tabla_tamaos(); t_datos.setShowVerticalLines(true); t_datos.setShowHorizontalLines(true); FormatoEditor fe=new FormatoEditor(); t_datos.setDefaultEditor(Double.class, fe); FormatoEditorTexto fs=new FormatoEditorTexto(); t_datos.setDefaultEditor(String.class, fs); t_datos.setDefaultRenderer(Double.class, formato); t_datos.setDefaultRenderer(Integer.class, formato); t_datos.setDefaultRenderer(String.class, formato); t_datos.setDefaultRenderer(Boolean.class, formato); } public void busca() { if (pedido != null) { this.b_eliminar.setEnabled(true); h = new Herramientas(usr, menu); h.session(sessionPrograma); h.desbloqueaOrden(); h.desbloqueaPedido(); Session session = HibernateUtil.getSessionFactory().openSession(); try { this.t_pedido.setText(""); this.t_proveedor.setText(""); this.t_plazo.setText(""); this.t_orden.setText(""); this.t_fecha.setText("DD/MM/AAAA"); this.l_proveedor.setText("SELECCIONE UN PROVEEDOR"); this.t_notas.setText(""); this.t_nombre.setText(""); this.t_direccion.setText(""); this.t_poblacion.setText(""); this.t_colonia.setText(""); this.t_cp.setText(""); this.t_rfc.setText(""); this.t_tipo.setText(""); this.t_marca.setText(""); this.t_modelo.setText(""); this.t_id_aseguradora.setText(""); this.t_aseguradora.setText(""); this.t_siniestro.setText(""); this.t_asegurado.setText(""); this.t_folio_externo.setText(""); this.t_id_partida.setText(""); this.t_nombre_partida.setText(""); session.beginTransaction().begin(); pedido = (Pedido) session.get(Pedido.class, pedido.getIdPedido()); String resp = ""; //*********cargamos datos de la factura************************* this.t_pedido.setText("" + pedido.getIdPedido()); this.t_proveedor.setText("" + pedido.getProveedorByIdProveedor().getIdProveedor()); l_proveedor.setText(pedido.getProveedorByIdProveedor().getNombre()); this.t_plazo.setText(""); Partida[] part = (Partida[]) pedido.getPartidas().toArray(new Partida[0]); PartidaExterna[] partEx = (PartidaExterna[]) pedido.getPartidaExternas() .toArray(new PartidaExterna[0]); if (part.length > 0) t_orden.setText("" + part[0].getOrdenByIdOrden().getIdOrden()); if (pedido.getNotas() != null) this.t_notas.setText(pedido.getNotas()); else this.t_notas.setText(""); t_fecha.setText("" + pedido.getFechaPedido()); //************cargamos dator de facturacion********************* this.t_clave.setText("" + pedido.getProveedorByIdEmpresa().getIdProveedor()); this.t_nombre.setText(pedido.getProveedorByIdEmpresa().getNombre()); if (pedido.getProveedorByIdEmpresa() != null) this.t_direccion.setText(pedido.getProveedorByIdEmpresa().getDireccion()); else this.t_direccion.setText(""); if (pedido.getProveedorByIdEmpresa() != null) this.t_colonia.setText(pedido.getProveedorByIdEmpresa().getColonia()); else this.t_colonia.setText(""); if (pedido.getProveedorByIdEmpresa() != null) this.t_poblacion.setText(pedido.getProveedorByIdEmpresa().getPoblacion()); else this.t_poblacion.setText(""); this.t_rfc.setText(pedido.getProveedorByIdEmpresa().getRfc()); if (pedido.getProveedorByIdEmpresa() != null) this.t_cp.setText(pedido.getProveedorByIdEmpresa().getCp()); else this.t_cp.setText(""); //************cargamos datos de la orden*********************** if (part.length > 0) { c_tipo.setSelectedItem("Interno"); resp = h.estadoOrden(part[0].getOrdenByIdOrden()); orden_act = part[0].getOrdenByIdOrden(); t_tipo.setText(part[0].getOrdenByIdOrden().getTipo().getTipoNombre()); t_marca.setText(part[0].getOrdenByIdOrden().getMarca().getIdMarca()); t_modelo.setText("" + part[0].getOrdenByIdOrden().getModelo()); t_id_aseguradora.setText("" + part[0].getOrdenByIdOrden().getCompania().getIdCompania()); t_aseguradora.setText(part[0].getOrdenByIdOrden().getCompania().getNombre()); if (part[0].getOrdenByIdOrden().getSiniestro() != null) t_siniestro.setText(part[0].getOrdenByIdOrden().getSiniestro()); else t_siniestro.setText(""); t_asegurado.setText(part[0].getOrdenByIdOrden().getClientes().getNombre()); t_folio_externo.setText(""); this.t_id_comprador.setText("" + pedido.getEmpleado().getIdEmpleado()); this.t_nombre_comprador.setText(pedido.getEmpleado().getNombre()); } else { if (partEx.length > 0 && pedido.getOrdenExterna() != null) { c_tipo.setSelectedItem("Externo"); if (pedido.getOrdenExterna().getTipo() != null) t_tipo.setText(pedido.getOrdenExterna().getTipo().getTipoNombre()); else t_tipo.setText(""); if (pedido.getOrdenExterna().getMarca() != null) t_marca.setText(pedido.getOrdenExterna().getMarca().getIdMarca()); else t_marca.setText(""); if (pedido.getOrdenExterna().getModelo() != null) t_modelo.setText("" + pedido.getOrdenExterna().getModelo()); else t_modelo.setText(""); if (pedido.getOrdenExterna().getCompania() != null) { t_id_aseguradora.setText("" + pedido.getOrdenExterna().getCompania().getIdCompania()); t_aseguradora.setText(pedido.getOrdenExterna().getCompania().getNombre()); } else { t_id_aseguradora.setText(""); t_aseguradora.setText(""); } if (pedido.getOrdenExterna().getAsegurado() != null) t_asegurado.setText(pedido.getOrdenExterna().getAsegurado()); else t_asegurado.setText(""); if (pedido.getOrdenExterna().getSiniestro() != null) this.t_siniestro.setText(pedido.getOrdenExterna().getSiniestro()); else this.t_siniestro.setText(""); //agregar el commprador this.t_id_comprador.setText("" + pedido.getEmpleado().getIdEmpleado()); this.t_nombre_comprador.setText(pedido.getEmpleado().getNombre()); } else { //if(pedido.getPartida()!=null) //{ c_tipo.setSelectedItem("Adicional"); orden_act = pedido.getOrden(); orden_act = (Orden) session.get(Orden.class, orden_act.getIdOrden()); resp = h.estadoOrden(orden_act); t_orden.setText("" + orden_act.getIdOrden()); t_tipo.setText(orden_act.getTipo().getTipoNombre()); t_marca.setText(orden_act.getMarca().getIdMarca()); t_modelo.setText("" + orden_act.getModelo()); t_id_aseguradora.setText("" + orden_act.getCompania().getIdCompania()); t_aseguradora.setText(orden_act.getCompania().getNombre()); if (orden_act.getSiniestro() != null) t_siniestro.setText(orden_act.getSiniestro()); else t_siniestro.setText(""); t_asegurado.setText(orden_act.getClientes().getNombre()); t_folio_externo.setText(""); t_id_partida.setText("");//+pedido.getPartida().getIdPartida()); t_nombre_partida.setText("");//pedido.getPartida().getCatalogo().getNombre()); this.t_id_comprador.setText("" + pedido.getEmpleado().getIdEmpleado()); this.t_nombre_comprador.setText(pedido.getEmpleado().getNombre()); /*} else { t_tipo.setText(""); t_marca.setText(""); t_modelo.setText(""); t_aseguradora.setText(""); t_siniestro.setText(""); t_asegurado.setText(""); t_folio_externo.setText(""); }*/ } } //***ordenamos las partidas************ Partida aux; for (int k = 0; k < part.length; k++) { for (int f = 0; f < (part.length - 1) - k; f++) { if (part[f].getIdEvaluacion() > part[f + 1].getIdEvaluacion()) { aux = part[f]; part[f] = part[f + 1]; part[f + 1] = aux; } if (part[f].getIdEvaluacion() == part[f + 1].getIdEvaluacion() && part[f].getSubPartida() > part[f + 1].getSubPartida()) { aux = part[f]; part[f] = part[f + 1]; part[f + 1] = aux; } } } for (int k = 0; k < partEx.length; k++) { for (int f = 0; f < (partEx.length - 1) - k; f++) { if (partEx[f].getIdPartidaExterna() > partEx[f + 1].getIdPartidaExterna()) { PartidaExterna auxEx = partEx[f]; partEx[f] = partEx[f + 1]; partEx[f + 1] = auxEx; } } } //********** double tot = 0.0d; if (c_tipo.getSelectedItem().toString().compareTo("Interno") == 0) { model = new MyModel(part.length, columnas); t_datos.setModel(model); for (int r = 0; r < part.length; r++) { model.setValueAt(part[r].getIdPartida(), r, 0); model.setValueAt(part[r].getIdEvaluacion(), r, 1); model.setValueAt(part[r].getSubPartida(), r, 2); if (part[r].getEjemplar() != null) model.setValueAt(part[r].getEjemplar().getIdParte(), r, 3); else model.setValueAt("", r, 3); model.setValueAt(part[r].getCatalogo().getIdCatalogo(), r, 4); model.setValueAt(part[r].getCatalogo().getNombre(), r, 5); model.setValueAt(part[r].getMed(), r, 6); if (part[r].getPlazo() != null) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); model.setValueAt(sdf.format(part[r].getPlazo()), r, 7); } else model.setValueAt("0", r, 7); if (part[r].getCantPcp() != 0.0d) model.setValueAt(part[r].getCantPcp(), r, 8); else model.setValueAt(0, r, 8); if (part[r].getPcp() != null) model.setValueAt(part[r].getPcp(), r, 9); else model.setValueAt(0, r, 9); double sum = part[r].getCantPcp() * part[r].getPcp(); tot += sum; model.setValueAt(sum, r, 10); } } if (c_tipo.getSelectedItem().toString().compareTo("Externo") == 0 || c_tipo.getSelectedItem().toString().compareTo("Adicional") == 0) { model = new MyModel(partEx.length, columnas); t_datos.setModel(model); for (int r = 0; r < partEx.length; r++) { model.setValueAt(partEx[r].getIdPartidaExterna(), r, 0); model.setValueAt(partEx[r].getPartida(), r, 1); model.setValueAt(partEx[r].getIdValuacion(), r, 2); if (partEx[r].getNoParte() != null) model.setValueAt(partEx[r].getNoParte(), r, 3); else model.setValueAt("", r, 3); model.setValueAt("", r, 4); model.setValueAt(partEx[r].getDescripcion(), r, 5); model.setValueAt(partEx[r].getUnidad(), r, 6); if (partEx[r].getPlazo() != null) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); model.setValueAt(sdf.format(partEx[r].getPlazo()), r, 7); } else model.setValueAt("0", r, 7); if (partEx[r].getCantidad() != null) model.setValueAt(partEx[r].getCantidad(), r, 8); else model.setValueAt(0, r, 8); if (partEx[r].getCosto() != null) model.setValueAt(partEx[r].getCosto(), r, 9); else model.setValueAt(0, r, 9); double sum = partEx[r].getCantidad() * partEx[r].getCosto(); tot += sum; model.setValueAt(sum, r, 10); } } t_subtotal.setValue(tot); double iva = tot * .16; t_IVA.setValue(iva); t_total.setValue(tot + iva); //checar si la orden ya fue autorizada if (pedido.getUsuarioByAutorizo() != null || pedido.getUsuarioByAutorizo2() != null) { if (pedido.getUsuarioByAutorizo() != null) { r_autorizar.setSelected(true); r_autorizar.setText(pedido.getUsuarioByAutorizo().getEmpleado().getNombre()); } else { r_autorizar.setSelected(false); r_autorizar.setText("Autorizacion 1"); } if (pedido.getUsuarioByAutorizo2() != null) { r_autorizar2.setSelected(true); r_autorizar2.setText(pedido.getUsuarioByAutorizo2().getEmpleado().getNombre()); } else { r_autorizar2.setSelected(false); r_autorizar2.setText("Autorizacion 2"); } model.setColumnaEditable(0, false); model.setColumnaEditable(1, false); model.setColumnaEditable(2, false); model.setColumnaEditable(4, false); model.setColumnaEditable(5, false); model.setColumnaEditable(7, false); model.setColumnaEditable(8, false); model.setColumnaEditable(9, false); b_eliminar.setEnabled(false); } else { r_autorizar.setSelected(false); r_autorizar2.setSelected(false); r_autorizar.setText("Autorizacion 1"); r_autorizar2.setText("Autorizacion 2"); b_eliminar.setEnabled(true); } //vemos si la orden no esta bloqueada if (c_tipo.getSelectedItem().toString().compareTo("Interno") == 0 || c_tipo.getSelectedItem().toString().compareTo("Adicional") == 0) { if (resp.compareTo("") == 0 || resp.compareTo("*bloqueada ok*") != 0) { this.b_eliminar.setEnabled(false); JOptionPane.showMessageDialog(null, "Orden bloqueada por:" + orden_act.getUsuarioByBloqueada().getIdUsuario()); } if (b_eliminar.isEnabled() != false) { resp = h.estadoPedido(pedido); if (resp.compareTo("") == 0 || resp.compareTo("*bloqueada ok*") != 0) { this.b_eliminar.setEnabled(false); JOptionPane.showMessageDialog(null, "Pedido bloqueado por:" + pedido.getUsuarioByBloqueado().getIdUsuario()); } } if (orden_act != null && orden_act.getFechaCierre() != null) { this.b_eliminar.setEnabled(false); JOptionPane.showMessageDialog(null, "Orden cerrada"); } } else { resp = h.estadoPedido(pedido); if (resp.compareTo("") == 0 || resp.compareTo("*bloqueada ok*") != 0) { this.b_eliminar.setEnabled(false); JOptionPane.showMessageDialog(null, "Pedido bloqueado por:" + pedido.getUsuarioByBloqueado().getIdUsuario()); } } session.beginTransaction().commit(); } catch (Exception e) { e.printStackTrace(); this.t_pedido.setText(""); this.t_proveedor.setText(""); this.t_plazo.setText(""); this.t_orden.setText(""); this.t_fecha.setText("DD/MM/AAAA"); this.l_proveedor.setText("SELECCIONE UN PROVEEDOR"); this.t_notas.setText(""); this.t_nombre.setText(""); this.t_direccion.setText(""); this.t_poblacion.setText(""); this.t_colonia.setText(""); this.t_cp.setText(""); this.t_rfc.setText(""); this.t_tipo.setText(""); this.t_marca.setText(""); this.t_modelo.setText(""); this.t_id_aseguradora.setText(""); this.t_aseguradora.setText(""); this.t_siniestro.setText(""); this.t_asegurado.setText(""); this.t_folio_externo.setText(""); this.r_autorizar.setEnabled(false); this.r_autorizar2.setEnabled(false); b_eliminar.setEnabled(false); session.beginTransaction().rollback(); } finally { if (session.isOpen() == true) session.close(); } } else { b_eliminar.setEnabled(false); } titulos(); } private List<Object[]> executeHQLQuery(String hql) { try { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); Query q = session.createQuery(hql); List resultList = q.list(); session.getTransaction().commit(); session.disconnect(); return resultList; } catch (HibernateException he) { he.printStackTrace(); List lista = null; return lista; } } public class MyModel extends DefaultTableModel { Class[] types = new Class[] { java.lang.String.class/*interno*/, java.lang.String.class/*#*/, java.lang.String.class/*R.Valua*/, java.lang.String.class/*N Parte*/, java.lang.String.class/*Folio*/, java.lang.String.class/*Descripcin*/, java.lang.String.class/*Medida*/, java.lang.String.class/*Plazo*/, java.lang.Double.class/*Cantidad*/, java.lang.Double.class/*Costo c/u*/, java.lang.Double.class/*Total*/ }; int ren = 0; int col = 0; private List celdaEditable; public MyModel(int renglones, String columnas[]) { ren = renglones; col = columnas.length; celdaEditable = new ArrayList(); //celdaEditable=new boolean[types.length][renglones]; for (int x = 0; x < renglones; x++) { List aux = new ArrayList(); for (int y = 0; y < types.length; y++) aux.add(false); celdaEditable.add(aux); } this.setDataVector(new Object[renglones][columnas.length], columnas); } @Override public int getRowCount() { return ren; } @Override public int getColumnCount() { return col; } @Override public void setValueAt(Object value, int row, int col) { Vector vector = (Vector) this.dataVector.elementAt(row); Object celda = ((Vector) this.dataVector.elementAt(row)).elementAt(col); switch (col) { default: vector.setElementAt(value, col); dataVector.setElementAt(vector, row); fireTableCellUpdated(row, col); break; } } public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { List aux = (List) celdaEditable.get(rowIndex); return (boolean) aux.get(columnIndex); } @Override public void removeRow(int row) { //Vector vector = (Vector)dataVector.elementAt(0); dataVector.remove(row); celdaEditable.remove(row); //vector.remove(row); fireTableRowsDeleted(row, row); this.ren = ren - 1; } @Override public void addRow(Object[] vec) { insertRow(getRowCount(), vec); } @Override public void insertRow(int row, Object[] rowData) { Vector vector = new Vector(); for (int x = 0; x < rowData.length; x++) vector.add(rowData[x]); dataVector.insertElementAt(vector, row); List aux = new ArrayList(); for (int x = 0; x < rowData.length; x++) { if (x == 7 || x == 8) aux.add(true); else aux.add(false); } celdaEditable.add(ren, aux); fireTableRowsInserted(row, row); this.ren = ren + 1; } public void setCeldaEditable(int fila, int columna, boolean editable) { //this.celdaEditable[ columna ][ fila ] = editable; List aux = (List) celdaEditable.get(fila); aux.set(columna, editable); } public void setColumnaEditable(int columna, boolean editable) { for (int i = 0; i < celdaEditable.size(); i++) { List aux = (List) celdaEditable.get(i); aux.set(columna, editable); } } } void consulta() { h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_busca.getText().compareToIgnoreCase("") != 0) { if (x >= t_datos.getRowCount()) x = 0; for (; x < t_datos.getRowCount(); x++) { if (t_datos.getValueAt(x, 5).toString().indexOf(t_busca.getText()) != -1) { t_datos.setRowSelectionInterval(x, x); t_datos.setColumnSelectionInterval(4, 5); break; } } x++; } } public void formatoTabla() { Color c1 = new java.awt.Color(2, 135, 242); for(int x=0; x<t_datos.getColumnModel().getColumnCount(); x++) { t_datos.getColumnModel().getColumn(x).setHeaderRenderer(new Render1(c1)); } tabla_tamaos(); t_datos.setShowVerticalLines(true); t_datos.setShowHorizontalLines(true); t_datos.setDefaultRenderer(Double.class, formato); t_datos.setDefaultRenderer(Integer.class, formato); } }