@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;
  }
 @Override
 public JSONObject migrate(Item item, MigratorContext context) throws JSONException {
   JSONObject jsonObject = new JSONObject();
   CommonFieldsMigrator.migrateCommonFields(item, jsonObject, context);
   jsonObject.put("name", item.getName());
   jsonObject.put("isSubItemOf", item.isSubItemOf());
   Item parentItem = item.getParentItem();
   if (parentItem != null) {
     jsonObject.put("subItemOf", context.get("Item", parentItem.getID()));
   }
   jsonObject.put("iSellThisService", item.isISellThisItem());
   jsonObject.put("salesDescription", item.getSalesDescription());
   jsonObject.put("salesPrice", item.getSalesPrice());
   Account incomeAccount = item.getIncomeAccount();
   if (incomeAccount != null) {
     jsonObject.put("incomeAccount", context.get("Account", incomeAccount.getID()));
   }
   jsonObject.put("isTaxable", item.isTaxable());
   jsonObject.put("isCommissionItem", item.isCommissionItem());
   jsonObject.put("standardCost", item.getStandardCost());
   ItemGroup itemGroup = item.getItemGroup();
   if (itemGroup != null) {
     jsonObject.put("itemGroup", context.get("ItemGroup", itemGroup.getID()));
   }
   jsonObject.put("inActive", !item.isActive());
   jsonObject.put("iBuyThisService", item.isIBuyThisItem());
   jsonObject.put("purchaseDescription", item.getPurchaseDescription());
   jsonObject.put("purchasePrice", item.getPurchasePrice());
   Account expenseAccount = item.getExpenseAccount();
   if (expenseAccount != null) {
     jsonObject.put("expenseAccount", context.get("Account", expenseAccount.getID()));
   }
   Vendor preferredVendor = item.getPreferredVendor();
   if (preferredVendor != null) {
     jsonObject.put("preferredVendor", context.get("Vendor", preferredVendor.getID()));
   }
   jsonObject.put("vendorServiceNumber", item.getVendorItemNumber());
   jsonObject.put("itemType", PicklistUtilMigrator.getItemTypeIdentifier(item.getType()));
   // assertAccount
   Account assestsAccount = item.getAssestsAccount();
   if (assestsAccount != null) {
     jsonObject.put("assetAccount", context.get("Account", assestsAccount.getID()));
   }
   Quantity reorderPoint = item.getReorderPoint();
   if (reorderPoint != null) {
     double value = reorderPoint.getValue();
     Unit unit = reorderPoint.getUnit();
     if (unit != null) {
       jsonObject.put("reOrderPoint", unit.getFactor() * value);
     } else {
       jsonObject.put("reOrderPoint", value);
     }
   }
   Account costOfGoodsSold = item.getExpenseAccount();
   if (costOfGoodsSold != null) {
     jsonObject.put("costOfGoodsSold", context.get("Account", costOfGoodsSold.getID()));
   }
   Warehouse warehouse = item.getWarehouse();
   if (warehouse != null) {
     jsonObject.put("warehouse", context.get("Warehouse", warehouse.getID()));
   }
   Measurement measurement = item.getMeasurement();
   if (measurement != null) {
     jsonObject.put("measurement", context.get("Measurement", measurement.getID()));
   }
   jsonObject.put("averageCost", item.getAverageCost());
   return jsonObject;
 }