- debug("submittable", String.format(Locale.US,
- "%s, accounts=%d, accounts_with_values=%s, " +
- "amounts_with_accounts=%d, amounts=%d, running_total=%1.2f, " +
- "single_empty_with_acc=%s", have_description ? "description" : "NO description",
- accounts, accounts_with_values, amounts_with_accounts, amounts, running_total,
- (single_empty_amount && single_empty_amount_has_account) ? "true" : "false"));
+ // suggest off-balance amount to a row and remove hints on other rows
+ Item receiver = null;
+ if (!itemsWithAccountAndEmptyAmount.isEmpty())
+ receiver = itemsWithAccountAndEmptyAmount.get(0);
+ else if (!itemsWithEmptyAmount.isEmpty())
+ receiver = itemsWithEmptyAmount.get(0);
+
+ for (Item item : items) {
+ if (item.equals(receiver)) {
+ Logger.debug("submittable",
+ String.format("Setting amount hint to %1.2f", -balance));
+ item.setAmountHint(String.format("%1.2f", -balance));
+ }
+ else
+ item.setAmountHint(null);
+ }
+ }