示例#1
0
  private void jTable1MouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTable1MouseClicked
    int row = jTable1.getSelectedRow();
    int col = jTable1.getSelectedColumn();
    if (col == 6) {
      String selectedSiteName = JOptionPane.showInputDialog(null, "Clave ");
      if (selectedSiteName.equalsIgnoreCase("cajamarca")) {
        try {
          ServiceHb helper = new ServiceHb();
          helper.iniciarTransaccion();
          Ctecobrar p = (Ctecobrar) jTable1.getValueAt(row, col);
          String fecha[] = ("" + jTable1.getValueAt(row, 0)).split("-");
          Calendar ca = Calendar.getInstance();
          ca.set(
              Integer.parseInt(fecha[0]),
              Integer.parseInt(fecha[1]) - 1,
              Integer.parseInt(fecha[2]));

          p.setFecha(new java.sql.Date(ca.getTimeInMillis()));
          p.setFactura("" + jTable1.getValueAt(row, 1));
          p.setPlanpagos("" + jTable1.getValueAt(row, 2));
          p.setObservacion("" + jTable1.getValueAt(row, 3));
          p.setMontos("" + jTable1.getValueAt(row, 4));
          p.setSaldo("" + jTable1.getValueAt(row, 5));
          helper.actualizarObjeto(p);
          helper.confirmarTransaccion();
          helper.cerrarSesion();
          JOptionPane.showMessageDialog(null, "Cuenta Actualizada");
          actualizar();
        } catch (Exception io) {

        }
      }
    }
    if (col == 7) {
      try {
        editarfacturas edi =
            new editarfacturas(
                null, null, true, Integer.parseInt(jTable1.getValueAt(row, 7).toString()));
      } catch (Exception io) {
        System.out.println(io);
      }
    }
    if (col == 8) {
      String selectedSiteName = JOptionPane.showInputDialog(null, "Clave ");
      if (selectedSiteName.equalsIgnoreCase("cajamarca")) {
        try {
          ServiceHb helper = new ServiceHb();
          helper.iniciarTransaccion();
          Ctecobrar p = (Ctecobrar) jTable1.getValueAt(row, col);
          helper.eliminarObjeto(p);
          helper.confirmarTransaccion();
          helper.cerrarSesion();
          JOptionPane.showMessageDialog(null, "Cuenta Eliminada");
          dispose();
        } catch (Exception io) {

        }
      }
    }
  } // GEN-LAST:event_jTable1MouseClicked