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

Day book entry - employee reference

0
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
created Jun 9, 2010 by dorin
0% Accept Rate
Q 2 A 3 C 0

3 Answers

0
Hi,

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


Best regards,
answered Jun 9, 2010 by Christian Estrup
0
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
answered Jun 9, 2010 by dorin
0
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
answered Jun 9, 2010 by dorin
Visma e-conomic A/S
...