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 Operaciones; import Hibernate.Util.HibernateUtil; import Hibernate.entidades.Empleado; import Hibernate.entidades.Orden; import Hibernate.entidades.Usuario; import Servicios.buscaOrden; import Empleados.buscaEmpleado; import Hibernate.entidades.Configuracion; import Hibernate.entidades.Foto; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import Integral.Herramientas; import Integral.PDF; import Integral.calendario; import com.itextpdf.text.Image; import com.itextpdf.text.pdf.AcroFields; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; import java.io.File; import java.io.FileOutputStream; /** * * @author salvador */ public class ResponsablesOP extends javax.swing.JPanel { private Usuario usr; public Orden orden_act = null; Herramientas h; String estado = ""; String sessionPrograma = ""; /** * Creates new form Responsables */ public ResponsablesOP(String ses, Usuario usuario) { sessionPrograma = ses; usr = usuario; initComponents(); jButton1.setIcon(new ImageIcon("imagenes/pdf.png")); } /** * 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() { jPanel1 = new javax.swing.JPanel(); jLabel = new javax.swing.JLabel(); t_hojalateria = new javax.swing.JTextField(); b_buscarh = new javax.swing.JButton(); b_borrarh = new javax.swing.JButton(); l_hojalateria = new javax.swing.JLabel(); t_rhojalateria = new javax.swing.JTextField(); l_autorizoh = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); t_mecanica = new javax.swing.JTextField(); b_buscarm = new javax.swing.JButton(); b_borrarm = new javax.swing.JButton(); l_mecanica = new javax.swing.JLabel(); t_rmecanica = new javax.swing.JTextField(); l_autorizom = new javax.swing.JLabel(); t_suspension = new javax.swing.JTextField(); l_suspension = new javax.swing.JLabel(); b_borrars = new javax.swing.JButton(); b_buscars = new javax.swing.JButton(); l_autorizos = new javax.swing.JLabel(); t_rsuspension = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); t_electrico = new javax.swing.JTextField(); t_relectrico = new javax.swing.JTextField(); b_buscare = new javax.swing.JButton(); l_autorizoe = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); l_electrico = new javax.swing.JLabel(); b_borrare = new javax.swing.JButton(); l_orden = new javax.swing.JLabel(); t_orden = new javax.swing.JTextField(); b_buscaro = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); t_pintura = new javax.swing.JTextField(); b_buscarp = new javax.swing.JButton(); b_borrarp = new javax.swing.JButton(); l_pintura = new javax.swing.JLabel(); t_rpintura = new javax.swing.JTextField(); l_autorizop = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); h_limite = new javax.swing.JTextField(); m_limite = new javax.swing.JTextField(); s_limite = new javax.swing.JTextField(); e_limite = new javax.swing.JTextField(); p_limite = new javax.swing.JTextField(); h_fecha = new javax.swing.JButton(); m_fecha = new javax.swing.JButton(); s_fecha = new javax.swing.JButton(); p_fecha = new javax.swing.JButton(); e_fecha = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jLabel.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel.setText("1.- Hojalatera:"); jLabel.setMaximumSize(new java.awt.Dimension(210, 15)); jLabel.setMinimumSize(new java.awt.Dimension(210, 15)); jLabel.setPreferredSize(new java.awt.Dimension(210, 15)); t_hojalateria.setBackground(new java.awt.Color(204, 255, 255)); t_hojalateria.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_hojalateria.setEnabled(false); b_buscarh.setBackground(new java.awt.Color(2, 135, 242)); b_buscarh.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscarh.setToolTipText("Consultar empleados"); b_buscarh.setEnabled(false); b_buscarh.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscarh.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscarh.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscarh.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscarhActionPerformed(evt); } }); b_borrarh.setBackground(new java.awt.Color(2, 135, 242)); b_borrarh.setIcon(new ImageIcon("imagenes/eliminar.png")); b_borrarh.setToolTipText("Eliminar asignacin"); b_borrarh.setEnabled(false); b_borrarh.setMaximumSize(new java.awt.Dimension(32, 8)); b_borrarh.setMinimumSize(new java.awt.Dimension(32, 8)); b_borrarh.setPreferredSize(new java.awt.Dimension(32, 8)); b_borrarh.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_borrarhActionPerformed(evt); } }); l_hojalateria.setText("<Nombre del Responsable>"); t_rhojalateria.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_rhojalateria.setEnabled(false); t_rhojalateria.setMinimumSize(new java.awt.Dimension(250, 19)); t_rhojalateria.setName(""); // NOI18N t_rhojalateria.setPreferredSize(new java.awt.Dimension(250, 19)); l_autorizoh.setText("<Usuario que asigno operacin>"); l_autorizoh.setMaximumSize(new java.awt.Dimension(300, 15)); l_autorizoh.setMinimumSize(new java.awt.Dimension(300, 15)); l_autorizoh.setPreferredSize(new java.awt.Dimension(300, 15)); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel5.setForeground(new java.awt.Color(0, 51, 255)); jLabel5.setText("Responsable"); jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel7.setForeground(new java.awt.Color(0, 51, 255)); jLabel7.setText("No Emp."); jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel14.setForeground(new java.awt.Color(0, 51, 255)); jLabel14.setText("Fecha y Hora"); jLabel15.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel15.setForeground(new java.awt.Color(0, 51, 255)); jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel15.setText("Asigno Operacin"); jLabel1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel1.setText("2.- Mecnica:"); jLabel1.setMaximumSize(new java.awt.Dimension(210, 15)); jLabel1.setMinimumSize(new java.awt.Dimension(210, 15)); jLabel1.setPreferredSize(new java.awt.Dimension(210, 15)); t_mecanica.setBackground(new java.awt.Color(204, 255, 255)); t_mecanica.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_mecanica.setEnabled(false); b_buscarm.setBackground(new java.awt.Color(2, 135, 242)); b_buscarm.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscarm.setToolTipText("Consultar empleados"); b_buscarm.setEnabled(false); b_buscarm.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscarm.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscarm.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscarm.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscarmActionPerformed(evt); } }); b_borrarm.setBackground(new java.awt.Color(2, 135, 242)); b_borrarm.setIcon(new ImageIcon("imagenes/eliminar.png")); b_borrarm.setToolTipText("Eliminar asignacin"); b_borrarm.setEnabled(false); b_borrarm.setMaximumSize(new java.awt.Dimension(32, 8)); b_borrarm.setMinimumSize(new java.awt.Dimension(32, 8)); b_borrarm.setPreferredSize(new java.awt.Dimension(32, 8)); b_borrarm.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_borrarmActionPerformed(evt); } }); l_mecanica.setText("<Nombre del Responsable>"); t_rmecanica.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_rmecanica.setEnabled(false); t_rmecanica.setMinimumSize(new java.awt.Dimension(250, 19)); t_rmecanica.setName(""); // NOI18N t_rmecanica.setPreferredSize(new java.awt.Dimension(250, 19)); l_autorizom.setText("<Usuario que asigno operacin>"); l_autorizom.setMaximumSize(new java.awt.Dimension(300, 15)); l_autorizom.setMinimumSize(new java.awt.Dimension(300, 15)); l_autorizom.setPreferredSize(new java.awt.Dimension(300, 15)); t_suspension.setBackground(new java.awt.Color(204, 255, 255)); t_suspension.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_suspension.setEnabled(false); l_suspension.setText("<Nombre del Responsable>"); b_borrars.setBackground(new java.awt.Color(2, 135, 242)); b_borrars.setIcon(new ImageIcon("imagenes/eliminar.png")); b_borrars.setToolTipText("Eliminar asignacin"); b_borrars.setEnabled(false); b_borrars.setMaximumSize(new java.awt.Dimension(32, 8)); b_borrars.setMinimumSize(new java.awt.Dimension(32, 8)); b_borrars.setPreferredSize(new java.awt.Dimension(32, 8)); b_borrars.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_borrarsActionPerformed(evt); } }); b_buscars.setBackground(new java.awt.Color(2, 135, 242)); b_buscars.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscars.setToolTipText("Consultar empleados"); b_buscars.setEnabled(false); b_buscars.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscars.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscars.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscars.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscarsActionPerformed(evt); } }); l_autorizos.setText("<Usuario que asigno operacin>"); l_autorizos.setMaximumSize(new java.awt.Dimension(300, 15)); l_autorizos.setMinimumSize(new java.awt.Dimension(300, 15)); l_autorizos.setPreferredSize(new java.awt.Dimension(300, 15)); t_rsuspension.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_rsuspension.setEnabled(false); t_rsuspension.setMinimumSize(new java.awt.Dimension(250, 19)); t_rsuspension.setName(""); // NOI18N t_rsuspension.setPreferredSize(new java.awt.Dimension(250, 19)); jLabel2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel2.setText("3.- Suspensin:"); jLabel2.setMaximumSize(new java.awt.Dimension(210, 15)); jLabel2.setMinimumSize(new java.awt.Dimension(210, 15)); jLabel2.setPreferredSize(new java.awt.Dimension(210, 15)); t_electrico.setBackground(new java.awt.Color(204, 255, 255)); t_electrico.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_electrico.setEnabled(false); t_relectrico.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_relectrico.setEnabled(false); t_relectrico.setMinimumSize(new java.awt.Dimension(250, 19)); t_relectrico.setName(""); // NOI18N t_relectrico.setPreferredSize(new java.awt.Dimension(250, 19)); b_buscare.setBackground(new java.awt.Color(2, 135, 242)); b_buscare.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscare.setToolTipText("Consultar empleados"); b_buscare.setEnabled(false); b_buscare.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscare.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscare.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscare.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscareActionPerformed(evt); } }); l_autorizoe.setText("<Usuario que asigno operacin>"); l_autorizoe.setMaximumSize(new java.awt.Dimension(300, 15)); l_autorizoe.setMinimumSize(new java.awt.Dimension(300, 15)); l_autorizoe.setPreferredSize(new java.awt.Dimension(300, 15)); jLabel3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel3.setText("4.- Electrico:"); jLabel3.setMaximumSize(new java.awt.Dimension(210, 15)); jLabel3.setMinimumSize(new java.awt.Dimension(210, 15)); jLabel3.setPreferredSize(new java.awt.Dimension(210, 15)); l_electrico.setText("<Nombre del Responsable>"); b_borrare.setBackground(new java.awt.Color(2, 135, 242)); b_borrare.setIcon(new ImageIcon("imagenes/eliminar.png")); b_borrare.setToolTipText("Eliminar asignacin"); b_borrare.setEnabled(false); b_borrare.setMaximumSize(new java.awt.Dimension(32, 8)); b_borrare.setMinimumSize(new java.awt.Dimension(32, 8)); b_borrare.setPreferredSize(new java.awt.Dimension(32, 8)); b_borrare.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_borrareActionPerformed(evt); } }); l_orden.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N l_orden.setText("O. Taller"); l_orden.setMaximumSize(new java.awt.Dimension(210, 15)); l_orden.setMinimumSize(new java.awt.Dimension(210, 15)); l_orden.setPreferredSize(new java.awt.Dimension(210, 15)); t_orden.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_orden.setMinimumSize(new java.awt.Dimension(250, 19)); t_orden.setName(""); // NOI18N t_orden.setPreferredSize(new java.awt.Dimension(250, 19)); t_orden.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { t_ordenFocusLost(evt); } }); t_orden.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_ordenActionPerformed(evt); } }); t_orden.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { t_ordenKeyReleased(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { t_ordenKeyTyped(evt); } }); b_buscaro.setBackground(new java.awt.Color(2, 135, 242)); b_buscaro.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscaro.setMnemonic(KeyEvent.VK_F1); b_buscaro.setToolTipText("Consultar orden de taller"); b_buscaro.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscaro.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscaro.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscaro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscaroActionPerformed(evt); } }); jLabel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N jLabel4.setText("5.- Pintura:"); jLabel4.setMaximumSize(new java.awt.Dimension(210, 15)); jLabel4.setMinimumSize(new java.awt.Dimension(210, 15)); jLabel4.setPreferredSize(new java.awt.Dimension(210, 15)); t_pintura.setBackground(new java.awt.Color(204, 255, 255)); t_pintura.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_pintura.setEnabled(false); b_buscarp.setBackground(new java.awt.Color(2, 135, 242)); b_buscarp.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscarp.setToolTipText("Consultar empleados"); b_buscarp.setEnabled(false); b_buscarp.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscarp.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscarp.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscarp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscarpActionPerformed(evt); } }); b_borrarp.setBackground(new java.awt.Color(2, 135, 242)); b_borrarp.setIcon(new ImageIcon("imagenes/eliminar.png")); b_borrarp.setToolTipText("Eliminar asignacin"); b_borrarp.setEnabled(false); b_borrarp.setMaximumSize(new java.awt.Dimension(32, 8)); b_borrarp.setMinimumSize(new java.awt.Dimension(32, 8)); b_borrarp.setPreferredSize(new java.awt.Dimension(32, 8)); b_borrarp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_borrarpActionPerformed(evt); } }); l_pintura.setText("<Nombre del Responsable>"); t_rpintura.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); t_rpintura.setEnabled(false); t_rpintura.setMinimumSize(new java.awt.Dimension(250, 19)); t_rpintura.setName(""); // NOI18N t_rpintura.setPreferredSize(new java.awt.Dimension(250, 19)); l_autorizop.setText("<Usuario que asigno operacin>"); l_autorizop.setMaximumSize(new java.awt.Dimension(300, 15)); l_autorizop.setMinimumSize(new java.awt.Dimension(300, 15)); l_autorizop.setPreferredSize(new java.awt.Dimension(300, 15)); jLabel16.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel16.setForeground(new java.awt.Color(0, 51, 255)); jLabel16.setText("Fecha Lmite"); h_limite.setText("DD-MM-AAAA"); h_limite.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); h_limite.setEnabled(false); h_limite.setMinimumSize(new java.awt.Dimension(250, 19)); h_limite.setName(""); // NOI18N h_limite.setPreferredSize(new java.awt.Dimension(250, 19)); m_limite.setText("DD-MM-AAAA"); m_limite.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); m_limite.setEnabled(false); m_limite.setMinimumSize(new java.awt.Dimension(250, 19)); m_limite.setName(""); // NOI18N m_limite.setPreferredSize(new java.awt.Dimension(250, 19)); s_limite.setText("DD-MM-AAAA"); s_limite.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); s_limite.setEnabled(false); s_limite.setMinimumSize(new java.awt.Dimension(250, 19)); s_limite.setName(""); // NOI18N s_limite.setPreferredSize(new java.awt.Dimension(250, 19)); e_limite.setText("DD-MM-AAAA"); e_limite.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); e_limite.setEnabled(false); e_limite.setMinimumSize(new java.awt.Dimension(250, 19)); e_limite.setName(""); // NOI18N e_limite.setPreferredSize(new java.awt.Dimension(250, 19)); p_limite.setText("DD-MM-AAAA"); p_limite.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); p_limite.setEnabled(false); p_limite.setMinimumSize(new java.awt.Dimension(250, 19)); p_limite.setName(""); // NOI18N p_limite.setPreferredSize(new java.awt.Dimension(250, 19)); h_fecha.setBackground(new java.awt.Color(2, 135, 242)); h_fecha.setIcon(new ImageIcon("imagenes/calendario.png")); h_fecha.setToolTipText("Calendario"); h_fecha.setEnabled(false); h_fecha.setMaximumSize(new java.awt.Dimension(32, 8)); h_fecha.setMinimumSize(new java.awt.Dimension(32, 8)); h_fecha.setPreferredSize(new java.awt.Dimension(32, 8)); h_fecha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { h_fechaActionPerformed(evt); } }); m_fecha.setBackground(new java.awt.Color(2, 135, 242)); m_fecha.setIcon(new ImageIcon("imagenes/calendario.png")); m_fecha.setToolTipText("Calendario"); m_fecha.setEnabled(false); m_fecha.setMaximumSize(new java.awt.Dimension(32, 8)); m_fecha.setMinimumSize(new java.awt.Dimension(32, 8)); m_fecha.setPreferredSize(new java.awt.Dimension(32, 8)); m_fecha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_fechaActionPerformed(evt); } }); s_fecha.setBackground(new java.awt.Color(2, 135, 242)); s_fecha.setIcon(new ImageIcon("imagenes/calendario.png")); s_fecha.setToolTipText("Calendario"); s_fecha.setEnabled(false); s_fecha.setMaximumSize(new java.awt.Dimension(32, 8)); s_fecha.setMinimumSize(new java.awt.Dimension(32, 8)); s_fecha.setPreferredSize(new java.awt.Dimension(32, 8)); s_fecha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { s_fechaActionPerformed(evt); } }); p_fecha.setBackground(new java.awt.Color(2, 135, 242)); p_fecha.setIcon(new ImageIcon("imagenes/calendario.png")); p_fecha.setToolTipText("Calendario"); p_fecha.setEnabled(false); p_fecha.setMaximumSize(new java.awt.Dimension(32, 8)); p_fecha.setMinimumSize(new java.awt.Dimension(32, 8)); p_fecha.setPreferredSize(new java.awt.Dimension(32, 8)); p_fecha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { p_fechaActionPerformed(evt); } }); e_fecha.setBackground(new java.awt.Color(2, 135, 242)); e_fecha.setIcon(new ImageIcon("imagenes/calendario.png")); e_fecha.setToolTipText("Calendario"); e_fecha.setEnabled(false); e_fecha.setMaximumSize(new java.awt.Dimension(32, 8)); e_fecha.setMinimumSize(new java.awt.Dimension(32, 8)); e_fecha.setPreferredSize(new java.awt.Dimension(32, 8)); e_fecha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { e_fechaActionPerformed(evt); } }); jButton1.setBackground(new java.awt.Color(2, 135, 242)); jButton1.setEnabled(false); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( jPanel1Layout.createSequentialGroup() .addComponent(l_orden, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_orden, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(b_buscaro, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(t_mecanica, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0).addComponent( b_buscarm, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1).addComponent( b_borrarm, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11).addComponent( l_mecanica, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(t_suspension, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0).addComponent(b_buscars, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1).addComponent(b_borrars, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11).addComponent( l_suspension, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( jPanel1Layout.createSequentialGroup() .addComponent(t_hojalateria, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0).addComponent( b_buscarh, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1).addComponent( b_borrarh, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11).addComponent( l_hojalateria, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(37, 37, 37) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout .createSequentialGroup() .addComponent( t_rsuspension, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) .addComponent( l_autorizos, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout .createSequentialGroup() .addComponent( t_rmecanica, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( l_autorizom, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout .createSequentialGroup() .addComponent( t_rhojalateria, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( l_autorizoh, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout .createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup( jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( l_autorizop, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( l_autorizoe, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(13, 13, 13))) .addGroup(jPanel1Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(p_limite, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(e_limite, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(s_limite, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(m_limite, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(h_limite, javax.swing.GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE) .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(t_electrico, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(b_buscare, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(b_borrare, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11) .addComponent(l_electrico, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(t_relectrico, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(t_pintura, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(b_buscarp, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(b_borrarp, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11) .addComponent(l_pintura, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_rpintura, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 0, Short.MAX_VALUE))) .addGap(18, 18, 18) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(h_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( m_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( s_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( p_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(e_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28))))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_orden, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_orden, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(b_buscaro, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5).addComponent(jLabel7) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel14).addComponent(jLabel15).addComponent(jLabel16))) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(b_buscarh, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b_borrarh, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup().addGap(3, 3, 3) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_hojalateria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_hojalateria) .addComponent(t_rhojalateria, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_autorizoh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(h_limite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(h_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(2, 2, 2).addComponent( b_buscarm, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(2, 2, 2).addComponent( b_borrarm, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(5, 5, 5) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_mecanica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(l_mecanica) .addComponent(t_rmecanica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_autorizom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(m_limite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(m_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(4, 4, 4).addComponent( b_buscars, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(4, 4, 4).addComponent( b_borrars, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(9, 9, 9) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_suspension, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_suspension))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(t_rsuspension, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_autorizos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(s_limite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(s_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(4, 4, 4))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(b_buscare, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b_borrare, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup().addGap(3, 3, 3) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_electrico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_electrico) .addComponent(t_relectrico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(l_autorizoe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(e_limite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(e_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(b_buscarp, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b_borrarp, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup().addGap(3, 3, 3) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_pintura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_pintura) .addComponent(t_rpintura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(p_limite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_autorizop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(p_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2))) .addContainerGap(222, Short.MAX_VALUE))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); }// </editor-fold>//GEN-END:initComponents private void b_buscarhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscarhActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaEmpleado obj = new buscaEmpleado(new javax.swing.JFrame(), true, usr, this.sessionPrograma); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); obj.setLocation((d.width / 2) - (obj.getWidth() / 2), (d.height / 2) - (obj.getHeight() / 2)); obj.setVisible(true); Empleado actor = obj.getReturnStatus(); if (actor != null) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = guardaEmpleado(actor, "hojalateria", valor); if (resp = false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_buscarhActionPerformed private void b_borrarhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_borrarhActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_hojalateria.getText().compareTo("") != 0) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = quitaEmpleado("hojalateria", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_borrarhActionPerformed private void b_buscarmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscarmActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaEmpleado obj = new buscaEmpleado(new javax.swing.JFrame(), true, usr, this.sessionPrograma); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); obj.setLocation((d.width / 2) - (obj.getWidth() / 2), (d.height / 2) - (obj.getHeight() / 2)); obj.setVisible(true); Empleado actor = obj.getReturnStatus(); if (actor != null) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = guardaEmpleado(actor, "mecanica", valor); if (resp = false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_buscarmActionPerformed private void b_borrarmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_borrarmActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_mecanica.getText().compareTo("") != 0) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = quitaEmpleado("mecanica", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_borrarmActionPerformed private void b_borrarsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_borrarsActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_suspension.getText().compareTo("") != 0) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = quitaEmpleado("suspension", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_borrarsActionPerformed private void b_buscarsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscarsActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaEmpleado obj = new buscaEmpleado(new javax.swing.JFrame(), true, usr, this.sessionPrograma); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); obj.setLocation((d.width / 2) - (obj.getWidth() / 2), (d.height / 2) - (obj.getHeight() / 2)); obj.setVisible(true); Empleado actor = obj.getReturnStatus(); if (actor != null) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = guardaEmpleado(actor, "suspension", valor); if (resp = false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_buscarsActionPerformed private void b_buscareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscareActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaEmpleado obj = new buscaEmpleado(new javax.swing.JFrame(), true, usr, this.sessionPrograma); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); obj.setLocation((d.width / 2) - (obj.getWidth() / 2), (d.height / 2) - (obj.getHeight() / 2)); obj.setVisible(true); Empleado actor = obj.getReturnStatus(); if (actor != null) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = guardaEmpleado(actor, "electrico", valor); if (resp = false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_buscareActionPerformed private void b_borrareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_borrareActionPerformed h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_electrico.getText().compareTo("") != 0) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = quitaEmpleado("electrico", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_borrareActionPerformed private void t_ordenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_ordenActionPerformed // TODO add your handling code here: this.b_buscaro.requestFocus(); }//GEN-LAST:event_t_ordenActionPerformed private void t_ordenKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_ordenKeyTyped // TODO add your handling code here: char car = evt.getKeyChar(); if (t_orden.getSelectedText() != null) t_orden.setText(t_orden.getText().replace(t_orden.getSelectedText(), "")); if (t_orden.getText().length() >= 6) { evt.consume(); } if ((car < '0' || car > '9')) evt.consume(); }//GEN-LAST:event_t_ordenKeyTyped private void t_ordenKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_ordenKeyReleased // TODO add your handling code here: if (t_orden.getText().length() >= 6) { b_buscaro.requestFocus(); } }//GEN-LAST:event_t_ordenKeyReleased private void b_buscaroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscaroActionPerformed //h=new Herramientas(usr, 0); //h.session(sessionPrograma); buscaOrden obj = new buscaOrden(new javax.swing.JFrame(), true, usr, 0); obj.t_busca.requestFocus(); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); obj.setLocation((d.width / 2) - (obj.getWidth() / 2), (d.height / 2) - (obj.getHeight() / 2)); obj.setVisible(true); orden_act = obj.getReturnStatus(); try { if (orden_act != null) { if (orden_act.getFechaCierre() == null) { //h= new Herramientas(usr, 0); //h.desbloqueaOrden(); //String resp=h.estadoOrden(orden_act); /*if(resp.compareTo("")==0 || resp.compareTo("*bloqueada ok*")==0) {*/ t_orden.setText("" + orden_act.getIdOrden()); if (t_orden.getText().compareTo("") != 0) { t_orden.setText("" + orden_act.getIdOrden()); permisos(true, true, true, true, true); buscaApertura(); } else orden_act = null; /*} else { JOptionPane.showMessageDialog(null, "Orden Bloqueada por:"+orden_act.getUsuarioByBloqueada().getIdUsuario()); permisos(false, false, false, false); }*/ } else { t_orden.setText("" + orden_act.getIdOrden()); if (t_orden.getText().compareTo("") != 0) { t_orden.setText("" + orden_act.getIdOrden()); buscaApertura(); permisos(false, false, false, false, false); } else orden_act = null; JOptionPane.showMessageDialog(null, "Orden cerrada!"); } } else { //h= new Herramientas(usr, 0); //h.desbloqueaOrden(); b_buscaro.requestFocus(); } } catch (Exception e) { } }//GEN-LAST:event_b_buscaroActionPerformed private void b_buscarpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscarpActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaEmpleado obj = new buscaEmpleado(new javax.swing.JFrame(), true, usr, this.sessionPrograma); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); obj.setLocation((d.width / 2) - (obj.getWidth() / 2), (d.height / 2) - (obj.getHeight() / 2)); obj.setVisible(true); Empleado actor = obj.getReturnStatus(); if (actor != null) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = guardaEmpleado(actor, "pintura", valor); if (resp = false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_buscarpActionPerformed private void b_borrarpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_borrarpActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_pintura.getText().compareTo("") != 0) { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String valor = dateFormat.format(fecha); boolean resp = quitaEmpleado("pintura", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_b_borrarpActionPerformed private void t_ordenFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_t_ordenFocusLost // TODO add your handling code here: Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); orden_act = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); if (orden_act != null) { if (orden_act.getFechaCierre() == null) { t_orden.setText("" + orden_act.getIdOrden()); if (t_orden.getText().compareTo("") != 0) { t_orden.setText("" + orden_act.getIdOrden()); permisos(true, true, true, true, true); buscaApertura(); } else orden_act = null; } else { t_orden.setText("" + orden_act.getIdOrden()); if (t_orden.getText().compareTo("") != 0) { t_orden.setText("" + orden_act.getIdOrden()); buscaApertura(); permisos(false, false, false, false, false); JOptionPane.showMessageDialog(null, "Orden cerrada!"); } else orden_act = null; } } else { h = new Herramientas(usr, 0); h.desbloqueaOrden(); b_buscaro.requestFocus(); } } catch (Exception e) { e.printStackTrace(); } if (session != null) if (session.isOpen()) session.close(); }//GEN-LAST:event_t_ordenFocusLost private void h_fechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_h_fechaActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); calendario cal = new calendario(new javax.swing.JFrame(), true); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); cal.setLocation((d.width / 2) - (cal.getWidth() / 2), (d.height / 2) - (cal.getHeight() / 2)); cal.setVisible(true); Calendar miCalendario = cal.getReturnStatus(); if (miCalendario != null) { String dia = Integer.toString(miCalendario.get(Calendar.DATE)); ; String mes = Integer.toString(miCalendario.get(Calendar.MONTH) + 1); String anio = Integer.toString(miCalendario.get(Calendar.YEAR)); String fechas = dia + "-" + mes + "-" + anio; boolean resp = guardaLimite("hojalateria", fechas); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } else { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); String valor = dateFormat.format(fecha); boolean resp = quitaLimite("hojalateria", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_h_fechaActionPerformed private void m_fechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_fechaActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); calendario cal = new calendario(new javax.swing.JFrame(), true); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); cal.setLocation((d.width / 2) - (cal.getWidth() / 2), (d.height / 2) - (cal.getHeight() / 2)); cal.setVisible(true); Calendar miCalendario = cal.getReturnStatus(); if (miCalendario != null) { String dia = Integer.toString(miCalendario.get(Calendar.DATE)); ; String mes = Integer.toString(miCalendario.get(Calendar.MONTH) + 1); String anio = Integer.toString(miCalendario.get(Calendar.YEAR)); String fechas = dia + "-" + mes + "-" + anio; boolean resp = guardaLimite("mecanica", fechas); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } else { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); String valor = dateFormat.format(fecha); boolean resp = quitaLimite("mecanica", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_m_fechaActionPerformed private void s_fechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_s_fechaActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); calendario cal = new calendario(new javax.swing.JFrame(), true); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); cal.setLocation((d.width / 2) - (cal.getWidth() / 2), (d.height / 2) - (cal.getHeight() / 2)); cal.setVisible(true); Calendar miCalendario = cal.getReturnStatus(); if (miCalendario != null) { String dia = Integer.toString(miCalendario.get(Calendar.DATE)); ; String mes = Integer.toString(miCalendario.get(Calendar.MONTH) + 1); String anio = Integer.toString(miCalendario.get(Calendar.YEAR)); String fechas = dia + "-" + mes + "-" + anio; boolean resp = guardaLimite("suspencion", fechas); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } else { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); String valor = dateFormat.format(fecha); boolean resp = quitaLimite("suspension", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_s_fechaActionPerformed private void p_fechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_p_fechaActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); calendario cal = new calendario(new javax.swing.JFrame(), true); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); cal.setLocation((d.width / 2) - (cal.getWidth() / 2), (d.height / 2) - (cal.getHeight() / 2)); cal.setVisible(true); Calendar miCalendario = cal.getReturnStatus(); if (miCalendario != null) { String dia = Integer.toString(miCalendario.get(Calendar.DATE)); ; String mes = Integer.toString(miCalendario.get(Calendar.MONTH) + 1); String anio = Integer.toString(miCalendario.get(Calendar.YEAR)); String fechas = dia + "-" + mes + "-" + anio; boolean resp = guardaLimite("pintura", fechas); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } else { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); String valor = dateFormat.format(fecha); boolean resp = quitaLimite("pintura", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_p_fechaActionPerformed private void e_fechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_e_fechaActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); calendario cal = new calendario(new javax.swing.JFrame(), true); Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); cal.setLocation((d.width / 2) - (cal.getWidth() / 2), (d.height / 2) - (cal.getHeight() / 2)); cal.setVisible(true); Calendar miCalendario = cal.getReturnStatus(); if (miCalendario != null) { String dia = Integer.toString(miCalendario.get(Calendar.DATE)); ; String mes = Integer.toString(miCalendario.get(Calendar.MONTH) + 1); String anio = Integer.toString(miCalendario.get(Calendar.YEAR)); String fechas = dia + "-" + mes + "-" + anio; boolean resp = guardaLimite("electrico", fechas); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } else { Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); String valor = dateFormat.format(fecha); boolean resp = quitaLimite("electrico", valor); if (resp == false) JOptionPane.showMessageDialog(null, "Error al actualizar el campo!"); } }//GEN-LAST:event_e_fechaActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); Session session = HibernateUtil.getSessionFactory().openSession(); try { Orden ord = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); Date fecha = new Date(); Date fecha1 = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyyHH-mm-ss");//YYYY-MM-DD HH:MM:SS String valor = dateFormat.format(fecha); File folder = new File("reportes/" + ord.getIdOrden()); folder.mkdirs(); PdfReader reader = new PdfReader("imagenes/PlantillaHojaAsignacion.pdf"); PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("reportes/" + ord.getIdOrden() + "/" + valor + "-HojaAsignacion.pdf")); PdfContentByte cb = stamp.getUnderContent(1); AcroFields fdfDoc = stamp.getAcroFields(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED); cb.beginText(); fdfDoc.setField("orden", String.valueOf(ord.getIdOrden())); if (ord.getCompania() != null) fdfDoc.setField("compania", ord.getCompania().getNombre()); else fdfDoc.setField("compania", ""); if (ord.getSiniestro() != null) fdfDoc.setField("siniestro", ord.getSiniestro()); else fdfDoc.setField("siniestro", ""); if (ord.getPoliza() != null) fdfDoc.setField("poliza", ord.getPoliza()); else fdfDoc.setField("poliza", ""); if (ord.getFecha() != null) fdfDoc.setField("apertura", ord.getFecha().toString()); else fdfDoc.setField("apertura", ""); if (ord.getFechaSiniestro() != null) fdfDoc.setField("f_siniestro", ord.getFechaSiniestro().toString()); else fdfDoc.setField("f_siniestro", ""); if (ord.getInciso() != null) fdfDoc.setField("inciso", ord.getInciso()); else fdfDoc.setField("inciso", ""); if (ord.getTipo() != null) fdfDoc.setField("unidad", ord.getTipo().getTipoNombre()); else fdfDoc.setField("unidad", ""); if (ord.getModelo() != null) fdfDoc.setField("modelo", ord.getModelo().toString()); else fdfDoc.setField("modelo", ""); if (ord.getMarca() != null) fdfDoc.setField("marca", ord.getMarca().getMarcaNombre()); else fdfDoc.setField("marca", ""); if (ord.getNoEconomico() != null) fdfDoc.setField("economico", ord.getNoEconomico()); else fdfDoc.setField("economico", ""); if (ord.getNoMotor() != null) fdfDoc.setField("no_motor", ord.getNoMotor()); else fdfDoc.setField("no_motor", ""); if (ord.getNoSerie() != null) fdfDoc.setField("no_serie", ord.getNoSerie()); else fdfDoc.setField("no_serie", ""); //tabla if (ord.getEmpleadoByRHojalateria() != null) fdfDoc.setField("HOJALATERIA", ord.getEmpleadoByRHojalateria().getIdEmpleado().toString()); else fdfDoc.setField("HOJALATERIA", ""); if (ord.getEmpleadoByRHojalateria() != null) fdfDoc.setField("R_H", ord.getEmpleadoByRHojalateria().getNombre().toString()); else fdfDoc.setField("R_H", ""); if (ord.getEmpleadoByRMecanica() != null) fdfDoc.setField("MECANICA", ord.getEmpleadoByRMecanica().getIdEmpleado().toString()); else fdfDoc.setField("MECANICA", ""); if (ord.getEmpleadoByRMecanica() != null) fdfDoc.setField("R_M", ord.getEmpleadoByRMecanica().getNombre().toString()); else fdfDoc.setField("R_M", ""); if (ord.getEmpleadoByRSuspension() != null) fdfDoc.setField("SUSPENSIN", ord.getEmpleadoByRSuspension().getIdEmpleado().toString()); else fdfDoc.setField("SUSPENSIN", ""); if (ord.getEmpleadoByRSuspension() != null) fdfDoc.setField("R_S", ord.getEmpleadoByRSuspension().getNombre().toString()); else fdfDoc.setField("R_S", ""); if (ord.getEmpleadoByRElectrico() != null) fdfDoc.setField("ELECTRICO", ord.getEmpleadoByRElectrico().getIdEmpleado().toString()); else fdfDoc.setField("ELECTRICO", ""); if (ord.getEmpleadoByRElectrico() != null) fdfDoc.setField("R_E", ord.getEmpleadoByRElectrico().getNombre().toString()); else fdfDoc.setField("R_E", ""); if (ord.getEmpleadoByRPintura() != null) fdfDoc.setField("PINTURA", ord.getEmpleadoByRPintura().getIdEmpleado().toString()); else fdfDoc.setField("PINTURA", ""); if (ord.getEmpleadoByRPintura() != null) fdfDoc.setField("R_P", ord.getEmpleadoByRPintura().getNombre().toString()); else fdfDoc.setField("R_P", ""); //FECHAS String valor1 = ""; if (ord.getRHojalateriaFecha() != null) { fecha1 = ord.getRHojalateriaFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_H", valor1); } else { fdfDoc.setField("F_H", valor1); } if (ord.getRMecanicaFecha() != null) { fecha1 = ord.getRMecanicaFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_M", valor1); } else { fdfDoc.setField("F_M", valor1); } if (ord.getRSuspensionFecha() != null) { fecha1 = ord.getRSuspensionFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_S", valor1); } else { fdfDoc.setField("F_S", valor1); } if (ord.getRElectricoFecha() != null) { fecha1 = ord.getRElectricoFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_E", valor1); } else { fdfDoc.setField("F_E", valor1); } if (ord.getRPinturaFecha() != null) { fecha1 = ord.getRPinturaFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_P", valor1); } else { fdfDoc.setField("F_P", valor1); } //ASIGNO OPERARIO if (ord.getUsuarioByRHojalateriaAsigno() != null) fdfDoc.setField("A_H", ord.getUsuarioByRHojalateriaAsigno().getIdUsuario()); else fdfDoc.setField("A_H", ""); if (ord.getUsuarioByRMecanicaAsigno() != null) fdfDoc.setField("A_M", ord.getUsuarioByRMecanicaAsigno().getIdUsuario()); else fdfDoc.setField("A_M", ""); if (ord.getUsuarioByRSuspensionAsigno() != null) fdfDoc.setField("A_S", ord.getUsuarioByRSuspensionAsigno().getIdUsuario()); else fdfDoc.setField("A_S", ""); if (ord.getUsuarioByRElectricoAsigno() != null) fdfDoc.setField("A_E", ord.getUsuarioByRElectricoAsigno().getIdUsuario()); else fdfDoc.setField("A_E", ""); if (ord.getUsuarioByRPinturaAsigno() != null) fdfDoc.setField("A_P", ord.getUsuarioByRPinturaAsigno().getIdUsuario()); else fdfDoc.setField("A_P", ""); //LIMITE if (ord.getHojalateriaLimite() != null) { fecha1 = ord.getHojalateriaLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_H_L", valor1); } else { fdfDoc.setField("F_H_L", ""); } if (ord.getMecanicaLimite() != null) { fecha1 = ord.getMecanicaLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_M_L", valor1); } else { fdfDoc.setField("F_M_L", ""); } if (ord.getSuspensionLimite() != null) { fecha1 = ord.getSuspensionLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_S_L", valor1); } else { fdfDoc.setField("F_S_L", ""); } if (ord.getElectricoLimite() != null) { fecha1 = ord.getElectricoLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_E_L", valor1); } else { fdfDoc.setField("F_E_L", ""); } if (ord.getPinturaLimite() != null) { fecha1 = ord.getPinturaLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor1 = dateFormat.format(fecha1); fdfDoc.setField("F_P_L", valor1); } else { fdfDoc.setField("F_P_L", ""); } Foto[] fotos = (Foto[]) ord.getFotos().toArray(new Foto[0]); for (int k = 0; k < fotos.length - 1; k++) { for (int f = 0; f < (fotos.length - 1) - k; f++) { if (fotos[f].getFecha().after(fotos[f + 1].getFecha()) == true) { Foto aux; aux = fotos[f]; fotos[f] = fotos[f + 1]; fotos[f + 1] = aux; } } } if (fotos.length > 0) { try { Image img; img = Image .getInstance("ordenes/" + ord.getIdOrden() + "/miniatura/" + fotos[0].getDescripcion()); img.setAbsolutePosition(30, 495); img.scaleAbsoluteWidth(124); img.scaleAbsoluteHeight(80); cb.addImage(img, true); } catch (Exception e) { //e.printStackTrace(); } } else { } cb.endText(); stamp.close(); PDF reporte = new PDF(); reporte.cerrar(); reporte.visualizar("reportes/" + ord.getIdOrden() + "/" + valor + "-HojaAsignacion.pdf"); } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto"); } if (session != null) if (session.isOpen()) session.close(); }//GEN-LAST:event_jButton1ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton b_borrare; private javax.swing.JButton b_borrarh; private javax.swing.JButton b_borrarm; private javax.swing.JButton b_borrarp; private javax.swing.JButton b_borrars; private javax.swing.JButton b_buscare; private javax.swing.JButton b_buscarh; private javax.swing.JButton b_buscarm; private javax.swing.JButton b_buscaro; private javax.swing.JButton b_buscarp; private javax.swing.JButton b_buscars; private javax.swing.JButton e_fecha; private javax.swing.JTextField e_limite; private javax.swing.JButton h_fecha; private javax.swing.JTextField h_limite; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel1; private javax.swing.JLabel l_autorizoe; private javax.swing.JLabel l_autorizoh; private javax.swing.JLabel l_autorizom; private javax.swing.JLabel l_autorizop; private javax.swing.JLabel l_autorizos; private javax.swing.JLabel l_electrico; private javax.swing.JLabel l_hojalateria; private javax.swing.JLabel l_mecanica; private javax.swing.JLabel l_orden; private javax.swing.JLabel l_pintura; private javax.swing.JLabel l_suspension; private javax.swing.JButton m_fecha; private javax.swing.JTextField m_limite; private javax.swing.JButton p_fecha; private javax.swing.JTextField p_limite; private javax.swing.JButton s_fecha; private javax.swing.JTextField s_limite; private javax.swing.JTextField t_electrico; private javax.swing.JTextField t_hojalateria; private javax.swing.JTextField t_mecanica; public javax.swing.JTextField t_orden; private javax.swing.JTextField t_pintura; private javax.swing.JTextField t_relectrico; private javax.swing.JTextField t_rhojalateria; private javax.swing.JTextField t_rmecanica; private javax.swing.JTextField t_rpintura; private javax.swing.JTextField t_rsuspension; private javax.swing.JTextField t_suspension; // End of variables declaration//GEN-END:variables private void permisos(boolean hojalateria, boolean mecanica, boolean suspension, boolean electrico, boolean pintura) { Session session = HibernateUtil.getSessionFactory().openSession(); try { Orden objeto = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); this.usr = (Usuario) session.get(Usuario.class, this.usr.getIdUsuario()); //*******validamos los permisos if (usr.getAltaSeguimiento() == false) { hojalateria = false; mecanica = false; suspension = false; electrico = false; pintura = false; this.h_fecha.setEnabled(false); this.m_fecha.setEnabled(false); this.s_fecha.setEnabled(false); this.e_fecha.setEnabled(false); this.p_fecha.setEnabled(false); this.jButton1.setEnabled(false); } this.b_buscarh.setEnabled(hojalateria); this.b_borrarh.setEnabled(hojalateria); this.b_buscarm.setEnabled(mecanica); this.b_borrarm.setEnabled(mecanica); this.b_buscars.setEnabled(suspension); this.b_borrars.setEnabled(suspension); this.b_buscare.setEnabled(electrico); this.b_borrare.setEnabled(electrico); this.b_buscarp.setEnabled(pintura); this.b_borrarp.setEnabled(pintura); this.h_fecha.setEnabled(pintura); this.m_fecha.setEnabled(pintura); this.s_fecha.setEnabled(pintura); this.e_fecha.setEnabled(pintura); this.p_fecha.setEnabled(pintura); this.jButton1.setEnabled(pintura); } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) session.close(); } private void buscaApertura() { Session session = HibernateUtil.getSessionFactory().openSession(); try { Query q = session.createQuery("from Orden ord where ord.idOrden=" + t_orden.getText()); List resultList = q.list(); if (resultList.size() > 0) { for (Object o : resultList) { Orden actor = (Orden) o; //****Hojalateria************************************************** if (actor.getEmpleadoByRHojalateria() != null) t_hojalateria.setText("" + actor.getEmpleadoByRHojalateria().getIdEmpleado()); else t_hojalateria.setText(""); if (actor.getEmpleadoByRHojalateria() != null) l_hojalateria.setText(actor.getEmpleadoByRHojalateria().getNombre()); else l_hojalateria.setText("<Nombre del Responsable>"); Date fecha = actor.getFecha(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); String valor = dateFormat.format(fecha); try { fecha = actor.getRHojalateriaFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor = dateFormat.format(fecha); t_rhojalateria.setText(valor); } catch (Exception E) { t_rhojalateria.setText(""); } if (actor.getUsuarioByRHojalateriaAsigno() != null) l_autorizoh.setText("" + actor.getUsuarioByRHojalateriaAsigno().getIdUsuario()); else l_autorizoh.setText("<Usuario que asigno operacin>"); //************************************************************** //*****Mecanica************************************************* if (actor.getEmpleadoByRMecanica() != null) t_mecanica.setText("" + actor.getEmpleadoByRMecanica().getIdEmpleado()); else t_mecanica.setText(""); if (actor.getEmpleadoByRMecanica() != null) l_mecanica.setText(actor.getEmpleadoByRMecanica().getNombre()); else l_mecanica.setText("<Nombre del Responsable>"); try { fecha = actor.getRMecanicaFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor = dateFormat.format(fecha); t_rmecanica.setText(valor); } catch (Exception E) { t_rmecanica.setText(""); } if (actor.getUsuarioByRMecanicaAsigno() != null) l_autorizom.setText("" + actor.getUsuarioByRMecanicaAsigno().getIdUsuario()); else l_autorizom.setText("<Usuario que asigno operacin>"); //************************************************************** //*********Suspension**************************************** if (actor.getEmpleadoByRSuspension() != null) t_suspension.setText("" + actor.getEmpleadoByRSuspension().getIdEmpleado()); else t_suspension.setText(""); if (actor.getEmpleadoByRSuspension() != null) l_suspension.setText(actor.getEmpleadoByRSuspension().getNombre()); else l_suspension.setText("<Nombre del Responsable>"); try { fecha = actor.getRSuspensionFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor = dateFormat.format(fecha); t_rsuspension.setText(valor); } catch (Exception E) { t_rsuspension.setText(""); } if (actor.getUsuarioByRSuspensionAsigno() != null) l_autorizos.setText("" + actor.getUsuarioByRSuspensionAsigno().getIdUsuario()); else l_autorizos.setText("<Usuario que asigno operacin>"); //************************************************************** //***********Electrico******************************************** if (actor.getEmpleadoByRElectrico() != null) t_electrico.setText("" + actor.getEmpleadoByRElectrico().getIdEmpleado()); else t_electrico.setText(""); if (actor.getEmpleadoByRElectrico() != null) l_electrico.setText(actor.getEmpleadoByRElectrico().getNombre()); else l_electrico.setText("<Nombre del Responsable>"); try { fecha = actor.getRElectricoFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor = dateFormat.format(fecha); t_relectrico.setText(valor); } catch (Exception E) { t_relectrico.setText(""); } if (actor.getUsuarioByRElectricoAsigno() != null) l_autorizoe.setText("" + actor.getUsuarioByRElectricoAsigno().getIdUsuario()); else l_autorizoe.setText("<Usuario que asigno operacin>"); //************************************************************** //***********Pintura******************************************** if (actor.getEmpleadoByRPintura() != null) t_pintura.setText("" + actor.getEmpleadoByRPintura().getIdEmpleado()); else t_pintura.setText(""); if (actor.getEmpleadoByRPintura() != null) l_pintura.setText(actor.getEmpleadoByRPintura().getNombre()); else l_pintura.setText("<Nombre del Responsable>"); try { fecha = actor.getRPinturaFecha(); dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); valor = dateFormat.format(fecha); t_rpintura.setText(valor); } catch (Exception E) { t_rpintura.setText(""); } try { if (actor.getHojalateriaLimite() != null) { fecha = actor.getHojalateriaLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy"); valor = dateFormat.format(fecha); h_limite.setText(valor); } else { h_limite.setText("DD-MM-YYYY"); } } catch (Exception E) { h_limite.setText("DD-MM-YYYY"); } try { if (actor.getMecanicaLimite() != null) { fecha = actor.getMecanicaLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy"); valor = dateFormat.format(fecha); m_limite.setText(valor); } else { m_limite.setText("DD-MM-YYYY"); } } catch (Exception E) { m_limite.setText("DD-MM-YYYY"); } try { if (actor.getSuspensionLimite() != null) { fecha = actor.getSuspensionLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy"); valor = dateFormat.format(fecha); s_limite.setText(valor); } else { s_limite.setText("dd-MM-yyyy"); } } catch (Exception E) { s_limite.setText("dd-MM-yyyy"); } try { if (actor.getElectricoLimite() != null) { fecha = actor.getElectricoLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy"); valor = dateFormat.format(fecha); e_limite.setText(valor); } else { e_limite.setText("dd-MM-yyyy"); } } catch (Exception E) { e_limite.setText(""); } try { if (actor.getPinturaLimite() != null) { fecha = actor.getPinturaLimite(); dateFormat = new SimpleDateFormat("dd-MM-yyyy"); valor = dateFormat.format(fecha); p_limite.setText(valor); } else { p_limite.setText("dd-MM-yyyy"); } } catch (Exception E) { p_limite.setText(""); } if (actor.getUsuarioByRPinturaAsigno() != null) l_autorizop.setText("" + actor.getUsuarioByRPinturaAsigno().getIdUsuario()); else l_autorizop.setText("<Usuario que asigno operacin>"); //************************************************************** permisos(true, true, true, true, true); } } else { permisos(false, false, false, false, false); } } catch (Exception e) { } if (session != null) if (session.isOpen()) session.close(); } private boolean guardaEmpleado(Empleado obj, String campo, String valor) { boolean edo = false; Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Orden objeto = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); String[] fecha; String[] hora; String[] aux; int op = 0; Calendar calendario; switch (campo) { case "hojalateria": fecha = valor.split("-"); hora = fecha[2].split(":"); aux = hora[0].split(" "); fecha[2] = aux[0]; hora[0] = aux[1]; objeto.setEmpleadoByRHojalateria(obj); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0]), Integer.parseInt(hora[0]), Integer.parseInt(hora[1]), Integer.parseInt(hora[2])); objeto.setRHojalateriaFecha(calendario.getTime()); objeto.setUsuarioByRHojalateriaAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_hojalateria.setText("" + obj.getIdEmpleado()); l_hojalateria.setText(obj.getNombre()); t_rhojalateria.setText(valor); l_autorizoh.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "mecanica": fecha = valor.split("-"); hora = fecha[2].split(":"); aux = hora[0].split(" "); fecha[2] = aux[0]; hora[0] = aux[1]; objeto.setEmpleadoByRMecanica(obj); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0]), Integer.parseInt(hora[0]), Integer.parseInt(hora[1]), Integer.parseInt(hora[2])); objeto.setRMecanicaFecha(calendario.getTime()); objeto.setUsuarioByRMecanicaAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_mecanica.setText("" + obj.getIdEmpleado()); l_mecanica.setText(obj.getNombre()); t_rmecanica.setText(valor); l_autorizom.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "suspension": fecha = valor.split("-"); hora = fecha[2].split(":"); aux = hora[0].split(" "); fecha[2] = aux[0]; hora[0] = aux[1]; objeto.setEmpleadoByRSuspension(obj); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0]), Integer.parseInt(hora[0]), Integer.parseInt(hora[1]), Integer.parseInt(hora[2])); objeto.setRSuspensionFecha(calendario.getTime()); objeto.setUsuarioByRSuspensionAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_suspension.setText("" + obj.getIdEmpleado()); l_suspension.setText(obj.getNombre()); t_rsuspension.setText(valor); l_autorizos.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "electrico": fecha = valor.split("-"); hora = fecha[2].split(":"); aux = hora[0].split(" "); fecha[2] = aux[0]; hora[0] = aux[1]; objeto.setEmpleadoByRElectrico(obj); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0]), Integer.parseInt(hora[0]), Integer.parseInt(hora[1]), Integer.parseInt(hora[2])); objeto.setRElectricoFecha(calendario.getTime()); objeto.setUsuarioByRElectricoAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_electrico.setText("" + obj.getIdEmpleado()); l_electrico.setText(obj.getNombre()); t_relectrico.setText(valor); l_autorizoe.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "pintura": fecha = valor.split("-"); hora = fecha[2].split(":"); aux = hora[0].split(" "); fecha[2] = aux[0]; hora[0] = aux[1]; objeto.setEmpleadoByRPintura(obj); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0]), Integer.parseInt(hora[0]), Integer.parseInt(hora[1]), Integer.parseInt(hora[2])); objeto.setRPinturaFecha(calendario.getTime()); objeto.setUsuarioByRPinturaAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_pintura.setText("" + obj.getIdEmpleado()); l_pintura.setText(obj.getNombre()); t_rpintura.setText(valor); l_autorizop.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; } return false; } catch (HibernateException he) { he.printStackTrace(); session.getTransaction().rollback(); permisos(true, true, true, true, true); edo = true; } if (session != null) if (session.isOpen()) session.close(); return edo; } private boolean guardaLimite(String tipo, String campo) { boolean edo = false; Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Orden objeto = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); String[] fecha; Date fechas = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Calendar calendario; switch (tipo) { case "hojalateria": fecha = campo.split("-"); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0])); objeto.setHojalateriaLimite(calendario.getTime()); session.update(objeto); session.getTransaction().commit(); permisos(true, true, true, true, true); String valor = dateFormat.format(calendario.getTime()); h_limite.setText(valor); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "mecanica": fecha = campo.split("-"); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0])); objeto.setMecanicaLimite(calendario.getTime()); session.update(objeto); session.getTransaction().commit(); permisos(true, true, true, true, true); String valor1 = dateFormat.format(calendario.getTime()); m_limite.setText(valor1); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "suspencion": fecha = campo.split("-"); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0])); objeto.setSuspensionLimite(calendario.getTime()); session.update(objeto); session.getTransaction().commit(); permisos(true, true, true, true, true); String valor2 = dateFormat.format(calendario.getTime()); s_limite.setText(valor2); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "electrico": fecha = campo.split("-"); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0])); objeto.setElectricoLimite(calendario.getTime()); session.update(objeto); session.getTransaction().commit(); permisos(true, true, true, true, true); String valor3 = dateFormat.format(calendario.getTime()); e_limite.setText(valor3); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; case "pintura": fecha = campo.split("-"); calendario = Calendar.getInstance(); calendario.set(Integer.parseInt(fecha[2]), Integer.parseInt(fecha[1]) - 1, Integer.parseInt(fecha[0])); objeto.setPinturaLimite(calendario.getTime()); session.update(objeto); session.getTransaction().commit(); permisos(true, true, true, true, true); String valor4 = dateFormat.format(calendario.getTime()); p_limite.setText(valor4); JOptionPane.showMessageDialog(null, "Asignacin actualizada!"); edo = true; break; } } catch (HibernateException he) { he.printStackTrace(); session.getTransaction().rollback(); permisos(true, true, true, true, true); edo = true; } if (session != null) if (session.isOpen()) session.close(); return edo; } private boolean quitaEmpleado(String campo, String valor) { boolean edo = false; Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Orden objeto = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); switch (campo) { case "hojalateria": objeto.setEmpleadoByRHojalateria(null); objeto.setRHojalateriaFecha(null); objeto.setUsuarioByRHojalateriaAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_hojalateria.setText(""); l_hojalateria.setText("<Nombre del Responsable>"); t_rhojalateria.setText(""); l_autorizoh.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "mecanica": objeto.setEmpleadoByRMecanica(null); objeto.setRMecanicaFecha(null); objeto.setUsuarioByRMecanicaAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_mecanica.setText(""); l_mecanica.setText("<Nombre del Responsable>"); t_rmecanica.setText(""); l_autorizom.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "suspension": objeto.setEmpleadoByRSuspension(null); objeto.setRSuspensionFecha(null); objeto.setUsuarioByRSuspensionAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_suspension.setText(""); l_suspension.setText("<Nombre del Responsable>"); t_rsuspension.setText(""); l_autorizos.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "electrico": objeto.setEmpleadoByRElectrico(null); objeto.setRElectricoFecha(null); objeto.setUsuarioByRElectricoAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_electrico.setText(""); l_electrico.setText("<Nombre del Responsable>"); t_relectrico.setText(""); l_autorizoe.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "pintura": objeto.setEmpleadoByRPintura(null); objeto.setRElectricoFecha(null); objeto.setUsuarioByRElectricoAsigno(usr); session.update(objeto); session.getTransaction().commit(); t_pintura.setText(""); l_pintura.setText("<Nombre del Responsable>"); t_rpintura.setText(""); l_autorizop.setText(usr.getIdUsuario()); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; } } catch (HibernateException he) { System.out.println(he);//he.printStackTrace(); session.getTransaction().rollback(); permisos(true, true, true, true, true); } if (session != null) if (session.isOpen()) session.close(); return edo; } public boolean quitaLimite(String tipo, String valor) { boolean edo = false; Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Orden objeto = (Orden) session.get(Orden.class, Integer.parseInt(t_orden.getText())); switch (tipo) { case "hojalateria": objeto.setHojalateriaLimite(null); session.update(objeto); session.getTransaction().commit(); h_limite.setText("DD-MM-YYYY"); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "mecanica": objeto.setMecanicaLimite(null); session.update(objeto); session.getTransaction().commit(); m_limite.setText("DD-MM-YYYY"); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "suspension": objeto.setSuspensionLimite(null); session.update(objeto); session.getTransaction().commit(); s_limite.setText("DD-MM-YYYY"); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "electrico": objeto.setElectricoLimite(null); session.update(objeto); session.getTransaction().commit(); e_limite.setText("DD-MM-YYYY"); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; case "pintura": objeto.setPinturaLimite(null); session.update(objeto); session.getTransaction().commit(); p_limite.setText("DD-MM-YYYY"); permisos(true, true, true, true, true); JOptionPane.showMessageDialog(null, "La asignacin fue eliminada!"); edo = true; break; } } catch (HibernateException he) { System.out.println(he);//he.printStackTrace(); session.getTransaction().rollback(); permisos(true, true, true, true, true); } if (session != null) if (session.isOpen()) session.close(); return edo; } }