[Home] [Help]
736: hz_cust_accounts cust,
737: hz_parties cust_party,
738: ar_receivable_applications ra,
739: ar_receivable_applications ra1, --bug1199027
740: ar_cash_receipt_history crh,
741: ar_cash_receipt_history crh_batch,
742: ar_cash_receipt_history crh_remit,
743: ar_cash_receipts cr
744: WHERE lu1.lookup_code (+) = cr.reversal_category
737: hz_parties cust_party,
738: ar_receivable_applications ra,
739: ar_receivable_applications ra1, --bug1199027
740: ar_cash_receipt_history crh,
741: ar_cash_receipt_history crh_batch,
742: ar_cash_receipt_history crh_remit,
743: ar_cash_receipts cr
744: WHERE lu1.lookup_code (+) = cr.reversal_category
745: AND lu1.lookup_type (+) = 'REVERSAL_CATEGORY_TYPE'
738: ar_receivable_applications ra,
739: ar_receivable_applications ra1, --bug1199027
740: ar_cash_receipt_history crh,
741: ar_cash_receipt_history crh_batch,
742: ar_cash_receipt_history crh_remit,
743: ar_cash_receipts cr
744: WHERE lu1.lookup_code (+) = cr.reversal_category
745: AND lu1.lookup_type (+) = 'REVERSAL_CATEGORY_TYPE'
746: AND lu2.lookup_code (+) = cr.reversal_reason_code
767: /* get remittance batch */
768: AND crh_remit.batch_id = batch_remit.batch_id(+)
769: AND nvl(crh_remit.cash_receipt_history_id, -99) in
770: ( SELECT nvl( min(crh1.cash_receipt_history_id), -99 )
771: from ar_cash_receipt_history crh1
772: where crh1.cash_receipt_id = cr.cash_receipt_id
773: and crh1.status = 'REMITTED' )
774: AND crh_remit.status (+) = 'REMITTED'
775: AND crh_remit.cash_receipt_id(+) = cr.cash_receipt_id
1982: hz_parties cust_party,
1983: iby_trxn_extensions_v iby,
1984: ar_receivable_applications ra,
1985: ar_receivable_applications ra1, --bug1199027
1986: ar_cash_receipt_history crh,
1987: ar_cash_receipt_history crh_batch,
1988: ar_cash_receipt_history crh_remit,
1989: ar_cash_receipts cr
1990: WHERE lu1.lookup_code (+) = cr.reversal_category
1983: iby_trxn_extensions_v iby,
1984: ar_receivable_applications ra,
1985: ar_receivable_applications ra1, --bug1199027
1986: ar_cash_receipt_history crh,
1987: ar_cash_receipt_history crh_batch,
1988: ar_cash_receipt_history crh_remit,
1989: ar_cash_receipts cr
1990: WHERE lu1.lookup_code (+) = cr.reversal_category
1991: AND lu1.lookup_type (+) = 'REVERSAL_CATEGORY_TYPE'
1984: ar_receivable_applications ra,
1985: ar_receivable_applications ra1, --bug1199027
1986: ar_cash_receipt_history crh,
1987: ar_cash_receipt_history crh_batch,
1988: ar_cash_receipt_history crh_remit,
1989: ar_cash_receipts cr
1990: WHERE lu1.lookup_code (+) = cr.reversal_category
1991: AND lu1.lookup_type (+) = 'REVERSAL_CATEGORY_TYPE'
1992: AND lu2.lookup_code (+) = cr.reversal_reason_code
2015: /* get remittance batch */
2016: AND crh_remit.batch_id = batch_remit.batch_id(+)
2017: AND nvl(crh_remit.cash_receipt_history_id, -99) in
2018: ( SELECT nvl( min(crh1.cash_receipt_history_id), -99 )
2019: from ar_cash_receipt_history crh1
2020: where crh1.cash_receipt_id = cr.cash_receipt_id
2021: and crh1.status = 'REMITTED' )
2022: AND crh_remit.status (+) = 'REMITTED'
2023: AND crh_remit.cash_receipt_id(+) = cr.cash_receipt_id
3069: to_number(null), /* expiration_days */
3070: '' /* override_auto_accounting_flag */
3071: FROM
3072: ar_vat_tax vt,
3073: ar_cash_receipt_history crh,
3074: ar_cash_receipts cr ,
3075: ar_receivable_applications ra
3076: WHERE crh.cash_receipt_id = cr.cash_receipt_id
3077: and nvl(crh.current_record_flag, 'N') = 'Y'
4671: --
4672: -- lock the receipt
4673: --
4674: Declare--Add for bug 13582725
4675: temp_status AR_CASH_RECEIPT_HISTORY.STATUS%TYPE;
4676: BEGIN
4677: select STATUS into temp_status
4678: FROM AR_CASH_RECEIPT_HISTORY
4679: WHERE CURRENT_RECORD_FLAG='Y' AND
4674: Declare--Add for bug 13582725
4675: temp_status AR_CASH_RECEIPT_HISTORY.STATUS%TYPE;
4676: BEGIN
4677: select STATUS into temp_status
4678: FROM AR_CASH_RECEIPT_HISTORY
4679: WHERE CURRENT_RECORD_FLAG='Y' AND
4680: CASH_RECEIPT_ID=p_entity_id;
4681: IF temp_status = 'REVERSED' THEN
4682: print(p_recursive_level,'Its a reversed receipt. Will be taken care seperatly');
4699: records into the following stmts */
4700: cursor dist_crh_cur is
4701: select 'Found' record_found
4702: FROM ar_distributions dist,
4703: ar_cash_receipt_history crh
4704: where crh.cash_receipt_history_id = dist.source_id (+)
4705: AND crh.cash_receipt_id = p_entity_id
4706: FOR UPDATE OF crh.cash_receipt_id,
4707: dist.source_id NOWAIT;
4732: SELECT 'Found' record_found
4733: FROM ar_distributions dist,
4734: ar_payment_schedules ps,
4735: ar_receivable_applications ra,
4736: ar_cash_receipt_history crh,
4737: ar_cash_receipts cr
4738: WHERE cr.cash_receipt_id = p_entity_id
4739: AND cr.cash_receipt_id = crh.cash_receipt_id
4740: AND cr.cash_receipt_id = ra.cash_receipt_id (+)
4843: l_unpurgeable_histories NUMBER;
4844: BEGIN
4845: SELECT COUNT(*)
4846: INTO l_unpurgeable_histories
4847: FROM ar_cash_receipt_history
4848: WHERE cash_receipt_id = p_entity_id
4849: AND
4850: (
4851: posting_control_id = -3 OR
4858: END IF;
4859: -- 5715943
4860: SELECT COUNT(*)
4861: INTO l_unpurgeable_histories
4862: FROM ar_cash_receipt_history
4863: WHERE cash_receipt_id = p_entity_id
4864: AND current_record_flag = 'Y'
4865: AND
4866: (
4906: l_statement_reconciliation NUMBER;
4907: BEGIN
4908: SELECT COUNT(*)
4909: INTO l_statement_reconciliation
4910: FROM ar_cash_receipt_history crh,
4911: ce_statement_reconciliations sr
4912: WHERE cash_receipt_id = p_entity_id
4913: AND crh.cash_receipt_history_id = sr.reference_id
4914: AND sr.reference_type = 'RECEIPT'
4938: CURSOR cur_batch_id(l_receipt_id NUMBER) IS
4939: SELECT bat.batch_id
4940: FROM ar_batches bat,
4941: (SELECT distinct batch_id
4942: FROM ar_cash_receipt_history
4943: WHERE cash_receipt_id = l_receipt_id) crh
4944: WHERE crh.batch_id = bat.batch_id
4945: FOR UPDATE OF bat.batch_id NOWAIT ;
4946: --
4946: --
4947: CURSOR cur_trans_id(l_receipt_id NUMBER) IS
4948: SELECT bat.transmission_request_id
4949: FROM ar_batches bat,
4950: ar_cash_receipt_history crh
4951: WHERE crh.cash_receipt_id = l_receipt_id
4952: AND crh.batch_id = bat.batch_id
4953: AND crh.first_posted_record_flag = 'Y';
4954:
4974: DELETE FROM ar_distributions
4975: WHERE source_id in
4976: (
4977: SELECT cash_receipt_history_id
4978: FROM ar_cash_receipt_history
4979: WHERE cash_receipt_id = p_entity_id
4980: )
4981: AND source_table = 'CRH';
4982:
4981: AND source_table = 'CRH';
4982:
4983: --
4984: -- Bug 2021718: call the entity handler for
4985: -- ar_cash_receipt_history rather
4986: -- then doing the delete in this package.
4987: -- DELETE FROM ar_cash_receipt_history
4988: -- WHERE cash_receipt_id = p_entity_id;
4989:
4983: --
4984: -- Bug 2021718: call the entity handler for
4985: -- ar_cash_receipt_history rather
4986: -- then doing the delete in this package.
4987: -- DELETE FROM ar_cash_receipt_history
4988: -- WHERE cash_receipt_id = p_entity_id;
4989:
4990: arp_cr_history_pkg.delete_p_cr(p_entity_id);
4991:
4998: FORALL i IN l_batch_id.FIRST..l_batch_id.LAST
4999: DELETE FROM ar_batches
5000: WHERE batch_id = l_batch_id(i)
5001: AND NOT EXISTS ( SELECT 'x'
5002: FROM ar_cash_receipt_history h
5003: WHERE h.batch_id = l_batch_id(i) );
5004:
5005: --
5006: -- There could be multiple records within this batch
5247: cp_max_recpt_id NUMBER
5248: ) IS
5249: select CR.CASH_RECEIPT_ID
5250: FROM AR_CASH_RECEIPTS CR,
5251: AR_CASH_RECEIPT_HISTORY CRH
5252: WHERE
5253: CR.CASH_RECEIPT_ID=CRH.CASH_RECEIPT_ID AND
5254: CRH.STATUS ='REVERSED' AND
5255: CRH.CURRENT_RECORD_FLAG='Y' AND
5328: WHERE CASH_RECEIPT_ID=cr_id
5329: FOR UPDATE OF CASH_RECEIPT_ID NOWAIT;
5330:
5331: CURSOR c_crh (cr_id NUMBER) IS
5332: SELECT 'X' FROM AR_CASH_RECEIPT_HISTORY
5333: WHERE CASH_RECEIPT_ID=cr_id
5334: FOR UPDATE OF CASH_RECEIPT_ID NOWAIT;
5335:
5336: CURSOR c_ard( cr_id number) IS
5337: SELECT 'X' FROM ar_distributions
5338: WHERE source_id in
5339: (
5340: SELECT cash_receipt_history_id
5341: FROM ar_cash_receipt_history
5342: WHERE cash_receipt_id = cr_id
5343: )
5344: AND source_table = 'CRH'
5345: FOR UPDATE OF SOURCE_ID NOWAIT;
5374: DELETE FROM ar_distributions
5375: WHERE source_id in
5376: (
5377: SELECT cash_receipt_history_id
5378: FROM ar_cash_receipt_history
5379: WHERE cash_receipt_id = l_rcpt_id
5380: )
5381: AND source_table = 'CRH';
5382: