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

Problem setting date of cashBookEntry

0
Hi,
I'm a bit of newbie but managed to use Java to update e-conomic from our EPOS system! The only problem I'm having is setting the date of the transactions.

The date set in e-conomic seems to be one day behind... for example if I try to set 23rd August, when I check e-conomic the date is set as 22nd August!

Here is the code I am using, and below that an example of the debug output I am getting. (The date from the EPOS system is stored in Date variable 'paymentDate')


                CurrencyHandle currency = sessioncurrency_FindByCode(GBP);
                
                       vatAccount = 4000;
                       vatCode = S-STD;

                AccountHandle account = sessionaccount_FindByNumber(vatAccount);
                
                // Cash book 7 = Manual customer invoices
                CashBookHandle cashBookHandle = sessioncashBook_FindByNumber(7);
                
                // Set VAT Account
                VatAccountHandle vatAccountHandle = sessionvatAccount_FindByVatCode(vatCode);

                // Set the customer
                DebtorHandle debtor  = sessiondebtor_FindByNumber(101);

                // Create a skeleton cash book entry
                CashBookEntryHandle cashBookEntryHandle
                        = sessioncashBookEntry_CreateManualDebtorInvoice(cashBookHandle, debtor, account);

                // Set the handle from the newly created entry
                datasetHandle(cashBookEntryHandle);

                // Populate data with everything from the new entry
                data = sessioncashBookEntry_GetData(cashBookEntryHandle);

                datasetCurrencyHandle(currency);
                datasetAmount(new BigDecimal(paymentTotal));

                Calendar cal = CalendargetInstance();

                DateFormat dateFormat = new SimpleDateFormat(yyyy/MM/dd HHmmss);
                Systemoutprintln(dateFormatformat(calgetTime()));
                Systemoutprintln(dateFormatformat(paymentDate));

                calsetTimeZone(dateFormatgetTimeZone());
                calsetTime(paymentDate);

                Systemoutprintln(dateFormatformat(calgetTime()));

                datasetDate(cal);

                Systemoutprintln(dateFormatformat(datagetDate()getTime()));                
                
                datasetContraVatAccountHandle(vatAccountHandle);
                datasetText(Daily takings +paymentMethod);
                
                sessioncashBookEntry_UpdateFromData(data);
                  

     Systemoutprintln(dateFormatformat(sessioncashBookEntry_GetDate(cashBookEntryHandle)getTime()));
                Systemoutprintln(---);


The debug output for a few entries is:


2012/08/23 211328
2012/08/23 000000
2012/08/23 000000
2012/08/23 000000
2012/08/22 010000
---
2012/08/23 211335
2012/08/23 000000
2012/08/23 000000
2012/08/23 000000
2012/08/22 010000
---
2012/08/23 211343
2012/08/28 000000
2012/08/28 000000
2012/08/28 000000
2012/08/27 010000
---


I wonder if there's some issue with the timezone, but not sure where to search for a solution. Can anyone help?

Regards,

Brian
created Aug 23, 2012 by mrbriandarnell
50% Accept Rate
Q 5 A 2 C 1

Visma e-conomic A/S
...