Interbranch

Make sure you familiarize yourself with the following important concepts of our API:
Prices and Quantities, Products and Articles, Sync Markers
After taking the time to understand these concepts, you will much better understand the basics of our API.

Introduction

Using these API functions, you can interact with the MplusKASSA interbranch workflow. The interbranch system was created to facilitate transfer of stock from one branch to another branch within the same MplusKASSA administration. The full interbranch workflow is as follows:

create order saveInterbranchOrder Order claim claimInterbranchOrder ship shipInterbranchOrder Shipment deliver deliverInterbranchShipment Delivery

There are some shortcuts available in this workflow. For instance, you can immediately create a shipment or a delivery, which will automatically create an order or an order and a shipment respectively.

create shipment saveInterbranchShipment Order (automatic) Shipment deliver deliverInterbranchShipment Delivery

create delivery saveInterbranchDelivery Order (automatically) Shipment (automatically) Delivery

Contents

getInterbranchOrders
Retrieving interbranch orders


getInterbranchShipments
Retrieving interbranch shipments


getInterbranchDeliveries
Retrieving interbranch deliveries


saveInterbranchOrder
Create or modify an interbranch order

 1,
  'toBranchNumber' => 2,
  'employeeNumber' => 999999,
  'reference' => 'Interbranch order from branch 1 to 2',
  'interbranchOrderLineList' => array(
    array(
      'articleNumber' => 1,
      // this quantity + this decimalPlaces means an actual quantity of 2.5
      'quantity' => 25,
      'decimalPlaces' => 1,
    ),
  ),
);

// Then we call the saveInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_order = $mplusqapiclient->saveInterbranchOrder($interbranch_order))) {
    // Success, we show the created interbranch_order
    print_r($interbranch_order);
    exit(sprintf('Saved interbranch order %d.%d.', $interbranch_order['interbranchOrderNumber']['year'], $interbranch_order['interbranchOrderNumber']['number']));
  } else {
    exit('Unable to save interbranch order.');
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

claimInterbranchOrder
Claim an interbranch order

 2018,
  'number' => 1,
);

$branch_number = 2;
$workplace_number = 1;
$employee_number = 999999;

// Then we call the claimInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_order = $mplusqapiclient->claimInterbranchOrder($interbranch_order_number, $branch_number, $workplace_number, $employee_number))) {
    // Success, we show the claimed interbranch_order
    print_r($interbranch_order);
    exit(sprintf('Claimed interbranch order %d.%d.', $interbranch_order['interbranchOrderNumber']['year'], $interbranch_order['interbranchOrderNumber']['number']));
  } else {
    exit('Unable to claiminterbranch order.');
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

releaseInterbranchOrder
Release an interbranch order

 2018,
  'number' => 1,
);

// Then we call the releaseInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_order = $mplusqapiclient->releaseInterbranchOrder($interbranch_order_number))) {
    // Success, we show the released interbranch_order
    print_r($interbranch_order);
    exit(sprintf('Released interbranch order %d.%d.', $interbranch_order['interbranchOrderNumber']['year'], $interbranch_order['interbranchOrderNumber']['number']));
  } else {
    exit('Unable to release interbranch order.');
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

shipInterbranchOrder
Ship an interbranch order, which creates a shipment

 2018,
  'number' => 1,
);

// Then we call the shipInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_shipment = $mplusqapiclient->shipInterbranchOrder($interbranch_order_number))) {
    // Success, we show the interbranch_shipment
    print_r($interbranch_shipment);
    exit(sprintf('Shipped interbranch order %d.%d (created interbranch shipment %d.%d).', $interbranch_shipment['interbranchOrderNumber']['year'], $interbranch_shipment['interbranchOrderNumber']['number'], $interbranch_shipment['interbranchShipmentNumber']['year'], $interbranch_shipment['interbranchShipmentNumber']['number']));
  } else {
    exit(sprintf('Unable to ship interbranch order %d.%d.', $interbranch_order_number['year'], $interbranch_order_number['number']));
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

deliverInterbranchShipment
Deliver an interbranch shipment, which creates a delivery

 2018,
  'number' => 1,
);

// Then we call the deliverInterbranchShipment() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_delivery = $mplusqapiclient->deliverInterbranchShipment($interbranch_shipment_number))) {
    // Success, we show the interbranch_delivery
    print_r($interbranch_delivery);
    exit(sprintf('Shipped interbranch shipment %d.%d (created interbranch delivery %d.%d).', $interbranch_delivery['interbranchShipmentNumber']['year'], $interbranch_delivery['interbranchShipmentNumber']['number'], $interbranch_delivery['interbranchDeliveryNumber']['year'], $interbranch_shipment['interbranchDeliveryNumber']['number']));
  } else {
    exit(sprintf('Unable to deliver interbranch shipment %d.%d.', $interbranch_shipment_number['year'], $interbranch_shipment_number['number']));
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

saveInterbranchShipment
Creates an interbranch shipment, which automatically creates an order

 1,
  'toBranchNumber' => 2,
  'employeeNumber' => 999999,
  'reference' => 'Interbranch shipment from branch 1 to 2',
  'interbranchShipmentLineList' => array(
    array(
      'articleNumber' => 1,
      // this quantity + this decimalPlaces means an actual quantity of 2.5
      'quantity' => 25,
      'decimalPlaces' => 1,
    ),
  ),
);

// Then we call the saveInterbranchShipment() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_shipment = $mplusqapiclient->saveInterbranchShipment($interbranch_shipment))) {
    // Success, we show the created interbranch_shipment
    print_r($interbranch_shipment);
    exit(sprintf('Saved interbranch shipment %d.%d.', $interbranch_shipment['interbranchShipmentNumber']['year'], $interbranch_shipment['interbranchShipmentNumber']['number']));
  } else {
    exit('Unable to save interbranch shipment.');
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

saveInterbranchDelivery
Creates an interbranch delivery, which automatically creates an order and a shipment

 1,
  'toBranchNumber' => 2,
  'employeeNumber' => 999999,
  'reference' => 'Interbranch delivery from branch 1 to 2',
  'interbranchShipmentLineList' => array(
    array(
      'articleNumber' => 1,
      // this quantity + this decimalPlaces means an actual quantity of 2.5
      'quantity' => 25,
      'decimalPlaces' => 1,
    ),
  ),
);

// Then we call the saveInterbranchDelivery() function wrapped in a try/catch block to intercept any exceptions.
try {
  if (false !== ($interbranch_delivery = $mplusqapiclient->saveInterbranchDelivery($interbranch_delivery))) {
    // Success, we show the created interbranch_delivery
    print_r($interbranch_delivery);
    exit(sprintf('Saved interbranch delivery %d.%d.', $interbranch_delivery['interbranchDeliveryNumber']['year'], $interbranch_delivery['interbranchDeliveryNumber']['number']));
  } else {
    exit('Unable to save interbranch delivery.');
  }
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}