Business Analytics

In addition to entering transactions in QuickBooks Online, a small business often generates financial reports such as Balance Sheet or Profit and Loss to understand the financial condition of the business. These reports not only provide raw figures but can also give a much clearer insight into how the company is performing. These data helps the small business understand how their business is performing, areas that need attention, and things the business seems to be doing great with.

As with any business, no two businesses are alike and hence QuickBooks Online Reports provides the ability to extract data and customize it in a way that can be useful for the business.

Reports can be summarized by Customers or Vendors, Items or Departments and can also be queried for a specific time period.

Balance Sheet

A balance sheet reports a company’s assets, liabilities and shareholders’ equity at a specific point in time, and provides a basis for computing rates of return and evaluating its capital structure. It is a financial statement that provides a snapshot of what a company owns and owes, as well as the amount invested by shareholders.

Profit And Loss

A profit and loss statement or income statement, provides information on the operation of the enterprise. These include sales and the various expenses incurred during the stated period.

Attributes used in thisconcept Description
start_date The start date for the report, if not set the default date macro of ‘Year to date’ is used
end_date The end date for the report, if not set the default date macro of ‘Year to date’ is used
summarize_column_by The criteria by which the report result is grouped. Reports can be summarized by Customer, Vendor, Classes, Departments, Employees, Items and Total
Step by Step guide (or README)

Here is a quick tutorial to query a balancesheet and profit and loss report. In addition, this example handles querying a report for a specific date period and summarize the results by Customer.

  1. Initialize the ReportService class.
  2. Generate a report by calling the executeReport method.
  3. Set the start_date and end_date of the service.
  4. Generate a report again by calling the executeReport method.
  5. Set the summarized_column_by field to ‘Customer’.
  6. Generate a report again by calling the executeReport method.
Sample Code

.NET

Java

PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
//Initialize OAuth2RequestValidator and ServiceContext
ServiceContext serviceContext = base.IntializeContext(realmId);
ReportService defaultReportService = new ReportService(serviceContext);

//Query default Profit and loss report
Report defaultPnLReport = defaultReportService.ExecuteReport("ProfitAndLoss");

//Query default BalanceSheet report
Report defaultBalanceSheet = defaultReportService.ExecuteReport("BalanceSheet");

//Run report for a specific time period
defaultReportService.start_date = "2018-01-01";
defaultReportService.end_date = "2018-04-15";
defaultPnLReport = defaultReportService.ExecuteReport("ProfitAndLoss");
defaultBalanceSheet = defaultReportService.ExecuteReport("BalanceSheet");

//Run report summarized by customer
defaultReportService.summarize_column_by = "Customers";
defaultPnLReport = defaultReportService.ExecuteReport("ProfitAndLoss");
defaultBalanceSheet = defaultReportService.ExecuteReport("BalanceSheet");

Note: click here to view the complete code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//create oauth object
OAuth2Authorizer oauth = new OAuth2Authorizer(accessToken);
//create context
Context context = new Context(oauth, ServiceType.QBO, realmId);
//create ReportService
ReportService service = new ReportService(context);

//Query default Profit and loss report
Report defaultPnLReport = service.executeReport(ReportName.PROFITANDLOSS.toString());

//Query default BalanceSheet report
Report defaultBalanceSheet = service.executeReport(ReportName.BALANCESHEET.toString());

//Run report for a specific time period
service.setStart_date("2018-01-01");
service.setEnd_date("2018-04-15");
defaultBalanceSheet = service.executeReport(ReportName.BALANCESHEET.toString());
defaultPnLReport = service.executeReport(ReportName.PROFITANDLOSS.toString());

//Run report summarized by customer
service.setSummarize_column_by("Customers");
defaultBalanceSheet = service.executeReport(ReportName.BALANCESHEET.toString());
defaultPnLReport = service.executeReport(ReportName.PROFITANDLOSS.toString());

Note: click here to view the complete code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<?php
//create dataservice
$dataService->updateOAuth2Token($accessToken);

//Initialize the Report service from the data service context
$serviceContext = $dataService->getServiceContext();
$reportService = new ReportService($serviceContext);

//Query default Profit and loss report
$profitAndLossReport = $reportService->executeReport("ProfitAndLoss");

//Query default BalanceSheet report
$balancesheet = $reportService->executeReport("BalanceSheet");

//Run report summarized by customer
$reportService->setSummarizeColumnBy("Customers");
$profitAndLossReport = $reportService->executeReport("ProfitAndLoss");
$balancesheet = $reportService->executeReport("BalanceSheet");
?>

Note: click here to view the complete code.

What’s next