t1.object_taxpayer_type) = 'SMALL_SCALE_TAXPAYER' and
to_char(t2.due_date,'yyyy-mm') <= to_char(SYSDATE,'yyyy-mm')) or t2.write_off_flag = 'FULL')
to_char(t2.due_date,'yyyy-mm') <= to_char(SYSDATE,'yyyy-mm')) or (t2.write_off_flag = 'FULL' and t1.contract_status not in('REPURING','REPUR')) or(nvl(t2.write_off_flag,'NOT')='FULL' and t1.contract_status in('REPURING','REPUR') and t2.cf_item<>1) or (nvl(t2.write_off_flag,'NOT')='PARTIAL' and t1.contract_status in('REPURING','REPUR') and t2.cf_item=1 ) )
AND cf_item<> 9
AND cf_status='RELEASE'
AND ((t2.cf_status='RELEASE' and t1.contract_status not in('REPURING','REPUR') and t2.cf_direction='INFLOW') or(t1.contract_status in ('REPURING','REPUR') and t2.cf_item=250 and t2.cf_status='RELEASE' )or ( t2.cf_status in('BLOCK') and nvl(t2.write_off_flag,'NOT')='PARTIAL' and nvl(t2.billing_status,'NOT') != 'FULL' and t1.contract_status in ('REPURING','REPUR') and t2.cf_item =1 and t2.cf_direction='NONCASH' and nvl(t2.billing_amount,0) <> t2.received_amount))
and t2.cashflow_id not in (20265,34267,24445)
and nvl(t2.billing_status,'NOT') != 'FULL'
and t2.cf_direction='INFLOW'
--and t2.cf_direction='INFLOW'
and ((decode(t2.cf_item,
'250',
t1.inv_object_taxpayer_type,
...
...
@@ -165,7 +165,9 @@
t2.amount_dr received_amount,
NULL received_principal,
NULL received_interest,
0 billing_amount,
nvl((SELECT SUM(l.total_amount)
FROM acr_invoice_ln l
WHERE l.ref_n04 = t2.journal_line_id),0) billing_amount,