DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_INVOICE_UTILS

Source


1 package body PA_INVOICE_UTILS as
2 -- $Header: PAINUTLB.pls 120.0.12010000.5 2008/10/30 11:32:03 nkapling noship $
3 --
4 --  FUNCTION
5 --              Check_draft_invoice_exists
6 --
7 --
8 Function check_draft_invoice_exists (x_project_id     IN number,
9                                      x_customer_id	   IN number)
10 return number
11 is
12         cursor c1 is
13                 SELECT 1
14                 FROM    sys.dual
15                 WHERE exists (SELECT NULL
16                         FROM   pa_draft_invoices a, pa_agreements b
17                         WHERE  a.project_id   = x_project_id
18                         AND    a.agreement_id = b.agreement_id
19                         AND    b.customer_id  = x_customer_id );
20 /*                      AND    a.transfer_status_code = 'A');  commented for bug 6636321*/
21         c1_rec c1%rowtype;
22 begin
23 
24    if (x_project_id is null and x_customer_id is null) then
25       return(null);
26    end if;
27 
28    open c1;
29    fetch c1 into c1_rec;
30    if c1%notfound then
31       close c1;
32       return(0);
33    else
34       close c1;
35       return(1);
36    end if;
37 
38 exception
39    when others then
40       return(SQLCODE);
41 end check_draft_invoice_exists;
42 
43 -------------------------------------------------------------
44 
45 END PA_INVOICE_UTILS;