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

One more question regarding expenses

How do I get all cashbookentries (created as "Udlæg") through the project module?
created Apr 26, 2016 by kennex77
67% Accept Rate
Q 3 A 0 C 6

1 Answer

Best answer

Hi Kennex

As Expenses on Projects aren't exposed via SOAP like time entries and mileage are, looking for booked entries on projects is the approach.

You can find entries attached to a project using Project_GetEntries and then fetch those entries using Entry_GetDataArray.
answered Apr 27, 2016 by olej
selected May 2, 2016 by kennex77
So neither REST or SOAP expose expenses?
Not as 'expenses' like time entries etc.
You can look at the entries attached to a project using Project_GetEntries and then fetch those journal entries (Entry_GetDataArray) and look for expense types. But the actual 'Expense' part as understood in 'Projects' is not exposed.
I'm confused, sorry.
Can i read/create Expenses (created as "Udlæg" in the project module) through the API or not? :)

If yes, do you have any examples on how to use Project_GetEntries.

I am extending our EazyProject App integration with time, milage and expense export to e-conomic.

Time and milage is done, but expenses really gives me trouble.
Hi Kennex - No problem :-)
You can create cashbook entries as cashbook entries that reference a project and book these. They will then show up on the Project Card.
Likewise any expense registered on a project that results in account entries can be found as entries belonging to the project.

What you cannot do though is via API register an employee expense through a cashbook and then have it show up for approval in the project module.

Does it make more sense now?
Please give it a whirl inside the application where you
A: create and book an expense and then look at the Accounting tab -> Find entries
B: Create a journal entry in your cashbook and reference a project and then go look at the project card
C: Create a journal entry in your cashbook and reference both a project and an employee then go look at the expense card for that employee.
Okay, I'm almost there.

I can read all the entries now by this:

Dim arrP As IProject = ECOsession.Project.FindByNumber(100014)
Dim DebtorEntry As IEntry() = arrP.GetEntries()

But how do I add amount and ref a project, when I create a new CashBookEntry?
I try this, (just static test-values):

Dim arrCUS As IDebtor = ECOsession.Debtor.FindByNumber(1000)
Dim arrKRED As ICreditor = ECOsession.Creditor.FindByNumber(0)
Dim arrACCOUNT As IAccount = ECOsession.Account.FindByNumber(2241) ' konto Personaleudgifter
Dim arrCONTRA_ACCOUNT As IAccount = ECOsession.Account.FindByNumber(2241) ' konto Personaleudgifter
Dim CashBook As ICashBook = ECOsession.CashBook.FindByNumber(0)

Dim createdEntryData As CashBookEntry = ECOsession.CashBookEntryData.Create(CashBookEntryType.FinanceVoucher, CashBook, arrCUS, arrKRED, arrACCOUNT, arrCONTRA_ACCOUNT)
Please note that the SDK is completely deprecated and we strongly advise that you pick up on using SOAP directly instead.

Short intro - just in case:
xxxxxData.Create creates a local object that allows you to set properties and add to an array etc. before committing to the server.
xxxxx.Create() calls the service directly and is a very chatty approach that does not scale well.

Using the SDK you'd first dim a CashBookEntryData.Create, then set the properties on the entry (entry.property). Then add it to an array if you have several and then in the end send the data to the service using ECOsession.CashBookEntry.CreateFromDataArray()

Project and Amount are set like so:
entry.Project =  projecthandle
entry.Amount = xx,xx

Note: CashBook "0" and Creditor "0" will fail to look up ;-)
Thank you so much - now everything is working :)
Visma e-conomic A/S