@Override
public ModificationInfo setExpenditure(ExpenditureDetails details) throws ClipsServerException {
checkCommandAccessibility(COMMAND_MODIFY);
ServiceRender entity = getExistentEntity();
Expenditure exp = null;
if (details.id != 0) {
exp = findEntity(Expenditure.class, details.id);
checkTheSame(exp.getServiceRender());
} else {
exp = new Expenditure();
exp.setServiceRender(entity);
}
AuditDoc<Expenditure> auditExp = new AuditDoc<Expenditure>(exp, getCollaborator());
exp.setQuantity(details.quantity);
exp.setType(findEntity(ExpenditureType.class, details.expenTypeID));
int id = saveEntity(exp);
auditExp.check(exp);
return new ModificationInfo(id, persistAudit(auditExp));
}