Ejemplo n.º 1
0
  public static String printPersonRefundsFromOthers(
      PersonData pd, String returnToText, String forText) {
    StringBuilder sb = new StringBuilder(pd.getName());
    sb.append(" ").append(returnToText).append(":\n");
    HashMap<String, Double> refundMap = pd.getMyRefunds();

    if (refundMap.size() <= 0) return "";

    return printCalculationList(forText, sb, refundMap);
  }
Ejemplo n.º 2
0
  public static String printPersonReturnsToOthersDetails(
      PersonData pp,
      String howMuchPaidText,
      String howMuchShouldPayText,
      String returnToText,
      String forText,
      String endOfLine) {
    //		String currency = Currency.getInstance(Locale.getDefault()).getSymbol();

    StringBuilder sb =
        new StringBuilder(pp.getName())
            .append(" - ")
            .append(howMuchPaidText)
            .append(": ")
            .append(FormatterHelper.currencyFormat(pp.getHowMuchPersonPaid(), 2))
            .append(" ");
    sb.append("(")
        .append(howMuchShouldPayText)
        .append(": ")
        .append(FormatterHelper.currencyFormat(pp.getHowMuchPersonShouldPay(), 2))
        .append(")");

    String messageIfNoReturnNeeded = sb.toString() + endOfLine;

    sb.append(", ").append(returnToText).append(":").append(endOfLine);
    boolean isThereAnyPersonOnReturnList = false;

    Iterator<String> it = pp.getMyDebts().keySet().iterator();
    while (it.hasNext()) {
      String key = it.next();
      double result = pp.getMyDebts().get(key);
      if (result > 0) {
        isThereAnyPersonOnReturnList = true;
        sb.append(FormatterHelper.currencyFormat(result, 2)).append(" ");
        sb.append(forText).append(": ").append(key).append(endOfLine);
      }
    }

    if (isThereAnyPersonOnReturnList) return sb.toString();
    else return messageIfNoReturnNeeded;
  }