Blesta Source Documentation

BillingOverviewStatistics extends BillingOverviewModel

Billing Overview statistics

Table of Contents

Methods

__construct() Initialize
getActiveServicesCount() Fetches the number of active services
getAmountInvoiced() Fetches the total amount invoiced over a date range
getCredits() Fetches the credits (non-income) received over a date range
getGatewayRevenue() Fetches the revenue received over a date range for gateways
getOtherRevenue() Fetches the amounts received for transactions of type 'other' that are not for gateways i.e. custom 'debit' and/or 'credit' transaction types
getOutstandingBalance() Fetches the total amount invoiced for all unpaid invoices
getOverdueBalance() Fetches the total amount invoiced for all past due invoices
getRevenue() Fetches the revenue received over a date range
getScheduledCancelationsCount() Fetches the number of upcoming services set to be canceled
getServicesAddedCount() Fetches the number of services added within the given date range
getServicesCanceledCount() Fetches the number of services canceled within the given date range
getTransactionRevenue() Partially constructs a Record object for fetching revenue from transaction information
Methods

getActiveServicesCount()

Fetches the number of active services

public getActiveServicesCount(int $company_id) : int
Parameters
$company_id : int

The company ID from which to get services

Return values
int

The number of active services

getAmountInvoiced()

Fetches the total amount invoiced over a date range

public getAmountInvoiced(int $company_id, string $currency, string $start_date, string $end_date[, array<string|int, mixed> $statuses = ['active', 'proforma'] ]) : float
Parameters
$company_id : int

The company ID from which to fetch revenue

$currency : string

The ISO 4217 3-character currency code

$start_date : string

The start date timestamp

$end_date : string

The end date timestamp

$statuses : array<string|int, mixed> = ['active', 'proforma']

A list of acceptable invoice statuses (active, proforma, or both)

Return values
float

The total invoiced amount over the given date range

getCredits()

Fetches the credits (non-income) received over a date range

public getCredits(int $company_id, string $currency, string $start_date, string $end_date) : float
Parameters
$company_id : int

The company ID from which to fetch revenue

$currency : string

The ISO 4217 3-character currency code

$start_date : string

The start date

$end_date : string

The end date

Return values
float

The total credits over the given date range

getGatewayRevenue()

Fetches the revenue received over a date range for gateways

public getGatewayRevenue(int $company_id, string $currency, string $start_date, string $end_date, string $type) : array<string|int, mixed>
Parameters
$company_id : int

The company ID from which to fetch revenue

$currency : string

The ISO 4217 3-character currency code

$start_date : string

The start date

$end_date : string

The end date

$type : string

The type of transaction to filter by -- "cc", "ach", "other"

Return values
array<string|int, mixed>

An array of stdClass objects containing:

  • total The total revenue received over the given date range
  • gateway_id The ID of the gateway
  • type The transaction type

getOtherRevenue()

Fetches the amounts received for transactions of type 'other' that are not for gateways i.e. custom 'debit' and/or 'credit' transaction types

public getOtherRevenue(int $company_id, string $currency, string $start_date, string $end_date) : array<string|int, mixed>
Parameters
$company_id : int

The company ID from which to fetch revenue

$currency : string

The ISO 4217 3-character currency code

$start_date : string

The start date

$end_date : string

The end date

Return values
array<string|int, mixed>

An array of stdClass objects containing:

  • total The total revenue received over the given date range
  • id The transaction type ID
  • name The name of the transaction type
  • type The transaction type

getOutstandingBalance()

Fetches the total amount invoiced for all unpaid invoices

public getOutstandingBalance(int $company_id, string $currency) : float
Parameters
$company_id : int

The company ID from which to fetch the outstanding balance

$currency : string

The ISO 4217 3-character currency code

Return values
float

The total outstanding balance

getOverdueBalance()

Fetches the total amount invoiced for all past due invoices

public getOverdueBalance(int $company_id, string $currency) : float
Parameters
$company_id : int

The company ID from which to fetch the past due balance

$currency : string

The ISO 4217 3-character currency code

Return values
float

The total overdue balance

getRevenue()

Fetches the revenue received over a date range

public getRevenue(int $company_id, string $currency, string $start_date, string $end_date[, string $type = null ]) : float
Parameters
$company_id : int

The company ID from which to fetch revenue

$currency : string

The ISO 4217 3-character currency code

$start_date : string

The start date

$end_date : string

The end date

$type : string = null

The type of transaction to filter by -- "cc", "ach", "other" (optional, default all)

Return values
float

The total revenue received over the given date range

getScheduledCancelationsCount()

Fetches the number of upcoming services set to be canceled

public getScheduledCancelationsCount(int $company_id) : int
Parameters
$company_id : int

The company ID

Return values
int

The number of upcoming services set to be canceled

getServicesAddedCount()

Fetches the number of services added within the given date range

public getServicesAddedCount(int $company_id, string $start_date, string $end_date) : int
Parameters
$company_id : int

The company ID from which to get services

$start_date : string

The start date timestamp

$end_date : string

The end date timestamp

Return values
int

The number of services added within the given date range

getServicesCanceledCount()

Fetches the number of services canceled within the given date range

public getServicesCanceledCount(int $company_id, string $start_date, string $end_date) : int
Parameters
$company_id : int

The company ID from which to get services

$start_date : string

The start date timestamp

$end_date : string

The end date timestamp

Return values
int

The number of services canceled within the given date range

getTransactionRevenue()

Partially constructs a Record object for fetching revenue from transaction information

private getTransactionRevenue(int $company_id, string $currency, string $start_date, string $end_date[, string $type = null ]) : Record
Parameters
$company_id : int

The company ID from which to fetch revenue

$currency : string

The ISO 4217 3-character currency code

$start_date : string

The start date

$end_date : string

The end date

$type : string = null

The type of transaction to filter by -- "cc", "ach", "other" (optional, default all)

Return values
Record

A partially-constructed Record object for fetching revenue

Tags
subpackage

plugins.billingoverview.models

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results