diff --git a/img/classroom.jpg b/img/classroom.jpg new file mode 100644 index 0000000..8fe481e Binary files /dev/null and b/img/classroom.jpg differ diff --git a/img/classroom_student.jpg b/img/classroom_student.jpg new file mode 100644 index 0000000..7f7c701 Binary files /dev/null and b/img/classroom_student.jpg differ diff --git a/img/icono.png b/img/icono.png new file mode 100644 index 0000000..9d4aeaf Binary files /dev/null and b/img/icono.png differ diff --git a/img/icons/exit.png b/img/icons/exit.png new file mode 100644 index 0000000..9de2007 Binary files /dev/null and b/img/icons/exit.png differ diff --git a/img/icons/manual_pay.png b/img/icons/manual_pay.png new file mode 100644 index 0000000..4087a70 Binary files /dev/null and b/img/icons/manual_pay.png differ diff --git a/img/icons/new.png b/img/icons/new.png new file mode 100644 index 0000000..6219fd7 Binary files /dev/null and b/img/icons/new.png differ diff --git a/img/icons/see.png b/img/icons/see.png new file mode 100644 index 0000000..0bc878f Binary files /dev/null and b/img/icons/see.png differ diff --git a/img/icons/student.png b/img/icons/student.png new file mode 100644 index 0000000..2f69a8f Binary files /dev/null and b/img/icons/student.png differ diff --git a/img/pagos.jpg b/img/pagos.jpg new file mode 100644 index 0000000..aee26e5 Binary files /dev/null and b/img/pagos.jpg differ diff --git a/img/pagos_manuales.jpg b/img/pagos_manuales.jpg new file mode 100644 index 0000000..34a96a2 Binary files /dev/null and b/img/pagos_manuales.jpg differ diff --git a/img/textura-alumno.jpg b/img/textura-alumno.jpg new file mode 100644 index 0000000..bd1ae35 Binary files /dev/null and b/img/textura-alumno.jpg differ diff --git a/img/textura-principal.jpg b/img/textura-principal.jpg index 52b783c..91ecf9a 100644 Binary files a/img/textura-principal.jpg and b/img/textura-principal.jpg differ diff --git a/img/texture-3443415_640.jpg b/img/texture-3443415_640.jpg new file mode 100644 index 0000000..a612bbe Binary files /dev/null and b/img/texture-3443415_640.jpg differ diff --git a/src/clases/FondoSwing.java b/src/clases/FondoSwing.java index d117725..39ab41d 100644 --- a/src/clases/FondoSwing.java +++ b/src/clases/FondoSwing.java @@ -7,6 +7,7 @@ import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; +import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.Border; @@ -50,4 +51,9 @@ public void setBorder(JFrame frame) { panel.setBorder(this); } + public void setBorder(JDialog frame) { + JPanel panel = (JPanel) frame.getContentPane(); + panel.setBorder(this); + } + } diff --git a/src/clases/MetodosSueltos.java b/src/clases/MetodosSueltos.java index 389a929..5ea3648 100644 --- a/src/clases/MetodosSueltos.java +++ b/src/clases/MetodosSueltos.java @@ -5,10 +5,16 @@ */ package clases; +import es.discoduroderoer.fechas.Dias; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Date; import javax.swing.JComboBox; public class MetodosSueltos { - + public static void rellenarComboAlumno(JComboBox cmbAlumno) { String sql = "Select id, nombre || ' ' || apellidos as nombreC " @@ -22,9 +28,34 @@ public static void rellenarComboAlumno(JComboBox cmbAlumno) { "nombreC"); } - - public static boolean validarTelefono(String texto){ + + public static void enlace(String enlaceAAceder) { + Desktop enlace = Desktop.getDesktop(); + try { + enlace.browse(new URI(enlaceAAceder)); + } catch (IOException | URISyntaxException e) { + } + } + + public static Date inicioMes() { + + Date d = new Date(); + + return new Date(d.getYear(), d.getMonth(), 1); + + } + + public static Date finMes() { + + Date d = new Date(); + + int dias = Dias.numeroDeDiasMes(d.getMonth() + 1); + + return new Date(d.getYear(), d.getMonth(), dias); + } + + public static boolean validarTelefono(String texto) { return texto.matches("[0-9]{9}"); } - + } diff --git a/src/formularios/AcercaDeForm.form b/src/formularios/AcercaDeForm.form new file mode 100644 index 0000000..4f1d37d --- /dev/null +++ b/src/formularios/AcercaDeForm.form @@ -0,0 +1,153 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/formularios/AcercaDeForm.java b/src/formularios/AcercaDeForm.java new file mode 100644 index 0000000..688db94 --- /dev/null +++ b/src/formularios/AcercaDeForm.java @@ -0,0 +1,146 @@ +/* + * 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 formularios; + +import clases.MetodosSueltos; + +/** + * + * @author Fernando + */ +public class AcercaDeForm extends javax.swing.JDialog { + + /** + * Creates new form AcercaDeForm + */ + public AcercaDeForm(java.awt.Frame parent, boolean modal) { + super(parent, modal); + + this.setLocationRelativeTo(null); + initComponents(); + } + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jLabel8 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Acerca de"); + + jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N + jLabel1.setText("

Programa gestor de clases que nos permite gestionar clases particulares

"); + jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + + jLabel2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N + jLabel2.setText("Gandulfo"); + + jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N + jLabel3.setText("Si quieres saber como se hizo, visita este"); + + jLabel4.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N + jLabel4.setText("Bastían Medina"); + + jLabel5.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N + jLabel5.setText("Agradecimientos"); + + jLabel6.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N + jLabel6.setText("Evarist J."); + + jLabel7.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N + jLabel7.setText("Ruben Sanchez"); + + jLabel8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N + jLabel8.setText("link"); + jLabel8.setToolTipText(""); + jLabel8.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + jLabel8MouseClicked(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 86, Short.MAX_VALUE))) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(34, 34, 34) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel6) + .addComponent(jLabel4) + .addComponent(jLabel2) + .addComponent(jLabel7)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(26, 26, 26) + .addComponent(jLabel5) + .addGap(18, 18, 18) + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel6) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel7) + .addContainerGap(50, Short.MAX_VALUE)) + ); + + pack(); + }//
//GEN-END:initComponents + + private void jLabel8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel8MouseClicked + + MetodosSueltos.enlace("https://www.youtube.com/watch?v=Fw2cKmeajeM&list=PLaxZkGlLWHGXCn4mqSxgltF71ouBMZ1Og"); + + + }//GEN-LAST:event_jLabel8MouseClicked + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + 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 jLabel7; + private javax.swing.JLabel jLabel8; + // End of variables declaration//GEN-END:variables +} diff --git a/src/formularios/AlumnoForm.form b/src/formularios/AlumnoForm.form index c2d14d8..eb99c29 100644 --- a/src/formularios/AlumnoForm.form +++ b/src/formularios/AlumnoForm.form @@ -150,6 +150,9 @@ + + + @@ -157,6 +160,9 @@ + + + @@ -164,6 +170,9 @@ + + + @@ -171,6 +180,9 @@ + + + @@ -187,6 +199,9 @@ + + + @@ -236,6 +251,9 @@ + + + @@ -246,11 +264,17 @@ + + + + + + diff --git a/src/formularios/AlumnoForm.java b/src/formularios/AlumnoForm.java index 49830c7..b87ed3f 100644 --- a/src/formularios/AlumnoForm.java +++ b/src/formularios/AlumnoForm.java @@ -5,6 +5,7 @@ */ package formularios; +import clases.FondoSwing; import clases.MetodosSueltos; import clases.VariablesGlobales; import java.sql.ResultSet; @@ -12,6 +13,9 @@ import javax.swing.JOptionPane; import es.discoduroderoer.expresiones_regulares.ExpresionesRegulares; import es.discoduroderoer.swing.MiSwing; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -34,6 +38,14 @@ public AlumnoForm(java.awt.Frame parent, boolean modal) { inicializar(); this.setLocationRelativeTo(null); + FondoSwing f; + try { + f = new FondoSwing("img/textura-alumno.jpg"); + f.setBorder(this); + } catch (IOException ex) { + Logger.getLogger(AlumnoForm.class.getName()).log(Level.SEVERE, null, ex); + } + } //Modificacion de alumno @@ -131,12 +143,16 @@ private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Crear alumno"); + jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Nombre:"); + jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Email:"); + jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Telefono:"); + jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Origen:"); rdbActSi.setSelected(true); @@ -144,6 +160,7 @@ private void initComponents() { rdbActNo.setText("No"); + jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Activado"); btnGuardar.setText("Guardar"); @@ -171,12 +188,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtPrecioBase.setText("8"); + jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("Precio base:"); txtPrecioDomicilio.setText("10"); + jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("Precio domicilio"); + jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("Apellidos:"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); diff --git a/src/formularios/ClasesForm.form b/src/formularios/ClasesForm.form index 0075063..9eca306 100644 --- a/src/formularios/ClasesForm.form +++ b/src/formularios/ClasesForm.form @@ -35,6 +35,9 @@ + + + @@ -202,6 +205,9 @@ + + + @@ -238,6 +244,9 @@ + + + @@ -248,6 +257,9 @@ + + + @@ -265,6 +277,9 @@ + + + @@ -320,6 +335,9 @@ + + + diff --git a/src/formularios/ClasesForm.java b/src/formularios/ClasesForm.java index 63d807f..dca263e 100644 --- a/src/formularios/ClasesForm.java +++ b/src/formularios/ClasesForm.java @@ -5,6 +5,7 @@ */ package formularios; +import clases.FondoSwing; import clases.MetodosSueltos; import clases.VariablesGlobales; import java.sql.SQLException; @@ -14,6 +15,9 @@ import es.discoduroderoer.expresiones_regulares.ExpresionesRegulares; import es.discoduroderoer.fechas.Horas; import es.discoduroderoer.swing.MiSwing; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -40,6 +44,13 @@ public ClasesForm(java.awt.Frame parent, boolean modal) { this.dtpFecha.setDate(new Date()); + try { + FondoSwing f = new FondoSwing("img/classroom.jpg"); + f.setBorder(this); + } catch (IOException ex) { + Logger.getLogger(AlumnoForm.class.getName()).log(Level.SEVERE, null, ex); + } + } private void calcularPrecioFinal() { @@ -96,15 +107,12 @@ private boolean guardar() { codigoAlumno = Integer.parseInt(filaCombobox[0]); } - /* if (!this.dtpFecha.isValid()) { + if (this.dtpFecha.getDate() == null) { errores += "- La fecha no es válida \n"; } else { - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); formatoFechaClase = sdf.format(this.dtpFecha.getDate()); } - */ - SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); - formatoFechaClase = sdf.format(this.dtpFecha.getDate()); if (this.cmbHoraInicio.getSelectedIndex() > this.cmbHoraFin.getSelectedIndex()) { errores += "- Las horas no estan correctas \n"; @@ -213,6 +221,7 @@ private void initComponents() { setResizable(false); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Alumno"); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 50, -1, -1)); @@ -275,6 +284,7 @@ public void keyTyped(java.awt.event.KeyEvent evt) { }); getContentPane().add(txtEspecificarPrecio, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 270, 50, 20)); + jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Hora fin"); getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(266, 143, -1, -1)); @@ -294,13 +304,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); getContentPane().add(btnSalir, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 360, 83, -1)); + jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Fecha"); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 100, -1, -1)); + jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Hora inicio"); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 143, -1, -1)); getContentPane().add(dtpFecha, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 100, 112, -1)); + jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Precio"); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 196, -1, -1)); @@ -332,6 +345,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); getContentPane().add(txtPrecioFinal, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 230, 115, 20)); + jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("Precio final"); getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 190, 110, 20)); diff --git a/src/formularios/PagosForm.form b/src/formularios/PagosForm.form index c9f1b24..e1a1722 100644 --- a/src/formularios/PagosForm.form +++ b/src/formularios/PagosForm.form @@ -4,9 +4,12 @@ + + + @@ -105,7 +108,7 @@ - + @@ -118,7 +121,7 @@ - + @@ -133,12 +136,15 @@ + + + - + @@ -168,7 +174,7 @@ - + @@ -176,9 +182,12 @@ + + + - + @@ -191,18 +200,59 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/formularios/PagosForm.java b/src/formularios/PagosForm.java index 848b066..4dd4eac 100644 --- a/src/formularios/PagosForm.java +++ b/src/formularios/PagosForm.java @@ -5,12 +5,16 @@ */ package formularios; +import clases.FondoSwing; import clases.MetodosSueltos; import clases.RendererPagos; import clases.VariablesGlobales; import es.discoduroderoer.swing.MiSwing; +import java.io.IOException; import java.sql.SQLException; import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.table.DefaultTableModel; /** @@ -25,15 +29,30 @@ public PagosForm(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); - rellenarPagos(""); + this.dtpFI.setDate(MetodosSueltos.inicioMes()); + this.dtpFF.setDate(MetodosSueltos.finMes()); + + filtro(); - this.buttonGroup1.add(this.rdbTodos); + this.buttonGroup1.add(this.rdbTodosPagados); this.buttonGroup1.add(this.rdbPagado); this.buttonGroup1.add(this.rdbNoPagado); + this.buttonGroup2.add(this.rdbOrigenTodos); + this.buttonGroup2.add(this.rdbClassgap); + this.buttonGroup2.add(this.rdbPresencial); + this.buttonGroup2.add(this.rdbOnline); + MetodosSueltos.rellenarComboAlumno(cmbAlumno); this.setLocationRelativeTo(null); + try { + FondoSwing f = new FondoSwing("img/pagos.jpg"); + f.setBorder(this); + } catch (IOException ex) { + Logger.getLogger(AlumnoForm.class.getName()).log(Level.SEVERE, null, ex); + } + } private void rellenarPagos(String sqlAdicional) { @@ -43,12 +62,10 @@ private void rellenarPagos(String sqlAdicional) { + "ifnull(strftime('%d/%m/%Y', c.fecha),'Pendiente de realizar') as 'Fecha clase', " + "a.nombre || ' ' || apellidos as Alumno, " + "c.precio as precio_clase, p.pagado as Pagado " - + "from clases c, pagos p, alumnos a " - + "where c.id_clase = p.id_clase and a.id = c.id_alumno "; - - String sql = sqlBase + sqlAdicional + " order by p.fecha desc, c.fecha desc"; + + "from clases c, pagos p, alumnos a, origen o " + + "where a.origen = o.id and c.id_clase = p.id_clase and a.id = c.id_alumno "; - System.out.println(sql); + String sql = sqlBase + sqlAdicional + " order by p.fecha, c.fecha desc"; modelo = new DefaultTableModel() { @Override @@ -59,7 +76,7 @@ public boolean isCellEditable(int row, int column) { this.tblPagos.setModel(modelo); this.tblPagos.setDefaultRenderer(Object.class, new RendererPagos()); - + try { VariablesGlobales.conexion.ejecutarConsulta(sql); VariablesGlobales.conexion.rellenaJTableBD(modelo); @@ -69,6 +86,87 @@ public boolean isCellEditable(int row, int column) { } } + public void filtro() { + String sqlAdicional = ""; + SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); + String formatoFechaClase; + + boolean noPagadoAct = false, inicioAct = false; + + String parentesisApertura = ""; + String parentesisCierre = ""; + + if (this.dtpFF.getDate() != null && this.dtpFI.getDate() != null) { + parentesisApertura = "("; + parentesisCierre = ")"; + } + + if (this.cmbAlumno.getSelectedIndex() != 0) { + String[] filaCombobox = (String[]) (this.cmbAlumno.getSelectedItem()); + int codigoAlumno = Integer.parseInt(filaCombobox[0]); + sqlAdicional += " and a.id = " + codigoAlumno; + + } else { + if (!this.rdbOrigenTodos.isSelected()) { + + if (this.rdbOnline.isSelected()) { + sqlAdicional += " and o.nombre = 'Online'"; + } else if (this.rdbClassgap.isSelected()) { + sqlAdicional += " and o.nombre = 'Classgap'"; + } else { + sqlAdicional += " and o.nombre = 'Presencial'"; + } + + } + } + + if (!this.rdbTodosPagados.isSelected()) { + + if (this.rdbPagado.isSelected()) { + sqlAdicional += " and precio_clase <= p.pagado"; + } else { + sqlAdicional += " and (precio_clase > p.pagado"; + noPagadoAct = true; + } + + } + + if (this.dtpFI.getDate() != null) { + + formatoFechaClase = sdf.format(this.dtpFI.getDate()); + + if (noPagadoAct) { + sqlAdicional += " or " + parentesisApertura + " p.fecha >= '" + formatoFechaClase + "'"; + } else { + sqlAdicional += " and p.fecha >= '" + formatoFechaClase + "'"; + } + inicioAct = true; + + } + + if (this.dtpFF.getDate() != null) { + formatoFechaClase = sdf.format(this.dtpFF.getDate()); + + if (noPagadoAct) { + if (inicioAct) { + sqlAdicional += " and p.fecha <= '" + formatoFechaClase + "'" + parentesisCierre; + } else { + sqlAdicional += " or p.fecha <= '" + formatoFechaClase + "'" + parentesisCierre; + } + + } else { + sqlAdicional += " and p.fecha <= '" + formatoFechaClase + "'"; + } + + } + + if (noPagadoAct) { + sqlAdicional += ")"; + } + + rellenarPagos(sqlAdicional); + } + /** * 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 @@ -79,6 +177,7 @@ public boolean isCellEditable(int row, int column) { private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); + buttonGroup2 = new javax.swing.ButtonGroup(); jScrollPane1 = new javax.swing.JScrollPane(); tblPagos = new javax.swing.JTable(); dtpFI = new com.toedter.calendar.JDateChooser(); @@ -91,9 +190,14 @@ private void initComponents() { jLabel3 = new javax.swing.JLabel(); rdbNoPagado = new javax.swing.JRadioButton(); rdbPagado = new javax.swing.JRadioButton(); - rdbTodos = new javax.swing.JRadioButton(); + rdbTodosPagados = new javax.swing.JRadioButton(); + rdbPresencial = new javax.swing.JRadioButton(); + rdbClassgap = new javax.swing.JRadioButton(); + rdbOrigenTodos = new javax.swing.JRadioButton(); + rdbOnline = new javax.swing.JRadioButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Pagos"); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); tblPagos.setModel(new javax.swing.table.DefaultTableModel( @@ -119,7 +223,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { btnfiltrarActionPerformed(evt); } }); - getContentPane().add(btnfiltrar, new org.netbeans.lib.awtextra.AbsoluteConstraints(509, 36, 65, -1)); + getContentPane().add(btnfiltrar, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 50, 65, -1)); btnLimpiar.setText("Limpiar"); btnLimpiar.addActionListener(new java.awt.event.ActionListener() { @@ -127,10 +231,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { btnLimpiarActionPerformed(evt); } }); - getContentPane().add(btnLimpiar, new org.netbeans.lib.awtextra.AbsoluteConstraints(509, 70, -1, -1)); + getContentPane().add(btnLimpiar, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 90, -1, -1)); cmbAlumno.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - getContentPane().add(cmbAlumno, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 40, 170, -1)); + cmbAlumno.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + cmbAlumnoItemStateChanged(evt); + } + }); + getContentPane().add(cmbAlumno, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 40, 250, -1)); jLabel1.setText("F. fin"); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 80, -1, -1)); @@ -139,10 +248,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 80, -1, -1)); jLabel3.setText("Alumno"); - getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 20, -1, -1)); + getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 40, -1, -1)); rdbNoPagado.setText("No pagado"); - getContentPane().add(rdbNoPagado, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 80, -1, 30)); + rdbNoPagado.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + rdbNoPagadoActionPerformed(evt); + } + }); + getContentPane().add(rdbNoPagado, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 80, -1, 30)); rdbPagado.setText("Pagado"); rdbPagado.addActionListener(new java.awt.event.ActionListener() { @@ -150,11 +264,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { rdbPagadoActionPerformed(evt); } }); - getContentPane().add(rdbPagado, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 50, 80, 30)); + getContentPane().add(rdbPagado, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 50, 80, 30)); - rdbTodos.setSelected(true); - rdbTodos.setText("Todos"); - getContentPane().add(rdbTodos, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 30, 80, -1)); + rdbTodosPagados.setSelected(true); + rdbTodosPagados.setText("Todos"); + getContentPane().add(rdbTodosPagados, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 30, 80, -1)); + + rdbPresencial.setText("Presencial"); + getContentPane().add(rdbPresencial, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 90, -1, -1)); + + rdbClassgap.setText("Classgap"); + getContentPane().add(rdbClassgap, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 50, -1, -1)); + + rdbOrigenTodos.setSelected(true); + rdbOrigenTodos.setText("Todos"); + getContentPane().add(rdbOrigenTodos, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 30, -1, -1)); + + rdbOnline.setText("Online"); + getContentPane().add(rdbOnline, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 70, -1, -1)); pack(); }// //GEN-END:initComponents @@ -165,72 +292,7 @@ private void rdbPagadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR private void btnfiltrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnfiltrarActionPerformed - String sqlAdicional = ""; - SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); - String formatoFechaClase; - - boolean noPagadoAct = false, inicioAct = false; - - String parentesisApertura = ""; - String parentesisCierre = ""; - - if (this.dtpFF.getDate() != null && this.dtpFI.getDate() != null) { - parentesisApertura = "("; - parentesisCierre = ")"; - } - - if (this.cmbAlumno.getSelectedIndex() != 0) { - String[] filaCombobox = (String[]) (this.cmbAlumno.getSelectedItem()); - int codigoAlumno = Integer.parseInt(filaCombobox[0]); - sqlAdicional += " and a.id = " + codigoAlumno; - - } - - if (!this.rdbTodos.isSelected()) { - - if (this.rdbPagado.isSelected()) { - sqlAdicional += " and precio_clase <= p.pagado"; - } else { - sqlAdicional += " and (precio_clase > p.pagado"; - noPagadoAct = true; - } - - } - - if (this.dtpFI.getDate() != null) { - - formatoFechaClase = sdf.format(this.dtpFI.getDate()); - - if (noPagadoAct) { - sqlAdicional += " or " + parentesisApertura + " p.fecha >= '" + formatoFechaClase + "'"; - } else { - sqlAdicional += " and p.fecha >= '" + formatoFechaClase + "'"; - } - inicioAct=true; - - } - - if (this.dtpFF.getDate() != null) { - formatoFechaClase = sdf.format(this.dtpFF.getDate()); - - if (noPagadoAct) { - if (inicioAct) { - sqlAdicional += " and p.fecha <= '" + formatoFechaClase + "'" + parentesisCierre; - } else { - sqlAdicional += " or p.fecha <= '" + formatoFechaClase + "'" + parentesisCierre; - } - - } else { - sqlAdicional += " and p.fecha <= '" + formatoFechaClase + "'"; - } - - } - - if (noPagadoAct) { - sqlAdicional += ")"; - } - - rellenarPagos(sqlAdicional); + filtro(); }//GEN-LAST:event_btnfiltrarActionPerformed @@ -238,17 +300,37 @@ private void btnfiltrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private void btnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimpiarActionPerformed MiSwing.limpiarFormulario(this.getContentPane().getComponents()); - this.rdbTodos.setSelected(true); + this.rdbTodosPagados.setSelected(true); rellenarPagos(""); }//GEN-LAST:event_btnLimpiarActionPerformed + private void rdbNoPagadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdbNoPagadoActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_rdbNoPagadoActionPerformed + + private void cmbAlumnoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbAlumnoItemStateChanged + + if (this.cmbAlumno.getSelectedIndex() != 0) { + this.rdbOrigenTodos.setEnabled(false); + this.rdbOnline.setEnabled(false); + this.rdbClassgap.setEnabled(false); + this.rdbPresencial.setEnabled(false); + } else { + this.rdbOrigenTodos.setEnabled(true); + this.rdbOnline.setEnabled(true); + this.rdbClassgap.setEnabled(true); + this.rdbPresencial.setEnabled(true); + } + }//GEN-LAST:event_cmbAlumnoItemStateChanged + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnLimpiar; private javax.swing.JButton btnfiltrar; private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.ButtonGroup buttonGroup2; private javax.swing.JComboBox cmbAlumno; private com.toedter.calendar.JDateChooser dtpFF; private com.toedter.calendar.JDateChooser dtpFI; @@ -256,9 +338,13 @@ private void btnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JRadioButton rdbClassgap; private javax.swing.JRadioButton rdbNoPagado; + private javax.swing.JRadioButton rdbOnline; + private javax.swing.JRadioButton rdbOrigenTodos; private javax.swing.JRadioButton rdbPagado; - private javax.swing.JRadioButton rdbTodos; + private javax.swing.JRadioButton rdbPresencial; + private javax.swing.JRadioButton rdbTodosPagados; private javax.swing.JTable tblPagos; // End of variables declaration//GEN-END:variables } diff --git a/src/formularios/PagosManualesForm.form b/src/formularios/PagosManualesForm.form index 5154661..4a181aa 100644 --- a/src/formularios/PagosManualesForm.form +++ b/src/formularios/PagosManualesForm.form @@ -7,6 +7,7 @@ + @@ -92,6 +93,9 @@ + + + @@ -102,6 +106,9 @@ + + + @@ -112,6 +119,9 @@ + + + @@ -177,6 +187,9 @@ + + + diff --git a/src/formularios/PagosManualesForm.java b/src/formularios/PagosManualesForm.java index 803b0ad..53862b8 100644 --- a/src/formularios/PagosManualesForm.java +++ b/src/formularios/PagosManualesForm.java @@ -5,19 +5,20 @@ */ package formularios; +import clases.FondoSwing; import clases.MetodosSueltos; import clases.VariablesGlobales; import es.discoduroderoer.expresiones_regulares.ExpresionesRegulares; import es.discoduroderoer.swing.MiSwing; +import java.io.IOException; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.JOptionPane; -/** - * - * @author Fernando - */ public class PagosManualesForm extends javax.swing.JDialog { /** @@ -34,6 +35,14 @@ public PagosManualesForm(java.awt.Frame parent, boolean modal) { MetodosSueltos.rellenarComboAlumno(cmbAlumno); this.setLocationRelativeTo(parent); + this.dtpFechaPago.setDate(new Date()); + try { + FondoSwing f = new FondoSwing("img/pagos_manuales.jpg"); + f.setBorder(this); + } catch (IOException ex) { + Logger.getLogger(AlumnoForm.class.getName()).log(Level.SEVERE, null, ex); + } + } public boolean actualizarPagos() { @@ -58,17 +67,12 @@ public boolean actualizarPagos() { pago = Double.parseDouble(precioText); } - /*System.out.println(this.dtpFechaPago.isValid()); - System.out.println(this.dtpFechaPago.getDate()); - if (!this.dtpFechaPago.isValid()) { + if (this.dtpFechaPago.getDate() == null) { errores += "- La fecha no es válida \n"; } else { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); formatoFechaClase = sdf.format(this.dtpFechaPago.getDate()); - }*/ - //SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); - formatoFechaClase = sdf.format(this.dtpFechaPago.getDate()); + } if (errores.equals("")) { @@ -198,6 +202,7 @@ private void initComponents() { txtPrecioPresencial = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Pagos manuales"); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); btnGuardar.setText("Guardar"); @@ -231,12 +236,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); getContentPane().add(txtPago, new org.netbeans.lib.awtextra.AbsoluteConstraints(89, 139, 174, -1)); + jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Alumno"); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(28, 30, -1, -1)); + jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Fecha"); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(28, 84, -1, -1)); + jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Pago"); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(28, 142, -1, -1)); @@ -279,6 +287,7 @@ public void keyTyped(java.awt.event.KeyEvent evt) { }); getContentPane().add(txtEspecificarPrecio, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 270, 50, 20)); + jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Precio por clase"); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 190, -1, -1)); @@ -314,9 +323,10 @@ private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI }//GEN-LAST:event_btnGuardarActionPerformed private void btnguardarNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarNuevoActionPerformed - //this.actualizarPagos(); + if (this.actualizarPagos()) { + MiSwing.limpiarFormulario(this.getContentPane().getComponents()); + } - MiSwing.limpiarFormulario(this.getContentPane().getComponents()); }//GEN-LAST:event_btnguardarNuevoActionPerformed diff --git a/src/formularios/Principal.form b/src/formularios/Principal.form index 150cbee..0d0f00c 100644 --- a/src/formularios/Principal.form +++ b/src/formularios/Principal.form @@ -14,6 +14,8 @@ + + @@ -77,6 +79,21 @@ + + + + + + + + + + + + + + + @@ -199,6 +216,7 @@ + @@ -206,21 +224,21 @@ - + - + - + @@ -246,17 +264,20 @@ - + + + + - + @@ -269,7 +290,7 @@ - + @@ -287,6 +308,9 @@ + + + @@ -299,7 +323,7 @@ - + @@ -309,18 +333,18 @@ - + - + - + @@ -372,5 +396,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/formularios/Principal.java b/src/formularios/Principal.java index 130c2e7..9946e65 100644 --- a/src/formularios/Principal.java +++ b/src/formularios/Principal.java @@ -12,11 +12,13 @@ import es.discoduroderoer.swing.LAF; import es.discoduroderoer.swing.MiSwing; import java.io.IOException; +import java.net.ServerSocket; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; @@ -24,23 +26,45 @@ public class Principal extends javax.swing.JFrame { private DefaultTableModel modelo; - public Principal() { + public Principal() throws IOException { + + ServerSocket s = new ServerSocket(6200); + try { LAF.disenoGUI(); initComponents(); - rellenarClases(""); + + this.dtpFI.setDate(MetodosSueltos.inicioMes()); + this.dtpFF.setDate(MetodosSueltos.finMes()); + + filtro(); + this.setLocationRelativeTo(null); FondoSwing f; + jMenuItem7.setIcon((new ImageIcon("img/icons/exit.png"))); + jMenuItem8.setIcon((new ImageIcon("img/icons/see.png"))); + jMenuItem2.setIcon((new ImageIcon("img/icons/manual_pay.png"))); + jMenuItem5.setIcon((new ImageIcon("img/icons/new.png"))); + mitAluCrear.setIcon((new ImageIcon("img/icons/new.png"))); + jMenuItem9.setIcon((new ImageIcon("img/icons/see.png"))); + f = new FondoSwing("img/textura-principal.jpg"); f.setBorder(this); + MiSwing.iconoJFrame(this, "img/icono.png"); + MetodosSueltos.rellenarComboAlumno(cmbAlumno); this.cuentaActivos(); - this.buttonGroup1.add(this.rdbTodas); + this.buttonGroup1.add(this.rdbEstadoTodas); this.buttonGroup1.add(this.rdbPendientes); this.buttonGroup1.add(this.rdbRealizadas); + this.buttonGroup2.add(this.rdbOrigenTodos); + this.buttonGroup2.add(this.rdbPresencial); + this.buttonGroup2.add(this.rdbClassgap); + this.buttonGroup2.add(this.rdbOnline); + } catch (IOException ex) { Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } @@ -65,18 +89,18 @@ private void cuentaActivos() { private void rellenarClases(String sqlAdicional) { - String sqlBase = "select id_clase, nombre || ' ' || apellidos as Alumno, " + String sqlBase = "select id_clase, a.nombre || ' ' || apellidos as Alumno, " + " ifnull(strftime('%d/%m/%Y', fecha), 'Pendiente de realizar') as 'Fecha clase', " + "hora_inicio as 'H. inicio', " + "hora_fin as 'H. fin', Precio " - + "from clases c, alumnos a " - + "where c.id_alumno = a.id"; + + "from clases c, alumnos a, origen o " + + "where a.origen = o.id and c.id_alumno = a.id "; - String sql = sqlBase + sqlAdicional + " order by fecha, hora_inicio,hora_fin "; + String sql = sqlBase + sqlAdicional + " order by fecha desc, hora_inicio,hora_fin "; String sqlGanado = "select sum(p.pagado) " - + " from clases c, pagos p, alumnos a " - + " where c.id_clase = p.id_clase and a.id = c.id_alumno "; + + " from clases c, pagos p, alumnos a , origen o " + + " where a.origen = o.id and c.id_clase = p.id_clase and a.id = c.id_alumno "; sqlGanado = sqlGanado + sqlAdicional; @@ -125,9 +149,23 @@ private void filtro() { int codigoAlumno = Integer.parseInt(filaCombobox[0]); sqlAdicional += " and a.id = " + codigoAlumno; + } else { + + if (!this.rdbOrigenTodos.isSelected()) { + + if (this.rdbOnline.isSelected()) { + sqlAdicional += " and o.nombre = 'Online'"; + } else if (this.rdbClassgap.isSelected()) { + sqlAdicional += " and o.nombre = 'Classgap'"; + } else { + sqlAdicional += " and o.nombre = 'Presencial'"; + } + + } + } - if (!this.rdbTodas.isSelected()) { + if (!this.rdbEstadoTodas.isSelected()) { if (this.rdbRealizadas.isSelected()) { sqlAdicional += " and c.fecha is not null"; @@ -196,6 +234,7 @@ private void initComponents() { jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem6 = new javax.swing.JMenuItem(); buttonGroup1 = new javax.swing.ButtonGroup(); + buttonGroup2 = new javax.swing.ButtonGroup(); jScrollPane1 = new javax.swing.JScrollPane(); tblClases = new javax.swing.JTable(); cmbAlumno = new javax.swing.JComboBox<>(); @@ -209,11 +248,17 @@ private void initComponents() { btnLimpiar = new javax.swing.JButton(); rdbPendientes = new javax.swing.JRadioButton(); rdbRealizadas = new javax.swing.JRadioButton(); - rdbTodas = new javax.swing.JRadioButton(); + rdbEstadoTodas = new javax.swing.JRadioButton(); txtGanado = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); txtActivos = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); + rdbPresencial = new javax.swing.JRadioButton(); + rdbClassgap = new javax.swing.JRadioButton(); + rdbOrigenTodos = new javax.swing.JRadioButton(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + rdbOnline = new javax.swing.JRadioButton(); jMenuBar1 = new javax.swing.JMenuBar(); menuAlu = new javax.swing.JMenu(); mitAluCrear = new javax.swing.JMenuItem(); @@ -223,6 +268,8 @@ private void initComponents() { jMenu3 = new javax.swing.JMenu(); jMenuItem8 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); + jMenu1 = new javax.swing.JMenu(); + jMenuItem3 = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); jMenuItem7 = new javax.swing.JMenuItem(); @@ -259,14 +306,19 @@ public void windowClosing(java.awt.event.WindowEvent evt) { getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, 633, 274)); cmbAlumno.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + cmbAlumno.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + cmbAlumnoItemStateChanged(evt); + } + }); cmbAlumno.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmbAlumnoActionPerformed(evt); } }); - getContentPane().add(cmbAlumno, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 50, 220, -1)); - getContentPane().add(dtpFI, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 100, -1, -1)); - getContentPane().add(dtpFF, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 100, -1, 20)); + getContentPane().add(cmbAlumno, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 50, 220, -1)); + getContentPane().add(dtpFI, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 100, -1, -1)); + getContentPane().add(dtpFF, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 100, -1, 20)); btnFiltrare.setText("Filtrar"); btnFiltrare.addActionListener(new java.awt.event.ActionListener() { @@ -278,30 +330,36 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Inicio"); - getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 100, -1, -1)); + getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 100, -1, -1)); + jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Fin"); - getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 100, -1, -1)); + getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 100, -1, -1)); jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Alumno"); - getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 60, -1, -1)); + getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 50, -1, -1)); jButton2.setText("Dar por pagada"); getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 110, 110, -1)); btnLimpiar.setText("Limpiar"); + btnLimpiar.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnLimpiarActionPerformed(evt); + } + }); getContentPane().add(btnLimpiar, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 80, 110, -1)); rdbPendientes.setText("Pendientes"); - getContentPane().add(rdbPendientes, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 100, -1, -1)); + getContentPane().add(rdbPendientes, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 110, -1, -1)); rdbRealizadas.setText("Realizadas"); - getContentPane().add(rdbRealizadas, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 70, -1, -1)); + getContentPane().add(rdbRealizadas, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 80, -1, -1)); - rdbTodas.setSelected(true); - rdbTodas.setText("Todas"); - getContentPane().add(rdbTodas, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 40, -1, -1)); + rdbEstadoTodas.setSelected(true); + rdbEstadoTodas.setText("Todas"); + getContentPane().add(rdbEstadoTodas, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 50, -1, -1)); txtGanado.setEditable(false); txtGanado.setHorizontalAlignment(javax.swing.JTextField.RIGHT); @@ -319,6 +377,27 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel5.setText("Alumnos activos"); getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 430, 90, 30)); + rdbPresencial.setText("Presencial"); + getContentPane().add(rdbPresencial, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 110, -1, -1)); + + rdbClassgap.setText("Classgap"); + getContentPane().add(rdbClassgap, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 70, -1, -1)); + + rdbOrigenTodos.setSelected(true); + rdbOrigenTodos.setText("Todos"); + getContentPane().add(rdbOrigenTodos, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 50, -1, -1)); + + jLabel6.setForeground(new java.awt.Color(255, 255, 255)); + jLabel6.setText("Estado"); + getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 30, -1, -1)); + + jLabel7.setForeground(new java.awt.Color(255, 255, 255)); + jLabel7.setText("Origen"); + getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 30, -1, -1)); + + rdbOnline.setText("Online"); + getContentPane().add(rdbOnline, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 90, -1, -1)); + menuAlu.setText("Alumno"); mitAluCrear.setText("Crear..."); @@ -371,6 +450,18 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuBar1.add(jMenu3); + jMenu1.setText("Ayuda"); + + jMenuItem3.setText("Acerca de"); + jMenuItem3.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jMenuItem3ActionPerformed(evt); + } + }); + jMenu1.add(jMenuItem3); + + jMenuBar1.add(jMenu1); + jMenu4.setText("Salir"); jMenuItem7.setText("Salir del sistema"); @@ -454,6 +545,38 @@ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:even }//GEN-LAST:event_formWindowClosing + private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed + AcercaDeForm ventana = new AcercaDeForm(this, true); + ventana.setVisible(true); + }//GEN-LAST:event_jMenuItem3ActionPerformed + + private void btnLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimpiarActionPerformed + + MiSwing.limpiarFormulario(this.getContentPane().getComponents()); + + this.dtpFI.setDate(MetodosSueltos.inicioMes()); + this.dtpFF.setDate(MetodosSueltos.finMes()); + + filtro(); + + }//GEN-LAST:event_btnLimpiarActionPerformed + + private void cmbAlumnoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbAlumnoItemStateChanged + + if(this.cmbAlumno.getSelectedIndex() != 0){ + this.rdbOrigenTodos.setEnabled(false); + this.rdbOnline.setEnabled(false); + this.rdbClassgap.setEnabled(false); + this.rdbPresencial.setEnabled(false); + }else{ + this.rdbOrigenTodos.setEnabled(true); + this.rdbOnline.setEnabled(true); + this.rdbClassgap.setEnabled(true); + this.rdbPresencial.setEnabled(true); + } + + }//GEN-LAST:event_cmbAlumnoItemStateChanged + /** * @param args the command line arguments */ @@ -484,7 +607,10 @@ public static void main(String args[]) { /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { - new Principal().setVisible(true); + try { + new Principal().setVisible(true); + } catch (IOException ex) { + } } }); } @@ -493,6 +619,7 @@ public void run() { private javax.swing.JButton btnFiltrare; private javax.swing.JButton btnLimpiar; private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.ButtonGroup buttonGroup2; private javax.swing.JComboBox cmbAlumno; private com.toedter.calendar.JDateChooser dtpFF; private com.toedter.calendar.JDateChooser dtpFI; @@ -502,12 +629,16 @@ public void run() { 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.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenu jMenu4; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; + private javax.swing.JMenuItem jMenuItem3; private javax.swing.JMenuItem jMenuItem5; private javax.swing.JMenuItem jMenuItem6; private javax.swing.JMenuItem jMenuItem7; @@ -516,9 +647,13 @@ public void run() { private javax.swing.JScrollPane jScrollPane1; private javax.swing.JMenu menuAlu; private javax.swing.JMenuItem mitAluCrear; + private javax.swing.JRadioButton rdbClassgap; + private javax.swing.JRadioButton rdbEstadoTodas; + private javax.swing.JRadioButton rdbOnline; + private javax.swing.JRadioButton rdbOrigenTodos; private javax.swing.JRadioButton rdbPendientes; + private javax.swing.JRadioButton rdbPresencial; private javax.swing.JRadioButton rdbRealizadas; - private javax.swing.JRadioButton rdbTodas; private javax.swing.JTable tblClases; private javax.swing.JTextField txtActivos; private javax.swing.JTextField txtGanado; diff --git a/src/formularios/VerAlumnosForm.java b/src/formularios/VerAlumnosForm.java index 72ce6f0..6cd815e 100644 --- a/src/formularios/VerAlumnosForm.java +++ b/src/formularios/VerAlumnosForm.java @@ -5,11 +5,15 @@ */ package formularios; +import clases.FondoSwing; import clases.VariablesGlobales; import java.sql.SQLException; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import es.discoduroderoer.swing.MiSwing; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -38,6 +42,14 @@ public VerAlumnosForm(java.awt.Frame parent, boolean modal) { rellenarAlumnos(); this.setLocationRelativeTo(parent); + + try { + FondoSwing f = new FondoSwing("img/classroom_student.jpg"); + f.setBorder(this); + } catch (IOException ex) { + Logger.getLogger(AlumnoForm.class.getName()).log(Level.SEVERE, null, ex); + } + }