@Override
  public void setRegistry(erp.lib.data.SDataRegistry registry) {
    moExchangeRate = (SDataExchangeRate) registry;

    moFieldPkCurrencyId.setFieldValue(new int[] {moExchangeRate.getPkCurrencyId()});
    moFieldPkDateId.setFieldValue(moExchangeRate.getPkDateId());
    moFieldExchangeRate.setFieldValue(moExchangeRate.getExchangeRate());
    moFieldIsDeleted.setFieldValue(moExchangeRate.getIsDeleted());

    jcbPkCurrencyId.setEnabled(false);
    jbPkCurrencyId.setEnabled(false);

    jftPkDateId.setEnabled(false);
    jbPkDateId.setEnabled(false);
    jckIsDeleted.setEnabled(true);
  }
  public void focusLostYear() {
    int[] date = null;

    if (jckShowPayDays.isSelected()) {
      date = SLibTimeUtils.digestDate(miClient.getSession().getCurrentDate());
      moFieldDateRef.setFieldValue(
          SLibTimeUtils.createDate(moFieldYear.getInteger(), date[1], date[2]));
    }
  }
  public void initForm() {
    mbFirstTime = true;

    moFieldYear.setFieldValue(miClient.getSessionXXX().getWorkingYear());
    jckShowPayDays.setSelected(false);
    itemStateChangedShowPayDays(); // resets reference date

    if (mnBizPartnerId == SLibConsts.UNDEFINED) {
      moFieldBizPartner.resetField();
    } else {
      SFormUtilities.locateComboBoxItem(jcbBizPartner, new int[] {mnBizPartnerId});
    }
  }
  private void itemStateChangedShowPayDays() {
    int[] date = null;

    if (jckShowPayDays.isSelected()) {
      jftDateRef.setEnabled(true);
      jbPickDateRef.setEnabled(true);

      date = SLibTimeUtils.digestDate(miClient.getSession().getCurrentDate());
      moFieldDateRef.setFieldValue(
          SLibTimeUtils.createDate(moFieldYear.getInteger(), date[1], date[2]));
    } else {
      jftDateRef.setEnabled(false);
      jbPickDateRef.setEnabled(false);

      moFieldDateRef.resetField();
    }
  }
  @Override
  public void formReset() {
    mnFormResult = SLibConstants.UNDEFINED;
    mnFormStatus = SLibConstants.UNDEFINED;
    mbFirstTime = true;

    moExchangeRate = null;

    for (int i = 0; i < mvFields.size(); i++) {
      mvFields.get(i).resetField();
    }

    moFieldPkDateId.setFieldValue(miClient.getSessionXXX().getWorkingDate());

    jcbPkCurrencyId.setEnabled(true);
    jbPkCurrencyId.setEnabled(true);
    jftPkDateId.setEnabled(true);
    jbPkDateId.setEnabled(true);

    jckIsDeleted.setEnabled(false);
  }
 public void focusLostDate() {
   moFieldYear.setFieldValue(SLibTimeUtilities.digestYear(moFieldDateRef.getDate())[0]);
 }