Class: ReportsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/reports_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ ReportsClient

Initialize the ReportsClient class with an API client instance.

Parameters:

  • connection (LockstepApi)

    The API client object for this connection



22
23
24
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 22

def initialize(connection)
    @connection = connection
end

Instance Method Details

#accounts_payable_aging_headerObject

Retrieves AP Aging Header information report broken down by aging bucket.

The AP Aging Header report contains aggregated information about the ‘TotalBillsPastDue`, `TotalVendors`, and their respective `PercentageOfTotalAp` grouped by their aging `ReportBucket`.



173
174
175
176
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 173

def accounts_payable_aging_header()
    path = "/api/v1/Reports/ap-aging-header"
    @connection.request(:get, path, nil, nil)
end

#accounts_payable_header(report_date:, company_id:) ⇒ Object

Retrieves AP header information up to the date specified.

Parameters:

  • report_date (date)

    The date of the report.

  • company_id (uuid)

    Include a company to get AP data for a specific company, leave as null to include all Companies.



131
132
133
134
135
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 131

def accounts_payable_header(report_date:, company_id:)
    path = "/api/v1/Reports/ap-header"
    params = {:reportDate => report_date, :companyId => company_id}
    @connection.request(:get, path, nil, params)
end

#accounts_receivable_aging_headerObject

Retrieves AR Aging Header information report broken down by aging bucket.

The AR Aging Header report contains aggregated information about the ‘TotalInvoicesPastDue`, `TotalCustomers`, and their respective `PercentageOfTotalAr` grouped by their aging `ReportBucket`.



163
164
165
166
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 163

def accounts_receivable_aging_header()
    path = "/api/v1/Reports/ar-aging-header"
    @connection.request(:get, path, nil, nil)
end

#accounts_receivable_header(report_date:, company_id:) ⇒ Object

Retrieves AR header information up to the date specified.

Parameters:

  • report_date (date)

    The date of the report.

  • company_id (uuid)

    Include a company to get AR data for a specific company, leave as null to include all Companies.



120
121
122
123
124
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 120

def accounts_receivable_header(report_date:, company_id:)
    path = "/api/v1/Reports/ar-header"
    params = {:reportDate => report_date, :companyId => company_id}
    @connection.request(:get, path, nil, params)
end

#attachments_header_information(company_id:) ⇒ Object

Retrieves Attachment Header information for the requested companyId.

