@Override
 protected void initMemoAndReference() {
   ClientCustomerPrePayment customerPrePayment = transaction;
   if (customerPrePayment != null) {
     memoTextAreaItem.setDisabled(isInViewMode());
     setMemoTextAreaItem(customerPrePayment.getMemo());
     // setRefText(customerPrePayment.getReference());
   }
 }
  private void adjustBalance(double amount) {
    ClientCustomerPrePayment customerPrePayment = transaction;
    enteredBalance = amount;

    if (DecimalUtil.isLessThan(enteredBalance, 0)
        || DecimalUtil.isGreaterThan(enteredBalance, 1000000000000.00)) {
      amountText.setAmount(0D);
      enteredBalance = 0D;
    }
    if (getCustomer() != null) {
      if (isInViewMode()
          && getCustomer().getID() == (customerPrePayment.getCustomer())
          && !DecimalUtil.isEquals(enteredBalance, 0)) {
        double cusBal =
            DecimalUtil.isLessThan(getCustomer().getBalance(), 0)
                ? -1 * getCustomer().getBalance()
                : getCustomer().getBalance();
        toBeSetCustomerBalance = (cusBal - transaction.getTotal()) + enteredBalance;
      } else {
        toBeSetCustomerBalance = getCustomer().getBalance() - enteredBalance;
      }
      // customerBalText.setAmount(toBeSetCustomerBalance);

    }
    if (depositInAccount != null) {
      double balanceToBeUpdate;
      if (depositInAccount.getCurrency() == getPreferences().getPrimaryCurrency().getID()) {
        balanceToBeUpdate = enteredBalance;
      } else {
        balanceToBeUpdate = enteredBalance;
      }

      if (depositInAccount.isIncrease()) {
        toBeSetEndingBalance =
            depositInAccount.getTotalBalanceInAccountCurrency() - balanceToBeUpdate;
      } else {
        toBeSetEndingBalance =
            depositInAccount.getTotalBalanceInAccountCurrency() + balanceToBeUpdate;
      }
      if (isInViewMode()
          && depositInAccount.getID() == (customerPrePayment.getDepositIn())
          && !DecimalUtil.isEquals(balanceToBeUpdate, 0)) {
        toBeSetEndingBalance = toBeSetEndingBalance - transaction.getTotal();
      }
      // endBalText.setAmount(toBeSetEndingBalance);

    }
  }