コード例 #1
0
  @Override
  protected String initObject(Context context, boolean isUpdate) {

    String string = context.getString();
    if (isUpdate) {
      if (string.isEmpty()) {
        addFirstMessage(
            context, getMessages().selectATransactionToUpdate(getMessages().creditCardCharge()));
        return "expensesList";
      }
      creditCardCharge = getTransaction(string, AccounterCoreType.CREDITCARDCHARGE, context);

      if (creditCardCharge == null) {
        addFirstMessage(
            context, getMessages().selectATransactionToUpdate(getMessages().creditCardCharge()));
        return "expensesList " + string;
      }
      setValues();
    } else {
      if (!string.isEmpty()) {
        get(NUMBER).setValue(string);
      }
      creditCardCharge = new ClientCreditCardCharge();
    }
    setTransaction(creditCardCharge);
    return null;
  }
コード例 #2
0
  @Override
  protected Result onCompleteProcess(Context context) {
    List<ClientTransactionItem> items = get(ITEMS).getValue();

    List<ClientTransactionItem> accounts = get(ACCOUNTS).getValue();
    if (items.isEmpty() && accounts.isEmpty()) {
      return new Result();
    }
    Vendor supplier = get(VENDOR).getValue();
    creditCardCharge.setVendor(supplier.getID());

    Contact contact = get(CONTACT).getValue();
    creditCardCharge.setContact(toClientContact(contact));

    ClientFinanceDate date = get(DATE).getValue();
    creditCardCharge.setDate(date.getDate());

    creditCardCharge.setType(ClientTransaction.TYPE_CREDIT_CARD_CHARGE);

    String number = get(NUMBER).getValue();
    creditCardCharge.setNumber(number);

    String paymentMethod = get(PAYMENT_METHOD).getValue();
    creditCardCharge.setPaymentMethod(paymentMethod);

    String phone = get(PHONE).getValue();
    creditCardCharge.setPhone(phone);

    Account account = get(PAY_FROM).getValue();
    creditCardCharge.setPayFrom(account.getID());

    ClientFinanceDate deliveryDate = get(DELIVERY_DATE).getValue();
    creditCardCharge.setDeliveryDate(deliveryDate);
    items.addAll(accounts);
    creditCardCharge.setTransactionItems(items);
    ClientCompanyPreferences preferences = context.getPreferences();
    if (preferences.isTrackTax() && !preferences.isTaxPerDetailLine()) {
      TAXCode taxCode = get(TAXCODE).getValue();
      for (ClientTransactionItem item : items) {
        item.setTaxCode(taxCode.getID());
      }
    }

    creditCardCharge.setCurrency(supplier.getCurrency().getID());
    creditCardCharge.setCurrencyFactor((Double) get(CURRENCY_FACTOR).getValue());
    String memo = get(MEMO).getValue();
    creditCardCharge.setMemo(memo);
    updateTotals(context, creditCardCharge, false);

    create(creditCardCharge, context);

    return null;
  }
コード例 #3
0
 @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;
 }