@ConfigureContext(session = parke) public void testUpdateItemAccountAmounts_ThreeAccounts() { PurapAccountingServiceFixture fixture = PurapAccountingServiceFixture.REQ_PRORATION_THIRDS; RequisitionDocument req = fixture.generateRequisitionDocument_OneItem(); RequisitionItem item = (RequisitionItem) req.getItems().get(0); KualiDecimal total = item.getTotalAmount(); purapAccountingService.updateItemAccountAmounts(item); PurApAccountingLine line1 = item.getSourceAccountingLines().get(0); assertTrue(line1.getAmount().compareTo(total.divide(new KualiDecimal(3))) == 0); }
/** * 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()); } } }