public JournalFilterFrame() {
    try {
      jbInit();

      // set domain in combo box...
      ClientApplet applet =
          ((ApplicationClientFacade) MDIFrame.getInstance().getClientFacade()).getMainClass();
      ButtonCompanyAuthorizations bca = applet.getAuthorizations().getCompanyBa();
      ArrayList companiesList = bca.getCompaniesList("ACC05");
      Domain domain = new Domain("DOMAIN_ACC05");
      for (int i = 0; i < companiesList.size(); i++) {
        if (applet
            .getAuthorizations()
            .getCompanyBa()
            .isInsertEnabled("ACC05", companiesList.get(i).toString()))
          domain.addDomainPair(companiesList.get(i), companiesList.get(i).toString());
      }
      controlCompaniesCombo.setDomain(domain);
      controlCompaniesCombo.getComboBox().setSelectedIndex(0);

      setSize(400, 200);
      MDIFrame.getInstance().add(this);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  void printButton_actionPerformed(ActionEvent e) {
    DetailSaleDocVO vo = (DetailSaleDocVO) headerFormPanel.getVOModel().getValueObject();

    HashMap params = new HashMap();
    params.put("COMPANY_CODE", vo.getCompanyCodeSys01DOC01());
    params.put("DOC_TYPE", vo.getDocTypeDOC01());
    params.put("DOC_YEAR", vo.getDocYearDOC01());
    params.put("DOC_NUMBER", vo.getDocNumberDOC01());

    HashMap map = new HashMap();
    map.put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01DOC01());
    map.put(ApplicationConsts.FUNCTION_CODE_SYS06, headerFormPanel.getFunctionId());
    map.put(ApplicationConsts.EXPORT_PARAMS, params);
    Response res = ClientUtils.getData("getJasperReport", map);
    if (!res.isError()) {
      JasperPrint print = (JasperPrint) ((VOResponse) res).getVo();
      JRViewer viewer = new JRViewer(print);
      JFrame frame = new JFrame();
      frame.setSize(MDIFrame.getInstance().getSize());
      frame.setContentPane(viewer);
      frame.setTitle(this.getTitle());
      frame.setIconImage(MDIFrame.getInstance().getIconImage());
      frame.setVisible(true);
    } else
      JOptionPane.showMessageDialog(
          ClientUtils.getParentFrame(this),
          res.getErrorMessage(),
          ClientSettings.getInstance().getResources().getResource("print document"),
          JOptionPane.ERROR_MESSAGE);
  }
  void printButton_actionPerformed(ActionEvent e) {
    if (controlFromDate.getValue() == null || controlToDate.getValue() == null) {
      JOptionPane.showMessageDialog(
          ClientUtils.getParentFrame(this),
          ClientSettings.getInstance().getResources().getResource("please set a from/to date"),
          ClientSettings.getInstance().getResources().getResource("Attention"),
          JOptionPane.WARNING_MESSAGE);
      return;
    }
    if (controlCompaniesCombo.getValue() == null) {
      JOptionPane.showMessageDialog(
          ClientUtils.getParentFrame(this),
          ClientSettings.getInstance().getResources().getResource("please select a company"),
          ClientSettings.getInstance().getResources().getResource("Attention"),
          JOptionPane.WARNING_MESSAGE);
      return;
    }

    HashMap params = new HashMap();
    params.put("COMPANY_CODE", controlCompaniesCombo.getValue());
    params.put("START_DATE", controlFromDate.getValue());
    params.put("END_DATE", controlToDate.getValue());
    if (controlFromItemNr.getValue() != null)
      params.put(
          "FROM_PROGRESSIVE",
          " and ACC05_JOURNAL_HEADER.PROGRESSIVE>=" + controlFromItemNr.getValue());
    else params.remove("FROM_PROGRESSIVE");

    HashMap map = new HashMap();
    map.put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompaniesCombo.getValue());
    map.put(ApplicationConsts.FUNCTION_CODE_SYS06, "ACC05");
    map.put(ApplicationConsts.EXPORT_PARAMS, params);
    Response res = ClientUtils.getData("getJasperReport", map);
    if (!res.isError()) {
      JasperPrint print = (JasperPrint) ((VOResponse) res).getVo();
      JRViewer viewer = new JRViewer(print);
      JFrame frame = new JFrame();
      frame.setSize(MDIFrame.getInstance().getSize());
      frame.setContentPane(viewer);
      frame.setTitle(this.getTitle());
      frame.setIconImage(MDIFrame.getInstance().getIconImage());
      frame.setVisible(true);
    } else
      JOptionPane.showMessageDialog(
          ClientUtils.getParentFrame(this),
          res.getErrorMessage(),
          ClientSettings.getInstance().getResources().getResource("print journal"),
          JOptionPane.ERROR_MESSAGE);
  }
  @Override
  public void inicializar(
      GridDataLocator gridDataLocator,
      GridController gridController,
      String valueObjectClassName,
      String titulo,
      boolean addToMDIFrame) {
    initComponents();
    gridData.setGridDataLocator(gridDataLocator);
    gridData.setController(gridController);

    //        decimalColumn1.setAdditionalHeaderColumnName("Vehiculo");
    //        decimalColumn1.setAdditionalHeaderColumnSpan(9);
    //
    //        textColumn4.setAdditionalHeaderColumnName("Auditoria");
    //        textColumn4.setAdditionalHeaderColumnSpan(4);

    if (addToMDIFrame) {
      pack();
    } else {
      gridData.setAutoLoadData(false);
      setBounds(0, 0, 0, 0);
    }
    MDIFrame.add(this);
  }
  public AccountsController(String companyCodeSys01ACC01, String ledgerCode) {
    gridFrame = new AccountsGridFrame(this);
    MDIFrame.add(gridFrame);

    if (companyCodeSys01ACC01 != null && ledgerCode != null) {
      gridFrame.getControlCompaniesCombo().setValue(companyCodeSys01ACC01);
      gridFrame.getControlLedgerCode().setValue(ledgerCode);
      gridFrame.getControlLedgerCode().getLookupController().forceValidate();
    }
  }
  public EmpDetailFrameController(EmpGridFrame gridFrame, String pk, Connection conn) {
    this.gridFrame = gridFrame;
    this.pk = pk;
    this.conn = conn;
    frame = new EmpDetailFrame(conn, this);
    MDIFrame.add(frame);

    if (pk != null) {
      frame.getMainPanel().setMode(Consts.READONLY);
      frame.getMainPanel().reload();
    } else {
      frame.getMainPanel().setMode(Consts.INSERT);
    }
  }
  /**
   * Callback method invoked before saving data when the grid was in INSERT mode (on pressing save
   * button).
   *
   * @return <code>true</code> allows the saving to continue, <code>false</code> the saving is
   *     interrupted
   */
  public boolean beforeInsertGrid(GridControl grid) {
    boolean ok = super.beforeInsertGrid(grid);
    if (!ok) return ok;

    if (gridFrame.getControlCompaniesCombo().getValue() == null
        || gridFrame.getControlLedgerCode().getValue() == null
        || gridFrame.getControlLedgerCode().getValue().equals("")) {
      JOptionPane.showMessageDialog(
          MDIFrame.getInstance(),
          ClientSettings.getInstance().getResources().getResource("insert not allowed"),
          ClientSettings.getInstance().getResources().getResource("Attention"),
          JOptionPane.WARNING_MESSAGE);
      return false;
    }
    return true;
  }
  public ProdutoDetalheController(ProdutoGrid produtoGrid, int pk) {
    this.produtoGrid = produtoGrid;
    this.pk = pk;

    produtoDetalhe = new ProdutoDetalhe(this);
    produtoDetalhe.setParentFrame(this.produtoGrid);
    this.produtoGrid.pushFrame(produtoDetalhe);
    MDIFrame.add(produtoDetalhe);

    if (pk != 0) {
      produtoDetalhe.getForm1().setMode(Consts.READONLY);
      produtoDetalhe.getForm1().reload();

    } else {
      produtoDetalhe.getForm1().setMode(Consts.INSERT);
      valoresPadrao();
    }
  }
  @Override
  public void inicializar(FormController formController, boolean addToMDIFrame) {
    initComponents();
    this.getRootPane().setDefaultButton(jButton1);
    DefaultLookupController et = new DefaultLookupController(EtapaSiniestro.class.getName());
    et.addLookup2ParentLink("etapaSiniestro");
    codLookupControl1.setLookupController(et);
    form1.setCreateInnerVO(false);
    form1.setFormController(formController);
    form1.getVOModel().setCreateInnerVO(true);

    if (addToMDIFrame) {
      pack();
    } else {
      setBounds(0, 0, 0, 0);
    }

    MDIFrame.add(this);
  }
 @Override
 public void inicializar(
     GridDataLocator gridDataLocator,
     GridController gridController,
     String valueObjectClassName,
     String titulo,
     boolean addToMDIFrame) {
   initComponents();
   gridData.setGridDataLocator(gridDataLocator);
   gridData.setController(gridController);
   saveButton1.addActionListener((ActionListener) gridController);
   checkBoxControl1.addActionListener((ActionListener) gridController);
   // setTitle(titulo);
   if (addToMDIFrame) {
     pack();
   } else {
     gridData.setAutoLoadData(false);
     setBounds(0, 0, 0, 0);
   }
   MDIFrame.add(this);
 }
 public InDeliveryNotesController() {
   this.frame = new InDeliveryNotesFrame(this);
   MDIFrame.add(frame, true);
 }
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() instanceof InsertButton) {
      // <editor-fold defaultstate="collapsed" desc="Crear nuevo">
      if (beanVO != null) {
        if (((Siniestro) beanVO)
            .getCertificado()
            .getPoliza()
            .getVigenciaHasta()
            .before(new Date())) {
          JOptionPane.showMessageDialog(
              gridControl,
              ClientSettings.getInstance()
                  .getResources()
                  .getResource(
                      "No se Permite Realizar el Siniestro a Este Asegurado\n"
                          + "La Poliza no esta Vigente"),
              General.edition,
              JOptionPane.INFORMATION_MESSAGE);
          return;
        }
        if (!((Siniestro) beanVO).getAsegurado().getAuditoria().getActivo()) {
          JOptionPane.showMessageDialog(
              gridControl,
              ClientSettings.getInstance()
                  .getResources()
                  .getResource(
                      "No se Permite Realizar el Siniestro a Este Asegurado\n"
                          + "El Asegurado no está Activo"),
              General.edition,
              JOptionPane.INFORMATION_MESSAGE);
          return;
        }
        if (!((Siniestro) beanVO).getCertificado().getAuditoria().getActivo()) {
          JOptionPane.showMessageDialog(
              gridControl,
              ClientSettings.getInstance()
                  .getResources()
                  .getResource(
                      "No se Permite Realizar el Siniestro a Este Asegurado\n"
                          + "El Certificado no está Activo"),
              General.edition,
              JOptionPane.INFORMATION_MESSAGE);
          return;
        }
        if (!((Siniestro) beanVO).getCertificado().getPoliza().getAuditoria().getActivo()) {
          JOptionPane.showMessageDialog(
              gridControl,
              ClientSettings.getInstance()
                  .getResources()
                  .getResource(
                      "No se Permite Realizar el Siniestro a Este Asegurado\n"
                          + "El Poliza no está Activo"),
              General.edition,
              JOptionPane.INFORMATION_MESSAGE);
          return;
        }

        if (!((Siniestro) beanVO).getCertificado().getTitular().getAuditoria().getActivo()) {
          JOptionPane.showMessageDialog(
              gridControl,
              ClientSettings.getInstance()
                  .getResources()
                  .getResource(
                      "No se Permite Realizar el Siniestro a Este Asegurado\n"
                          + "El Titular del certificado no está Activo"),
              General.edition,
              JOptionPane.INFORMATION_MESSAGE);
          return;
        }

        Class c = DetalleSiniestroChousser.showDialog();
        if (c != null && c.getClass() != null) {
          if (c.equals(Vida.class)) {
            new DetalleVidaNuevoDetrailController(
                DetalleVidaNuevoDetailFrame.class.getName(),
                ((SiniestroDetailFrame) vista).getGridData(),
                null,
                (Siniestro) beanVO,
                false);
          } else {
            new DetalleSiniestroDetailFrameController(
                DetalleSiniestroDetailFrame.class.getName(),
                ((SiniestroDetailFrame) vista).getGridData(),
                null,
                true,
                (Siniestro) beanVO,
                c);
          }
        }
      }
      // </editor-fold>
    } else if (e.getSource() == ((SiniestroDetailFrame) vista).getEstadoButton()) {
      // <editor-fold defaultstate="collapsed" desc="Cambiar Estado">
      if (vista.getMainPanel().getMode() == Consts.READONLY) {
        Siniestro ss = ((Siniestro) beanVO);
        switch (((Siniestro) beanVO).getEstadoSiniestro()) {
          case ABIERTO:
            int op =
                JOptionPane.showConfirmDialog(
                    MDIFrame.getInstance(),
                    "Si Cierra el siniestro necesitara privilegios de Super usuario para poder abrirlo nuevamente. Desea Cerralo?",
                    "Cerrar Sinietro",
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.INFORMATION_MESSAGE);
            if (op == JOptionPane.YES_OPTION) {
              ss.setEstadoSiniestro(Dominios.EstadoSiniestro.CERRADO);
              ((SiniestroDetailFrame) vista).validarEstadoSiniestro(ss.getEstadoSiniestro());
            }
            break;
          case CERRADO:
            if (SuperusuarioLoginDialog.VerificarSuperusuario()) {
              ss.setEstadoSiniestro(Dominios.EstadoSiniestro.ABIERTO);
              ((SiniestroDetailFrame) vista).validarEstadoSiniestro(ss.getEstadoSiniestro());
            } else {
              return;
            }
            break;
        }

        Session s = null;
        try {
          s = HibernateUtil.getSessionFactory().openSession();
          Transaction t = s.beginTransaction();
          s.update(ss);
          t.commit();
        } catch (Exception ex) {
          ex.printStackTrace();
        } finally {
          s.close();
        }
        ((SiniestroDetailFrame) vista).validarEstado(ss);
      } else {
        JOptionPane.showMessageDialog(vista, "Debes guardar primero el Registro");
      }
      // </editor-fold>
    }
  }
 public VatsController() {
   gridFrame = new VatsGridFrame(this);
   MDIFrame.add(gridFrame);
 }
  private void jbInit() throws Exception {
    controlDofRef.setAttributeName("docRefNumberDOC01");
    titledBorder1 = new TitledBorder("");
    titledBorder2 = new TitledBorder("");
    labelDocNum.setText("docNumber");
    titledBorder1.setTitle(
        ClientSettings.getInstance().getResources().getResource("document identification"));
    titledBorder1.setTitleColor(Color.blue);
    this.setBorder(titledBorder1);
    this.setLayout(gridBagLayout1);
    labelDocYear.setText("docYear");
    labelDocRif.setText("docRif");
    controlDocRifLookup.setCanCopy(true);
    controlDocRifLookup.setAllowOnlyNumbers(true);
    controlDocRifLookup.setLinkLabel(labelDocRif);
    controlDocRifLookup.setMaxCharacters(20);
    controlDocRifLookup.setEnabledOnEdit(false);
    controlDocRifLookup.setAttributeName("docSequenceDoc01DOC01");
    labelDocDate.setText("docDate");
    labelDocState.setText("docState");

    ClientApplet applet =
        ((ApplicationClientFacade) MDIFrame.getInstance().getClientFacade()).getMainClass();
    ApplicationParametersVO appVO = applet.getAuthorizations();
    if (!appVO.getManualDocNumInSaleDocs().booleanValue()) {
      controlDocNumber.setEnabledOnInsert(false);
      controlDocNumber.setEnabledOnEdit(false);
    }

    controlDocNumber.setLinkLabel(labelDocNum);
    controlDocNumber.setMaxCharacters(255);
    controlDocNumber.setRequired(false);
    controlDocNumber.setAttributeName("docSequenceDOC01");
    controlDocYear.setLinkLabel(labelDocYear);
    controlDocYear.setEnabledOnInsert(false);
    controlDocYear.setEnabledOnEdit(false);
    controlDocYear.setAttributeName("docYearDOC01");
    controlDocTypeRef.setCanCopy(true);
    controlDocTypeRef.setAttributeName("docTypeDoc01DOC01");
    controlDocTypeRef.setLinkLabel(labelDocRif);
    controlDocTypeRef.setEnabledOnInsert(true);
    controlDocTypeRef.setEnabledOnEdit(false);
    controlDocTypeRef.setDomainId("SALE_DOC_TYPE");
    controlDocYearRef.setEnabledOnInsert(false);
    controlDocYearRef.setEnabledOnEdit(false);
    controlDocYearRef.setAttributeName("docYearDoc01DOC01");
    controlDocDate.setCanCopy(true);
    controlDocDate.setLinkLabel(labelDocDate);
    controlDocDate.setRequired(true);
    controlDocDate.setEnabledOnEdit(false);
    controlDocDate.setAttributeName("docDateDOC01");
    controlDocState.setCanCopy(false);
    controlDocState.setLinkLabel(labelDocDate);
    controlDocState.setRequired(true);
    controlDocState.setEnabledOnInsert(false);
    controlDocState.setEnabledOnEdit(false);
    controlDocState.setAttributeName("docStateDOC01");
    controlDocState.setDomainId("DOC01_STATES");
    labelDocRefNr.setText("docRef");
    controlSectional.setAttributeName("sectionalDOC01");
    controlSectional.setEnabledOnInsert(false);
    controlSectional.setEnabledOnEdit(false);
    controlSectional.setTextAlignment(SwingConstants.RIGHT);
    this.add(
        labelDocNum,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    this.add(
        controlDocNumber,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 0, 5, 5),
            0,
            0));

    if (showDocRefLookup) {
      this.add(
          labelDocRif,
          new GridBagConstraints(
              0,
              1,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.NONE,
              new Insets(5, 5, 5, 5),
              0,
              0));
      this.add(
          controlDocTypeRef,
          new GridBagConstraints(
              1,
              1,
              2,
              1,
              0.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(5, 0, 5, 5),
              0,
              0));
      this.add(
          controlDocRifLookup,
          new GridBagConstraints(
              3,
              1,
              2,
              1,
              0.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(5, 0, 5, 5),
              0,
              0));
      this.add(
          controlDocYearRef,
          new GridBagConstraints(
              5,
              1,
              3,
              1,
              1.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.NONE,
              new Insets(5, 0, 5, 5),
              40,
              0));
      this.add(
          new JPanel(),
          new GridBagConstraints(
              9,
              0,
              1,
              1,
              1.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(0, 0, 0, 0),
              0,
              0));
    } else {
      this.add(
          labelDocRefNr,
          new GridBagConstraints(
              0,
              1,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.NONE,
              new Insets(5, 5, 5, 5),
              0,
              0));
      this.add(
          controlDofRef,
          new GridBagConstraints(
              1,
              1,
              2,
              1,
              0.0,
              0.0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(5, 0, 5, 5),
              0,
              0));
    }

    this.add(
        controlDocYear,
        new GridBagConstraints(
            4,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 0, 5, 5),
            0,
            0));
    this.add(
        labelDocYear,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    this.add(
        labelDocDate,
        new GridBagConstraints(
            5,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    this.add(
        controlDocDate,
        new GridBagConstraints(
            6,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            60,
            0));
    this.add(
        labelDocState,
        new GridBagConstraints(
            7,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    this.add(
        controlDocState,
        new GridBagConstraints(
            8,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    if (showSectional)
      this.add(
          controlSectional,
          new GridBagConstraints(
              1,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.CENTER,
              GridBagConstraints.NONE,
              new Insets(0, 0, 0, 0),
              0,
              0));
  }
Beispiel #15
0
 /** Method called after MDI creation. */
 public void afterMDIcreation(MDIFrame frame) {
   MDIFrame.addStatusComponent(new Clock());
 }
 public PreVendaController() {
   grid = new PreVendaGrid(this);
   MDIFrame.add(grid);
 }