1 PACKAGE FA_TRANSFER_XIT_PKG AUTHID CURRENT_USER as
2 /* $Header: FAXTFRXS.pls 120.7 2009/04/15 15:13:43 bridgway ship $ */
3
4 /******************************************************************************
5
6 FUNCTION
7 fautfr() - FA Utility TransFeR asset
8
9 DESCRIPTION
10 This function is a generic transfer function, that transfers a single
11 asset's COST, DEPRN RSV, and REVAL RSV from one set of accounts to
12 another, for all of an asset's active distribution lines.
13
14 For intercompany transfers, it also inserts the appropriate
15 FA_ADJUSTMENTS rows as well, for those distributions that
16 have the balancing segment different from the distribution that
17 was transferred out of. FA_ADJUSTMENTS rows are inserted for
18 the AR_INTERCOMPANY_ACCT and AP_INTERCOMPANY_ACCT code combination
19 ids.
20
21 The accounts it transfers to/from are determined by the old
22 and new category ids passed in. (In the case of a transfer, these
23 two are the same, but in the general case, they may be different, ie
24 a reclassification).
25
26 This module assumes that the caller has terminated and inserted into
27 the FA_DISTRIBUTION_HISTORY table already with the thid parameter
28 passed into the function.
29
30 PARAMETERS
31 * X_thid
32 The transaction header id for the TRANSFER/UNIT ADJUSTMENT/RECLASS
33 TRANSACTION_TYPE_CODE which terminated the distributions.
34
35 * X_asset_id
36 The asset_id.
37
38 * X_book
39 book type code.
40
41 * X_txn_type_code
42 transaction type code, i.e TRANSFER/UNIT ADJUSTMENT/RECLASS.
43
44 * X_period_ctr
45 The period counter the transaction is occuring in. This gets
46 inserted into FA_ADJUSTMENTS as the
47 PERIOD_COUNTER_CREATED/ADJUSTED.
48
49 * X_current_units
50 Since we call in CLEAR mode, we don't need to know the old
51 number of units for UNIT ADJUSTMENTS, just pass in the new
52 number of units for this field.
53
54 * X_today
55 date in the format of 'DD-MON-YYYY HH24:MI:SS'
56
57 * X_old_cat_id
58 The asset_category_id before the transaction. For TRANSFERS,
59 old_cat_id = new_cat_id, but for RECLASSes, these will be
60 different. This determines the accounts to transfer to/from.
61
62 * X_new_cat_id
63 The new asset_category_id after the transaction.
64
65 * X_asset_type
66 The asset type, ie CIP, CAPITALIZED, or EXPENSED. We don't
67 insert any FA_ADJUSTMENTS rows for EXPENSED assets.
68
69 RETURNS
70 TRUE, on successful transfer
71 FALSE, for an error condition
72
73 HISTORY
74 04 Mar 1997 L Son Created
75
76 ******************************************************************************/
77
78
79 FUNCTION fautfr(X_thid IN NUMBER,
80 X_asset_id IN NUMBER,
81 X_book IN VARCHAR2,
82 X_txn_type_code IN VARCHAR2,
83 X_period_ctr IN NUMBER,
84 X_curr_units IN NUMBER,
85 X_today IN DATE,
86 X_old_cat_id IN NUMBER,
87 X_new_cat_id IN NUMBER,
88 X_asset_type IN VARCHAR2,
89 X_last_update_date IN DATE default sysdate,
90 X_last_updated_by IN NUMBER default -1,
91 X_last_update_login IN NUMBER default -1,
92 X_init_message_flag IN VARCHAR2 DEFAULT 'NO', p_log_level_rec IN FA_API_TYPES.log_level_rec_type)
93
94 return BOOLEAN;
95
96
97
98
99
100
101 /*****************************************************************************
102 NAME
103 fadotfr() - FA DO a TransFeR
104
105 DESCRIPTION
106 This function does a transfer for a single asset for a single type
107 of account; it both clears out the old amounts using the Insert
108 into FA_ADJUSTMENTS function's CLEAR mode, then puts the amounts
109 back in using the Insert into FA_ADJUSTMENTS function's ACTIVE mode.
110
111 PARAMETERS
112 X_adj_ptr - structure defined in fa_adjust_type_pkg
113
114 X_acctcode - constant value defined in the body of this package.
115 represents each account type for which fa_adjustments rows are
116 inserted (e.g FA_TFR_COST, FA_TFR_DEPRN_RSV etc.)
117
118 X_old_cat_id - category id of terminated distribution
119
120 X_new_cat_id - category id of new distribution
121
122 X_asset_type - asset_type ('CAPITALIZED', 'CIP' etc)
123
124 RETURNS
125 TRUE, on successful completion
126 FALSE, for an error condition
127
128 HISTORY
129 04 Mar 1997 L Son Created
130
131 ******************************************************************************/
132
133
134 FUNCTION fadotfr(X_adj_ptr IN OUT NOCOPY fa_adjust_type_pkg.fa_adj_row_struct,
135 X_acctcode IN NUMBER,
136 X_old_cat_id IN NUMBER,
137 X_new_cat_id IN NUMBER,
138 X_asset_type IN VARCHAR2,
139 X_last_update_date IN DATE default sysdate,
140 X_last_updated_by IN NUMBER default -1,
141 X_last_update_login IN NUMBER default -1,
142 X_mrc_sob_type_code IN VARCHAR2,
143 X_set_of_books_id IN NUMBER,
144 p_log_level_rec IN FA_API_TYPES.log_level_rec_type)
145
146 return BOOLEAN;
147
148
149
150
151
152
153
154 /*****************************************************************************
155 NAME
156 setacct() - SET the ACCounT information
157
158 DESCRIPTION
159 This function sets the account, account_type, debit_credit_flag,
160 and adjustment_type fields in the X_adj structure according to
161 the acctcode and the select_mode flags.
162
163 PARAMETERS
164 X_adj_ptr - record structure containing info to insert into fa_adjustments
165 X_acctcode - constant value representing each account type for which
166 fa_adjustment rows are inserted
167
168 X_select_mode - debit(DR) or credit(CR) is set depending on the mode
169
170 X_cat_id - category_id
171 X_asset_type - asset_type
172
173 RETURNS
174 TRUE, on successful completion
175 FALSE, for an error condition
176
177 HISTORY
178 04 Mar 1997 L Son Created
179
180 ******************************************************************************/
181
182 FUNCTION setacct(X_adj_ptr IN OUT NOCOPY fa_adjust_type_pkg.fa_adj_row_struct,
183 X_acctcode IN NUMBER,
184 X_select_mode IN NUMBER,
185 X_cat_id IN NUMBER,
186 X_asset_type IN VARCHAR2, p_log_level_rec IN FA_API_TYPES.log_level_rec_type)
187 return BOOLEAN;
188
189
190
191
192
193
194
195 /*****************************************************************************
196
197 NAME
198 fatsgl() -
199
200 DESCRIPTION
201 This function finds all distributions affected by the transfer in the
202 order of terminated distribution rows followed by active distribution rows.
203
204 For each fetched terminated distribution, 1) it calls query_balances_int to get
205 cost, depreciation reserve, revaluation reserve 2) accumulate total_cost,
206 total depreciation reserve, total revaluation reserve to re-distribute
207 to active distribution 3) insert rows into fa_adjustments to clear out the
208 amount from the terminated distribution.
209
210 For each fetched active distribution, 1)total cost, total deprn reserve
211 and total reval reserve accumulated above will be prorated to each distribution
212 based on its units assigned 2) insert rows with prorated amount into fa_adjustments
213 3) last distribution will get the remaning pennies leftover from doing rounding.
214
215
216 PARAMETERS
217 X_adj - record structure containning info for fa_adjusment row
218 X_cat_id - category_id
219 X_asset_type - asset_type
220
221 RETURNS
222 TRUE, on successful completion
223 FALSE, for an error condition
224
225 HISTORY
226 04 Mar 1997 L Son Created
227
228 ******************************************************************************/
229
230
231 FUNCTION fatsgl(X_adj IN OUT NOCOPY fa_adjust_type_pkg.fa_adj_row_struct,
232 X_cat_id IN NUMBER,
233 X_asset_type IN VARCHAR2,
234 X_last_update_date IN DATE default sysdate,
235 X_last_updated_by IN NUMBER default -1,
236 X_last_update_login IN NUMBER default -1,
237 X_mrc_sob_type_code IN VARCHAR2,
238 X_set_of_books_id IN NUMBER,
239 p_log_level_rec IN FA_API_TYPES.log_level_rec_type)
240 return BOOLEAN;
241
242
243 /*===========================================================================
244 |
245 | NAME: faumvexp() - FA Move Expense
246 |
247 | DESCRIPTION: Move catchup expense like amort adj expense
248 | to a new distribution for reclass in period of addition
249 |
250 | RETURNS: TRUE, on successful completion
251 | FALSE, on error condition
252 |
253 | History
254 | 16-Aug-2005 YYOON Created
255 |
256 ============================================================================*/
257
258 FUNCTION faumvexp(X_asset_id NUMBER
259 ,X_book_type_code VARCHAR2
260 ,X_th_id NUMBER
261 ,X_to_category_id NUMBER
262 ,X_exp_moved OUT NOCOPY BOOLEAN
263 ,X_last_update_date DATE
264 ,X_last_updated_by NUMBER
265 ,X_last_update_login NUMBER
266 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN;
267
268 FUNCTION faucper(X_asset_id NUMBER,
269 X_is_prior_period IN OUT NOCOPY BOOLEAN,
270 X_book VARCHAR2, p_log_level_rec IN FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN;
271
272
273 END FA_TRANSFER_XIT_PKG;