284: p_batch_id IN NUMBER) IS
285:
286: CURSOR get_app_C IS
287: select app.receivable_application_id app_id
288: from ar_receivable_applications app
289: where app.cash_receipt_id = p_cash_receipt_id
290: and nvl(app.confirmed_flag,'Y') = 'Y' --confirmed records have accounting only
291: and exists (select 'x'
292: from ar_distributions ard
423: arp_acct_main.Delete_Acct_Entry(l_ae_doc_rec);
424:
425: END LOOP;
426:
427: -- delete all AR_RECEIVABLE_APPLICATIONS records created for this
428: -- receipt:
429:
430: DELETE AR_RECEIVABLE_APPLICATIONS
431: WHERE cash_receipt_id = p_cash_receipt_id
426:
427: -- delete all AR_RECEIVABLE_APPLICATIONS records created for this
428: -- receipt:
429:
430: DELETE AR_RECEIVABLE_APPLICATIONS
431: WHERE cash_receipt_id = p_cash_receipt_id
432: RETURNING receivable_application_id
433: BULK COLLECT INTO l_rec_app_key_value_list;
434:
438: +---------------------------------*/
439:
440: ar_mrc_engine.maintain_mrc_data(
441: p_event_mode => 'DELETE',
442: p_table_name => 'AR_RECEIVABLE_APPLICATIONS',
443: p_mode => 'BATCH',
444: p_key_value_list => l_rec_app_key_value_list);
445:
446: /* Bug 4173339
692: AND cb_sl.statement_header_id = cb_sh.statement_header_id (+);
693:
694:
695: -- for cash receipts, get the application amounts from
696: -- ar_receivable_applications
697:
698: IF (p_receipt_type = 'MISC') THEN
699:
700: p_apps_exist_flag := 'N';
835: p_discounts_earned,
836: p_discounts_unearned,
837: l_tot_exchange_gain_loss
838: FROM
839: ar_receivable_applications ra
840: WHERE
841: ra.cash_receipt_id = p_cr_id;
842:
843: p_amount_on_account := l_amount_on_account;
854: 'ACC', 'Y',
855: 'OTHER ACC', 'Y',
856: 'ACTIVITY', 'Y', 'N'))
857: INTO l_apps_exist
858: FROM ar_receivable_applications ra
859: WHERE ra.cash_receipt_id = p_cr_id
860: AND ra.reversal_gl_date is NULL;
861:
862: p_apps_exist_flag := l_apps_exist;
872: FROM ar_cash_receipts cr
873: WHERE cr.cash_receipt_id = p_cr_id
874: AND exists
875: (select 1
876: from ar_receivable_applications ra,
877: ar_payment_schedules ps
878: where ra.cash_receipt_id = cr.cash_receipt_id
879: and ra.applied_payment_schedule_id = ps.payment_schedule_id
880: and ps.invoice_currency_code <> cr.currency_code
941: FROM dual
942: WHERE
943: EXISTS
944: ( SELECT 1
945: FROM AR_CASH_RECEIPT_HISTORY crh, ar_receivable_applications ra
946: WHERE crh.cash_receipt_id = ra.application_ref_id
947: AND ra.cash_receipt_id = p_cr_id
948: AND ra.applied_payment_schedule_id+0 in (-6 , -9)
949: AND ra.application_ref_type = 'MISC_RECEIPT'