DBA Data[Home] [Help]

APPS.FA_GAINLOSS_UND_PKG dependencies on FA_DISTRIBUTION_HISTORY

Line 1145: FROM fa_distribution_history fadh,

1141:
1142: --Select active distribution_ids
1143: CURSOR TRET IS
1144: SELECT fadh.distribution_id
1145: FROM fa_distribution_history fadh,
1146: fa_book_controls bc
1147: WHERE fadh.asset_id = h_asset_id
1148: AND fadh.book_type_code = bc.distribution_source_book
1149: AND bc.book_type_code = h_book

Line 1156: FROM fa_distribution_history dh,

1152:
1153: -- Select distribution_ids that were retired
1154: CURSOR PRET IS
1155: SELECT dh.distribution_id
1156: FROM fa_distribution_history dh,
1157: fa_book_controls bc,
1158: fa_retirements rt
1159: WHERE dh.asset_id = h_asset_id
1160: AND dh.book_type_code = bc.distribution_source_book

Line 1172: FROM fa_distribution_history dh_old,

1168: -- Bug 5149832, 5237765, 5251944
1169: CURSOR OLD_NEW_DIST IS
1170: SELECT dh_old.distribution_id,
1171: dh_new.distribution_id
1172: FROM fa_distribution_history dh_old,
1173: fa_distribution_history dh_new,
1174: fa_book_controls bc,
1175: fa_transaction_headers th
1176: WHERE th.transaction_header_id = h_rethdrout

Line 1173: fa_distribution_history dh_new,

1169: CURSOR OLD_NEW_DIST IS
1170: SELECT dh_old.distribution_id,
1171: dh_new.distribution_id
1172: FROM fa_distribution_history dh_old,
1173: fa_distribution_history dh_new,
1174: fa_book_controls bc,
1175: fa_transaction_headers th
1176: WHERE th.transaction_header_id = h_rethdrout
1177: and th.asset_id = h_asset_id

Line 1187: from fa_distribution_history dh_pret

