API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Find invoices from a customer that are newer then a given date

0

Im currently listing all invoices from a selected customer.

I would like to filter on this result, and only list the invoices newer than a specified date.

// Find debtor
$debtorHandle = $client->Debtor_FindByNumber(array('number' => $economic_api->customerId))->Debtor_FindByNumberResult;

// Find order ids for debtor
$orderHandles = $client->Debtor_GetInvoices(array('debtorHandle' => $debtorHandle))->Debtor_GetInvoicesResult->InvoiceHandle;

// Find all orders for debtor
$invoices = $client->Invoice_GetDataArray(array('entityHandles' => $orderHandles))->Invoice_GetDataArrayResult->InvoiceData;

 

Do i have to check every invoice in my script or is there a filter available?

created Mar 24, 2015 by steffena
60% Accept Rate
Q 5 A 0 C 2

1 Answer

0
 
Best answer

Hi Steffen

If date span is your primary interest you could consider using Invoice_FindByDateInterval followed by Invoice_GetDataArray and only look at invoices matching your criteria.

Depending on the business setup and amount of customers and activity this could quickly become more cumbersome.

Filtering is not available like we have it via REST. The only filtering via SOAP is the one you're already using, such as FindByNumber etc.

P.S. Your comments mention Orders but you're dealing with Invoices. Is this on purpose?

answered Mar 24, 2015 by olej
selected Mar 24, 2015 by steffena
In that case I'll stick to my solution and check the date of all the  returned invoices.
My client have more than 5000 invoices in his system, so I'm pretty sure that's going give somekind of timeout.

I started out using a snippet fetching orders and forgot to change the variable names :) So thats why it says orders some places - just poor naming :)

Thanks for your input :)
Visma e-conomic A/S
...