1 PACKAGE FA_TRANSFER_XIT_PKG as
2 /* $Header: FAXTFRXS.pls 120.5 2005/07/28 00:15:17 tkawamur 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',
93 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
94
95 return BOOLEAN;
96
97
98
99
100
101
102 /*****************************************************************************
103 NAME
104 fadotfr() - FA DO a TransFeR
105
106 DESCRIPTION
107 This function does a transfer for a single asset for a single type
108 of account; it both clears out the old amounts using the Insert
109 into FA_ADJUSTMENTS function's CLEAR mode, then puts the amounts
110 back in using the Insert into FA_ADJUSTMENTS function's ACTIVE mode.
111
112 PARAMETERS
113 X_adj_ptr - structure defined in fa_adjust_type_pkg
114
115 X_acctcode - constant value defined in the body of this package.
116 represents each account type for which fa_adjustments rows are
117 inserted (e.g FA_TFR_COST, FA_TFR_DEPRN_RSV etc.)
118
119 X_old_cat_id - category id of terminated distribution
120
121 X_new_cat_id - category id of new distribution
122
123 X_asset_type - asset_type ('CAPITALIZED', 'CIP' etc)
124
125 RETURNS
126 TRUE, on successful completion
127 FALSE, for an error condition
128
129 HISTORY
130 04 Mar 1997 L Son Created
131
132 ******************************************************************************/
133
134
135 FUNCTION fadotfr(X_adj_ptr IN OUT NOCOPY fa_adjust_type_pkg.fa_adj_row_struct,
136 X_acctcode IN NUMBER,
137 X_old_cat_id IN NUMBER,
138 X_new_cat_id IN NUMBER,
139 X_asset_type IN VARCHAR2,
140 X_last_update_date IN DATE default sysdate,
141 X_last_updated_by IN NUMBER default -1,
142 X_last_update_login IN NUMBER default -1,
143 X_mrc_sob_type_code IN VARCHAR2,
144 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
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,
187 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
188 return BOOLEAN;
189
190
191
192
193
194
195
196 /*****************************************************************************
197
198 NAME
199 fatsgl() -
200
201 DESCRIPTION
202 This function finds all distributions affected by the transfer in the
203 order of terminated distribution rows followed by active distribution rows.
204
205 For each fetched terminated distribution, 1) it calls query_balances_int to get
206 cost, depreciation reserve, revaluation reserve 2) accumulate total_cost,
207 total depreciation reserve, total revaluation reserve to re-distribute
208 to active distribution 3) insert rows into fa_adjustments to clear out the
209 amount from the terminated distribution.
210
211 For each fetched active distribution, 1)total cost, total deprn reserve
212 and total reval reserve accumulated above will be prorated to each distribution
213 based on its units assigned 2) insert rows with prorated amount into fa_adjustments
214 3) last distribution will get the remaning pennies leftover from doing rounding.
215
216
217 PARAMETERS
218 X_adj - record structure containning info for fa_adjusment row
219 X_cat_id - category_id
220 X_asset_type - asset_type
221
222 RETURNS
223 TRUE, on successful completion
224 FALSE, for an error condition
225
226 HISTORY
227 04 Mar 1997 L Son Created
228
229 ******************************************************************************/
230
231
232 FUNCTION fatsgl(X_adj IN OUT NOCOPY fa_adjust_type_pkg.fa_adj_row_struct,
233 X_cat_id IN NUMBER,
234 X_asset_type IN VARCHAR2,
235 X_last_update_date IN DATE default sysdate,
236 X_last_updated_by IN NUMBER default -1,
237 X_last_update_login IN NUMBER default -1,
238 X_mrc_sob_type_code IN VARCHAR2,
239 p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null)
240 return BOOLEAN;
241
242
243
244 END FA_TRANSFER_XIT_PKG;