org.geebis.books.model.terms
Class Terms

java.lang.Object
  extended by org.geebis.books.model.terms.Terms
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DateDrivenTerms, DaysDrivenTerms

@Name(value="terms")
public abstract class Terms
extends java.lang.Object
implements java.io.Serializable

The Terms class represents terms of payment on an invoice.

Terms can have discounts which means that if the invoice is paid before the discount date specified by calculateDiscountDate()

See Also:
Serialized Form

Constructor Summary
protected Terms()
           
protected Terms(java.lang.String name)
           
protected Terms(java.lang.String name, java.lang.Double discountPercent)
           
 
Method Summary
 java.lang.Double calculateDiscountAmount(java.util.Date issuedDate, java.util.Date testDate, java.lang.Double amount)
          Returns the discount amount for the values passed in with this terms
abstract  java.util.Date calculateDiscountDate(java.util.Date issuedDate)
          Gets the cut off date that a discount can be taken at with this terms
abstract  java.util.Date calculateDueDate(java.util.Date issuedDate)
          Gets the due date of an invoice with the passed in date
 TermsStatus calculateStatus(java.util.Date issuedDate, java.util.Date testDate)
          Returns the TermsStatus for this terms with the passed in issued date and test date
 java.lang.Double getDiscountPercent()
          Gets the discount percent of the terms
 java.lang.Long getId()
           
 java.lang.String getName()
          Gets the name of this terms.
 java.lang.Integer getVersion()
           
 void setDiscountPercent(java.lang.Double discountPercent)
          Sets the discount percent of the terms
 void setId(java.lang.Long id)
           
 void setName(java.lang.String name)
          Sets the name of the terms
 void setVersion(java.lang.Integer version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Terms

protected Terms()

Terms

protected Terms(java.lang.String name)

Terms

protected Terms(java.lang.String name,
                java.lang.Double discountPercent)
Method Detail

getName

public java.lang.String getName()
Gets the name of this terms. The terms name is unique and is used to identify the terms throughout the system.

Returns:
the name of the terms

setName

public void setName(java.lang.String name)
Sets the name of the terms

Parameters:
name - the new name of the terms

getDiscountPercent

public java.lang.Double getDiscountPercent()
Gets the discount percent of the terms

Returns:
the discount percent of the terms

setDiscountPercent

public void setDiscountPercent(java.lang.Double discountPercent)
Sets the discount percent of the terms

Parameters:
discountPercent - the new discount percent for this terms

getVersion

public java.lang.Integer getVersion()

setVersion

public void setVersion(java.lang.Integer version)

getId

public java.lang.Long getId()

setId

public void setId(java.lang.Long id)

calculateDueDate

public abstract java.util.Date calculateDueDate(java.util.Date issuedDate)
Gets the due date of an invoice with the passed in date

Parameters:
issuedDate - the date the invoice was issued
Returns:
the date the invoice is due

calculateDiscountDate

public abstract java.util.Date calculateDiscountDate(java.util.Date issuedDate)
Gets the cut off date that a discount can be taken at with this terms

Parameters:
issuedDate - the date the invoice was issued
Returns:
the cut off date for taking a discount

calculateDiscountAmount

public java.lang.Double calculateDiscountAmount(java.util.Date issuedDate,
                                                java.util.Date testDate,
                                                java.lang.Double amount)
Returns the discount amount for the values passed in with this terms

Parameters:
issuedDate - the date the invoice was issued
testDate - the date to test
amount - the amount of the invoice
Returns:
a Double of the discount amount

calculateStatus

public TermsStatus calculateStatus(java.util.Date issuedDate,
                                   java.util.Date testDate)
Returns the TermsStatus for this terms with the passed in issued date and test date

Parameters:
issuedDate - the date the invoice was issued
testDate - the date to test
Returns:
The TermsStatus for the test date relative to the issuedDate with this terms