{"id":66,"date":"2022-08-01T06:38:05","date_gmt":"2022-08-01T06:38:05","guid":{"rendered":"https:\/\/www.wellnessliving.com\/developer-portal\/?p=66"},"modified":"2024-11-11T03:08:41","modified_gmt":"2024-11-11T03:08:41","slug":"get-report-information","status":"publish","type":"post","link":"https:\/\/www.wellnessliving.com\/developer-portal\/tutorials\/get-report-information\/","title":{"rendered":"Retrieving report information"},"content":{"rendered":"\n<p>Each report in WellnessLiving returns a different set of information. This tutorial will show some examples of the pertinent data reports can return.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/www.wellnessliving.com\/knowledge-sharing\/knowledge-base\/all-sales-report\/\" target=\"_blank\" rel=\"noreferrer noopener\">All Sales Report<\/a> 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.<\/p>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Retrieve the All Sales Report.\n$o_report=new DataModel($o_config);\n$o_report->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n\/\/ Set the values.\n$o_report->id_report_group=WlReportGroupSid::MONTH;\n$o_report->id_report=WlReportSid::PURCHASE_ITEM_ACCRUAL_CASH;\n$o_report->k_business='2149'; \/\/ Put your business key here.\n\n\/\/ Set the filter to a specific date.\n$o_report->filterSet([\n  'dt_date' => '2020-01-01'\n]);\n\n\/\/ Perform the request.\n$o_report->get();\n\n\/\/ The example code will return each item name, purchase cost, purchase name, purchaser name, and purchaser UID.\n$i=0;\nforeach($o_report->a_data['a_row'] as $a_row)\n{\n  $i++;\n  echo $i.'. '.$a_row['dt_date'].' '.$a_row['f_total']['m_amount'].' '.$a_row['o_user']['text_name'].' '.$a_row['s_item'].\"\\r\\n\";\n}<\/pre>\n\n\n\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/www.wellnessliving.com\/knowledge-sharing\/knowledge-base\/using-the-app-drawer\/\" target=\"_blank\">All Clients Report<\/a> returns a list of all clients of a business. 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 <strong>Clients<\/strong> in the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.wellnessliving.com\/knowledge-sharing\/knowledge-base\/using-the-app-drawer\/\" target=\"_blank\">App Drawer<\/a>, which returns a list of all a business\u2019s clients. Clients can be filtered by client type or location.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Retrieve the All Clients Report.\n$o_report=new \\WellnessLiving\\Wl\\Report\\DataModel($o_config);\n$o_report->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n\/\/ Set the values.\n$o_report->id_report_group=WlReportGroupSid::MONTH;\n$o_report->id_report=WlReportSid::LOGIN_LIST_ALL;\n$o_report->k_business='45740'; \/\/ Put your business key here.\n\n\/\/ Filter for active pass holders, active members, and any locations.\n$o_report->filterSet([\n  'a_login_type' => ['223324','223323'],\n  'k_location' => ''\n]);\n\n\/\/ The example code will return each client's, first name, last name, UID, member ID, and email.\n$o_report->get();\n$i=0;\nforeach($o_report->a_data['a_row'] as $a_row)\n{\n  $i++;\n  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']);}<\/pre>\n\n\n\n<p>The second version of the All Clients Report can be accessed by selecting <strong>Reports<\/strong> in the App Drawer and then selecting the All Clients Report from the <strong>Clients<\/strong> report group. This returns a list of a business\u2019s clients filtered by their join date.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Retrieve the client information for specific dates.\n$o_report = new \\WellnessLiving\\Wl\\Report\\DataModel($o_config);\n$o_report->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n$o_report->id_report=\\WellnessLiving\\Wl\\Report\\WlReportSid::LOGIN_LIST;\n$o_report->k_business='2'; \/\/ Put your business key here.\n\n\/\/ Set the filter to a specific date.\n$o_report->filterSet([\n 'dt_date' => '2020-01-01',\n 'sid_report_date' => 'month' \/\/ The range of results to return. Values will be for the specified month (January in this case). Values are the names of the WlReportGroupSid constants using lowercase.\n]);\n\n\/\/ Perform the request.\n$o_report->get();\n\n\/\/ The example code will return each client's first name, last name, email, and join date.\n$i=0;\nforeach($o_report->a_data['a_row'] as $a_row)\n{\n $i++;\n echo $i.'. '.$a_row['a_data_api']['s_firstname'].' '.$a_row['a_data_api']['s_lastname'];\n echo '    '.$a_row['a_data_api']['s_mail'].'    '.$a_row['dt_since_local']['dt_date'].\"\\n\";\n}<\/pre>\n\n\n\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/www.wellnessliving.com\/knowledge-sharing\/knowledge-base\/batch-report\/\" target=\"_blank\">Batch Report<\/a> 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 the funds are made available to the business.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Retrieve the Batch Report.\n$o_report=new \\WellnessLiving\\Wl\\Report\\DataModel($o_config);\n$o_report->cookieSet($o_notepad->cookieGet()); \/\/ Store cookies to maintain the session.\n\n$o_report->id_report=WlReportSid::PAY_TRANSACTION_BATCH;\n$o_report->k_business='49344'; \/\/ Put your business key here.\n$o_report->filterSet([\n\/\/ This date is used to specify the day in question.\n'dt_date' => '2023-03-21',\n]);\n\n$o_report->get();\n\n\/\/ The example code will return each batch record's date, amount, card system, and attached note (if applicable).\n$i=0;\nforeach($o_report->a_data['a_row'] as $a_row)\n{\n $i++;\n\n\/\/ Print the date, amount, and type of transaction in the Batch Report.\necho $i.' '.$a_row['dt_date'].' '.$a_row['f_debit']['m_amount'].' '.$a_row['s_card_system']['text_text'].\"\\n\";\n}<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Each report in WellnessLiving returns a different set of information. This tutorial will show some examples 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,25],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts\/66"}],"collection":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":18,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":486,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/posts\/66\/revisions\/486"}],"wp:attachment":[{"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellnessliving.com\/developer-portal\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}