1 PACKAGE BODY AP_WEB_OA_CUSTOM_PKG AS
2 /* $Header: apwcstmb.pls 120.4 2005/10/02 20:11:25 albowicz noship $ */
3
4
5 ------------------------------------------------------------------------------------
6 -- Function : GetCustomizedExpRepSummary
7 -- Author : krmenon
8 -- Description: This function is part of the client extension solution which provides
9 -- a way to display a customized Expense Report Summary in the
10 -- Review Page and the Confirmation Page.
11 -- Assumptions: In order to enable access to the amounts that the user has entered, for
12 -- performing calculations, the user must save the expense report. If the
13 -- user has not saved the expense report, before reaching the Review Page,
14 -- the input parameter will be a null string.
15 -- NO EXCEPTIONS ARE PROPAGATED TO THE CLIENT!!!
16 -- Please handle all error conditions in the customization itself. Do not
17 -- raise any exceptions.
18 --
19 -- Parameters :
20 --
21 -- P_ReportHeaderId Contains the Expense Report Header Id
22 -- P_CurrentPage Contains the page where the call was made (Current Page)
23 ------------------------------------------------------------------------------------
24 FUNCTION GetCustomizedExpRepSummary(P_ReportHeaderId IN VARCHAR2,
25 P_CurrentPage IN VARCHAR2) RETURN VARCHAR2 IS
26 l_msgtxt VARCHAR2(2000);
27 BEGIN
28 /*--------------------------------------------------------------+
29 |If the report has not been saved, the report header id passed |
30 |into this routine will be null. The default behaviour is that |
31 |the fucntion will return null. If you wish to display a |
32 |message then customixe the if statement to return the |
33 |appropriate message. |
34 +--------------------------------------------------------------*/
35 IF (P_ReportHeaderId IS NULL OR P_ReportHeaderId = '') THEN
36 --
37 -- For customization, the error message goes here if the expense report
38 -- is not saved. Replace the 'NULL' with your customized error/warning
39 -- message.
40 --
41 -- SAMPLE CODE
42 --
43 -- If you have translation, you can use the FND_MESSAGE functionality
44 -- to create your translatable message.
45 --
46 -- l_msgtxt := '<table cellpadding="0" cellspacing="0" border="0" width="100%" summary="">'||
47 -- '<tr><td height="4"></td></tr>'||
48 -- '<tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%" summary="">'||
49 -- ' <tr><td width="100%" class="OraHeader">Expense Report Summary</td></tr>'||
50 -- ' <tr><td class="OraBGAccentDark"></td></tr>'||
51 -- ' </table></td></tr>'||
52 -- '<tr><td height="2"></td></tr>'||
53 -- '<tr><td><b><font size="2" face="Arial, Helvetica, sans-serif">'||
54 -- 'Your expense account must be "saved" to ensure the calculated totals below include '||
55 -- 'all appropriate amounts. If you have not done so please do so now.'||
56 -- '</tr></td>'||
57 -- '<tr><td height="4"></td></tr>'||
58 -- '<tr><td><table cellpadding="0" cellspacing="0" border="0" width="60%" summary="">'||
59 -- ' <tr><td><span class="OraPromptText">Total Expense Amount</span></td>'||
60 -- ' <td class="OraDataText" align="right" nowrap>0.00</td>'||
61 -- ' </tr>'||
62 -- ' <tr><td><span class="OraPromptText">Amount Paid to You by paycheck</span></td>'||
63 -- ' <td class="OraDataText" align="right" nowrap>0.00</td>'||
64 -- ' </tr>'||
65 -- ' <tr><td><span class="OraPromptText">Amount Paid to Credit card bank on your behalf'||
66 -- '</span></td>'||
67 -- ' <td class="OraDataText" align="right" nowrap>0.00</td>'||
68 -- ' </tr></table>'||
69 -- '</td></tr></table><p></p>';
70
71 l_msgtxt := NULL;
72
73 ELSE
74 --
75 -- For customization, call your custom function which returns the
76 -- message text to be displayed. The returned text should have all
77 -- formatting done.
78 --
79 -- SAMPLE CODE
80 --
81 -- l_msgtxt := <Package Name>.<Function Name>(P_ReportHeaderId, P_CurrentPage);
82 --
83
84 l_msgtxt := NULL;
85
86 END IF;
87
88 RETURN l_msgtxt;
89
90 END GetCustomizedExpRepSummary;
91
92
93 ------------------------------------------------------------------------------------
94 -- Function : GetNewExpenseReportInvoice
95 -- Author : Quan Le
96 -- Description: This is to enable customers to customize the way expense report invoice
97 -- is created.
98 -- Assumptions: Note that the max length of the report number is 50.
99 --
100 -- Parameters :
101 --
102 -- p_employeeId id of the employee whom the report is for
103 -- p_userId fnd user_id of the employee whom the report is for
104 -- p_reportHeaderId report_header_id of the curent report
105 ------------------------------------------------------------------------------------
106 FUNCTION GetNewExpenseReportInvoice(p_employeeId IN ap_expense_report_headers.employee_id%TYPE,
107 p_userId IN fnd_user.user_id%TYPE,
108 p_reportHeaderId IN ap_expense_report_headers.report_header_id%TYPE) RETURN VARCHAR2 IS
109 l_reportNumber ap_expense_report_headers.invoice_num%TYPE := NULL;
110 l_userName fnd_user.user_name%TYPE := null;
111 l_nReport NUMBER := 0;
112 BEGIN
113 -- IF (p_employeeId is not NULL AND p_userId is not NULL) THEN
114 -- SAMPLE CODE
115 -- If you want to access the AP_WEB_REPNUM_PREFIX profile option,
116 -- use the following function:
117 -- fnd_profile.value_specific( 'AP_WEB_REPNUM_PREFIX', p_userId )
118 --
119 -- The following sample code will generate the report invoice of <userid><YY-DDMMHHMI><-><number> format
120 -- where:
121 -- userid : the employee's user name
122 -- YY : the las 2 digit of the current year and
123 -- number : the total number of expense reports the employee has
124 -- for the current year including the current report.
125 --
126 --
127 -- Get the user name
128 -- SELECT user_name INTO l_userName
129 -- FROM fnd_user fnd
130 -- WHERE fnd.employee_id = p_employeeId
131 -- AND fnd.user_id = p_userId
132 -- AND sysdate <= nvl(fnd.end_date, sysdate)
133 -- AND rownum = 1;
134
135 -- Get the total of the number of expense report
136 -- this employee has for current year
137 -- SELECT count(*) INTO l_nReport
138 -- FROM ap_expense_report_headers
139 -- WHERE employee_id = p_employeeId
140 -- AND to_char(sysdate, 'RR') = to_char(CREATION_DATE, 'RR');
141
142 -- l_nReport := l_nReport + 1;
143
144 -- Max length of the report number is 50
145 -- l_reportNumber := SUBSTR(l_userName, 1, 30) || to_char(sysdate,'RR-DDMMHHMI') || '-'|| ltrim(to_char(l_nReport,'0999'));
146 -- END IF;
147
148 RETURN l_reportNumber;
149
150 EXCEPTION
151 WHEN NO_DATA_FOUND THEN
152 RETURN NULL;
153
154 WHEN OTHERS THEN
155 return NULL;
156
157 END GetNewExpenseReportInvoice;
158
159
160
161 END AP_WEB_OA_CUSTOM_PKG;