org.kuali.kfs.module.purap.document.service
Interface PurapService

All Known Implementing Classes:
PurapServiceImpl

public interface PurapService

Defines methods that must be implemented by classes providing a PurapService.


Method Summary
 void addBelowLineItems(PurchasingAccountsPayableDocument document)
          Add the allowed below the line items to the given document
 boolean allowEncumberNextFiscalYear()
          Returns true if the current date falls within the allowed range to encumber in the next fiscal year.
 void calculateTax(PurchasingAccountsPayableDocument purapDocument)
          Calculates sales or use tax for each item if sales tax enabled and item is taxable.
 void clearAllTaxes(PurchasingAccountsPayableDocument apDoc)
           
 void clearTax(PurchasingAccountsPayableDocument purapDocument, boolean useTax)
          Clears the tax from a document.
 void deleteUnenteredItems(PurapItemOperations document)
          Remove items that have not been "entered" which means no data has been added to them so no more processing needs to continue on these items.
 List<Integer> getAllowedFiscalYears()
          Returns a list of fiscal years that can be selected from on the document (built for Requisition and Purchase Order).
 org.kuali.rice.kns.util.KualiDecimal getApoLimit(Integer vendorContractGeneratedIdentifier, String chart, String org)
          Retrieve the Automatic Purchase Order Limit amount based first on the derived contract limit (see VendorService.getApoLimitFromContract(Integer, String, String)) and if that is null then based on the OrganizationParameter associated with the given 'chart' and 'org' values.
 PurApItem getBelowTheLineByType(PurchasingAccountsPayableDocument document, ItemType iT)
          Retrieve the below the line item for a doc by item type (unknown result if multiple of same below the line item type)
 String[] getBelowTheLineForDocument(PurchasingAccountsPayableDocument document)
          Retrieves the below the line items allowed from the parameter table for the given document
 Date getDateFromOffsetFromToday(int offsetDays)
          Return a Date object which is which is a given number of days away from today, in either direction.
 String getDeliveryState(PurchasingAccountsPayableDocument purapDocument)
          Retrieves the delivery state from the document
 List<String> getRelatedDocumentIds(Integer accountsPayablePurchasingDocumentLinkIdentifier)
           
 List getRelatedViews(Class clazz, Integer accountsPayablePurchasingDocumentLinkIdentifier)
          Retrieve list of views for given identifier
 boolean isAccountingLineTaxable(PurApAccountingLine acctLine, boolean deliveryStateTaxable)
          Determines if the accounting line is taxable based on account and object code.
 boolean isDateAYearBeforeToday(Date compareDate)
          We are obliged not to simply use a dateDiff and compare the result to 365, because we have to worry about leap years.
 boolean isDateInPast(Date compareDate)
          Determine whether a given date is in the past.
 boolean isDateMoreThanANumberOfDaysAway(Date compareDate, int daysAway)
          Determine whether a given date is more than a given number of days away from the current date.
 boolean isDeliveryStateTaxable(String deliveryState)
          Determines if the delivery state is taxable or not.
 boolean isDocumentStoppedInRouteNode(PurchasingAccountsPayableDocument document, String nodeName)
          Determines if a document is in a specified node.
 boolean isFullDocumentEntryCompleted(PurchasingAccountsPayableDocument purapDocument)
          Determines if full entry mode has ended for this Purchasing/Accounts Payable document.
 boolean isItemTypeConflictWithTaxPolicy(PurchasingDocument purchasingDocument, PurApItem item)
          Determines if the item type specified conflict with the Account tax policy.
 boolean isTaxable(boolean useTaxIndicator, String deliveryState, PurApItem item)
          Determines if the item is taxable based on a decision tree.
 boolean isTaxableForSummary(boolean useTaxIndicator, String deliveryState, PurApItem item)
          Determines if the item is taxable based on a decision tree.
 boolean isTodayWithinApoAllowedRange()
          Returns true if today is within the APO allowed date range.
 void performLogicForCloseReopenPO(PurchasingAccountsPayableDocument purapDocument)
          Create a close or reopen purchase order document.
 Object performLogicWithFakedUserSession(String requiredPersonPersonUserId, LogicContainer logicToRun, Object... objects)
          Performs the given logic with the given fake user id.
 void prorateForTradeInAndFullOrderDiscount(PurchasingAccountsPayableDocument purDoc)
          Proation for Trade in and Full Order Discount miscellaneous items.
 void saveDocumentNoValidation(org.kuali.rice.kns.document.Document document)
          Saves the document without doing validation by invoking the saveDocument method of documentService.
 void saveRoutingDataForRelatedDocuments(Integer accountsPayablePurchasingDocumentLinkIdentifier)
           
 void sortBelowTheLine(PurchasingAccountsPayableDocument document)
          Sort the below the line elements of the given document
 boolean updateStatus(PurchasingAccountsPayableDocument document, String statusToSet)
          Update the status for the given Purchasing/Accounts Payable document
 void updateUseTaxIndicator(PurchasingAccountsPayableDocument purapDocument, boolean newUseTaxIndicatorValue)
          Updates the use tax field, clearing old values if it has changed
 

