@Override
  public ValidationResult validate() {
    ValidationResult result = super.validate();

    if (AccounterValidator.isInPreventPostingBeforeDate(this.transactionDate)) {
      result.addError(transactionDateItem, messages.invalidateDate());
    }

    result.add(payForm.validate());

    if (!AccounterValidator.isPositiveAmount(amountText.getAmount())) {
      amountText.textBox.addStyleName("highlightedFormItem");
      result.addError(amountText, messages.valueCannotBe0orlessthan0(messages.amount()));
    }
    ClientAccount bankAccount = depositInCombo.getSelectedValue();
    // check if the currency of accounts is valid or not
    if (bankAccount != null) {
      ClientCurrency bankCurrency = getCurrency(bankAccount.getCurrency());
      ClientCurrency customerCurrency = getCurrency(customer.getCurrency());
      if (bankCurrency != getBaseCurrency() && bankCurrency != customerCurrency) {
        result.addError(depositInCombo, messages.selectProperBankAccount());
      }
    }
    return result;
  }
  @Override
  protected void customerSelected(ClientCustomer customer) {
    if (customer == null) return;

    // Job Tracking
    if (isTrackJob()) {
      jobListCombo.setValue("");
      jobListCombo.setEnabled(!isInViewMode());
      jobListCombo.setCustomer(customer);
    }
    ClientCurrency clientCurrency = getCurrency(customer.getCurrency());
    amountText.setCurrency(clientCurrency);
    bankBalText.setCurrency(clientCurrency);
    customerBalText.setCurrency(clientCurrency);

    this.setCustomer(customer);
    if (customerCombo != null) {
      customerCombo.setComboItem(customer);
    }
    this.addressListOfCustomer = customer.getAddress();
    initBillToCombo();
    customerBalText.setAmount(customer.getBalance());
    adjustBalance(amountText.getAmount());
    currencyWidget.setSelectedCurrencyFactorInWidget(
        clientCurrency, transactionDateItem.getDate().getDate());
  }
 @Override
 protected void accountSelected(ClientAccount account) {
   if (account == null) return;
   this.depositInAccount = account;
   depositInCombo.setValue(depositInAccount);
   bankBalText.setAmount(depositInAccount.getTotalBalance());
   // if (account != null && !(Boolean) printCheck.getValue()) {
   // setCheckNumber();
   // } else if (account == null)
   // checkNo.setValue("");
   adjustBalance(amountText.getAmount());
 }
 @Override
 public void updateAmountsFromGUI() {
   adjustBalance(amountText.getAmount());
 }
 @Override
 protected void depositInAccountSelected(ClientAccount depositInAccount2) {
   super.depositInAccountSelected(depositInAccount2);
   adjustBalance(amountText.getAmount());
 }