Day book entry - employee reference

Forum for JAVA developers using the E-conomic API.
Exchange your ideas, tip and tricks using the API.
Best Practices

Day book entry - employee reference

Postby dorin » Wed Jun 09, 2010 9:02 am

Hy,

I've downloaded the new release API and I've tried to set an employee reference for a new cashBookEntry.

CurrencyHandle currency = session.currency_FindByCode("RON");
AccountHandle account = session.account_FindByNumber(11111);
EmployeeHandle employeeHandle = session.employee_FindByNumber(1);

CashBookHandle cashBookHandle = session.cashBook_FindByNumber(5);
CashBookEntryData data = new CashBookEntryData();
data.setAmount(new BigDecimal(1000));
data.setCashBookHandle(cashBookHandle);
data.setType(CashBookEntryType.FinanceVoucher);
Calendar cal = Calendar.getInstance();
data.setDate(cal);
data.setVoucherNumber(59);
data.setText("test from API");
data.setCurrencyHandle(currency);
data.setAccountHandle(account);
data.setEmployeeHandle(employeeHandle);
session.cashBookEntry_CreateFromData(data);


But in my e-conomic web account, the field for the employee reference isn't set (all other fields are completed like I specified in my code). Please advice me what's wrong with my code.

Best regards,
Dorin
-
dorin
 
Posts: 5
Joined: Tue May 25, 2010 3:53 pm

Re: Day book entry - employee reference

Postby Christian Estrup » Wed Jun 09, 2010 9:53 am

Hi,

This really only makes sense if you also set Project and CostType.


Best regards,
Christian Estrup
Chief Architect

Image
Online accounting
User avatar
Christian Estrup
 
Posts: 245
Joined: Tue Jun 09, 2009 6:37 pm

Re: Day book entry - employee reference

Postby dorin » Wed Jun 09, 2010 10:52 am

Hi,

The problem seems to persist. If I set the Project and CostType, the new cashBookEntry doesn't have the Project checkbox set, and because of that no employee reference, or project.

ProjectHandle projectHandle = session.project_FindByNumber(2);
CostTypeHandle costTypeHandle = session.costType_FindByNumber("1");

CashBookEntryData data = new CashBookEntryData();
...
data.setProjectHandle(projectHandle);
data.setCostTypeHandle(costTypeHandle);
...
session.cashBookEntry_CreateFromData(data);


What's the right solution?

Best regards,
Dorin
-
dorin
 
Posts: 5
Joined: Tue May 25, 2010 3:53 pm

Re: Day book entry - employee reference

Postby dorin » Wed Jun 09, 2010 11:21 am

Hi,

I think I found the solution:

CashBookEntryHandle entry = session.cashBookEntry_CreateFromData(data);
session.cashBookEntry_SetProjectAndCostType(entry, projectHandle, costTypeHandle);
session.cashBookEntry_SetEmployee(entry, employeeHandle);


Best regards,
Dorin
-
dorin
 
Posts: 5
Joined: Tue May 25, 2010 3:53 pm


Return to JAVA



cron