1 package body PO_POXAWDSTA_XMLP_PKG AS
2 /* $Header: POXAWDSTA_XMLB.pls 120.2 2011/02/10 06:10:58 nbingi noship $ */
3
4 FUNCTION AfterPForm RETURN Boolean IS
5 doc_date_where_a VARCHAR2(500);
6 doc_date_where_c VARCHAR2(500);
7
8
9 Begin
10
11 if (po_clm_clo_util.getclmstatus = 'Y') then
12 t_date_to := p_date_to + 1;
13 if p_issue_office is null then
14 doc_iss_off_where := '1=1';
15 else
16 doc_iss_off_where := 'PHA.CLM_ISSUING_OFFICE = :p_issue_office';
17 end if;
18
19 IF (p_clm_doc_num_from is null and p_clm_doc_num_to is null) then
20 doc_num_where := '1=1';
21
22 ELSiF (p_clm_doc_num_from is NOT null and p_clm_doc_num_to is null) then
23 doc_num_where := 'PHA.SEGMENT1 >= :p_clm_doc_num_from';
24
25 ELSiF (p_clm_doc_num_from is null and p_clm_doc_num_to is NOT null) then
26 doc_num_where := 'PHA.SEGMENT1 <= :p_clm_doc_num_to';
27
28 ELSiF (p_clm_doc_num_from is NOT null and p_clm_doc_num_to is NOT null) then
29 doc_num_where := 'PHA.SEGMENT1 BETWEEN :p_clm_doc_num_from AND :p_clm_doc_num_to';
30
31 END IF;
32
33 IF (p_date_from IS NULL AND t_date_to IS NULL) then
34 doc_date_where := '1=1';
35
36 ELSE
37 iF (p_date_from IS NOT NULL AND t_date_to IS NULL) then
38
39 doc_date_where_a := 'PHA.APPROVED_DATE >= :p_date_from';
40 doc_date_where_c := 'PHA.CREATION_DATE >= :p_date_from';
41
42 ELSiF (p_date_from IS NULL AND t_date_to IS NOT NULL) then
43
44 doc_date_where_a := 'PHA.APPROVED_DATE <= :t_date_to';
45 doc_date_where_c := 'PHA.CREATION_DATE <= :t_date_to';
46
47 ELSiF (p_date_from IS NOT NULL AND t_date_to IS NOT NULL) then
48
49 doc_date_where_a := 'PHA.APPROVED_DATE BETWEEN :p_date_from AND :t_date_to';
50 doc_date_where_c := 'PHA.CREATION_DATE BETWEEN :p_date_from AND :t_date_to';
51
52 END IF;
53 doc_date_where := '((PHA.APPROVED_DATE IS NOT NULL AND ' || doc_date_where_a ||
54 ' ) OR (PHA.APPROVED_DATE IS NULL AND ' || doc_date_where_c || ' ))';
55
56 END IF;
57 else
58 doc_num_where := '1=2';
59 doc_date_where := '1=2';
60 doc_iss_off_where := '1=2';
61 end if;
62
63 RETURN (TRUE);
64 END AfterPForm;
65
66 FUNCTION getClmDocNum(doc_num in VARCHAR2) return VARCHAR2 IS
67 doc_num_desc VARCHAR2(200) := '';
68 Begin
69 if doc_num is not null then
70 select PH.CLM_DOCUMENT_NUMBER
71 into doc_num_desc
72 FROM PO_HEADERS PH
73 WHERE PH.SEGMENT1 = doc_num;
74 end if;
75
76 RETURN (doc_num_desc);
77
78 exception
79 when others then
80 doc_num_desc := doc_num;
81 RETURN (doc_num_desc);
82 END getClmDocNum;
83
84 FUNCTION getIssueOfficeCode return VARCHAR2 IS
85 issue_office_desc VARCHAR2(200) := '';
86 Begin
87
88 if p_issue_office is not null then
89 select hrall.location_code
90 into issue_office_desc
91 FROM hr_locations_all hrall, hr_location_extra_info loceit
92 WHERE loceit.location_id = hrall.location_id
93 and loceit.information_type = 'CLM_OFFICE_CODE'
94 and po_uda_data_util.is_location_valid(hrall.location_id, 'ISSUING_OFFICE') = 'Y'
95 and hrall.location_id = p_issue_office;
96 end if;
97
98 RETURN (issue_office_desc);
99
100 exception
101 when others then
102 issue_office_desc := p_issue_office;
103 RETURN (issue_office_desc);
104 END getIssueOfficeCode;
105
106 END PO_POXAWDSTA_XMLP_PKG;
107