Пример #1
0
 @ConfigureContext(session = appleton)
 public void testUpdateAccountAmounts_AfterFullEntry_AmountToPercent() {
   PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_THIRDS;
   PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem();
   preq.setApplicationDocumentStatus(
       PurapConstants.PaymentRequestStatuses.APPDOC_DEPARTMENT_APPROVED);
   purapAccountingService.updateAccountAmounts(preq);
   PurApItem item = preq.getItems().get(0);
   int i = 0;
   for (PurApAccountingLine correctLine : fixture.getPurApAccountingLineList()) {
     PurApAccountingLine line = item.getSourceAccountingLines().get(i++);
     assertTrue(line.getAccountLinePercent().equals(correctLine.getAccountLinePercent()));
   }
 }
Пример #2
0
 /**
  * Used by tests of generateAccountDistributionForProration and related methods to make
  * comparisons between the percentages given by the resulting distributed accounts and the
  * percentages that we think should be correct for those lines.
  *
  * @param distributedAccounts A List of the PurApAccountingLines that result from the distribution
  *     to be tested.
  * @param correctPercents A List of percents we think should be correct, in BigDecimal format
  */
 private void comparePercentages(
     List<PurApAccountingLine> distributedAccounts, List<BigDecimal> correctPercents) {
   for (int i = 0; i < distributedAccounts.size(); i++) {
     PurApAccountingLine line = distributedAccounts.get(i);
     BigDecimal percent = line.getAccountLinePercent();
     assertTrue(percent.floatValue() == correctPercents.get(i).floatValue());
   }
 }
Пример #3
0
 @ConfigureContext(session = appleton)
 public void testUpdateAccountAmounts_BeforeFullEntry_AmountNotToPercent() {
   PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.PREQ_PRORATION_THIRDS;
   PurchasingAccountsPayableDocument preq = fixture.generatePaymentRequestDocument_OneItem();
   purapAccountingService.updateAccountAmounts(preq);
   PurApItem item = preq.getItems().get(0);
   int i = 0;
   boolean orResult = false;
   for (PurApAccountingLine correctLine : fixture.getPurApAccountingLineList()) {
     PurApAccountingLine line = item.getSourceAccountingLines().get(i++);
     if (!line.getAccountLinePercent().equals(correctLine.getAccountLinePercent())) {
       orResult = true;
       break;
     }
   }
   assertFalse(orResult);
 }
  public boolean validate(AttributedDocumentEvent event) {
    boolean valid = true;
    double pct = accountingLine.getAccountLinePercent().doubleValue();

    if (pct <= 0 || pct > 100) {
      GlobalVariables.getMessageMap()
          .putError(errorPropertyName, PurapKeyConstants.ERROR_ITEM_PERCENT, "%", itemIdentifier);

      valid = false;
    }

    return valid;
  }
 /**
  * finds the line with matching sequence number, chart code, account number, financial object code
  * and updates amount/percent on the account line.
  *
  * @param pOItem
  * @param lineAcct
  */
 protected void updateItemAccountLine(PurApItem pOItem, PurApAccountingLine lineAcct) {
   List<PurApAccountingLine> pOAccountingLines = pOItem.getSourceAccountingLines();
   for (PurApAccountingLine pOLineAcct : pOAccountingLines) {
     if (lineAcct.getChartOfAccountsCode().equalsIgnoreCase(pOLineAcct.getChartOfAccountsCode())
         && lineAcct.getAccountNumber().equalsIgnoreCase(pOLineAcct.getAccountNumber())
         && lineAcct
             .getFinancialObjectCode()
             .equalsIgnoreCase(pOLineAcct.getFinancialObjectCode())) {
       lineAcct.setAmount(pOLineAcct.getAmount());
       lineAcct.setAccountLinePercent(pOLineAcct.getAccountLinePercent());
     }
   }
 }