<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); //if you just pass an id, will request a lookup by id try { $item = $api->getItems('0bf0d265-f083-487a-948e-863580f3f94c'); echo "Item found: " . $item->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $items = $api->getItems(array('status' => 'active', 'sort' => 'name-|status', 'limit' => '5')); foreach ($items->items as $item) { echo $item->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $sales_item_id = '5f3602b7-707f-40e2-b4c3-1dd7a13ed4f1'; try { //if you just pass an id, will request a lookup by id $salesitemdetail = $api->getSalesItemsDetails($sales_item_id, '40dcfffb-f9c6-40e8-b0ea-db4fa979777f'); echo "Prep Item Detail found with quantity of: " . $salesitemdetail->quantity . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { $salesitemdetails = $api->getSalesItemsDetails($sales_item_id); foreach ($salesitemdetails->salesitemsdetails as $salesitemdetail) { echo $salesitemdetail->quantity . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { //only fields required are sales_date, location is based off of api key $salesHeader = $api->createSalesSheet(array("sales_date" => '01-01-2012')); echo "The new sales sheet id is: " . $salesHeader->id . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $sales_id = '780dea11-ea9d-454f-8027-5d4f413e0833'; try { $values = array('quantity' => '9'); //using id $salesDetail = $api->updateSalesDetail($sales_id, '83e06af6-72a6-4812-b8c1-91f82effed01', $values); echo "Sales detail new quantity is:" . $salesDetail->quantity . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //using plu $values = array('quantity' => '11'); $salesDetail = $api->updateSalesDetail($sales_id, '1234', $values, true); echo "Sales detail new quantity is:" . $salesDetail->quantity . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { //if you just pass an id, will request a lookup by id $supercat = $api->getSuperCategories('53'); echo "Super Category found: " . $supercat->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $supercats = $api->getSuperCategories(array('name' => 'food', 'limit' => '5')); foreach ($supercats->super_categories as $supercat) { echo $supercat->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $sales_id = '780dea11-ea9d-454f-8027-5d4f413e0833'; try { //if you just pass an id, will request a lookup by id $salesDetail = $api->getSalesDetail($sales_id, '83e06af6-72a6-4812-b8c1-91f82effed01'); echo "Detail Found:" . $salesDetail->sales_item_name . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if want to search by plu $salesDetail = $api->getSalesDetailByPlu($sales_id, '1234'); echo "Detail Found:" . $salesDetail->sales_item_name . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $salesDetail = $api->getSalesDetail($sales_id, array('plu_num' => '1234', 'sort' => 'sales_item_name', 'limit' => '5')); foreach ($salesDetail->salesdetails as $detail) { echo $detail->sales_item_name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); //if you just pass an id, will request a lookup by id try { $prepitem = $api->getPrepItems('5af926d8-3c28-4509-881b-6fdf8e542ef7'); echo "Prep Item found: " . $prepitem->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $prepitems = $api->getPrepItems(array('status' => 'active', 'sort' => 'name-|status', 'limit' => '5')); foreach ($prepitems->prepitems as $prepitem) { echo $prepitem->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $prep_item_id = '5af926d8-3c28-4509-881b-6fdf8e542ef7'; try { //if you just pass an id, will request a lookup by id $prepitemdetail = $api->getPrepItemsDetails($prep_item_id, '515b8605-4cb8-4d6d-ba88-7a04fc51f530'); echo "Prep Item Detail found with quantity of: " . $prepitemdetail->quantity . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { $prepitemdetails = $api->getPrepItemsDetails($prep_item_id); foreach ($prepitemdetails->prepitemsdetails as $prepitemdetail) { echo $prepitemdetail->quantity . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { $salesDetail = $api->createSalesDetail('780dea11-ea9d-454f-8027-5d4f413e0833', array('plu_num' => '1234', 'quantity' => '6', 'price' => '5.99')); echo "The new sales detail id is: " . $salesDetail->id . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $prep_item_id = '5af926d8-3c28-4509-881b-6fdf8e542ef7'; try { //if you just pass an id, will request a lookup by id $prepitemuom = $api->getPrepItemsUoms($prep_item_id, '839ed28d-8052-4d52-b036-f47d8f447a55'); echo "Prep Item UOM found: " . $prepitemuom->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //will return all uoms $prepitemsuoms = $api->getPrepItemsUoms($prep_item_id); foreach ($prepitemsuoms->prepitemsuoms as $uom) { echo $uom->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { //if you just pass an id, will request a lookup by id $cat = $api->getSalesCategories('198'); echo "Sales Category found: " . $cat->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $cats = $api->getSalesCategories(array('name' => 'wine', 'limit' => '5')); foreach ($cats->salescategories as $cat) { echo $cat->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { //only need id $success = $api->deleteSalesSheet('811b1648-39dd-49e8-965a-ffd4c040e806'); echo "The sales sheet is deleted.\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { $prepItemsCosts = $api->getPrepItemsCosts('5af926d8-3c28-4509-881b-6fdf8e542ef7'); echo $prepItemsCosts->prepitemcost->cost . "\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { $values = array('status' => 'closed'); $salesHeader = $api->updateSalesSheet('811b1648-39dd-49e8-965a-ffd4c040e806', $values); echo "Sales sheet updated!\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); //if you just pass an id, will request a lookup by id try { $salesitem = $api->getSalesItems('5f3602b7-707f-40e2-b4c3-1dd7a13ed4f1'); echo "Sales Item found: " . $salesitem->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $salesitems = $api->getSalesItems(array('status' => 'active', 'sort' => 'name-', 'limit' => '5')); foreach ($salesitems->salesitems as $salesitem) { echo $salesitem->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { //if you just pass an id, will request a lookup by id $cat = $api->getCategories('250'); echo "Category found: " . $cat->name . " \n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $cats = $api->getCategories(array('name' => 'food', 'limit' => '5')); foreach ($cats->categories as $cat) { echo $cat->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { $itemsUOMs = $api->getItemsUOMs('6f826e5a-b7e1-4f77-9e12-1dd9845c363b', array('limit' => '1')); foreach ($itemsUOMs->itemsuoms as $uom) { echo 'Name:' . $uom->name . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $sales_id = 'f17253ed-7a51-434d-a6ff-1f31ded10a92'; try { //using id $salesDetail = $api->deleteSalesDetail($sales_id, '5be1935f-9804-4ecb-a6ed-b85109777cdd'); echo "Sales detail delete successful!\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //using plu $salesDetail = $api->deleteSalesDetail($sales_id, '12345', true); echo "Sales detail delete successful!\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); try { //if you just pass an id, will request a lookup by id $salesHeader = $api->getSalesSheet('811b1648-39dd-49e8-965a-ffd4c040e806'); echo "Doc Number {$salesHeader->docnum} found!\n"; } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } try { //if you pass an array, will do a search $salesHeader = $api->getSalesSheet(array('status' => 'open', 'sales_date' => '07-00-0000', 'sort' => 'sales_date-|status', 'limit' => '5')); foreach ($salesHeader->sales as $sale) { echo $sale->docnum . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; } ?>
<?php require_once '../../lib/RSentry.php'; $api = new RSentry('testkey'); $sales_id = '780dea11-ea9d-454f-8027-5d4f413e0833'; try { //you just pass a sales_header_id //add true/false (defaults to false if you don't pass anything) for if you want super categories as well $salesDetail = $api->getSalesDetailByCategory($sales_id, true); foreach ($salesDetail->categories as $cat) { echo $cat->name . ':' . $cat->sales . "\n"; } foreach ($salesDetail->super_categories as $super) { echo $super->name . ':' . $super->sales . "\n"; } } catch (RSentryException $e) { echo "Exception: {$e->getMessage()} code: {$e->getCode()}\n"; }