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

Error booking CashEntry

0
Hi. I want to book a CashEntry via SOAP api. It is done via an .NET application. The following code gives this exception:

"Economic.Api.Exceptions.IntegrityException(E06300): Cannot book the cashbook: Not all combinations of voucher number and date balance. (id=21bdb549-3637-414f-b819-b1b5e65952bd)"

The code:

var session = new EvoEconomicApi.EvoEconApi.EconomicWebServiceSoapClient();

                session.ConnectWithToken(_agreementGrantToken, _appSecretToken);

                var invoice = session.Invoice_FindByNumber(economicInvoiceId);
                var invoiceData = session.Invoice_GetData(invoice);

                if (invoice == null)
                    return "";

                var cashBook = session.CashBook_GetAll()[0];
                var contraAccount = session.Account_FindByNumber(5820);

                var cashBookEntryDataHandle = session.CashBookEntry_Create(CashBookEntryType.DebtorPayment, cashBook, invoiceData.DebtorHandle, null, null, contraAccount);
                var cashBookEntryData = session.CashBookEntry_GetData(cashBookEntryDataHandle);


                //cashBookEntryData.Date = DateTime.Today;
                //cashBookEntryData.VoucherNumber = session.CashBook_GetNextVoucherNumber(cashBook);
                cashBookEntryData.Amount = invoiceData.GrossAmount;
                cashBookEntryData.AmountDefaultCurrency = invoiceData.GrossAmount;
                cashBookEntryData.Text = "Payment, Invoice: " + invoiceData.Number;
                cashBookEntryData.DebtorInvoiceNumber = invoiceData.Number;
                cashBookEntryData.CurrencyHandle = session.Currency_FindByCode("DKK");

                session.CashBookEntry_UpdateFromData(cashBookEntryData);
                session.CashBook_Book(cashBook);

                session.Disconnect();
created Jan 23 by petermelchiorsen
0% Accept Rate
Q 1 A 0 C 0

1 Answer

0
Hi Peter,

When booking a cashbook in e-conomic you're in effect booking all entries in that cashbook.
In order for cashbook entries and in particular the type FinanceVoucher to be valid to be booked they must balance.
Balancing is an accounting term that defines that the negative and positive sums of a voucher must balance.
A single-legged entry such as a FinanceVoucher needs a balance entry to be bookable.

Furthermore it is via the application possible to setup for a cashbook whether vouchers must match on Date or month. Default is Date.

Please ensure that the entries adhere to both debit/credit as well as match on date when belonging to same voucher.
answered Jan 24 by olej
Visma e-conomic A/S
...