public long getDateAtValue(Object type, double value) {
SelectFrom clause = SelectFrom.getInstance();
AssignmentFieldFunctor dataFunctor = (type==COST) ? cost(clause, true) : work(clause);
DateAtValueFunctor dateAtValue = DateAtValueFunctor.getInstance(value, AssignmentFieldClosureCollection.getInstance(dataFunctor));
clause.select(dateAtValue); // override existing select
Query.getInstance().selectFrom(clause)
.execute();
return dateAtValue.getDate();
}