Example #1
0
  private void btnNuevoActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnNuevoActionPerformed
    // TODO add your handling code here:
    //        System.out.println("nuevo");
    if (profile.getProCode() == null) {
      GeneralFunctions.sendMessage(this, "Favor de teclear el codigo del Perfil");
      return;
    }
    if (profile.getProName() == null) {
      GeneralFunctions.sendMessage(this, "Favor de teclear el nombre del Perfil");
      return;
    }
    if (proStatus.getSelectedIndex() == 0) {
      GeneralFunctions.sendMessage(this, "Favor de seleccionar un Estatus");
      return;
    }
    profile.setProDteMod(new Date());
    //        profile.setProUsrMod(topFrame.getMainUser().getUsrId());
    profile.setProUsrMod(topFrame.getMainUser());
    if (profileBoundary.insert(profile) == 1) {
      JOptionPane.showMessageDialog(this, UIConstants.SUCCESS_SAVE);
    }

    btnLimpiarActionPerformed(null);
  } // GEN-LAST:event_btnNuevoActionPerformed
Example #2
0
  private void jButton1ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed
    Date date = new Date();
    SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy_hh:mm");
    String fileOut = "./reports/RPT_SERVICIOS_" + df.format(date) + ".pdf";
    try {
      Calendar calEntrada = dateChooserFecEnt.getCurrent();
      Calendar calSalida = dateChooserFecFin.getCurrent();
      if (GeneralFunctions.compareDates(calEntrada, calSalida, false)) {
        SimpleDateFormat dateF = new SimpleDateFormat("dd/MM/yyyy");
        XmlMarshaler marshaler = new XmlMarshaler(UIConstants.REPORTE_SERVICIOS_XML_LINUX);
        AccountBoundary acb = new AccountBoundary();
        MultiValueBoundary mvb = new MultiValueBoundary();
        Account acct = new Account();
        acct.setActStatus(
            mvb.findByKey(new MultiValue(MMKeys.AccountsTransactions.STA_PAGADO_KEY)));
        List<Account> list = acb.findServices(acct, calEntrada.getTime(), calSalida.getTime());
        if (list != null && list.size() > 0) {
          ServicioRep rep = mapEntity(list);
          rep.setHeader(
              new Header(
                  dateF.format(calEntrada.getTime()),
                  dateF.format(calSalida.getTime()),
                  df.format(date)));
          int response = marshaler.parseObject(rep);
          if (response > 0) {
            FOPEngine.convertToPDF(
                UIConstants.REPORTE_SERVICIOS_XSL_LINUX,
                UIConstants.REPORTE_SERVICIOS_XML_LINUX,
                fileOut);
            File myFile = new File(fileOut);
            Desktop.getDesktop().open(myFile);
            GeneralFunctions.sendMessage(this, "Reporte de Servicios generado correctamente.");
          } else {
            GeneralFunctions.sendMessage(this, "No se pudo generar el Reporte de Servicios.");
          }
        }
      } else {
        GeneralFunctions.sendMessage(this, UIConstants.ERROR_INVALID_RANGE_DATES);
      }

    } catch (Exception ex) {
      Logger.getLogger(CancelacionesRp.class.getName()).log(Level.SEVERE, null, ex);
      GeneralFunctions.sendMessage(
          this,
          "Ocurrio un error al generar el reporte.\nContacte con su servicio técnico.\nError: "
              + ex.getMessage());
    }
  } // GEN-LAST:event_jButton1ActionPerformed