|
34 | 34 | import org.compiere.util.Env;
|
35 | 35 | import org.compiere.util.Msg;
|
36 | 36 | import org.compiere.util.TimeUtil;
|
| 37 | +import org.compiere.util.Util; |
37 | 38 |
|
38 | 39 |
|
39 | 40 | /**
|
@@ -442,7 +443,48 @@ public String completeIt()
|
442 | 443 | if (!isApproved())
|
443 | 444 | approveIt();
|
444 | 445 | log.info("completeIt - " + toString());
|
445 |
| - |
| 446 | + StringBuffer linesWithoutReference = new StringBuffer(); |
| 447 | + Arrays.asList(getLines(true)).stream() |
| 448 | + .filter(statementLine -> statementLine.getC_Payment_ID() == 0) |
| 449 | + .forEach(statementLine -> { |
| 450 | + if(linesWithoutReference.length() > 0) { |
| 451 | + linesWithoutReference.append(Env.NL); |
| 452 | + } |
| 453 | + // Add |
| 454 | + StringBuffer displayValue = new StringBuffer(); |
| 455 | + displayValue.append(statementLine.getLine()); |
| 456 | + // Reference No |
| 457 | + if(!Util.isEmpty(statementLine.getReferenceNo())) { |
| 458 | + displayValue.append(" - @ReferenceNo@: ").append(statementLine.getReferenceNo()); |
| 459 | + } |
| 460 | + // Memo |
| 461 | + if(!Util.isEmpty(statementLine.getMemo())) { |
| 462 | + displayValue.append(" - @Memo@: ").append(statementLine.getMemo()); |
| 463 | + } |
| 464 | + // EFT Check No |
| 465 | + if(!Util.isEmpty(statementLine.getEftCheckNo())) { |
| 466 | + displayValue.append(" - @EftCheckNo@: ").append(statementLine.getEftCheckNo()); |
| 467 | + } |
| 468 | + if(!Util.isEmpty(statementLine.getEftMemo())) { |
| 469 | + displayValue.append(" - @EftMemo@: ").append(statementLine.getEftMemo()); |
| 470 | + } |
| 471 | + // Add amount |
| 472 | + if (statementLine.getTrxAmt().compareTo(Env.ZERO) != 0) { |
| 473 | + displayValue.append(" - @TrxAmt@: ").append(DisplayType.getNumberFormat(DisplayType.Amount).format(statementLine.getTrxAmt())); |
| 474 | + } |
| 475 | + if (statementLine.getChargeAmt().compareTo(Env.ZERO) != 0) { |
| 476 | + displayValue.append(" - @ChargeAmt@: ").append(DisplayType.getNumberFormat(DisplayType.Amount).format(statementLine.getChargeAmt())); |
| 477 | + } |
| 478 | + if (statementLine.getInterestAmt().compareTo(Env.ZERO) != 0) { |
| 479 | + displayValue.append(" - @InterestAmt@: ").append(DisplayType.getNumberFormat(DisplayType.Amount).format(statementLine.getInterestAmt())); |
| 480 | + } |
| 481 | + // Add info |
| 482 | + linesWithoutReference.append(displayValue); |
| 483 | + }); |
| 484 | + // Validate |
| 485 | + if(linesWithoutReference.length() > 0) { |
| 486 | + throw new AdempiereException("@Error@" + Env.NL + " @C_Payment_ID@ @NotFound@ " + Env.NL + linesWithoutReference.toString()); |
| 487 | + } |
446 | 488 | // Set Payment reconciled
|
447 | 489 | MBankStatementLine[] lines = getLines(false);
|
448 | 490 | for (int i = 0; i < lines.length; i++)
|
|
0 commit comments