The Attachment Header report contains aggregated information about the ‘TotalAttachments`, `TotalArchived`, and `TotalActive` attachment classifications.

Parameters:

  • company_id (uuid)

    Include a specific company to get Attachment data for, leave as null to include all Companies.



184
185
186
187
188
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 184

def attachments_header_information(company_id:)
    path = "/api/v1/Reports/attachments-header"
    params = {:companyId => company_id}
    @connection.request(:get, path, nil, params)
end

#balance_sheet_report(start_date:, end_date:, app_enrollment_id:, column_option:, display_depth:, comparison_period:, show_currency_difference:, show_percentage_difference:) ⇒ Object

Generates a balance sheet for the given time range.

Parameters:

  • start_date (date-time)

    The start date of the report

  • end_date (date-time)

    The end date of the report

  • app_enrollment_id (uuid)

    The app enrollment id of the app enrollment whose data will be used.

  • column_option (string)

    The desired column splitting of the report data. An empty string or anything unrecognized will result in only totals being displayed. Options are as follows: By Period - a column for every month/fiscal period within the reporting dates Quarterly - a column for every quarter within the reporting dates Annually - a column for every year within the reporting dates

  • display_depth (ReportDepth)

    The desired row splitting of the report data. For Balance Sheets, the minimum report depth is 1. Options are as follows: 1 - combine all accounts by their category 2 - combine all accounts by their subcategory 3 - display all accounts

  • comparison_period (string)

    Add a column for historical data with the following options and use showCurrencyDifference and/or show percentageDifference to display a comparison of that historical data to the report period. “PP” - previous period (will show the previous quarter or year if Quarterly or Annually is chosen for columnOption) “PY” - previous year (the same date range as the report, but for the year prior)

  • show_currency_difference (boolean)

    A boolean to turn on a currency based difference between the reporting period and the comparison period.

  • show_percentage_difference (boolean)

    A boolean to turn on a percent based difference between the reporting period and the comparison period.



230
231
232
233
234
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 230

def balance_sheet_report(start_date:, end_date:, app_enrollment_id:, column_option:, display_depth:, comparison_period:, show_currency_difference:, show_percentage_difference:)
    path = "/api/v1/Reports/balance-sheet"
    params = {:startDate => start_date, :endDate => end_date, :appEnrollmentId => app_enrollment_id, :columnOption => column_option, :displayDepth => display_depth, :comparisonPeriod => comparison_period, :showCurrencyDifference => show_currency_difference, :showPercentageDifference => show_percentage_difference}
    @connection.request(:get, path, nil, params)
end

#cash_flow(timeframe:) ⇒ Object

Retrieves a current Cash Flow report for this account.

The Cash Flow report indicates the amount of payments retrieved and invoices billed within a given timeframe. You can use this report to determine the overall balance of money coming into and out of your accounts receivable and accounts payable businesses.

Parameters:

  • timeframe (int32)

    Number of days of data to include for the Cash Flow Report (default is 30 days from today)



33
34
35
36
37
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 33

def cash_flow(timeframe:)
    path = "/api/v1/Reports/cashflow"
    params = {:timeframe => timeframe}
    @connection.request(:get, path, nil, params)
end

#cash_flow_statement_report(start_date:, end_date:, app_enrollment_id:, column_option:, display_depth:) ⇒ Object

Generates a cash flow statement for the given time range.

Parameters:

  • start_date (date-time)

    The start date of the report

  • end_date (date-time)

    The end date of the report

  • app_enrollment_id (uuid)

    The app enrollment id of the app enrollment whose data will be used.

  • column_option (string)

    The desired column splitting of the report data. An empty string or anything unrecognized will result in only totals being displayed. Options are as follows: By Period - a column for every month/fiscal period within the reporting dates Quarterly - a column for every quarter within the reporting dates Annually - a column for every year within the reporting dates

  • display_depth (ReportDepth)

    The desired row splitting of the report data. Options are as follows: 0 - combine all accounts by their classification 1 - combine all accounts by their category 2 - combine all accounts by their subcategory 3 - display all accounts



244
245
246
247
248
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 244

def cash_flow_statement_report(start_date:, end_date:, app_enrollment_id:, column_option:, display_depth:)
    path = "/api/v1/Reports/cash-flow-statement"
    params = {:startDate => start_date, :endDate => end_date, :appEnrollmentId => app_enrollment_id, :columnOption => column_option, :displayDepth => display_depth}
    @connection.request(:get, path, nil, params)
end

#daily_sales_outstanding(report_date:) ⇒ Object

Retrieves a current Daily Sales Outstanding (DSO) report for this account.

Daily Sales Outstanding, or DSO, is a metric that indicates the average number of days that it takes for an invoice to be fully paid. You can use this report to identify whether a company is improving on its ability to collect on invoices.

Parameters:

  • report_date (date-time)

    Optional: Specify the specific report date to generate the from (default UTC now)



57
58
59
60
61
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 57

def daily_sales_outstanding(report_date:)
    path = "/api/v1/Reports/daily-sales-outstanding"
    params = {:reportDate => report_date}
    @connection.request(:get, path, nil, params)
end

#days_payable_outstandingObject

Retrieves a current Days Payable Outstanding (DPO) report for this account.

Days payable outstanding (DPO) is a financial ratio that indicates the average time (in days) that a company takes to pay its bills to its trade creditors, which may include suppliers, vendors, or financiers.



68
69
70
71
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 68

def days_payable_outstanding()
    path = "/api/v1/Reports/daily-payable-outstanding"
    @connection.request(:get, path, nil, nil)
end

#days_payable_outstanding_summary(report_date:, filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Retrieves a summary for each vendor that includes a count of their outstanding bills, the total amount outstanding, and their daily payable outstanding value.

Days payable outstanding (DPO) is a financial ratio that indicates the average time (in days) that a company takes to pay its bills to its trade creditors, which may include suppliers, vendors, or financiers.

More information on querying can be found on the [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight) page on the Lockstep Developer website.

Parameters:

  • report_date (date-time)

    The date the outstanding values are calculated on. Should be either the current day or the end of a previous quarter.

  • filter (string)

    The filter for this query. See [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight)

  • include_param (string)

    To fetch additional data on this object, specify the list of elements to retrieve. No collections are currently available but may be offered in the future

  • order (string)

    The sort order for the results, in the [Searchlight order syntax](github.com/tspence/csharp-searchlight).

  • page_size (int32)

    The page size for results (default 250, maximum of 500)

  • page_number (int32)

    The page number for results (default 0)



263
264
265
266
267
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 263

def days_payable_outstanding_summary(report_date:, filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Reports/daily-payable-outstanding-summary"
    params = {:reportDate => report_date, :filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#days_payable_outstanding_summary_total(report_date:) ⇒ Object

Retrieves total number of vendors, bills, the total amount outstanding, and the daily payable outstanding value for a group.

Days payable outstanding (DPO) is a financial ratio that indicates the average time (in days) that a company takes to pay its bills to its trade creditors, which may include suppliers, vendors, or financiers.

Parameters:

  • report_date (date-time)

    The date the outstanding values are calculated on. Should be either the current day or the end of a previous quarter.



275
276
277
278
279
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 275

def days_payable_outstanding_summary_total(report_date:)
    path = "/api/v1/Reports/daily-payable-outstanding-summary-total"
    params = {:reportDate => report_date}
    @connection.request(:get, path, nil, params)
end

#income_statement_report(start_date:, end_date:, app_enrollment_id:, column_option:, display_depth:, comparison_period:, show_currency_difference:, show_percentage_difference:) ⇒ Object

Generates an Income Statement for the given time range.

Parameters:

  • start_date (date-time)

    The start date of the report

  • end_date (date-time)

    The end date of the report

  • app_enrollment_id (uuid)

    The app enrollment id of the app enrollment whose data will be used.

  • column_option (string)

    The desired column splitting of the report data. An empty string or anything unrecognized will result in only totals being displayed. Options are as follows: By Period - a column for every month/fiscal period within the reporting dates Quarterly - a column for every quarter within the reporting dates Annually - a column for every year within the reporting dates

  • display_depth (ReportDepth)

    The desired row splitting of the report data. For Income Statements, the minimum report depth is 1. Options are as follows: 1 - combine all accounts by their category 2 - combine all accounts by their subcategory 3 - display all accounts

  • comparison_period (string)

    Add a column for historical data with the following options and use showCurrencyDifference and/or show percentageDifference to display a comparison of that historical data to the report period. Options are as follows (note for YTD the data will be compared as a percentage of YTD and showCurrencyDifference and showPercentageDifference should not be used): “PP” - previous period (will show the previous quarter or year if Quarterly or Annually is chosen for columnOption) “PY” - previous year (the same date range as the report, but for the year prior) “YTD” - year to date (the current financial year to the current period)

  • show_currency_difference (boolean)

    A boolean to turn on a currency based difference between the reporting period and the comparison period.

  • show_percentage_difference (boolean)

    A boolean to turn on a percent based difference between the reporting period and the comparison period.



213
214
215
216
217
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 213

def income_statement_report(start_date:, end_date:, app_enrollment_id:, column_option:, display_depth:, comparison_period:, show_currency_difference:, show_percentage_difference:)
    path = "/api/v1/Reports/income-statement"
    params = {:startDate => start_date, :endDate => end_date, :appEnrollmentId => app_enrollment_id, :columnOption => column_option, :displayDepth => display_depth, :comparisonPeriod => comparison_period, :showCurrencyDifference => show_currency_difference, :showPercentageDifference => show_percentage_difference}
    @connection.request(:get, path, nil, params)
end

#invoice_aging_report(company_id:, recalculate:, currency_code:, currency_provider:, buckets:, ap_report:) ⇒ Object

The Aging Report contains information about the total dollar value of invoices broken down by their age. Last default or specified bucket treated as a catch all bucket for values that fit in that bucket or beyond.

You can specify viewing parameters for the aging report such as currency code and date bucket configuration. You can also view aging data for an entire account or a specific company.

This information is recalculated when invoice data changes. After each invoice data change occurs, Lockstep queues up a calculation based on the current invoice data at that time. This information is calculated and persisted for each customer so that the report will be available quickly.

To force a recalculation of aging data, specify the ‘recalculate` option. Note that forcing a recalculation will slow your API response time.

