1 PACKAGE CHV_CREATE_AUTHORIZATIONS AUTHID CURRENT_USER as
2 /*$Header: CHVPRAUS.pls 115.0 99/07/17 01:29:36 porting ship $*/
3
4 /*===========================================================================
5 PACKAGE NAME: CHV_CREATE_AUTHORIZATIONS
6 DESCRIPTION: This package contains the server side of Supplier Scheduling
7 APIs to calculate authorization quantity.
8
9 CLIENT/SERVER: Server
10
11 OWNER: Sri Rumalla
12
13 FUNCTION:
14 insert_authorizations()
15 calc_high_auth_qty()
16
17 ============================================================================*/
18
19 /*===========================================================================
20 PROCEDURE NAME : insert_authorizations
21
22 DESCRIPTION : CALC_AUTH_QTY is a procedure to calculate authorizations
23 for a scheduled item based on certain organization
24 options, ASL defaults and scheduling parameters.
25
26 PARAMETERS : p_organization_id IN NUMBER,
27 p_schedule_id IN NUMBER,
28 p_schedule_item_id IN NUMBER,
29 p_asl_id IN NUMBER,
30 p_horizon_start_date IN DATE,
31 p_horizon_end_date IN DATE,
32 p_vendor_id IN NUMBER,
33 p_vendor_site_id IN NUMBER,
34 p_item_id IN NUMBER,
35 p_starting_auth_quantity IN NUMBER,
36 p_starting_auth_qty_primary IN NUMBER,
37 p_cum_period_end_date IN DATE,
38 p_starting_cum_quantity IN NUMBER,
39 p_starting_cum_qty_primary IN NUMBER,
40 p_purch_unit_of_measure IN VARCHAR2,
41 p_primary_unit_of_measure IN VARCHAR2,
42
43 DESIGN REFERENCES :
44
45 ALGORITHM : Get ASL authorization enabled information from
46 PO_APPROVED_SUPPLIER_LIST based on the incoming
47 parameters.
48
49 If enable_authorizations_flag = 'Y' do the following:
50 Get past due quantity in purchasing and primary UOM's
51 based on the x_horizon_start_date.
52
53 Get cum information for the organization and supplier
54 item from CHV_ORG_OPTIONS, CHV_CUM_PERIODS and
55 CHV_CUM_PERIOD_ITEMS tables.
56
57 For every authorization_code in CHV_AUTHORIZATIONS
58 based on the ASL do the following:
59
60 Calculate authorization end date for each
61 authorization based on the x_horizon_end_date,
62 cum_period_end_date, horizon_start_date +
63 timefence_days. Authorization end date is set to
64 the earliest of the above three dates.
65
66 Get authorization quantities in purchasing and
67 primary UOM's from CHV_ITEM_ORDERS based on the
68 authorization end date calculated above.
69
70 Insert into CHV_AUTHORIZATIONs table the
71 authorization code data.
72
73 NOTES :
74
75 OPEN ISSUES :
76
77 CLOSED ISSUES :
78
79 CHANGE HISTORY : Created 3-APR-1995 SXLIU
80 ==========================================================================*/
81 PROCEDURE insert_authorizations(
82 p_organization_id IN NUMBER,
83 p_schedule_id IN NUMBER,
84 p_schedule_item_id IN NUMBER,
85 p_asl_id IN NUMBER,
86 p_horizon_start_date IN DATE,
87 p_horizon_end_date IN DATE,
88 p_starting_auth_qty IN NUMBER,
89 p_starting_auth_qty_primary IN NUMBER,
90 p_starting_cum_qty IN NUMBER,
91 p_starting_cum_qty_primary IN NUMBER,
92 p_cum_period_end_date IN DATE,
93 p_purch_unit_of_measure IN VARCHAR2,
94 p_primary_unit_of_measure IN VARCHAR2,
95 p_enable_cum_flag IN VARCHAR2);
96
97
98 /*===========================================================================
99 PROCEDURE NAME : calc_high_auth_qty
100
101 DESCRIPTION : CALC_HIGH_AUTH_QTY is a procedure to calculate
102 high authorizations for each authorization code
103 for the scheduled item within a cum period. It is
104 called whenever a schedule header is confirmed.
105
106 PARAMETERS : p_organization_id IN NUMBER,
107 p_schedule_id IN NUMBER,
108 p_schedule_item_id IN NUMBER,
109 p_vendor_id IN NUMBER,
110 p_vendor_site_id IN NUMBER,
111 p_item_id IN NUMBER,
112 p_asl_id IN NUMBER,
113 p_horizon_start_date IN DATE,
114 p_cum_period_item_id IN NUMBER
115
116 DESIGN REFERENCES :
117
118 ALGORITHM :
119
120 NOTES :
121
122 OPEN ISSUES :
123
124 CLOSED ISSUES :
125
126 CHANGE HISTORY : Created 14-MAY-1995 SXLIU
127 ==========================================================================*/
128 PROCEDURE calc_high_auth_qty(p_organization_id IN NUMBER,
129 p_schedule_id IN NUMBER,
130 p_schedule_item_id IN NUMBER,
131 p_vendor_id IN NUMBER,
132 p_vendor_site_id IN NUMBER,
133 p_item_id IN NUMBER,
134 p_asl_id IN NUMBER,
135 p_horizon_start_date IN DATE,
136 p_cum_period_item_id IN NUMBER);
137
138 END CHV_CREATE_AUTHORIZATIONS;