-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #496 from DannyvdSluijs/Update-readme-examples
Correct readme examples
- Loading branch information
Showing
1 changed file
with
29 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,55 +131,56 @@ _Do note when you have no more minutely calls available, Exact only sends the Mi | |
$connection->setDivision(123456); | ||
|
||
// Create a new account | ||
$account = new Account($connection); | ||
$account->AddressLine1 = $customer['address']; | ||
$account->AddressLine2 = $customer['address2']; | ||
$account->City = $customer['city']; | ||
$account->Code = $customer['customerid']; | ||
$account->Country = $customer['country']; | ||
$account = new \Picqer\Financials\Exact\Account($connection); | ||
$account->AddressLine1 = 'Customers address line'; | ||
$account->AddressLine2 = 'Customer address line 2'; | ||
$account->City = 'Customer city'; | ||
$account->Code = 'Customer code'; | ||
$account->Country = 'Customer country'; | ||
$account->IsSales = 'true'; | ||
$account->Name = $customer['name']; | ||
$account->Postcode = $customer['zipcode']; | ||
$account->Name = 'Customer name'; | ||
$account->Postcode = 'Customer postcode'; | ||
$account->Status = 'C'; | ||
$account->save(); | ||
|
||
// Add a product in Exact | ||
$item = new Item($connection); | ||
$item->Code = $productcode; | ||
$item->CostPriceStandard = $costprice; | ||
$item->Description = $name; | ||
$item = new \Picqer\Financials\Exact\Item($connection); | ||
$item->Code = 'product code'; | ||
$item->CostPriceStandard = 2.50; | ||
$item->Description = 'product description'; | ||
$item->IsSalesItem = true; | ||
$item->SalesVatCode = 'VH'; | ||
$item->save(); | ||
|
||
// Retrieve an item | ||
$item = new Item($connection); | ||
$item->find(ID); | ||
// Retrieve an item by id | ||
$item = new \Picqer\Financials\Exact\Item($connection); | ||
$id = '097A82A9-6EF7-4EDC-8036-3F7559D9EF82'; | ||
$item->find($id); | ||
|
||
// List items | ||
$item = new Item($connection); | ||
$item = new \Picqer\Financials\Exact\Item($connection); | ||
$item->get(); | ||
|
||
// List items with filter (using a filter always returns a collection) | ||
$item = new Item($connection); | ||
$items = $item->filter("Code eq '$productcode'"); // Uses filters as described in Exact API docs (odata filters) | ||
$item = new \Picqer\Financials\Exact\Item($connection); | ||
$items = $item->filter("Code eq '$item->Code'"); // Uses filters as described in Exact API docs (odata filters) | ||
|
||
// Create new invoice with invoice lines | ||
$invoiceLines[] = [ | ||
'Item' => $itemId, | ||
'Quantity' => $orderproduct['amount'], | ||
'UnitPrice' => $orderproduct['price'] | ||
'Item' => $item->ID, | ||
'Quantity' => 1, | ||
'UnitPrice' => $item->CostPriceStandard | ||
]; | ||
|
||
$salesInvoice = new SalesInvoice($connection); | ||
$salesInvoice->InvoiceTo = $customer_code; | ||
$salesInvoice->OrderedBy = $customer_code; | ||
$salesInvoice->YourRef = $orderId; | ||
$salesInvoice = new \Picqer\Financials\Exact\SalesInvoice($connection); | ||
$salesInvoice->InvoiceTo = $account->ID; | ||
$salesInvoice->OrderedBy = $account->ID; | ||
$salesInvoice->YourRef = 'Invoice reference'; | ||
$salesInvoice->SalesInvoiceLines = $invoiceLines; | ||
$salesInvoice->save(); | ||
|
||
// Print and email the invoice | ||
$printedInvoice = new PrintedSalesInvoice($connection); | ||
$printedInvoice = new \Picqer\Financials\Exact\PrintedSalesInvoice($connection); | ||
$printedInvoice->InvoiceID = $salesInvoice->InvoiceID; | ||
$printedInvoice->SendEmailToCustomer = true; | ||
$printedInvoice->SenderEmailAddress = "[email protected]"; | ||
|
@@ -219,13 +220,13 @@ Examples: | |
|
||
Return only the EntryID and FinancialYear. | ||
```php | ||
$test = new GeneralJournalEntry($connection); | ||
$test = new \Picqer\Financials\Exact\GeneralJournalEntry($connection); | ||
var_dump($test->filter('', '', 'EntryID, FinancialYear')); | ||
``` | ||
|
||
The $top=1 is added like this: | ||
```php | ||
$test = new GeneralJournalEntry($connection); | ||
$test = new \Picqer\Financials\Exact\GeneralJournalEntry($connection); | ||
var_dump($test->filter('', '', '', ['$top'=> 1])); | ||
``` | ||
|
||
|