@Override protected String getDisplayValue(Account value) { return value != null ? value.getNumber() + "-" + value.getName() + "-" + CommandUtils.getAccountTypeString(value.getType()) : ""; }
@Override public void setValue(Object value) { ClientQuantity clientQuantity = (ClientQuantity) value; if (clientQuantity != null) { getRequirement(UNIT) .setValue( CommandUtils.getServerObjectById(clientQuantity.getUnit(), AccounterCoreType.UNIT)); getRequirement(VALUE).setValue(clientQuantity.getValue()); } super.setValue(value); }
private void setValues() { List<ClientTransactionItem> items = new ArrayList<ClientTransactionItem>(); List<ClientTransactionItem> accounts = new ArrayList<ClientTransactionItem>(); for (ClientTransactionItem clientTransactionItem : creditCardCharge.getTransactionItems()) { if (clientTransactionItem.getType() == ClientTransactionItem.TYPE_ACCOUNT) { accounts.add(clientTransactionItem); } else { items.add(clientTransactionItem); } } get(ACCOUNTS).setValue(accounts); get(ITEMS).setValue(items); get(VENDOR) .setValue( CommandUtils.getServerObjectById( creditCardCharge.getVendor(), AccounterCoreType.VENDOR)); get(CONTACT).setValue(toServerContact(creditCardCharge.getContact())); get(DATE).setValue(creditCardCharge.getDate()); get(NUMBER).setValue(creditCardCharge.getNumber()); get(PAYMENT_METHOD) .setValue( CommandUtils.getPaymentMethod( creditCardCharge.getPaymentMethodForCommands(), getMessages())); get(PHONE).setValue(creditCardCharge.getPhone()); get(PAY_FROM) .setValue( CommandUtils.getServerObjectById( creditCardCharge.getPayFrom(), AccounterCoreType.ACCOUNT)); get(DELIVERY_DATE).setValue(new ClientFinanceDate(creditCardCharge.getDeliveryDate())); get(IS_VAT_INCLUSIVE).setValue(isAmountIncludeTAX(creditCardCharge)); /* get(CURRENCY_FACTOR).setValue(creditCardCharge.getCurrencyFactor()); */ get(MEMO).setValue(creditCardCharge.getMemo()); if (getPreferences().isTrackDiscounts() && !getPreferences().isDiscountPerDetailLine()) { get(DISCOUNT) .setValue(getDiscountFromTransactionItems(creditCardCharge.getTransactionItems())); } }
@Override protected String initObject(Context context, boolean isUpdate) { if (isUpdate) { String string = context.getString(); if (string.isEmpty()) { addFirstMessage(context, getMessages().selectATransactionToUpdate(getMessages().invoice())); return "employeeList"; } long numberFromString = getNumberFromString(string); employee = (ClientEmployee) CommandUtils.getClientObjectById( numberFromString, AccounterCoreType.EMPLOYEE, getCompanyId()); if (employee == null) { return "employeeList" + string; } setValues(); } else { employee = new ClientEmployee(); } return null; }