diff --git a/README.md b/README.md index a7bac42..f770969 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The package is fairly simple. All you need to do is install this package via [co **Installation** 1. `composer require qbil-software/read-soft-online` 2. `require_once 'vendor/autoload.php';` -3. `$client = new Client('insert_api_key_here');` +3. `$client = new Qbil\ReadSoftOnline\Client('insert_api_key_here');` 4. Authenticate using `$client->authenticate('rso username here', 'rso password here')` diff --git a/src/Qbil/Models/Invoice.php b/src/Qbil/Models/Invoice.php index 135f405..1e3de05 100644 --- a/src/Qbil/Models/Invoice.php +++ b/src/Qbil/Models/Invoice.php @@ -23,6 +23,7 @@ public function __construct(Document $document) $this->theirVatRegistration = $this->extract($document->HeaderFields, 'suppliervatregistrationnumber'); $this->ourVatRegistration = $this->extract($document->HeaderFields, 'CustomerVATRegistrationNumber'); $this->orderNumber = $this->extract($document->HeaderFields, 'invoiceordernumber'); + $this->contract = $this->extract($document->HeaderFields, 'Inkoopcontract'); foreach (array_column($this->extract($document->Tables, 'LineItem', 'TableRows'), 'ItemFields') as $line) { $invoiceLine = new InvoiceLine( @@ -30,6 +31,7 @@ public function __construct(Document $document) $this->extract($line, 'LIT_DeliveredQuantity'), $this->extract($line, 'LIT_VatExcludedAmount'), $this->extract($line, 'LIT_UnitPriceAmount'), + $this->extract($line, 'LIT_Inkoopcontract'), $document->DocumentSubType ); @@ -48,6 +50,7 @@ public function __construct(Document $document) private $theirVatRegistration; private $ourVatRegistration; private $orderNumber; + private $contract; private $invoiceLines = []; public function addInvoiceLine(InvoiceLine $invoiceLine) @@ -155,4 +158,12 @@ public function getOrder() { return $this->orderNumber; } + + /** + * @return mixed + */ + public function getContract() + { + return $this->contract; + } } diff --git a/src/Qbil/Models/InvoiceLine.php b/src/Qbil/Models/InvoiceLine.php index 3a0734f..c832c87 100644 --- a/src/Qbil/Models/InvoiceLine.php +++ b/src/Qbil/Models/InvoiceLine.php @@ -10,12 +10,13 @@ class InvoiceLine { - public function __construct($order, $quantity, $amount, $price, $type, $allocatedInvoice = null) + public function __construct($order, $quantity, $amount, $price, $purchaseContract, $type, $allocatedInvoice = null) { $this->order = $order; $this->quantity = $quantity; $this->amount = $amount; $this->price = $price; + $this->purchaseContract = $purchaseContract; $this->type = $type; $this->allocatedInvoice = $allocatedInvoice; } @@ -24,6 +25,7 @@ public function __construct($order, $quantity, $amount, $price, $type, $allocate private $quantity; private $amount; private $price; + private $purchaseContract; private $type; private $allocatedInvoice; @@ -84,10 +86,18 @@ public function setType($type) } /** - * @param mixed $type + * @param $allocatedInvoice */ public function setAllocatedInvoice($allocatedInvoice) { $this->allocatedInvoice = $allocatedInvoice; } + + /** + * @return mixed + */ + public function getPurchaseContract() + { + return $this->purchaseContract; + } }