Skip to content

Commit

Permalink
Added purchase contract to invoice and invoice line
Browse files Browse the repository at this point in the history
v1.4
Updated readme

Signed-off-by: faizan <faizanakram99@gmail.com>
  • Loading branch information
faizanakram99 committed Feb 19, 2019
1 parent 927474c commit dbd1828
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')`


Expand Down
11 changes: 11 additions & 0 deletions src/Qbil/Models/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ 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(
$this->extract($line, 'LIT_OrderNumber'),
$this->extract($line, 'LIT_DeliveredQuantity'),
$this->extract($line, 'LIT_VatExcludedAmount'),
$this->extract($line, 'LIT_UnitPriceAmount'),
$this->extract($line, 'LIT_Inkoopcontract'),
$document->DocumentSubType
);

Expand All @@ -48,6 +50,7 @@ public function __construct(Document $document)
private $theirVatRegistration;
private $ourVatRegistration;
private $orderNumber;
private $contract;
private $invoiceLines = [];

public function addInvoiceLine(InvoiceLine $invoiceLine)
Expand Down Expand Up @@ -155,4 +158,12 @@ public function getOrder()
{
return $this->orderNumber;
}

/**
* @return mixed
*/
public function getContract()
{
return $this->contract;
}
}
14 changes: 12 additions & 2 deletions src/Qbil/Models/InvoiceLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
}

0 comments on commit dbd1828

Please sign in to comment.