Method Detail

updateStatus

boolean updateStatus(PurchasingAccountsPayableDocument document,
                     String statusToSet)
Update the status for the given Purchasing/Accounts Payable document

Parameters:
document -
statusToSet -
Returns:

getRelatedDocumentIds

List<String> getRelatedDocumentIds(Integer accountsPayablePurchasingDocumentLinkIdentifier)

saveRoutingDataForRelatedDocuments

void saveRoutingDataForRelatedDocuments(Integer accountsPayablePurchasingDocumentLinkIdentifier)

getRelatedViews

List getRelatedViews(Class clazz,
                     Integer accountsPayablePurchasingDocumentLinkIdentifier)
Retrieve list of views for given identifier

Parameters:
clazz -
accountsPayablePurchasingDocumentLinkIdentifier -
Returns:
List of views for given identifier

addBelowLineItems

void addBelowLineItems(PurchasingAccountsPayableDocument document)
Add the allowed below the line items to the given document

Parameters:
document - PurchasingAccountsPayableDocument

getBelowTheLineForDocument

String[] getBelowTheLineForDocument(PurchasingAccountsPayableDocument document)
Retrieves the below the line items allowed from the parameter table for the given document

Parameters:
document - PurchasingAccountsPayableDocument
Returns:
Array list of below the line items

getBelowTheLineByType

PurApItem getBelowTheLineByType(PurchasingAccountsPayableDocument document,
                                ItemType iT)
Retrieve the below the line item for a doc by item type (unknown result if multiple of same below the line item type)

Parameters:
document - the document
iT - the itemType
Returns:
below the line item by item type

getDateFromOffsetFromToday

Date getDateFromOffsetFromToday(int offsetDays)
Return a Date object which is which is a given number of days away from today, in either direction.

Parameters:
offsetDays -
Returns:
A java.sql.Date

isDateInPast

boolean isDateInPast(Date compareDate)
Determine whether a given date is in the past.

Parameters:
compareDate - An SQL date (not a DateFormatter date, or a util Date)
Returns:
True if the given date is before today.

isDateMoreThanANumberOfDaysAway

boolean isDateMoreThanANumberOfDaysAway(Date compareDate,
                                        int daysAway)
Determine whether a given date is more than a given number of days away from the current date.

Parameters:
compareDate - An SQL date (not a DateFormatter date, or a util Date)
daysAway - An int, positive for future days, negative for past days
Returns:
True if the given date is more than the given number of days away in either direction.

isDateAYearBeforeToday

boolean isDateAYearBeforeToday(Date compareDate)
We are obliged not to simply use a dateDiff and compare the result to 365, because we have to worry about leap years.

Parameters:
compareDate - An SQL date (not a DateFormatter date, or a util Date)
Returns:
True if the date given for comparison is more than a year in the past, not including today.

getApoLimit

org.kuali.rice.kns.util.KualiDecimal getApoLimit(Integer vendorContractGeneratedIdentifier,
                                                 String chart,
                                                 String org)
Retrieve the Automatic Purchase Order Limit amount based first on the derived contract limit (see VendorService.getApoLimitFromContract(Integer, String, String)) and if that is null then based on the OrganizationParameter associated with the given 'chart' and 'org' values.

Parameters:
vendorContractGeneratedIdentifier -
chart - chart code to use when looking up limit amount on VendorContract and OrganizationParameter
org - organization code to use when looking up limit amount on VendorContract and OrganizationParameter
Returns:
a KualiDecimal if a valid limit amount is found or null if one is not found

isFullDocumentEntryCompleted

boolean isFullDocumentEntryCompleted(PurchasingAccountsPayableDocument purapDocument)
Determines if full entry mode has ended for this Purchasing/Accounts Payable document.

Parameters:
purapDocument - PurchasingAccountsPayableDocument
Returns:
a boolean to indicate if document has completed full entry mode

performLogicForCloseReopenPO

void performLogicForCloseReopenPO(PurchasingAccountsPayableDocument purapDocument)
Create a close or reopen purchase order document.

Parameters:
purapDocument - PurchasingAccountsPayableDocument

performLogicWithFakedUserSession

Object performLogicWithFakedUserSession(String requiredPersonPersonUserId,
                                        LogicContainer logicToRun,
                                        Object... objects)
                                        throws org.kuali.rice.kew.exception.WorkflowException,
                                               Exception
