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

Problems with creating a CurrentInvoice


Were are having some problems with regards to creating a CurrentInvoice more specifically the problem is getting the Product to be registered with the CurrentInvoice,

Everything works fine in the .NET example we have made, but when we try to do it in PHP it fails. And since the documentation of the API is VERY limited, we seem to be stuck.

I hope someone in here can help us out
created Jun 11, 2009 by Wodecraft
0% Accept Rate
Q 1 A 0 C 0

3 Answers


Try this exsample:

          $debtorHandles = $client-debtor_GetAll()-Debtor_GetAllResult-DebtorHandle;
          $firstDebtor = $debtorHandles[0];                                               
          $newCurrentInvoiceHandle = $client-CurrentInvoice_Create(array(
          'debtorHandle' = $firstDebtor))-CurrentInvoice_CreateResult;
          $newCurrentInvoiceLineHandle = $client-CurrentInvoiceLine_Create(array(
          'invoiceHandle' = $newCurrentInvoiceHandle))-CurrentInvoiceLine_CreateResult;
         $productHandles = $client-product_GetAll()-Product_GetAllResult-ProductHandle;
         $firstProduct = $productHandles[0];
         'currentInvoiceLineHandle' = $newCurrentInvoiceLineHandle,
         'valueHandle'        = $firstProduct));

catch(Exception $exception)

Hope its helps   .

answered Jun 12, 2009 by cwe
I transfer my orders and their products into e-conomic from my web shop.
When the order from my web shop imported into economic, for each order economic generates its own Order_ID.
Like taking one example below when I click on the current Order under Sales tab I'll see one row :-
On the current Order list I have :-
10145    05.06.09    1791    Ruth Altmann        Yes    08.06.09    DKK    503.00     

So, here 10145 is order_id generated by ecomomic but I dont want that order_id becasue its diffiuclt for me track it with my webshop's order_id as both are different.

As , it is not possible with economic api to generate web shop's order_id then I had used
Other Reference to store the order_id of my web shop.

Now, I want to create the Invoice of that order but here the problem comes again when I have created invoice for that particular order using economic api it generates the row some thing like below

On the current Invoice list I have :-
10146    05.06.09    1791    Ruth Altmann        Yes    08.06.09    DKK    0.503.00   

So, here it generates the 10146 as its invoice_id but I want that invoice _id to be equal to my webshop's order_id that is equal to [color=#80BF00:3quuf6vl]14995[/color:3quuf6vl]

At the end ,  is it possible to use my web shop' s order_id 14995 as invoice_id in the economic ?

Is there any way or function to do that because as you see it difficult for me to remember/trace which order_id has its invoice_id
answered Jul 20, 2009 by shivank
The ID is returned.  

In Sales/Archive in E-conomic you can also search by other-ref.  So even if you just put your web shop ID in other-ref you could then use it to search for invoices.

However, what you could also do is add a field to your web shop tables for the e-conomic ID (or create a new table to map web shop IDs to e-conomic IDs).  So when you create your invoice in e-conomic you grab the new ID and add it to your web shop table.  That way you have a mapping in your web shop between your web shop items and e-conomic.  If you also added that ID to your web shop administration interface you'd have a way to find the ID quickly.  If you wanted to be clever you could even have it pull the data out of e-conomic.  

answered Sep 11, 2009 by mjtnet
Visma e-conomic A/S