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

adding cashbookentry data - date format exception

0
Hi,

I'm trying to add a cashbook entry using the code below and get the following error




ICashBook cashbook = _sessionCashBookFindByNumber(1);
                IAccount account = _sessionAccountFindByNumber(1302);
                IAccount contraAcc = _sessionAccountFindByNumber(4200);

                ICashBookEntryData data = _sessionCashBookEntryDataCreate(CashBookEntryTypeDebtorPayment, cashbook,
                        null, null, account, contraAcc);

                ICashBookEntry entry = _sessionCashBookEntryCreateFromData(data);

                entryAmount = 2400M;
                entryAmountDefaultCurrency = 2400M;
                entryDate = new DateTime(2011,06,15);
                IDepartment dept = _sessionDepartmentFindByNumber(300);
                entryDepartment = dept;
                entryText = 110111;

                _sessionCashBookEntryUpdateFromData(data);


I've tried various date formats and also tried adding entry.duedate but it's made no difference.

In addition to this query, is this the recommended way to add a cashbook entry as there ain't many examples kickin about and I'm not all that hot on accountancy   

Are the creditor and/or debtor compulsory...you'll notice i'm passing nulls for these types in the code above.

thanks,
created Mar 28, 2012 by matleeds
0% Accept Rate
Q 4 A 2 C 0

3 Answers

0
Hi,

The problem is that, on your first CreateFromData, you don't have a valid date etc. yet.

Therefore, you should skip your first CreateFromData, and change the call to UpdateFromData to CreateFromData.


Best regards,
answered Mar 29, 2012 by Christian Estrup
0
Hi Christian,

if i skip the first createfromdata how do i create the ICashBookEntry 'entry' object?

thanks,
answered Mar 29, 2012 by matleeds
0
Hi,

Remove this:

ICashBookEntry entry = _session.CashBookEntry.CreateFromData(data);

Then change all entry.* setters to data.* setters.

- and then replace this:

_session.CashBookEntry.UpdateFromData(data);

- with this:

ICashBookEntry entry = _session.CashBookEntry.CreateFromData(data);

There's your entry


Best regards,
answered Mar 29, 2012 by Christian Estrup
Visma e-conomic A/S
...