Performs the given logic with the given fake user id. Need this to control the user.

Parameters:
requiredPersonPersonUserId -
logicToRun -
objects -
Returns:
Throws:
org.kuali.rice.kew.exception.WorkflowException
Exception

sortBelowTheLine

void sortBelowTheLine(PurchasingAccountsPayableDocument document)
Sort the below the line elements of the given document

Parameters:
document - PurchasingAccountsPayableDocument to be sorted

deleteUnenteredItems

void deleteUnenteredItems(PurapItemOperations document)
Remove items that have not been "entered" which means no data has been added to them so no more processing needs to continue on these items.

Parameters:
apDocument - AccountsPayableDocument which contains list of items to be reviewed

saveDocumentNoValidation

void saveDocumentNoValidation(org.kuali.rice.kns.document.Document document)
Saves the document without doing validation by invoking the saveDocument method of documentService.

Parameters:
document - The purchase order document to be saved.

isDocumentStoppedInRouteNode

boolean isDocumentStoppedInRouteNode(PurchasingAccountsPayableDocument document,
                                     String nodeName)
Determines if a document is in a specified node.

Parameters:
document -
nodeName -
Returns:

allowEncumberNextFiscalYear

boolean allowEncumberNextFiscalYear()
Returns true if the current date falls within the allowed range to encumber in the next fiscal year.

Returns:

getAllowedFiscalYears

List<Integer> getAllowedFiscalYears()
Returns a list of fiscal years that can be selected from on the document (built for Requisition and Purchase Order). Typically only the current year is returned. However, if the current date falls within the allowed range to encumber in the next fiscal year, the current year and the next current year is returned.

Returns:
List

isTodayWithinApoAllowedRange

boolean isTodayWithinApoAllowedRange()
Returns true if today is within the APO allowed date range. If the difference between today and this years closing date is less than or equal to the number of days allowed for APO.

Returns:
boolean

calculateTax

void calculateTax(PurchasingAccountsPayableDocument purapDocument)
Calculates sales or use tax for each item if sales tax enabled and item is taxable.

Parameters:
purapDocument -

clearTax

void clearTax(PurchasingAccountsPayableDocument purapDocument,
              boolean useTax)
Clears the tax from a document. Useful when changing from use to sales

Parameters:
purapDocument - document
useTax - the whether to clear use or sales

updateUseTaxIndicator

void updateUseTaxIndicator(PurchasingAccountsPayableDocument purapDocument,
                           boolean newUseTaxIndicatorValue)
Updates the use tax field, clearing old values if it has changed

Parameters:
purapDocument - document
newUseTaxIndicatorValue - useTaxIndicator to change to

prorateForTradeInAndFullOrderDiscount

void prorateForTradeInAndFullOrderDiscount(PurchasingAccountsPayableDocument purDoc)
Proation for Trade in and Full Order Discount miscellaneous items.

Parameters:
purDoc -

isTaxable

boolean isTaxable(boolean useTaxIndicator,
                  String deliveryState,
                  PurApItem item)
Determines if the item is taxable based on a decision tree.

Parameters:
useTaxIndicator -
deliveryState -
item -
Returns:

isTaxableForSummary

boolean isTaxableForSummary(boolean useTaxIndicator,
                            String deliveryState,
                            PurApItem item)
Determines if the item is taxable based on a decision tree. Does not consider if item is entered, this is not used to calculate tax, just if the item is indeed taxable.

Parameters:
useTaxIndicator -
deliveryState -
item -
Returns:

getDeliveryState

String getDeliveryState(PurchasingAccountsPayableDocument purapDocument)
Retrieves the delivery state from the document

Parameters:
purapDocument -
Returns:

isAccountingLineTaxable

boolean isAccountingLineTaxable(PurApAccountingLine acctLine,
                                boolean deliveryStateTaxable)
Determines if the accounting line is taxable based on account and object code.

Parameters:
acctLine -
deliveryStateTaxable -
Returns:

isDeliveryStateTaxable

boolean isDeliveryStateTaxable(String deliveryState)
Determines if the delivery state is taxable or not. If parameter is Allow and delivery state in list, or parameter is Denied and delivery state is not in list then state is taxable.

Parameters:
deliveryState -
Returns:

clearAllTaxes

void clearAllTaxes(PurchasingAccountsPayableDocument apDoc)

isItemTypeConflictWithTaxPolicy

boolean isItemTypeConflictWithTaxPolicy(PurchasingDocument purchasingDocument,
                                        PurApItem item)
Determines if the item type specified conflict with the Account tax policy.

Parameters:
purchasingDocument - purchasing document to check
item - item to check if in conflict with tax policy
Returns:
true if item is in conflict, false otherwise


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.