DBA Data[Home] [Help]

PACKAGE BODY: APPS.CHV_ITEM_ORDERS_S1

Source


1 PACKAGE BODY CHV_ITEM_ORDERS_S1 as
2 /* $Header: CHVPRIOB.pls 115.1 2002/11/26 23:55:40 sbull ship $ */
3 
4 /*========================= CHV_ITEM_ORDERS_S1 ==============================*/
5 
6 /*=============================================================================
7 
8   PROCEDURE NAME:     get_past_due_qty()
9 
10 =============================================================================*/
11 PROCEDURE get_past_due_qty(x_schedule_id                 IN      NUMBER,
12                            x_schedule_item_id            IN      NUMBER,
13                            x_horizon_start_date          IN      DATE,
14                            x_past_due_qty_primary        IN OUT NOCOPY  NUMBER,
15                            x_past_due_qty_purch          IN OUT NOCOPY  NUMBER) IS
16 
17   x_progress VARCHAR2(3) := NULL;
18 
19 BEGIN
20 
21   SELECT SUM(order_quantity),
22          SUM(order_quantity_primary)
23   INTO x_past_due_qty_purch,
24        x_past_due_qty_primary
25   FROM chv_item_orders
26   WHERE schedule_id              = x_schedule_id
27   AND   schedule_item_id         = x_schedule_item_id
28   AND   due_date                 < x_horizon_start_date
29 --  AND   document_approval_status = 'FIRM'
30   AND   supply_document_type     = 'RELEASE';
31 
32   EXCEPTION
33     WHEN OTHERS THEN
34       po_message_s.sql_error('get_past_due_qty', x_progress,sqlcode);
35       RAISE;
36 
37 END get_past_due_qty ;
38 
39 /*=============================================================================
40 
41   PROCEDURE NAME:     get_auth_qty()
42 
43 =============================================================================*/
44 PROCEDURE get_auth_qty (x_schedule_id                 IN      NUMBER,
45                         x_schedule_item_id            IN      NUMBER,
46                         x_authorization_end_date      IN      DATE,
47                         x_authorization_qty           IN OUT NOCOPY  NUMBER,
48                         x_authorization_qty_primary   IN OUT NOCOPY  NUMBER) IS
49 
50   x_progress VARCHAR2(3) := NULL;
51 
52 BEGIN
53 
54 /*
55  * Initialize the quantities to 0 in case there are no records found.
56  */
57   x_authorization_qty := 0;
58   x_authorization_qty_primary := 0;
59 
60   SELECT SUM(order_quantity),
61          SUM(order_quantity_primary)
62   INTO x_authorization_qty,
63        x_authorization_qty_primary
64   FROM chv_item_orders
65   WHERE schedule_id      = x_schedule_id
66   AND   schedule_item_id = x_schedule_item_id
67   AND   due_date         < x_authorization_end_date;
68 
69   EXCEPTION
70     WHEN OTHERS THEN
71       po_message_s.sql_error('get_auth_qty', x_progress, sqlcode);
72       RAISE;
73 
74 END get_auth_qty;
75 
76 END CHV_ITEM_ORDERS_S1;