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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumNested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.FlagsNested 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongId 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.longThe id of related expense category.longId 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.longGet unique to this business id for expense.Get the id of related contractor account if applicable.longGet the id of related contractor invoice if applicable.longGet the id of related contractor system if applicable.longgetId()Get the unique identifier of this expense within this business.longGet the id of related invoice if applicable.Note of percent to mark expense up.longId of related new FreshBooks (not Classic) project if applicable.getNotes()Get notes about the expense.longId of related recurring expense profile if applicable.longId of related FreshBooks Classic project if applicable.longGet 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.longGet 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 archivedbooleanCan the expense be billed to a Client or Project.booleanisCogs()Get if the expense counts as "Cost of Goods Sold" and is associated with a client.booleanIf the expense is a duplicated expense.booleanIndicates if the expense was created via a bulk import action.booleanIndicates if the expense has an attached receipt.booleanbooleanvoidsetAccountId(long accountId) Id of expense account if applicable.voidsetAccountName(String accountName) Name of related account if applicable.voidTotal amount of the expense.voidsetAttachment(Expense.ExpenseAttachment attachment) Set the details for an attached receipt.voidsetBankName(String bankName) Name of bank expense was imported from, if applicable.voidsetBillable(boolean billable) Can the expense be billed to a Client or Project.voidsetCategoryId(long categoryId) Set the id of the expense category.voidsetClientId(long clientId) Id of client to assign the expense to.voidsetCogs(boolean cogs) Set if the expense counts as "Cost of Goods Sold" and can be associated with a client.voidDate of the expense.voidsetDuplicate(boolean duplicate) If the expense is a duplicated expense.voidsetExtAccountId(String extAccountId) Set the id of related contractor account if applicable.voidsetExtInvoiceId(long extInvoiceId) Set the id of related contractor invoice if applicable.voidsetExtSystemId(long extSystemId) Set the id of related contractor system if applicable.voidsetHasReceipt(boolean hasReceipt) Indicates if the expense has an attached receipt.voidsetIncludeReceipt(boolean includeReceipt) voidsetInvoiceId(long invoiceId) Set the id of related invoice if applicable.voidsetMarkupPercent(String markupPercent) Note of percent to mark expense up.voidsetModernProjectId(long modernProjectId) Set the Id of a new FreshBooks (not Classic) project to associate the expense with the project.voidSet notes about the expense.voidsetPotentialBillPayment(boolean potentialBillPayment) voidsetProjectId(long projectId) Set the Id of a FreshBooks Classic project to associate the expense with the project.voidsetStaffId(long staffId) Set the id of related staff member if applicable.voidsetStatus(Expense.ExpenseStatus status) Set the status of the expense.voidsetTaxAmount1(Money taxAmount) Set the amount of the first tax making up the total amount of the expense.voidsetTaxAmount2(Money taxAmount) Set the amount of the second tax making up the total amount of the expense.voidsetTaxName1(String taxName) Set the name of first tax.voidsetTaxName2(String taxName) Set the name of second tax.voidsetTaxPercent1(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.voidsetTaxPercent2(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.voidsetTransactionId(long transactionId) Set the id of related bank imported transaction if applicable.voidGet the name of the vendor.voidsetVisState(VisState visState) Set the visibility state of the expense.Methods inherited from class com.google.api.client.json.GenericJson
clone, getFactory, set, setFactory, toPrettyString, toStringMethods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeysMethods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:ConvertibleContentReturn the objects values as a Map suitable to sending to FreshBooks in a POST or PUT request.- Specified by:
getContentin interfaceConvertibleContent- Returns:
-