Skip to content

Commit

Permalink
+ added order number to invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
xersion22 committed Feb 13, 2019
1 parent 9e650cc commit 927474c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Qbil/Models/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
* Created by PhpStorm.
* User: faizan
* Date: 11/12/18
* Time: 4:03 PM
* Time: 4:03 PM.
*/

namespace Qbil\ReadSoftOnline\Models;


class Invoice
{
public function __construct(Document $document)
Expand All @@ -23,6 +22,7 @@ public function __construct(Document $document)
$this->currency = $this->extract($document->HeaderFields, 'invoicecurrency');
$this->theirVatRegistration = $this->extract($document->HeaderFields, 'suppliervatregistrationnumber');
$this->ourVatRegistration = $this->extract($document->HeaderFields, 'CustomerVATRegistrationNumber');
$this->orderNumber = $this->extract($document->HeaderFields, 'invoiceordernumber');

foreach (array_column($this->extract($document->Tables, 'LineItem', 'TableRows'), 'ItemFields') as $line) {
$invoiceLine = new InvoiceLine(
Expand All @@ -47,6 +47,7 @@ public function __construct(Document $document)
private $currency;
private $theirVatRegistration;
private $ourVatRegistration;
private $orderNumber;
private $invoiceLines = [];

public function addInvoiceLine(InvoiceLine $invoiceLine)
Expand Down Expand Up @@ -146,4 +147,12 @@ private function extract(array $property, $key, $subKey = 'Text')
{
return $property[array_search($key, array_column($property, 'Type'))][$subKey];
}
}

/**
* @return mixed
*/
public function getOrder()
{
return $this->orderNumber;
}
}

0 comments on commit 927474c

Please sign in to comment.