Skip to content

Commit d8a059a

Browse files
committed
Added example for creating an invoice
1 parent 58e7b7e commit d8a059a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,27 @@ the api connection.
108108
// List items with filter
109109
$item = new Item($connection);
110110
$item->filter("Code eq '$productcode'"); // Uses filters as described in Exact API docs (odata filters)
111-
111+
112+
// Create new invoice with invoice lines
113+
$items[] = [
114+
'Item' => $itemId,
115+
'Quantity' => $orderproduct['amount'],
116+
'UnitPrice' => $orderproduct['price']
117+
];
118+
119+
$salesInvoice = new SalesInvoice($this->connection());
120+
$salesInvoice->InvoiceTo = $customer_code;
121+
$salesInvoice->OrderedBy = $customer_code;
122+
$salesInvoice->YourRef = $orderId;
123+
$salesInvoice->SalesInvoiceLines = $items;
124+
125+
126+
112127
Check [src/Picqer/Financials/Exact](src/Picqer/Financials/Exact) for all available entities.
113128

114129
## Code example
115130
See for example: [example/example.php](example/example.php)
116131

117-
118132
## TODO
119133
- Switch administration (now uses default)
120134
- Current entities do not contain all available properties. Feel free to submit a PR with added or extended entities if you require them.

0 commit comments

Comments
 (0)