Presentacion.InterfacesAdmin.GeneracionInformes.java Source code

Java tutorial

Introduction

Here is the source code for Presentacion.InterfacesAdmin.GeneracionInformes.java

Source

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

import Modelos.Informacion_Fraccion;
import Modelos.Informacion_hotel;
import Modelos.Informe_Lavadero;
import Modelos.Recepcionista;
import Servicios.Administrador;
import Servicios.Conexion;
import Servicios.GeneradorPDF;
import Servicios.ParquaderoFraccion;
import Servicios.ParqueaderoMes;
import Servicios.SLavadero;
import Servicios.S_Hotel;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.pdf.PdfPTable;
import java.awt.Desktop;
import java.io.File;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

/**
 *
 * @author Eduardo
 */
public class GeneracionInformes extends javax.swing.JDialog {

    /**
     * Creates new form GeneracionInformes
     */
    int tipo_informe = -1;
    ImageIcon ii;

    public GeneracionInformes(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.jTextField1.setText(System.getProperty("user.home"));
        this.fechaInforme.setFormats("yyyy-MM-dd");
        this.fechaInforme.getEditor().setEditable(false);
    }

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

        jPanel3 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        fechaInforme = new org.jdesktop.swingx.JXDatePicker();
        jLabel3 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jPanel_Informe = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jPanel_Informe1 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jPanel_Informe2 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Generacin Informes");
        setUndecorated(true);

        jPanel3.setBackground(new java.awt.Color(102, 102, 102));

        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setFont(new java.awt.Font("Century Gothic", 1, 16)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Generar Informe");

        fechaInforme.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N

        jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(255, 255, 255));
        jLabel3.setText("Fecha");

        jTextField1.setBackground(new java.awt.Color(240, 240, 240));
        jTextField1.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jTextField1.setEnabled(false);

