[Home] [Help]
1045: lag(distribution_id,1,to_number(NULL)) over (partition by document_id, distribution_type
1046: order by occurrence_id) lagdist,
1047: lag(distribution_id,1,to_number(NULL)) over (partition by document_id, occurrence_id, distribution_type
1048: order by accounting_reversal_option) cancellagdist
1049: from jl_rev_tmp) tmp,
1050: jl_br_ar_distributns_all dist
1051: where tmp.distribution_id = dist.distribution_id
1052: and (tmp.ACCOUNTING_REVERSAL_OPTION = 'Y'
1053: or dist.std_occurrence_code in ('FULL_SETTLEMENT', 'PARTIAL_SETTLEMENT')
1124: )
1125: WHEN STD_OCCURRENCE_CODE IN ('REMITTANCE', 'FULL_SETTLEMENT', 'PARTIAL_SETTLEMENT',
1126: 'REJECTED_ENTRY', 'WRITE_OFF_REQUISITION', 'AUTOMATIC_WRITE_OFF')
1127: THEN
1128: into jl_rev_tmp (
1129: distribution_id, document_id, occurrence_id, distribution_type, ACCOUNTING_REVERSAL_OPTION
1130: )
1131: values (
1132: jl_br_ar_distributns_s.NEXTVAL, document_id, occurrence_id, distribution_type, ACCOUNTING_REVERSAL_OPTION