use of de.metas.invoicecandidate.model.I_C_Invoice_Candidate in project metasfresh-webui-api by metasfresh.
the class C_Invoice_Candidate_ApproveForInvoicing method retrieveInvoiceCandidatesToApproveQuery.
private final IQuery<I_C_Invoice_Candidate> retrieveInvoiceCandidatesToApproveQuery() {
final IQueryBuilder<I_C_Invoice_Candidate> queryBuilder = Services.get(IQueryBL.class).createQueryBuilder(I_C_Invoice_Candidate.class).filter(getProcessInfo().getQueryFilter()).addOnlyActiveRecordsFilter().addNotEqualsFilter(I_C_Invoice_Candidate.COLUMN_Processed, // not processed
true).addNotEqualsFilter(I_C_Invoice_Candidate.COLUMN_ApprovalForInvoicing, // not already approved
true);
// Only selected rows
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
if (!selectedRowIds.isAll()) {
final Set<Integer> invoiceCandidateIds = selectedRowIds.toIntSet();
if (invoiceCandidateIds.isEmpty()) {
// shall not happen
throw new AdempiereException("@NoSelection@");
}
queryBuilder.addInArrayFilter(I_C_Invoice_Candidate.COLUMN_C_Invoice_Candidate_ID, invoiceCandidateIds);
}
return queryBuilder.create();
}
Aggregations