Parameters:

  • company_id (uuid)

    Company aging buckets are filtered by (all company aging returned if not company specified)

  • recalculate (boolean)

    Force api to recalculate aging data, cached data may be returned when set to false

  • currency_code (string)

    Currency aging buckets are converted to (all aging data returned without currency conversion if no currency is specified)

  • currency_provider (string)

    Currency provider currency rates should be returned from to convert aging amounts to (default Lockstep currency provider used if no data provider specified)

  • buckets (int32)

    Customized buckets used for aging calculations (default buckets [0,30,60,90,120,180] will be used if buckets not specified)

  • ap_report (boolean)

    A boolean to turn on AP Aging reports



152
153
154
155
156
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 152

def invoice_aging_report(company_id:, recalculate:, currency_code:, currency_provider:, buckets:, ap_report:)
    path = "/api/v1/Reports/aging"
    params = {:CompanyId => company_id, :Recalculate => recalculate, :CurrencyCode => currency_code, :CurrencyProvider => currency_provider, :Buckets => buckets, :ApReport => ap_report}
    @connection.request(:get, path, nil, params)
end

#payables_coming_dueObject

Retrieves payable amount due for 4 time buckets (Today, 7 Days from Today, 14 Days from Today, and 30 Days from Today).



76
77
78
79
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 76

