1 PACKAGE BODY POS_HEADER_INFO_S AS
2 /* $Header: POSHEADB.pls 115.0 99/08/20 11:09:28 porting sh $ */
3
4
5 /* GetPaymentTerms
6 * ---------------
7 * PL/SQL function to get the payment terms either from the po header,
8 * or defaulted from the supplier site information.
9 */
10 FUNCTION GetPaymentTerms(p_sessionID NUMBER, p_vendorSiteID NUMBER)
11 RETURN NUMBER
12 IS
13
14 v_count NUMBER;
15 v_termID NUMBER;
16 x_progress VARCHAR2(3);
17
18 BEGIN
19
20 SELECT count(po_header_id)
21 INTO v_count
22 FROM POS_ASN_SHOP_CART_DETAILS
23 WHERE session_id = p_sessionID;
24
25 v_termID := NULL;
26
27 IF v_count = 1 THEN
28
29 -- all shipments in the shopping cart for this particular session ID
30 -- belong to the same PO, so we grab the term from the terms_id from
31 -- po_headers_all.
32 SELECT POH.terms_id
33 INTO v_termID
34 FROM PO_HEADERS_ALL POH,
35 POS_ASN_SHOP_CART_DETAILS POS
36 WHERE POH.po_header_id = POS.po_header_id
37 AND POS.session_id = p_sessionID;
38
39 ELSE
40
41 -- the shipments in the shopping car for this particular session ID
42 -- belong to different PO's, so we grab the payment term from the
43 -- supplier site instead.
44 SELECT terms_id
45 INTO v_termID
46 FROM PO_VENDOR_SITES
47 WHERE vendor_site_id = p_vendorSiteID;
48
49 END IF;
50
51 RETURN(v_termID);
52
53 EXCEPTION
54 WHEN OTHERS THEN
55 po_message_s.sql_error('GetPaymentTerms', x_progress, sqlcode);
56 RAISE;
57
58 END GetPaymentTerms;
59
60
61 END POS_HEADER_INFO_S;
62