= b.seq_no
and a.operate_date <= $P{adtm_start}
and a.operate_date > (select accstart_date from cmaccountyear where $P{adtm_start} between accstart_date and accend_date )
and a.item_status = 1
group by a.deptaccount_no asc , b.seq_no desc
) o
where first_row = 1
) m , dpdeptmaster n ,dpdepttype dpt,cmcoopmaster
where m.deptaccount_no = n.deptaccount_no and
n.depttype_code = dpt.depttype_code and n.coop_id = cmcoopmaster.coop_id
and m.prncbal > 0 and n.depttype_code between $P{as_start_type} and $P{as_end_type}
group by n.depttype_code
order by n.depttype_code]]>