1 PACKAGE BODY PO_LINES_PKG_SCU as
2 /* $Header: POXPIL5B.pls 115.6 2002/11/26 23:36:59 sbull ship $ */
3
4 procedure check_unique(X_rowid VARCHAR2,
5 X_line_num NUMBER,
6 X_po_header_id NUMBER
7 ) is
8
9 X_Progress varchar2(3) := '';
10 dummy NUMBER;
11 begin
12 X_progress := '010';
13
14 SELECT 1
15 INTO dummy
16 FROM DUAL
17 WHERE not exists (SELECT 'this line num exists already'
18 FROM po_lines
19 WHERE po_header_id = X_po_header_id
20 AND line_num = X_line_num
21 AND (rowid <> X_rowid OR X_rowid is null));
22 exception
23 when no_data_found then
24 po_message_s.app_error('PO_PO_ENTER_UNIQUE_LINE_NUM');
25 when others then
26 po_message_s.sql_error('check_unique',X_progress,sqlcode);
27 raise;
28 end check_unique;
29
30 /*===========================================================================
31
32 PROCEDURE NAME: select_ship_total
33
34 ===========================================================================*/
35
36 procedure select_ship_total ( X_po_line_id IN NUMBER,
37 X_total IN OUT NOCOPY NUMBER,
38 X_total_RTOT_DB IN OUT NOCOPY NUMBER) is
39
40 X_progress varchar2(3) := '';
41
42 begin
43
44 /* Bug#2400791 : Modified the following select statement, to take into
45 account of the cancelled quantity also while updating the total_ship_qty
46 of the lines block */
47 X_progress := '010';
48
49 select nvl(sum(quantity),0) - nvl(sum(quantity_cancelled),0),
50 nvl(sum(quantity),0) - nvl(sum(quantity_cancelled),0)
51 into X_total,
52 X_total_RTOT_DB
53 from PO_LINE_LOCATIONS PLL
54 where PLL.PO_LINE_ID = X_po_line_id;
55
56 exception
57
58 when no_data_found then
59 null;
60
61 when others then
62 po_message_s.sql_error('select_ship_total',X_progress,sqlcode);
63 raise;
64
65 end select_ship_total;
66
67
68
69 END PO_LINES_PKG_SCU;