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 Valuacion; import Clientes.buscaCliente; import Hibernate.entidades.Usuario; import java.awt.Dimension; import java.awt.Toolkit; import java.util.Calendar; import javax.swing.ImageIcon; import Integral.Herramientas; import Integral.calendario; import Compania.buscaCompania; import Hibernate.Util.HibernateUtil; import Hibernate.entidades.Clientes; import Hibernate.entidades.Compania; import Hibernate.entidades.Configuracion; import Hibernate.entidades.Orden; import Hibernate.entidades.Partida; import Hibernate.entidades.PartidaExterna; import Hibernate.entidades.Pedido; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Element; import com.itextpdf.text.Font; import com.itextpdf.text.PageSize; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.GrayColor; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfPTable; import java.awt.Color; import java.awt.Desktop; import java.io.File; import java.io.FileOutputStream; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Vector; import javax.swing.JOptionPane; import javax.swing.SwingConstants; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.hibernate.Query; import org.hibernate.Session; import Integral.ExtensionFileFilter; import Integral.FormatoTabla; import Integral.HorizontalBarUI; import Integral.PDF; import Integral.PanelPestanas; import Integral.Render1; import Integral.VerticalBarUI; import Servicios.ModificarOrden; import java.math.BigDecimal; /** * * @author I.S.C Salvador */ public class Reportes extends javax.swing.JPanel { Usuario usr; String estado; String sessionPrograma; Herramientas h; FormatoTabla formato; String[] columnas = new String[] { "No", "Aseguradora" }; Class[] types = new Class[] { java.lang.String.class, java.lang.String.class }; public List tam_pdf = new ArrayList(); MyModel model; private String periodo; private javax.swing.JTabbedPane P_pestana; private ModificarOrden Modificar_Orden; String ruta = ""; /** * Creates new form Reportes */ public Reportes(Usuario us, String ses, String ciclo, javax.swing.JTabbedPane panel, ModificarOrden mod_ord, String carpeta) { initComponents(); ruta = carpeta; P_pestana = panel; Modificar_Orden = mod_ord; this.periodo = ciclo; formato = new FormatoTabla(); usr = us; sessionPrograma = ses; h = new Herramientas(usr, 0); model = new MyModel(0, columnas, types); titulos(); scroll.getVerticalScrollBar().setUI(new VerticalBarUI()); scroll.getHorizontalScrollBar().setUI(new HorizontalBarUI()); } /** * 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(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel6 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); c_levantamiento = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); c_valuacion = new javax.swing.JComboBox(); jLabel6 = new javax.swing.JLabel(); c_cotizacion = new javax.swing.JComboBox(); l_nombre_aseguradora = new javax.swing.JLabel(); b_buscar_aseguradora = new javax.swing.JButton(); t_aseguradora = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); t_fecha1 = new javax.swing.JTextField(); b_fecha_siniestro = new javax.swing.JButton(); t_fecha2 = new javax.swing.JTextField(); b_fecha_siniestro1 = new javax.swing.JButton(); c_tipo_fecha = new javax.swing.JComboBox(); jPanel5 = new javax.swing.JPanel(); b_busca_cliente = new javax.swing.JButton(); jLabel8 = new javax.swing.JLabel(); l_id_cliente = new javax.swing.JTextField(); t_asegurado1 = new javax.swing.JCheckBox(); t_asegurado2 = new javax.swing.JCheckBox(); t_asegurado3 = new javax.swing.JCheckBox(); t_asegurado4 = new javax.swing.JCheckBox(); c_estado_cliente = new javax.swing.JComboBox(); jLabel14 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); cb_poliza = new javax.swing.JCheckBox(); cb_siniestro = new javax.swing.JCheckBox(); cb_inciso = new javax.swing.JCheckBox(); cb_reporte = new javax.swing.JCheckBox(); cb_fecha_siniestro = new javax.swing.JCheckBox(); cb_cliente = new javax.swing.JCheckBox(); cb_email = new javax.swing.JCheckBox(); cb_tipo_cliente = new javax.swing.JCheckBox(); cb_marca = new javax.swing.JCheckBox(); cb_placas = new javax.swing.JCheckBox(); cb_motor = new javax.swing.JCheckBox(); cb_anio = new javax.swing.JCheckBox(); cb_serie = new javax.swing.JCheckBox(); cb_economico = new javax.swing.JCheckBox(); cb_interna = new javax.swing.JCheckBox(); cb_estatus = new javax.swing.JCheckBox(); cb_presupuestado = new javax.swing.JCheckBox(); cb_cia = new javax.swing.JCheckBox(); cb_autorizado = new javax.swing.JCheckBox(); cb_compras = new javax.swing.JCheckBox(); cb_tot = new javax.swing.JCheckBox(); cb_tot_directa = new javax.swing.JCheckBox(); cb_autorizado_directo = new javax.swing.JCheckBox(); cb_fecha_entrada = new javax.swing.JCheckBox(); cb_factura = new javax.swing.JCheckBox(); cb_tipo = new javax.swing.JCheckBox(); cb_tot1 = new javax.swing.JCheckBox(); cb_fecha_cliente = new javax.swing.JCheckBox(); jButton4 = new javax.swing.JButton(); scroll = new javax.swing.JScrollPane(); t_datos = new javax.swing.JTable(); 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), "Reportes", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 12))); // NOI18N setLayout(new java.awt.BorderLayout()); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jButton1.setBackground(new java.awt.Color(2, 135, 242)); jButton1.setIcon(new ImageIcon("imagenes/busca.png")); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setBackground(new java.awt.Color(2, 135, 242)); jButton2.setIcon(new ImageIcon("imagenes/pdf.png")); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setBackground(new java.awt.Color(2, 135, 242)); jButton3.setIcon(new ImageIcon("imagenes/exel.png")); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel6.setBackground(new java.awt.Color(254, 254, 254)); jPanel6.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); jPanel4.setBackground(new java.awt.Color(255, 255, 255)); jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Estatus en Valuacin", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N jLabel4.setText("Levantamiento:"); c_levantamiento .setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todas", "Abiertas", "Cerradas" })); jLabel5.setText("Valuacin:"); c_valuacion .setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todas", "Abiertas", "Cerradas" })); jLabel6.setText("Cotizacin"); c_cotizacion .setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todas", "Abiertas", "Cerradas" })); l_nombre_aseguradora.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N l_nombre_aseguradora.setText("Selecciones una Aseguradora"); b_buscar_aseguradora.setBackground(new java.awt.Color(2, 135, 242)); b_buscar_aseguradora.setIcon(new ImageIcon("imagenes/buscar.png")); b_buscar_aseguradora.setToolTipText("Consultar aseguradoras"); b_buscar_aseguradora.setMaximumSize(new java.awt.Dimension(32, 8)); b_buscar_aseguradora.setMinimumSize(new java.awt.Dimension(32, 8)); b_buscar_aseguradora.setPreferredSize(new java.awt.Dimension(32, 8)); b_buscar_aseguradora.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_buscar_aseguradoraActionPerformed(evt); } }); t_aseguradora.setBackground(new java.awt.Color(204, 255, 255)); t_aseguradora.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_aseguradora.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_aseguradoraActionPerformed(evt); } }); t_aseguradora.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_aseguradoraKeyTyped(evt); } }); jLabel3.setText("No:"); 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, false) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(c_levantamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup().addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(c_valuacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup().addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(c_cotizacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel4Layout.createSequentialGroup().addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(t_aseguradora) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(b_buscar_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(l_nombre_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4).addComponent(c_levantamiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5).addComponent(c_valuacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6).addComponent(c_cotizacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(11, 11, 11) .addComponent(jLabel3)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup().addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(b_buscar_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel4Layout.createSequentialGroup().addGap(9, 9, 9) .addComponent(t_aseguradora, 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_nombre_aseguradora, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))); jPanel2.setBackground(new java.awt.Color(255, 255, 255)); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Fecha", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N jLabel1.setText("Inicio:"); jLabel2.setText("Fin:"); t_fecha1.setEditable(false); t_fecha1.setBackground(new java.awt.Color(204, 255, 255)); t_fecha1.setText("AAAA-MM-DD"); t_fecha1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_fecha1.setEnabled(false); b_fecha_siniestro.setBackground(new java.awt.Color(2, 135, 242)); b_fecha_siniestro.setIcon(new ImageIcon("imagenes/calendario.png")); b_fecha_siniestro.setToolTipText("Calendario"); b_fecha_siniestro.setMaximumSize(new java.awt.Dimension(32, 8)); b_fecha_siniestro.setMinimumSize(new java.awt.Dimension(32, 8)); b_fecha_siniestro.setPreferredSize(new java.awt.Dimension(32, 8)); b_fecha_siniestro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_fecha_siniestroActionPerformed(evt); } }); t_fecha2.setEditable(false); t_fecha2.setBackground(new java.awt.Color(204, 255, 255)); t_fecha2.setText("AAAA-MM-DD"); t_fecha2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); t_fecha2.setEnabled(false); t_fecha2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_fecha2ActionPerformed(evt); } }); b_fecha_siniestro1.setBackground(new java.awt.Color(2, 135, 242)); b_fecha_siniestro1.setIcon(new ImageIcon("imagenes/calendario.png")); b_fecha_siniestro1.setToolTipText("Calendario"); b_fecha_siniestro1.setMaximumSize(new java.awt.Dimension(32, 8)); b_fecha_siniestro1.setMinimumSize(new java.awt.Dimension(32, 8)); b_fecha_siniestro1.setPreferredSize(new java.awt.Dimension(32, 8)); b_fecha_siniestro1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_fecha_siniestro1ActionPerformed(evt); } }); c_tipo_fecha.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione", "Ingreso", "Siniestro", "Promesa Interna", "Levantamiento", "Inicio Cotizacion", "Autorizacion del cliente", "Autorizacion interna", "Inicio de valuacin", "Envio a compaia", "Autoriza Compaia", "Autoriza Valuacion", "Fecturacion", "Cierre", "" })); c_tipo_fecha.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { c_tipo_fechaActionPerformed(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(t_fecha1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(b_fecha_siniestro, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(t_fecha2, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(b_fecha_siniestro1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addComponent(c_tipo_fecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(c_tipo_fecha, 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) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addGroup(jPanel2Layout.createSequentialGroup().addGap(35, 35, 35) .addComponent(jLabel2)) .addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(3, 3, 3) .addComponent(t_fecha1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(b_fecha_siniestro, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addGap(3, 3, 3) .addComponent(t_fecha2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(b_fecha_siniestro1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(26, 26, 26))); jPanel5.setBackground(new java.awt.Color(255, 255, 255)); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Cliente", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 11))); // NOI18N b_busca_cliente.setBackground(new java.awt.Color(2, 135, 242)); b_busca_cliente.setIcon(new ImageIcon("imagenes/buscar.png")); b_busca_cliente.setToolTipText("Consultar clientes"); b_busca_cliente.setMaximumSize(new java.awt.Dimension(32, 8)); b_busca_cliente.setMinimumSize(new java.awt.Dimension(32, 8)); b_busca_cliente.setPreferredSize(new java.awt.Dimension(32, 8)); b_busca_cliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_busca_clienteActionPerformed(evt); } }); jLabel8.setForeground(new java.awt.Color(51, 0, 255)); jLabel8.setText("No"); l_id_cliente.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { l_id_clienteKeyTyped(evt); } }); t_asegurado1.setText("Asegurado"); t_asegurado2.setText("Tercero"); t_asegurado3.setText("T. Asegurado"); t_asegurado4.setText("Particular"); c_estado_cliente.setBackground(new java.awt.Color(204, 255, 255)); c_estado_cliente.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccionar", "Aguascalientes", "Baja California", "Baja California Sur", "Campeche", "Chiapas", "Chihuahua", "Coahuila", "Colima", "Distrito Federal", "Durango", "Estado de Mxico", "Guanajuato", "Guerrero", "Hidalgo", "Jalisco", "Michoacn", "Morelos", "Nayarit", "Nuevo Len", "Oaxaca", "Puebla", "Quertaro", "Quintana Roo", "San Luis Potos", "Sinaloa", "Sonora", "Tabasco", "Tamaulipas", "Tlaxcala", "Veracruz", "Yucatn", "Zacatecas" })); jLabel14.setText("Edo:"); 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(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(l_id_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(b_busca_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout .createSequentialGroup().addComponent(jLabel14) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(c_estado_cliente, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout .createSequentialGroup() .addGroup(jPanel5Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(t_asegurado1).addComponent(t_asegurado2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(t_asegurado4) .addComponent(t_asegurado3))))))); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(b_busca_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel5Layout.createSequentialGroup().addGap(5, 5, 5) .addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(l_id_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_asegurado1).addComponent(t_asegurado3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_asegurado2).addComponent(t_asegurado4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(c_estado_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel5Layout.createSequentialGroup().addGap(5, 5, 5) .addComponent(jLabel14))) .addContainerGap(17, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(470, 470, 470))); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addContainerGap().addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jTabbedPane1.addTab("Filtrar", jPanel6); jPanel3.setBackground(new java.awt.Color(255, 255, 255)); jPanel3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); cb_poliza.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_poliza.setText("Poliza"); cb_siniestro.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_siniestro.setText("Sinisestro"); cb_inciso.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_inciso.setText("Inciso"); cb_reporte.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_reporte.setText("N Rep."); cb_fecha_siniestro.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_fecha_siniestro.setText("F. Siniestro"); cb_cliente.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_cliente.setText("Cliente"); cb_email.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_email.setText("Email cliene"); cb_tipo_cliente.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_tipo_cliente.setText("Tipo Cliente"); cb_marca.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_marca.setText("Marca"); cb_placas.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_placas.setText("Placas"); cb_motor.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_motor.setText("Motor"); cb_anio.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_anio.setText("Ao"); cb_serie.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_serie.setText("Serie"); cb_economico.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_economico.setText("N. Econom."); cb_interna.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_interna.setText("F. Interna"); cb_estatus.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_estatus.setText("Estatus Orden"); cb_presupuestado.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_presupuestado.setText("Refacciones Cotizado"); cb_cia.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_cia.setText("Refacciones Cia/Seg."); cb_autorizado.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_autorizado.setText("Refacciones Autorizado"); cb_compras.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_compras.setText("Compras"); cb_tot.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_tot.setText("M.O. Cotizada"); cb_tot_directa.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_tot_directa.setText("M.O. Directa"); cb_autorizado_directo.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_autorizado_directo.setText("Refacciones Cotizado Final"); cb_fecha_entrada.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_fecha_entrada.setText("F. Entrada"); cb_factura.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_factura.setText("Factura"); cb_tipo.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_tipo.setText("Tipo"); cb_tot1.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_tot1.setText("M.O. Cotizada Final"); cb_fecha_cliente.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N cb_fecha_cliente.setText("F. Cliente"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(cb_poliza) .addComponent(cb_siniestro).addComponent(cb_inciso).addComponent(cb_reporte) .addComponent(cb_fecha_siniestro).addComponent(cb_cliente)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_email).addComponent(cb_tipo_cliente).addComponent(cb_marca) .addComponent(cb_placas).addComponent(cb_motor) .addGroup(jPanel3Layout.createSequentialGroup().addGap(2, 2, 2) .addComponent(cb_anio))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_serie).addComponent(cb_economico).addComponent(cb_interna) .addComponent(cb_cia).addComponent(cb_presupuestado).addComponent(cb_estatus)) .addGap(28, 28, 28) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_autorizado).addComponent(cb_tot) .addComponent(cb_tot1).addComponent(cb_autorizado_directo)) .addGap(55, 55, 55) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_factura).addComponent(cb_fecha_entrada) .addComponent(cb_tipo).addComponent(cb_fecha_cliente))) .addComponent(cb_tot_directa).addComponent(cb_compras)) .addGap(192, 337, Short.MAX_VALUE))); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(cb_poliza) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_siniestro) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_inciso) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_reporte)) .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(cb_email) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_tipo_cliente) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_marca)) .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cb_serie).addComponent(cb_autorizado)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_economico) .addComponent(cb_autorizado_directo)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cb_interna).addComponent(cb_tot))) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(cb_fecha_entrada) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_factura) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cb_tipo))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_placas).addComponent(cb_estatus) .addComponent(cb_tot1).addComponent(cb_fecha_cliente)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_fecha_siniestro) .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(cb_motor) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cb_presupuestado).addComponent(cb_tot_directa))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cb_anio).addComponent(cb_cia) .addComponent(cb_cliente)) .addComponent(cb_compras)))) .addGap(0, 39, Short.MAX_VALUE))); jTabbedPane1.addTab("Campos para el reporte", jPanel3); jButton4.setBackground(new java.awt.Color(2, 135, 242)); jButton4.setForeground(new java.awt.Color(255, 255, 255)); jButton4.setIcon(new ImageIcon("imagenes/nuevo.png")); jButton4.setToolTipText("Restaurar"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 916, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE) .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); add(jPanel1, java.awt.BorderLayout.PAGE_START); t_datos.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { "No", "Aseguradora" }) { boolean[] canEdit = new boolean[] { false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); t_datos.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); t_datos.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); t_datos.getTableHeader().setReorderingAllowed(false); t_datos.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { t_datosMouseClicked(evt); } }); scroll.setViewportView(t_datos); add(scroll, java.awt.BorderLayout.CENTER); }// </editor-fold>//GEN-END:initComponents private void b_fecha_siniestroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_fecha_siniestroActionPerformed // 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)); t_fecha1.setText(anio + "-" + mes + "-" + dia); //b_busca_cliente.requestFocus(); } else t_fecha1.setText("AAAA-MM-DD"); model = new MyModel(0, columnas, types); t_datos.setModel(model); titulos(); }//GEN-LAST:event_b_fecha_siniestroActionPerformed private void b_fecha_siniestro1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_fecha_siniestro1ActionPerformed // 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)); t_fecha2.setText(anio + "-" + mes + "-" + dia); } else t_fecha2.setText("AAAA-MM-DD"); model = new MyModel(0, columnas, types); t_datos.setModel(model); titulos(); }//GEN-LAST:event_b_fecha_siniestro1ActionPerformed private void t_aseguradoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_aseguradoraActionPerformed // TODO add your handling code here: b_buscar_aseguradora.requestFocus(); }//GEN-LAST:event_t_aseguradoraActionPerformed private void t_aseguradoraKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_aseguradoraKeyTyped // TODO add your handling code here: char car = evt.getKeyChar(); if (t_aseguradora.getText().length() >= 4) evt.consume(); if ((car < '0' || car > '9')) evt.consume(); }//GEN-LAST:event_t_aseguradoraKeyTyped private void b_buscar_aseguradoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_buscar_aseguradoraActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaCompania obj = new buscaCompania(new javax.swing.JFrame(), true, this.sessionPrograma, this.usr); 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); Compania actor = obj.getReturnStatus(); if (actor != null) { t_aseguradora.setText(actor.getIdCompania().toString()); l_nombre_aseguradora.setText(actor.getNombre()); } else { t_aseguradora.setText(""); l_nombre_aseguradora.setText("Selecciones una Aseguradora"); } }//GEN-LAST:event_b_buscar_aseguradoraActionPerformed private void b_busca_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_busca_clienteActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); buscaCliente obj = new buscaCliente(new javax.swing.JFrame(), true); 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); Clientes actor = obj.getReturnStatus(); if (actor != null) l_id_cliente.setText(actor.getIdClientes().toString()); else l_id_cliente.setText(""); }//GEN-LAST:event_b_busca_clienteActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String consulta = "from Orden com "; int entro = 0; switch (c_tipo_fecha.getSelectedItem().toString()) { case "Ingreso": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { consulta += "where com.fecha>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fecha<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Siniestro": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fechaSiniestro>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fechaSiniestro<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Promesa Interna": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fechaTaller>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fechaTaller<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Levantamiento": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RLevantamientoInicio>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RLevantamientoInicio<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Inicio Cotizacion": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RCotizaInicio>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RCotizaInicio<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Autorizacion del cliente": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.autorizaCliente>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.autorizaCliente<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Autorizacion interna": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RAutorizacionInterna>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RAutorizacionInterna<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Inicio de valuacin": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RValuacionInicio>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RValuacionInicio<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Envio a compaia": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.envioCompania>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.envioCompania<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Autoriza Compaia": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.autorizaCompania>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.autorizaCompania<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Autoriza Valuacion": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RValuacionCierre>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RValuacionCierre<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Fecturacion": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fehaFectura>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fehaFectura<='" + t_fecha2.getText() + "' "; entro = 1; } break; case "Cierre": if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fechaCierre>='" + t_fecha1.getText() + "' "; entro = 1; } if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.fechaCierre<='" + t_fecha2.getText() + "' "; entro = 1; } break; } if (c_levantamiento.getSelectedIndex() > 0) { if (c_levantamiento.getSelectedItem().toString().compareTo("Abiertas") == 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RLevantamientoCierre=null "; entro = 1; } if (c_levantamiento.getSelectedItem().toString().compareTo("Cerradas") == 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RLevantamientoCierre!=null "; entro = 1; } } if (c_valuacion.getSelectedIndex() > 0) { if (c_valuacion.getSelectedItem().toString().compareTo("Abiertas") == 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RValuacionCierre=null "; entro = 1; } if (c_valuacion.getSelectedItem().toString().compareTo("Cerradas") == 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RValuacionCierre!=null "; entro = 1; } } if (c_cotizacion.getSelectedIndex() > 0) { if (c_cotizacion.getSelectedItem().toString().compareTo("Abiertas") == 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RCotizaCierre=null "; entro = 1; } if (c_cotizacion.getSelectedItem().toString().compareTo("Cerradas") == 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.RCotizaCierre!=null "; entro = 1; } } if (t_aseguradora.getText().compareTo("") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.compania.idCompania=" + t_aseguradora.getText() + " "; entro = 1; } if (l_id_cliente.getText().compareTo("") != 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.clientes.idClientes=" + l_id_cliente.getText() + " "; entro = 1; } if (t_asegurado1.isSelected() == true || t_asegurado2.isSelected() == true || t_asegurado3.isSelected() == true || t_asegurado4.isSelected() == true) { if (entro == 1) consulta += "and ( "; else consulta += "where ("; } int parentesis = 0; if (t_asegurado1.isSelected() == true) { consulta += "com.tipoCliente='1' "; entro = 1; parentesis = 1; } if (t_asegurado2.isSelected() == true) { if (parentesis == 1) consulta += "or "; consulta += "com.tipoCliente='2' "; entro = 1; parentesis = 1; } if (t_asegurado3.isSelected() == true) { if (parentesis == 1) consulta += "or "; consulta += "com.tipoCliente='3' "; entro = 1; parentesis = 1; } if (t_asegurado4.isSelected() == true) { if (parentesis == 1) consulta += "or "; consulta += "com.tipoCliente='4' "; entro = 1; } if (t_asegurado1.isSelected() == true || t_asegurado2.isSelected() == true || t_asegurado3.isSelected() == true || t_asegurado4.isSelected() == true) consulta += ") "; if (c_estado_cliente.getSelectedIndex() > 0) { if (entro == 1) consulta += "and "; else consulta += "where "; consulta += "com.clientes.estado='" + c_estado_cliente.getSelectedItem().toString() + "' "; entro = 1; } /*if(entro==1) consulta+="and "; else consulta+="where "; consulta+="com.ciclo.idCiclo="+periodo;*/ TableColumnModel col_model = t_datos.getColumnModel(); DefaultTableCellRenderer tcr = new DefaultTableCellRenderer(); tcr.setHorizontalAlignment(SwingConstants.RIGHT); Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); Query q = session.createQuery(consulta); session.beginTransaction().commit(); List resultList = q.list(); List tipos = new ArrayList(); List col = new ArrayList(); List tam = new ArrayList(); if (resultList.size() > 0) { tam_pdf = new ArrayList(); tipos.add(java.lang.String.class); col.add("No"); tam.add(70); tam_pdf.add(14); tipos.add(java.lang.String.class); col.add("Aseguradora"); tam.add(180); tam_pdf.add(25); if (cb_fecha_entrada.isSelected() == true) { tipos.add(java.lang.String.class); col.add("F. Ingreso"); tam.add(80); tam_pdf.add(15); } if (cb_poliza.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Poliza"); tam.add(80); tam_pdf.add(15); } if (cb_siniestro.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Siniestro"); tam.add(60); tam_pdf.add(15); } if (cb_inciso.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Inciso"); tam.add(50); tam_pdf.add(10); } if (cb_reporte.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Reporte"); tam.add(80); tam_pdf.add(15); } if (cb_fecha_siniestro.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Fecha Rep."); tam.add(80); tam_pdf.add(15); } if (cb_cliente.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Cliente"); tam.add(180); tam_pdf.add(25); } if (cb_email.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Email cliente"); tam.add(150); tam_pdf.add(25); } if (cb_tipo_cliente.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Tipo Cliente"); tam.add(80); tam_pdf.add(15); } if (cb_marca.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Marca"); tam.add(150); tam_pdf.add(20); } if (cb_placas.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Placas"); tam.add(80); tam_pdf.add(15); } if (cb_motor.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Motor"); tam.add(80); tam_pdf.add(15); } if (cb_anio.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Modelo"); tam.add(40); tam_pdf.add(10); } if (cb_serie.isSelected() == true) { tipos.add(java.lang.String.class); col.add("No serie"); tam.add(80); tam_pdf.add(15); } if (cb_economico.isSelected() == true) { tipos.add(java.lang.String.class); col.add("No economico"); tam.add(80); tam_pdf.add(15); } if (cb_interna.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Fecha int."); tam.add(80); tam_pdf.add(15); } if (cb_estatus.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Estatus"); tam.add(80); tam_pdf.add(15); } if (cb_presupuestado.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("Cotizado"); tam.add(80); tam_pdf.add(15); } if (cb_cia.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("Cia/Seg"); tam.add(80); tam_pdf.add(15); } if (cb_autorizado.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("Autorizado"); tam.add(80); tam_pdf.add(15); } if (cb_compras.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("Compras"); tam.add(80); tam_pdf.add(15); } if (cb_tot.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("MO.Cot."); tam.add(80); tam_pdf.add(15); } if (cb_tot_directa.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("M.O Dir."); tam.add(80); tam_pdf.add(15); } if (cb_tot1.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("M.O.Cot.Fin"); tam.add(80); tam_pdf.add(15); } if (cb_autorizado_directo.isSelected() == true) { tipos.add(java.lang.Double.class); col.add("Ref.Cot.F."); tam.add(80); tam_pdf.add(15); } if (cb_factura.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Factura"); tam.add(80); tam_pdf.add(15); } if (cb_tipo.isSelected() == true) { tipos.add(java.lang.String.class); col.add("Tipo"); tam.add(80); tam_pdf.add(15); } if (cb_interna.isSelected() == true) { tipos.add(java.lang.String.class); col.add("F.Cliente"); tam.add(80); tam_pdf.add(15); } model = new MyModel(resultList.size(), (String[]) col.toArray(new String[0]), (Class[]) tipos.toArray(new Class[0])); t_datos.setModel(model); t_datos.setDefaultRenderer(String.class, formato); t_datos.setDefaultRenderer(Double.class, formato); JTableHeader header = t_datos.getTableHeader(); header.setBackground(new java.awt.Color(90, 66, 126));//102,102,102 header.setForeground(Color.white); for (int c = 0; c < tam.size(); c++) { TableColumn column = col_model.getColumn(c); column.setPreferredWidth((int) tam.get(c)); } int ren = 0; for (Object o : resultList) { Orden orden = (Orden) o; int columna = 0; Vector v = new Vector(); v.add(v); t_datos.setValueAt(orden.getIdOrden(), ren, columna); columna++; t_datos.setValueAt(orden.getCompania().getNombre(), ren, columna); columna++; if (cb_fecha_entrada.isSelected() == true) { t_datos.setValueAt(orden.getFecha().toString(), ren, columna); columna++; } if (cb_poliza.isSelected() == true) { t_datos.setValueAt(orden.getPoliza(), ren, columna); columna++; } if (cb_siniestro.isSelected() == true) { t_datos.setValueAt(orden.getSiniestro(), ren, columna); columna++; } if (cb_inciso.isSelected() == true) { t_datos.setValueAt(orden.getInciso(), ren, columna); columna++; } if (cb_reporte.isSelected() == true) { t_datos.setValueAt(orden.getNoReporte(), ren, columna); columna++; } if (cb_fecha_siniestro.isSelected() == true) { if (orden.getFechaSiniestro() != null) t_datos.setValueAt(orden.getFechaSiniestro().toString(), ren, columna); else t_datos.setValueAt("", ren, columna); columna++; } if (cb_cliente.isSelected() == true) { t_datos.setValueAt(orden.getClientes().getNombre(), ren, columna); columna++; } if (cb_email.isSelected() == true) { t_datos.setValueAt(orden.getClientes().getEmail(), ren, columna); columna++; } if (cb_tipo_cliente.isSelected() == true) { if (orden.getTipoCliente() != null) { if (orden.getTipoCliente().compareTo("1") == 0) t_datos.setValueAt("Asegurado", ren, columna); if (orden.getTipoCliente().compareTo("2") == 0) t_datos.setValueAt("Tercero", ren, columna); if (orden.getTipoCliente().compareTo("3") == 0) t_datos.setValueAt("Tercero Asegurado", ren, columna); if (orden.getTipoCliente().compareTo("4") == 0) t_datos.setValueAt("Particular", ren, columna); } else t_datos.setValueAt("", ren, columna); columna++; } if (cb_marca.isSelected() == true) { t_datos.setValueAt(orden.getMarca().getMarcaNombre(), ren, columna); columna++; } if (cb_placas.isSelected() == true) { t_datos.setValueAt(orden.getNoPlacas(), ren, columna); columna++; } if (cb_motor.isSelected() == true) { t_datos.setValueAt(orden.getNoMotor(), ren, columna); columna++; } if (cb_anio.isSelected() == true) { t_datos.setValueAt("" + orden.getModelo(), ren, columna); columna++; } if (cb_serie.isSelected() == true) { t_datos.setValueAt(orden.getNoSerie(), ren, columna); columna++; } if (cb_economico.isSelected() == true) { t_datos.setValueAt(orden.getNoEconomico(), ren, columna); columna++; } if (cb_interna.isSelected() == true) { if (orden.getFechaTaller() != null) t_datos.setValueAt(orden.getFechaTaller().toString(), ren, columna); else t_datos.setValueAt("", ren, columna); columna++; } if (cb_estatus.isSelected() == true) { t_datos.setValueAt(orden.getEstatus().getEstatusNombre(), ren, columna); columna++; } if (cb_presupuestado.isSelected() == true) { Partida[] partidas = (Partida[]) orden.getPartidasForIdOrden().toArray(new Partida[0]); double suma = 0d; for (int p = 0; p < partidas.length; p++) { suma += partidas[p].getCU() * partidas[p].getCant(); } BigDecimal conv = new BigDecimal(suma); t_datos.setValueAt(conv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(), ren, columna); columna++; } Partida[] partidas = (Partida[]) orden.getPartidasForIdOrden().toArray(new Partida[0]); if (cb_cia.isSelected() == true) { double suma = 0d; for (int p = 0; p < partidas.length; p++) { suma += Math.round(partidas[p].getCU() / (1 - (partidas[p].getPorcentaje() * 0.01))) * partidas[p].getCant(); } BigDecimal conv = new BigDecimal(suma); t_datos.setValueAt(conv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(), ren, columna); //t_datos.setValueAt(suma, ren, columna); columna++; } if (cb_autorizado.isSelected() == true) { double suma = 0d; for (int p = 0; p < partidas.length; p++) { suma += Math.round(partidas[p].getCantidadAut() * partidas[p].getPrecioAutCU()); } BigDecimal conv = new BigDecimal(suma); t_datos.setValueAt(conv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(), ren, columna); //t_datos.setValueAt(suma, ren, columna); columna++; } if (cb_compras.isSelected() == true) {//realizar consulta de costo de compras internas mas las adicionales /*if(orden.getMoPresupuestada()!=null) t_datos.setValueAt(orden.getMoPresupuestada(), ren, columna);*/ double suma = 0d; for (int p = 0; p < partidas.length; p++) { if (partidas[p].getPedido() != null) { if (partidas[p].getPedido().getUsuarioByAutorizo() != null && partidas[p].getPedido().getUsuarioByAutorizo2() != null) { suma += Math.round(partidas[p].getCantPcp() * partidas[p].getPcp()); } } } if (orden.getPedidos().size() > 0) { Pedido[] adicionales = (Pedido[]) orden.getPedidos().toArray(new Pedido[0]); if (adicionales.length > 0) { for (int a = 0; a < adicionales.length; a++) { if (adicionales[a].getUsuarioByAutorizo() != null && adicionales[a].getUsuarioByAutorizo2() != null) { PartidaExterna[] pe = (PartidaExterna[]) adicionales[a].getPartidaExternas() .toArray(new PartidaExterna[0]); for (int b = 0; b < pe.length; b++) { suma += Math.round(pe[b].getCantidad() * pe[b].getCosto()); } } } } } BigDecimal conv = new BigDecimal(suma); t_datos.setValueAt(conv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(), ren, columna); //t_datos.setValueAt(suma, ren, columna); columna++; } if (cb_tot.isSelected() == true) { double suma = 0d; for (int p = 0; p < partidas.length; p++) { double horas = 0d; if (partidas[p].getDm() != -1) horas += partidas[p].getDm(); if (partidas[p].getRepMin() != -1) horas += partidas[p].getRepMin(); if (partidas[p].getRepMed() != -1) horas += partidas[p].getRepMed(); if (partidas[p].getRepMax() != -1) horas += partidas[p].getRepMax(); if (partidas[p].getPint() != -1) horas += partidas[p].getPint(); if (partidas[p].getCam() != -1) horas += partidas[p].getCam(); horas *= partidas[p].getCant(); suma += horas * orden.getCompania().getImporteHora(); } BigDecimal conv = new BigDecimal(suma); t_datos.setValueAt(conv.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(), ren, columna); //t_datos.setValueAt(suma, ren, columna); columna++; } if (cb_tot_directa.isSelected() == true) { t_datos.setValueAt(orden.getMoDirecta(), ren, columna); columna++; } if (cb_tot1.isSelected() == true) { t_datos.setValueAt(orden.getMoPresupuestada(), ren, columna); columna++; } if (cb_autorizado_directo.isSelected() == true) { t_datos.setValueAt(orden.getRefAutorizadas(), ren, columna); columna++; } if (cb_factura.isSelected() == true) { if (orden.getNoFactura() != null) t_datos.setValueAt(orden.getNoFactura(), ren, columna); else t_datos.setValueAt("", ren, columna); columna++; } if (cb_tipo.isSelected() == true) { if (orden.getTipo() != null) t_datos.setValueAt(orden.getTipo().getTipoNombre(), ren, columna); else t_datos.setValueAt("", ren, columna); columna++; } if (cb_fecha_cliente.isSelected() == true) { if (orden.getFechaCliente() != null) t_datos.setValueAt(orden.getFechaCliente().toString(), ren, columna); else t_datos.setValueAt("", ren, columna); columna++; } ren++; } } else { tipos = new ArrayList(); col = new ArrayList(); tam = new ArrayList(); tipos.add(java.lang.String.class); col.add("No"); tam.add(40); tipos.add(java.lang.String.class); col.add("Aseguradora"); tam.add(150); model = new MyModel(0, (String[]) col.toArray(new String[0]), (Class[]) tipos.toArray(new Class[0])); t_datos.setModel(model); for (int c = 0; c < tam.size(); c++) { TableColumn column = col_model.getColumn(c); column.setPreferredWidth((int) tam.get(c)); } } if (entro == 1) entro = 0; titulos(); } catch (Exception e) { e.printStackTrace(); } if (session != null) if (session.isOpen()) session.close(); }//GEN-LAST:event_jButton1ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: c_tipo_fecha.setSelectedIndex(0); t_fecha1.setText("AAAA-MM-DD"); t_fecha2.setText("AAAA-MM-DD"); c_levantamiento.setSelectedIndex(0); c_valuacion.setSelectedIndex(0); c_cotizacion.setSelectedIndex(0); t_aseguradora.setText(""); l_nombre_aseguradora.setText("Selecciones una Aseguradora"); l_id_cliente.setText(""); t_asegurado1.setSelected(false); t_asegurado2.setSelected(false); t_asegurado3.setSelected(false); t_asegurado4.setSelected(false); c_estado_cliente.setSelectedIndex(0); cb_poliza.setSelected(false); cb_siniestro.setSelected(false); cb_inciso.setSelected(false); cb_reporte.setSelected(false); cb_fecha_siniestro.setSelected(false); cb_cliente.setSelected(false); cb_siniestro.setSelected(false); cb_siniestro.setSelected(false); cb_email.setSelected(false); cb_tipo_cliente.setSelected(false); cb_marca.setSelected(false); cb_placas.setSelected(false); cb_motor.setSelected(false); cb_anio.setSelected(false); cb_serie.setSelected(false); cb_economico.setSelected(false); cb_interna.setSelected(false); cb_estatus.setSelected(false); cb_presupuestado.setSelected(false); cb_cia.setSelected(false); cb_autorizado.setSelected(false); cb_compras.setSelected(false); cb_tot.setSelected(false); cb_tot_directa.setSelected(false); cb_autorizado_directo.setSelected(false); cb_fecha_entrada.setSelected(false); cb_factura.setSelected(false); cb_tipo.setSelected(false); cb_fecha_cliente.setSelected(false); }//GEN-LAST:event_jButton4ActionPerformed private void c_tipo_fechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_c_tipo_fechaActionPerformed // TODO add your handling code here: t_fecha1.setText("AAAA-MM-DD"); t_fecha2.setText("AAAA-MM-DD"); model = new MyModel(0, columnas, types); t_datos.setModel(model); titulos(); }//GEN-LAST:event_c_tipo_fechaActionPerformed private void t_fecha2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_fecha2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_t_fecha2ActionPerformed private void l_id_clienteKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_l_id_clienteKeyTyped // TODO add your handling code here: char car = evt.getKeyChar(); if (t_aseguradora.getText().length() >= 10) evt.consume(); if ((car < '0' || car > '9')) evt.consume(); }//GEN-LAST:event_l_id_clienteKeyTyped private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: h = new Herramientas(usr, 0); h.session(sessionPrograma); if (t_datos.getRowCount() > 0) { javax.swing.JFileChooser jF1 = new javax.swing.JFileChooser(); jF1.setFileFilter(new ExtensionFileFilter("Excel document (*.pdf)", new String[] { "pdf" })); String ruta = null; if (jF1.showSaveDialog(null) == jF1.APPROVE_OPTION) { ruta = jF1.getSelectedFile().getAbsolutePath(); if (ruta != null) { Session session = HibernateUtil.getSessionFactory().openSession(); try { DecimalFormat formatoPorcentaje = new DecimalFormat("#,##0.00"); formatoPorcentaje.setMinimumFractionDigits(2); session.beginTransaction().begin(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED); //Orden ord=buscaApertura(); PDF reporte = new PDF(); Date fecha = new Date(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyyHH-mm-ss");//YYYY-MM-DD HH:MM:SS String valor = dateFormat.format(fecha); reporte.Abrir2(PageSize.LETTER.rotate(), "Valuacin", ruta + ".pdf"); Font font = new Font(Font.FontFamily.HELVETICA, 5, Font.BOLD); BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; float[] nuevos = new float[tam_pdf.size()]; for (int q = 0; q < tam_pdf.size(); q++) { nuevos[q] = Float.parseFloat(tam_pdf.get(q).toString()); } PdfPTable tabla = reporte.crearTabla(nuevos.length, nuevos, 100, Element.ALIGN_LEFT); cabecera(reporte, bf, tabla); int ren = 0; double dm = 0d, cam = 0d, min = 0d, med = 0d, max = 0d, pin = 0d, tot = 0d; double cia = 0d, refacciones = 0d, autorizado = 0d, presupuesto = 0d, directo = 0d, tot_m = 0d, compras = 0d, aut = 0d, mo_dir = 0d, cotizado = 0d; for (int i = 0; i < t_datos.getRowCount(); i++) { for (int j = 0; j < t_datos.getColumnCount(); j++) { if (t_datos.getColumnName(j).compareTo("Cia/Seg") == 0 || t_datos.getColumnName(j).compareTo("Costo Refacciones") == 0 || t_datos.getColumnName(j).compareTo("Autorizado") == 0 || t_datos.getColumnName(j).compareTo("M.O. Presup.") == 0 || t_datos.getColumnName(j).compareTo("M.O. Directa") == 0 || t_datos.getColumnName(j).compareTo("Tot M.O") == 0 || t_datos.getColumnName(j).compareTo("Compras") == 0 || t_datos.getColumnName(j).compareTo("Aut. Dir.") == 0 || t_datos.getColumnName(j).compareTo("M.O Directa") == 0 || t_datos.getColumnName(j).compareTo("Cotizado") == 0) { if (t_datos.getValueAt(i, j) != null) { tabla.addCell( reporte.celda(formatoPorcentaje.format(t_datos.getValueAt(i, j)), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); if (t_datos.getColumnName(j).compareTo("Cia/Seg") == 0) { cia += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("Costo Refacciones") == 0) { refacciones += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("Autorizado") == 0) { autorizado += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("M.O. Presup.") == 0) { presupuesto += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("M.O. Directa") == 0) { directo += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("Tot M.O") == 0) { tot_m += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("Compras") == 0) { compras += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("Aut. Dir.") == 0) { aut += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("M.O Directa") == 0) { mo_dir += (double) t_datos.getValueAt(i, j); } if (t_datos.getColumnName(j).compareTo("Cotizado") == 0) { cotizado += (double) t_datos.getValueAt(i, j); } } else tabla.addCell(reporte.celda("0.00", font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); } else { if (t_datos.getValueAt(i, j) != null) tabla.addCell(reporte.celda("" + t_datos.getValueAt(i, j), font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); else tabla.addCell(reporte.celda("", font, contenido, izquierda, 0, 1, Rectangle.RECTANGLE)); } } /*if(ren==38) { reporte.agregaObjeto(tabla); reporte.writer.newPage(); tabla=reporte.crearTabla(nuevos.length, nuevos, 100, Element.ALIGN_LEFT); cabecera(reporte, bf, tabla); ren=-1; } ren++;*/ } for (int j = 0; j < t_datos.getColumnCount(); j++) { boolean entro = false; if (t_datos.getColumnName(j).compareTo("Cia/Seg") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(cia), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("Costo Refacciones") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(refacciones), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("Autorizado") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(autorizado), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("M.O. Presup.") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(presupuesto), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("M.O. Directa") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(directo), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("Tot M.O") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(tot_m), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("Compras") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(compras), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("Aut. Dir.") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(aut), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("M.O Directa") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(mo_dir), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (t_datos.getColumnName(j).compareTo("Cotizado") == 0) { tabla.addCell(reporte.celda(formatoPorcentaje.format(cotizado), font, contenido, derecha, 0, 1, Rectangle.RECTANGLE)); entro = true; } if (entro == false) { tabla.addCell( reporte.celda("", font, contenido, derecha, 0, 1, Rectangle.NO_BORDER)); } } tabla.setHeaderRows(1); reporte.agregaObjeto(tabla); reporte.cerrar(); reporte.visualizar2(ruta + ".pdf"); } catch (Exception e) { System.out.println(e); e.printStackTrace(); 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_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: h = new Herramientas(this.usr, 0); h.session(sessionPrograma); javax.swing.JFileChooser jF1 = new javax.swing.JFileChooser(); jF1.setFileFilter(new ExtensionFileFilter("Excel document (*.xls)", new String[] { "xls" })); String ruta = null; if (jF1.showSaveDialog(null) == jF1.APPROVE_OPTION) { ruta = jF1.getSelectedFile().getAbsolutePath(); if (ruta != null) { File archivoXLS = new File(ruta + ".xls"); try { if (archivoXLS.exists()) archivoXLS.delete(); archivoXLS.createNewFile(); Workbook libro = new HSSFWorkbook(); FileOutputStream archivo = new FileOutputStream(archivoXLS); Sheet hoja = libro.createSheet("VALUACION"); for (int ren = 0; ren < (t_datos.getRowCount() + 1); ren++) { Row fila = hoja.createRow(ren); for (int col = 0; col < t_datos.getColumnCount(); col++) { Cell celda = fila.createCell(col); if (ren == 0) { celda.setCellValue(t_datos.getColumnName(col)); } else { try { celda.setCellValue(t_datos.getValueAt(ren - 1, col).toString()); } catch (Exception e) { celda.setCellValue(""); } } } } libro.write(archivo); archivo.close(); Desktop.getDesktop().open(archivoXLS); } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte si el archivo esta abierto"); } } } }//GEN-LAST:event_jButton3ActionPerformed private void t_datosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_t_datosMouseClicked // TODO add your handling code here: if (evt.getClickCount() == 2) { if (t_datos.getRowCount() > 0 && t_datos.getSelectedRow() >= 0) { Session session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction().begin(); Query q = session.createQuery("SELECT ord from Orden ord where ord.idOrden=" + t_datos.getValueAt(t_datos.getSelectedRow(), 0)); List resultList = q.list(); if (resultList.size() > 0) { Object o = resultList.get(0); Orden ord = (Orden) o; usr = (Usuario) session.get(Usuario.class, usr.getIdUsuario()); int pos = -1; for (int a = 0; a < P_pestana.getTabCount(); a++) { if (P_pestana.getTitleAt(a) == "A. Valuacion") pos = a; } if (pos >= 0) { P_pestana.setSelectedIndex(pos); Modificar_Orden.t_orden.requestFocus(); } else { Modificar_Orden = new ModificarOrden(usr, this.periodo, 3, sessionPrograma, ruta); PanelPestanas btc = new PanelPestanas(P_pestana, 3, usr); P_pestana.addTab("A. Valuacion", Modificar_Orden); P_pestana.setSelectedComponent(Modificar_Orden); P_pestana.setTabComponentAt(P_pestana.getSelectedIndex(), btc); Modificar_Orden.t_orden.requestFocus(); } Modificar_Orden.t_orden.setText("" + ord.getIdOrden()); Modificar_Orden.orden_act = ord; Modificar_Orden.consultaOrden(); Modificar_Orden.b_busca_orden.requestFocus(); Modificar_Orden.p_ventanas.setSelectedIndex(0); if (session != null) if (session.isOpen()) session.close(); } else { if (session != null) if (session.isOpen()) session.close(); } } } }//GEN-LAST:event_t_datosMouseClicked // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton b_busca_cliente; private javax.swing.JButton b_buscar_aseguradora; private javax.swing.JButton b_fecha_siniestro; private javax.swing.JButton b_fecha_siniestro1; private javax.swing.JComboBox c_cotizacion; private javax.swing.JComboBox c_estado_cliente; private javax.swing.JComboBox c_levantamiento; private javax.swing.JComboBox c_tipo_fecha; private javax.swing.JComboBox c_valuacion; private javax.swing.JCheckBox cb_anio; private javax.swing.JCheckBox cb_autorizado; private javax.swing.JCheckBox cb_autorizado_directo; private javax.swing.JCheckBox cb_cia; private javax.swing.JCheckBox cb_cliente; private javax.swing.JCheckBox cb_compras; private javax.swing.JCheckBox cb_economico; private javax.swing.JCheckBox cb_email; private javax.swing.JCheckBox cb_estatus; private javax.swing.JCheckBox cb_factura; private javax.swing.JCheckBox cb_fecha_cliente; private javax.swing.JCheckBox cb_fecha_entrada; private javax.swing.JCheckBox cb_fecha_siniestro; private javax.swing.JCheckBox cb_inciso; private javax.swing.JCheckBox cb_interna; private javax.swing.JCheckBox cb_marca; private javax.swing.JCheckBox cb_motor; private javax.swing.JCheckBox cb_placas; private javax.swing.JCheckBox cb_poliza; private javax.swing.JCheckBox cb_presupuestado; private javax.swing.JCheckBox cb_reporte; private javax.swing.JCheckBox cb_serie; private javax.swing.JCheckBox cb_siniestro; private javax.swing.JCheckBox cb_tipo; private javax.swing.JCheckBox cb_tipo_cliente; private javax.swing.JCheckBox cb_tot; private javax.swing.JCheckBox cb_tot1; private javax.swing.JCheckBox cb_tot_directa; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTextField l_id_cliente; private javax.swing.JLabel l_nombre_aseguradora; private javax.swing.JScrollPane scroll; private javax.swing.JCheckBox t_asegurado1; private javax.swing.JCheckBox t_asegurado2; private javax.swing.JCheckBox t_asegurado3; private javax.swing.JCheckBox t_asegurado4; public javax.swing.JTextField t_aseguradora; private javax.swing.JTable t_datos; private javax.swing.JTextField t_fecha1; private javax.swing.JTextField t_fecha2; // End of variables declaration//GEN-END:variables public class MyModel extends DefaultTableModel { Class[] types; int ren = 0; int col = 0; private boolean[][] celdaEditable; public MyModel(int renglones, String columnas[], Class[] tipos) { types = tipos; ren = renglones; col = columnas.length; celdaEditable = new boolean[types.length][renglones]; for (int x = 0; x < types.length; x++) { for (int y = 0; y < renglones; y++) { celdaEditable[x][y] = false; } } 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); this.dataVector.setElementAt(vector, row); fireTableCellUpdated(row, col); break; } } public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return this.celdaEditable[columnIndex][rowIndex]; } public void setCeldaEditable(int fila, int columna, boolean editable) { this.celdaEditable[columna][fila] = editable; } public void setColumnaEditable(int columna, boolean editable) { int i = 0; int cantidadFilas = this.getRowCount(); for (i = 0; i < celdaEditable[columna].length; i++) this.celdaEditable[columna][i] = editable; } } public void cabecera(PDF reporte, BaseFont bf, PdfPTable tabla) { Session session = HibernateUtil.getSessionFactory().openSession(); try { reporte.contenido.setLineWidth(0.5f); reporte.contenido.setColorStroke(new GrayColor(0.2f)); reporte.contenido.setColorFill(new GrayColor(0.9f)); Configuracion con = (Configuracion) session.get(Configuracion.class, 1); reporte.inicioTexto(); reporte.contenido.setFontAndSize(bf, 14); reporte.contenido.setColorFill(BaseColor.BLACK); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, con.getEmpresa(), 35, 575, 0); reporte.contenido.setFontAndSize(bf, 8); reporte.contenido.setColorFill(BaseColor.BLACK); String titulo = "Reporte"; if (c_tipo_fecha.getSelectedItem().toString().compareTo("Seleccione") != 0) { titulo += " " + c_tipo_fecha.getSelectedItem().toString(); if (t_fecha1.getText().compareTo("AAAA-MM-DD") != 0) titulo += " del " + t_fecha1.getText(); if (t_fecha2.getText().compareTo("AAAA-MM-DD") != 0) titulo += " al " + t_fecha2.getText(); } reporte.contenido.showTextAligned(PdfContentByte.ALIGN_LEFT, titulo, 35, 565, 0); reporte.contenido.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Fecha:" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()), 750, 575, 0); reporte.finTexto(); //agregamos renglones vacios para dejar un espacio reporte.agregaObjeto(new Paragraph(" ")); /*reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" ")); reporte.agregaObjeto(new Paragraph(" "));*/ //reporte.agregaObjeto(new Paragraph(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD); BaseColor cabecera = BaseColor.GRAY; BaseColor contenido = BaseColor.WHITE; int centro = Element.ALIGN_CENTER; int izquierda = Element.ALIGN_LEFT; int derecha = Element.ALIGN_RIGHT; for (int a = 0; a < tabla.getNumberOfColumns(); a++) { tabla.addCell( reporte.celda(t_datos.getColumnName(a), font, cabecera, centro, 0, 1, Rectangle.RECTANGLE)); } } catch (Exception e) { System.out.println(e); } if (session != null) if (session.isOpen()) session.close(); } public void titulos() { Color c1 = new java.awt.Color(2, 135, 242); for (int c = 0; c < t_datos.getColumnCount(); c++) t_datos.getColumnModel().getColumn(c).setHeaderRenderer(new Render1(c1)); JTableHeader header = t_datos.getTableHeader(); header.setBackground(new java.awt.Color(90, 66, 126));//102,102,102 header.setForeground(Color.white); //t_datos.setShowVerticalLines(true); t_datos.setShowHorizontalLines(true); } }