Example #1
0
}
/*******************************************
 * Example; create new stock item
 *******************************************/
// 1) Add new stock item
$response = $api->addStockItem(array('name' => 'Stock item example', 'description' => 'Example stock item description.', 'sku' => 'STOCK' . mt_rand(100, 999) . 'ID', 'unit_price' => round(M_PI, 2), 'vat' => 20, 'stock' => 10));
if (!empty($bench)) {
    _debug($response, 'Add stock item');
}
/******************************************
 * Pridame pohyb na sklade
 ******************************************/
$stock_item_id = 0;
if (!empty($stock_item_id)) {
    // Add new stock movement
    $response = $api->addStockMovement(array('stock_item_id' => $stock_item_id, 'quantity' => 50, 'note' => 'Stock movement example from API'));
    if (!empty($bench)) {
        _debug($response, 'Add stock movement');
    }
}
$tend = microtime(true);
if (!empty($bench)) {
    // output time
    echo '<div style="background:red;color:white;padding:10px;margin-top:10px;">Bench is ON. Microtime in secs ~ <b>' . round($tend - $tstart, $time_round) . 's</b><br></div>';
}
/***********************************************
 * dump in readable format
 ***********************************************/
function _debug($obj, $title = '')
{
    if (!is_array($obj)) {