1 PACKAGE okl_pay_invoices_cons_pvt AUTHID CURRENT_USER AS
2 /* $Header: OKLRPICS.pls 120.5 2007/11/08 21:34:59 cklee ship $ */
3 ------------------------------------------------------------------------------
4 -- Global Variables
5 ------------------------------------------------------------------------------
6
7 G_PKG_NAME CONSTANT VARCHAR2(200) := 'OKL_PAY_INVOICES_CONS_PVT';
8 G_APP_NAME CONSTANT VARCHAR2(3) := OKC_API.G_APP_NAME;
9 G_UNEXPECTED_ERROR CONSTANT VARCHAR2(200) := 'OKC_CONTRACTS_UNEXPECTED_ERROR';
10 G_SQLERRM_TOKEN CONSTANT VARCHAR2(200) := 'SQLERRM';
11 G_SQLCODE_TOKEN CONSTANT VARCHAR2(200) := 'SQLCODE';
12
13 ----------------------------------------------------------------------------
14 -- Data Structures
15 ----------------------------------------------------------------------------
16 TYPE disb_rules_type IS RECORD (
17 dra_rec OKL_DRA_PVT.dra_rec_type,
18 drv_rec OKL_DRV_PVT.drv_rec_type,
19 drs_rec OKL_DRS_PVT.drs_rec_type
20 );
21
22 TYPE disb_rules_tbl_type IS TABLE OF disb_rules_type
23 INDEX BY BINARY_INTEGER;
24
25
26 ---------------------------------------------------------------------------
27 -- Procedures and Functions
28 ---------------------------------------------------------------------------
29
30 PROCEDURE consolidation(p_api_version IN NUMBER
31 ,p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE
32 ,x_return_status OUT NOCOPY VARCHAR2
33 ,x_msg_count OUT NOCOPY NUMBER
34 ,x_msg_data OUT NOCOPY VARCHAR2
35 ,p_contract_number IN VARCHAR2 DEFAULT NULL
36 ,p_vendor IN VARCHAR2 DEFAULT NULL
37 ,p_vendor_site IN VARCHAR2 DEFAULT NULL
38 ,p_vpa_number IN VARCHAR2 DEFAULT NULL
39 ,p_stream_type_purpose IN VARCHAR2 DEFAULT NULL
40 ,p_from_date IN DATE DEFAULT NULL -- set p_from_date and p_to_date as not required
41 ,p_to_date IN DATE DEFAULT NULL); -- set p_from_date and p_to_date as not required
42
43
44 --start: 31-Oct-2007 cklee -- bug: 6508575 fixed
45 ----------------------------------------------------------------------------------
46 -- Start of comments
47 --
48 -- Procedure Name : get_ap_invoice_date
49 -- Description : Get the AP invoice date based on the following:
50 -- In p_transaction_date : OKL internal invoice transaction date
51 -- In p_vendor_id : vendor id
52 -- In p_vendor_site_id : vendor site id
53 -- In p_stream_type_purpose : stream type purpose
54 -- In p_adv_grouping_flag : advance grouping flag
55 -- OUT: Consolidation invoice date
56 -- Business Rules :
57 -- Business logic:
58 -- If criteria meet, set new invoice date as a grouping cirteria. Otherwise, set
59 -- invoice date as passed in transaction date.
60 -- Parameters :
61 -- Version : 1.0
62 -- End of comments
63 ----------------------------------------------------------------------------------
64 FUNCTION get_ap_invoice_date(
65 p_transaction_date IN DATE
66 ,p_vendor_id IN NUMBER
67 ,p_vendor_site_id IN NUMBER
68 ,p_stream_type_purpose IN VARCHAR2
69 ,p_adv_grouping_flag IN VARCHAR2 DEFAULT 'Y' -- reserved for future use
70 ) RETURN DATE;
71
72 ----------------------------------------------------------------------------------
73 -- Start of comments
74 --
75 -- Procedure Name : get_Disbursement_group
76 -- Description : Get Disbursement group
77 -- In p_transaction_date : OKL internal invoice transaction date
78 -- In p_vendor_id : vendor id
79 -- In p_vendor_site_id : vendor site id
80 -- In p_stream_type_purpose : stream type purpose
81 -- In p_adv_grouping_flag : advance grouping flag
82 -- OUT: Disbursement term
83 -- Business Rules :
84 -- Business logic:
85 -- If criteria meet, set Term name as a grouping cirteria. Otherwise, set
86 -- stream type purpose as a grouping criteria.
87 -- Parameters :
88 -- Version : 1.0
89 -- End of comments
90 ----------------------------------------------------------------------------------
91 FUNCTION get_Disbursement_group(
92 p_transaction_date IN DATE -- reserved for future use
93 ,p_vendor_id IN NUMBER
94 ,p_vendor_site_id IN NUMBER
95 ,p_stream_type_purpose IN VARCHAR2
96 ,p_adv_grouping_flag IN VARCHAR2 DEFAULT 'Y' -- reserved for future use
97 ) RETURN VARCHAR2;
98
99 ----------------------------------------------------------------------------------
100 -- Start of comments
101 --
102 -- Procedure Name : get_contract_group
103 -- Description : get_contract_group
104 -- In p_transaction_date : OKL internal invoice transaction date
105 -- In p_vendor_id : vendor id
106 -- In p_vendor_site_id : vendor site id
107 -- In p_stream_type_purpose : stream type purpose
108 -- In p_adv_grouping_flag : advance grouping flag
109 -- OUT: Disbursement term
110 -- Business Rules :
111 -- Business logic:
112 -- If criteria meet, set contract number as a grouping cirteria. Otherwise, set
113 -- contract number as null.
114 -- Parameters :
115 -- Version : 1.0
116 -- End of comments
117 ----------------------------------------------------------------------------------
118 FUNCTION get_contract_group(
119 p_transaction_date IN DATE -- reserved for future use
120 ,p_vendor_id IN NUMBER
121 ,p_vendor_site_id IN NUMBER
122 ,p_stream_type_purpose IN VARCHAR2
123 ,p_contract_number IN VARCHAR2
124 ,p_adv_grouping_flag IN VARCHAR2 DEFAULT 'Y' -- reserved for future use
125 ) RETURN VARCHAR2;
126
127 ----------------------------------------------------------------------------------
128 -- Start of comments
129 --
130 -- Procedure Name : get_Disbursement_rule
131 -- Description : Get Disbursement rule
132 -- In p_transaction_date : OKL internal invoice transaction date
133 -- In p_vendor_id : vendor id
134 -- In p_vendor_site_id : vendor site id
135 -- In p_stream_type_purpose : stream type purpose
136 -- In p_adv_grouping_flag : advance grouping flag
137 -- OUT: Disbursement term
138 -- Business Rules :
139 -- Business logic:
140 -- If criteria meet, set Term name as a grouping cirteria. Otherwise, set
141 -- okl_txl_ap_inv_lns_all_b.id as a grouping criteria.
142 -- Note: No rule, no consolidation
143 -- Parameters :
144 -- Version : 1.0
145 -- End of comments
146 ----------------------------------------------------------------------------------
147 FUNCTION get_Disbursement_rule(
148 p_transaction_date IN DATE -- reserved for future use
149 ,p_okl_invoice_line_id IN NUMBER -- okl_txl_ap_inv_lns_all_b.id
150 ,p_vendor_id IN NUMBER
151 ,p_vendor_site_id IN NUMBER
152 ,p_stream_type_purpose IN VARCHAR2
153 ,p_adv_grouping_flag IN VARCHAR2 DEFAULT 'Y' -- reserved for future use
154 ) RETURN VARCHAR2;
155
156 --end: 31-Oct-2007 cklee -- bug: 6508575 fixed
157
158 END OKL_PAY_INVOICES_CONS_PVT;