Introduction
Using these API functions, you will be able to request the receipts based on certain search criteria you set in the request.
Contents
Retrieving receipts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. // Then we create the request array that will contain the search criteria $request = array( // Search for receipts from August 1, 2014 up to and including August 31, 2014 'fromFinancialDate' => '2014-08-01', 'throughFinancialDate' => '2014-08-31', // Only get receipts that are booked on branch 1 'branchNumbers' => array(1), // We don't want to filter by employee, so we leave this empty 'employeeNumbers' => array(), // We don't want to filter by customer, so we leave this empty 'relationNumbers' => array(), // We only want receipts that contain an article with barcode '87123456789' 'articleBarcodes' => array('87123456789'), // We don't care about the remaining article filters 'articleNumbers' => array(), 'articleTurnoverGroups' => array(), 'articlePluNumbers' => array(), ); // Then we call the getReceipts() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($receipts_result = $mplusqapiclient->getReceipts($request))) { // Success, we show the number of found receipts exit(sprintf('Found %d receipt(s).', count($receipts_result))); } else { exit('Invalid result after running getReceipts.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |