Home /Tutorials /Get report information
Get report information

Each report in WellnessLiving returns a different set of information. The examples in this tutorial will show some of the pertinent data reports can return.

The All Sales Report is an example of a WellnessLiving report containing information about all purchases made in a business. The report can be filtered to return results for specified dates and date ranges.

// Get the All Sales Report.
$o_report=new DataModel($o_config);
$o_report->cookieSet($o_notepad->cookieGet()); // Keep cookies to keep session.
// Set the values.
$o_report->id_report_group=WlReportGroupSid::MONTH;
$o_report->id_report=WlReportSid::PURCHASE_ITEM_ACCRUAL_CASH;
$o_report->k_business='2149'; // Put your business key here.
// Set the filter to a specific date.
$o_report->filterSet([
  'dt_date' => '2018-09-01'
]);
// Perform the request.
$o_report->get();
// The example code will return each purchase's date and cost, the purchaser UID and their name, and the item name.
$i=0;
foreach($o_report->a_data['a_row'] as $a_row)
{
  $i++;
  echo $i.'. '.$a_row['dt_date'].' '.$a_row['f_total']['m_amount'].' '.$a_row['o_user']['text_name'].' '.$a_row['s_item']."\r\n";
}

The All Clients Report is a report that returns a list of all a business’s clients. Keep in mind that there are two different versions of the All Clients Report available through the SDK. The first version of the report can be accessed in WellnessLiving by selecting Clients in the App Drawer, which returns a list of all a business’s clients. Clients can be filtered by client type or location.

// Get the All Clients Report.
$o_report=new \WellnessLiving\Wl\Report\DataModel($o_config);
$o_report->cookieSet($o_notepad->cookieGet()); // Keep cookies to keep session.
// Set the values.
$o_report->id_report_group=WlReportGroupSid::MONTH;
$o_report->id_report=WlReportSid::LOGIN_LIST_ALL;
$o_report->k_business='45740'; // Put your business key here.

// Filter for active pass holders and active members and any locations.
$o_report->filterSet([
  'a_login_type' => ['223324','223323'],
  'k_location' => ''
]);
// The example code will return each client's UID, first name, last name, member ID, and email.
$o_report->get();
$i=0;
foreach($o_report->a_data['a_row'] as $a_row)
{
  $i++;
  printf("%3d %3s %15s %15s %15s %s\r\n",$i,$a_row['uid'],$a_row['a_data_api']['s_firstname'],$a_row['a_data_api']['s_lastname'],$a_row['member'],$a_row['a_data_api']['s_mail']);}

The second version of the All Clients Report can be accessed by selecting Reports in the App Drawer, and then selecting the All Clients Report from the Clients report group. This returns a list of a business’s clients filtered by their join date.

// Gets client information for specific dates.
$o_report = new \WellnessLiving\Wl\Report\DataModel($o_config);
$o_report->cookieSet($o_notepad->cookieGet()); // Keep cookies to keep session.

$o_report->id_report=\WellnessLiving\Wl\Report\WlReportSid::LOGIN_LIST;
$o_report->k_business='2'; // Put your business key here.
// Set the filter to a specific date.
$o_report->filterSet([
 'dt_date' => '2020-02-24',
 'sid_report_date' => 'month' // The range of results to return. Values will be for the specified month (February in this case). Values are the names of the WlReportGroupSid constants using lowercase.
]);

// Perform the request.
$o_report->get();
// The example code will return each client's first name, last name, email, and join date.
$i=0;
foreach($o_report->a_data['a_row'] as $a_row)
{
 $i++;
 echo $i.'. '.$a_row['a_data_api']['s_firstname'].' '.$a_row['a_data_api']['s_lastname'];
 echo '    '.$a_row['a_data_api']['s_mail'].'    '.$a_row['dt_since_local']['dt_date']."\n";
}

The Batch Report will show all the credit card transactions made on a given date. Credit card transactions are usually batched and sent to the payment processor before that money is made available to the business.

// Get the Batch Report.
$o_report=new \WellnessLiving\Wl\Report\DataModel($o_config);
$o_report->cookieSet($o_notepad->cookieGet()); // Keep cookies to keep session.

$o_report->id_report=WlReportSid::PAY_TRANSACTION_BATCH;
$o_report->k_business='49344'; // Put your business key here
$o_report->filterSet([
// This date is used to specify the day in question.
'dt_date' => '2023-03-21',
]);

$o_report->get();

// The example code will return each batch record's date, amount, card system, and attached note (if applicable).
$i=0;
foreach($o_report->a_data['a_row'] as $a_row)
{
 $i++;
// Print the date amount and type of transaction in the batch report.
echo $i.' '.$a_row['dt_date'].' '.$a_row['f_debit']['m_amount'].' '.$a_row['s_card_system']['text_text']."\n";
}