Package net.amcintosh.freshbooks.models
Class Expense
java.lang.Object
java.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.json.GenericJson
net.amcintosh.freshbooks.models.Expense
- All Implemented Interfaces:
Cloneable
,Map<String,
,Object> ConvertibleContent
Expenses are used to track expenditures your business incurs.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.Flags
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Id of expense account if applicable.Get unique identifier of business the expense exists on.Name of related account if applicable.Total amount of the expense.Get the attached receipt image details.Name of bank expense was imported from, if applicable.long
The id of related expense category.long
Id of client the expense has been assigned to if applicable.Return the objects values as a Map suitable to sending to FreshBooks in a POST or PUT request.getDate()
Date of the expense.long
Get unique to this business id for expense.Get the id of related contractor account if applicable.long
Get the id of related contractor invoice if applicable.long
Get the id of related contractor system if applicable.long
getId()
Get the unique identifier of this expense within this business.long
Get the id of related invoice if applicable.Note of percent to mark expense up.long
Id of related new FreshBooks (not Classic) project if applicable.getNotes()
Get notes about the expense.long
Id of related recurring expense profile if applicable.long
Id of related FreshBooks Classic project if applicable.long
Get the id of related staff member if applicable.Get the status of the expense.Get the amount of the first tax making up the total amount of the expense.Get the amount of the second tax making up the total amount of the expense.Get the name of first tax.Get the name of second tax.Get the string-decimal tax amount for first tax – indicates the maximum tax percentage for this expense.Get the string-decimal tax amount for second tax – indicates the maximum tax percentage for this expense.long
Get the id of related bank imported transaction if applicable.Get the time of last modification to the invoice.Get the name of the vendor.Get the visibility state: active, deleted, or archivedboolean
Can the expense be billed to a Client or Project.boolean
isCogs()
Get if the expense counts as "Cost of Goods Sold" and is associated with a client.boolean
If the expense is a duplicated expense.boolean
Indicates if the expense was created via a bulk import action.boolean
Indicates if the expense has an attached receipt.boolean
boolean
void
setAccountId
(long accountId) Id of expense account if applicable.void
setAccountName
(String accountName) Name of related account if applicable.void
Total amount of the expense.void
setAttachment
(Expense.ExpenseAttachment attachment) Set the details for an attached receipt.void
setBankName
(String bankName) Name of bank expense was imported from, if applicable.void
setBillable
(boolean billable) Can the expense be billed to a Client or Project.void
setCategoryId
(long categoryId) Set the id of the expense category.void
setClientId
(long clientId) Id of client to assign the expense to.void
setCogs
(boolean cogs) Set if the expense counts as "Cost of Goods Sold" and can be associated with a client.void
Date of the expense.void
setDuplicate
(boolean duplicate) If the expense is a duplicated expense.void
setExtAccountId
(String extAccountId) Set the id of related contractor account if applicable.void
setExtInvoiceId
(long extInvoiceId) Set the id of related contractor invoice if applicable.void
setExtSystemId
(long extSystemId) Set the id of related contractor system if applicable.void
setHasReceipt
(boolean hasReceipt) Indicates if the expense has an attached receipt.void
setIncludeReceipt
(boolean includeReceipt) void
setInvoiceId
(long invoiceId) Set the id of related invoice if applicable.void
setMarkupPercent
(String markupPercent) Note of percent to mark expense up.void
setModernProjectId
(long modernProjectId) Set the Id of a new FreshBooks (not Classic) project to associate the expense with the project.void
Set notes about the expense.void
setPotentialBillPayment
(boolean potentialBillPayment) void
setProjectId
(long projectId) Set the Id of a FreshBooks Classic project to associate the expense with the project.void
setStaffId
(long staffId) Set the id of related staff member if applicable.void
setStatus
(Expense.ExpenseStatus status) Set the status of the expense.void
setTaxAmount1
(Money taxAmount) Set the amount of the first tax making up the total amount of the expense.void
setTaxAmount2
(Money taxAmount) Set the amount of the second tax making up the total amount of the expense.void
setTaxName1
(String taxName) Set the name of first tax.void
setTaxName2
(String taxName) Set the name of second tax.void
setTaxPercent1
(String taxPercent1) Set the string-decimal tax amount for first tax – indicates the maximum tax percentage for this expense, this does not add tax to the expense, instead use taxAmount1.void
setTaxPercent2
(String taxPercent2) Set the string-decimal tax amount for second tax – indicates the maximum tax percentage for this expense, this does not add tax to the expense, instead use taxAmount2.void
setTransactionId
(long transactionId) Set the id of related bank imported transaction if applicable.void
Get the name of the vendor.void
setVisState
(VisState visState) Set the visibility state of the expense.Methods inherited from class com.google.api.client.json.GenericJson
clone, getFactory, set, setFactory, toPrettyString, toString
Methods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
Expense
public Expense()
-
-
Method Details
-
getId
public long getId()Get the unique identifier of this expense within this business.- Returns:
- The id of the expense
-
getExpenseId
public long getExpenseId()Get unique to this business id for expense. Note: This is the same asgetId
.- Returns:
- The id of the expense
-
getAccountName
Name of related account if applicable.- Returns:
-
setAccountName
Name of related account if applicable.- Parameters:
accountName
-
-
getAccountId
public long getAccountId()Id of expense account if applicable.- Returns:
-
setAccountId
public void setAccountId(long accountId) Id of expense account if applicable.- Parameters:
accountId
-
-
getAccountingSystemId
Get unique identifier of business the expense exists on.- Returns:
- Accounting System Id
-
getAmount
Total amount of the expense.- Returns:
-
setAmount
Total amount of the expense.- Parameters:
amount
-
-
getBankName
Name of bank expense was imported from, if applicable.- Returns:
-
setBankName
Name of bank expense was imported from, if applicable.- Parameters:
bankName
-
-
isBillable
public boolean isBillable()Can the expense be billed to a Client or Project.- Returns:
-
setBillable
public void setBillable(boolean billable) Can the expense be billed to a Client or Project.- Parameters:
billable
-
-
getCategoryId
public long getCategoryId()The id of related expense category.- Returns:
- Id of the category
-
setCategoryId
public void setCategoryId(long categoryId) Set the id of the expense category.- Parameters:
categoryId
- Id of the category
-
getClientId
public long getClientId()Id of client the expense has been assigned to if applicable.- Returns:
- Client Id
-
setClientId
public void setClientId(long clientId) Id of client to assign the expense to.- Parameters:
clientId
- Client Id
-
getDate
Date of the expense.
The API returns this in YYYY-MM-DD format. It is converted to a LocalDate.- Returns:
- converted LocalDate object
-
setDate
Date of the expense.
This is sent to the API in YYYY-MM-DD format.- Parameters:
date
-
-
getExtAccountId
Get the id of related contractor account if applicable.- Returns:
-
setExtAccountId
Set the id of related contractor account if applicable.- Parameters:
extAccountId
-
-
getExtInvoiceId
public long getExtInvoiceId()Get the id of related contractor invoice if applicable.- Returns:
-
setExtInvoiceId
public void setExtInvoiceId(long extInvoiceId) Set the id of related contractor invoice if applicable.- Parameters:
extInvoiceId
-
-
getExtSystemId
public long getExtSystemId()Get the id of related contractor system if applicable.- Returns:
-
setExtSystemId
public void setExtSystemId(long extSystemId) Set the id of related contractor system if applicable.- Parameters:
extSystemId
-
-
isFromBulkImport
public boolean isFromBulkImport()Indicates if the expense was created via a bulk import action.- Returns:
-
isHasReceipt
public boolean isHasReceipt()Indicates if the expense has an attached receipt.- Returns:
-
setHasReceipt
public void setHasReceipt(boolean hasReceipt) Indicates if the expense has an attached receipt.- Parameters:
hasReceipt
-
-
isIncludeReceipt
public boolean isIncludeReceipt() -
setIncludeReceipt
public void setIncludeReceipt(boolean includeReceipt) -
getInvoiceId
public long getInvoiceId()Get the id of related invoice if applicable.- Returns:
-
setInvoiceId
public void setInvoiceId(long invoiceId) Set the id of related invoice if applicable.- Parameters:
invoiceId
-
-
isCogs
public boolean isCogs()Get if the expense counts as "Cost of Goods Sold" and is associated with a client.- Returns:
-
setCogs
public void setCogs(boolean cogs) Set if the expense counts as "Cost of Goods Sold" and can be associated with a client.- Parameters:
cogs
-
-
isDuplicate
public boolean isDuplicate()If the expense is a duplicated expense.- Returns:
-
setDuplicate
public void setDuplicate(boolean duplicate) If the expense is a duplicated expense.- Parameters:
duplicate
-
-
getMarkupPercent
Note of percent to mark expense up.- Returns:
- String-decimal percentage
-
setMarkupPercent
Note of percent to mark expense up.- Parameters:
markupPercent
- String-decimal percentage
-
getModernProjectId
public long getModernProjectId()Id of related new FreshBooks (not Classic) project if applicable.- Returns:
- Project Id
-
setModernProjectId
public void setModernProjectId(long modernProjectId) Set the Id of a new FreshBooks (not Classic) project to associate the expense with the project.- Parameters:
modernProjectId
- Project Id
-
getNotes
Get notes about the expense.- Returns:
-
setNotes
Set notes about the expense.- Parameters:
notes
-
-
isPotentialBillPayment
public boolean isPotentialBillPayment() -
setPotentialBillPayment
public void setPotentialBillPayment(boolean potentialBillPayment) -
getProfileId
public long getProfileId()Id of related recurring expense profile if applicable.- Returns:
-
getProjectId
public long getProjectId()Id of related FreshBooks Classic project if applicable.- Returns:
- Project Id
-
setProjectId
public void setProjectId(long projectId) Set the Id of a FreshBooks Classic project to associate the expense with the project.- Parameters:
projectId
- Classic Project Id
-
getStaffId
public long getStaffId()Get the id of related staff member if applicable.- Returns:
-
setStaffId
public void setStaffId(long staffId) Set the id of related staff member if applicable.- Parameters:
staffId
-
-
getStatus
Get the status of the expense.- Returns:
- Enum of the expense status.
-
setStatus
Set the status of the expense. This is only writable at creation and cannot be manually set later.- Parameters:
status
- ExpenseStatus value
-
getTaxAmount1
Get the amount of the first tax making up the total amount of the expense.- Returns:
- Object containing amount and currency code.
-
setTaxAmount1
Set the amount of the first tax making up the total amount of the expense.- Parameters:
taxAmount
- Money object of required deposit
-
getTaxAmount2
Get the amount of the second tax making up the total amount of the expense.- Returns:
- Object containing amount and currency code.
-
setTaxAmount2
Set the amount of the second tax making up the total amount of the expense.- Parameters:
taxAmount
- Money object of required deposit
-
getTaxName1
Get the name of first tax.- Returns:
- Eg. "HST"
-
setTaxName1
Set the name of first tax.- Parameters:
taxName
- Eg. "HST"
-
getTaxName2
Get the name of second tax.- Returns:
- Eg. "HST"
-
setTaxName2
Set the name of second tax.- Parameters:
taxName
- Eg. "HST"
-
getTaxPercent1
Get the string-decimal tax amount for first tax – indicates the maximum tax percentage for this expense.- Returns:
-
setTaxPercent1
Set the string-decimal tax amount for first tax – indicates the maximum tax percentage for this expense, this does not add tax to the expense, instead use taxAmount1.- Parameters:
taxPercent1
-
-
getTaxPercent2
Get the string-decimal tax amount for second tax – indicates the maximum tax percentage for this expense.- Returns:
-
setTaxPercent2
Set the string-decimal tax amount for second tax – indicates the maximum tax percentage for this expense, this does not add tax to the expense, instead use taxAmount2.- Parameters:
taxPercent2
-
-
getTransactionId
public long getTransactionId()Get the id of related bank imported transaction if applicable.- Returns:
-
setTransactionId
public void setTransactionId(long transactionId) Set the id of related bank imported transaction if applicable.- Parameters:
transactionId
-
-
getUpdated
Get the time of last modification to the invoice.
Note: The API returns this data in "US/Eastern", but it is converted here to UTC.- Returns:
- Updated time in UTC
-
getVendor
Get the name of the vendor.- Returns:
- Eg. "Home Depot"
-
setVendor
Get the name of the vendor.- Parameters:
vendor
- Eg. "Home Depot"
-
getVisState
Get the visibility state: active, deleted, or archived- Returns:
- Enum of the visibility state.
- See Also:
-
setVisState
Set the visibility state of the expense.- Parameters:
visState
- VisState value- See Also:
-
getAttachment
Get the attached receipt image details.
Note: This data is not in the default response and will only be present with the use of a corresponding "includes" filter.- Returns:
-
setAttachment
Set the details for an attached receipt.- Parameters:
attachment
-
-
getContent
Description copied from interface:ConvertibleContent
Return the objects values as a Map suitable to sending to FreshBooks in a POST or PUT request.- Specified by:
getContent
in interfaceConvertibleContent
- Returns:
-