Ejemplo n.º 1
0
  @Override
  public erp.lib.form.SFormValidation formValidate() {
    SFormValidation validation = new SFormValidation();

    for (int i = 0; i < mvFields.size(); i++) {
      if (!((erp.lib.form.SFormField) mvFields.get(i)).validateField()) {
        validation.setIsError(true);
        validation.setComponent(mvFields.get(i).getComponent());
        break;
      }
    }

    if (moExchangeRate == null && !validation.getIsError()) {
      if (moFieldPkCurrencyId.getKeyAsIntArray()[0]
          == miClient.getSessionXXX().getParamsErp().getFkCurrencyId()) {
        validation.setMessage(
            "La moneda del tipo de cambio no puede ser la moneda local del sistema.");
        validation.setComponent(jcbPkCurrencyId);
      } else {
        if (SDataUtilities.callProcedureVal(
                miClient,
                SProcConstants.FIN_EXC_RATE_VAL,
                new Object[] {moFieldPkCurrencyId.getKeyAsIntArray()[0], moFieldPkDateId.getDate()},
                SLibConstants.EXEC_MODE_VERBOSE)
            > 0) {
          validation.setMessage("Ya existe un registro para la moneda y fecha especificadas.");
          validation.setComponent(jftPkDateId);
        }
      }
    }

    return validation;
  }
Ejemplo n.º 2
0
  @Override
  public erp.lib.data.SDataRegistry getRegistry() {
    if (moExchangeRate == null) {
      moExchangeRate = new SDataExchangeRate();
      moExchangeRate.setPkCurrencyId(moFieldPkCurrencyId.getKeyAsIntArray()[0]);
      moExchangeRate.setPkDateId(moFieldPkDateId.getDate());
      moExchangeRate.setFkUserNewId(miClient.getSession().getUser().getPkUserId());
    } else {
      moExchangeRate.setFkUserEditId(miClient.getSession().getUser().getPkUserId());
    }

    moExchangeRate.setExchangeRate(moFieldExchangeRate.getDouble());
    moExchangeRate.setIsDeleted(moFieldIsDeleted.getBoolean());

    return moExchangeRate;
  }
  private void print() {
    int year = moFieldYear.getInteger();
    Cursor cursor = getCursor();
    Map<String, Object> map = null;
    JasperPrint jasperPrint = null;
    JasperViewer jasperViewer = null;
    SDataBizPartner bizPartner = null;
    SDataBizPartnerCategory bizPartnerCategory = null;

    try {
      setCursor(new Cursor(Cursor.WAIT_CURSOR));

      bizPartner =
          (SDataBizPartner)
              SDataUtilities.readRegistry(
                  miClient,
                  SDataConstants.BPSU_BP,
                  moFieldBizPartner.getKeyAsIntArray(),
                  SLibConstants.EXEC_MODE_VERBOSE);

      map = miClient.createReportParams();
      map.put("nSysMoveCatId", manSysMoveTypeKey[0]);
      map.put("nSysMoveTypeId", manSysMoveTypeKey[1]);
      map.put("sBizPartnerCat", msBizPartnerCatSng.toUpperCase());
      map.put("sBizPartnerCatPlural", msBizPartnerCatPlr.toUpperCase());
      map.put(
          "nLocalCurrencyId",
          miClient.getSessionXXX().getParamsErp().getDbmsDataCurrency().getPkCurrencyId());
      map.put(
          "sLocalCurrency",
          miClient.getSessionXXX().getParamsErp().getDbmsDataCurrency().getCurrency());
      map.put("nYear", year);
      map.put(
          "tDate",
          jckShowPayDays.isSelected()
              ? moFieldDateRef.getDate()
              : SLibTimeUtilities.createDate(year, 12, 31));
      map.put("nBizPartnerId", bizPartner.getPkBizPartnerId());
      map.put("sBizPartner", bizPartner.getBizPartner());

      switch (mnBizPartnerCategoryId) {
        case SDataConstantsSys.BPSS_CT_BP_SUP:
          bizPartnerCategory = bizPartner.getDbmsCategorySettingsSup();
          break;
        case SDataConstantsSys.BPSS_CT_BP_CUS:
          bizPartnerCategory = bizPartner.getDbmsCategorySettingsCus();
          break;
        default:
      }

      map.put("dCreditLimit", bizPartnerCategory.getEffectiveCreditLimit());
      map.put("nDaysCredit", bizPartnerCategory.getEffectiveDaysOfCredit());
      map.put("nDaysGrace", bizPartnerCategory.getEffectiveDaysOfGrace());
      map.put(
          "sCreditType",
          SDataReadDescriptions.getCatalogueDescription(
              miClient,
              SDataConstants.BPSS_TP_CRED,
              new int[] {bizPartnerCategory.getEffectiveCreditTypeId()}));

      jasperPrint =
          SDataUtilities.fillReport(
              miClient,
              jckShowPayDays.isSelected()
                  ? SDataConstantsSys.REP_FIN_BPS_ACC_MOV_DAY
                  : SDataConstantsSys.REP_FIN_BPS_ACC_MOV,
              map);
      jasperViewer = new JasperViewer(jasperPrint, false);
      jasperViewer.setTitle(getTitle());
      jasperViewer.setVisible(true);
    } catch (Exception e) {
      SLibUtilities.renderException(this, e);
    } finally {
      setCursor(cursor);
    }
  }