1183: (dh_old.units_assigned + dh_old.transaction_units = 0 -- FULL RET in dh_old DH row
1184: OR
1185: exists
1186: (select 1 -- PARTIAL RET in dh_pret DH row
1187: from fa_distribution_history dh_pret
1188: where dh_pret.asset_id = dh_old.asset_id
1189: and dh_pret.book_type_code = dh_old.book_type_code
1190: and dh_pret.transaction_header_id_out = DH_OLD.transaction_header_id_in
1191: and DH_OLD.transaction_units is NULL

Line 1206: FROM fa_distribution_history dh

1202:
1203:
1204: CURSOR UPD_DIST IS
1205: SELECT dh.distribution_id
1206: FROM fa_distribution_history dh
1207: WHERE dh.book_type_code = h_book
1208: AND dh.asset_id = h_asset_id
1209: AND dh.transaction_header_id_out is null
1210: AND exists

Line 1213: FROM fa_distribution_history ret

1209: AND dh.transaction_header_id_out is null
1210: AND exists
1211: (
1212: SELECT 'x'
1213: FROM fa_distribution_history ret
1214: WHERE ret.book_type_code = h_book
1215: AND ret.asset_id = h_asset_id
1216: AND ret.retirement_id = h_ret_id
1217: AND ret.code_combination_id = dh.code_combination_id

Line 1225: FROM fa_distribution_history dh

1221:
1222: CURSOR CRET IS
1223: SELECT dh.distribution_id,
1224: dh.units_assigned
1225: FROM fa_distribution_history dh
1226: WHERE dh.book_type_code = h_book
1227: AND dh.asset_id = h_asset_id
1228: AND dh.transaction_header_id_out = h_rethdrout
1229: UNION

Line 1231: FROM fa_distribution_history r

1227: AND dh.asset_id = h_asset_id
1228: AND dh.transaction_header_id_out = h_rethdrout
1229: UNION
1230: SELECT r.distribution_id, 0 - nvl (r.transaction_units, 0)
1231: FROM fa_distribution_history r
1232: WHERE r.book_type_code = h_book
1233: AND r.asset_id = h_asset_id
1234: AND r.retirement_id = h_ret_id
1235: AND not exists

Line 1238: FROM fa_distribution_history d

1234: AND r.retirement_id = h_ret_id
1235: AND not exists
1236: (
1237: SELECT 'x'
1238: FROM fa_distribution_history d
1239: WHERE d.book_type_code = h_book
1240: AND d.asset_id = h_asset_id
1241: AND d.transaction_header_id_out = h_rethdrout
1242: AND r.code_combination_id = d.code_combination_id

Line 1253: from fa_distribution_history d1,

1249: * for all updates in the case of multi-distributed assets
1250: */
1251: CURSOR CHG_DIST IS
1252: select d1.distribution_id
1253: from fa_distribution_history d1,
1254: fa_distribution_history d2
1255: where d2.book_type_code = h_book
1256: and d2.asset_id = h_asset_id
1257: and d1.book_type_code = d2.book_type_code

Line 1254: fa_distribution_history d2

1250: */
1251: CURSOR CHG_DIST IS
1252: select d1.distribution_id
1253: from fa_distribution_history d1,
1254: fa_distribution_history d2
1255: where d2.book_type_code = h_book
1256: and d2.asset_id = h_asset_id
1257: and d1.book_type_code = d2.book_type_code
1258: and d1.asset_id = d2.asset_id

Line 1678: FROM FA_DISTRIBUTION_HISTORY fadh

1674: BEGIN
1675: SELECT distinct fadh.TRANSACTION_HEADER_ID_OUT,
1676: DECODE(fadh.TRANSACTION_HEADER_ID_OUT, null, 0, 1)
1677: INTO h_dist_hdrout, h_drflag
1678: FROM FA_DISTRIBUTION_HISTORY fadh
1679: WHERE fadh.retirement_id = h_ret_id;
1680: EXCEPTION
1681: WHEN NO_DATA_FOUND then
1682: NULL;

Line 1774: element => 'Update FA_DISTRIBUTION_HISTORY',

1770:
1771: if g_print_debug then
1772: fa_debug_pkg.add
1773: (fname => l_calling_fn,
1774: element => 'Update FA_DISTRIBUTION_HISTORY',
1775: value => '');
1776: end if;
1777:
1778: -- bugfix for 991646.

Line 1784: -- fa_distribution_history is bypassed and it moves on to create new

1780: -- asset that are
1781: -- retired are reinstated, no need to terminate any distribution rows
1782: -- as in the case
1783: -- for all other partial retirement case. Hence the following update of
1784: -- fa_distribution_history is bypassed and it moves on to create new
1785: -- distribution rows with original units before the retirement
1786:
1787: -- Fix for Bug #1256872. Select the active distributions
1788: -- to be terminated. They will be the duplicates of the

Line 1814: from fa_distribution_history

1810: -- abs(transaction_units) = units_assigned.
1811:
1812: select count(*)
1813: into h_count
1814: from fa_distribution_history
1815: where transaction_header_id_out = h_dist_hdrout
1816: and book_type_code = h_book
1817: and asset_id = h_asset_id
1818: and retirement_id = h_ret_id;

Line 1841: -- UPDATING FA_DISTRIBUTION_HISTORY

1837: element => '+++ Step 4.6',
1838: value => '');
1839: end if;
1840:
1841: -- UPDATING FA_DISTRIBUTION_HISTORY
1842: -- if (h_mrc_primary_book_flag = 1) then
1843: if (ret.mrc_sob_type_code <> 'R') then
1844: UPDATE FA_DISTRIBUTION_HISTORY
1845: SET date_ineffective =

Line 1844: UPDATE FA_DISTRIBUTION_HISTORY

1840:
1841: -- UPDATING FA_DISTRIBUTION_HISTORY
1842: -- if (h_mrc_primary_book_flag = 1) then
1843: if (ret.mrc_sob_type_code <> 'R') then
1844: UPDATE FA_DISTRIBUTION_HISTORY
1845: SET date_ineffective =
1846: h_today, -- to_date(h_today,'DD/MM/YYYY hh24:mi:ss'),
1847: transaction_header_id_out = h_rethdrout,
1848: last_update_date =

Line 1853: -- END UPDATING FA_DISTRIBUTION_HISTORY

1849: h_today, -- to_date(h_today,'DD/MM/YYYY hh24:mi:ss'),
1850: last_updated_by = h_user_id
1851: WHERE distribution_id = h_rdistid;
1852: end if;
1853: -- END UPDATING FA_DISTRIBUTION_HISTORY
1854: upd_ctr := upd_ctr + 1;
1855:
1856: if g_print_debug then
1857: fa_debug_pkg.add

Line 1966: element => 'Update FA_DISTRIBUTION_HISTORY (FULL RETIREMENT)',

1962:
1963: if g_print_debug then
1964: fa_debug_pkg.add
1965: (fname => l_calling_fn,
1966: element => 'Update FA_DISTRIBUTION_HISTORY (FULL RETIREMENT)',
1967: value => '');
1968: end if;
1969:
1970: -- UPDATING FA_DISTRIBUTION_HISTORY

Line 1970: -- UPDATING FA_DISTRIBUTION_HISTORY

1966: element => 'Update FA_DISTRIBUTION_HISTORY (FULL RETIREMENT)',
1967: value => '');
1968: end if;
1969:
1970: -- UPDATING FA_DISTRIBUTION_HISTORY
1971: --if (h_mrc_primary_book_flag = 1) then
1972: if (ret.mrc_sob_type_code <> 'R') then
1973: UPDATE FA_DISTRIBUTION_HISTORY
1974: SET date_ineffective =

Line 1973: UPDATE FA_DISTRIBUTION_HISTORY

1969:
1970: -- UPDATING FA_DISTRIBUTION_HISTORY
1971: --if (h_mrc_primary_book_flag = 1) then
1972: if (ret.mrc_sob_type_code <> 'R') then
1973: UPDATE FA_DISTRIBUTION_HISTORY
1974: SET date_ineffective =
1975: today,
1976: transaction_header_id_out = h_rethdrout,
1977: last_update_date =

Line 1989: element => 'Update FA_DISTRIBUTION_HISTORY (new)',

1985:
1986: if g_print_debug then
1987: fa_debug_pkg.add
1988: (fname => l_calling_fn,
1989: element => 'Update FA_DISTRIBUTION_HISTORY (new)',
1990: value => '');
1991: end if;
1992:
1993: -- Fix for Bug #1256872. Select the active distributions

Line 2007: Select FA_DISTRIBUTION_HISTORY_s.nextval

2003: FETCH CRET INTO h_rdistid, h_units_assigned;
2004: exit when CRET%notfound or CRET%notfound IS NULL;
2005:
2006: BEGIN
2007: Select FA_DISTRIBUTION_HISTORY_s.nextval
2008: into new_distid
2009: from dual;
2010: EXCEPTION
2011: when others then

Line 2030: FROM fa_distribution_history ret

2026:
2027: BEGIN
2028: SELECT 0 - nvl (ret.transaction_units, 0)
2029: INTO h_units_retired
2030: FROM fa_distribution_history ret
2031: WHERE ret.book_type_code = h_book
2032: AND ret.asset_id = h_asset_id
2033: AND ret.retirement_id = h_ret_id
2034: AND exists

Line 2037: FROM fa_distribution_history dh

2033: AND ret.retirement_id = h_ret_id
2034: AND exists
2035: (
2036: SELECT 'x'
2037: FROM fa_distribution_history dh
2038: WHERE dh.book_type_code = h_book
2039: AND dh.asset_id = h_asset_id
2040: AND dh.distribution_id = h_rdistid
2041: AND dh.distribution_id <> ret.distribution_id

Line 2051: -- INSERTING FA_DISTRIBUTION_HISTORY

2047: WHEN NO_DATA_FOUND then
2048: NULL;
2049: END;
2050:
2051: -- INSERTING FA_DISTRIBUTION_HISTORY
2052: --if (h_mrc_primary_book_flag = 1) then
2053: if (ret.mrc_sob_type_code <> 'R') then
2054: INSERT INTO FA_DISTRIBUTION_HISTORY
2055: (distribution_id, book_type_code, asset_id,

Line 2054: INSERT INTO FA_DISTRIBUTION_HISTORY

2050:
2051: -- INSERTING FA_DISTRIBUTION_HISTORY
2052: --if (h_mrc_primary_book_flag = 1) then
2053: if (ret.mrc_sob_type_code <> 'R') then
2054: INSERT INTO FA_DISTRIBUTION_HISTORY
2055: (distribution_id, book_type_code, asset_id,
2056: units_assigned, date_effective, date_ineffective,
2057: code_Combination_id,
2058: location_id, assigned_to, transaction_header_id_in,

Line 2067: FROM FA_DISTRIBUTION_HISTORY

2063: null, code_Combination_id,
2064: location_id, assigned_to, h_rethdrout,
2065: null, null, null, today,
2066: user_id
2067: FROM FA_DISTRIBUTION_HISTORY
2068: WHERE distribution_id = h_rdistid;
2069:
2070: end if;
2071:

Line 2088: FROM fa_distribution_history r

2084: WHERE TRANSACTION_HEADER_ID = h_rethdrout
2085: AND DISTRIBUTION_ID =
2086: (
2087: SELECT DISTINCT r.distribution_id
2088: FROM fa_distribution_history r
2089: WHERE r.book_type_code = h_book
2090: AND r.asset_id = h_asset_id
2091: AND r.retirement_id = h_ret_id
2092: AND exists

Line 2095: FROM fa_distribution_history d

2091: AND r.retirement_id = h_ret_id
2092: AND exists
2093: (
2094: SELECT 'x'
2095: FROM fa_distribution_history d
2096: WHERE d.book_type_code = h_book
2097: AND d.asset_id = h_asset_id
2098: AND d.distribution_id = h_rdistid
2099: AND r.code_combination_id = d.code_combination_id

Line 2124: FROM fa_distribution_history n

2120: "o.distribution_id = h_rdistid" were contradicting so splitted them. */
2121:
2122: Cursor C1 is
2123: SELECT DISTINCT n.distribution_id
2124: FROM fa_distribution_history n
2125: WHERE n.book_type_code = h_book
2126: AND n.asset_id = h_asset_id
2127: AND n.date_ineffective is null
2128: AND exists

Line 2131: FROM fa_distribution_history o

2127: AND n.date_ineffective is null
2128: AND exists
2129: (
2130: SELECT 'x'
2131: FROM fa_distribution_history o
2132: WHERE o.book_type_code = h_book
2133: AND o.asset_id = h_asset_id
2134: --AND o.retirement_id = h_ret_id
2135: AND o.distribution_id = h_rdistid -- added for bug 2775057

Line 2143: FROM fa_distribution_history o

2139: )
2140: AND exists
2141: (
2142: SELECT 'x'
2143: FROM fa_distribution_history o
2144: WHERE o.book_type_code = h_book
2145: AND o.asset_id = h_asset_id
2146: AND o.retirement_id = h_ret_id
2147: --AND o.distribution_id = h_rdistid -- added for bug 2775057

Line 2161: FROM fa_distribution_history r

2157: -- Fix for Bug #3678791. Break previous update statement
2158: -- into multiple smaller statements.
2159: SELECT DISTINCT r.distribution_id
2160: INTO l_temp_dist_id1
2161: FROM fa_distribution_history r
2162: WHERE r.book_type_code = h_book
2163: AND r.asset_id = h_asset_id
2164: AND r.retirement_id = h_ret_id
2165: AND exists

Line 2168: FROM fa_distribution_history d

2164: AND r.retirement_id = h_ret_id
2165: AND exists
2166: (
2167: SELECT 'x'
2168: FROM fa_distribution_history d
2169: WHERE d.book_type_code = h_book
2170: AND d.asset_id = h_asset_id
2171: AND d.distribution_id = h_rdistid
2172: AND r.code_combination_id = d.code_combination_id

Line 2193: from fa_distribution_history d1,

2189: if (h_drflag = 0) then -- if fully retired
2190: BEGIN
2191: select d1.distribution_id
2192: into h_adj_distid
2193: from fa_distribution_history d1,
2194: fa_distribution_history d2
2195: where d2.book_type_code = h_book
2196: and d2.asset_id = h_asset_id
2197: and d1.book_type_code = d2.book_type_code

Line 2194: fa_distribution_history d2

2190: BEGIN
2191: select d1.distribution_id
2192: into h_adj_distid
2193: from fa_distribution_history d1,
2194: fa_distribution_history d2
2195: where d2.book_type_code = h_book
2196: and d2.asset_id = h_asset_id
2197: and d1.book_type_code = d2.book_type_code
2198: and d1.asset_id = d2.asset_id

Line 2238: FROM fa_distribution_history r

2234: AND DISTRIBUTION_ID <> h_adj_distid
2235: AND DISTRIBUTION_ID =
2236: (
2237: SELECT DISTINCT r.distribution_id
2238: FROM fa_distribution_history r
2239: WHERE r.book_type_code = h_book
2240: AND r.asset_id = h_asset_id
2241: AND r.transaction_header_id_in =
2242: (

Line 2244: FROM fa_distribution_history

2240: AND r.asset_id = h_asset_id
2241: AND r.transaction_header_id_in =
2242: (
2243: SELECT DISTINCT transaction_header_id_out
2244: FROM fa_distribution_history
2245: WHERE book_type_code = h_book
2246: AND asset_id = h_asset_id
2247: AND retirement_id = h_ret_id
2248: )

Line 2252: FROM fa_distribution_history d

2248: )
2249: AND exists
2250: (
2251: SELECT 'x'
2252: FROM fa_distribution_history d
2253: WHERE d.book_type_code = h_book
2254: AND d.asset_id = h_asset_id
2255: AND d.distribution_id = h_rdistid
2256: AND r.code_combination_id = d.code_combination_id

Line 2264: FROM fa_distribution_history

2260: )
2261: AND not exists
2262: (
2263: SELECT 'x'
2264: FROM fa_distribution_history
2265: WHERE book_type_code = h_book
2266: AND asset_id = h_asset_id
2267: AND retirement_id = h_ret_id
2268: AND distribution_id = h_adj_distid

Line 2280: FROM fa_distribution_history r

2276: AND DISTRIBUTION_ID <> h_adj_distid
2277: AND DISTRIBUTION_ID =
2278: (
2279: SELECT DISTINCT r.distribution_id
2280: FROM fa_distribution_history r
2281: WHERE r.book_type_code = h_book
2282: AND r.asset_id = h_asset_id
2283: AND r.transaction_header_id_in =
2284: (

Line 2286: FROM fa_distribution_history

2282: AND r.asset_id = h_asset_id
2283: AND r.transaction_header_id_in =
2284: (
2285: SELECT DISTINCT transaction_header_id_out
2286: FROM fa_distribution_history
2287: WHERE book_type_code = h_book
2288: AND asset_id = h_asset_id
2289: AND retirement_id = h_ret_id
2290: )

Line 2294: FROM fa_distribution_history d

2290: )
2291: AND exists
2292: (
2293: SELECT 'x'
2294: FROM fa_distribution_history d
2295: WHERE d.book_type_code = h_book
2296: AND d.asset_id = h_asset_id
2297: AND d.distribution_id = h_rdistid
2298: AND r.code_combination_id = d.code_combination_id

Line 2306: FROM fa_distribution_history

2302: )
2303: AND not exists
2304: (
2305: SELECT 'x'
2306: FROM fa_distribution_history
2307: WHERE book_type_code = h_book
2308: AND asset_id = h_asset_id
2309: AND retirement_id = h_ret_id
2310: AND distribution_id = h_adj_distid

Line 2592: FROM fa_distribution_history dh_old,

2588: SELECT dh_old.distribution_id,
2589: dh_new.distribution_id,
2590: dh_old.code_combination_id,
2591: dh_new.code_combination_id
2592: FROM fa_distribution_history dh_old,
2593: fa_distribution_history dh_new
2594: WHERE
2595: dh_old.retirement_id = h_retirement_id and
2596: dh_old.book_type_code = RET.book and

Line 2593: fa_distribution_history dh_new

2589: dh_new.distribution_id,
2590: dh_old.code_combination_id,
2591: dh_new.code_combination_id
2592: FROM fa_distribution_history dh_old,
2593: fa_distribution_history dh_new
2594: WHERE
2595: dh_old.retirement_id = h_retirement_id and
2596: dh_old.book_type_code = RET.book and
2597: dh_old.units_assigned + dh_old.transaction_units <> 0

Line 3237: FA_DISTRIBUTION_HISTORY dh,

3233: (dh.units_assigned / ah.units)
3234: * expense_amount -
3235: nvl(adj.adjustment_amount, 0)
3236: FROM
3237: FA_DISTRIBUTION_HISTORY dh,
3238: FA_ASSET_HISTORY ah,
3239: FA_ADJUSTMENTS adj
3240: WHERE dh.asset_id = RET.asset_id
3241: AND dh.book_type_code = BK.dis_book

Line 3260: FA_DISTRIBUTION_HISTORY dh,

3256: (dh.units_assigned / ah.units)
3257: * expense_amount -
3258: nvl(adj.adjustment_amount, 0)
3259: FROM
3260: FA_DISTRIBUTION_HISTORY dh,
3261: FA_ASSET_HISTORY ah,
3262: FA_ADJUSTMENTS_MRC_V adj
3263: WHERE dh.asset_id = RET.asset_id
3264: AND dh.book_type_code = BK.dis_book

Line 3282: fa_distribution_history fadh,

3278: faadj.distribution_id,
3279: faadj.code_combination_id,
3280: - 1 * faadj.adjustment_amount
3281: FROM
3282: fa_distribution_history fadh,
3283: fa_adjustments faadj
3284: WHERE fadh.asset_id(+) = RET.asset_id
3285: AND fadh.book_type_code(+) = BK.dis_book
3286: AND fadh.date_ineffective(+) is null

Line 3302: fa_distribution_history fadh,

3298: faadj.distribution_id,
3299: faadj.code_combination_id,
3300: - 1 * faadj.adjustment_amount
3301: FROM
3302: fa_distribution_history fadh,
3303: fa_adjustments_mrc_v faadj
3304: WHERE fadh.asset_id(+) = RET.asset_id
3305: AND fadh.book_type_code(+) = BK.dis_book
3306: AND fadh.date_ineffective(+) is null

Line 3324: FROM FA_RETIREMENTS faret, fa_distribution_history fadh,

3320: fadh.code_combination_id,
3321: (ABS(fadh.transaction_units) / faret.units)
3322: * expense_amount -
3323: NVL(faadj.adjustment_amount, 0)
3324: FROM FA_RETIREMENTS faret, fa_distribution_history fadh,
3325: fa_adjustments faadj
3326: WHERE fadh.asset_id = RET.asset_id
3327: AND fadh.book_type_code = BK.dis_book
3328: AND fadh.retirement_id = RET.retirement_id

Line 3345: FROM FA_RETIREMENTS_MRC_V faret, fa_distribution_history fadh,

3341: fadh.code_combination_id,
3342: (ABS(fadh.transaction_units) / faret.units)
3343: * expense_amount -
3344: NVL(faadj.adjustment_amount, 0)
3345: FROM FA_RETIREMENTS_MRC_V faret, fa_distribution_history fadh,
3346: fa_adjustments_mrc_v faadj
3347: WHERE fadh.asset_id = RET.asset_id
3348: AND fadh.book_type_code = BK.dis_book
3349: AND fadh.retirement_id = RET.retirement_id

Line 3366: FA_DISTRIBUTION_HISTORY fadh,

3362: faadj.code_combination_id,
3363: - 1 * faadj.adjustment_amount
3364: FROM
3365: FA_RETIREMENTS faret,
3366: FA_DISTRIBUTION_HISTORY fadh,
3367: FA_ADJUSTMENTS faadj
3368: WHERE fadh.asset_id(+) = RET.asset_id
3369: AND fadh.book_type_code(+) = BK.dis_book
3370: AND fadh.retirement_id(+) = RET.retirement_id

Line 3388: FA_DISTRIBUTION_HISTORY fadh,

3384: faadj.code_combination_id,
3385: - 1 * faadj.adjustment_amount
3386: FROM
3387: FA_RETIREMENTS_MRC_V faret,
3388: FA_DISTRIBUTION_HISTORY fadh,
3389: FA_ADJUSTMENTS_MRC_V faadj
3390: WHERE fadh.asset_id(+) = RET.asset_id
3391: AND fadh.book_type_code(+) = BK.dis_book
3392: AND fadh.retirement_id(+) = RET.retirement_id