Owns invoices, quotes and payment lists for the current organisation: looks them up, counts them and starts new ones via builders. Registered with the application manager as the JS service "invoiceManager", so app developers reach it as invoiceManager from server-side JS.

Group: Managers


Methods

invoiceBuilder(Date now, Profile createdBy) · findInvoiceStatus(String status) · findQuoteStatus(String status) · findInvoices(Date startDate, Date endDate) · findInvoices(String status, Date startDate, Date endDate) · countInvoices(String status, Date startDate, Date endDate) · countQuotes(String status, Date startDate, Date endDate) · quoteBuilder(Date now, Profile createdBy) · findInvoiceByNumber(String invoiceNumber) · findPaymentListByNumber(String num) · nextInvoiceNumber()

invoiceBuilder(Date now, Profile createdBy)

Returns: InvoiceBuilder

Starts a builder for a new invoice, ready to have its fields set before being persisted.

ParameterDescription
nowthe date and time the invoice is being created
createdBythe profile creating the invoice

findInvoiceStatus(String status)

Returns: InvoiceStatus

Parses a free-text value into the matching invoice status.

ParameterDescription
statusthe text to parse, such as "draft", "sent", "overdue" or "paid"

findQuoteStatus(String status)

Returns: QuoteStatus

Parses a free-text value into the matching quote status.

ParameterDescription
statusthe text to parse, matched case-insensitively against the quote status names

findInvoices(Date startDate, Date endDate)

Returns: List<Invoice>

Looks up all invoices for the current organisation issued within a date range, regardless of status.

ParameterDescription
startDatethe earliest issue date to include
endDatethe latest issue date to include

findInvoices(String status, Date startDate, Date endDate)

Returns: List<Invoice>

Looks up invoices for the current organisation, optionally filtered by status, issued within a date range.

ParameterDescription
statusthe invoice status to filter by, or null to include all statuses
startDatethe earliest issue date to include
endDatethe latest issue date to include

countInvoices(String status, Date startDate, Date endDate)

Returns: long

Counts invoices for the current organisation, optionally filtered by status, issued within a date range.

ParameterDescription
statusthe invoice status to filter by, or null to include all statuses
startDatethe earliest issue date to include
endDatethe latest issue date to include

countQuotes(String status, Date startDate, Date endDate)

Returns: Long

Counts quotes for the current organisation, optionally filtered by status, issued within a date range.

ParameterDescription
statusthe quote status to filter by (parsed with findQuoteStatus), or null to include all statuses
startDatethe earliest issue date to include
endDatethe latest issue date to include

quoteBuilder(Date now, Profile createdBy)

Returns: QuoteBuilder

Starts a builder for a new quote, ready to have its fields set before being persisted.

ParameterDescription
nowthe date and time the quote is being created
createdBythe profile creating the quote

findInvoiceByNumber(String invoiceNumber)

Returns: Invoice

Looks up a single invoice for the current organisation by its invoice number.

ParameterDescription
invoiceNumberthe invoice number to search for

findPaymentListByNumber(String num)

Returns: PaymentItemList

Looks up a payment item list (invoice, quote or purchase order) for the current organisation by its number.

ParameterDescription
numthe payment list number to search for

nextInvoiceNumber()

Returns: String

Generates the next available invoice number for the current organisation, for use on a new invoice.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.