def payables_coming_due()
    path = "/api/v1/Reports/payables-coming-due"
    @connection.request(:get, path, nil, nil)
end

#payables_coming_due_header(report_date:) ⇒ Object

Retrieves total number of vendors, bills, the total amount outstanding, for a group.

Parameters:

  • report_date (date-time)

    The date the outstanding values are calculated on. Should be either the current day, 7 days after the current day, 14 days after the current day, or 30 days after the current day.



99
100
101
102
103
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 99

def payables_coming_due_header(report_date:)
    path = "/api/v1/Reports/payables-coming-due-header"
    params = {:reportDate => report_date}
    @connection.request(:get, path, nil, params)
end

#payables_coming_due_summary(filter:, include_param:, order:, page_size:, page_number:) ⇒ Object

Payables coming due represents the amount of cash required to pay vendor bills based on the due dates of the bills. Each bucket represents total amount due within the time period based on open Payables as of today.

Parameters:

  • filter (string)

    The filter for this query. See [Searchlight Query Language](developer.lockstep.io/docs/querying-with-searchlight)

  • include_param (string)

    To fetch additional data on this object, specify the list of elements to retrieve. No collections are currently available but may be offered in the future

  • order (string)

    The sort order for the results, in the [Searchlight order syntax](github.com/tspence/csharp-searchlight).

  • page_size (int32)

    The page size for results (default 250, maximum of 500)

  • page_number (int32)

    The page number for results (default 0)



89
90
91
92
93
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 89

def payables_coming_due_summary(filter:, include_param:, order:, page_size:, page_number:)
    path = "/api/v1/Reports/payables-coming-due-summary"
    params = {:filter => filter, :include => include_param, :order => order, :pageSize => page_size, :pageNumber => page_number}
    @connection.request(:get, path, nil, params)
end

#payables_summary_report(timeframe:) ⇒ Object

Retrieves a current Payables Summary report for this account.

The Payables Summary report indicates the amount of payments sent and bills received within a given timeframe. You can use this report to determine the overall balance of money coming into and out of your accounts receivable and accounts payable businesses.

Parameters:

  • timeframe (int32)

    Number of days of data to include for the Payables Summary Report (default is 30 days from today)



45
46
47
48
49
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 45

def payables_summary_report(timeframe:)
    path = "/api/v1/Reports/payables-summary"
    params = {:timeframe => timeframe}
    @connection.request(:get, path, nil, params)
end

#risk_ratesObject

Retrieves a current Risk Rate report for this account.

Risk Rate is a metric that indicates the percentage of total AR balance left unpaid after 90 days. You can use this report to identify the percentage of invoice value that is not being collected in a timely manner.



110
111
112
113
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 110

def risk_rates()
    path = "/api/v1/Reports/risk-rates"
    @connection.request(:get, path, nil, nil)
end

#trial_balance_report(start_date:, end_date:, app_enrollment_id:) ⇒ Object

Generates a Trial Balance Report for the given time range.

Parameters:

  • start_date (date-time)

    The start date of the report

  • end_date (date-time)

    The end date of the report

  • app_enrollment_id (uuid)

    The app enrollment id of the app enrollment whose data will be used.



196
197
198
199
200
# File 'lib/lockstep_sdk/clients/reports_client.rb', line 196

def trial_balance_report(start_date:, end_date:, app_enrollment_id:)
    path = "/api/v1/Reports/trial-balance"
    params = {:startDate => start_date, :endDate => end_date, :appEnrollmentId => app_enrollment_id}
    @connection.request(:get, path, nil, params)
end