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

Create Cashbookentry

No matter what I do, I cannot make a cashbookentry, so I need an example for that - i hope someone can help.

I tried just to create the entry with few data to avoid mistakes with CashBookEntry_Create, plotting to alter the data further afterards, but this simple step did'nt work, here is the code.

$entry = $client-CashBookEntry_Create(array(
    'cashBookHandle' = $cb,
    'type' = 'FinanceVoucher',
    'accountHandle' = $bank,
    'contraAccountHandle' = $fejlkto));

Here is how the array looks like (print_r):

It is a shame there is not very much documentation and examples for PHP and e-conomic. I found two posts in the forum regarding or partially regarding cashbookentries - none with examples, just very theoretically.
Would anyone ming supplying me some kind of example of how to create a cashbookentry?
created Jun 13, 2011 by olsen-it
0% Accept Rate
Q 2 A 2 C 0

3 Answers

You are almost there. Perhaps the documentation at https://www.e-conomic.com/secure/api1/E ... try_Create may help.

This code works:

  $cb = $client-CashBook_FindByNumber(array('number' = 1))-CashBook_FindByNumberResult;
  $bank = $client-Account_FindByNumber(array('number' = 5820))-Account_FindByNumberResult;
  $fejlkto = $client-Account_FindByNumber(array('number' = 9900))-Account_FindByNumberResult;
  $entry = $client-CashBookEntry_Create(array(
    'cashBookHandle' = $cb,
    'type' = 'FinanceVoucher',
    'accountHandle' = $bank,
    'contraAccountHandle' = $fejlkto))-CashBookEntry_CreateResult;

answered Jun 17, 2011 by ecodyr
A question to the wise.

I have noted that you all do a

$cb = $client-CashBook_FindByNumber(array('number'=1))-CashBook_FindByNumberResult;

I'm a little puzzeled by this if i understand you correct it's because you want to find the next available voucher in the chain or have i missed something?

I would do the following :

$cb = $client-CashBook_GetNectVoucherNumber()-CashBook_GetNextVoucherNumberResult;

And so on

answered Dec 18, 2012 by HansenKent
CashBook_GetNextVoucherNumber is a fairly new method, and hence not that widely used yet (a lot of people probably do not know of it).

But it is indeed the recommended way to do it.
answered Dec 21, 2012 by nkn
Visma e-conomic A/S