Open invoices
Lists open (unpaid) invoices with Finder type IVT, optionally of one customer. Read-only.
Twinfield documentation: Sales transactions.
openInvoices() returns an OpenInvoiceSearch. Filter with customer() (Finder option dim2), dim1() (the accounts receivable account), value() (the original amount) or openValue() (the outstanding amount), and search with pattern() on customer code, name, amount and invoice number. get() gives one page, all() every result page by page.
Each OpenInvoice has the invoice number, the amount, the customer code and name, and a side. The Finder gives no day book or transaction number.
Two things the Twinfield documentation does not say:
- Without
customer()ordim1(), the results also include open purchase invoices, with the supplier in the customer column. - The side is the opposite of the total line of the invoice:
C(credit) for a sales invoice,D(debit) for a purchase invoice or a sales credit note.
$twinfield = Example::twinfield();
// Without a customer, the Finder also gives open purchase invoices.$search = $twinfield->salesTransactions()->openInvoices();
if (isset($argv[1])) { $search = $search->customer($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: credit for a sales invoice. $invoice->debitCredit === DebitCredit::Credit ? 'C' : 'D', $invoice->relation, $invoice->relationName, ), PHP_EOL;}php examples/sales-transactions/open-invoices/example.php 10002 open invoice(s) of 1000 2026-0042 181.50 C 1000 Example customer 2026-0043 121.00 D 1000 Example customerWhat 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: Sales transactions: Find.
$twinfield->salesTransactions()->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/sales-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.