示例#1
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
示例#2
0
  /** Creates new form ProfilesFrm */
  public ProfilesFrm(MainFrm paren) {

    initComponents();
    topFrame = paren;
    setLocationRelativeTo(null);
    setResizable(false);
    setTitle("Profiles");
    profileBoundary = new ProfileBoundary();
    MMBoundary = new MultiValueBoundary();
    resultList = searchAll();
    // Creamos mapa de componentes
    proStatus.addItem(new MultiValue(null, "Seleccionar..."));
    for (MultiValue obj :
        MMBoundary.findByType(new MultiValue(null, null, "GRL", null, null, null))) {
      proStatus.addItem(obj);
    }

    formManager = new FormManager();
    formManager.createComponentMaps(this);
    formManager.setDefaultFormStatus();
    fillTable(resultTable);

    resultTable.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            JTableDoubleClickListener.addDoubleCLick(
                e, profile, resultList, formManager.getFormComponentMap());
            if (e.getClickCount() == 2) {
              formManager.updateButtonMenuState(UIConstants.DOUBLE_CLICK);
            }
          }
        });
    this.setDefaultCloseOperation(this.DISPOSE_ON_CLOSE);
    proId.setVisible(false);
  }