queryString.append(" and annotation.useYearly = :use_quarterly");
parameters.put("use_quarterly",
annotationsFilter.getUseYearly());
}
if (optinalType.isPresent()) {
AnnotationType type = optinalType.get();
if (type.equals(AnnotationType.INCOME)
&& (annotationsFilter.getVatTo() != null
|| annotationsFilter.getVatFrom() != null
|| annotationsFilter.getRetentionTo() != null || annotationsFilter
.getRetentionFrom() != null)) {
queryString.append(" and ( type(book) = PropertyBook and ( book.property.type='PREMISE' or ( book.property.type='TENEMENT' and annotation.forCompany = true ) ) ) ");
}
if (type.equals(AnnotationType.EXPENSES)
&& annotationsFilter.getUseQuarterly() != null) {
queryString.append(" and annotation.useQuarterly = :use_quarterly");
parameters.put("use_quarterly",
annotationsFilter.getUseQuarterly());
}
if (type.equals(AnnotationType.INCOME)
&& annotationsFilter.getForCompany() != null) {
queryString.append(" and annotation.forCompany = :for_company");
parameters.put("for_company",
annotationsFilter.getForCompany());
}