@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
 public HashMap<String, Object> saveView() {
   HashMap<String, Object> map = new HashMap<String, Object>();
   map.put("activeInActive", activeInActiveSelect.getSelectedValue());
   map.put("currentView", trasactionViewSelect.getSelectedValue());
   map.put("transactionType", trasactionViewTypeSelect.getSelectedValue());
   map.put("dateRange", dateRangeSelector.getSelectedValue());
   map.put("selectedCustomer", selectedCustomer == null ? "" : selectedCustomer.getName());
   PayeeList selection = custGrid.getSelection();
   map.put("payeeSelection", selection);
   return map;
 }
  private void OncusotmerSelected() {

    this.selectedCustomer = custGrid.getSelectedCustomer();
    if (Accounter.isIpadApp()) {
      rightVpPanel.add(transactionButton);
      transactionButton.setText(messages2.transactionListFor(selectedCustomer.getDisplayName()));
    }
    detailsPanel.showCustomerDetails(selectedCustomer);
    custHistoryGrid.setSelectedCustomer(selectedCustomer);
    MainFinanceWindow.getViewManager().updateButtons();
    showButtonBar();
    callRPC(0, getPageSize());
  }
  @Override
  protected void callRPC(int start, int length) {
    custHistoryGrid.removeAllRecords();
    records = new ArrayList<TransactionHistory>();
    if (selectedCustomer != null) {
      Accounter.createReportService()
          .getCustomerTransactionsList(
              selectedCustomer.getID(),
              getTransactionType(),
              getTransactionStatusType(),
              getStartDate(),
              getEndDate(),
              start,
              length,
              new AsyncCallback<PaginationList<TransactionHistory>>() {

                @Override
                public void onFailure(Throwable caught) {
                  caught.printStackTrace();
                }

                @Override
                public void onSuccess(PaginationList<TransactionHistory> result) {
                  records = result;
                  custHistoryGrid.removeAllRecords();
                  if (records != null) {
                    custHistoryGrid.addRecords(records);
                  }
                  updateRecordsCount(result.getStart(), result.size(), result.getTotalCount());
                  if (records.size() == 0) {
                    custHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions()));
                  }
                }
              });

    } else {
      custHistoryGrid.removeAllRecords();
      custHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions()));
    }
  }
  @Override
  protected void initTransactionViewData() {
    if (transaction == null) {
      setData(new ClientCustomerPrePayment());
      initDepositInAccounts();
    } else {

      if (currencyWidget != null) {
        this.currency = getCompany().getCurrency(transaction.getCurrency());
        this.currencyFactor = transaction.getCurrencyFactor();
        currencyWidget.setSelectedCurrency(this.currency);
        // currencyWidget.currencyChanged(this.currency);
        currencyWidget.setCurrencyFactor(transaction.getCurrencyFactor());
        currencyWidget.setEnabled(!isInViewMode());
      }
      ClientCompany comapny = getCompany();

      ClientCustomer customer = comapny.getCustomer(transaction.getCustomer());
      customerSelected(comapny.getCustomer(transaction.getCustomer()));
      this.billingAddress = transaction.getAddress();
      if (billingAddress != null) billToaddressSelected(billingAddress);
      amountText.setEnabled(!isInViewMode());
      amountText.setAmount(transaction.getTotal());
      if (customer != null) {
        customerBalText.setAmount(customer.getBalance());
      }
      // bankBalText.setAmount(getAmountInTransactionCurrency(transaction.g));
      paymentMethodSelected(transaction.getPaymentMethod());
      this.depositInAccount = comapny.getAccount(transaction.getDepositIn());
      if (depositInAccount != null) {
        depositInCombo.setComboItem(depositInAccount);
        bankBalText.setAmount(depositInAccount.getTotalBalanceInAccountCurrency());
        bankBalText.setCurrency(getCompany().getCurrency(depositInAccount.getCurrency()));
      }
      if (isTrackClass()) {
        classListCombo.setComboItem(
            getCompany().getAccounterClass(transaction.getAccounterClass()));
      }
      paymentMethodCombo.setComboItem(transaction.getPaymentMethod());
      checkNo.setValue(transaction.getCheckNumber());
      // if (transaction.getPaymentMethod().equals(constants.check())) {
      // printCheck.setDisabled(isInViewMode());
      // checkNo.setDisabled(isInViewMode());
      // } else {
      // printCheck.setDisabled(true);
      // checkNo.setDisabled(true);
      // }

      // if (transaction.getCheckNumber() != null) {
      // if (transaction.getCheckNumber().equals(
      // messages.toBePrinted())) {
      // checkNo.setValue(messages.toBePrinted());
      // printCheck.setValue(true);
      // } else {
      // checkNo.setValue(transaction.getCheckNumber());
      // printCheck.setValue(false);
      // }
      // }
    }
    if (locationTrackingEnabled)
      locationSelected(getCompany().getLocation(transaction.getLocation()));
    if (isTrackJob()) {
      if (customer != null) {
        jobListCombo.setCustomer(customer);
      }
      jobSelected(Accounter.getCompany().getjob(transaction.getJob()));
    }
    initMemoAndReference();
    initCustomers();
    if (isMultiCurrencyEnabled()) {
      updateAmountsFromGUI();
    }
  }