Open invoices
Lists open (unpaid) purchase invoices with Finder type IVT, optionally of one supplier. Read-only.
Twinfield documentation: Purchase transactions.
openInvoices() returns an OpenInvoiceSearch, the same search as for sales transactions. Filter with supplier() (Finder option dim2), dim1() (the accounts payable account), value() (the original amount) or openValue() (the outstanding amount), and search with pattern() on supplier code, name, amount and invoice number. get() gives one page, all() every result page by page.
Each OpenInvoice has the invoice number, the open amount, the supplier code and name, and a side. The Finder gives no day book or transaction number.
Things the Twinfield documentation does not say:
- Without
supplier()ordim1(), the results also include open sales invoices. - The side is the opposite of the total line of the invoice:
D(debit) for a purchase invoice,C(credit) for a purchase credit note or a sales invoice. - The amount is the open amount, always positive: for a partly paid invoice of 15.00 with 10.00 still open, the Finder gives 10.00.
$twinfield = Example::twinfield();
// Without a supplier, the Finder also gives open sales invoices.$search = $twinfield->purchaseTransactions()->openInvoices();
if (isset($argv[1])) { $search = $search->supplier($argv[1]);}
$page = $search->limit(20)->get();
echo $page->totalRows, ' open invoice(s)', isset($argv[1]) ? ' of ' . $argv[1] : '', PHP_EOL;
foreach ($page as $invoice) { echo sprintf( ' %-16s %10s %s %-6s %s', $invoice->invoiceNumber, $invoice->amount, // The Finder gives the side opposite to the invoice: debit for a purchase invoice. $invoice->debitCredit === DebitCredit::Debit ? 'D' : 'C', $invoice->relation, $invoice->relationName, ), PHP_EOL;}php examples/purchase-transactions/open-invoices/example.php 20002 open invoice(s) of 2000 F-2026-0042 181.50 D 2000 Example supplier C-2026-0007 48.40 C 2000 Example supplierWhat the SDK sends to Twinfield and what Twinfield sends back, for a call like the one in this example. The responses come from the tests, with example data.
Twinfield documentation: Purchase transactions: Find.
$twinfield->purchaseTransactions()->openInvoices()->limit(20)->get();The SDK sends this in the SOAP body to finder.asmx, with SOAPAction http://www.twinfield.com/Search; the access token goes in the SOAP header:
<Search xmlns="http://www.twinfield.com/"> <type>IVT</type> <pattern>*</pattern> <field>0</field> <firstRow>1</firstRow> <maxRows>20</maxRows></Search>Twinfield answers with this SOAP body:
<SearchResponse xmlns="http://www.twinfield.com/"> <SearchResult/> <data> <TotalRows>3</TotalRows> <Columns> <string>Factuurnr.</string> <string>Bedrag</string> <string>Debiteur</string> <string>Naam</string> <string>Debet/credit</string> </Columns> <Items> <ArrayOfString> <string>2026-0042</string> <string>181.50</string> <string>1000</string> <string>Example customer</string> <string>C</string> </ArrayOfString> <ArrayOfString> <string>2026-0043</string> <string>121.00</string> <string>1000</string> <string>Example customer</string> <string>D</string> </ArrayOfString> <ArrayOfString> <string>INV-778</string> <string>50.00</string> <string>2000</string> <string>Example supplier</string> <string>D</string> </ArrayOfString> </Items> </data></SearchResponse>Source
Section titled “Source”View examples/purchase-transactions/open-invoices/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.