        jPanel_Informe.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel_Informe.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jPanel_Informe.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jPanel_InformeMouseClicked(evt);
            }
        });
        jPanel_Informe.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel5.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel5.setText("Examinar");
        jPanel_Informe.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, 30));

        jSeparator2.setBackground(new java.awt.Color(0, 0, 0));
        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jPanel_Informe.add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 10, 40));

        jPanel_Informe1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel_Informe1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jPanel_Informe1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jPanel_Informe1MouseClicked(evt);
            }
        });
        jPanel_Informe1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel6.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("Aceptar");
        jPanel_Informe1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 0, 60, 30));

        jPanel_Informe2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel_Informe2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jPanel_Informe2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jPanel_Informe2MouseClicked(evt);
            }
        });
        jPanel_Informe2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel7.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText("Cancelar");
        jPanel_Informe2.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 0, 60, 30));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(jPanel3Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(jPanel_Informe1, javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(37, 37, 37).addComponent(jPanel_Informe2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(fechaInforme, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jTextField1).addComponent(jLabel3,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 192,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jPanel_Informe, javax.swing.GroupLayout.PREFERRED_SIZE, 79,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                        jPanel3Layout.createSequentialGroup().addComponent(jLabel4,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE)));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(fechaInforme, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(
                                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jPanel_Informe, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
                                                Short.MAX_VALUE)
                                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel_Informe1, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jPanel_Informe2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(30, Short.MAX_VALUE)));

        jPanel_Informe1.getAccessibleContext().setAccessibleDescription("");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE));

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

    private void jPanel_InformeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel_InformeMouseClicked
        // TODO add your handling code here:
        JFileChooser directorio = new JFileChooser();
        directorio.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        directorio.setDialogTitle("Seleccionar directorio...");
        int resultado = directorio.showOpenDialog(jPanel3);
        if (resultado == JFileChooser.APPROVE_OPTION) {
            this.jTextField1.setText(directorio.getSelectedFile().getAbsolutePath());
        } else {
            if (resultado == JFileChooser.ERROR_OPTION) {
                JOptionPane.showMessageDialog(null, "Error al seleccionar directorio");
            }
        }
    }//GEN-LAST:event_jPanel_InformeMouseClicked

    private void jPanel_Informe1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel_Informe1MouseClicked
        // TODO add your handling code here:
        if (!this.fechaInforme.getEditor().getText().equalsIgnoreCase("")) {
            switch (this.tipo_informe) {
            case 1:
                InformeMensual();
                this.hide();
                break;
            case 2:
                InformeFraccion();
                this.hide();
                break;
            case 3:
                InformeLavadero();
                this.hide();
                break;
            case 4:
                InformeHotel();
                this.hide();
                break;
            case 5:
                InformeTotalMensual();
                this.hide();
                break;
            default:
                JOptionPane.showMessageDialog(null, "Informe Incorrecto");
                break;
            }
        } else {
            JOptionPane.showMessageDialog(null, "Debe diligenciar una fecha");
        }
    }//GEN-LAST:event_jPanel_Informe1MouseClicked

    private void jPanel_Informe2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel_Informe2MouseClicked
        // TODO add your handling code here:
        this.hide();
    }//GEN-LAST:event_jPanel_Informe2MouseClicked

    public void InformeMensual() {
        String fecha = this.fechaInforme.getEditor().getText();
        try {
            GeneradorPDF generador = new GeneradorPDF(PageSize.LETTER, 14, 12, 12);
            generador.GenerarPDF(this.jTextField1.getText());
            generador.openDoc();
            generador.addTitulo("INFORME CONTABLE PARQUEADERO MENSUAL");
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("FECHA: " + fecha);
            generador.addParagrafo("\n");
            Administrador objadmin = new Administrador();
            ParqueaderoMes objfraccion = new ParqueaderoMes();
            ArrayList<Recepcionista> listarecep = new ArrayList<Recepcionista>();
            ArrayList<Object> inforecep = new ArrayList<Object>();
            listarecep = objadmin.GetInfoRecepcionista(Conexion.obtener());
            for (int i = 0; i < listarecep.size(); i++) {
                generador.addParagrafo("RECEPCIONISTA: " + listarecep.get(i).getRecepcionista_nombres() + " "
                        + listarecep.get(i).getRecepcionista_apellidos());
                generador.addParagrafo("\n");
                inforecep = objfraccion.CargarInformacionPorRecepcionista(Conexion.obtener(), fecha,
                        listarecep.get(i).getIdRecepcionista());
                if (inforecep.size() > 1) {
                    PdfPTable tabla = new PdfPTable(2);
                    generador.AgregarCeldaTabla("PLACA", tabla);
                    generador.AgregarCeldaTabla("VALOR ABONADO", tabla);
                    for (int j = 1; j < inforecep.size(); j++) {
                        ArrayList<String> datos = new ArrayList();
                        datos = (ArrayList<String>) inforecep.get(j);
                        generador.AgregarCeldaTabla(datos.get(1), tabla);
                        long valor = Long.parseLong(datos.get(3));
                        generador.AgregarCeldaTabla(Long.toString(valor), tabla);
                    }
                    generador.addTable(tabla);
                    generador.addParagrafo("\n");
                } else {
                    generador.addParagrafo("No tiene registros asociados");
                    generador.addParagrafo("\n");
                }
            }
            ArrayList<String> total = objadmin.TotalesDiarios(Conexion.obtener(), fecha);
            generador.addParagrafo("TOTAL: " + total.get(1));
            generador.addParagrafo("\n");
            generador.closeDoc();
            JOptionPane.showMessageDialog(null, "Reporte creado con exito");
            File file = new File(generador.ruta);
            Desktop.getDesktop().open(file);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
        }
    }

    public void InformeFraccion() {
        String fecha = this.fechaInforme.getEditor().getText();
        try {
            GeneradorPDF generador = new GeneradorPDF(PageSize.LETTER, 14, 12, 12);
            generador.GenerarPDF(this.jTextField1.getText());
            generador.openDoc();
            generador.addTitulo("INFORME CONTABLE PARQUEADERO POR FRACCIN");
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("FECHA: " + fecha);
            generador.addParagrafo("\n");
            Administrador objadmin = new Administrador();
            ParquaderoFraccion objfraccion = new ParquaderoFraccion();
            ArrayList<Recepcionista> listarecep = new ArrayList<Recepcionista>();
            ArrayList<Informacion_Fraccion> inforecep = new ArrayList<Informacion_Fraccion>();
            listarecep = objadmin.GetInfoRecepcionista(Conexion.obtener());
            for (int i = 0; i < listarecep.size(); i++) {
                generador.addParagrafo("RECEPCIONISTA: " + listarecep.get(i).getRecepcionista_nombres() + " "
                        + listarecep.get(i).getRecepcionista_apellidos());
                generador.addParagrafo("\n");
                inforecep = objfraccion.LoadInfoPerRecepcionista(Conexion.obtener(), fecha,
                        listarecep.get(i).getIdRecepcionista());
                if (inforecep.size() != 0) {
                    PdfPTable tabla = new PdfPTable(4);
                    generador.AgregarCeldaTabla("PLACA", tabla);
                    generador.AgregarCeldaTabla("FECHA INGRESO", tabla);
                    generador.AgregarCeldaTabla("FECHA SALIDA", tabla);
                    generador.AgregarCeldaTabla("VALOR COBRADO", tabla);
                    for (int j = 0; j < inforecep.size(); j++) {
                        generador.AgregarCeldaTabla(inforecep.get(j).getVehiculo_placa(), tabla);
                        generador.AgregarCeldaTabla(inforecep.get(j).getFecha_entrada(), tabla);
                        generador.AgregarCeldaTabla(inforecep.get(j).getFecha_salida(), tabla);
                        generador.AgregarCeldaTabla(Long.toString((long) inforecep.get(j).getValor_pagar()), tabla);
                    }
                    generador.addTable(tabla);
                    generador.addParagrafo("\n");
                } else {
                    generador.addParagrafo("No tiene registros asociados");
                    generador.addParagrafo("\n");
                }
            }
            ArrayList<String> total = objadmin.TotalesDiarios(Conexion.obtener(), fecha);
            generador.addParagrafo("TOTAL: " + total.get(0));
            generador.addParagrafo("\n");
            generador.closeDoc();
            JOptionPane.showMessageDialog(null, "Reporte creado con exito");
            File file = new File(generador.ruta);
            Desktop.getDesktop().open(file);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
        }
    }

    public void InformeHotel() {
        String fecha = this.fechaInforme.getEditor().getText();
        try {
            GeneradorPDF generador = new GeneradorPDF(PageSize.LETTER, 14, 12, 12);
            generador.GenerarPDF(this.jTextField1.getText());
            generador.openDoc();
            generador.addTitulo("INFORME CONTABLE HOTEL");
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("FECHA: " + fecha);
            generador.addParagrafo("\n");
            Administrador objadmin = new Administrador();
            S_Hotel objHotel = new S_Hotel();
            ArrayList<Recepcionista> listarecep = new ArrayList<Recepcionista>();
            ArrayList<Informacion_hotel> inforecep = new ArrayList<Informacion_hotel>();
            listarecep = objadmin.GetInfoRecepcionista(Conexion.obtener());
            for (int i = 0; i < listarecep.size(); i++) {
                generador.addParagrafo("RECEPCIONISTA: " + listarecep.get(i).getRecepcionista_nombres() + " "
                        + listarecep.get(i).getRecepcionista_apellidos());
                generador.addParagrafo("\n");
                inforecep = objHotel.LoadInfoPerRecepcionista(Conexion.obtener(), fecha,
                        listarecep.get(i).getIdRecepcionista());
                if (inforecep.size() != 0) {
                    PdfPTable tabla = new PdfPTable(2);
                    generador.AgregarCeldaTabla("N HABITACIN", tabla);
                    generador.AgregarCeldaTabla("VALOR TOTAL", tabla);
                    for (int j = 0; j < inforecep.size(); j++) {
                        generador.AgregarCeldaTabla(Integer.toString(inforecep.get(j).getNumHabitacion()), tabla);
                        generador.AgregarCeldaTabla(Long.toString(inforecep.get(j).getTotalPagado()), tabla);
                    }
                    generador.addTable(tabla);
                    generador.addParagrafo("\n");
                } else {
                    generador.addParagrafo("No tiene registros asociados");
                    generador.addParagrafo("\n");
                }
            }
            ArrayList<String> total = objadmin.TotalesDiarios(Conexion.obtener(), fecha);
            generador.addParagrafo("TOTAL: " + total.get(2));
            generador.addParagrafo("\n");
            generador.closeDoc();
            JOptionPane.showMessageDialog(null, "Reporte creado con exito");
            File file = new File(generador.ruta);
            Desktop.getDesktop().open(file);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
        }
    }

    public void InformeLavadero() {
        String fecha = this.fechaInforme.getEditor().getText();
        try {
            GeneradorPDF generador = new GeneradorPDF(PageSize.LETTER, 14, 12, 12);
            generador.GenerarPDF(this.jTextField1.getText());
            generador.openDoc();
            generador.addTitulo("INFORME CONTABLE LAVADERO");
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("FECHA: " + fecha);
            generador.addParagrafo("\n");
            Administrador objadmin = new Administrador();
            SLavadero lavadero = new SLavadero();
            ArrayList<Recepcionista> listarecep = new ArrayList<Recepcionista>();
            ArrayList<Informe_Lavadero> inforecep = new ArrayList<Informe_Lavadero>();
            listarecep = objadmin.GetInfoRecepcionista(Conexion.obtener());
            for (int i = 0; i < listarecep.size(); i++) {
                generador.addParagrafo("RECEPCIONISTA: " + listarecep.get(i).getRecepcionista_nombres() + " "
                        + listarecep.get(i).getRecepcionista_apellidos());
                generador.addParagrafo("\n");
                inforecep = lavadero.LoadInfoPerRecepcionista(Conexion.obtener(), fecha,
                        listarecep.get(i).getIdRecepcionista());
                if (inforecep.size() != 0) {
                    PdfPTable tabla = new PdfPTable(2);
                    generador.AgregarCeldaTabla("LAVADOR", tabla);
                    generador.AgregarCeldaTabla("VALOR TOTAL", tabla);
                    for (int j = 0; j < inforecep.size(); j++) {
                        generador.AgregarCeldaTabla(inforecep.get(j).getLavador_names(), tabla);
                        generador.AgregarCeldaTabla(Long.toString((long) inforecep.get(j).getValor_total()), tabla);
                    }
                    generador.addTable(tabla);
                    generador.addParagrafo("\n");
                } else {
                    generador.addParagrafo("No tiene registros asociados");
                    generador.addParagrafo("\n");
                }
            }
            float total = lavadero.LoadTotalRecep(Conexion.obtener(), fecha);
            generador.addParagrafo("TOTAL: " + total);
            generador.addParagrafo("\n");
            generador.closeDoc();
            JOptionPane.showMessageDialog(null, "Reporte creado con exito");
            File file = new File(generador.ruta);
            Desktop.getDesktop().open(file);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
        }
    }

    public void InformeTotalMensual() {
        String fecha = this.fechaInforme.getEditor().getText();
        try {
            GeneradorPDF generador = new GeneradorPDF(PageSize.LETTER, 14, 12, 12);
            generador.GenerarPDF(this.jTextField1.getText());
            generador.openDoc();
            generador.addTitulo("INFORME TOTAL MENSUAL");
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("MES: " + fecha);
            generador.addParagrafo("\n");
            Administrador objadmin = new Administrador();
            ArrayList<String> datos_mensuales = objadmin.Informe_Total_Mensual(Conexion.obtener(), fecha);
            generador.addParagrafo("SERVICIO: PARQUEADERO");
            generador.addParagrafo("TOTAL: " + Long.parseLong(datos_mensuales.get(0)));
            generador.addParagrafo("\n");
            generador.addParagrafo("SERVICIO: LAVADERO");
            generador.addParagrafo("TOTAL: " + Long.parseLong(datos_mensuales.get(2)));
            generador.addParagrafo("\n");
            generador.addParagrafo("SERVICIO: HOTEL");
            generador.addParagrafo("TOTAL: " + Long.parseLong(datos_mensuales.get(1)));
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("\n");
            generador.addParagrafo("TOTAL MES: " + Long.parseLong(datos_mensuales.get(3)));
            generador.closeDoc();
            JOptionPane.showMessageDialog(null, "Reporte creado con exito");
            File file = new File(generador.ruta);
            Desktop.getDesktop().open(file);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e.getMessage());
        }
    }

    public void setFormatoFecha() {
        this.fechaInforme.setFormats("yyyy-MM");
    }

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

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

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.jdesktop.swingx.JXDatePicker fechaInforme;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel_Informe;
    private javax.swing.JPanel jPanel_Informe1;
    private javax.swing.JPanel jPanel_Informe2;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}