As I said in my first reply, you want to use your SQL query to prevent data from reaching your report that you don't want to print. That way you won't have to decide whether or not to print something in the definition of the report itself. In other words, the report can assume that any data it receives are data that must be printed. Remove the grouping from your query and add a condition that will only return records where the transaction amount is at least $20. Something like this:
SELECT tmptract.soc_sec, tmptract.p_bal, tmptract.bal, tmptract.semester, tmptract.sch_yr, tmptract.due_date, tmptract.asofdate, name.last_name, name.first_name, name.mi, address.st_addr, address.add_addr, address.add_add2, address.city, address.state, address.zip, address.add_rid, address.salutation, sysvar.title, sysvar.schaddr1, sysvar.schaddr2, sysvar.schaddr3,'' as invoice_no, transact_prebill.ref_id, transact_prebill.amt_1, transact_prebill.offered, transact_prebill.loan_fees, transact_prebill.date, '' as check_no, transact_prebill.transact_rid, tcodes.act_code, 2 as bill_type
FROM tmptract, name, address, transact_prebill, tcodes, sysvar
WHERE tmptract.soc_sec = name.soc_sec
AND address.soc_sec = name.soc_sec
AND transact_prebill.soc_sec = tmptract.soc_sec
AND tcodes.tcodes = transact_prebill.tcodes
AND sysvar.school_id <> tmptract.soc_sec
AND address.labels2 = 1
AND tmptract.token = '#session.token#'
AND tcodes.inc_bill = 1
AND transact_prebill.posted = 0
AND transact_prebill.exclude_from_bill = 0
AND transact_prebill.accept not in('n','v')
AND transact_prebill.date <= tmptract.asofdate
AND transact_prebill.semester = tmptract.semester
AND transact_prebill.sch_yr = tmptract.sch_yr
WHERE NOT tmptract.soc_sec IN ( SELECT transact_prebill.soc_sec FROM transact_prebill
GROUP BY transact_prebill.soc_sec HAVING (SUM(transact_prebill.amt_1) < 20) )
ORDER BY name.last_name, name.first_name, name.mi, tmptract.soc_sec,address.add_rid, bill_type desc, act_code, transact_prebill.date
Your SQL engine syntax may differ, but you can adjust it as necessary. You will also need to add your other criteria to the sub-query, for "posted" and "exclude_from_bill" etc.
... View more