1 PACKAGE BODY PSA_MF_GL_TRANSFER_PKG AS
2 /* $Header: PSAMFGLB.pls 120.3 2006/09/13 12:54:44 agovil ship $ */
3
4 /**********************************/
5 /******* Transactions Body ********/
6 /**********************************/
7
8
9 FUNCTION psa_mf_trx_transfer(p_trx_rec in PSA_MFAR_UTILS.trx_rec)
10 RETURN varchar2
11 IS
12 ret_val varchar2(15) ;
13 errbuf varchar2(15);
14 retcode varchar2(15);
15 run_num number;
16 ret2 varchar2(15);
17 BEGIN
18 ret2 := psa_mf_MFAR_trx_jes(p_trx_rec);
19
20 update psa_mf_trx_dist_all
21 set posting_control_id = p_trx_rec.pst_ctrl_id
22 where cust_trx_line_gl_dist_id in (select cust_trx_line_gl_dist_id
23 from ra_cust_trx_line_gl_dist
24 where customer_trx_id = p_trx_rec.customer_trx_id);
25
26 RETURN ret_val;
27 END psa_mf_trx_transfer;
28
29
30 /**********************************/
31 /******* Adjustments Body ********/
32 /**********************************/
33 FUNCTION psa_mf_adj_transFer(p_adj_rec in PSA_MFAR_UTILS.adj_rec)
34 RETURN varchar2
35 IS
36 ret_val varchar2(15) ;
37 ret2 varchar2(15);
38
39 BEGIN
40 ret2 := psa_mf_MFAR_adj_jes(p_adj_rec);
41
42 update psa_mf_adj_dist_all
43 set posting_control_id = p_adj_rec.pst_ctrl_id
44 where adjustment_id = p_adj_rec.adjustment_id;
45
46 RETURN ret_val;
47 END psa_mf_adj_transfer;
48
49
50 /**********************************/
51 /******* Receipts Body ********/
52 /**********************************/
53 FUNCTION psa_mf_rct_transfer(p_rct_rec in PSA_MFAR_UTILS.rct_rec)
54 RETURN varchar2
55 IS
56 ret_val varchar2(15) ;
57 ret2 varchar2(15);
58
59 BEGIN
60 ret2 := psa_mf_MFAR_rct_jes(p_rct_rec);
61
62 update psa_mf_rct_dist_all
63 set posting_control_id = p_rct_rec.pst_ctrl_id
64 where receivable_application_id = p_rct_rec.ra_receivable_application_id;
65
66 RETURN ret_val;
67 END psa_mf_rct_transfer;
68
69 /******************************************************/
70 /* Function to Insert TRX additionalMFAR jes into GL Interface */
71 /******************************************************/
72 FUNCTION psa_mf_MFAR_trx_jes(p_trx_rec in PSA_MFAR_UTILS.trx_rec)
73 return varchar2
74 IS
75 BEGIN
76 RETURN 'TRUE';
77 END psa_mf_MFAR_trx_jes;
78
79 /******************************************************/
80 /* Function to Insert ADJ additionalMFAR jes into GL Interface */
81 /******************************************************/
82 FUNCTION psa_mf_MFAR_adj_jes(p_adj_rec in PSA_MFAR_UTILS.adj_rec)
83 RETURN varchar2
84 IS
85 BEGIN
86 RETURN 'TRUE';
87 END psa_mf_MFAR_adj_jes;
88
89 /*****************************************************/
90 /* Function to Insert RCT additionalMFAR jes into GL Interface */
91 /*****************************************************/
92 FUNCTION psa_mf_MFAR_rct_jes(p_rct_rec in PSA_MFAR_UTILS.rct_rec)
93 RETURN varchar2
94 IS
95 BEGIN
96 RETURN 'TRUE';
97 END psa_mf_MFAR_rct_jes;
98
99
100 function get_entered_dr_rct (p_lookup_code in number, p_amount in number,
101 p_discount in number,
102 p_ue_discount in number)
103 return number
104 is
105 the_amount number;
106 begin
107 if p_lookup_code in (1,2,3,4) then
108 the_amount := p_amount;
109 elsif p_lookup_code in (5,6,7,8) then
110 the_amount := p_discount;
111 elsif p_lookup_code in (9,10,11,12) then
112 the_amount := p_ue_discount;
113 end if;
114 if (the_amount >= 0) then -- positive
115 if p_lookup_code in (2,4,6,8,10,12) then --Even (Cr) Lines
116 the_amount := NULL;
117 end if;
118 elsif (the_amount < 0) then -- negative
119 if p_lookup_code in (1,3,5,7,9,11) then -- Odd (Dr) Lines
120 the_amount := NULL;
121 elsif p_lookup_code in (2,4,6,8,10,12) then --Even (Cr) Lines
122 the_amount := -1 * the_amount ;
123 end if;
124 end if;
125 return the_amount;
126 end;
127
128
129 function get_entered_cr_rct (p_lookup_code in number, p_amount in number,
130 p_discount in number,
131 p_ue_discount in number)
132 return number
133 is
134 the_amount number;
135 begin
136 if p_lookup_code in (1,2,3,4) then
137 the_amount := p_amount;
138 elsif p_lookup_code in (5,6,7,8) then
139 the_amount := p_discount;
140 elsif p_lookup_code in (9,10,11,12) then
141 the_amount := p_ue_discount;
142 end if;
143 if (the_amount >= 0) then -- positive
144 if p_lookup_code in (1,3,5,7,9,11) then --Odd (Dr) Lines
145 the_amount := NULL;
146 end if;
147 elsif (the_amount < 0) then -- negative
148 if p_lookup_code in (2,4,6,8,10,12) then -- Even (Cr) Lines
149 the_amount := NULL;
150 elsif p_lookup_code in (1,3,5,7,9,11) then --Odd (Dr) Lines
151 the_amount := -1 * the_amount ;
152 end if;
153 end if;
154 return the_amount;
155 end;
156
157
158 function get_entered_dr_adj (p_lookup_code in number, p_amount in number)
159 return number
160 is
161 the_amount number;
162 begin
163 the_amount := p_amount;
164 if (the_amount < 0) then -- negative
165 if p_lookup_code in (1,3) then --Odd (Dr) Lines
166 the_amount := -1 * the_amount ;
167 elsif p_lookup_code in (2,4) then --Even (Cr) Lines
168 the_amount := NULL;
169 end if;
170 elsif (the_amount >= 0) then -- positive
171 if p_lookup_code in (1,3) then -- Odd (Dr) Lines
172 the_amount := NULL;
173 end if;
174 end if;
175 return the_amount;
176 end;
177
178
179 function get_entered_cr_adj (p_lookup_code in number, p_amount in number)
180 return number
181 is
182 the_amount number;
183 begin
184 the_amount := p_amount;
185 if (the_amount < 0) then -- negative
186 if p_lookup_code in (1,3) then --Odd (Dr) Lines
187 the_amount := NULL;
188 elsif p_lookup_code in (2,4) then --Even (Cr) Lines
189 the_amount := -1 * the_amount ;
190 end if;
191 elsif (the_amount >= 0) then -- positive
192 if p_lookup_code in (2,4) then -- Even (Cr) Lines
193 the_amount := NULL;
194 end if;
195 end if;
196 return the_amount;
197 end;
198
199
200
201 function get_entered_cr_crm (p_lookup_code in number, p_amount in number)
202 return number
203 is
204 the_amount number := NULL;
205 begin
206 if p_lookup_code in (1) then
207 the_amount := p_amount * -1;
208 end if;
209 return the_amount;
210 end;
211
212 function get_entered_dr_crm (p_lookup_code in number, p_amount in number)
213 return number
214 is
215 the_amount number := NULL;
216 begin
217 if p_lookup_code in (2) then
218 the_amount := p_amount * -1;
219 end if;
220 return the_amount;
221 end;
222
223 END PSA_MF_GL_TRANSFER_PKG;