DBA Data[Home] [Help]

PACKAGE: APPS.PO_AUTOCREATE_POSTPROC_PVT

Source


1 PACKAGE po_autocreate_postproc_pvt AUTHID CURRENT_USER AS
2 /* $Header: PO_AUTOCREATE_POSTPROC_PVT.pls 120.4.12020000.2 2013/05/08 08:28:52 akyanama ship $ */
3 
4 
5 
6 x_headers PO_AUTOCREATE_TYPES.headers_rec_type;
7 
8 CURSOR c_doc IS
9   SELECT PHI.interface_header_id                   INTERFACE_HEADER_ID,
10          DFT.document_id                           PO_HEADER_ID,
11          PHI.action                                ACTION,
12          PHI.draft_id                              DRAFT_ID,
13          PHI.approval_status                       INTF_AUTH_STATUS,
14          PHI.effective_date                        INTF_START_DATE,
15          PHI.load_sourcing_rules_flag              LOAD_SOURCING_RULES_FLAG,
16          DECODE(POH.type_lookup_code,
17                 'QUOTATION', POH.status_lookup_code,
18                 POH.authorization_status)          ORIG_AUTH_STATUS,
19          POH.conterms_exist_flag                   ORIG_CONTERMS_EXIST_FLAG,
20          POH.user_hold_flag                        ORIG_USER_HOLD_FLAG,
21          PHI.original_po_header_id                 ORIG_PO_HEADER_ID,
22          COALESCE(PHDA.global_agreement_flag,
23                   POH.global_agreement_flag, 'N')  GA_FLAG,
24          NVL(PHDA.agent_id,
25              POH.agent_id)                         AGENT_ID,
26          NVL(PHDA.encumbrance_required_flag,
27              POH.encumbrance_required_flag)        ENCUMBRANCE_REQUIRED_FLAG,
28          NVL(PHDA.conterms_exist_flag,
29              POH.conterms_exist_flag)              CONTERMS_EXIST_FLAG,
30          NVL(PHDA.type_lookup_code,
31              POH.type_lookup_code)                 DOCUMENT_TYPE,
32          NVL(PHDA.quote_type_lookup_code,
33              POH.quote_type_lookup_code)           DOCUMENT_SUBTYPE,
34          NVL(PHDA.segment1,
35              POH.segment1)                         DOCUMENT_NUM,
36          NVL(PHDA.vendor_id,
37              POH.vendor_id)                        VENDOR_ID,
38          NVL(PV1.vendor_name,
39              PV2.vendor_name)                      VENDOR_NAME,
40          NVL2(PHI.document_num, 'Y', 'N')          DOC_NUM_PROVIDED,  --bug5028275
41          PHI.created_by                            CREATED_BY,
42          PHI.last_update_login                     LAST_UPDATE_LOGIN,
43          PHI.style_id                              PO_STYLE_ID
44   FROM po_headers_interface PHI,
45        po_headers_draft_all PHDA,
46        po_headers_all       POH,
47        po_drafts            DFT,
48        po_vendors           PV1,
49        po_vendors           PV2
50   WHERE  DFT.draft_id     = PO_AUTOCREATE_PARAMS.g_draft_id
51   AND    DFT.draft_id     = PHDA.draft_id(+)
52   AND    DFT.document_id  = PHDA.po_header_id(+)
53   AND    PHDA.vendor_id   = PV1.vendor_id(+)
54   AND    DFT.document_id  = POH.po_header_id(+)
55   AND    POH.vendor_id    = PV2.vendor_id(+)
56   AND    PHI.interface_header_id = PO_AUTOCREATE_PARAMS.x_interface_header_id;
57 
58 
59 SUBTYPE doc_row_type IS c_doc%ROWTYPE;
60 
61 /* ----------------------------------------------------
62 ----------------- PUBLIC PROCEDURES -------------------
63 ---------------------------------------------------- */
64 
65 /* ============================================================================
66      NAME: process
67      DESC: Main Procedure for the AutoCreate Post Processing logic which includes -
68 
69            - Creating Document from the Draft
70            - Copy Attachment
71            - Calculate Tax
72            - Wrapup
73 
74 ==============================================================================*/
75 
76 PROCEDURE process;
77 
78 
79 /*
80 -------------------------------------------------------
81 ---------------- PRIVATE PROCEDURES -------------------
82 -------------------------------------------------------
83 
84 
85 
86 /* ============================================================================
87      NAME: create_standard_po
88      DESC: Performs necessary post processing action to create a standard po.
89 
90            - Get the document num
91            - Transfer data from draft to base
92            - Calculate Tax
93 
94      ARGS: IN :  p_doc_rec     doc_row_type   -Some attribute values of the document
95 
96      NOTE: This procedure is called from process()
97 
98  ==============================================================================*/
99 
100 PROCEDURE create_standard_po(p_doc_rec IN doc_row_type);
101 
102 
103 
104 /* ============================================================================
105      NAME: create_blanket
106      DESC: Performs necessary post processing action to create a blanket.
107 
108            - Get the document num
109            - Transfer data from draft to base
110 
111      ARGS: IN :  p_doc_rec     doc_row_type   -Some attribute values of the document
112 
113      NOTE: This procedure is called from process()
114 
115  ==============================================================================*/
116 
117 PROCEDURE create_blanket(p_doc_rec IN doc_row_type);
118 
119 
120 /* ============================================================================
121      NAME: calculate_tax
122      DESC: Procedure to calculate Tax.
123 
124      ARGS: IN :  p_doc_rec     doc_row_type   -Some attribute values of the document
125 
126      NOTE: Use the function PO_TAX_INTERFACE_PVT.calculate_tax()
127 
128  ==============================================================================*/
129 
130 PROCEDURE calculate_tax(p_doc_rec IN doc_row_type);
131 
132 
133 
134 /* ============================================================================
135      NAME: copy_attachment
136      DESC: Copy the Header and Line level attachment.
137 
138      ARGS: IN :  p_doc_rec     doc_row_type   -Some attribute values of the document
139 
140      NOTE: Use the FND function fnd_attached_documents2_pkg.copy_attachments()
141 
142  ==============================================================================*/
143 
144 PROCEDURE copy_attachment (p_doc_rec IN doc_row_type, p_is_mod IN VARCHAR2 default 'N');
145 
146 -- CLM Autocreate - convert funding to info SLIN
147 PROCEDURE convert_fund_to_info_slin(   p_po_header_id_tbl IN PO_TBL_NUMBER,
148                                         p_po_line_id_tbl IN PO_TBL_NUMBER,
149                                         p_draft_id_tbl IN PO_TBL_NUMBER
150                                     );
151 --bug 16425245 create_doc_from_draft_check a public function.
152 FUNCTION create_doc_from_draft_check (p_po_header_id IN NUMBER)
153       RETURN VARCHAR2;
154 --bug 16425245
155 
156 
157 END PO_AUTOCREATE_POSTPROC_PVT;